posthog-js 1.391.6 → 1.391.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- function e(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function t(t){return function(){var i=this,s=arguments;return new Promise((function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}var s="1.391.6",r={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},n="$people_distinct_id",o="$device_id",a="__alias",l="__timers",_="$dead_clicks_enabled_server_side",u="$session_recording_remote_config",d="$sesid",c="$session_is_sampled",h="$enabled_feature_flags",p="$surveys_loaded_at",g="$flag_call_reported",v="$feature_flag_evaluated_at",f="$user_state",m="$client_session_props",y="$capture_rate_limit",b="$initial_campaign_params",w="$initial_referrer_info",S="$initial_person_info",x="$epp",E="$posthog_cookieless",P="$sdk_debug_extensions_init_method",T="$sdk_debug_extensions_init_time_ms",I="on_reject",k="always",R="anonymous",C="identified",O="identified_only",A="visibilitychange",F="beforeunload",L="$pageview",M="$pageleave",D="$identify",U="$groupidentify",N="undefined"!=typeof window?window:void 0,q="undefined"!=typeof globalThis?globalThis:N;"undefined"==typeof self&&(q.self=q),"undefined"==typeof File&&(q.File=function(){});var B,H=null==q?void 0:q.navigator,G=null==q?void 0:q.document,z=null==q?void 0:q.location,V=null==q?void 0:q.fetch,j=null!=q&&q.XMLHttpRequest&&"withCredentials"in new q.XMLHttpRequest?q.XMLHttpRequest:void 0,W=null==q?void 0:q.AbortController,Y=null==q?void 0:q.CompressionStream,K=null==H?void 0:H.userAgent,J=null!=N?N:{},Q=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),X=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],Z=["token"],ee="NativeGzipValidationError",te=e=>e.length>=2&&31===e[0]&&139===e[1],ie=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),se=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=ee,t},re=function(){var e=t((function*(e,t){18>e.size&&se("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());te(i)&&8===i[2]||se("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(B)return B;B=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;B[e]=t>>>0}return B})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&se("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&se("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function ne(){return ne=t((function*(e,i,s){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(e),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then((()=>o.close())).catch(function(){var e=t((function*(e){try{yield o.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),[_]=yield Promise.all([l,a]);return yield re(_,r),_}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),ne.apply(this,arguments)}var oe=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],ae=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return oe.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function le(e,t){return-1!==e.indexOf(t)}var _e=function(e){return e.replace(/^\$/,"")},ue=Object.prototype,de=ue.hasOwnProperty,ce=ue.toString,he=Array.isArray||function(e){return"[object Array]"===ce.call(e)},pe=e=>"function"==typeof e,ge=e=>e===Object(e)&&!he(e),ve=e=>{if(ge(e)){for(var t in e)if(de.call(e,t))return!1;return!0}return!1},fe=e=>void 0===e,me=e=>"[object String]"==ce.call(e),ye=e=>me(e)&&0===e.trim().length,be=e=>null===e,we=e=>fe(e)||be(e),Se=e=>"[object Number]"==ce.call(e)&&e==e,xe=e=>Se(e)&&e>0,Ee=e=>"[object Boolean]"===ce.call(e),Pe=e=>e instanceof FormData,Te=e=>le(X,e),Ie=e=>le(Z,e),ke=[!0,"true",1,"1","yes"],$e=e=>le(ke,e),Re=[!1,"false",0,"0","no"];function Ce(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Se(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Ce(r||i,t,i,s))}var Oe="Mobile",Ae="iOS",Fe="Android",Le="Tablet",Me=Fe+" "+Le,De="iPad",Ue="Apple",Ne=Ue+" Watch",qe="Safari",Be="BlackBerry",He="Samsung",Ge=He+"Browser",ze=He+" Internet",Ve="Chrome",je=Ve+" OS",We=Ve+" "+Ae,Ye="Internet Explorer",Ke=Ye+" "+Oe,Je="Opera",Qe=Je+" Mini",Xe="Edge",Ze="Microsoft "+Xe,et="Firefox",tt=et+" "+Ae,it="Nintendo",st="PlayStation",rt="Xbox",nt=Fe+" "+Oe,ot=Oe+" "+qe,at="Windows",lt=at+" Phone",_t="Nokia",ut="Ouya",dt="Generic",ct=dt+" "+Oe.toLowerCase(),ht=dt+" "+Le.toLowerCase(),pt="Konqueror",gt="Oculus Browser",vt="Vivaldi",ft="Yandex",mt="Whale",yt="DuckDuckGo",bt="Pale Moon",wt="Waterfox",St="Brave",xt="Google Search App",Et="(\\d+(\\.\\d+)?)",Pt=new RegExp("Version/"+Et),Tt=new RegExp(rt,"i"),It=new RegExp(st+" \\w+","i"),kt=new RegExp(it+" \\w+","i"),$t=new RegExp(Be+"|PlayBook|BB10","i"),Rt={"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"},Ct=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?St:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&le(e,"GSA/")?xt:le(e," OPR/")&&le(e,"Mini")?Qe:le(e," OPR/")?Je:$t.test(e)?Be:le(e,"IE"+Oe)||le(e,"WPDesktop")?Ke:le(e,"OculusBrowser")?gt:le(e,Ge)?ze:le(e,Xe)||le(e,"Edg/")?Ze:le(e,vt+"/")?vt:le(e,"YaBrowser/")?ft:le(e,mt+"/")?mt:le(e,yt+"/")||le(e,"Ddg/")?yt:le(e,"FBIOS")?"Facebook "+Oe:le(e,"UCWEB")||le(e,"UCBrowser")?"UC Browser":le(e,"CriOS")?We:le(e,"CrMo")||le(e,Ve)?Ve:le(e,Fe)&&le(e,qe)?nt:le(e,"FxiOS")?tt:le(e.toLowerCase(),pt.toLowerCase())?pt:le(e,St+"/")?St:((e,t)=>t&&le(t,Ue)||function(e){return le(e,qe)&&!le(e,Ve)&&!le(e,Fe)}(e))(e,t)?le(e,Oe)?ot:qe:le(e,"PaleMoon/")?bt:le(e,wt+"/")?wt:le(e,et)?et:le(e,"MSIE")||le(e,"Trident/")?Ye:le(e,"Gecko")?et:"")},Ot={[Ke]:[new RegExp("rv:"+Et)],[Ze]:[new RegExp(Xe+"?\\/"+Et)],[Ve]:[new RegExp("("+Ve+"|CrMo)\\/"+Et)],[We]:[new RegExp("CriOS\\/"+Et)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Et)],[qe]:[Pt],[ot]:[Pt],[Je]:[new RegExp("(Opera|OPR)\\/"+Et)],[et]:[new RegExp(et+"\\/"+Et)],[tt]:[new RegExp("FxiOS\\/"+Et)],[pt]:[new RegExp("Konqueror[:/]?"+Et,"i")],[Be]:[new RegExp(Be+" "+Et),Pt],[nt]:[new RegExp("android\\s"+Et,"i")],[ze]:[new RegExp(Ge+"\\/"+Et)],[gt]:[new RegExp("OculusBrowser\\/"+Et)],[vt]:[new RegExp(vt+"\\/"+Et)],[ft]:[new RegExp("YaBrowser\\/"+Et)],[mt]:[new RegExp(mt+"\\/"+Et)],[St]:[new RegExp(St+"\\/"+Et)],[yt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Et)],[bt]:[new RegExp("PaleMoon\\/"+Et)],[wt]:[new RegExp(wt+"\\/"+Et)],[xt]:[new RegExp("GSA\\/"+Et)],[Ye]:[new RegExp("(rv:|MSIE )"+Et)],Mozilla:[new RegExp("rv:"+Et)]},At=function(e,t,i,s){var r=Ct(e,t,i,s),n=Ot[r];if(fe(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Ft=[[new RegExp(rt+"; "+rt+" (.*?)[);]","i"),e=>[rt,e&&e[1]||""]],[new RegExp(it,"i"),[it,""]],[new RegExp(st,"i"),[st,""]],[$t,[Be,""]],[new RegExp(at,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[lt,""];if(new RegExp(Oe).test(t)&&!/IEMobile\b/.test(t))return[at+" "+Oe,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=Rt[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[at,s]}return[at,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Ae,[e[3],e[4],e[5]||"0"].join(".")]:[Ae,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=fe(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Fe+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Fe+")","i"),e=>e&&e[2]?[Fe,[e[2],e[3],e[4]||"0"].join(".")]:[Fe,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[je,""]],[/Linux|debian/i,["Linux",""]]],Lt=function(e){return kt.test(e)?it:It.test(e)?st:Tt.test(e)?rt:new RegExp(ut,"i").test(e)?ut:new RegExp("("+lt+"|WPDesktop)","i").test(e)?lt:/iPad/.test(e)?De:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ne:$t.test(e)?Be:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(_t,"i").test(e)?_t:/(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(Oe).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)?Fe:Me:new RegExp("(pda|"+Oe+")","i").test(e)?ct:new RegExp(Le,"i").test(e)&&!new RegExp(Le+" pc","i").test(e)?ht:""},Mt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Dt(e,t){return"string"==typeof(i=e)&&Mt.test(i)?e:t();var i}var Ut=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={_log(t){if(N&&(r.DEBUG||J.POSTHOG_DEBUG||i)&&!fe(N.console)&&N.console){for(var s=("__rrweb_original__"in N.console[t]?N.console[t].__rrweb_original__:N.console[t]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Ut(e+" "+t,i)};return s},Nt=Ut("[PostHog.js]"),qt=Nt.createLogger;function Bt(e,t){he(e)&&e.forEach(t)}function Ht(e,t){if(!we(e))if(he(e))e.forEach(t);else if(Pe(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)de.call(e,i)&&t(e[i],i)}var Gt=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e},zt=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){Nt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Nt.critical(e)}}},Vt=function(e){var t={};return Ht(e,(function(e,i){(me(e)&&e.length>0||Se(e))&&(t[i]=e)})),t};var jt=["herokuapp.com","vercel.app","netlify.app"];function Wt(e){var t=null==e?void 0:e.hostname;if(!me(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of jt)if(i===s)return!1;return!0}function Yt(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Se(e)&&isFinite(e)&&Math.floor(e)===e});class Kt{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/Math.pow(2,8),r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new Kt(r)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Kt(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class Jt{constructor(){this._timestamp=0,this._counter=0,this._random=new Zt}generate(){var e=this.generateOrAbort();if(fe(e)){this._timestamp=0;var t=this.generateOrAbort();if(fe(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return Kt.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}}var Qt,Xt=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};N&&!fe(N.crypto)&&crypto.getRandomValues&&(Xt=e=>crypto.getRandomValues(e));class Zt{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(Xt(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var ei=()=>ti().toString(),ti=()=>(Qt||(Qt=new Jt)).generate(),ii="",si=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ri={_is_supported:()=>!!G,_error(e){Nt.error("cookieStore error: "+e)},_get(e){if(G){try{for(var t=e+"=",i=G.cookie.split(";").filter((e=>e.length)),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},_parse(e){var t;try{t=JSON.parse(ri._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!G)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=G),ii)return ii;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+ei();!ii&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",ii=n)}return ii}(e);if(!i){var s=(e=>{var t=e.match(si);return t?t[0]:""})(e);s!==i&&Nt.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(G.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var _=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return _.length>3686.4&&Nt.warn("cookieStore warning: large cookie, len="+_.length),G.cookie=_,!0}catch(e){return!1}},_remove(e,t){if(null!=G&&G.cookie)try{ri._set(e,"",-1,t)}catch(e){return}}},ni=null,oi={_is_supported(){if(!be(ni))return ni;var e=!0;if(fe(N))e=!1;else try{var t="__mplssupport__";oi._set(t,"xyz"),'"xyz"'!==oi._get(t)&&(e=!1),oi._remove(t)}catch(t){e=!1}return e||Nt.error("localStorage unsupported; falling back to cookie store"),ni=e,e},_error(e){Nt.error("localStorage error: "+e)},_get(e){try{return null==N?void 0:N.localStorage.getItem(e)}catch(e){oi._error(e)}return null},_parse(e){try{return JSON.parse(oi._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==N||N.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){oi._error(e)}return!1},_remove(e){try{null==N||N.localStorage.removeItem(e)}catch(e){oi._error(e)}}},ai=[o,"distinct_id",d,c,x,S,f],li={},_i={_is_supported:()=>!0,_error(e){Nt.error("memoryStorage error: "+e)},_get:e=>li[e]||null,_parse:e=>li[e]||null,_set:(e,t)=>(li[e]=t,!0),_remove(e){delete li[e]}},ui=null,di={_is_supported(){if(!be(ui))return ui;if(ui=!0,fe(N))ui=!1;else try{var e="__support__";di._set(e,"xyz"),'"xyz"'!==di._get(e)&&(ui=!1),di._remove(e)}catch(e){ui=!1}return ui},_error(e){Nt.error("sessionStorage error: ",e)},_get(e){try{return null==N?void 0:N.sessionStorage.getItem(e)}catch(e){di._error(e)}return null},_parse(e){try{return JSON.parse(di._get(e))||null}catch(e){}return null},_set(e,t){try{return null==N||N.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){di._error(e)}return!1},_remove(e){try{null==N||N.sessionStorage.removeItem(e)}catch(e){di._error(e)}}};class ci{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===k||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===I}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return $e(e)?1:le(Re,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?oi:ri;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?ri:oi;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut($e(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==H?void 0:H.doNotTrack,null==H?void 0:H.msDoNotTrack,J.doNotTrack].some((e=>$e(e)))}}var hi=["next","previous","prev",">","<","+","-","−","–"];qt("[Dead Clicks]");var pi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(_)),s=e.instance.config.capture_dead_clicks;return Ee(s)?s:!!ge(s)||i},gi=qt("[SegmentIntegration]");var vi="posthog-js";function fi(e,t){var{organization:s,projectId:r,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,_,u,d,c;if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=(null==(l=t.exception)?void 0:l.values)||[],v=g.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(_=g[0])?void 0:_.value)||t.message,$exception_type:null==(u=g[0])?void 0:u.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(c=g[0])?void 0:c.type,$sentry_tags:t.tags};return s&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+t.event_id),a&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class mi{constructor(e,t,i,s,r,n){this.name=vi,this.setupOnce=function(o){o(fi(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class yi{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Nt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==N?void 0:N.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:_,maxContentY:u}=r;if(!(fe(n)||fe(o)||fe(a)||fe(l)||fe(_)||fe(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),_=Math.ceil(_),u=Math.ceil(u);var d=n>1?Ce(o/n,0,1,Nt):1,c=n>1?Ce(a/n,0,1,Nt):1,h=l>1?Ce(_/l,0,1,Nt):1,p=l>1?Ce(u/l,0,1,Nt):1;s=Gt(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:_,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var bi=["flags","surveys"],wi={[n]:{exposure:"hidden"},[a]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[l]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$exception_capture_enabled_server_side:{exposure:"event"},$error_tracking_suppression_rules:{exposure:"hidden"},$error_tracking_capture_extension_exceptions:{exposure:"event"},$web_vitals_enabled_server_side:{exposure:"event"},[_]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[u]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[d]:{exposure:"hidden"},[c]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:e=>be(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[h]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!ge(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},$active_feature_flags:{exposure:"event",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},$feature_flag_details:{exposure:"hidden",storageGroup:"flags"},$feature_flag_payloads:{exposure:"event",storageGroup:"flags"},$feature_flag_request_id:{exposure:"event",storageGroup:"flags",volatile:!0},$override_feature_flags:{exposure:"event"},$override_feature_flag_payloads:{exposure:"hidden"},$stored_person_properties:{exposure:"hidden"},$stored_group_properties:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[p]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[g]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},$feature_flag_errors:{exposure:"hidden"},[v]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[f]:{exposure:"hidden"},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[b]:{exposure:"hidden"},[w]:{exposure:"hidden"},[S]:{exposure:"hidden"},[x]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[P]:{exposure:"event"},[T]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Si=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],xi=e=>{var t=wi[e];if(t)return t;for(var[i,s]of Si)if(0===e.indexOf(i))return s},Ei=e=>{var t=null==G?void 0:G.createElement("a");return fe(t)?null:(t.href=e,t)},Pi=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!he(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Nt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ti=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),_=[],u=0;l.length>u;u++){var d=l[u].split("=");he(d)&&(t.includes(d[0])?_.push(d[0]+"="+i):_.push(l[u]))}var c=a;return null!=o&&(c+="?"+_.join("&")),null!=r&&(c+="#"+r),c},Ii="https?://(.*)",ki=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],$i=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ki],Ri="<masked>",Ci=["li_fat_id"];function Oi(e,t){var i=$i.concat(t||[]),s={};return Ht(i,(function(t){var i=Pi(e,t);s[t]=i||null})),s}function Ai(e){var t=function(e){return e?0===e.search(Ii+"google.([^/?]*)")?"google":0===e.search(Ii+"bing.com")?"bing":0===e.search(Ii+"yahoo.com")?"yahoo":0===e.search(Ii+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!be(t)){s.$search_engine=t;var r=G?Pi(G.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function Fi(){return navigator.language||navigator.userLanguage}var Li="$direct";function Mi(){return(null==G?void 0:G.referrer)||Li}function Di(e,t){var i=e?[...ki,...t||[]]:[],s=null==z?void 0:z.href.substring(0,1e3);return{r:Mi().substring(0,1e3),u:s?Ti(s,i,Ri):void 0}}function Ui(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==Li?Li:null==(t=Ei(i))?void 0:t.host};if(s){r.$current_url=s;var n=Ei(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var o=Oi(s);Gt(r,o)}if(i){var a=Ai(i);Gt(r,a)}return r}function Ni(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function qi(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Bi={flags:v,surveys:p},Hi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Gi="main";class zi{constructor(e,t,s){if(void 0===s&&(s=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_saved=!1,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&Nt.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),N){var r=()=>this.flush();Yt(N,"beforeunload",r,{capture:!1}),Yt(N,"pagehide",r,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Se(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Hi.indexOf(e.persistence.toLowerCase())&&(Nt.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var s=[...ai,...e];return i({},oi,{_parse(e){try{var i={};try{i=ri._parse(e)||{}}catch(e){}var s,r=JSON.parse(oi._get(e)||"{}");if(t){var n={};for(var o in i){var a=i[o];be(a)||""===a||(n[o]=a)}s=Gt(r,n)}else s=Gt(i,r);return oi._set(e,s),s}catch(e){}return null},_set(e,t,i,r,n,o){var a=oi._set(e,t,void 0,void 0,o);try{var l={};s.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&ri._set(e,l,i,r,n,o)}catch(e){oi._error(e)}return a},_remove(e,t){try{null==N||N.localStorage.removeItem(e),ri._remove(e,t)}catch(e){oi._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&oi._is_supported()?(t=oi,r=!0):"localstorage+cookie"===n&&s._is_supported()?(t=s,r=!0):"sessionstorage"===n&&di._is_supported()?t=di:"memory"===n?t=_i:"cookie"===n?t=ri:s._is_supported()?(t=s,r=!0):t=ri,this._splitStorageEligible=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[v];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return Ht(this.props,((t,i)=>{var s=xi(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===h?()=>this._isFeatureFlagCacheStale():()=>!1))return;s.transformToEventProperties&&Gt(e,s.transformToEventProperties(t))}else if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,(()=>!1)))return;e[i]=t}})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=Gt({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of bi){var t=oi._parse(this._groupEntryName(e));if(t&&!ve(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Gt(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var i;return(null==(i=xi(t))?void 0:i.storageGroup)===e}))}_groupEntryIsStale(e,t){var i=Bi[e];if(!i)return!1;var s=t[i],r=this.props[i];return Se(s)&&Se(r)&&r>s}refreshKey(e){var t;if(!this._disabled){var i=this._splitStorage?null==(t=xi(e))?void 0:t.storageGroup:void 0,s=i?oi._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e]);else{if(i){var r=this._storage._parse(this._name);if(r&&e in r)return void this._setProp(e,r[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?fe(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){fe(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(){this._disabled||(this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,Gi))}_writeNowSplit(){var{main:e,groups:t}=this._partitionProps();for(var i of(this._writeEntry(this._storage,this._name,e,Gi),bi)){var s,r=t[i];(!ve(r)||null!=(s=this._slotState[i])&&s.persisted)&&this._writeEntry(oi,this._groupEntryName(i),r,i)}}_partitionProps(){var e={},t={};for(var i of bi)t[i]={};return Ht(this.props,((i,s)=>{var r,n=null==(r=xi(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Gi)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return Ht(e,((e,t)=>{var s;i[t]=null!=(s=xi(t))&&s.volatile?"__volatile__":e})),JSON.stringify(i)}_writeEntry(e,t,i,s){var r=this._slotWriteState(s);if(s===Gi||r.dirty||fe(r.fingerprint)){var n;try{if((n=this._entryFingerprint(i,s))===r.fingerprint)return void(r.dirty=!1)}catch(e){n=void 0}e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(r.dirty=!1,s!==Gi&&(r.persisted=!0),fe(n)||(r.fingerprint=n)):this._config.debug&&Nt.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(fe(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!t&&this._ownsSplitStorage)for(var i of bi)oi._remove(this._groupEntryName(i));t?delete this._slotState[Gi]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(ge(e)){fe(t)&&(t="None"),this._expire_days=fe(i)?this._default_expiry:i;var s=!1;if(Ht(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(ge(e)){this._expire_days=fe(t)?this._default_expiry:t;var i=!1;if(Ht(e,((t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this._setProp(s,t),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this._deleteProp(e),this.save())}update_campaign_params(){if(!this._campaign_params_saved){var e=function(e,t,i){if(!G)return{};var s,r=t?[...ki,...i||[]]:[],n=Oi(Ti(G.URL,r,Ri),e),o=(s={},Ht(Ci,(function(e){var t=ri._get(e);s[e]=t||null})),s);return Gt(o,n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);ve(Vt(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==G?void 0:G.referrer)?Ai(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Mi(),$referring_domain:null!=G&&G.referrer&&(null==(e=Ei(G.referrer))?void 0:e.host)||Li},void 0)}set_initial_person_info(){this.props[b]||this.props[w]||this.register_once({[S]:Di(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ht([w,b],(t=>{var i=this.props[t];i&&Ht(i,(function(t,i){e["$initial_"+_e(i)]=t}))}));var t,i,s=this.props[S];if(s){var r=(t=Ui(s),i={},Ht(t,(function(e,t){i["$initial_"+_e(t)]=e})),i);Gt(e,r)}return e}safe_merge(e){return Ht(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every(((e,t)=>e===s[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s?this._buildStorage(e):this._storage,n=this._resolveSplitStorage(e);if(s||n!==this._splitStorage){var o=this.props;this.clear(),this._storage=r,this._splitStorage=n,this.props=o,this.save()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[l]||{};i[e]=t,this._setProp(l,i),this.save()}remove_event_timer(e){var t=this.props[l]||{},i=t[e];return fe(i)||(delete t[e],this._setProp(l,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){var i;this.props[e]=t,null!=(i=xi(e))&&i.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,i=null==(t=xi(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Vi={Activation:"events",Cancellation:"cancelEvents"},ji={Button:"button",Tab:"tab",Selector:"selector"},Wi={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Yi={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Ki={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Ji={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Qi={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Xi={Once:"once",Recurring:"recurring",Always:"always"},Zi={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},es={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},ts={Popover:"popover",Inline:"inline"},is={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},ss={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},rs={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ns=qt("[RateLimiter]");class os{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{ns.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void ns.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(y))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(y,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var as=qt("[RemoteConfig]");class ls{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=J._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=J.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=J.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return as.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void as.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return as.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){as.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&G&&"hidden"!==G.visibilityState&&this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){var t;e||as.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var _s=["fatal","error","warning","log","info","debug"],us={GZipJS:"gzip-js",Base64:"base64"},ds=Uint8Array,cs=Uint16Array,hs=Uint32Array,ps=new ds([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gs=new ds([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),vs=new ds([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fs=function(e,t){for(var i=new cs(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new hs(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},ms=fs(ps,2),ys=ms[1];ms[0][28]=258,ys[258]=28;for(var bs=fs(gs,0)[1],ws=new cs(32768),Ss=0;32768>Ss;++Ss){var xs=(43690&Ss)>>>1|(21845&Ss)<<1;ws[Ss]=((65280&(xs=(61680&(xs=(52428&xs)>>>2|(13107&xs)<<2))>>>4|(3855&xs)<<4))>>>8|(255&xs)<<8)>>>1}var Es=function(e,t,i){for(var s=e.length,r=0,n=new cs(t);s>r;++r)++n[e[r]-1];var o,a=new cs(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new cs(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var _=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,c=d|(1<<u)-1;c>=d;++d)o[ws[d]>>>l]=_}else for(o=new cs(s),r=0;s>r;++r)o[r]=ws[a[e[r]-1]++]>>>15-e[r];return o},Ps=new ds(288);for(Ss=0;144>Ss;++Ss)Ps[Ss]=8;for(Ss=144;256>Ss;++Ss)Ps[Ss]=9;for(Ss=256;280>Ss;++Ss)Ps[Ss]=7;for(Ss=280;288>Ss;++Ss)Ps[Ss]=8;var Ts=new ds(32);for(Ss=0;32>Ss;++Ss)Ts[Ss]=5;var Is=Es(Ps,9,0),ks=Es(Ts,5,0),$s=function(e){return(e/8>>0)+(7&e&&1)},Rs=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof cs?cs:e instanceof hs?hs:ds)(i-t);return s.set(e.subarray(t,i)),s},Cs=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Os=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},As=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new ds(0),0];if(1==r){var o=new ds(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],_=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=i[i[d].f>i[_].f?_++:d++],l=i[_!=u&&i[d].f>i[_].f?_++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var c=n[0].s;for(s=1;r>s;++s)n[s].s>c&&(c=n[s].s);var h=new cs(c+1),p=Fs(i[u-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new ds(h),p]},Fs=function(e,t,i){return-1==e.s?Math.max(Fs(e.l,t,i+1),Fs(e.r,t,i+1)):t[e.s]=i},Ls=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new cs(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},Ms=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Ds=function(e,t,i){var s=i.length,r=$s(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},Us=function(e,t,i,s,r,n,o,a,l,_,u){Cs(t,u++,i),++r[256];for(var d=As(r,15),c=d[0],h=d[1],p=As(n,15),g=p[0],v=p[1],f=Ls(c),m=f[0],y=f[1],b=Ls(g),w=b[0],S=b[1],x=new cs(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var P=As(x,7),T=P[0],I=P[1],k=19;k>4&&!T[vs[k-1]];--k);var R,C,O,A,F=_+5<<3,L=Ms(r,Ps)+Ms(n,Ts)+o,M=Ms(r,c)+Ms(n,g)+o+14+3*k+Ms(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(L>=F&&M>=F)return Ds(t,u,e.subarray(l,l+_));if(Cs(t,u,1+(L>M)),u+=2,L>M){R=Es(c,h,0),C=c,O=Es(g,v,0),A=g;var D=Es(T,I,0);for(Cs(t,u,y-257),Cs(t,u+5,S-1),Cs(t,u+10,k-4),u+=14,E=0;k>E;++E)Cs(t,u+3*E,T[vs[E]]);u+=3*k;for(var U=[m,w],N=0;2>N;++N){var q=U[N];for(E=0;q.length>E;++E)Cs(t,u,D[B=31&q[E]]),u+=T[B],B>15&&(Cs(t,u,q[E]>>>5&127),u+=q[E]>>>12)}}else R=Is,C=Ps,O=ks,A=Ts;for(E=0;a>E;++E)if(s[E]>255){var B;Os(t,u,R[257+(B=s[E]>>>18&31)]),u+=C[B+257],B>7&&(Cs(t,u,s[E]>>>23&31),u+=ps[B]);var H=31&s[E];Os(t,u,O[H]),u+=A[H],H>3&&(Os(t,u,s[E]>>>5&8191),u+=gs[H])}else Os(t,u,R[s[E]]),u+=C[s[E]];return Os(t,u,R[256]),u+C[256]},Ns=new hs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qs=function(){for(var e=new hs(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Bs=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Hs(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=qs[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,_=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new ds(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),_=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?_=Ds(l,_,e.subarray(u,d)):(l[u]=!0,_=Ds(l,_,e.subarray(u,o)))}else{for(var c=Ns[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new cs(32768),f=new cs(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new hs(25e3),S=new cs(288),x=new cs(32),E=0,P=0,T=(u=0,0),I=0,k=0;o>u;++u){var R=b(u),C=32767&u,O=f[R];if(v[C]=O,f[R]=C,u>=I){var A=o-u;if((E>7e3||T>24576)&&A>423){_=Us(e,l,0,w,S,x,P,T,k,u-k,_),T=E=P=0,k=u;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[F]=0}var L=2,M=0,D=p,U=C-O&32767;if(A>2&&R==b(u-U))for(var N=Math.min(h,A)-1,q=Math.min(32767,u),B=Math.min(258,A);q>=U&&--D&&C!=O;){if(e[u+L]==e[u+L-U]){for(var H=0;B>H&&e[u+H]==e[u+H-U];++H);if(H>L){if(L=H,M=U,H>N)break;var G=Math.min(U,H-2),z=0;for(F=0;G>F;++F){var V=u-U+F+32768&32767,j=V-v[V]+32768&32767;j>z&&(z=j,O=V)}}}U+=(C=O)-(O=v[C])+32768&32767}if(M){w[T++]=268435456|ys[L]<<18|bs[M];var W=31&ys[L],Y=31&bs[M];P+=ps[W]+gs[Y],++S[257+W],++x[Y],I=u+L,++E}else w[T++]=e[u],++S[e[u]]}}_=Us(e,l,!0,w,S,x,P,T,k,u-k,_)}return Rs(a,0,s+$s(_)+r)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=_.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Bs(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(_,t),Bs(_,u-8,i.d()),Bs(_,u-4,s),_}var Gs=!!j||!!V,zs="text/plain",Vs=!1,js=(e,t)=>{var[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;var o=n.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return r+(o?"?"+o:"")+(s?"#"+s:"")},Ws=function(e,t,s){var r;void 0===s&&(s=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(r=null==o?void 0:o.split("&").map((e=>{var t,[i,r]=e.split("="),n=s&&null!==(t=a[i])&&void 0!==t?t:r;return delete a[i],i+"="+n})))&&void 0!==r?r:[],_=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return Ht(e,(function(e,t){fe(e)||fe(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)})),r.join(t)}(a);return _&&l.push(_),n+"?"+l.join("&")},Ys=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Ks=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===us.GZipJS){var s=Hs(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new ds(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new ds(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Rs(s,0,r)}(Ys(t)),{mtime:0});return{contentType:zs,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===us.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Ys(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Ys(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Ys(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Js=e=>{var t,s,r,n=Ks(e);return!n||(s=e.compression,r=Pi(e.url,"compression"),s!==Q.GZipJS&&r!==Q.GZipJS&&"gzip"!==r)||((t=n.body)instanceof ArrayBuffer?te(new Uint8Array(t)):ArrayBuffer.isView(t)&&te(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:n}:(Vs=!0,{url:js(e.url,"compression"),encodedBody:Ks(i({},e,{compression:void 0,_encodedBody:void 0}))})},Qs=function(){var e=t((function*(e){var t=Ys(e.data),s=yield function(e,t,i){return ne.apply(this,arguments)}(t,r.DEBUG,{rethrow:!0});if(!s)return e;var n=yield s.arrayBuffer();return i({},e,{_encodedBody:{contentType:zs,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),Xs=(e,t)=>Ws(e,{_:(new Date).getTime().toString(),ver:r.JS_SDK_VERSION,compression:t}),Zs=[];V&&Zs.push({transport:"fetch",method(e){var t,{url:s,encodedBody:r}=Js(e),{contentType:n,body:o,estimatedSize:a}=null!=r?r:{},l=new Headers;Ht(e.headers,(function(e,t){l.append(t,e)})),n&&l.append("Content-Type",n);var _=null;if(W){var u=new W;_={signal:u.signal,timeout:setTimeout((()=>u.abort()),e.timeout)}}V(s,i({method:(null==e?void 0:e.method)||"GET",headers:l,keepalive:"POST"===e.method&&52428.8>(a||0),body:o,signal:null==(t=_)?void 0:t.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Nt.error(e)}null==e.callback||e.callback(s)})))).catch((t=>{Nt.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>_?clearTimeout(_.timeout):null))}}),j&&Zs.push({transport:"XHR",method(e){var t=new j,{url:i,encodedBody:s}=Js(e);t.open(e.method||"GET",i,!0);var{contentType:r,body:n}=null!=s?s:{};Ht(e.headers,(function(e,i){t.setRequestHeader(i,e)})),r&&t.setRequestHeader("Content-Type",r),e.timeout&&(t.timeout=e.timeout),t.onreadystatechange=()=>{if(4===t.readyState){var i={statusCode:t.status,text:t.responseText};if(200===t.status)try{i.json=JSON.parse(t.responseText)}catch(e){}null==e.callback||e.callback(i)}},t.send(n)}}),null!=H&&H.sendBeacon&&Zs.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=Js(e),{contentType:s,body:r}=null!=i?i:{};if(!r)return;var n=r instanceof Blob?r:new Blob([r],{type:s});H.sendBeacon(t,n)}catch(e){}}});var er=3e3;class tr{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Ce((null==t?void 0:t.flush_interval_ms)||er,250,5e3,Nt.createLogger("flush interval"),er),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequest(i({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&he(i.data)&&Ht(i.data,(e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e._sendRequest(i)};for(var s in t)i()}}),this._flushTimeoutMs))}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Ht(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;fe(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var ir=["retriesPerformedSoFar"];class sr{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!fe(N)&&"onLine"in N.navigator&&(this._areWeOnline=N.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Yt(N,"online",this._onlineListener),Yt(N,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}(e,ir);xe(t)&&(s.url=Ws(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(i({retriesPerformedSoFar:t},s));0===e.statusCode&&Nt.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==s.callback||s.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=Math.random()-.5;return Math.ceil(s+r*(s-i))}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),Nt.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter((i=>e>i.retryAt||(t.push(i),!1)));if(this._queue=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,fe(N)||(this._onlineListener&&(N.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(N.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){Nt.error(e)}this._queue=[]}}class rr{constructor(e){this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Yt(N,"scroll",this._updateScrollData,{capture:!0}),Yt(N,"scrollend",this._updateScrollData,{capture:!0}),Yt(N,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==N?void 0:N.document.documentElement;var e=he(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==N?void 0:N.document.querySelector(t);if(i)return i}}_scrollPosition(e){var t="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var i=this.scrollElement();return i&&i[t]||0}return N?"y"===e?N.scrollY||N.pageYOffset||N.document.documentElement.scrollTop||0:N.scrollX||N.pageXOffset||N.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var nr=e=>Di(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class or{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[m]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||nr,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[m]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Ui(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Ht(Vt(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+_e(i)]=t})),e}}class ar{constructor(){this._events={}}on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}}var lr=qt("[SessionId]");class _r{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new ar,this._sessionHasBeenIdleTooLong=(e,t)=>!(!xe(e)||!xe(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===k)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||ei,this._windowIdGenerator=i||ei;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Ce(this._config.session_idle_timeout_seconds||1800,60,36e3,lr.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=di._parse(this._window_id_storage_key),o=di._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:di._remove(this._window_id_storage_key),di._set(this._primary_window_exists_storage_key,!0)}if(null!=(s=this._config.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){lr.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return fe(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&di._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&di._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?di._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!be(t)&&!be(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[d]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return xe(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(d):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!be(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[d]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var[e]=this._getSessionId(),t=xe(e)?e:0,i=xe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[d];return he(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&N&&(N.removeEventListener(F,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&di._remove(this._primary_window_exists_storage_key)},Yt(N,F,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===k)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[,s,r]=this._getSessionId(),n=this._freshestActivityTimestamp(),o=this._getWindowId(),a=xe(r)&&Math.abs(i-r)>864e5,l=!1,_=!1,u=!s,d=s,c=!u&&!e&&this._sessionHasBeenIdleTooLong(i,n);c&&((c=this._isSessionIdleAfterCrossTabRefresh(i))||lr.info("cross-tab refresh kept the session alive",{sessionId:s}),[,s,r]=this._getSessionId()),u||c||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),lr.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),r=i,l=!0):(o||(o=this._windowIdGenerator(),l=!0),(_=s!==d)&&(lr.info("adopted cross-tab session id",{sessionId:s,windowId:o}),l=!0));var h=xe(n)&&e&&!a?n:i,p=xe(r)?r:(new Date).getTime();this._setWindowId(o),this._setSessionId(s,h,p),e||this._resetIdleTimer();var g={noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a,crossTabAdoption:_};return l&&this._sessionIdChangedHandlers.forEach((e=>e(s,o,g))),{sessionId:s,windowId:o,sessionStartTimestamp:p,changeReason:l?g:void 0,lastActivityTimestamp:n}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()}),1.1*this.sessionTimeoutMs))}}function ur(e,t,i){return Ys({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var dr="custom",cr="i.posthog.com",hr=/^\/static\//;class pr{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+cr,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":dr),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(hr.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return""+i+t}if(this.region===dr)return this.apiHost+t;var s=cr+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var gr=qt("[Surveys]"),vr={ignoreConditions:!1,ignoreDelay:!1,displayType:ts.Popover},fr=qt("[PostHog ExternalIntegrations]"),mr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class yr{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=J.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return fr.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=J.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(mr[t],(()=>{var i;null==(i=J.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!s&&null!=(r=J.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=J.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,s]of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;t(i)}}}var br,wr={},Sr=0,xr=()=>{},Er='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Pr="Surveys module not available",Tr="sanitize_properties is deprecated. Use before_send instead",Ir="Invalid value for property_denylist config: ",kr="posthog",$r=!Gs&&-1===(null==K?void 0:K.indexOf("MSIE"))&&-1===(null==K?void 0:K.indexOf("Mozilla")),Rr=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Wt(null==G?void 0:G.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:xr,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:z&&me(null==z?void 0:z.search)&&-1!==z.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==N||null==(t=N.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){Nt.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:O,before_send:void 0,request_queue_config:{flush_interval_ms:er},error_tracking:{},_onCapture:xr},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:hi,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e)}))(e))},Cr=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],Or=e=>{var t={};for(var[i,s]of Cr)fe(e[i])||(t[s]=e[i]);var r=Gt({},t,e),n=e.__preview_external_dependency_versioned_paths;return fe(n)||(fe(e.strict_script_versioning)&&(r.strict_script_versioning=!!n),me(n)&&fe(e.asset_host)&&(r.asset_host=n)),he(e.property_blacklist)&&(fe(e.property_denylist)?r.property_denylist=e.property_blacklist:he(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:Nt.error(Ir+e.property_denylist)),r};class Ar{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Nt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Fr{_replaceExtension(e,t){if(e){var i=this._extensions.indexOf(e);-1!==i&&this._extensions.splice(i,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===k||this.config.cookieless_mode===I&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new Ar,this._personProcessingSetOncePropertiesSent=!1,this.version=r.LIB_VERSION,this._internalEventEmitter=new ar,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Rr(),this.SentryIntegration=mi,this.sentryIntegration=e=>function(e,t){var i=fi(e,t);return{name:vi,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new rr(this),this.pageViewManager=new yi(this),this.rateLimiter=new os(this),this.requestRouter=new pr(this),this.consent=new ci(this),this.externalIntegrations=new yr(this);var t=null!==(e=Fr.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=me(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=me(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>Nt.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==kr){var s,r=null!==(s=wr[i])&&void 0!==s?s:new Fr;return r._init(e,t,i),wr[i]=r,wr[kr][i]=r,r}return this._init(e,t,i)}_init(e,t,s){var n,o;void 0===t&&(t={});var a=me(e)?e.trim():"";if(!a)return Nt.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var l=Rr(t.defaults),_=Or(t),u=Gt({},l,_,{name:s,token:a});ge(l.rageclick)&&ge(_.rageclick)&&(u.rageclick=Gt({},l.rageclick,_.rageclick)),ge(l.session_recording)&&ge(_.session_recording)&&(u.session_recording=Gt({},l.session_recording,_.session_recording)),this.set_config(u),this.config.on_xhr_error&&Nt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:us.GZipJS;var d=this._is_persistence_disabled();this.persistence=new zi(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new zi(i({},this.config,{persistence:"sessionStorage"}),d,!1);var c=i({},this.persistence.props),h=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new tr((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new sr(this),this.__request_queue=[];var p=this._inCookielessMode();if(p||(this.sessionManager=new _r(this),this.sessionPropsManager=new or(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Nt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(p)}),0)):(Nt.info("Initializing extensions synchronously"),this._initExtensions(p)),r.DEBUG=r.DEBUG||this.config.debug,r.DEBUG&&Nt.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:c,s:h}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var g=t.bootstrap.distinctID,v=this.get_distinct_id(),m=this.persistence.get_property(f);if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&m===R)this.identify(g);else if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&m===C)Nt.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var y=this.config.get_device_id(ei()),b=t.bootstrap.isIdentifiedID?y:g;this.persistence.set_property(f,t.bootstrap.isIdentifiedID?C:R),this.register({distinct_id:g,$device_id:b})}}if(p)this.register_once({distinct_id:E,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(ei());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(f,R)}return Yt(N,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||ei();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(f,C)),t()},r=i.user();"then"in r&&pe(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||gi.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(gi.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(gi.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,L),identify:e=>t(e,D),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),pe(this.config._onCapture)&&this.config._onCapture!==xr&&(Nt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Nt.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}_initExtensions(e){var t,s,r,n,o,a,l,_=performance.now(),u=i({},Fr.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new u.featureFlags(this)),u.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new u.exceptions(this)),u.historyAutocapture&&this._extensions.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this._extensions.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this._extensions.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this._extensions.push(this.autocapture=new u.autocapture(this)),u.surveys&&this._extensions.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this)),u.logs&&this._extensions.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new u.logs(this)),u.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this._extensions.push(this.productTours=new u.productTours(this)),u.heatmaps&&this._extensions.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this._extensions.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,pi)),u.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this._extensions.forEach((e=>{e.initialize&&d.push((()=>{null==e.initialize||e.initialize()}))})),d.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(d,_)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){Nt.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[P]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[T]:s}),this.config.__preview_deferred_init_extensions&&Nt.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!G||!G.body)return Nt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=le(e.supportedCompression,us.GZipJS)?us.GZipJS:le(e.supportedCompression,us.Base64)?us.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:O}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){Nt.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=z&&z.hostname){var e=z.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new ls(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Bt(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(M),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(M,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?$r?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=i({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(fe(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,s,r,n=i({},e);n.timeout=n.timeout||6e4,n.url=Xs(n.url,n.compression);var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=Zs.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),l=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===o)return e[i]}(a))?void 0:r.method)&&void 0!==s?s:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===us.GZipJS&&Y&&!Vs?Qs(n).then((e=>{l(e)})).catch((t=>{if(ie(t))return Vs=!0,void l(i({},n,{compression:void 0,url:Xs(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return ie(e)||t===ee})(t)&&(Vs=!0),l(n)})):l(n)})(i({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Sr++;try{var t,i=[],s=[],r=[];Bt(e,(e=>{if(e)if(he(t=e[0]))r.push(e);else if(pe(e))try{e.call(this)}catch(t){Nt.error("Error executing queued PostHog call",e,t)}else he(e)&&"alias"===t?i.push(e):he(e)&&-1!==t.indexOf("capture")&&pe(this[t])?r.push(e):s.push(e)}));var n=function(e,t){Bt(e,(function(e){try{if(he(e[0])){var i=t;Ht(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){Nt.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(s,this),n(r,this)}finally{Sr--}}push(e){if(Sr>0&&he(e)&&me(e[0])){var t=Fr.prototype[e[0]];pe(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!fe(e)&&me(e)){var _=!this.config.opt_out_useragent_filter&&this._is_bot();if(!_||this.config.__preview_capture_bot_pageviews){var u=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!me(null==t?void 0:t.$current_url)&&(Nt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=s&&s._originatedFromCaptureException||Nt.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var d=new Date,c=(null==s?void 0:s.timestamp)||d,h=Dt(null==s?void 0:s.uuid,ei),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},c,h)};e===L&&this.config.__preview_capture_bot_pageviews&&_&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==s?void 0:s.$set)&&(p.$set=null==s?void 0:s.$set);var g=null==s?void 0:s.$unset;g&&(p.$unset=g);var v,f,m,y=this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==U,e===D);if(y&&(p.$set_once=y),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>me(e)?e.slice(0,n):e,l=new Set,p=function e(t,i){return t!==Object(t)?a?a(t):t:l.has(t)?void 0:(l.add(t),he(t)?(s=[],Bt(t,(t=>{s.push(e(t))}))):(s={},Ht(t,((t,i)=>{l.has(t)||(s[i]=e(t,i))}))),s);var s}(o)),p.timestamp=c,fe(null==s?void 0:s.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),e===Zi.DISMISSED||e===Zi.SENT){var b=null==t?void 0:t[es.SURVEY_ID],w=null==t?void 0:t[es.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})("seenSurvey_",e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){gr.error("Failed to persist survey seen state",e)}})({id:b,current_iteration:w}),p.$set=i({},p.$set,{[(v={id:b,current_iteration:w},f=e===Zi.SENT?"responded":"dismissed",m="$survey_"+f+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(m="$survey_"+f+"/"+v.id+"/"+v.current_iteration),m)]:!0})}else e===Zi.SHOWN&&(p.$set=i({},p.$set,{[es.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===ss.SHOWN){var S=null==t?void 0:t[rs.TOUR_TYPE];S&&(p.$set=i({},p.$set,{[rs.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var x=i({},p.properties.$set,p.$set);if(ve(x)||this.setPersonPropertiesForFlags(x),!we(this.config.before_send)){var E=this._runBeforeSend(p);if(!E)return;(p=E).uuid=Dt(p.uuid,ei)}this._internalEventEmitter.emit("eventCaptured",p);var P={method:"POST",url:null!==(r=null==s?void 0:s._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==s?void 0:s._batchKey,transport:null==s?void 0:s.transport};return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?this._send_retriable_request(P):this._requestQueue.enqueue(P),p}Nt.critical("This capture call is ignored due to client rate limiting.")}}else Nt.error("No event name provided to posthog.capture")}else Nt.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,n,o){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this._inCookielessMode()&&(l.$cookieless_mode=!0),"$snapshot"===e){var _=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=_.distinct_id,(!me(l.distinct_id)&&!Se(l.distinct_id)||ye(l.distinct_id))&&Nt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(e,t,i){var s,n,o,a;if(!K)return{};var l,_,u,d,c,h,p,g,v,f=e?[...ki,...t||[]]:[],[m,y]=function(e){for(var t=0;Ft.length>t;t++){var[i,s]=Ft[t],r=i.exec(e),n=r&&(pe(s)?s(r,e):s);if(n)return n}return["",""]}(K),b=null!=(l="undefined"!=typeof navigator?navigator:void 0)&&l.brave?{brave:!0}:{},w={detectGoogleSearchApp:i},S=Gt(Vt({$os:m,$os_version:y,$browser:Ct(K,navigator.vendor,b,w),$device:Lt(K),$device_type:(u=K,d={userAgentDataPlatform:null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,maxTouchPoints:null==(n=navigator)?void 0:n.maxTouchPoints,screenWidth:null==N||null==(o=N.screen)?void 0:o.width,screenHeight:null==N||null==(a=N.screen)?void 0:a.height,devicePixelRatio:null==N?void 0:N.devicePixelRatio},v=Lt(u),v===De||v===Me||"Kobo"===v||"Kindle Fire"===v||v===ht?Le:v===it||v===rt||v===st||v===ut?"Console":v===Ne?"Wearable":v?Oe:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(c=null==d?void 0:d.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(h=null==d?void 0:d.screenWidth)&&void 0!==h?h:0,null!==(p=null==d?void 0:d.screenHeight)&&void 0!==p?p:0)/(null!==(g=null==d?void 0:d.devicePixelRatio)&&void 0!==g?g:1)?Oe:Le:"Desktop"),$timezone:Ni(),$timezone_offset:qi()}),{$current_url:Ti(null==z?void 0:z.href,f,Ri),$host:null==z?void 0:z.host,$pathname:null==z?void 0:z.pathname,$raw_user_agent:K.length>1e3?K.substring(0,997)+"...":K,$browser_version:At(K,navigator.vendor,b,w),$browser_language:Fi(),$browser_language_prefix:(_=Fi(),"string"==typeof _?_.split("-")[0]:void 0),$screen_height:null==N?void 0:N.screen.height,$screen_width:null==N?void 0:N.screen.width,$viewport_height:null==N?void 0:N.innerHeight,$viewport_width:null==N?void 0:N.innerWidth,$lib:r.LIB_NAME,$lib_version:r.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return r.SDK_DIST_CHANNEL&&(S.$sdk_dist_channel=r.SDK_DIST_CHANNEL),S}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app);if(this.sessionManager){var{sessionId:c,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,s.getTime());l.$session_id=c,l.$window_id=h}this.sessionPropsManager&&Gt(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Gt(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===dr&&(l.$lib_custom_api_host=this.config.api_host),u=e!==L||o?e!==M||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),l=Gt(l,u),e===L&&G&&(l.title=G.title),!fe(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}K&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Gt({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),he(this.config.property_denylist)?Ht(this.config.property_denylist,(function(e){delete l[e]})):Nt.error(Ir+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(Nt.error(Tr),l=v(l,e));var f=this._hasPersonProcessing();return l.$process_person_profile=f,f&&!o&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=Gt({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Nt.error(Tr),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),ve(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Pr}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Pr})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Pr})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=vr),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Pr}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Pr})}_validateIdentifyId(e){return!e||ye(e)?(Nt.critical("Unique user id has not been set in posthog.identify"),!1):e===E?(Nt.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Nt.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Nt.uninitializedWarning("posthog.identify");if(Se(e)&&(e=e.toString(),Nt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(o)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(a)&&(this.unregister(a),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(f)||R)===R;e!==s&&n?(this.persistence.set_property(f,C),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(D,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=ur(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(g))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=ur(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):Nt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(he(e)?e:[e]).filter((e=>me(e)&&e.length>0));0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},r,{[e]:t})}),n||s){var o={$group_type:e,$group_key:t};s&&(o.$group_set=s),this.capture(U,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else Nt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,n,a,l,_,d;if(Nt.info("reset"),!this.__loaded)return Nt.uninitializedWarning("posthog.reset");var c,h=this.get_property(o),p=this.get_property(u);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),fe(p)||null==(c=this.persistence)||c.register({[u]:p}),null==(s=this.surveys)||s.reset(),null==(r=this._remoteConfigLoader)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(a=this.conversations)||a.reset(),null==(l=this.logs)||l.reset(),null==(_=this.persistence)||_.set_property(f,R),null==(d=this.sessionManager)||d.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===k)this.register_once({distinct_id:E,$device_id:null},"");else{var g=this.config.get_device_id(ei());this.register_once({distinct_id:g,$device_id:e?g:h},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(n)?(Nt.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(fe(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(a,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Nt.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(ge(e)){var s,n,o,a,l,_,u,d,c,h,p;Gt(this.config,Or(e));var g=this._is_persistence_disabled();null==(s=this.persistence)||s.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new zi(i({},this.config,{persistence:"sessionStorage"}),g,!1);var v=this._checkLocalStorageForDebug(this.config.debug);Ee(v)&&(this.config.debug=v),Ee(this.config.debug)&&(this.config.debug?(r.DEBUG=!0,oi._is_supported()&&oi._set("ph_debug",!0),Nt.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(r.DEBUG=!1,oi._is_supported()&&oi._remove("ph_debug"))),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(_=this.autocapture)||_.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){r.LIB_NAME=e,r.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(i({},r,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:Fr._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:kr;return t!==kr&&(t=kr+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(f))===C||(null==(t=this.sessionPersistence)?void 0:t.get_property(f))===C}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===O&&!this._isIdentified()&&ve(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[a])&&(null==(t=this.persistence)||null==(t=t.props)||!t[x]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Nt.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(x,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==I)}_sync_opt_out_with_persistence(){var e,t,i,s,r=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==k){if(this._inCookielessMode()){var i,s,r,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new _r(this),this.pageViewManager=new yi(this),this.persistence&&(this.sessionPropsManager=new or(this,this.sessionManager,this.persistence));var a,l=null!==(r=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==r?r:null==(o=Fr.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var _,u;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==I&&(null==(_=this.surveys)||_.loadIfEnabled()),(fe(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(u=null==e?void 0:e.captureEventName)&&void 0!==u?u:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Nt.warn(Er)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==k?(this.config.cookieless_mode===I&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===I&&(this.register({distinct_id:E,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):Nt.warn(Er)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===k||(this.config.cookieless_mode===I?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return H?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&ae(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>ae(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver}(H,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){G&&("visible"===G.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(L,{title:G.title},{send_instantly:!0}),this._visibilityStateListener&&(G.removeEventListener(A,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Yt(G,A,this._visibilityStateListener)))}debug(e){!1===e?(null==N||N.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==N||N.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var e,t,i,s,r,n,o=this._originalUserConfig||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Nt.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",!1,s=Nt,r=(t="advanced_disable_flags")in(e=o)&&!we(e[t]),n=i in e&&!we(e[i]),r?e[t]:!!n&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}_runBeforeSend(e){var t;if(we(this.config.before_send))return e;var i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Ie),s=he(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s){if(r=n(r),we(r)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Te(e.event)?Nt.warn(o+". This can cause unexpected behavior."):Nt.info(o),null}r.properties&&!ve(r.properties)||Nt.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(r.properties&&we(r.properties[a]))return Nt.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=Ee(e)&&!e,i=oi._is_supported()&&"true"===oi._get("ph_debug");return!t&&(!!i||e)}}Fr.__defaultExtensionClasses={},Fr._noopLogger={trace:br=()=>{},debug:br,info:br,warn:br,error:br,fatal:br},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=zt(e.prototype[t[i]])}(Fr,["identify"]);var Lr=function(){r.SDK_DIST_CHANNEL="npm";var e=wr[kr]=new Fr;return function(){function e(){e.done||(e.done=!0,$r=!1,Ht(wr,(function(e){e._dom_loaded()})))}null!=G&&G.addEventListener?"complete"===G.readyState?e():Yt(G,"DOMContentLoaded",e,{capture:!1}):N&&Nt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{us as Compression,is as DEFAULT_PRODUCT_TOUR_APPEARANCE,ts as DisplaySurveyType,Fr as PostHog,ss as ProductTourEventName,rs as ProductTourEventProperties,Zi as SurveyEventName,es as SurveyEventProperties,Vi as SurveyEventType,Wi as SurveyPosition,Qi as SurveyQuestionBranchingType,Ji as SurveyQuestionType,Xi as SurveySchedule,Yi as SurveyTabPosition,Ki as SurveyType,ji as SurveyWidgetType,Lr as default,Lr as posthog,_s as severityLevels};
1
+ function e(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function t(t){return function(){var i=this,s=arguments;return new Promise((function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}var s="1.391.7",r={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},n="$people_distinct_id",o="$device_id",a="__alias",l="__timers",_="$dead_clicks_enabled_server_side",u="$session_recording_remote_config",d="$sesid",c="$session_is_sampled",h="$enabled_feature_flags",p="$surveys_loaded_at",g="$flag_call_reported",v="$feature_flag_evaluated_at",f="$user_state",m="$client_session_props",y="$capture_rate_limit",b="$initial_campaign_params",w="$initial_referrer_info",S="$initial_person_info",x="$epp",E="$posthog_cookieless",P="$sdk_debug_extensions_init_method",T="$sdk_debug_extensions_init_time_ms",I="on_reject",k="always",R="anonymous",C="identified",O="identified_only",A="visibilitychange",F="beforeunload",L="$pageview",M="$pageleave",D="$identify",U="$groupidentify",N="undefined"!=typeof window?window:void 0,q="undefined"!=typeof globalThis?globalThis:N;"undefined"==typeof self&&(q.self=q),"undefined"==typeof File&&(q.File=function(){});var B,H=null==q?void 0:q.navigator,G=null==q?void 0:q.document,z=null==q?void 0:q.location,V=null==q?void 0:q.fetch,j=null!=q&&q.XMLHttpRequest&&"withCredentials"in new q.XMLHttpRequest?q.XMLHttpRequest:void 0,W=null==q?void 0:q.AbortController,Y=null==q?void 0:q.CompressionStream,K=null==H?void 0:H.userAgent,J=null!=N?N:{},Q=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),X=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],Z=["token"],ee="NativeGzipValidationError",te=e=>e.length>=2&&31===e[0]&&139===e[1],ie=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),se=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=ee,t},re=function(){var e=t((function*(e,t){18>e.size&&se("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());te(i)&&8===i[2]||se("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(B)return B;B=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;B[e]=t>>>0}return B})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&se("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&se("invalid-size")}));return function(t,i){return e.apply(this,arguments)}}();function ne(){return ne=t((function*(e,i,s){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(e),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then((()=>o.close())).catch(function(){var e=t((function*(e){try{yield o.abort(e)}catch(e){}throw e}));return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),[_]=yield Promise.all([l,a]);return yield re(_,r),_}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})),ne.apply(this,arguments)}var oe=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],ae=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return oe.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function le(e,t){return-1!==e.indexOf(t)}var _e=function(e){return e.replace(/^\$/,"")},ue=Object.prototype,de=ue.hasOwnProperty,ce=ue.toString,he=Array.isArray||function(e){return"[object Array]"===ce.call(e)},pe=e=>"function"==typeof e,ge=e=>e===Object(e)&&!he(e),ve=e=>{if(ge(e)){for(var t in e)if(de.call(e,t))return!1;return!0}return!1},fe=e=>void 0===e,me=e=>"[object String]"==ce.call(e),ye=e=>me(e)&&0===e.trim().length,be=e=>null===e,we=e=>fe(e)||be(e),Se=e=>"[object Number]"==ce.call(e)&&e==e,xe=e=>Se(e)&&e>0,Ee=e=>"[object Boolean]"===ce.call(e),Pe=e=>e instanceof FormData,Te=e=>le(X,e),Ie=e=>le(Z,e),ke=[!0,"true",1,"1","yes"],$e=e=>le(ke,e),Re=[!1,"false",0,"0","no"];function Ce(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Se(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Ce(r||i,t,i,s))}var Oe="Mobile",Ae="iOS",Fe="Android",Le="Tablet",Me=Fe+" "+Le,De="iPad",Ue="Apple",Ne=Ue+" Watch",qe="Safari",Be="BlackBerry",He="Samsung",Ge=He+"Browser",ze=He+" Internet",Ve="Chrome",je=Ve+" OS",We=Ve+" "+Ae,Ye="Internet Explorer",Ke=Ye+" "+Oe,Je="Opera",Qe=Je+" Mini",Xe="Edge",Ze="Microsoft "+Xe,et="Firefox",tt=et+" "+Ae,it="Nintendo",st="PlayStation",rt="Xbox",nt=Fe+" "+Oe,ot=Oe+" "+qe,at="Windows",lt=at+" Phone",_t="Nokia",ut="Ouya",dt="Generic",ct=dt+" "+Oe.toLowerCase(),ht=dt+" "+Le.toLowerCase(),pt="Konqueror",gt="Oculus Browser",vt="Vivaldi",ft="Yandex",mt="Whale",yt="DuckDuckGo",bt="Pale Moon",wt="Waterfox",St="Brave",xt="Google Search App",Et="(\\d+(\\.\\d+)?)",Pt=new RegExp("Version/"+Et),Tt=new RegExp(rt,"i"),It=new RegExp(st+" \\w+","i"),kt=new RegExp(it+" \\w+","i"),$t=new RegExp(Be+"|PlayBook|BB10","i"),Rt={"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"},Ct=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?St:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&le(e,"GSA/")?xt:le(e," OPR/")&&le(e,"Mini")?Qe:le(e," OPR/")?Je:$t.test(e)?Be:le(e,"IE"+Oe)||le(e,"WPDesktop")?Ke:le(e,"OculusBrowser")?gt:le(e,Ge)?ze:le(e,Xe)||le(e,"Edg/")?Ze:le(e,vt+"/")?vt:le(e,"YaBrowser/")?ft:le(e,mt+"/")?mt:le(e,yt+"/")||le(e,"Ddg/")?yt:le(e,"FBIOS")?"Facebook "+Oe:le(e,"UCWEB")||le(e,"UCBrowser")?"UC Browser":le(e,"CriOS")?We:le(e,"CrMo")||le(e,Ve)?Ve:le(e,Fe)&&le(e,qe)?nt:le(e,"FxiOS")?tt:le(e.toLowerCase(),pt.toLowerCase())?pt:le(e,St+"/")?St:((e,t)=>t&&le(t,Ue)||function(e){return le(e,qe)&&!le(e,Ve)&&!le(e,Fe)}(e))(e,t)?le(e,Oe)?ot:qe:le(e,"PaleMoon/")?bt:le(e,wt+"/")?wt:le(e,et)?et:le(e,"MSIE")||le(e,"Trident/")?Ye:le(e,"Gecko")?et:"")},Ot={[Ke]:[new RegExp("rv:"+Et)],[Ze]:[new RegExp(Xe+"?\\/"+Et)],[Ve]:[new RegExp("("+Ve+"|CrMo)\\/"+Et)],[We]:[new RegExp("CriOS\\/"+Et)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Et)],[qe]:[Pt],[ot]:[Pt],[Je]:[new RegExp("(Opera|OPR)\\/"+Et)],[et]:[new RegExp(et+"\\/"+Et)],[tt]:[new RegExp("FxiOS\\/"+Et)],[pt]:[new RegExp("Konqueror[:/]?"+Et,"i")],[Be]:[new RegExp(Be+" "+Et),Pt],[nt]:[new RegExp("android\\s"+Et,"i")],[ze]:[new RegExp(Ge+"\\/"+Et)],[gt]:[new RegExp("OculusBrowser\\/"+Et)],[vt]:[new RegExp(vt+"\\/"+Et)],[ft]:[new RegExp("YaBrowser\\/"+Et)],[mt]:[new RegExp(mt+"\\/"+Et)],[St]:[new RegExp(St+"\\/"+Et)],[yt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Et)],[bt]:[new RegExp("PaleMoon\\/"+Et)],[wt]:[new RegExp(wt+"\\/"+Et)],[xt]:[new RegExp("GSA\\/"+Et)],[Ye]:[new RegExp("(rv:|MSIE )"+Et)],Mozilla:[new RegExp("rv:"+Et)]},At=function(e,t,i,s){var r=Ct(e,t,i,s),n=Ot[r];if(fe(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Ft=[[new RegExp(rt+"; "+rt+" (.*?)[);]","i"),e=>[rt,e&&e[1]||""]],[new RegExp(it,"i"),[it,""]],[new RegExp(st,"i"),[st,""]],[$t,[Be,""]],[new RegExp(at,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[lt,""];if(new RegExp(Oe).test(t)&&!/IEMobile\b/.test(t))return[at+" "+Oe,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=Rt[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[at,s]}return[at,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Ae,[e[3],e[4],e[5]||"0"].join(".")]:[Ae,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=fe(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Fe+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Fe+")","i"),e=>e&&e[2]?[Fe,[e[2],e[3],e[4]||"0"].join(".")]:[Fe,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[je,""]],[/Linux|debian/i,["Linux",""]]],Lt=function(e){return kt.test(e)?it:It.test(e)?st:Tt.test(e)?rt:new RegExp(ut,"i").test(e)?ut:new RegExp("("+lt+"|WPDesktop)","i").test(e)?lt:/iPad/.test(e)?De:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ne:$t.test(e)?Be:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(_t,"i").test(e)?_t:/(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(Oe).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)?Fe:Me:new RegExp("(pda|"+Oe+")","i").test(e)?ct:new RegExp(Le,"i").test(e)&&!new RegExp(Le+" pc","i").test(e)?ht:""},Mt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Dt(e,t){return"string"==typeof(i=e)&&Mt.test(i)?e:t();var i}var Ut=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={_log(t){if(N&&(r.DEBUG||J.POSTHOG_DEBUG||i)&&!fe(N.console)&&N.console){for(var s=("__rrweb_original__"in N.console[t]?N.console[t].__rrweb_original__:N.console[t]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Ut(e+" "+t,i)};return s},Nt=Ut("[PostHog.js]"),qt=Nt.createLogger;function Bt(e,t){he(e)&&e.forEach(t)}function Ht(e,t){if(!we(e))if(he(e))e.forEach(t);else if(Pe(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)de.call(e,i)&&t(e[i],i)}var Gt=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e},zt=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){Nt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Nt.critical(e)}}},Vt=function(e){var t={};return Ht(e,(function(e,i){(me(e)&&e.length>0||Se(e))&&(t[i]=e)})),t};var jt=["herokuapp.com","vercel.app","netlify.app"];function Wt(e){var t=null==e?void 0:e.hostname;if(!me(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of jt)if(i===s)return!1;return!0}function Yt(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Se(e)&&isFinite(e)&&Math.floor(e)===e});class Kt{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/Math.pow(2,8),r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new Kt(r)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Kt(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class Jt{constructor(){this._timestamp=0,this._counter=0,this._random=new Zt}generate(){var e=this.generateOrAbort();if(fe(e)){this._timestamp=0;var t=this.generateOrAbort();if(fe(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return Kt.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}}var Qt,Xt=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};N&&!fe(N.crypto)&&crypto.getRandomValues&&(Xt=e=>crypto.getRandomValues(e));class Zt{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(Xt(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var ei=()=>ti().toString(),ti=()=>(Qt||(Qt=new Jt)).generate(),ii="",si=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ri={_is_supported:()=>!!G,_error(e){Nt.error("cookieStore error: "+e)},_get(e){if(G){try{for(var t=e+"=",i=G.cookie.split(";").filter((e=>e.length)),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},_parse(e){var t;try{t=JSON.parse(ri._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!G)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=G),ii)return ii;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+ei();!ii&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",ii=n)}return ii}(e);if(!i){var s=(e=>{var t=e.match(si);return t?t[0]:""})(e);s!==i&&Nt.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(G.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var _=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return _.length>3686.4&&Nt.warn("cookieStore warning: large cookie, len="+_.length),G.cookie=_,!0}catch(e){return!1}},_remove(e,t){if(null!=G&&G.cookie)try{ri._set(e,"",-1,t)}catch(e){return}}},ni=null,oi={_is_supported(){if(!be(ni))return ni;var e=!0;if(fe(N))e=!1;else try{var t="__mplssupport__";oi._set(t,"xyz"),'"xyz"'!==oi._get(t)&&(e=!1),oi._remove(t)}catch(t){e=!1}return e||Nt.error("localStorage unsupported; falling back to cookie store"),ni=e,e},_error(e){Nt.error("localStorage error: "+e)},_get(e){try{return null==N?void 0:N.localStorage.getItem(e)}catch(e){oi._error(e)}return null},_parse(e){try{return JSON.parse(oi._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==N||N.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){oi._error(e)}return!1},_remove(e){try{null==N||N.localStorage.removeItem(e)}catch(e){oi._error(e)}}},ai=[o,"distinct_id",d,c,x,S,f],li={},_i={_is_supported:()=>!0,_error(e){Nt.error("memoryStorage error: "+e)},_get:e=>li[e]||null,_parse:e=>li[e]||null,_set:(e,t)=>(li[e]=t,!0),_remove(e){delete li[e]}},ui=null,di={_is_supported(){if(!be(ui))return ui;if(ui=!0,fe(N))ui=!1;else try{var e="__support__";di._set(e,"xyz"),'"xyz"'!==di._get(e)&&(ui=!1),di._remove(e)}catch(e){ui=!1}return ui},_error(e){Nt.error("sessionStorage error: ",e)},_get(e){try{return null==N?void 0:N.sessionStorage.getItem(e)}catch(e){di._error(e)}return null},_parse(e){try{return JSON.parse(di._get(e))||null}catch(e){}return null},_set(e,t){try{return null==N||N.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){di._error(e)}return!1},_remove(e){try{null==N||N.sessionStorage.removeItem(e)}catch(e){di._error(e)}}};class ci{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===k||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===I}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return $e(e)?1:le(Re,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?oi:ri;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?ri:oi;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut($e(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==H?void 0:H.doNotTrack,null==H?void 0:H.msDoNotTrack,J.doNotTrack].some((e=>$e(e)))}}var hi=["next","previous","prev",">","<","+","-","−","–"];qt("[Dead Clicks]");var pi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(_)),s=e.instance.config.capture_dead_clicks;return Ee(s)?s:!!ge(s)||i},gi=qt("[SegmentIntegration]");var vi="posthog-js";function fi(e,t){var{organization:s,projectId:r,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,_,u,d,c;if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=(null==(l=t.exception)?void 0:l.values)||[],v=g.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),f={$exception_message:(null==(_=g[0])?void 0:_.value)||t.message,$exception_type:null==(u=g[0])?void 0:u.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(c=g[0])?void 0:c.type,$sentry_tags:t.tags};return s&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+t.event_id),a&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class mi{constructor(e,t,i,s,r,n){this.name=vi,this.setupOnce=function(o){o(fi(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class yi{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Nt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==N?void 0:N.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:_,maxContentY:u}=r;if(!(fe(n)||fe(o)||fe(a)||fe(l)||fe(_)||fe(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),_=Math.ceil(_),u=Math.ceil(u);var d=n>1?Ce(o/n,0,1,Nt):1,c=n>1?Ce(a/n,0,1,Nt):1,h=l>1?Ce(_/l,0,1,Nt):1,p=l>1?Ce(u/l,0,1,Nt):1;s=Gt(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:_,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var bi=["flags","surveys"],wi={[n]:{exposure:"hidden"},[a]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[l]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$exception_capture_enabled_server_side:{exposure:"event"},$error_tracking_suppression_rules:{exposure:"hidden"},$error_tracking_capture_extension_exceptions:{exposure:"event"},$web_vitals_enabled_server_side:{exposure:"event"},[_]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[u]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[d]:{exposure:"hidden"},[c]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:e=>be(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[h]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!ge(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},$active_feature_flags:{exposure:"event",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},$feature_flag_details:{exposure:"hidden",storageGroup:"flags"},$feature_flag_payloads:{exposure:"event",storageGroup:"flags"},$feature_flag_request_id:{exposure:"event",storageGroup:"flags",volatile:!0},$override_feature_flags:{exposure:"event"},$override_feature_flag_payloads:{exposure:"hidden"},$stored_person_properties:{exposure:"hidden"},$stored_group_properties:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[p]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[g]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},$feature_flag_errors:{exposure:"hidden"},[v]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[f]:{exposure:"hidden"},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[b]:{exposure:"hidden"},[w]:{exposure:"hidden"},[S]:{exposure:"hidden"},[x]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[P]:{exposure:"event"},[T]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Si=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],xi=e=>{var t=wi[e];if(t)return t;for(var[i,s]of Si)if(0===e.indexOf(i))return s},Ei=e=>{var t=null==G?void 0:G.createElement("a");return fe(t)?null:(t.href=e,t)},Pi=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!he(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Nt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ti=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),_=[],u=0;l.length>u;u++){var d=l[u].split("=");he(d)&&(t.includes(d[0])?_.push(d[0]+"="+i):_.push(l[u]))}var c=a;return null!=o&&(c+="?"+_.join("&")),null!=r&&(c+="#"+r),c},Ii="https?://(.*)",ki=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],$i=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ki],Ri="<masked>",Ci=["li_fat_id"];function Oi(e,t){var i=$i.concat(t||[]),s={};return Ht(i,(function(t){var i=Pi(e,t);s[t]=i||null})),s}function Ai(e){var t=function(e){return e?0===e.search(Ii+"google.([^/?]*)")?"google":0===e.search(Ii+"bing.com")?"bing":0===e.search(Ii+"yahoo.com")?"yahoo":0===e.search(Ii+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!be(t)){s.$search_engine=t;var r=G?Pi(G.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function Fi(){return navigator.language||navigator.userLanguage}var Li="$direct";function Mi(){return(null==G?void 0:G.referrer)||Li}function Di(e,t){var i=e?[...ki,...t||[]]:[],s=null==z?void 0:z.href.substring(0,1e3);return{r:Mi().substring(0,1e3),u:s?Ti(s,i,Ri):void 0}}function Ui(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==Li?Li:null==(t=Ei(i))?void 0:t.host};if(s){r.$current_url=s;var n=Ei(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var o=Oi(s);Gt(r,o)}if(i){var a=Ai(i);Gt(r,a)}return r}function Ni(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function qi(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Bi={flags:v,surveys:p},Hi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Gi="main";class zi{constructor(e,t,s){if(void 0===s&&(s=!0),this._slotState={},this._splitStorageEligible=!1,this._splitStorage=!1,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_saved=!1,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),e.debug&&Nt.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),N){var r=()=>this.flush();Yt(N,"beforeunload",r,{capture:!1}),Yt(N,"pagehide",r,{capture:!1})}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Se(t)&&t>0?t:0}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Hi.indexOf(e.persistence.toLowerCase())&&(Nt.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var s=[...ai,...e];return i({},oi,{_parse(e){try{var i={};try{i=ri._parse(e)||{}}catch(e){}var s,r=JSON.parse(oi._get(e)||"{}");if(t){var n={};for(var o in i){var a=i[o];be(a)||""===a||(n[o]=a)}s=Gt(r,n)}else s=Gt(i,r);return oi._set(e,s),s}catch(e){}return null},_set(e,t,i,r,n,o){var a=oi._set(e,t,void 0,void 0,o);try{var l={};s.forEach((e=>{t[e]&&(l[e]=t[e])})),Object.keys(l).length&&ri._set(e,l,i,r,n,o)}catch(e){oi._error(e)}return a},_remove(e,t){try{null==N||N.localStorage.removeItem(e),ri._remove(e,t)}catch(e){oi._error(e)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&oi._is_supported()?(t=oi,r=!0):"localstorage+cookie"===n&&s._is_supported()?(t=s,r=!0):"sessionstorage"===n&&di._is_supported()?t=di:"memory"===n?t=_i:"cookie"===n?t=ri:s._is_supported()?(t=s,r=!0):t=ri,this._splitStorageEligible=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[v];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return Ht(this.props,((t,i)=>{var s=xi(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===h?()=>this._isFeatureFlagCacheStale():()=>!1))return;s.transformToEventProperties&&Gt(e,s.transformToEventProperties(t))}else if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,(()=>!1)))return;e[i]=t}})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=Gt({},e)),this._splitStorage&&this._loadGroupEntries()}}_loadGroupEntries(){for(var e of bi){var t=oi._parse(this._groupEntryName(e));if(t&&!ve(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Gt(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some((t=>{var i;return(null==(i=xi(t))?void 0:i.storageGroup)===e}))}_groupEntryIsStale(e,t){var i=Bi[e];if(!i)return!1;var s=t[i],r=this.props[i];return Se(s)&&Se(r)&&r>s}refreshKey(e){var t;if(!this._disabled){var i=this._splitStorage?null==(t=xi(e))?void 0:t.storageGroup:void 0,s=i?oi._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e]);else{if(i){var r=this._storage._parse(this._name);if(r&&e in r)return void this._setProp(e,r[e])}this._deleteProp(e)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?fe(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout((()=>{this._pendingSaveTimer=void 0,this._writeNow()}),e)):this._writeNow()}}flush(){fe(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(){this._disabled||(this._splitStorage?this._writeNowSplit():this._writeEntry(this._storage,this._name,this.props,Gi))}_writeNowSplit(){var{main:e,groups:t}=this._partitionProps();for(var i of(this._writeEntry(this._storage,this._name,e,Gi),bi)){var s,r=t[i];(!ve(r)||null!=(s=this._slotState[i])&&s.persisted)&&this._writeEntry(oi,this._groupEntryName(i),r,i)}}_partitionProps(){var e={},t={};for(var i of bi)t[i]={};return Ht(this.props,((i,s)=>{var r,n=null==(r=xi(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i})),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Gi)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return Ht(e,((e,t)=>{var s;i[t]=null!=(s=xi(t))&&s.volatile?"__volatile__":e})),JSON.stringify(i)}_writeEntry(e,t,i,s){var r=this._slotWriteState(s);if(s===Gi||r.dirty||fe(r.fingerprint)){var n;try{if((n=this._entryFingerprint(i,s))===r.fingerprint)return void(r.dirty=!1)}catch(e){n=void 0}e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(r.dirty=!1,s!==Gi&&(r.persisted=!0),fe(n)||(r.fingerprint=n)):this._config.debug&&Nt.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(fe(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!t&&this._ownsSplitStorage)for(var i of bi)oi._remove(this._groupEntryName(i));t?delete this._slotState[Gi]:this._slotState={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(ge(e)){fe(t)&&(t="None"),this._expire_days=fe(i)?this._default_expiry:i;var s=!1;if(Ht(e,((e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(ge(e)){this._expire_days=fe(t)?this._default_expiry:t;var i=!1;if(Ht(e,((t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this._setProp(s,t),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this._deleteProp(e),this.save())}update_campaign_params(){if(!this._campaign_params_saved){var e=function(e,t,i){if(!G)return{};var s,r=t?[...ki,...i||[]]:[],n=Oi(Ti(G.URL,r,Ri),e),o=(s={},Ht(Ci,(function(e){var t=ri._get(e);s[e]=t||null})),s);return Gt(o,n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);ve(Vt(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==G?void 0:G.referrer)?Ai(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Mi(),$referring_domain:null!=G&&G.referrer&&(null==(e=Ei(G.referrer))?void 0:e.host)||Li},void 0)}set_initial_person_info(){this.props[b]||this.props[w]||this.register_once({[S]:Di(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Ht([w,b],(t=>{var i=this.props[t];i&&Ht(i,(function(t,i){e["$initial_"+_e(i)]=t}))}));var t,i,s=this.props[S];if(s){var r=(t=Ui(s),i={},Ht(t,(function(e,t){i["$initial_"+_e(t)]=e})),i);Gt(e,r)}return e}safe_merge(e){return Ht(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every(((e,t)=>e===s[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s?this._buildStorage(e):this._storage,n=this._resolveSplitStorage(e);if(s||n!==this._splitStorage){var o=this.props;this.clear(),this._storage=r,this._splitStorage=n,this.props=o,this.save()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[l]||{};i[e]=t,this._setProp(l,i),this.save()}remove_event_timer(e){var t=this.props[l]||{},i=t[e];return fe(i)||(delete t[e],this._setProp(l,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t){var i;this.props[e]=t,null!=(i=xi(e))&&i.volatile||this._markGroupDirty(e)}_deleteProp(e){delete this.props[e],this._markGroupDirty(e)}_markGroupDirty(e){var t,i=null==(t=xi(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Vi={Activation:"events",Cancellation:"cancelEvents"},ji={Button:"button",Tab:"tab",Selector:"selector"},Wi={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Yi={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Ki={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Ji={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Qi={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Xi={Once:"once",Recurring:"recurring",Always:"always"},Zi={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},es={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},ts={Popover:"popover",Inline:"inline"},is={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},ss={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},rs={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ns=qt("[RateLimiter]");class os{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{ns.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void ns.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(y))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(y,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var as=qt("[RemoteConfig]");class ls{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=J._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=J.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=J.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return as.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void as.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return as.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){as.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){!this._instance._shouldDisableFlags()&&G&&"hidden"!==G.visibilityState&&this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){var t;e||as.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var _s=["fatal","error","warning","log","info","debug"],us={GZipJS:"gzip-js",Base64:"base64"},ds=Uint8Array,cs=Uint16Array,hs=Uint32Array,ps=new ds([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gs=new ds([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),vs=new ds([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fs=function(e,t){for(var i=new cs(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new hs(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},ms=fs(ps,2),ys=ms[1];ms[0][28]=258,ys[258]=28;for(var bs=fs(gs,0)[1],ws=new cs(32768),Ss=0;32768>Ss;++Ss){var xs=(43690&Ss)>>>1|(21845&Ss)<<1;ws[Ss]=((65280&(xs=(61680&(xs=(52428&xs)>>>2|(13107&xs)<<2))>>>4|(3855&xs)<<4))>>>8|(255&xs)<<8)>>>1}var Es=function(e,t,i){for(var s=e.length,r=0,n=new cs(t);s>r;++r)++n[e[r]-1];var o,a=new cs(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new cs(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var _=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,c=d|(1<<u)-1;c>=d;++d)o[ws[d]>>>l]=_}else for(o=new cs(s),r=0;s>r;++r)o[r]=ws[a[e[r]-1]++]>>>15-e[r];return o},Ps=new ds(288);for(Ss=0;144>Ss;++Ss)Ps[Ss]=8;for(Ss=144;256>Ss;++Ss)Ps[Ss]=9;for(Ss=256;280>Ss;++Ss)Ps[Ss]=7;for(Ss=280;288>Ss;++Ss)Ps[Ss]=8;var Ts=new ds(32);for(Ss=0;32>Ss;++Ss)Ts[Ss]=5;var Is=Es(Ps,9,0),ks=Es(Ts,5,0),$s=function(e){return(e/8>>0)+(7&e&&1)},Rs=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof cs?cs:e instanceof hs?hs:ds)(i-t);return s.set(e.subarray(t,i)),s},Cs=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Os=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},As=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new ds(0),0];if(1==r){var o=new ds(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],_=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=i[i[d].f>i[_].f?_++:d++],l=i[_!=u&&i[d].f>i[_].f?_++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var c=n[0].s;for(s=1;r>s;++s)n[s].s>c&&(c=n[s].s);var h=new cs(c+1),p=Fs(i[u-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new ds(h),p]},Fs=function(e,t,i){return-1==e.s?Math.max(Fs(e.l,t,i+1),Fs(e.r,t,i+1)):t[e.s]=i},Ls=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new cs(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},Ms=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},Ds=function(e,t,i){var s=i.length,r=$s(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},Us=function(e,t,i,s,r,n,o,a,l,_,u){Cs(t,u++,i),++r[256];for(var d=As(r,15),c=d[0],h=d[1],p=As(n,15),g=p[0],v=p[1],f=Ls(c),m=f[0],y=f[1],b=Ls(g),w=b[0],S=b[1],x=new cs(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var P=As(x,7),T=P[0],I=P[1],k=19;k>4&&!T[vs[k-1]];--k);var R,C,O,A,F=_+5<<3,L=Ms(r,Ps)+Ms(n,Ts)+o,M=Ms(r,c)+Ms(n,g)+o+14+3*k+Ms(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(L>=F&&M>=F)return Ds(t,u,e.subarray(l,l+_));if(Cs(t,u,1+(L>M)),u+=2,L>M){R=Es(c,h,0),C=c,O=Es(g,v,0),A=g;var D=Es(T,I,0);for(Cs(t,u,y-257),Cs(t,u+5,S-1),Cs(t,u+10,k-4),u+=14,E=0;k>E;++E)Cs(t,u+3*E,T[vs[E]]);u+=3*k;for(var U=[m,w],N=0;2>N;++N){var q=U[N];for(E=0;q.length>E;++E)Cs(t,u,D[B=31&q[E]]),u+=T[B],B>15&&(Cs(t,u,q[E]>>>5&127),u+=q[E]>>>12)}}else R=Is,C=Ps,O=ks,A=Ts;for(E=0;a>E;++E)if(s[E]>255){var B;Os(t,u,R[257+(B=s[E]>>>18&31)]),u+=C[B+257],B>7&&(Cs(t,u,s[E]>>>23&31),u+=ps[B]);var H=31&s[E];Os(t,u,O[H]),u+=A[H],H>3&&(Os(t,u,s[E]>>>5&8191),u+=gs[H])}else Os(t,u,R[s[E]]),u+=C[s[E]];return Os(t,u,R[256]),u+C[256]},Ns=new hs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qs=function(){for(var e=new hs(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Bs=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Hs(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=qs[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,_=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new ds(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),_=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?_=Ds(l,_,e.subarray(u,d)):(l[u]=!0,_=Ds(l,_,e.subarray(u,o)))}else{for(var c=Ns[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new cs(32768),f=new cs(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new hs(25e3),S=new cs(288),x=new cs(32),E=0,P=0,T=(u=0,0),I=0,k=0;o>u;++u){var R=b(u),C=32767&u,O=f[R];if(v[C]=O,f[R]=C,u>=I){var A=o-u;if((E>7e3||T>24576)&&A>423){_=Us(e,l,0,w,S,x,P,T,k,u-k,_),T=E=P=0,k=u;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[F]=0}var L=2,M=0,D=p,U=C-O&32767;if(A>2&&R==b(u-U))for(var N=Math.min(h,A)-1,q=Math.min(32767,u),B=Math.min(258,A);q>=U&&--D&&C!=O;){if(e[u+L]==e[u+L-U]){for(var H=0;B>H&&e[u+H]==e[u+H-U];++H);if(H>L){if(L=H,M=U,H>N)break;var G=Math.min(U,H-2),z=0;for(F=0;G>F;++F){var V=u-U+F+32768&32767,j=V-v[V]+32768&32767;j>z&&(z=j,O=V)}}}U+=(C=O)-(O=v[C])+32768&32767}if(M){w[T++]=268435456|ys[L]<<18|bs[M];var W=31&ys[L],Y=31&bs[M];P+=ps[W]+gs[Y],++S[257+W],++x[Y],I=u+L,++E}else w[T++]=e[u],++S[e[u]]}}_=Us(e,l,!0,w,S,x,P,T,k,u-k,_)}return Rs(a,0,s+$s(_)+r)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=_.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Bs(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(_,t),Bs(_,u-8,i.d()),Bs(_,u-4,s),_}var Gs=!!j||!!V,zs="text/plain",Vs=!1,js=(e,t)=>{var[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;var o=n.split("&").filter((e=>e.split("=")[0]!==t)).join("&");return r+(o?"?"+o:"")+(s?"#"+s:"")},Ws=function(e,t,s){var r;void 0===s&&(s=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(r=null==o?void 0:o.split("&").map((e=>{var t,[i,r]=e.split("="),n=s&&null!==(t=a[i])&&void 0!==t?t:r;return delete a[i],i+"="+n})))&&void 0!==r?r:[],_=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return Ht(e,(function(e,t){fe(e)||fe(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)})),r.join(t)}(a);return _&&l.push(_),n+"?"+l.join("&")},Ys=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Ks=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===us.GZipJS){var s=Hs(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new ds(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new ds(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Rs(s,0,r)}(Ys(t)),{mtime:0});return{contentType:zs,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===us.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Ys(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Ys(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Ys(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Js=e=>{var t,s,r,n=Ks(e);return!n||(s=e.compression,r=Pi(e.url,"compression"),s!==Q.GZipJS&&r!==Q.GZipJS&&"gzip"!==r)||((t=n.body)instanceof ArrayBuffer?te(new Uint8Array(t)):ArrayBuffer.isView(t)&&te(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:n}:(Vs=!0,{url:js(e.url,"compression"),encodedBody:Ks(i({},e,{compression:void 0,_encodedBody:void 0}))})},Qs=function(){var e=t((function*(e){var t=Ys(e.data),s=yield function(e,t,i){return ne.apply(this,arguments)}(t,r.DEBUG,{rethrow:!0});if(!s)return e;var n=yield s.arrayBuffer();return i({},e,{_encodedBody:{contentType:zs,body:n,estimatedSize:n.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),Xs=(e,t)=>Ws(e,{_:(new Date).getTime().toString(),ver:r.JS_SDK_VERSION,compression:t}),Zs=[];V&&Zs.push({transport:"fetch",method(e){var t,{url:s,encodedBody:r}=Js(e),{contentType:n,body:o,estimatedSize:a}=null!=r?r:{},l=new Headers;Ht(e.headers,(function(e,t){l.append(t,e)})),n&&l.append("Content-Type",n);var _=null;if(W){var u=new W;_={signal:u.signal,timeout:setTimeout((()=>u.abort()),e.timeout)}}V(s,i({method:(null==e?void 0:e.method)||"GET",headers:l,keepalive:"POST"===e.method&&52428.8>(a||0),body:o,signal:null==(t=_)?void 0:t.signal},e.fetchOptions)).then((t=>t.text().then((i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){Nt.error(e)}null==e.callback||e.callback(s)})))).catch((t=>{Nt.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>_?clearTimeout(_.timeout):null))}}),j&&Zs.push({transport:"XHR",method(e){var t=new j,{url:i,encodedBody:s}=Js(e);t.open(e.method||"GET",i,!0);var{contentType:r,body:n}=null!=s?s:{};Ht(e.headers,(function(e,i){t.setRequestHeader(i,e)})),r&&t.setRequestHeader("Content-Type",r),e.timeout&&(t.timeout=e.timeout),t.onreadystatechange=()=>{if(4===t.readyState){var i={statusCode:t.status,text:t.responseText};if(200===t.status)try{i.json=JSON.parse(t.responseText)}catch(e){}null==e.callback||e.callback(i)}},t.send(n)}}),null!=H&&H.sendBeacon&&Zs.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:i}=Js(e),{contentType:s,body:r}=null!=i?i:{};if(!r)return;var n=r instanceof Blob?r:new Blob([r],{type:s});H.sendBeacon(t,n)}catch(e){}}});var er=3e3;class tr{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Ce((null==t?void 0:t.flush_interval_ms)||er,250,5e3,Nt.createLogger("flush interval"),er),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequest(i({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&he(i.data)&&Ht(i.data,(e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e._sendRequest(i)};for(var s in t)i()}}),this._flushTimeoutMs))}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Ht(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;fe(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var ir=["retriesPerformedSoFar"];class sr{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!fe(N)&&"onLine"in N.navigator&&(this._areWeOnline=N.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Yt(N,"online",this._onlineListener),Yt(N,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}(e,ir);xe(t)&&(s.url=Ws(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(i({retriesPerformedSoFar:t},s));0===e.statusCode&&Nt.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==s.callback||s.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=Math.random()-.5;return Math.ceil(s+r*(s-i))}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),Nt.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter((i=>e>i.retryAt||(t.push(i),!1)));if(this._queue=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,fe(N)||(this._onlineListener&&(N.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(N.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){Nt.error(e)}this._queue=[]}}class rr{constructor(e){this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Yt(N,"scroll",this._updateScrollData,{capture:!0}),Yt(N,"scrollend",this._updateScrollData,{capture:!0}),Yt(N,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==N?void 0:N.document.documentElement;var e=he(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==N?void 0:N.document.querySelector(t);if(i)return i}}_scrollPosition(e){var t="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var i=this.scrollElement();return i&&i[t]||0}return N?"y"===e?N.scrollY||N.pageYOffset||N.document.documentElement.scrollTop||0:N.scrollX||N.pageXOffset||N.document.documentElement.scrollLeft||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var nr=e=>Di(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class or{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[m]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||nr,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[m]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Ui(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Ht(Vt(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+_e(i)]=t})),e}}class ar{constructor(){this._events={}}on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}}var lr=qt("[SessionId]");class _r{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new ar,this._sessionHasBeenIdleTooLong=(e,t)=>!(!xe(e)||!xe(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===k)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||ei,this._windowIdGenerator=i||ei;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Ce(this._config.session_idle_timeout_seconds||1800,60,36e3,lr.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=di._parse(this._window_id_storage_key),o=di._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:di._remove(this._window_id_storage_key),di._set(this._primary_window_exists_storage_key,!0)}if(null!=(s=this._config.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){lr.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return fe(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&di._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&di._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?di._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!be(t)&&!be(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[d]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return xe(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(d):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!be(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var[,t,i]=this._getSessionId();t===this._sessionId&&i===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[d]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var[e]=this._getSessionId(),t=xe(e)?e:0,i=xe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[d];return he(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&N&&(N.removeEventListener(F,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&di._remove(this._primary_window_exists_storage_key)},Yt(N,F,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===k)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[,s,r]=this._getSessionId(),n=this._freshestActivityTimestamp(),o=this._getWindowId(),a=xe(r)&&Math.abs(i-r)>864e5,l=!1,_=!1,u=!s,d=s,c=!u&&!e&&this._sessionHasBeenIdleTooLong(i,n);c&&((c=this._isSessionIdleAfterCrossTabRefresh(i))||lr.info("cross-tab refresh kept the session alive",{sessionId:s}),[,s,r]=this._getSessionId()),u||c||a?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),lr.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),r=i,l=!0):(o||(o=this._windowIdGenerator(),l=!0),(_=s!==d)&&(lr.info("adopted cross-tab session id",{sessionId:s,windowId:o}),l=!0));var h=xe(n)&&e&&!a?n:i,p=xe(r)?r:(new Date).getTime();this._setWindowId(o),this._setSessionId(s,h,p),e||this._resetIdleTimer();var g={noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a,crossTabAdoption:_};return l&&this._sessionIdChangedHandlers.forEach((e=>e(s,o,g))),{sessionId:s,windowId:o,sessionStartTimestamp:p,changeReason:l?g:void 0,lastActivityTimestamp:n}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()}),1.1*this.sessionTimeoutMs))}}function ur(e,t,i){return Ys({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var dr="custom",cr="i.posthog.com",hr=/^\/static\//;class pr{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+cr,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":dr),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(hr.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return""+i+t}if(this.region===dr)return this.apiHost+t;var s=cr+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}var gr=qt("[Surveys]"),vr={ignoreConditions:!1,ignoreDelay:!1,displayType:ts.Popover},fr=qt("[PostHog ExternalIntegrations]"),mr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class yr{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=J.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return fr.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=J.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(mr[t],(()=>{var i;null==(i=J.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!s&&null!=(r=J.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=J.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,s]of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;t(i)}}}var br,wr={},Sr=0,xr=()=>{},Er='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Pr="Surveys module not available",Tr="sanitize_properties is deprecated. Use before_send instead",Ir="Invalid value for property_denylist config: ",kr="posthog",$r=!Gs&&-1===(null==K?void 0:K.indexOf("MSIE"))&&-1===(null==K?void 0:K.indexOf("Mozilla")),Rr=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Wt(null==G?void 0:G.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:xr,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:z&&me(null==z?void 0:z.search)&&-1!==z.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==N||null==(t=N.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){Nt.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:O,before_send:void 0,request_queue_config:{flush_interval_ms:er},error_tracking:{},_onCapture:xr},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:hi,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e)}))(e))},Cr=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],Or=e=>{var t={};for(var[i,s]of Cr)fe(e[i])||(t[s]=e[i]);var r=Gt({},t,e),n=e.__preview_external_dependency_versioned_paths;return fe(n)||(fe(e.strict_script_versioning)&&(r.strict_script_versioning=!!n),me(n)&&fe(e.asset_host)&&(r.asset_host=n)),he(e.property_blacklist)&&(fe(e.property_denylist)?r.property_denylist=e.property_blacklist:he(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:Nt.error(Ir+e.property_denylist)),r};class Ar{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Nt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Fr{_replaceExtension(e,t){if(e){var i=this._extensions.indexOf(e);-1!==i&&this._extensions.splice(i,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return this.config.cookieless_mode===k||this.config.cookieless_mode===I&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new Ar,this._personProcessingSetOncePropertiesSent=!1,this.version=r.LIB_VERSION,this._internalEventEmitter=new ar,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Rr(),this.SentryIntegration=mi,this.sentryIntegration=e=>function(e,t){var i=fi(e,t);return{name:vi,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new rr(this),this.pageViewManager=new yi(this),this.rateLimiter=new os(this),this.requestRouter=new pr(this),this.consent=new ci(this),this.externalIntegrations=new yr(this);var t=null!==(e=Fr.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=me(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=me(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>Nt.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==kr){var s,r=null!==(s=wr[i])&&void 0!==s?s:new Fr;return r._init(e,t,i),wr[i]=r,wr[kr][i]=r,r}return this._init(e,t,i)}_init(e,t,s){var n,o;void 0===t&&(t={});var a=me(e)?e.trim():"";if(!a)return Nt.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var l=Rr(t.defaults),_=Or(t),u=Gt({},l,_,{name:s,token:a});ge(l.rageclick)&&ge(_.rageclick)&&(u.rageclick=Gt({},l.rageclick,_.rageclick)),ge(l.session_recording)&&ge(_.session_recording)&&(u.session_recording=Gt({},l.session_recording,_.session_recording)),this.set_config(u),this.config.on_xhr_error&&Nt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:us.GZipJS;var d=this._is_persistence_disabled();this.persistence=new zi(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new zi(i({},this.config,{persistence:"sessionStorage"}),d,!1);var c=i({},this.persistence.props),h=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new tr((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new sr(this),this.__request_queue=[];var p=this._inCookielessMode();if(p||(this.sessionManager=new _r(this),this.sessionPropsManager=new or(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Nt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(p)}),0)):(Nt.info("Initializing extensions synchronously"),this._initExtensions(p)),r.DEBUG=r.DEBUG||this.config.debug,r.DEBUG&&Nt.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:c,s:h}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var g=t.bootstrap.distinctID,v=this.get_distinct_id(),m=this.persistence.get_property(f);if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&m===R)this.identify(g);else if(t.bootstrap.isIdentifiedID&&null!=v&&v!==g&&m===C)Nt.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var y=this.config.get_device_id(ei()),b=t.bootstrap.isIdentifiedID?y:g;this.persistence.set_property(f,t.bootstrap.isIdentifiedID?C:R),this.register({distinct_id:g,$device_id:b})}}if(p)this.register_once({distinct_id:E,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(ei());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(f,R)}return Yt(N,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||ei();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(f,C)),t()},r=i.user();"then"in r&&pe(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||gi.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(gi.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(gi.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,L),identify:e=>t(e,D),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),pe(this.config._onCapture)&&this.config._onCapture!==xr&&(Nt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&Nt.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}_initExtensions(e){var t,s,r,n,o,a,l,_=performance.now(),u=i({},Fr.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new u.featureFlags(this)),u.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new u.exceptions(this)),u.historyAutocapture&&this._extensions.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this._extensions.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this._extensions.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this._extensions.push(this.autocapture=new u.autocapture(this)),u.surveys&&this._extensions.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this)),u.logs&&this._extensions.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new u.logs(this)),u.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this._extensions.push(this.productTours=new u.productTours(this)),u.heatmaps&&this._extensions.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this._extensions.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,pi)),u.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this._extensions.forEach((e=>{e.initialize&&d.push((()=>{null==e.initialize||e.initialize()}))})),d.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(d,_)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){Nt.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[P]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[T]:s}),this.config.__preview_deferred_init_extensions&&Nt.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!G||!G.body)return Nt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=le(e.supportedCompression,us.GZipJS)?us.GZipJS:le(e.supportedCompression,us.Base64)?us.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:O}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){Nt.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=z&&z.hostname){var e=z.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new ls(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Bt(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(M),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(M,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?$r?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=i({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(fe(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,s,r,n=i({},e);n.timeout=n.timeout||6e4,n.url=Xs(n.url,n.compression);var o=null!==(t=n.transport)&&void 0!==t?t:"fetch",a=Zs.filter((e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport))),l=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===o)return e[i]}(a))?void 0:r.method)&&void 0!==s?s:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===us.GZipJS&&Y&&!Vs?Qs(n).then((e=>{l(e)})).catch((t=>{if(ie(t))return Vs=!0,void l(i({},n,{compression:void 0,url:Xs(e.url,void 0)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return ie(e)||t===ee})(t)&&(Vs=!0),l(n)})):l(n)})(i({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Sr++;try{var t,i=[],s=[],r=[];Bt(e,(e=>{if(e)if(he(t=e[0]))r.push(e);else if(pe(e))try{e.call(this)}catch(t){Nt.error("Error executing queued PostHog call",e,t)}else he(e)&&"alias"===t?i.push(e):he(e)&&-1!==t.indexOf("capture")&&pe(this[t])?r.push(e):s.push(e)}));var n=function(e,t){Bt(e,(function(e){try{if(he(e[0])){var i=t;Ht(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else t[e[0]].apply(t,e.slice(1))}catch(t){Nt.error("Error executing queued PostHog call",e,t)}}))};n(i,this),n(s,this),n(r,this)}finally{Sr--}}push(e){if(Sr>0&&he(e)&&me(e[0])){var t=Fr.prototype[e[0]];pe(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!fe(e)&&me(e)){var _=!this.config.opt_out_useragent_filter&&this._is_bot();if(!_||this.config.__preview_capture_bot_pageviews){var u=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!me(null==t?void 0:t.$current_url)&&(Nt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=s&&s._originatedFromCaptureException||Nt.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var d=new Date,c=(null==s?void 0:s.timestamp)||d,h=Dt(null==s?void 0:s.uuid,ei),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},c,h)};e===L&&this.config.__preview_capture_bot_pageviews&&_&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==s?void 0:s.$set)&&(p.$set=null==s?void 0:s.$set);var g=null==s?void 0:s.$unset;g&&(p.$unset=g);var v,f,m,y=this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==U,e===D);if(y&&(p.$set_once=y),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>me(e)?e.slice(0,n):e,l=new Set,p=function e(t,i){return t!==Object(t)?a?a(t):t:l.has(t)?void 0:(l.add(t),he(t)?(s=[],Bt(t,(t=>{s.push(e(t))}))):(s={},Ht(t,((t,i)=>{l.has(t)||(s[i]=e(t,i))}))),s);var s}(o)),p.timestamp=c,fe(null==s?void 0:s.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),e===Zi.DISMISSED||e===Zi.SENT){var b=null==t?void 0:t[es.SURVEY_ID],w=null==t?void 0:t[es.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})("seenSurvey_",e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){gr.error("Failed to persist survey seen state",e)}})({id:b,current_iteration:w}),p.$set=i({},p.$set,{[(v={id:b,current_iteration:w},f=e===Zi.SENT?"responded":"dismissed",m="$survey_"+f+"/"+v.id,v.current_iteration&&v.current_iteration>0&&(m="$survey_"+f+"/"+v.id+"/"+v.current_iteration),m)]:!0})}else e===Zi.SHOWN&&(p.$set=i({},p.$set,{[es.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===ss.SHOWN){var S=null==t?void 0:t[rs.TOUR_TYPE];S&&(p.$set=i({},p.$set,{[rs.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var x=i({},p.properties.$set,p.$set);if(ve(x)||this.setPersonPropertiesForFlags(x),!we(this.config.before_send)){var E=this._runBeforeSend(p);if(!E)return;(p=E).uuid=Dt(p.uuid,ei)}this._internalEventEmitter.emit("eventCaptured",p);var P={method:"POST",url:null!==(r=null==s?void 0:s._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==s?void 0:s._batchKey,transport:null==s?void 0:s.transport};return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?this._send_retriable_request(P):this._requestQueue.enqueue(P),p}Nt.critical("This capture call is ignored due to client rate limiting.")}}else Nt.error("No event name provided to posthog.capture")}else Nt.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,n,o){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this._inCookielessMode()&&(l.$cookieless_mode=!0),"$snapshot"===e){var _=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=_.distinct_id,(!me(l.distinct_id)&&!Se(l.distinct_id)||ye(l.distinct_id))&&Nt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(e,t,i){var s,n,o,a;if(!K)return{};var l,_,u,d,c,h,p,g,v,f=e?[...ki,...t||[]]:[],[m,y]=function(e){for(var t=0;Ft.length>t;t++){var[i,s]=Ft[t],r=i.exec(e),n=r&&(pe(s)?s(r,e):s);if(n)return n}return["",""]}(K),b=null!=(l="undefined"!=typeof navigator?navigator:void 0)&&l.brave?{brave:!0}:{},w={detectGoogleSearchApp:i},S=Gt(Vt({$os:m,$os_version:y,$browser:Ct(K,navigator.vendor,b,w),$device:Lt(K),$device_type:(u=K,d={userAgentDataPlatform:null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,maxTouchPoints:null==(n=navigator)?void 0:n.maxTouchPoints,screenWidth:null==N||null==(o=N.screen)?void 0:o.width,screenHeight:null==N||null==(a=N.screen)?void 0:a.height,devicePixelRatio:null==N?void 0:N.devicePixelRatio},v=Lt(u),v===De||v===Me||"Kobo"===v||"Kindle Fire"===v||v===ht?Le:v===it||v===rt||v===st||v===ut?"Console":v===Ne?"Wearable":v?Oe:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(c=null==d?void 0:d.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(h=null==d?void 0:d.screenWidth)&&void 0!==h?h:0,null!==(p=null==d?void 0:d.screenHeight)&&void 0!==p?p:0)/(null!==(g=null==d?void 0:d.devicePixelRatio)&&void 0!==g?g:1)?Oe:Le:"Desktop"),$timezone:Ni(),$timezone_offset:qi()}),{$current_url:Ti(null==z?void 0:z.href,f,Ri),$host:null==z?void 0:z.host,$pathname:null==z?void 0:z.pathname,$raw_user_agent:K.length>1e3?K.substring(0,997)+"...":K,$browser_version:At(K,navigator.vendor,b,w),$browser_language:Fi(),$browser_language_prefix:(_=Fi(),"string"==typeof _?_.split("-")[0]:void 0),$screen_height:null==N?void 0:N.screen.height,$screen_width:null==N?void 0:N.screen.width,$viewport_height:null==N?void 0:N.innerHeight,$viewport_width:null==N?void 0:N.innerWidth,$lib:r.LIB_NAME,$lib_version:r.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return r.SDK_DIST_CHANNEL&&(S.$sdk_dist_channel=r.SDK_DIST_CHANNEL),S}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app);if(this.sessionManager){var{sessionId:c,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,s.getTime());l.$session_id=c,l.$window_id=h}this.sessionPropsManager&&Gt(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Gt(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===dr&&(l.$lib_custom_api_host=this.config.api_host),u=e!==L||o?e!==M||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),l=Gt(l,u),e===L&&G&&(l.title=G.title),!fe(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}K&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Gt({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),he(this.config.property_denylist)?Ht(this.config.property_denylist,(function(e){delete l[e]})):Nt.error(Ir+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(Nt.error(Tr),l=v(l,e));var f=this._hasPersonProcessing();return l.$process_person_profile=f,f&&!o&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=Gt({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Nt.error(Tr),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),ve(o)?void 0:o}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Pr}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Pr})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Pr})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=vr),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Pr}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Pr})}_validateIdentifyId(e){return!e||ye(e)?(Nt.critical("Unique user id has not been set in posthog.identify"),!1):e===E?(Nt.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Nt.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Nt.uninitializedWarning("posthog.identify");if(Se(e)&&(e=e.toString(),Nt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(o)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(a)&&(this.unregister(a),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(f)||R)===R;e!==s&&n?(this.persistence.set_property(f,C),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(D,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=ur(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(g))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=ur(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):Nt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(he(e)?e:[e]).filter((e=>me(e)&&e.length>0));0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},r,{[e]:t})}),n||s){var o={$group_type:e,$group_key:t};s&&(o.$group_set=s),this.capture(U,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else Nt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,n,a,l,_,d;if(Nt.info("reset"),!this.__loaded)return Nt.uninitializedWarning("posthog.reset");var c,h=this.get_property(o),p=this.get_property(u);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),fe(p)||null==(c=this.persistence)||c.register({[u]:p}),null==(s=this.surveys)||s.reset(),null==(r=this._remoteConfigLoader)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(a=this.conversations)||a.reset(),null==(l=this.logs)||l.reset(),null==(_=this.persistence)||_.set_property(f,R),null==(d=this.sessionManager)||d.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===k)this.register_once({distinct_id:E,$device_id:null},"");else{var g=this.config.get_device_id(ei());this.register_once({distinct_id:g,$device_id:e?g:h},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(n)?(Nt.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(fe(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(a,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Nt.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(ge(e)){var s,n,o,a,l,_,u,d,c,h,p;Gt(this.config,Or(e));var g=this._is_persistence_disabled();null==(s=this.persistence)||s.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new zi(i({},this.config,{persistence:"sessionStorage"}),g,!1);var v=this._checkLocalStorageForDebug(this.config.debug);Ee(v)&&(this.config.debug=v),Ee(this.config.debug)&&(this.config.debug?(r.DEBUG=!0,oi._is_supported()&&oi._set("ph_debug",!0),Nt.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(r.DEBUG=!1,oi._is_supported()&&oi._remove("ph_debug"))),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(_=this.autocapture)||_.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){r.LIB_NAME=e,r.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(i({},r,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:Fr._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:kr;return t!==kr&&(t=kr+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(f))===C||(null==(t=this.sessionPersistence)?void 0:t.get_property(f))===C}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===O&&!this._isIdentified()&&ve(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[a])&&(null==(t=this.persistence)||null==(t=t.props)||!t[x]))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Nt.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(x,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==I)}_sync_opt_out_with_persistence(){var e,t,i,s,r=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==k){if(this._inCookielessMode()){var i,s,r,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new _r(this),this.pageViewManager=new yi(this),this.persistence&&(this.sessionPropsManager=new or(this,this.sessionManager,this.persistence));var a,l=null!==(r=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==r?r:null==(o=Fr.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new l(this)),this._lastRemoteConfig&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this._lastRemoteConfig)))}var _,u;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==I&&(null==(_=this.surveys)||_.loadIfEnabled()),(fe(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(u=null==e?void 0:e.captureEventName)&&void 0!==u?u:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Nt.warn(Er)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==k?(this.config.cookieless_mode===I&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===I&&(this.register({distinct_id:E,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())):Nt.warn(Er)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===k||(this.config.cookieless_mode===I?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return H?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&ae(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>ae(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver}(H,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){G&&("visible"===G.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(L,{title:G.title},{send_instantly:!0}),this._visibilityStateListener&&(G.removeEventListener(A,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Yt(G,A,this._visibilityStateListener)))}debug(e){!1===e?(null==N||N.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==N||N.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var e,t,i,s,r,n,o=this._originalUserConfig||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Nt.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",!1,s=Nt,r=(t="advanced_disable_flags")in(e=o)&&!we(e[t]),n=i in e&&!we(e[i]),r?e[t]:!!n&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}_runBeforeSend(e){var t;if(we(this.config.before_send))return e;var i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Ie),s=he(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s){if(r=n(r),we(r)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Te(e.event)?Nt.warn(o+". This can cause unexpected behavior."):Nt.info(o),null}r.properties&&!ve(r.properties)||Nt.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(r.properties&&we(r.properties[a]))return Nt.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=Ee(e)&&!e,i=oi._is_supported()&&"true"===oi._get("ph_debug");return!t&&(!!i||e)}}Fr.__defaultExtensionClasses={},Fr._noopLogger={trace:br=()=>{},debug:br,info:br,warn:br,error:br,fatal:br},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=zt(e.prototype[t[i]])}(Fr,["identify"]);var Lr=function(){r.SDK_DIST_CHANNEL="npm";var e=wr[kr]=new Fr;return function(){function e(){e.done||(e.done=!0,$r=!1,Ht(wr,(function(e){e._dom_loaded()})))}null!=G&&G.addEventListener?"complete"===G.readyState?e():Yt(G,"DOMContentLoaded",e,{capture:!1}):N&&Nt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{us as Compression,is as DEFAULT_PRODUCT_TOUR_APPEARANCE,ts as DisplaySurveyType,Fr as PostHog,ss as ProductTourEventName,rs as ProductTourEventProperties,Zi as SurveyEventName,es as SurveyEventProperties,Vi as SurveyEventType,Wi as SurveyPosition,Qi as SurveyQuestionBranchingType,Ji as SurveyQuestionType,Xi as SurveySchedule,Yi as SurveyTabPosition,Ki as SurveyType,ji as SurveyWidgetType,Lr as default,Lr as posthog,_s as severityLevels};
2
2
  //# sourceMappingURL=module.slim.no-external.js.map