posthog-js 1.419.0 → 1.419.2

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
- var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,h=null==e?void 0:e.CompressionStream,l=null==i?void 0:i.userAgent,u="undefined"!=typeof globalThis?globalThis:t;u&&"undefined"==typeof self&&(u.self=u),u&&"undefined"==typeof File&&(u.File=function(){});var d=null!=t?t:{},v={DEBUG:!1,LIB_VERSION:"0.5.2",LIB_NAME:"browser-common"};function c(t,e,i,r,s,n,o){try{var a=t[n](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(r,s)}function _(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},p.apply(null,arguments)}var f,g=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],m=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),w=["$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"],y=["token"],b="NativeGzipValidationError",x=t=>t.length>=2&&31===t[0]&&139===t[1],E=(t,e)=>t===m.GZipJS||e===m.GZipJS||"gzip"===e,S=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),T=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=b,e},R=function(){var t=_((function*(t,e){18>t.size&&T("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());x(i)&&8===i[2]||T("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(f)return f;f=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;f[t]=e>>>0}return f})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&T("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&T("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function k(){return k=_((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=_((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),h=(yield Promise.all([a,o]))[0];return yield R(h,r),h}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),k.apply(this,arguments)}var P=["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"],O=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return P.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function I(t,e){return-1!==t.indexOf(e)}var C=function(t){return t.replace(/^\$/,"")},M=Object.prototype,A=M.hasOwnProperty,D=M.toString,N=Array.isArray||function(t){return"[object Array]"===D.call(t)},U=t=>"function"==typeof t,B=t=>t===Object(t)&&!N(t),F=t=>{if(B(t)){for(var e in t)if(A.call(t,e))return!1;return!0}return!1},L=t=>void 0===t,j=t=>"[object String]"==D.call(t),z=t=>j(t)&&0===t.trim().length,q=t=>null===t,H=t=>L(t)||q(t),G=t=>"[object Number]"==D.call(t)&&t==t,W=t=>G(t)&&t>0,V=t=>"[object Boolean]"===D.call(t),Y=t=>t instanceof FormData,J=t=>I(w,t),K=t=>I(y,t),X=[!0,"true",1,"1","yes"],Q=t=>I(X,t),Z=[!1,"false",0,"0","no"];function tt(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),G(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),tt(s||i,e,i,r))}var et="Mobile",it="iOS",rt="Android",st="Tablet",nt=rt+" "+st,ot="iPad",at="Apple",ht=at+" Watch",lt="Safari",ut="BlackBerry",dt="Samsung",vt=dt+"Browser",ct=dt+" Internet",_t="Chrome",pt=_t+" OS",ft=_t+" "+it,gt="Internet Explorer",mt=gt+" "+et,wt="Opera",yt=wt+" Mini",bt="Edge",$t="Microsoft "+bt,xt="Firefox",Et=xt+" "+it,St="Nintendo",Tt="PlayStation",Rt="Xbox",kt=rt+" "+et,Pt=et+" "+lt,Ot="Windows",It=Ot+" Phone",Ct="Nokia",Mt="Ouya",At="Generic",Dt=At+" "+et.toLowerCase(),Nt=At+" "+st.toLowerCase(),Ut="Konqueror",Bt="Oculus Browser",Ft="Vivaldi",Lt="Yandex",jt="Whale",zt="DuckDuckGo",qt="Pale Moon",Ht="Waterfox",Gt="Brave",Wt="Google Search App",Vt="(\\d+(\\.\\d+)?)",Yt=new RegExp("Version/"+Vt),Jt=new RegExp(Rt,"i"),Kt=new RegExp(Tt+" \\w+","i"),Xt=new RegExp(St+" \\w+","i"),Qt=new RegExp(ut+"|PlayBook|BB10","i"),Zt={"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"},te=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Gt:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&I(t,"GSA/")?Wt:I(t," OPR/")&&I(t,"Mini")?yt:I(t," OPR/")?wt:Qt.test(t)?ut:I(t,"IE"+et)||I(t,"WPDesktop")?mt:I(t,"OculusBrowser")?Bt:I(t,vt)?ct:I(t,bt)||I(t,"Edg/")?$t:I(t,Ft+"/")?Ft:I(t,"YaBrowser/")?Lt:I(t,jt+"/")?jt:I(t,zt+"/")||I(t,"Ddg/")?zt:I(t,"FBIOS")?"Facebook "+et:I(t,"UCWEB")||I(t,"UCBrowser")?"UC Browser":I(t,"CriOS")?ft:I(t,"CrMo")||I(t,_t)?_t:I(t,rt)&&I(t,lt)?kt:I(t,"FxiOS")?Et:I(t.toLowerCase(),Ut.toLowerCase())?Ut:I(t,Gt+"/")?Gt:((t,e)=>e&&I(e,at)||function(t){return I(t,lt)&&!I(t,_t)&&!I(t,rt)}(t))(t,e)?I(t,et)?Pt:lt:I(t,"PaleMoon/")?qt:I(t,Ht+"/")?Ht:I(t,xt)?xt:I(t,"MSIE")||I(t,"Trident/")?gt:I(t,"Gecko")?xt:"")},ee={[mt]:[new RegExp("rv:"+Vt)],[$t]:[new RegExp(bt+"?\\/"+Vt)],[_t]:[new RegExp("("+_t+"|CrMo)\\/"+Vt)],[ft]:[new RegExp("CriOS\\/"+Vt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Vt)],[lt]:[Yt],[Pt]:[Yt],[wt]:[new RegExp("(Opera|OPR)\\/"+Vt)],[xt]:[new RegExp(xt+"\\/"+Vt)],[Et]:[new RegExp("FxiOS\\/"+Vt)],[Ut]:[new RegExp("Konqueror[:/]?"+Vt,"i")],[ut]:[new RegExp(ut+" "+Vt),Yt],[kt]:[new RegExp("android\\s"+Vt,"i")],[ct]:[new RegExp(vt+"\\/"+Vt)],[Bt]:[new RegExp("OculusBrowser\\/"+Vt)],[Ft]:[new RegExp(Ft+"\\/"+Vt)],[Lt]:[new RegExp("YaBrowser\\/"+Vt)],[jt]:[new RegExp(jt+"\\/"+Vt)],[Gt]:[new RegExp(Gt+"\\/"+Vt)],[zt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Vt)],[qt]:[new RegExp("PaleMoon\\/"+Vt)],[Ht]:[new RegExp(Ht+"\\/"+Vt)],[Wt]:[new RegExp("GSA\\/"+Vt)],[gt]:[new RegExp("(rv:|MSIE )"+Vt)],Mozilla:[new RegExp("rv:"+Vt)]},ie=function(t,e,i,r){var s=te(t,e,i,r),n=ee[s];if(L(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},re=[[new RegExp(Rt+"; "+Rt+" (.*?)[);]","i"),t=>[Rt,t&&t[1]||""]],[new RegExp(St,"i"),[St,""]],[new RegExp(Tt,"i"),[Tt,""]],[Qt,[ut,""]],[new RegExp(Ot,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[It,""];if(new RegExp(et).test(e)&&!/IEMobile\b/.test(e))return[Ot+" "+et,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Zt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[Ot,r]}return[Ot,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[it,[t[3],t[4],t[5]||"0"].join(".")]:[it,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=L(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+rt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+rt+")","i"),t=>t&&t[2]?[rt,[t[2],t[3],t[4]||"0"].join(".")]:[rt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[pt,""]],[/Linux|debian/i,["Linux",""]]],se=function(t){return Xt.test(t)?St:Kt.test(t)?Tt:Jt.test(t)?Rt:new RegExp(Mt,"i").test(t)?Mt:new RegExp("("+It+"|WPDesktop)","i").test(t)?It:/iPad/.test(t)?ot:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ht:Qt.test(t)?ut:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ct,"i").test(t)?Ct:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(et).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?rt:nt:new RegExp("(pda|"+et+")","i").test(t)?Dt:new RegExp(st,"i").test(t)&&!new RegExp(st+" pc","i").test(t)?Nt:""},ne=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function oe(t,e){return"string"==typeof(i=t)&&ne.test(i)?t:e();var i}function ae(t){return t?t.split("#")[0]:t}var he=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={F(i){if(t&&(v.DEBUG||t.POSTHOG_DEBUG||r)&&!L(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),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 t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>he(e+" "+t,i)};return s},le=he("[PostHog.js]"),ue=le.createLogger,de=ue("[ExternalScriptsLoader]"),ve=t=>{var e=null==r?void 0:r.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},ce=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return de.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=ve(e);if(s){if(s.__posthog_loading_callback_fired)return i();var n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,i(t)})))}var o=()=>{if(!r)return i("document not found");if(ve(e))return ce(t,e,i);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?o():null==r||r.addEventListener("DOMContentLoaded",o)},_e={},pe=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=_e[s];if("fallback"===r&&n){if(ve(n))return void ce(t,n,i);delete _e[s]}ce(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=pe(t,e);_e[s]=a;var h=ve(s);null==h||null==(o=h.parentNode)||o.removeChild(h),ce(t,a,i)}else i(void 0,n)}:i)}else ce(t,pe(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");ce(t,o,i)}},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);ce(t,r,i)};v.DEBUG=!1,v.LIB_VERSION="1.419.0",v.LIB_NAME="web";var fe="$people_distinct_id",ge="distinct_id",me="$device_id",we="$device_model",ye="__alias",be="__timers",$e="$dead_clicks_enabled_server_side",xe="$session_recording_remote_config",Ee="$sesid",Se="$session_is_sampled",Te="$enabled_feature_flags",Re="$active_feature_flags",ke="$feature_flag_details",Pe="$feature_flag_payloads",Oe="$feature_flag_request_id",Ie="$minimal_flag_called_events",Ce="$stored_person_properties",Me="$stored_group_properties",Ae="$groups",De="$surveys_loaded_at",Ne="$flag_call_reported",Ue="$feature_flag_errors",Be="$feature_flag_evaluated_at",Fe="$user_state",Le="$client_session_props",je="$capture_rate_limit",ze="$initial_campaign_params",qe="$initial_referrer_info",He="$initial_person_info",Ge="$epp",We="$posthog_cookieless",Ve="$cookieless_mode",Ye="$sdk_debug_extensions_init_method",Je="$sdk_debug_extensions_init_time_ms",Ke="on_reject",Xe="always",Qe="anonymous",Ze="identified",ti="identified_only",ei="visibilitychange",ii="beforeunload",ri="$pageview",si="$pageleave",ni="$identify",oi="$groupidentify";function ai(t,e){N(t)&&t.forEach(e)}function hi(t,e){if(!H(t))if(N(t))t.forEach(e);else if(Y(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)A.call(t,i)&&e(t[i],i)}var li=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},ui=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){le.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),le.critical(t)}}},di=function(t){var e={};return hi(t,(function(t,i){(j(t)&&t.length>0||G(t))&&(e[i]=t)})),e};var vi=["herokuapp.com","vercel.app","netlify.app"];function ci(t){var e=null==t?void 0:t.hostname;if(!j(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of vi)if(i===r)return!1;return!0}function _i(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var pi=t=>{if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return G(t)&&isFinite(t)&&Math.floor(t)===t});class fi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new fi(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new fi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class gi{generate(){var t=this.generateOrAbort();if(!L(t))return t;this.Rr=0;var e=this.generateOrAbort();if(L(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.Rr)this.Rr=t,this.Ar();else{if(this.Rr>=t+1e4)return;this.Lr++,this.Lr>4398046511103&&(this.Rr++,this.Ar())}return fi.fromFieldsV7(this.Rr,Math.trunc(this.Lr/Math.pow(2,30)),this.Lr&Math.pow(2,30)-1,this.Or.nextUint32())}Ar(){this.Lr=1024*this.Or.nextUint32()+(1023&this.Or.nextUint32())}constructor(){this.Rr=0,this.Lr=0,this.Or=new yi}}var mi,wi=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!L(t.crypto)&&crypto.getRandomValues&&(wi=t=>crypto.getRandomValues(t));class yi{nextUint32(){return this.ft.length>this.Fr||(wi(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var bi=()=>$i().toString(),$i=()=>(mi||(mi=new gi)).generate(),xi="",Ei=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Si={Nr:()=>!!r,jr(t){le.error("cookieStore error: "+t)},Pr:pi,Br(t){var e;try{e=JSON.parse(Si.Pr(t))||{}}catch(t){}return e},Dr(t,e,i,s,n){if(!r)return!1;try{var o="",a="",h=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),xi)return xi;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+bi();!xi&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",xi=o)}return xi}(t);if(!i){var s=(t=>{var e=t.match(Ei);return e?e[0]:""})(t);s!==i&&le.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),o="; expires="+l.toUTCString()}n&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+h+a;return u.length>3686.4&&le.warn("cookieStore warning: large cookie, len="+u.length),r.cookie=u,!0}catch(t){return!1}},qr(t,e){if(null!=r&&r.cookie)try{Si.Dr(t,"",-1,e)}catch(t){return}}},Ti=null,Ri={Nr(){if(!q(Ti))return Ti;var e=!0;if(L(t))e=!1;else try{var i="__mplssupport__";Ri.Dr(i,"xyz"),'"xyz"'!==Ri.Pr(i)&&(e=!1),Ri.qr(i)}catch(t){e=!1}return e||le.error("localStorage unsupported; falling back to cookie store"),Ti=e,e},jr(t){le.error("localStorage error: "+t)},Pr(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Ri.jr(t)}return null},Br(t){try{return JSON.parse(Ri.Pr(t))||{}}catch(t){}return null},Dr(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ri.jr(t)}return!1},qr(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Ri.jr(t)}}},ki=[Ce,Re,Te,ke,Pe,Oe,Be,Ue,Ne],Pi=[me,ge,Ee,Se,Ge,He,Fe],Oi=t=>t+"_cpm",Ii=["__proto__","constructor","prototype"],Ci=t=>{if(!B(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Ii.indexOf(i)&&(e[i]=t[i])})),e},Mi=function(t,e){void 0===e&&(e=[]);var i={};return[...Pi,...e].forEach((e=>{var r=t[e];L(r)||q(r)||""===r||(i[e]=r)})),i},Ai=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Di=(t,e)=>({p:e,f:Ai(JSON.stringify(t))}),Ni=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=Si.Br(Oi(t)),r=(null==i?void 0:i.f)===Ai(e)&&N(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Ui=(t,e)=>e+"|"+(Si.Pr(Oi(t))||""),Bi={},Fi={Nr:()=>!0,jr(t){le.error("memoryStorage error: "+t)},Pr:t=>Bi[t]||null,Br:t=>Bi[t]||null,Dr:(t,e)=>(Bi[t]=e,!0),qr(t){delete Bi[t]}},Li=null,ji={Nr(){if(!q(Li))return Li;if(Li=!0,L(t))Li=!1;else try{var e="__support__";ji.Dr(e,"xyz"),'"xyz"'!==ji.Pr(e)&&(Li=!1),ji.qr(e)}catch(t){Li=!1}return Li},jr(t){le.error("sessionStorage error: ",t)},Pr(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){ji.jr(t)}return null},Br(t){try{return JSON.parse(ji.Pr(t))||null}catch(t){}return null},Dr(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){ji.jr(t)}return!1},qr(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){ji.jr(t)}}};class zi{constructor(t){this._instance=t}get qi(){return this._instance.config}get consent(){return this.cs()?0:this.fs}isOptedOut(){return this.qi.cookieless_mode===Xe||this.isRejected()||-1===this.consent&&this.qi.cookieless_mode===Ke}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.qi.opt_out_capturing_by_default}optInOut(t){this.ps.Dr(this.gs,t?1:0,this.qi.cookie_expiration,this.qi.cross_subdomain_cookie,this.qi.secure_cookie)}reset(){this.ps.qr(this.gs,this.qi.cross_subdomain_cookie)}get gs(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get fs(){var t=this.ps.Pr(this.gs);return Q(t)?1:I(Z,t)?0:-1}get ps(){var t=this.qi.opt_out_capturing_persistence_type,e="localStorage"===t?Ri:Si;if(!this.ys||this.ys!==e){this.ys=e;var i="localStorage"===t?Si:Ri;i.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(Q(i.Pr(this.gs))),i.qr(this.gs,this.qi.cross_subdomain_cookie))}return this.ys}cs(){return!!this.qi.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack].some((t=>Q(t)))}}var qi=["next","previous","prev",">","<","+","-","−","–"];ue("[Dead Clicks]");var Hi=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property($e)),r=t.instance.config.capture_dead_clicks;return V(r)?r:!!B(r)||i},Gi=ue("[SegmentIntegration]");var Wi="posthog-js";function Vi(t,e){var i=void 0===e?{}:e,r=i.organization,s=i.projectId,n=i.prefix,o=i.severityAllowList,a=void 0===o?["error"]:o,h=i.sendExceptionsToPostHog,l=void 0===h||h;return e=>{var i,o,h,u,d;if("*"!==a&&!a.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,_=(null==(i=e.exception)?void 0:i.values)||[],f=_.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(o=_[0])?void 0:o.value)||e.message,$exception_type:null==(h=_[0])?void 0:h.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(u=_[0])?void 0:u.value)||e.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),l&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class Yi{constructor(t,e,i,r,s,n){this.name=Wi,this.setupOnce=function(o){o(Vi(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Ji{constructor(t){this.ks=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(le.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Ss=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.xs()}xs(){var t;this.Cs=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ks)}destroy(){var t;null==(t=this.Cs)||t.call(this),this.Cs=void 0}doPageView(e,i){var r,s=this.Ts(e,i);return this.Ss={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.Ts(t,null==(e=this.Ss)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ss)?void 0:t.pageViewId}}Ts(t,e){var i=this.Ss;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,h=s.maxContentHeight,l=s.lastContentY,u=s.maxContentY;if(!(L(n)||L(o)||L(a)||L(h)||L(l)||L(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),h=Math.ceil(h),l=Math.ceil(l),u=Math.ceil(u);var d=n>1?tt(o/n,0,1,le):1,v=n>1?tt(a/n,0,1,le):1,c=h>1?tt(l/h,0,1,le):1,_=h>1?tt(u/h,0,1,le):1;r=li(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Ki=["flags","surveys"],Xi={[fe]:{exposure:"hidden"},[ye]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[be]:{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"},[$e]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[xe]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[Se]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:t=>q(t)},$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"},[Te]:{exposure:"hidden",storageGroup:"flags"},[Re]:{exposure:"hidden",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},[ke]:{exposure:"hidden",storageGroup:"flags"},[Pe]:{exposure:"hidden",storageGroup:"flags"},[Oe]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ie]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"hidden"},$override_feature_flag_payloads:{exposure:"hidden"},[Ce]:{exposure:"hidden"},[Me]:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[De]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},$surveys_activated_session:{exposure:"hidden"},$surveys_activated_timestamps:{exposure:"hidden"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ne]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},[Ae]:{exposure:"event"},[Ue]:{exposure:"hidden"},[Be]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Fe]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[je]:{exposure:"hidden"},[ze]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[He]:{exposure:"hidden"},[Ge]:{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"},[Ye]:{exposure:"event"},[Je]:{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_pending_trigger_conditions:{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"}},Qi=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Zi=t=>{var e=Xi[t];if(e)return e;for(var i of Qi){var r=i[1];if(0===t.indexOf(i[0]))return r}},tr=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return r=[],null!==(i=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(e))return"[Circular]";r.push(e)}return e}})))&&void 0!==i?i:"null"}var i,r},er=t=>{var e=null==r?void 0:r.createElement("a");return L(e)?null:(e.href=t,e)},ir=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!N(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){le.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},rr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],h=(o||"").split("&"),l=[],u=0;h.length>u;u++){var d=h[u].split("=");N(d)&&(e.includes(d[0])?l.push(d[0]+"="+i):l.push(h[u]))}var v=a;return null!=o&&(v+="?"+l.join("&")),null!=s&&(v+="#"+s),v},sr="https?://(.*)",nr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],or=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...nr],ar="<masked>",hr=["li_fat_id"];function lr(t,e){var i=or.concat(e||[]),r={};return hi(i,(function(e){var i=ir(t,e);r[e]=i||null})),r}function ur(t){var e=function(t){return t?0===t.search(sr+"google.([^/?]*)")?"google":0===t.search(sr+"bing.com")?"bing":0===t.search(sr+"yahoo.com")?"yahoo":0===t.search(sr+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!q(e)){s.$search_engine=e;var n=r?ir(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function dr(){return navigator.language||navigator.userLanguage}var vr="$direct";function cr(){return(null==r?void 0:r.referrer)||vr}function _r(t,e,i){void 0===i&&(i=!1);var r=t?[...nr,...e||[]]:[],n=i?ae(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:cr().substring(0,1e3),u:o?rr(o,r,ar):void 0}}function pr(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?ae(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==vr?vr:null==(i=er(r))?void 0:i.host};if(n){o.$current_url=n;var a=er(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var h=lr(n);li(o,h)}if(r){var l=ur(r);li(o,l)}return o}function fr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function gr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var mr={flags:Be,surveys:De},wr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],yr=t=>t+"_cookie_identity_change_pending",br="main",$r=(t,e)=>{hi(t,((i,r)=>{var s=Zi(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class xr{constructor(e,i,r){if(void 0===r&&(r=!0),this.Ms={},this.Es=!1,this.Is=!1,this.Rs=!1,this.Ps=!1,this.qi=e,this.As=r,this.props={},this.Fs=void 0,this.Ls=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.ps=this.Os(e),this.Is=this.Ds(e),this.load(),e.debug&&le.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();_i(t,"beforeunload",s,{capture:!1}),_i(t,"pagehide",s,{capture:!1})}}$s(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return G(e)&&e>0?e:0}Ns(t){if(this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase())if(t)try{var e=Mi(t,this.qi.cookie_persisted_properties||[]),i=Di(e,this.qi.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=Si.Pr(this.Ls)||void 0;s&&Ui(this.Ls,s)===r&&(this.qs=r,this.js=s)}catch(t){}else try{var n=Si.Pr(this.Ls)||void 0;this.qs=n?Ui(this.Ls,n):void 0,this.js=n}catch(t){}}syncCookieProperties(){return this.Bs(this.qi)}Bs(t,e){if(void 0===e&&(e=!1),this.Hs&&!e||this.Ps||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=Si.Pr(this.Ls)||void 0}catch(t){}if(!i||i===this.js)return!1;var r,s=Ui(this.Ls,i);try{r=Ci(JSON.parse(i))}catch(t){return!1}if((Si.Pr(this.Ls)||void 0)!==i)return!1;this.qs=s,this.js=i;var n=Ni(this.Ls,i),o=[...Pi,...n.properties],a={};if(Object.keys(r).forEach((t=>{var e=r[t];(L(e)||q(e)||""===e||t===Fe&&e!==Qe&&e!==Ze)&&(a[t]=!0,delete r[t])})),F(r))return!1;var h=ge in r||r[Fe]===Qe||r[Fe]===Ze,l=this.props[ge],u=this.props[Fe],d=li({},this.props);[...Pi,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(h||t!==ge&&t!==Fe)){var e=d[t];!n.isValid&&-1!==Pi.indexOf(t)&&(!1===e||0===e)||delete d[t]}})),this.props=li(d,r),!h||Fe in r||Fe in this.props||this.Us(Fe,Qe);var v=this.props[ge],c=this.props[Fe];return!h||v===l&&c===u||(this.Rs=!0,ji.Dr(yr(this.Ls),!0),this.zs(Ce),this.zs(Re),this.zs(Te),this.zs(ke),this.zs(Pe),this.zs(Oe),this.zs(Be),this.zs(Ue),this.zs(Ne),c===Qe&&(u===Ze||r[Fe]===Qe||!L(l)&&v!==l)&&($r(this.props,r),this.zs(Me)),c===Ze?this.props.$user_id=v:delete this.props.$user_id,this.zs(ye)),!0}consumeCookieIdentityChange(){var t=yr(this.Ls),e=this.Rs||!!ji.Pr(t);return this.Rs=!1,e&&ji.qr(t),e}Ws(t){return void 0===t&&(t=!1),!(this.Ps||this.Hs&&!t||!this.qi.cookieWinsOnConflict||"localstorage+cookie"!==this.qi.persistence.toLowerCase()||(this.Ps=!0,0))}Vs(){this.Ps&&(L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),delete this.Ms[br],this.Zs(!0))}Qs(t){if(void 0===t&&(t=!0),this.Ps)try{t?this.Vs():L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0)}finally{this.Ps=!1}}isDisabled(){return!!this.Hs}Os(e){-1===wr.indexOf(e.persistence.toLowerCase())&&(le.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=[...Pi,...e];return p({},Ri,{Br(t){try{var e,s={};try{e=Si.Pr(t)||void 0,s=e?Ci(JSON.parse(e)):{}}catch(t){}var n,o=JSON.parse(Ri.Pr(t)||"{}");if(i){var a=Ni(t,e),h=[...Pi,...a.properties],l={};Object.keys(s).forEach((t=>{var e=s[t];q(e)||""===e||t===Fe&&e!==Qe&&e!==Ze||(l[t]=e)}));var u=ge in l||l[Fe]===Qe||l[Fe]===Ze;if(Object.keys(l).length>0){var d,v=o[ge],c=null!==(d=o[Fe])&&void 0!==d?d:Qe;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(u||t!==ge&&t!==Fe)){var e=o[t];!a.isValid&&-1!==Pi.indexOf(t)&&(!1===e||0===e)||delete o[t]}})),!u||Fe in s||Fe in o||(o[Fe]=Qe),!u||(ge in l?l[ge]:o[ge])===v&&(Fe in l?l[Fe]:o[Fe])===c||(ki.forEach((t=>delete o[t])),l[Fe]===Ze&&ge in l?o.$user_id=l[ge]:delete o.$user_id,l[Fe]!==Ze&&(delete o[Ae],delete o[Me]),delete o.__alias)}n=li(o,l)}else n=li(s,o);return Ri.Dr(t,n),n}catch(t){}return null},Dr(t,r,s,n,o,a){var h=Ri.Dr(t,r,void 0,void 0,a);try{var l=Mi(r,e);if(Object.keys(l).length){if(i){var u=Oi(t),d=Di(l,e);if(Si.Dr(u,d,s,n,o,a),Si.Pr(u)!==JSON.stringify(d)){Si.qr(u,n);var v=Mi(r);return Si.Dr(t,v,s,n,o,a),h}}Si.Dr(t,l,s,n,o,a)}}catch(t){Ri.jr(t)}return h},qr(e,i){try{null==t||t.localStorage.removeItem(e),Si.qr(e,i),Si.qr(Oi(e),i)}catch(t){Ri.jr(t)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Ri.Nr()?(i=Ri,s=!0):"localstorage+cookie"===n&&r.Nr()?(i=r,s=!0):"sessionstorage"===n&&ji.Nr()?i=ji:"memory"===n?i=Fi:"cookie"===n?i=Si:r.Nr()?(i=r,s=!0):i=Si,this.Es=s,i}Js(t){return this.Ls+"__"+t}Ds(t){return this.Es&&!!t.split_storage}properties(){var t={};return hi(this.props,((e,i)=>{var r=Zi(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.Hs||t){var e=this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase(),i=e?Ri.Br(this.Ls):null,r={};if(e)try{hi(r=Ci(Si.Br(this.Ls)),((t,e)=>{(L(t)||q(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.ps.Br(this.Ls);if(s&&(this.props=li({},s)),this.Is&&this.Ks(),e&&s){var n,o,a=null==i?void 0:i[ge],h=null!==(n=null==i?void 0:i[Fe])&&void 0!==n?n:Qe,l=s[ge],u=null!==(o=s[Fe])&&void 0!==o?o:Qe;if(l!==a||u!==h){this.Rs=!0,ji.Dr(yr(this.Ls),!0);var d=li({},this.props);ki.forEach((t=>delete d[t])),u===Qe&&(h===Ze||r[Fe]===Qe||!L(a)&&l!==a)&&($r(d,r),delete d[Me]),this.props=d;var v=new Set;ki.forEach((t=>{var e,i=null==(e=Zi(t))?void 0:e.storageGroup;i&&v.add(i)})),v.forEach((t=>{var e={};hi(this.props,((i,r)=>{var s;(null==(s=Zi(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),F(e)?(Ri.qr(this.Js(t)),this.Ms[t]={}):Ri.Dr(this.Js(t),e)&&(this.Ms[t]={persisted:!0,fingerprint:this.Ys(e,t)})}))}}ji.Pr(yr(this.Ls))&&(this.Rs=!0)}}Ks(){for(var t of Ki){var e=Ri.Br(this.Js(t));if(e&&!F(e)){var i=this.Xs(t);i.persisted=!0,this.ta(t)||(i.fingerprint=this.Ys(e,t)),this.ea(t,e)||li(this.props,e)}}}ta(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Zi(e))?void 0:i.storageGroup)===t}))}ea(t,e){var i=mr[t];if(!i)return!1;var r=e[i],s=this.props[i];return G(r)&&G(s)&&s>r}refreshKey(t){var e;if(!this.Hs){var i=this.Is?null==(e=Zi(t))?void 0:e.storageGroup:void 0,r=i?Ri.Br(this.Js(i)):this.ps.Br(this.Ls);if(r&&t in r)this.Us(t,r[t]);else{if(i){var s=this.ps.Br(this.Ls);if(s&&t in s)return void this.Us(t,s[t])}this.zs(t)}}}save(){if(!this.Hs){var t=this.$s();t>0?L(this.Gs)&&(this.Gs=setTimeout((()=>{this.Gs=void 0,this.Zs()}),t)):this.Zs()}}flush(){L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0,this.Zs())}Zs(t){void 0===t&&(t=!1),this.Hs||this.Ps&&!t||(t||this.syncCookieProperties(),this.Is?this.ia():this.ra(this.ps,this.Ls,this.props,br)&&this.Ns(this.props))}ia(){var t=this.na(),e=t.main,i=t.groups;for(var r of(this.ra(this.ps,this.Ls,e,br)&&this.Ns(e),Ki)){var s,n=i[r];(!F(n)||null!=(s=this.Ms[r])&&s.persisted)&&this.ra(Ri,this.Js(r),n,r)}}na(){var t={},e={flags:{},surveys:{}};return hi(this.props,((i,r)=>{var s,n=null==(s=Zi(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ys(t,e){if(e===br)return JSON.stringify(t)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var i={};return hi(t,((t,e)=>{var r;i[e]=null!=(r=Zi(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}ra(t,e,i,r){var s,n=this.Xs(r);if(r!==br&&!n.dirty&&!L(n.fingerprint))return!1;try{if((s=this.Ys(i,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Dr(e,i,this.sa,this.aa,this.oa,this.qi.debug)?(n.dirty=!1,r!==br&&(n.persisted=!0),L(s)||(n.fingerprint=s),!0):(this.qi.debug&&le.warn('failed to persist storage entry "'+e+'"; will retry on next save'),!1)}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),this.ps.qr(this.Ls,!1),this.ps.qr(this.Ls,!0),!i&&this.As)for(var r of Ki)Ri.qr(this.Js(r));i?delete this.Ms[br]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(B(t)){this.syncCookieProperties(),L(e)&&(e="None"),this.sa=L(i)?this.la:i;var r=!1;if(hi(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Us(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(B(t)){this.syncCookieProperties(),this.sa=L(e)?this.la:e;var i=!1;if(hi(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||B(e)||N(e))&&(this.Us(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.zs(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this.Fs){var e=function(t,e,i){if(!r)return{};var s,n=e?[...nr,...i||[]]:[],o=lr(rr(r.URL,n,ar),t),a=(s={},hi(hr,(function(t){var e=pi(t);s[t]=e||null})),s);return li(a,o)}(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);F(di(e))||this.register(e),this.Fs=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?ur(t):{})}update_referrer_info(){var t;this.register_once({$referrer:cr(),$referring_domain:null!=r&&r.referrer&&(null==(t=er(r.referrer))?void 0:t.host)||vr},void 0)}set_initial_person_info(){this.props[ze]||this.props[qe]||this.register_once({[He]:_r(this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties,this.qi.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};hi([qe,ze],(e=>{var i=this.props[e];i&&hi(i,(function(e,i){t["$initial_"+C(i)]=e}))}));var e=this.props[He];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=pr(t,e),r={};return hi(i,(function(t,e){r["$initial_"+C(e)]=t})),r}(e,this.qi.disable_capture_url_hashes);li(t,i)}return t}safe_merge(t){return hi(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){var r=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),n=r||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,h=!!this.Hs&&!a;a||this.Bs(e,h),this.qi=t,!a&&(r||s||o)&&(this.qs=void 0,this.js=void 0,this.Bs(p({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var l=n||o?this.Os(t):this.ps,u=this.Ds(t),d=n||u!==this.Is,v=!a&&(d||t.cross_subdomain_cookie!==this.aa||t.secure_cookie!==this.oa)&&this.Ws(h);try{if(this.la=this.sa=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.ps=l,this.Is=u,this.props=c,this.save()}else o&&(this.ps=l,a||(delete this.Ms[br],this.Zs()))}finally{v&&this.Qs()}}set_disabled(t){this.Hs=t,this.Hs?this.remove():this.save()}set_cross_subdomain(t){t!==this.aa&&(this.aa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.oa&&(this.oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[be]||{};i[t]=e,this.Us(be,i),this.save()}remove_event_timer(t){var e=this.props[be]||{},i=e[t];return L(i)||(delete e[t],this.Us(be,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Us(t,e),this.save()}Us(t,e){var i;this.props[t]=e,null!=(i=Zi(t))&&i.volatile||this.ua(t)}zs(t){delete this.props[t],this.ua(t)}ua(t){var e,i=null==(e=Zi(t))?void 0:e.storageGroup;i&&(this.Xs(i).dirty=!0)}Xs(t){return this.Ms[t]||(this.Ms[t]={})}}function Er(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&U(i.then)&&i.then(void 0,(()=>{}))}}}}var Sr={GZipJS:"gzip-js",Base64:"base64"},Tr={Activation:"events",Cancellation:"cancelEvents"},Rr={Button:"button",Tab:"tab",Selector:"selector"},kr={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"},Pr={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Or={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Ir={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Cr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Mr={Once:"once",Recurring:"recurring",Always:"always"},Ar={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Dr={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"},Nr={Popover:"popover",Inline:"inline"},Ur={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},Br={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"},Fr={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"},Lr=ue("[RateLimiter]");class jr{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{Lr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Lr.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(je))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var h=1>a.tokens;if(h||t||(a.tokens=Math.max(0,a.tokens-1)),h&&!t){var l=(G(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.ha(l)&&(a.dropped=0)}return this.lastEventRateLimited=h,null==(r=this.instance.persistence)||r.set_property(je,a),{isRateLimited:h,remainingTokens:a.tokens}}da(t){var e=this.instance.config.property_denylist;return!N(e)||!e.includes(t)}va(){var t;if(this.da("$current_url")&&this.da("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}ha(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.va(),o=this.da("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var zr=ue("[RemoteConfig]");class qr{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=d._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ca(t){var e,i;null!=(e=d.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}fa(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return zr.info("Using preloaded remote config",this.remoteConfig),this.pa(this.remoteConfig),void this.ga();if(this._instance._shouldDisableFlags())return void zr.warn("Remote config is disabled. Falling back to local config.");this.ca((t=>{if(!t)return zr.info("No config found after loading remote JS config. Falling back to JSON."),void this.fa((t=>{this.pa(t.json,t),this.ga()}));this.pa(t),this.ga()}))}catch(t){zr.error("Error loading remote config",t),this.pa()}}stop(){this.ya&&(clearInterval(this.ya),this.ya=void 0)}refresh(){!this._instance._shouldDisableFlags()&&r&&"hidden"!==r.visibilityState&&this._instance.reloadFeatureFlags()}ga(){var t;if(!this.ya){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.ya=setInterval((()=>{this.refresh()}),e))}}pa(t,e){!t&&e&&(0===e.statusCode?e.error||zr.warn("Failed to fetch remote config from PostHog."):zr.error("Failed to fetch remote config from PostHog."));try{this._instance.pa(t?{ok:!0,config:t}:{ok:!1})}catch(t){zr.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){zr.error("Error loading feature flags",t)}}}var Hr=["fatal","error","warning","log","info","debug"],Gr=Uint8Array,Wr=Uint16Array,Vr=Uint32Array,Yr=new Gr([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]),Jr=new Gr([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]),Kr=new Gr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xr=function(t,e){for(var i=new Wr(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Vr(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Qr=Xr(Yr,2),Zr=Qr[1];Qr[0][28]=258,Zr[258]=28;for(var ts=Xr(Jr,0)[1],es=new Wr(32768),is=0;32768>is;++is){var rs=(43690&is)>>>1|(21845&is)<<1;es[is]=((65280&(rs=(61680&(rs=(52428&rs)>>>2|(13107&rs)<<2))>>>4|(3855&rs)<<4))>>>8|(255&rs)<<8)>>>1}var ss=function(t,e,i){for(var r=t.length,s=0,n=new Wr(e);r>s;++s)++n[t[s]-1];var o,a=new Wr(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Wr(1<<e);var h=15-e;for(s=0;r>s;++s)if(t[s])for(var l=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[es[d]>>>h]=l}else for(o=new Wr(r),s=0;r>s;++s)o[s]=es[a[t[s]-1]++]>>>15-t[s];return o},ns=new Gr(288);for(is=0;144>is;++is)ns[is]=8;for(is=144;256>is;++is)ns[is]=9;for(is=256;280>is;++is)ns[is]=7;for(is=280;288>is;++is)ns[is]=8;var os=new Gr(32);for(is=0;32>is;++is)os[is]=5;var as=ss(ns,9,0),hs=ss(os,5,0),ls=function(t){return(t/8>>0)+(7&t&&1)},us=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Wr?Wr:t instanceof Vr?Vr:Gr)(i-e);return r.set(t.subarray(e,i)),r},ds=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},vs=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},cs=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Gr(0),0];if(1==s){var o=new Gr(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],h=i[1],l=0,u=1,d=2;for(i[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=s-1;)a=i[i[d].f>i[l].f?l++:d++],h=i[l!=u&&i[d].f>i[l].f?l++:d++],i[u++]={s:-1,f:a.f+h.f,l:a,r:h};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Wr(v+1),_=_s(i[u-1],c,0);if(_>e){r=0;var p=0,f=_-e,g=1<<f;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<_-c[m]),c[m]=e}for(p>>>=f;p>0;){var w=n[r].s;e>c[w]?p-=1<<e-c[w]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}_=e}return[new Gr(c),_]},_s=function(t,e,i){return-1==t.s?Math.max(_s(t.l,e,i+1),_s(t.r,e,i+1)):e[t.s]=i},ps=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Wr(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&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(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},fs=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},gs=function(t,e,i){var r=i.length,s=ls(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},ms=function(t,e,i,r,s,n,o,a,h,l,u){ds(e,u++,i),++s[256];for(var d=cs(s,15),v=d[0],c=d[1],_=cs(n,15),p=_[0],f=_[1],g=ps(v),m=g[0],w=g[1],y=ps(p),b=y[0],x=y[1],E=new Wr(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;b.length>S;++S)E[31&b[S]]++;for(var T=cs(E,7),R=T[0],k=T[1],P=19;P>4&&!R[Kr[P-1]];--P);var O,I,C,M,A=l+5<<3,D=fs(s,ns)+fs(n,os)+o,N=fs(s,v)+fs(n,p)+o+14+3*P+fs(E,R)+(2*E[16]+3*E[17]+7*E[18]);if(D>=A&&N>=A)return gs(e,u,t.subarray(h,h+l));if(ds(e,u,1+(D>N)),u+=2,D>N){O=ss(v,c,0),I=v,C=ss(p,f,0),M=p;var U=ss(R,k,0);for(ds(e,u,w-257),ds(e,u+5,x-1),ds(e,u+10,P-4),u+=14,S=0;P>S;++S)ds(e,u+3*S,R[Kr[S]]);u+=3*P;for(var B=[m,b],F=0;2>F;++F){var L=B[F];for(S=0;L.length>S;++S)ds(e,u,U[j=31&L[S]]),u+=R[j],j>15&&(ds(e,u,L[S]>>>5&127),u+=L[S]>>>12)}}else O=as,I=ns,C=hs,M=os;for(S=0;a>S;++S)if(r[S]>255){var j;vs(e,u,O[257+(j=r[S]>>>18&31)]),u+=I[j+257],j>7&&(ds(e,u,r[S]>>>23&31),u+=Yr[j]);var z=31&r[S];vs(e,u,C[z]),u+=M[z],z>3&&(vs(e,u,r[S]>>>5&8191),u+=Jr[z])}else vs(e,u,O[r[S]]),u+=I[r[S]];return vs(e,u,O[256]),u+I[256]},ws=new Vr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ys=function(){for(var t=new Vr(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),bs=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function $s(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=ys[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,h,l=(a=10+((s=e).filename&&s.filename.length+1||0),h=8,function(t,e,i,r,s,n){var o=t.length,a=new Gr(r+o+5*(1+Math.floor(o/7e3))+s),h=a.subarray(r,a.length-s),l=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?l=gs(h,l,t.subarray(u,d)):(h[u]=!0,l=gs(h,l,t.subarray(u,o)))}else{for(var v=ws[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new Wr(32768),g=new Wr(p+1),m=Math.ceil(i/3),w=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<w)&p},b=new Vr(25e3),x=new Wr(288),E=new Wr(32),S=0,T=0,R=(u=0,0),k=0,P=0;o>u;++u){var O=y(u),I=32767&u,C=g[O];if(f[I]=C,g[O]=I,u>=k){var M=o-u;if((S>7e3||R>24576)&&M>423){l=ms(t,h,0,b,x,E,T,R,P,u-P,l),R=S=T=0,P=u;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)E[A]=0}var D=2,N=0,U=_,B=I-C&32767;if(M>2&&O==y(u-B))for(var F=Math.min(c,M)-1,L=Math.min(32767,u),j=Math.min(258,M);L>=B&&--U&&I!=C;){if(t[u+D]==t[u+D-B]){for(var z=0;j>z&&t[u+z]==t[u+z-B];++z);if(z>D){if(D=z,N=B,z>F)break;var q=Math.min(B,z-2),H=0;for(A=0;q>A;++A){var G=u-B+A+32768&32767,W=G-f[G]+32768&32767;W>H&&(H=W,C=G)}}}B+=(I=C)-(C=f[I])+32768&32767}if(N){b[R++]=268435456|Zr[D]<<18|ts[N];var V=31&Zr[D],Y=31&ts[N];T+=Yr[V]+Jr[Y],++x[257+V],++E[Y],k=u+D,++S}else b[R++]=t[u],++x[t[u]]}}l=ms(t,h,!0,b,x,E,T,R,P,u-P,l)}return us(a,0,r+ls(l)+s)}(n=t,null==(o=e).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,h)),u=l.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&bs(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(l,e),bs(l,u-8,i.d()),bs(l,u-4,r),l}var xs=!!o||!!n,Es="text/plain",Ss=!1,Ts=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Rs=function(t,e,i){var r;void 0===i&&(i=!0);var s=t.split("?"),n=s[0],o=s[1],a=p({},e),h=null!==(r=null==o?void 0:o.split("&").map((t=>{var e,r=t.split("="),s=r[0],n=i&&null!==(e=a[s])&&void 0!==e?e:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],l=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return hi(t,(function(t,e){L(t)||L(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(a);return l&&h.push(l),h.length>0?n+"?"+h.join("&"):n},ks=t=>{if(t.ba)return t.ba;var e=t.data,i=t.compression;if(e){if(i===Sr.GZipJS){var r=$s(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Gr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new Gr(s+8+(i-o<<1));a.set(r),r=a}var h=t.charCodeAt(o);128>h?n(h):2048>h?(n(192|h>>>6),n(128|63&h)):h>55295&&57344>h?(n(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++o))>>>18),n(128|h>>>12&63),n(128|h>>>6&63),n(128|63&h)):(n(224|h>>>12),n(128|h>>>6&63),n(128|63&h))}return us(r,0,s)}(tr(e)),{mtime:0});return{contentType:Es,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Sr.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(tr(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:tr(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=tr(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Ps=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:Rs(t.url,{compression:Sr.Base64}),encodedBody:ks(p({},t,{compression:Sr.Base64,ba:void 0}))}:{url:Ts(t.url,"compression"),encodedBody:ks(p({},t,{compression:void 0,ba:void 0}))};try{e=ks(t)}catch(e){if(E(t.compression,ir(t.url,"compression")))return le.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&E(t.compression,ir(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?x(new Uint8Array(i)):ArrayBuffer.isView(i)&&x(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Ss=!0,r()):{url:t.url,encodedBody:e}},Os=t=>{try{return Ps(t)}catch(e){return le.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Is=function(){var t=_((function*(t){var e=tr(t.data),i=yield function(t,e,i){return k.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{ba:{contentType:Es,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Cs=/Failed to fetch|NetworkError|Load failed/i,Ms=t=>"TypeError"===(null==t?void 0:t.name)&&Cs.test((null==t?void 0:t.message)||""),As=t=>{var e=Os(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,h=s.body,l=s.estimatedSize,u=new Headers;hi(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var e,i;v=!0,c.abort((e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",i))}),t.timeout)}}var _=e=>{v&&"AbortError"===(null==e?void 0:e.name)||Ms(e)?le.warn(e):le.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;n(i,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t._a&&52428.8>(l||0),body:h,signal:null==(f=d)?void 0:f.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){le.error(t)}null==t.callback||t.callback(r)})))).catch(_).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),_(t)}}},Ds=t=>{try{var e,r=Ps(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,h=o.estimatedSize;if(!a)return;var l=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(i.sendBeacon(s,l))return;var u=N(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(N(u)&&u.length>1&&(null!=h?h:0)>16384){var d=Math.ceil(u.length/2),v=e=>N(t.data)?e:p({},t.data,{batch:e});return Ds(p({},t,{data:v(u.slice(0,d))})),void Ds(p({},t,{data:v(u.slice(d))}))}le.warn("Beacon of ~"+(null!=h?h:0)+" bytes was rejected by the browser, falling back to fetch"),As(p({},t,{_a:!0}))}catch(t){le.warn("Beacon send failed",t)}},Ns=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return Rs(i===Sr.GZipJS?Ts(t,"compression"):t,p({},s?{[s]:Date.now().toString()}:{},i===Sr.GZipJS?{}:{compression:i}))},Us=[];n&&Us.push({transport:"fetch",method:As}),o&&Us.push({transport:"XHR",method(t){var e=Os(t);if(e){var i=new o,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;hi(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(a)}}}),null!=i&&i.sendBeacon&&Us.push({transport:"sendBeacon",method:Ds});var Bs=3e3;class Fs{constructor(t,e){this.wa=!0,this.ka=[],this.Sa=tt((null==e?void 0:e.flush_interval_ms)||Bs,250,5e3,le.createLogger("flush interval"),Bs),this.xa=t}enqueue(t){this.ka.push(t),this.Ca||this.Ta()}unload(){this.Ma();var t=this.ka.length>0?this.Ea():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ia(p({},t,{transport:"sendBeacon"}))}))}enable(){this.wa=!1,this.Ta()}Ta(){var t=this;this.wa||(this.Ca=setTimeout((()=>{if(this.Ma(),this.ka.length>0){var e=this.Ea(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&N(i.data)&&hi(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ia(i)};for(var r in e)i()}}),this.Sa))}Ia(t){try{this.xa(t)}catch(t){le.error(t)}}Ma(){clearTimeout(this.Ca),this.Ca=void 0}Ea(){var t={};return hi(this.ka,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;L(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.ka=[],t}}var Ls=["retriesPerformedSoFar"];class js{constructor(e){this.Ra=!1,this.Pa=3e3,this.ka=[],this._instance=e,this.ka=[],this.Aa=!0,!L(t)&&"onLine"in t.navigator&&(this.Aa=t.navigator.onLine,this.Fa=()=>{this.Aa=!0,this.La()},this.Oa=()=>{this.Aa=!1},_i(t,"online",this.Fa),_i(t,"offline",this.Oa))}get length(){return this.ka.length}retriableRequest(t){var e=t.retriesPerformedSoFar,i=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,Ls);W(e)&&(i.url=Rs(i.url,{retry_count:e})),this._instance._send_request(p({},i,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.xn(p({retriesPerformedSoFar:e},i));0===t.statusCode&&le.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!=e?e:0)+" retries.")}null==i.callback||i.callback(t)}}))}xn(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.ka.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),le.warn(s),this.Ra||(this.Ra=!0,this.Da())}Da(){if(this.$a&&clearTimeout(this.$a),0===this.ka.length)return this.Ra=!1,void(this.$a=void 0);this.$a=setTimeout((()=>{this.Aa&&this.ka.length>0&&this.La(),this.Da()}),this.Pa)}La(){var t=Date.now(),e=[],i=this.ka.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.ka=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.$a&&(clearTimeout(this.$a),this.$a=void 0),this.Ra=!1,L(t)||(this.Fa&&(t.removeEventListener("online",this.Fa),this.Fa=void 0),this.Oa&&(t.removeEventListener("offline",this.Oa),this.Oa=void 0)),this.ka)){var i=e.requestOptions;try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){le.error(t)}}this.ka=[]}}class zs{constructor(t){this.Na=()=>{var t,e,i,r;this.qa||(this.qa={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),h=(null==s?void 0:s.scrollHeight)||0;this.qa.lastScrollY=Math.ceil(n),this.qa.maxScrollY=Math.max(n,null!==(t=this.qa.maxScrollY)&&void 0!==t?t:0),this.qa.maxScrollHeight=Math.max(o,null!==(e=this.qa.maxScrollHeight)&&void 0!==e?e:0),this.qa.lastContentY=a,this.qa.maxContentY=Math.max(a,null!==(i=this.qa.maxContentY)&&void 0!==i?i:0),this.qa.maxContentHeight=Math.max(h,null!==(r=this.qa.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get ja(){return this._instance.config.scroll_root_selector}getContext(){return this.qa}resetContext(){var t=this.qa;return setTimeout(this.Na,0),t}startMeasuringScrollPosition(){_i(t,"scroll",this.Na,{capture:!0}),_i(t,"scrollend",this.Na,{capture:!0}),_i(t,"resize",this.Na)}scrollElement(){if(!this.ja)return null==t?void 0:t.document.documentElement;var e=N(this.ja)?this.ja:[this.ja];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}Ba(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.ja){var r=this.scrollElement();return r&&r[i]||0}return t?"y"===e?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.Ba("y")}scrollX(){return this.Ba("x")}}var qs=t=>_r(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class Hs{constructor(t,e,i,r){this.ot=t=>{var e=this.Ha();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Ua(this._instance)};this.za.register({[Le]:i})}},this._instance=t,this.Wa=e,this.za=i,this.Ua=r||qs,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[Le]}getSetOnceProps(){var t,e=null==(t=this.Ha())?void 0:t.props;return e?"r"in e?pr(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return hi(di(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+C(i)]=e})),t}}class Gs{on(t,e){return this.Va[t]||(this.Va[t]=[]),this.Va[t].push(e),()=>{this.Va[t]=this.Va[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Va[t]||[])i(e);for(var r of this.Va["*"]||[])r(t,e)}constructor(){this.Va={}}}var Ws=ue("[SessionId]"),Vs=864e5;class Ys{on(t,e){return this.Ga.on(t,e)}constructor(t,e,i){var r;if(this.Za=null,this.Qa=null,this.Ja=[],this.Ka=void 0,this.Ya=!1,this.Ga=new Gs,this.Xa=(t,e)=>!(!W(t)||!W(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Xe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qi=t.config,this.za=t.persistence,this.st=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.eo=void 0,this._sessionActivityTimestamp=null,this.io=e||bi,this.ro=i||bi;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*tt(this.qi.session_idle_timeout_seconds||1800,60,36e3,Ws.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.no(),this.so="ph_"+s+"_window_id",this.ao="ph_"+s+"_primary_window_exists",this.oo()){var n=ji.Br(this.so),o=ji.Br(this.ao);n&&!o?this.st=n:ji.qr(this.so),ji.Dr(this.ao,!0)}null!=(r=this.qi.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.qi.bootstrap.sessionID),this.lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return L(this.Ja)&&(this.Ja=[]),this.Ja.push(t),this._e&&t(this._e,this.st),()=>{this.Ja=this.Ja.filter((e=>e!==t))}}oo(){return"memory"!==this.qi.persistence&&!this.za.Hs&&ji.Nr()}uo(t){t!==this.st&&(this.st=t,this.oo()&&ji.Dr(this.so,t))}ho(){return this.st?this.st:this.oo()?ji.Br(this.so):null}do(t){var e=this.Za;return!q(e)&&!q(t)&&5e3>Math.abs(t-e)}vo(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this._e||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this._e=t,s&&!r||s&&this.do(e)||(this.Za=e,this.za.register({[Ee]:[e,t,i]}))}co(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return W(e)&&e>0}fo(){this.co()?this.za.refreshKey(Ee):(this.za.flush(),this.za.load())}po(){var t;if(!q(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Za){this.fo();var e=this.mo();e[1]===this._e&&e[2]===this._sessionStartTimestamp&&(this.Za=this._sessionActivityTimestamp,this.za.register({[Ee]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var t=this.mo()[0],e=W(t)?t:0,i=W(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}bo(t){return this.fo(),this.Xa(t,this.yo())}mo(){var t=this.za.props[Ee];return N(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Za=null,this.eo=void 0,clearTimeout(this._o),this._o=void 0,this.vo(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void Ws.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Ws.error("Invalid sessionID in bootstrap",t)}}(t);return!L(i)&&(e?this.eo={sessionId:t,sessionStartTimestamp:i}:this.vo(t,(new Date).getTime(),i),!0)}destroy(){this.Ya=!0,this.po(),clearTimeout(this._o),this._o=void 0,this.Ka&&t&&(t.removeEventListener(ii,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&ji.qr(this.ao)},_i(t,ii,this.Ka,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.qi.cookieless_mode===Xe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this._e;if(i)this.Qa=r;else if(q(this.Qa)||this.Qa>r||r-this.Qa>=1e3){var n,o;null==(n=(o=this.za).syncCookieProperties)||n.call(o),this.Qa=r}var a=this.mo(),h=a[1],l=a[2],u=!L(s)&&h!==s,d=this.yo(),v=this.ho(),c=this.eo,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Vs),p=c?_:W(l)&&Math.abs(r-l)>Vs,f=!1,g=u,m=!h||!!c,w=h,y=!m&&!t&&this.Xa(r,d);if(y){(y=this.bo(r))||Ws.info("cross-tab refresh kept the session alive",{sessionId:h});var b=this.mo();h=b[1],l=b[2]}if(m||y||p){g=!1;var x=c&&!_;h=x?c.sessionId:this.io(),v=this.ro(),Ws.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),l=x?c.sessionStartTimestamp:r,this.eo=void 0,f=!0}else v||(v=this.ro(),f=!0),(g=g||h!==w)&&(Ws.info("adopted cross-tab session id",{sessionId:h,windowId:v}),f=!0);var E=W(d)&&t&&!p?d:r,S=W(l)?l:(new Date).getTime();this.uo(v),this.vo(h,E,S),t||this.no();var T={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.Ja.forEach((t=>t(h,v,T))),{sessionId:h,windowId:v,sessionStartTimestamp:S,changeReason:f?T:void 0,lastActivityTimestamp:d}}no(){this.Ya||(clearTimeout(this._o),this._o=setTimeout((()=>{if(!this.Ya)if(this.bo((new Date).getTime())){var t=this._e;this.resetSessionId(),this.Ga.emit("forcedIdleReset",{idleSessionId:t})}else this.no()}),1.1*this.sessionTimeoutMs))}}function Js(){return(Js=_((function*(){var t=null==i?void 0:i.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=null==e?void 0:e.model;return j(r)&&r.length>0?r:void 0}catch(t){return void le.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ks(t,e,i){return tr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Xs="custom",Qs="i.posthog.com",Zs=/^\/static\//,tn=["/s/","/e/","/i/"];class en{constructor(t){this.wo={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Qs,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.wo[this.apiHost]||(this.wo[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":Xs),this.wo[this.apiHost]}ko(t){if(Zs.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}So(t){var e=er(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}xo(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=er(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&tn.some((t=>0===e.indexOf(t)))){var a=this.So(r);if(a){var h,l=this.apiHost,u=this.Co;(null==(h=u)?void 0:h.apiHost)===l&&u.rewriteRequestPath===s||(u={apiHost:l,rewriteRequestPath:s,urls:new Set},this.Co=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Co,i=this.So(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.xo(t,e,this.uiHost+e);if("flags"===t)return this.xo(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.ko(e);if(i)return this.xo(t,e,""+i+e)}if(this.region===Xs)return this.xo(t,e,this.apiHost+e);var r=Qs+e;switch(t){case"assets":return this.xo(t,e,"https://"+this.region+"-assets."+r);case"api":return this.xo(t,e,"https://"+this.region+"."+r)}}}var rn=ue("[Surveys]"),sn={ignoreConditions:!1,ignoreDelay:!1,displayType:Nr.Popover},nn=ue("[PostHog ExternalIntegrations]"),on={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class an{constructor(t){this._instance=t}_s(t,e){var i;null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return nn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=d.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t._s(on[n],(()=>{var e;null==(e=d.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=d.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=d.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class hn{constructor(t,e){this.I=t,this.ns=e,this.To=new Map,this.Xn=!1}add(t){var e=this;return _((function*(){if(e.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.To.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.To.set(t.name,t);try{var i=t.setup(e.ns);i&&(yield i)}catch(i){var r=e.To.get(t.name)===t;r&&e.To.delete(t.name),e.I.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.Mo(t)}}))()}dispose(){if(!this.Xn){this.Xn=!0;var t=Array.from(this.To.values()).reverse();for(var e of(this.To.clear(),t))this.Mo(e)}}Mo(t){try{var e=null==t.dispose?void 0:t.dispose();e&&U(e.then)&&e.then(void 0,(e=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class ln{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);L(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var un="extensionsRemoteConfig";class dn{constructor(t){this.Xn=!1,this.instance=t,this.I=le,this.Eo=t.Io,this.kv=new ln(t),this.onEvent=t=>Er(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Xn)return Er((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.Ro.on(un,e);return this.Eo&&e(this.Eo),Er(i)},this.Po=new hn(le.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(me))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(me);return"string"==typeof t?t:void 0}get library(){return{name:v.LIB_NAME,version:v.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.Po.add(t)}capture(t,e,i){var r=this;return _((function*(){i?r.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return Er(this.instance.Ao(t))}handleRemoteConfig(t){this.Xn||(this.Eo=t,this.instance.Ro.emit(un,t))}sendRequest(t,e){var i=this;return _((function*(){var r;void 0===e&&(e={});var s=i.instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",t),n={method:e.method,url:e.query?Rs(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.Xn||(this.Xn=!0,this.Po.dispose())}}var vn,cn={},_n=0,pn=()=>{},fn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',gn="Surveys module not available",mn="sanitize_properties is deprecated. Use before_send instead",wn="Invalid value for property_denylist config: ",yn=["token","distinct_id",Ve],bn="posthog",$n=!xs&&-1===(null==l?void 0:l.indexOf("MSIE"))&&-1===(null==l?void 0:l.indexOf("Mozilla")),xn=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ci(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:pn,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:s&&j(null==s?void 0:s.search)&&-1!==s.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,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.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(t){le.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ti,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Bs},error_tracking:{},_onCapture:pn},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:qi,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:t&&t>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},En=[["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"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],Sn=t=>{var e={};for(var i of En){var r=i[0],s=i[1];L(t[r])||(e[s]=t[r])}var n=li({},e,t),o=t.__preview_external_dependency_versioned_paths;return L(o)||(L(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),j(o)&&L(t.asset_host)&&(n.asset_host=o)),N(t.property_blacklist)&&(L(t.property_denylist)?n.property_denylist=t.property_blacklist:N(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:le.error(wn+t.property_denylist)),n};class Tn{constructor(){this.__forceAllowLocalhost=!1}get Fo(){return this.__forceAllowLocalhost}set Fo(t){le.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Rn{Lo(t,e){if(t){var i=this.To.indexOf(t);-1!==i&&this.To.splice(i,1)}return this.To.push(e),null==e.initialize||e.initialize(),e}Oo(){return this.config.cookieless_mode===Xe||this.config.cookieless_mode===Ke&&this.consent.isRejected()}Do(){if(!this.Oo()&&this.get_distinct_id()===We){var t=this.persistence;if(t){this.$o()||t.load(!0);var e=this.get_distinct_id();if(!e||e===We){var i=this.config.get_device_id(bi());this.register({distinct_id:i,$device_id:i}),t.set_property(Fe,Qe)}this.No()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Tn,this.qo=!1,this.version=v.LIB_VERSION,this.jo=new Set,this.Bo="",this.Ro=new Gs,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xn(),this.SentryIntegration=Yi,this.sentryIntegration=t=>function(t,e){var i=Vi(t,e);return{name:Wi,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Uo=!1,this.zo=null,this.Wo=null,this.Vo=null,this.scrollManager=new zs(this),this.pageViewManager=new Ji(this),this.rateLimiter=new jr(this),this.requestRouter=new en(this),this.consent=new zi(this),this.externalIntegrations=new an(this);var e=null!==(t=Rn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=j(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=j(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>le.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==bn){var r,s=null!==(r=cn[i])&&void 0!==r?r:new Rn;return s._init(t,e,i),cn[i]=s,cn[bn][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o,a=j(e)?e.trim():"";if(!a)return le.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 a!==(null==(o=this.config)?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=xn(i.defaults),i.debug=this.Go(i.debug),this.Zo=i,this.Qo=[],i.person_profiles?this.Wo=i.person_profiles:i.process_person&&(this.Wo=i.process_person);var h=xn(i.defaults),l=Sn(i),u=li({},h,l,{name:r,token:a});B(h.rageclick)&&B(l.rageclick)&&(u.rageclick=li({},h.rageclick,l.rageclick)),B(h.session_recording)&&B(l.session_recording)&&(u.session_recording=li({},h.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&le.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Sr.GZipJS;var d=this.$o();if(this.persistence=new xr(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(p({},this.config,{persistence:"sessionStorage"}),d,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&ji.Nr()){var c=ji.Br(this.Bo);N(c)&&c.forEach((t=>{j(t)&&this.jo.add(t)}))}else ji.qr(this.Bo);var _=p({},this.persistence.props),f=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Jo=new Fs((t=>this.Ko(t)),this.config.request_queue_config),this.Yo=new js(this),this.__request_queue=[];var g=this.Oo();if(g||(this.sessionManager=new Ys(this),this.sessionPropsManager=new Hs(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Xo()}))),this.tl(),this.config.__preview_deferred_init_extensions?(le.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.el(g)}),0)):(le.info("Initializing extensions synchronously"),this.el(g)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&le.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:_,s:f}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var m=i.bootstrap.distinctID,w=this.get_distinct_id(),y=this.persistence.get_property(Fe);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==m&&y===Qe)this.identify(m);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==m&&y===Ze)le.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 b=this.config.get_device_id(bi()),x=i.bootstrap.isIdentifiedID?b:m;this.persistence.set_property(Fe,i.bootstrap.isIdentifiedID?Ze:Qe),this.register({distinct_id:m,$device_id:x})}}if(g)this.register_once({distinct_id:We,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(bi());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Fe,Qe)}return _i(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||bi();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Fe,Ze)),e()},s=i.user();"then"in s&&U(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Gi.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Gi.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Gi.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,ri),identify:t=>e(t,ni),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.il())):this.il(),U(this.config._onCapture)&&this.config._onCapture!==pn&&(le.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&le.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.config.disableDeviceModel||function(){return Js.apply(this,arguments)}().then((t=>{t&&this.register({[we]:t})})).catch(pn),this}rl(t){var e=t;return j(e.name)&&U(e.setup)}nl(t,e){this.rl(t)?e.push((()=>{this.sl().add(t).catch(pn)})):this.To.push(t)}tl(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=Rn.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.al)||r.call(this),this.al=void 0,this.featureFlags=new o(this)),U(this.featureFlags.onReloading)&&U(this.featureFlags.setup)?this.al||(this.al=this.featureFlags.onReloading((()=>{this.Ro.emit("featureFlagsReloading",!0)})),this.sl().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}el(t){var e,i,r,s,n,o,a,h=performance.now(),l=p({},Rn.__defaultExtensionClasses,this.config.__extensionClasses),u=[];l.exceptions&&this.To.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new l.exceptions(this)),l.historyAutocapture&&this.To.push(this.historyAutocapture=new l.historyAutocapture(this)),l.tracingHeaders&&this.To.push(this.tracingHeaders=new l.tracingHeaders(this)),l.siteApps&&this.To.push(this.siteApps=new l.siteApps(this)),l.sessionRecording&&!t&&this.To.push(this.sessionRecording=new l.sessionRecording(this)),this.config.disable_scroll_properties||u.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),l.autocapture&&this.nl(this.autocapture=new l.autocapture(this),u),l.surveys&&this.nl(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new l.surveys(this),u),l.logs&&this.To.push(this.logs=null!==(r=this.logs)&&void 0!==r?r:new l.logs(this)),l.metrics&&this.To.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new l.metrics(this)),l.conversations&&this.To.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new l.conversations(this)),l.productTours&&this.To.push(this.productTours=new l.productTours(this)),l.heatmaps&&this.To.push(this.heatmaps=new l.heatmaps(this)),l.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new l.webVitalsAutocapture(this)),l.exceptionObserver&&this.To.push(this.exceptionObserver=new l.exceptionObserver(this)),l.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new l.deadClicksAutocapture(this,Hi)),l.toolbar&&this.To.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new l.toolbar(this)),l.experiments&&this.To.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new l.experiments(this)),this.To.forEach((t=>{t.initialize&&u.push((()=>{null==t.initialize||t.initialize()}))})),u.push((()=>{if(this.ol){var t=this.ol;this.ol=void 0,this.To.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.ll(u,h)}ll(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.ll(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){le.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Ye]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Je]:r}),this.config.__preview_deferred_init_extensions&&le.info("PostHog extensions initialized ("+r+"ms)")}pa(t){var e;if(!r||!r.body)return le.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ol=t),this.Io=t,this.compression=void 0,t.ok){var i,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=I(s.supportedCompression,Sr.GZipJS)?Sr.GZipJS:I(s.supportedCompression,Sr.Base64)?Sr.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:ti}),null==(e=this.ul)||e.handleRemoteConfig(t),this.To.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}il(){try{this.config.loaded(this)}catch(t){le.critical("`loaded` function failed",t)}if(this.hl(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Oo())&&this.dl()}),1),this.vl=new qr(this),this.vl.load()}hl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Jo)||t.enable())}_dom_loaded(){this.is_capturing()&&ai(this.__request_queue,(t=>this.Ko(t))),this.__request_queue=[],this.hl()}_handle_unload(){var t,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.cl()&&this.capture(si),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Jo)||r.unload(),null==(s=this.Yo)||s.unload()):this.cl()&&this.capture(si,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?$n?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(L(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=p({},t);s.timeout=s.timeout||6e4;var n,o,a,l,u,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&L(s.compression)&&s.data&&(s.compression=Sr.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(u=(l=(N(n=s.data)?n:[n]).map((t=>p({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=u.properties)?void 0:a.token)&&void 0!==o?o:null==u?void 0:u.token,batch:l,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),N(t)?t.map((t=>p({},t,{sent_at:e}))):p({},t,{sent_at:e})}(s.data))),s.url=Ns(s.url,s.method,s.compression,s.timestampMode);var v=Us.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:r.method)&&void 0!==i?i:v[0].method;if(!c)throw new Error("No available transport method");var _=t=>{try{c(t)}catch(t){Ms(t)?le.warn(t):le.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===Sr.GZipJS&&h&&"undefined"!=typeof Promise&&!Ss?Is(s).then((t=>{_(t)})).catch((e=>{if(S(e))return Ss=!0,void _(p({},s,{compression:void 0,url:Ns(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return S(t)||e===b})(e)&&(Ss=!0),_(s)})):c(s)})(p({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Ko(t){this.Yo?this.Yo.retriableRequest(t):this._send_request(t)}_execute_array(t){_n++;try{var e,i=[],r=[],s=[];ai(t,(t=>{if(t)if(N(e=t[0]))s.push(t);else if(U(t))try{t.call(this)}catch(e){le.error("Error executing queued PostHog call",t,e)}else N(t)&&"alias"===e?i.push(t):N(t)&&-1!==e.indexOf("capture")&&U(this[e])?s.push(t):r.push(t)}));var n=function(t,e){ai(t,(function(t){try{if(N(t[0])){var i=e;hi(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){le.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{_n--}}push(t){if(_n>0&&N(t)&&j(t[0])){var e=Rn.prototype[t[0]];U(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jo){if(this.is_capturing())if(!L(t)&&j(t)){this.Do();var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var l=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==l||!l.isRateLimited){null!=e&&e.$current_url&&!j(null==e?void 0:e.$current_url)&&(le.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i._originatedFromCaptureException||le.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 u=new Date,d=(null==i?void 0:i.timestamp)||u,v=oe(null==i?void 0:i.uuid,bi),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===ri&&this.config.__preview_capture_bot_pageviews&&h&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),l&&(c.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);var _="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property(Ie);(null==i?void 0:i.$set)&&!_&&(c.$set=null==i?void 0:i.$set);var f=null==i?void 0:i.$unset;f&&(c.$unset=f);var m,w,y,b=_?void 0:this.pl(null==i?void 0:i.$set_once,t!==oi,t===ni);if(b&&(c.$set_once=b),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>j(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){if(e!==Object(e))return o?o(e):e;if(!a.has(e)){var r;if(a.add(e),N(e))r=[],ai(e,(e=>{r.push(t(e))}));else{var s={};hi(e,((e,i)=>{a.has(e)||(s[i]=t(e,i))})),r=s}return r}}(n)),c.timestamp=d,L(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=u),_&&(c.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return g.forEach(r),e.forEach(r),i}(c.properties,yn)),t===Ar.DISMISSED||t===Ar.SENT){var x=null==e?void 0:e[Dr.SURVEY_ID],E=null==e?void 0:e[Dr.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){rn.error("Failed to persist survey seen state",t)}})({id:x,current_iteration:E}),c.$set=p({},c.$set,{[(m={id:x,current_iteration:E},w=t===Ar.SENT?"responded":"dismissed",y="$survey_"+w+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(y="$survey_"+w+"/"+m.id+"/"+m.current_iteration),y)]:!0})}else t===Ar.SHOWN&&(c.$set=p({},c.$set,{[Dr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Br.SHOWN){var S=null==e?void 0:e[Fr.TOUR_TYPE];S&&(c.$set=p({},c.$set,{[Fr.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var T=p({},c.properties.$set,c.$set);if(F(T)||this.setPersonPropertiesForFlags(T),!H(this.config.before_send)){var R=this.kn(c);if(!R)return;(c=R).uuid=oe(c.uuid,bi)}this.Ro.emit("eventCaptured",c);var k=null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),P={method:"POST",url:k,data:c,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(k)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Ko(P):this.Jo.enqueue(P),c}le.critical("This capture call is ignored due to client rate limiting.")}}else le.error("No event name provided to posthog.capture")}else le.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}sl(){var t;return null!==(t=this.ul)&&void 0!==t?t:this.ul=new dn(this)}Ao(t){this.Ho.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.Ho.indexOf(t);-1!==i&&this.Ho.splice(i,1)}}}gl(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Vo=null,this.persistence.get_property(Fe)===Qe&&(null==(r=this.sessionPersistence)||r.clear(),this.jo.clear(),this.ml()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.gl();var h=a?void 0:this.persistence.remove_event_timer(e),u=p({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Oo()&&(u[Ve]=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!j(u.distinct_id)&&!G(u.distinct_id)||z(u.distinct_id))&&le.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var c,_=function(e,i,r,n){var o,a,h,u;if(void 0===n&&(n=!1),!l)return{};var d,c=e?[...nr,...i||[]]:[],_=function(t){for(var e=0;re.length>e;e++){var i=re[e],r=i[1],s=i[0].exec(t),n=s&&(U(r)?r(s,t):r);if(n)return n}return["",""]}(l),p=_[0],f=_[1],g=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};L(r)||(m.detectGoogleSearchApp=r);var w={},y=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,b=null==(a=navigator)?void 0:a.maxTouchPoints,x=null==t||null==(h=t.screen)?void 0:h.width,E=null==t||null==(u=t.screen)?void 0:u.height,S=null==t?void 0:t.devicePixelRatio;L(y)||(w.userAgentDataPlatform=y),L(b)||(w.maxTouchPoints=b),L(x)||(w.screenWidth=x),L(E)||(w.screenHeight=E),L(S)||(w.devicePixelRatio=S);var T,R,k,P,O,I,C,M,A=li(di({$os:p,$os_version:f,$browser:te(l,navigator.vendor,g,m),$device:se(l),$device_type:(R=l,k=w,M=se(R),M===ot||M===nt||"Kobo"===M||"Kindle Fire"===M||M===Nt?st:M===St||M===Rt||M===Tt||M===Mt?"Console":M===ht?"Wearable":M?et:"Android"===(null==k?void 0:k.userAgentDataPlatform)&&(null!==(P=null==k?void 0:k.maxTouchPoints)&&void 0!==P?P:0)>0?600>Math.min(null!==(O=null==k?void 0:k.screenWidth)&&void 0!==O?O:0,null!==(I=null==k?void 0:k.screenHeight)&&void 0!==I?I:0)/(null!==(C=null==k?void 0:k.devicePixelRatio)&&void 0!==C?C:1)?et:st:"Desktop"),$timezone:fr(),$timezone_offset:gr()}),{$current_url:rr(n?ae(null==s?void 0:s.href):null==s?void 0:s.href,c,ar),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:l.length>1e3?l.substring(0,997)+"...":l,$browser_version:ie(l,navigator.vendor,g,m),$browser_language:dr(),$browser_language_prefix:(T=dr(),"string"==typeof T?T.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=v.SDK_DIST_CHANNEL),A}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var f=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),g=f.windowId;u.$session_id=f.sessionId,u.$window_id=g}this.sessionPropsManager&&li(u,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&li(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(m=this.Yo)?void 0:m.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Xs&&(u.$lib_custom_api_host=this.config.api_host),c=e!==ri||a?e!==si||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),u=li(u,c),e===ri&&r&&(u.title=r.title),!L(h)){var w=n.getTime()-h;u.$duration=parseFloat((w/1e3).toFixed(3))}l&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties();hi(["$referrer","$referring_domain"],(t=>{t in y&&delete b[t]}));var x={};if(this.Ho.length>0)for(var E of this.Ho.slice())try{li(x,E())}catch(t){le.error("Failed to produce browser extension event properties",t)}(u=li({},_,y,b,p({},x,u))).$is_identified=this._isIdentified(),N(this.config.property_denylist)?hi(this.config.property_denylist,(function(t){delete u[t]})):le.error(wn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(le.error(mn),u=S(u,e));var T=this.yl();return u.$process_person_profile=T,T&&!a&&this.bl("_calculate_event_properties"),u}pl(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.yl())return t;if(this.qo&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=li({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(le.error(mn),o=a(o,"$set_once")),e&&(this.qo=!0),F(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.gl(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.jo.add(t))),this.ml()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.jo.delete(t),this.ml()}_l(t,e){this.register({[t]:e})}Xo(){this.jo.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.jo.clear(),this.ml()}ml(){var t;if(this.Bo)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Hs||!ji.Nr())ji.qr(this.Bo);else{var e=[];this.jo.forEach((t=>e.push(t))),e.length>0?ji.Dr(this.Bo,e):ji.qr(this.Bo)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Ro.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:gn}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:gn})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:gn})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=sn),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:gn}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:gn})}wl(t){return!t||z(t)?(le.critical("Unique user id has not been set in posthog.identify"),!1):t===We?(le.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(le.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return le.uninitializedWarning("posthog.identify");if(G(t)&&(t=t.toString(),le.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.wl(t)&&this.bl("posthog.identify")){this.Do();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.gl(!1),o=this.persistence.Ws(),a=!1;try{var h=this.get_distinct_id();this.register({$user_id:t}),this.get_property(me)||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),t!==h&&t!==this.get_property(ye)&&(this.unregister(ye),this.register({distinct_id:t}));var l,u=(this.persistence.get_property(Fe)||Qe)===Qe,d=t!==h,v=!d&&u;if(d&&u)this.persistence.set_property(Fe,Ze),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(ni,{distinct_id:t,$anon_distinct_id:h},{$set:e||{},$set_once:i||{}}),this.Vo=Ks(t,e,i),null==(l=this.featureFlags)||l.setAnonymousDistinctId(h);else if(v){this.persistence.set_property(Fe,Ze);var c=e||{},_=i||{};this.setPersonPropertiesForFlags({$set:c,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:c,$set_once:_}),this.Vo=Ks(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Ne)):v&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Qs(a)}}}setPersonProperties(t,e){if((t||e)&&this.bl("posthog.setPersonProperties")){var i=Ks(this.get_distinct_id(),t,e);this.Vo!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Vo=i):le.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(N(t)?t:[t]).filter((t=>j(t)&&t.length>0));0!==i.length&&this.bl("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Vo=null)}group(t,e,i){var r;if(t&&e){null==(r=this.persistence)||r.syncCookieProperties(),this.gl();var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},s,{[t]:e})}),n||i){var o={$group_type:t,$group_key:e};i&&(o.$group_set=i),this.capture(oi,o)}i&&this.setGroupPropertiesForFlags({[t]:i}),n&&!i&&this.reloadFeatureFlags()}else le.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.bl("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=V(t)?t:null==t?void 0:t.resetDeviceID,i=V(t)||null==t?void 0:t.bootstrap;this.kl(e,!1,i)}kl(t,e,i){var r,s,n;if(void 0===e&&(e=!1),le.info("reset"),!this.__loaded)return le.uninitializedWarning("posthog.reset");var o=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(r=this.Zo)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(me),h=this.get_property(we),l=this.get_property(xe),u=this.is_capturing();this.consent.reset(),e||!u||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(n=this.persistence)||null==n.Ws?void 0:n.Ws(),v=!1;try{var c,_,f,g,m,w,y,b,x,E,S,T,R,k;if(null==(c=this.persistence)||c.clear(),null==(_=this.sessionPersistence)||_.clear(),this.jo.clear(),this.ml(),L(l)||null==(S=this.persistence)||S.register({[xe]:l}),null==(f=this.surveys)||f.reset(),null==(g=this.vl)||g.stop(),null==(m=this.featureFlags)||m.reset(),null==(w=this.conversations)||w.reset(),null==(y=this.logs)||y.reset(),null==(b=this.metrics)||b.reset(),null==(x=this.persistence)||x.set_property(Fe,Qe),null==(E=this.sessionManager)||E.resetSessionId(),this.Vo=null,this.config.cookieless_mode===Xe)this.register_once({distinct_id:We,$device_id:null},"");else{var P=this.config.get_device_id(bi());this.register_once({distinct_id:P,$device_id:t?P:a},""),t||L(h)||this.register({[we]:h})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this.Oo()||(null==(k=this.persistence)||k.set_property(Fe,i.isIdentifiedID?Ze:Qe),this.register({distinct_id:i.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(L(o)||null!=(R=this.sessionManager)&&R.setBootstrapSessionId(o,!0))){var O=p({},i);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,v=!0}finally{var I;d&&(null==(I=this.persistence)||null==I.Qs||I.Qs(v))}this.reloadFeatureFlags()}shutdown(t){var e=this;return _((function*(){var t,i,r,s,n,o;if(e.__loaded){null==(t=e.vl)||t.stop(),e.sl().dispose(),null==(i=e.sessionRecording)||i.dispose(),null==(r=e.logs)||r.flushLogs("sendBeacon"),null==(s=e.metrics)||s.flush("sendBeacon"),null==(n=e.Jo)||n.unload(),null==(o=e.Yo)||o.unload();try{var a;null==(a=e.featureFlags)||a.destroy()}catch(t){le.error("Error while destroying feature flags",t)}}else le.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(fe)?(le.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(L(e)&&(e=this.get_distinct_id()),t!==e?(this._l(ye,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(le.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=p({},this.config);if(B(t)){var i,r,s,n,o,a,h,l,u,d,c,_;li(this.config,Sn(t));var f=this.$o();null==(i=this.persistence)||i.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(p({},this.config,{persistence:"sessionStorage"}),f,!1);var g,m=this.Go(this.config.debug);V(m)&&(this.config.debug=m),V(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,Ri.Nr()&&Ri.Dr("ph_debug",!0),le.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,Ri.Nr()&&Ri.qr("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.No(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:Rn.Cl}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:bn;return e!==bn&&(e=bn+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Fe))===Ze||(null==(e=this.sessionPersistence)?void 0:e.get_property(Fe))===Ze}yl(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ti&&!this._isIdentified()&&F(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[ye])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ge]))}cl(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yl()||this.bl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bl(t){return"never"===this.config.person_profiles?(le.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._l(Ge,!0),!0)}$o(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ke)}No(){var t,e,i,r,s=this.$o();return(null==(t=this.persistence)?void 0:t.Hs)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.Hs)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.jo.clear(),this.ml()),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==Xe){if(this.Oo()){var i,r,s,n,o;this.kl(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Ys(this),this.pageViewManager=new Ji(this),this.persistence&&(this.sessionPropsManager=new Hs(this,this.sessionManager,this.persistence));var a,h=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=Rn.__defaultExtensionClasses)?void 0:o.sessionRecording;h&&(this.sessionRecording=this.Lo(this.sessionRecording,new h(this)),this.Io&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Io)))}var l,u;this.consent.optInOut(!0),this.No(),this.hl(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==Ke&&(null==(l=this.surveys)||l.loadIfEnabled()),(L(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.dl()}else le.warn(fn)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==Xe?(this.config.cookieless_mode===Ke&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===Ke&&(this.register({distinct_id:We,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.dl(),this.hl())):le.warn(fn)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Xe||(this.config.cookieless_mode===Ke?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.No()}_is_bot(){return i?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&O(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>O(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver}(i,this.config.custom_blocked_useragents):void 0}dl(){r&&("visible"===r.visibilityState?this.Uo||(this.Uo=!0,this.capture(ri,{title:r.title},{send_instantly:!0}),this.zo&&(r.removeEventListener(ei,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),_i(r,ei,this.zo)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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 t=this.Zo||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(le.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):function(t,e,i,r,s){var n=e in t&&!H(t[e]),o=i in t&&!H(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,le)}kn(t){var e;if(H(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(K),r=N(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),H(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return J(t.event)?le.warn(o+". This can cause unexpected behavior."):le.info(o),null}s.properties&&!F(s.properties)||le.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return le.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&H(s.properties[a]))return le.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.Ss)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Go(t){var e=V(t)&&!t,i=Ri.Nr()&&"true"===Ri.Pr("ph_debug");return!e&&(!!i||t)}}Rn.__defaultExtensionClasses={},Rn.Cl={trace:vn=()=>{},debug:vn,info:vn,warn:vn,error:vn,fatal:vn},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=ui(t.prototype[e[i]])}(Rn,["identify"]);var kn=function(){v.SDK_DIST_CHANNEL="npm";var e=cn[bn]=new Rn;return function(){function e(){e.done||(e.done=!0,$n=!1,hi(cn,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():_i(r,"DOMContentLoaded",e,{capture:!1}):t&&le.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Sr as Compression,Ur as DEFAULT_PRODUCT_TOUR_APPEARANCE,Nr as DisplaySurveyType,Rn as PostHog,Br as ProductTourEventName,Fr as ProductTourEventProperties,Ar as SurveyEventName,Dr as SurveyEventProperties,Tr as SurveyEventType,kr as SurveyPosition,Cr as SurveyQuestionBranchingType,Ir as SurveyQuestionType,Mr as SurveySchedule,Pr as SurveyTabPosition,Or as SurveyType,Rr as SurveyWidgetType,kn as default,kn as posthog,Hr as severityLevels};
1
+ var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,h=null==e?void 0:e.CompressionStream,l=null==i?void 0:i.userAgent,u="undefined"!=typeof globalThis?globalThis:t;u&&"undefined"==typeof self&&(u.self=u),u&&"undefined"==typeof File&&(u.File=function(){});var d=null!=t?t:{},v={DEBUG:!1,LIB_VERSION:"0.5.2",LIB_NAME:"browser-common"};function c(t,e,i,r,s,n,o){try{var a=t[n](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(r,s)}function _(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},p.apply(null,arguments)}var f,g=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],m=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),w=["$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"],y=["token"],b="NativeGzipValidationError",x=t=>t.length>=2&&31===t[0]&&139===t[1],E=(t,e)=>t===m.GZipJS||e===m.GZipJS||"gzip"===e,S=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),T=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=b,e},R=function(){var t=_((function*(t,e){18>t.size&&T("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());x(i)&&8===i[2]||T("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(f)return f;f=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;f[t]=e>>>0}return f})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&T("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&T("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function k(){return k=_((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=_((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),h=(yield Promise.all([a,o]))[0];return yield R(h,r),h}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),k.apply(this,arguments)}var P=["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"],O=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return P.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function I(t,e){return-1!==t.indexOf(e)}var C=function(t){return t.replace(/^\$/,"")},M=Object.prototype,A=M.hasOwnProperty,D=M.toString,N=Array.isArray||function(t){return"[object Array]"===D.call(t)},U=t=>"function"==typeof t,B=t=>t===Object(t)&&!N(t),F=t=>{if(B(t)){for(var e in t)if(A.call(t,e))return!1;return!0}return!1},L=t=>void 0===t,j=t=>"[object String]"==D.call(t),z=t=>j(t)&&0===t.trim().length,q=t=>null===t,H=t=>L(t)||q(t),G=t=>"[object Number]"==D.call(t)&&t==t,W=t=>G(t)&&t>0,V=t=>"[object Boolean]"===D.call(t),Y=t=>t instanceof FormData,J=t=>I(w,t),K=t=>I(y,t),X=[!0,"true",1,"1","yes"],Q=t=>I(X,t),Z=[!1,"false",0,"0","no"];function tt(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),G(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),tt(s||i,e,i,r))}var et="Mobile",it="iOS",rt="Android",st="Tablet",nt=rt+" "+st,ot="iPad",at="Apple",ht=at+" Watch",lt="Safari",ut="BlackBerry",dt="Samsung",vt=dt+"Browser",ct=dt+" Internet",_t="Chrome",pt=_t+" OS",ft=_t+" "+it,gt="Internet Explorer",mt=gt+" "+et,wt="Opera",yt=wt+" Mini",bt="Edge",$t="Microsoft "+bt,xt="Firefox",Et=xt+" "+it,St="Nintendo",Tt="PlayStation",Rt="Xbox",kt=rt+" "+et,Pt=et+" "+lt,Ot="Windows",It=Ot+" Phone",Ct="Nokia",Mt="Ouya",At="Generic",Dt=At+" "+et.toLowerCase(),Nt=At+" "+st.toLowerCase(),Ut="Konqueror",Bt="Oculus Browser",Ft="Vivaldi",Lt="Yandex",jt="Whale",zt="DuckDuckGo",qt="Pale Moon",Ht="Waterfox",Gt="Brave",Wt="Google Search App",Vt="(\\d+(\\.\\d+)?)",Yt=new RegExp("Version/"+Vt),Jt=new RegExp(Rt,"i"),Kt=new RegExp(Tt+" \\w+","i"),Xt=new RegExp(St+" \\w+","i"),Qt=new RegExp(ut+"|PlayBook|BB10","i"),Zt={"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"},te=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Gt:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&I(t,"GSA/")?Wt:I(t," OPR/")&&I(t,"Mini")?yt:I(t," OPR/")?wt:Qt.test(t)?ut:I(t,"IE"+et)||I(t,"WPDesktop")?mt:I(t,"OculusBrowser")?Bt:I(t,vt)?ct:I(t,bt)||I(t,"Edg/")?$t:I(t,Ft+"/")?Ft:I(t,"YaBrowser/")?Lt:I(t,jt+"/")?jt:I(t,zt+"/")||I(t,"Ddg/")?zt:I(t,"FBIOS")?"Facebook "+et:I(t,"UCWEB")||I(t,"UCBrowser")?"UC Browser":I(t,"CriOS")?ft:I(t,"CrMo")||I(t,_t)?_t:I(t,rt)&&I(t,lt)?kt:I(t,"FxiOS")?Et:I(t.toLowerCase(),Ut.toLowerCase())?Ut:I(t,Gt+"/")?Gt:((t,e)=>e&&I(e,at)||function(t){return I(t,lt)&&!I(t,_t)&&!I(t,rt)}(t))(t,e)?I(t,et)?Pt:lt:I(t,"PaleMoon/")?qt:I(t,Ht+"/")?Ht:I(t,xt)?xt:I(t,"MSIE")||I(t,"Trident/")?gt:I(t,"Gecko")?xt:"")},ee={[mt]:[new RegExp("rv:"+Vt)],[$t]:[new RegExp(bt+"?\\/"+Vt)],[_t]:[new RegExp("("+_t+"|CrMo)\\/"+Vt)],[ft]:[new RegExp("CriOS\\/"+Vt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Vt)],[lt]:[Yt],[Pt]:[Yt],[wt]:[new RegExp("(Opera|OPR)\\/"+Vt)],[xt]:[new RegExp(xt+"\\/"+Vt)],[Et]:[new RegExp("FxiOS\\/"+Vt)],[Ut]:[new RegExp("Konqueror[:/]?"+Vt,"i")],[ut]:[new RegExp(ut+" "+Vt),Yt],[kt]:[new RegExp("android\\s"+Vt,"i")],[ct]:[new RegExp(vt+"\\/"+Vt)],[Bt]:[new RegExp("OculusBrowser\\/"+Vt)],[Ft]:[new RegExp(Ft+"\\/"+Vt)],[Lt]:[new RegExp("YaBrowser\\/"+Vt)],[jt]:[new RegExp(jt+"\\/"+Vt)],[Gt]:[new RegExp(Gt+"\\/"+Vt)],[zt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Vt)],[qt]:[new RegExp("PaleMoon\\/"+Vt)],[Ht]:[new RegExp(Ht+"\\/"+Vt)],[Wt]:[new RegExp("GSA\\/"+Vt)],[gt]:[new RegExp("(rv:|MSIE )"+Vt)],Mozilla:[new RegExp("rv:"+Vt)]},ie=function(t,e,i,r){var s=te(t,e,i,r),n=ee[s];if(L(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},re=[[new RegExp(Rt+"; "+Rt+" (.*?)[);]","i"),t=>[Rt,t&&t[1]||""]],[new RegExp(St,"i"),[St,""]],[new RegExp(Tt,"i"),[Tt,""]],[Qt,[ut,""]],[new RegExp(Ot,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[It,""];if(new RegExp(et).test(e)&&!/IEMobile\b/.test(e))return[Ot+" "+et,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Zt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[Ot,r]}return[Ot,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[it,[t[3],t[4],t[5]||"0"].join(".")]:[it,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=L(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+rt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+rt+")","i"),t=>t&&t[2]?[rt,[t[2],t[3],t[4]||"0"].join(".")]:[rt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[pt,""]],[/Linux|debian/i,["Linux",""]]],se=function(t){return Xt.test(t)?St:Kt.test(t)?Tt:Jt.test(t)?Rt:new RegExp(Mt,"i").test(t)?Mt:new RegExp("("+It+"|WPDesktop)","i").test(t)?It:/iPad/.test(t)?ot:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ht:Qt.test(t)?ut:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ct,"i").test(t)?Ct:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(et).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?rt:nt:new RegExp("(pda|"+et+")","i").test(t)?Dt:new RegExp(st,"i").test(t)&&!new RegExp(st+" pc","i").test(t)?Nt:""},ne=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function oe(t,e){return"string"==typeof(i=t)&&ne.test(i)?t:e();var i}function ae(t){return t?t.split("#")[0]:t}var he=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={F(i){if(t&&(v.DEBUG||t.POSTHOG_DEBUG||r)&&!L(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),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 t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>he(e+" "+t,i)};return s},le=he("[PostHog.js]"),ue=le.createLogger,de=ue("[ExternalScriptsLoader]"),ve=t=>{var e=null==r?void 0:r.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},ce=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return de.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=ve(e);if(s){if(s.__posthog_loading_callback_fired)return i();var n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,i(t)})))}var o=()=>{if(!r)return i("document not found");if(ve(e))return ce(t,e,i);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?o():null==r||r.addEventListener("DOMContentLoaded",o)},_e={},pe=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=_e[s];if("fallback"===r&&n){if(ve(n))return void ce(t,n,i);delete _e[s]}ce(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=pe(t,e);_e[s]=a;var h=ve(s);null==h||null==(o=h.parentNode)||o.removeChild(h),ce(t,a,i)}else i(void 0,n)}:i)}else ce(t,pe(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");ce(t,o,i)}},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);ce(t,r,i)};v.DEBUG=!1,v.LIB_VERSION="1.419.2",v.LIB_NAME="web";var fe="$people_distinct_id",ge="distinct_id",me="$device_id",we="$device_model",ye="__alias",be="__timers",$e="$dead_clicks_enabled_server_side",xe="$session_recording_remote_config",Ee="$sesid",Se="$session_is_sampled",Te="$enabled_feature_flags",Re="$active_feature_flags",ke="$feature_flag_details",Pe="$feature_flag_payloads",Oe="$feature_flag_request_id",Ie="$minimal_flag_called_events",Ce="$stored_person_properties",Me="$stored_group_properties",Ae="$groups",De="$surveys_loaded_at",Ne="$flag_call_reported",Ue="$feature_flag_errors",Be="$feature_flag_evaluated_at",Fe="$user_state",Le="$client_session_props",je="$capture_rate_limit",ze="$initial_campaign_params",qe="$initial_referrer_info",He="$initial_person_info",Ge="$epp",We="$posthog_cookieless",Ve="$cookieless_mode",Ye="$sdk_debug_extensions_init_method",Je="$sdk_debug_extensions_init_time_ms",Ke="on_reject",Xe="always",Qe="anonymous",Ze="identified",ti="identified_only",ei="visibilitychange",ii="beforeunload",ri="$pageview",si="$pageleave",ni="$identify",oi="$groupidentify";function ai(t,e){N(t)&&t.forEach(e)}function hi(t,e){if(!H(t))if(N(t))t.forEach(e);else if(Y(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)A.call(t,i)&&e(t[i],i)}var li=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},ui=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){le.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),le.critical(t)}}},di=function(t){var e={};return hi(t,(function(t,i){(j(t)&&t.length>0||G(t))&&(e[i]=t)})),e};var vi=["herokuapp.com","vercel.app","netlify.app"];function ci(t){var e=null==t?void 0:t.hostname;if(!j(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of vi)if(i===r)return!1;return!0}function _i(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var pi=t=>{if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return G(t)&&isFinite(t)&&Math.floor(t)===t});class fi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new fi(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new fi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class gi{generate(){var t=this.generateOrAbort();if(!L(t))return t;this.Rr=0;var e=this.generateOrAbort();if(L(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.Rr)this.Rr=t,this.Ar();else{if(this.Rr>=t+1e4)return;this.Lr++,this.Lr>4398046511103&&(this.Rr++,this.Ar())}return fi.fromFieldsV7(this.Rr,Math.trunc(this.Lr/Math.pow(2,30)),this.Lr&Math.pow(2,30)-1,this.Or.nextUint32())}Ar(){this.Lr=1024*this.Or.nextUint32()+(1023&this.Or.nextUint32())}constructor(){this.Rr=0,this.Lr=0,this.Or=new yi}}var mi,wi=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!L(t.crypto)&&crypto.getRandomValues&&(wi=t=>crypto.getRandomValues(t));class yi{nextUint32(){return this.ft.length>this.Fr||(wi(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var bi=()=>$i().toString(),$i=()=>(mi||(mi=new gi)).generate(),xi="",Ei=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Si={Nr:()=>!!r,jr(t){le.error("cookieStore error: "+t)},Pr:pi,Br(t){var e;try{e=JSON.parse(Si.Pr(t))||{}}catch(t){}return e},Dr(t,e,i,s,n){if(!r)return!1;try{var o="",a="",h=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),xi)return xi;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+bi();!xi&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",xi=o)}return xi}(t);if(!i){var s=(t=>{var e=t.match(Ei);return e?e[0]:""})(t);s!==i&&le.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),o="; expires="+l.toUTCString()}n&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+h+a;return u.length>3686.4&&le.warn("cookieStore warning: large cookie, len="+u.length),r.cookie=u,!0}catch(t){return!1}},qr(t,e){if(null!=r&&r.cookie)try{Si.Dr(t,"",-1,e)}catch(t){return}}},Ti=null,Ri={Nr(){if(!q(Ti))return Ti;var e=!0;if(L(t))e=!1;else try{var i="__mplssupport__";Ri.Dr(i,"xyz"),'"xyz"'!==Ri.Pr(i)&&(e=!1),Ri.qr(i)}catch(t){e=!1}return e||le.error("localStorage unsupported; falling back to cookie store"),Ti=e,e},jr(t){le.error("localStorage error: "+t)},Pr(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Ri.jr(t)}return null},Br(t){try{return JSON.parse(Ri.Pr(t))||{}}catch(t){}return null},Dr(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ri.jr(t)}return!1},qr(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Ri.jr(t)}}},ki=[Ce,Re,Te,ke,Pe,Oe,Be,Ue,Ne],Pi=[me,ge,Ee,Se,Ge,He,Fe],Oi=t=>t+"_cpm",Ii=["__proto__","constructor","prototype"],Ci=t=>{if(!B(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Ii.indexOf(i)&&(e[i]=t[i])})),e},Mi=function(t,e){void 0===e&&(e=[]);var i={};return[...Pi,...e].forEach((e=>{var r=t[e];L(r)||q(r)||""===r||(i[e]=r)})),i},Ai=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Di=(t,e)=>({p:e,f:Ai(JSON.stringify(t))}),Ni=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=Si.Br(Oi(t)),r=(null==i?void 0:i.f)===Ai(e)&&N(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Ui=(t,e)=>e+"|"+(Si.Pr(Oi(t))||""),Bi={},Fi={Nr:()=>!0,jr(t){le.error("memoryStorage error: "+t)},Pr:t=>Bi[t]||null,Br:t=>Bi[t]||null,Dr:(t,e)=>(Bi[t]=e,!0),qr(t){delete Bi[t]}},Li=null,ji={Nr(){if(!q(Li))return Li;if(Li=!0,L(t))Li=!1;else try{var e="__support__";ji.Dr(e,"xyz"),'"xyz"'!==ji.Pr(e)&&(Li=!1),ji.qr(e)}catch(t){Li=!1}return Li},jr(t){le.error("sessionStorage error: ",t)},Pr(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){ji.jr(t)}return null},Br(t){try{return JSON.parse(ji.Pr(t))||null}catch(t){}return null},Dr(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){ji.jr(t)}return!1},qr(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){ji.jr(t)}}};class zi{constructor(t){this._instance=t}get qi(){return this._instance.config}get consent(){return this.cs()?0:this.fs}isOptedOut(){return this.qi.cookieless_mode===Xe||this.isRejected()||-1===this.consent&&this.qi.cookieless_mode===Ke}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.qi.opt_out_capturing_by_default}optInOut(t){this.ps.Dr(this.gs,t?1:0,this.qi.cookie_expiration,this.qi.cross_subdomain_cookie,this.qi.secure_cookie)}reset(){this.ps.qr(this.gs,this.qi.cross_subdomain_cookie)}get gs(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get fs(){var t=this.ps.Pr(this.gs);return Q(t)?1:I(Z,t)?0:-1}get ps(){var t=this.qi.opt_out_capturing_persistence_type,e="localStorage"===t?Ri:Si;if(!this.ys||this.ys!==e){this.ys=e;var i="localStorage"===t?Si:Ri;i.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(Q(i.Pr(this.gs))),i.qr(this.gs,this.qi.cross_subdomain_cookie))}return this.ys}cs(){return!!this.qi.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack].some((t=>Q(t)))}}var qi=["next","previous","prev",">","<","+","-","−","–"];ue("[Dead Clicks]");var Hi=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property($e)),r=t.instance.config.capture_dead_clicks;return V(r)?r:!!B(r)||i},Gi=ue("[SegmentIntegration]");var Wi="posthog-js";function Vi(t,e){var i=void 0===e?{}:e,r=i.organization,s=i.projectId,n=i.prefix,o=i.severityAllowList,a=void 0===o?["error"]:o,h=i.sendExceptionsToPostHog,l=void 0===h||h;return e=>{var i,o,h,u,d;if("*"!==a&&!a.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,_=(null==(i=e.exception)?void 0:i.values)||[],f=_.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(o=_[0])?void 0:o.value)||e.message,$exception_type:null==(h=_[0])?void 0:h.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(u=_[0])?void 0:u.value)||e.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),l&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class Yi{constructor(t,e,i,r,s,n){this.name=Wi,this.setupOnce=function(o){o(Vi(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Ji{constructor(t){this.ks=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(le.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Ss=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.xs()}xs(){var t;this.Cs=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ks)}destroy(){var t;null==(t=this.Cs)||t.call(this),this.Cs=void 0}doPageView(e,i){var r,s=this.Ts(e,i);return this.Ss={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.Ts(t,null==(e=this.Ss)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ss)?void 0:t.pageViewId}}Ts(t,e){var i=this.Ss;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,h=s.maxContentHeight,l=s.lastContentY,u=s.maxContentY;if(!(L(n)||L(o)||L(a)||L(h)||L(l)||L(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),h=Math.ceil(h),l=Math.ceil(l),u=Math.ceil(u);var d=n>1?tt(o/n,0,1,le):1,v=n>1?tt(a/n,0,1,le):1,c=h>1?tt(l/h,0,1,le):1,_=h>1?tt(u/h,0,1,le):1;r=li(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Ki=["flags","surveys"],Xi={[fe]:{exposure:"hidden"},[ye]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[be]:{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"},[$e]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[xe]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[Se]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:t=>q(t)},$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"},[Te]:{exposure:"hidden",storageGroup:"flags"},[Re]:{exposure:"hidden",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},[ke]:{exposure:"hidden",storageGroup:"flags"},[Pe]:{exposure:"hidden",storageGroup:"flags"},[Oe]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ie]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"hidden"},$override_feature_flag_payloads:{exposure:"hidden"},[Ce]:{exposure:"hidden"},[Me]:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[De]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},$surveys_activated_session:{exposure:"hidden"},$surveys_activated_timestamps:{exposure:"hidden"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ne]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},[Ae]:{exposure:"event"},[Ue]:{exposure:"hidden"},[Be]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Fe]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[je]:{exposure:"hidden"},[ze]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[He]:{exposure:"hidden"},[Ge]:{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"},[Ye]:{exposure:"event"},[Je]:{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_pending_trigger_conditions:{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"}},Qi=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Zi=t=>{var e=Xi[t];if(e)return e;for(var i of Qi){var r=i[1];if(0===t.indexOf(i[0]))return r}},tr=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return r=[],null!==(i=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(e))return"[Circular]";r.push(e)}return e}})))&&void 0!==i?i:"null"}var i,r},er=t=>{var e=null==r?void 0:r.createElement("a");return L(e)?null:(e.href=t,e)},ir=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!N(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){le.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},rr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],h=(o||"").split("&"),l=[],u=0;h.length>u;u++){var d=h[u].split("=");N(d)&&(e.includes(d[0])?l.push(d[0]+"="+i):l.push(h[u]))}var v=a;return null!=o&&(v+="?"+l.join("&")),null!=s&&(v+="#"+s),v},sr="https?://(.*)",nr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],or=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...nr],ar="<masked>",hr=["li_fat_id"];function lr(t,e){var i=or.concat(e||[]),r={};return hi(i,(function(e){var i=ir(t,e);r[e]=i||null})),r}function ur(t){var e=function(t){return t?0===t.search(sr+"google.([^/?]*)")?"google":0===t.search(sr+"bing.com")?"bing":0===t.search(sr+"yahoo.com")?"yahoo":0===t.search(sr+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!q(e)){s.$search_engine=e;var n=r?ir(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function dr(){return navigator.language||navigator.userLanguage}var vr="$direct";function cr(){return(null==r?void 0:r.referrer)||vr}function _r(t,e,i){void 0===i&&(i=!1);var r=t?[...nr,...e||[]]:[],n=i?ae(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:cr().substring(0,1e3),u:o?rr(o,r,ar):void 0}}function pr(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?ae(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==vr?vr:null==(i=er(r))?void 0:i.host};if(n){o.$current_url=n;var a=er(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var h=lr(n);li(o,h)}if(r){var l=ur(r);li(o,l)}return o}function fr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function gr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var mr={flags:Be,surveys:De},wr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],yr=t=>t+"_cookie_identity_change_pending",br="main",$r=(t,e)=>{hi(t,((i,r)=>{var s=Zi(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class xr{constructor(e,i,r){if(void 0===r&&(r=!0),this.Ms={},this.Es=!1,this.Is=!1,this.Rs=!1,this.Ps=!1,this.qi=e,this.As=r,this.props={},this.Fs=void 0,this.Ls=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.ps=this.Os(e),this.Is=this.Ds(e),this.load(),e.debug&&le.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();_i(t,"beforeunload",s,{capture:!1}),_i(t,"pagehide",s,{capture:!1})}}$s(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return G(e)&&e>0?e:0}Ns(t){if(this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase())if(t)try{var e=Mi(t,this.qi.cookie_persisted_properties||[]),i=Di(e,this.qi.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=Si.Pr(this.Ls)||void 0;s&&Ui(this.Ls,s)===r&&(this.qs=r,this.js=s)}catch(t){}else try{var n=Si.Pr(this.Ls)||void 0;this.qs=n?Ui(this.Ls,n):void 0,this.js=n}catch(t){}}syncCookieProperties(){return this.Bs(this.qi)}Bs(t,e){if(void 0===e&&(e=!1),this.Hs&&!e||this.Ps||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=Si.Pr(this.Ls)||void 0}catch(t){}if(!i||i===this.js)return!1;var r,s=Ui(this.Ls,i);try{r=Ci(JSON.parse(i))}catch(t){return!1}if((Si.Pr(this.Ls)||void 0)!==i)return!1;this.qs=s,this.js=i;var n=Ni(this.Ls,i),o=[...Pi,...n.properties],a={};if(Object.keys(r).forEach((t=>{var e=r[t];(L(e)||q(e)||""===e||t===Fe&&e!==Qe&&e!==Ze)&&(a[t]=!0,delete r[t])})),F(r))return!1;var h=ge in r||r[Fe]===Qe||r[Fe]===Ze,l=this.props[ge],u=this.props[Fe],d=li({},this.props);[...Pi,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(h||t!==ge&&t!==Fe)){var e=d[t];!n.isValid&&-1!==Pi.indexOf(t)&&(!1===e||0===e)||delete d[t]}})),this.props=li(d,r),!h||Fe in r||Fe in this.props||this.Us(Fe,Qe);var v=this.props[ge],c=this.props[Fe];return!h||v===l&&c===u||(this.Rs=!0,ji.Dr(yr(this.Ls),!0),this.zs(Ce),this.zs(Re),this.zs(Te),this.zs(ke),this.zs(Pe),this.zs(Oe),this.zs(Be),this.zs(Ue),this.zs(Ne),c===Qe&&(u===Ze||r[Fe]===Qe||!L(l)&&v!==l)&&($r(this.props,r),this.zs(Me)),c===Ze?this.props.$user_id=v:delete this.props.$user_id,this.zs(ye)),!0}consumeCookieIdentityChange(){var t=yr(this.Ls),e=this.Rs||!!ji.Pr(t);return this.Rs=!1,e&&ji.qr(t),e}Ws(t){return void 0===t&&(t=!1),!(this.Ps||this.Hs&&!t||!this.qi.cookieWinsOnConflict||"localstorage+cookie"!==this.qi.persistence.toLowerCase()||(this.Ps=!0,0))}Vs(){this.Ps&&(L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),delete this.Ms[br],this.Zs(!0))}Qs(t){if(void 0===t&&(t=!0),this.Ps)try{t?this.Vs():L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0)}finally{this.Ps=!1}}isDisabled(){return!!this.Hs}Os(e){-1===wr.indexOf(e.persistence.toLowerCase())&&(le.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=[...Pi,...e];return p({},Ri,{Br(t){try{var e,s={};try{e=Si.Pr(t)||void 0,s=e?Ci(JSON.parse(e)):{}}catch(t){}var n,o=JSON.parse(Ri.Pr(t)||"{}");if(i){var a=Ni(t,e),h=[...Pi,...a.properties],l={};Object.keys(s).forEach((t=>{var e=s[t];q(e)||""===e||t===Fe&&e!==Qe&&e!==Ze||(l[t]=e)}));var u=ge in l||l[Fe]===Qe||l[Fe]===Ze;if(Object.keys(l).length>0){var d,v=o[ge],c=null!==(d=o[Fe])&&void 0!==d?d:Qe;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(u||t!==ge&&t!==Fe)){var e=o[t];!a.isValid&&-1!==Pi.indexOf(t)&&(!1===e||0===e)||delete o[t]}})),!u||Fe in s||Fe in o||(o[Fe]=Qe),!u||(ge in l?l[ge]:o[ge])===v&&(Fe in l?l[Fe]:o[Fe])===c||(ki.forEach((t=>delete o[t])),l[Fe]===Ze&&ge in l?o.$user_id=l[ge]:delete o.$user_id,l[Fe]!==Ze&&(delete o[Ae],delete o[Me]),delete o.__alias)}n=li(o,l)}else n=li(s,o);return Ri.Dr(t,n),n}catch(t){}return null},Dr(t,r,s,n,o,a){var h=Ri.Dr(t,r,void 0,void 0,a);try{var l=Mi(r,e);if(Object.keys(l).length){if(i){var u=Oi(t),d=Di(l,e);if(Si.Dr(u,d,s,n,o,a),Si.Pr(u)!==JSON.stringify(d)){Si.qr(u,n);var v=Mi(r);return Si.Dr(t,v,s,n,o,a),h}}Si.Dr(t,l,s,n,o,a)}}catch(t){Ri.jr(t)}return h},qr(e,i){try{null==t||t.localStorage.removeItem(e),Si.qr(e,i),Si.qr(Oi(e),i)}catch(t){Ri.jr(t)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Ri.Nr()?(i=Ri,s=!0):"localstorage+cookie"===n&&r.Nr()?(i=r,s=!0):"sessionstorage"===n&&ji.Nr()?i=ji:"memory"===n?i=Fi:"cookie"===n?i=Si:r.Nr()?(i=r,s=!0):i=Si,this.Es=s,i}Js(t){return this.Ls+"__"+t}Ds(t){return this.Es&&!!t.split_storage}properties(){var t={};return hi(this.props,((e,i)=>{var r=Zi(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.Hs||t){var e=this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase(),i=e?Ri.Br(this.Ls):null,r={};if(e)try{hi(r=Ci(Si.Br(this.Ls)),((t,e)=>{(L(t)||q(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.ps.Br(this.Ls);if(s&&(this.props=li({},s)),this.Is&&this.Ks(),e&&s){var n,o,a=null==i?void 0:i[ge],h=null!==(n=null==i?void 0:i[Fe])&&void 0!==n?n:Qe,l=s[ge],u=null!==(o=s[Fe])&&void 0!==o?o:Qe;if(l!==a||u!==h){this.Rs=!0,ji.Dr(yr(this.Ls),!0);var d=li({},this.props);ki.forEach((t=>delete d[t])),u===Qe&&(h===Ze||r[Fe]===Qe||!L(a)&&l!==a)&&($r(d,r),delete d[Me]),this.props=d;var v=new Set;ki.forEach((t=>{var e,i=null==(e=Zi(t))?void 0:e.storageGroup;i&&v.add(i)})),v.forEach((t=>{var e={};hi(this.props,((i,r)=>{var s;(null==(s=Zi(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),F(e)?(Ri.qr(this.Js(t)),this.Ms[t]={}):Ri.Dr(this.Js(t),e)&&(this.Ms[t]={persisted:!0,fingerprint:this.Ys(e,t)})}))}}ji.Pr(yr(this.Ls))&&(this.Rs=!0)}}Ks(){for(var t of Ki){var e=Ri.Br(this.Js(t));if(e&&!F(e)){var i=this.Xs(t);i.persisted=!0,this.ta(t)||(i.fingerprint=this.Ys(e,t)),this.ea(t,e)||li(this.props,e)}}}ta(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Zi(e))?void 0:i.storageGroup)===t}))}ea(t,e){var i=mr[t];if(!i)return!1;var r=e[i],s=this.props[i];return G(r)&&G(s)&&s>r}refreshKey(t){var e;if(!this.Hs){var i=this.Is?null==(e=Zi(t))?void 0:e.storageGroup:void 0,r=i?Ri.Br(this.Js(i)):this.ps.Br(this.Ls);if(r&&t in r)this.Us(t,r[t]);else{if(i){var s=this.ps.Br(this.Ls);if(s&&t in s)return void this.Us(t,s[t])}this.zs(t)}}}save(){if(!this.Hs){var t=this.$s();t>0?L(this.Gs)&&(this.Gs=setTimeout((()=>{this.Gs=void 0,this.Zs()}),t)):this.Zs()}}flush(){L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0,this.Zs())}Zs(t){void 0===t&&(t=!1),this.Hs||this.Ps&&!t||(t||this.syncCookieProperties(),this.Is?this.ia():this.ra(this.ps,this.Ls,this.props,br)&&this.Ns(this.props))}ia(){var t=this.na(),e=t.main,i=t.groups;for(var r of(this.ra(this.ps,this.Ls,e,br)&&this.Ns(e),Ki)){var s,n=i[r];(!F(n)||null!=(s=this.Ms[r])&&s.persisted)&&this.ra(Ri,this.Js(r),n,r)}}na(){var t={},e={flags:{},surveys:{}};return hi(this.props,((i,r)=>{var s,n=null==(s=Zi(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ys(t,e){if(e===br)return JSON.stringify(t)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var i={};return hi(t,((t,e)=>{var r;i[e]=null!=(r=Zi(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}ra(t,e,i,r){var s,n=this.Xs(r);if(r!==br&&!n.dirty&&!L(n.fingerprint))return!1;try{if((s=this.Ys(i,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Dr(e,i,this.sa,this.aa,this.oa,this.qi.debug)?(n.dirty=!1,r!==br&&(n.persisted=!0),L(s)||(n.fingerprint=s),!0):(this.qi.debug&&le.warn('failed to persist storage entry "'+e+'"; will retry on next save'),!1)}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(L(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),this.ps.qr(this.Ls,!1),this.ps.qr(this.Ls,!0),!i&&this.As)for(var r of Ki)Ri.qr(this.Js(r));i?delete this.Ms[br]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(B(t)){this.syncCookieProperties(),L(e)&&(e="None"),this.sa=L(i)?this.la:i;var r=!1;if(hi(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Us(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(B(t)){this.syncCookieProperties(),this.sa=L(e)?this.la:e;var i=!1;if(hi(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||B(e)||N(e))&&(this.Us(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.zs(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this.Fs){var e=function(t,e,i){if(!r)return{};var s,n=e?[...nr,...i||[]]:[],o=lr(rr(r.URL,n,ar),t),a=(s={},hi(hr,(function(t){var e=pi(t);s[t]=e||null})),s);return li(a,o)}(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);F(di(e))||this.register(e),this.Fs=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?ur(t):{})}update_referrer_info(){var t;this.register_once({$referrer:cr(),$referring_domain:null!=r&&r.referrer&&(null==(t=er(r.referrer))?void 0:t.host)||vr},void 0)}set_initial_person_info(){this.props[ze]||this.props[qe]||this.register_once({[He]:_r(this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties,this.qi.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};hi([qe,ze],(e=>{var i=this.props[e];i&&hi(i,(function(e,i){t["$initial_"+C(i)]=e}))}));var e=this.props[He];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=pr(t,e),r={};return hi(i,(function(t,e){r["$initial_"+C(e)]=t})),r}(e,this.qi.disable_capture_url_hashes);li(t,i)}return t}safe_merge(t){return hi(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){var r=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),n=r||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,h=!!this.Hs&&!a;a||this.Bs(e,h),this.qi=t,!a&&(r||s||o)&&(this.qs=void 0,this.js=void 0,this.Bs(p({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),h));var l=n||o?this.Os(t):this.ps,u=this.Ds(t),d=n||u!==this.Is,v=!a&&(d||t.cross_subdomain_cookie!==this.aa||t.secure_cookie!==this.oa)&&this.Ws(h);try{if(this.la=this.sa=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.ps=l,this.Is=u,this.props=c,this.save()}else o&&(this.ps=l,a||(delete this.Ms[br],this.Zs()))}finally{v&&this.Qs()}}set_disabled(t){this.Hs=t,this.Hs?this.remove():this.save()}set_cross_subdomain(t){t!==this.aa&&(this.aa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.oa&&(this.oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[be]||{};i[t]=e,this.Us(be,i),this.save()}remove_event_timer(t){var e=this.props[be]||{},i=e[t];return L(i)||(delete e[t],this.Us(be,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Us(t,e),this.save()}Us(t,e){var i;this.props[t]=e,null!=(i=Zi(t))&&i.volatile||this.ua(t)}zs(t){delete this.props[t],this.ua(t)}ua(t){var e,i=null==(e=Zi(t))?void 0:e.storageGroup;i&&(this.Xs(i).dirty=!0)}Xs(t){return this.Ms[t]||(this.Ms[t]={})}}function Er(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&U(i.then)&&i.then(void 0,(()=>{}))}}}}var Sr={GZipJS:"gzip-js",Base64:"base64"},Tr={Activation:"events",Cancellation:"cancelEvents"},Rr={Button:"button",Tab:"tab",Selector:"selector"},kr={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"},Pr={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Or={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Ir={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Cr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Mr={Once:"once",Recurring:"recurring",Always:"always"},Ar={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Dr={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"},Nr={Popover:"popover",Inline:"inline"},Ur={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},Br={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"},Fr={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"},Lr=ue("[RateLimiter]");class jr{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{Lr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Lr.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(je))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var h=1>a.tokens;if(h||t||(a.tokens=Math.max(0,a.tokens-1)),h&&!t){var l=(G(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.ha(l)&&(a.dropped=0)}return this.lastEventRateLimited=h,null==(r=this.instance.persistence)||r.set_property(je,a),{isRateLimited:h,remainingTokens:a.tokens}}da(t){var e=this.instance.config.property_denylist;return!N(e)||!e.includes(t)}va(){var t;if(this.da("$current_url")&&this.da("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}ha(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.va(),o=this.da("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var zr=ue("[RemoteConfig]");class qr{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=d._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ca(t){var e,i;null!=(e=d.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}fa(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return zr.info("Using preloaded remote config",this.remoteConfig),this.pa(this.remoteConfig),void this.ga();if(this._instance._shouldDisableFlags())return void zr.warn("Remote config is disabled. Falling back to local config.");this.ca((t=>{if(!t)return zr.info("No config found after loading remote JS config. Falling back to JSON."),void this.fa((t=>{this.pa(t.json,t),this.ga()}));this.pa(t),this.ga()}))}catch(t){zr.error("Error loading remote config",t),this.pa()}}stop(){this.ya&&(clearInterval(this.ya),this.ya=void 0)}refresh(){!this._instance._shouldDisableFlags()&&r&&"hidden"!==r.visibilityState&&this._instance.reloadFeatureFlags()}ga(){var t;if(!this.ya){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.ya=setInterval((()=>{this.refresh()}),e))}}pa(t,e){!t&&e&&(0===e.statusCode?e.error||zr.warn("Failed to fetch remote config from PostHog."):zr.error("Failed to fetch remote config from PostHog."));try{this._instance.pa(t?{ok:!0,config:t}:{ok:!1})}catch(t){zr.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){zr.error("Error loading feature flags",t)}}}var Hr=["fatal","error","warning","log","info","debug"],Gr=Uint8Array,Wr=Uint16Array,Vr=Uint32Array,Yr=new Gr([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]),Jr=new Gr([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]),Kr=new Gr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xr=function(t,e){for(var i=new Wr(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Vr(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Qr=Xr(Yr,2),Zr=Qr[1];Qr[0][28]=258,Zr[258]=28;for(var ts=Xr(Jr,0)[1],es=new Wr(32768),is=0;32768>is;++is){var rs=(43690&is)>>>1|(21845&is)<<1;es[is]=((65280&(rs=(61680&(rs=(52428&rs)>>>2|(13107&rs)<<2))>>>4|(3855&rs)<<4))>>>8|(255&rs)<<8)>>>1}var ss=function(t,e,i){for(var r=t.length,s=0,n=new Wr(e);r>s;++s)++n[t[s]-1];var o,a=new Wr(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Wr(1<<e);var h=15-e;for(s=0;r>s;++s)if(t[s])for(var l=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[es[d]>>>h]=l}else for(o=new Wr(r),s=0;r>s;++s)o[s]=es[a[t[s]-1]++]>>>15-t[s];return o},ns=new Gr(288);for(is=0;144>is;++is)ns[is]=8;for(is=144;256>is;++is)ns[is]=9;for(is=256;280>is;++is)ns[is]=7;for(is=280;288>is;++is)ns[is]=8;var os=new Gr(32);for(is=0;32>is;++is)os[is]=5;var as=ss(ns,9,0),hs=ss(os,5,0),ls=function(t){return(t/8>>0)+(7&t&&1)},us=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Wr?Wr:t instanceof Vr?Vr:Gr)(i-e);return r.set(t.subarray(e,i)),r},ds=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},vs=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},cs=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Gr(0),0];if(1==s){var o=new Gr(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],h=i[1],l=0,u=1,d=2;for(i[0]={s:-1,f:a.f+h.f,l:a,r:h};u!=s-1;)a=i[i[d].f>i[l].f?l++:d++],h=i[l!=u&&i[d].f>i[l].f?l++:d++],i[u++]={s:-1,f:a.f+h.f,l:a,r:h};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Wr(v+1),_=_s(i[u-1],c,0);if(_>e){r=0;var p=0,f=_-e,g=1<<f;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<_-c[m]),c[m]=e}for(p>>>=f;p>0;){var w=n[r].s;e>c[w]?p-=1<<e-c[w]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}_=e}return[new Gr(c),_]},_s=function(t,e,i){return-1==t.s?Math.max(_s(t.l,e,i+1),_s(t.r,e,i+1)):e[t.s]=i},ps=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Wr(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&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(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},fs=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},gs=function(t,e,i){var r=i.length,s=ls(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},ms=function(t,e,i,r,s,n,o,a,h,l,u){ds(e,u++,i),++s[256];for(var d=cs(s,15),v=d[0],c=d[1],_=cs(n,15),p=_[0],f=_[1],g=ps(v),m=g[0],w=g[1],y=ps(p),b=y[0],x=y[1],E=new Wr(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;b.length>S;++S)E[31&b[S]]++;for(var T=cs(E,7),R=T[0],k=T[1],P=19;P>4&&!R[Kr[P-1]];--P);var O,I,C,M,A=l+5<<3,D=fs(s,ns)+fs(n,os)+o,N=fs(s,v)+fs(n,p)+o+14+3*P+fs(E,R)+(2*E[16]+3*E[17]+7*E[18]);if(D>=A&&N>=A)return gs(e,u,t.subarray(h,h+l));if(ds(e,u,1+(D>N)),u+=2,D>N){O=ss(v,c,0),I=v,C=ss(p,f,0),M=p;var U=ss(R,k,0);for(ds(e,u,w-257),ds(e,u+5,x-1),ds(e,u+10,P-4),u+=14,S=0;P>S;++S)ds(e,u+3*S,R[Kr[S]]);u+=3*P;for(var B=[m,b],F=0;2>F;++F){var L=B[F];for(S=0;L.length>S;++S)ds(e,u,U[j=31&L[S]]),u+=R[j],j>15&&(ds(e,u,L[S]>>>5&127),u+=L[S]>>>12)}}else O=as,I=ns,C=hs,M=os;for(S=0;a>S;++S)if(r[S]>255){var j;vs(e,u,O[257+(j=r[S]>>>18&31)]),u+=I[j+257],j>7&&(ds(e,u,r[S]>>>23&31),u+=Yr[j]);var z=31&r[S];vs(e,u,C[z]),u+=M[z],z>3&&(vs(e,u,r[S]>>>5&8191),u+=Jr[z])}else vs(e,u,O[r[S]]),u+=I[r[S]];return vs(e,u,O[256]),u+I[256]},ws=new Vr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ys=function(){for(var t=new Vr(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),bs=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function $s(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=ys[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,h,l=(a=10+((s=e).filename&&s.filename.length+1||0),h=8,function(t,e,i,r,s,n){var o=t.length,a=new Gr(r+o+5*(1+Math.floor(o/7e3))+s),h=a.subarray(r,a.length-s),l=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?l=gs(h,l,t.subarray(u,d)):(h[u]=!0,l=gs(h,l,t.subarray(u,o)))}else{for(var v=ws[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new Wr(32768),g=new Wr(p+1),m=Math.ceil(i/3),w=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<w)&p},b=new Vr(25e3),x=new Wr(288),E=new Wr(32),S=0,T=0,R=(u=0,0),k=0,P=0;o>u;++u){var O=y(u),I=32767&u,C=g[O];if(f[I]=C,g[O]=I,u>=k){var M=o-u;if((S>7e3||R>24576)&&M>423){l=ms(t,h,0,b,x,E,T,R,P,u-P,l),R=S=T=0,P=u;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)E[A]=0}var D=2,N=0,U=_,B=I-C&32767;if(M>2&&O==y(u-B))for(var F=Math.min(c,M)-1,L=Math.min(32767,u),j=Math.min(258,M);L>=B&&--U&&I!=C;){if(t[u+D]==t[u+D-B]){for(var z=0;j>z&&t[u+z]==t[u+z-B];++z);if(z>D){if(D=z,N=B,z>F)break;var q=Math.min(B,z-2),H=0;for(A=0;q>A;++A){var G=u-B+A+32768&32767,W=G-f[G]+32768&32767;W>H&&(H=W,C=G)}}}B+=(I=C)-(C=f[I])+32768&32767}if(N){b[R++]=268435456|Zr[D]<<18|ts[N];var V=31&Zr[D],Y=31&ts[N];T+=Yr[V]+Jr[Y],++x[257+V],++E[Y],k=u+D,++S}else b[R++]=t[u],++x[t[u]]}}l=ms(t,h,!0,b,x,E,T,R,P,u-P,l)}return us(a,0,r+ls(l)+s)}(n=t,null==(o=e).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,h)),u=l.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&bs(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(l,e),bs(l,u-8,i.d()),bs(l,u-4,r),l}var xs=!!o||!!n,Es="text/plain",Ss=!1,Ts=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Rs=function(t,e,i){var r;void 0===i&&(i=!0);var s=t.split("?"),n=s[0],o=s[1],a=p({},e),h=null!==(r=null==o?void 0:o.split("&").map((t=>{var e,r=t.split("="),s=r[0],n=i&&null!==(e=a[s])&&void 0!==e?e:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],l=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return hi(t,(function(t,e){L(t)||L(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(a);return l&&h.push(l),h.length>0?n+"?"+h.join("&"):n},ks=t=>{if(t.ba)return t.ba;var e=t.data,i=t.compression;if(e){if(i===Sr.GZipJS){var r=$s(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Gr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new Gr(s+8+(i-o<<1));a.set(r),r=a}var h=t.charCodeAt(o);128>h?n(h):2048>h?(n(192|h>>>6),n(128|63&h)):h>55295&&57344>h?(n(240|(h=65536+(1047552&h)|1023&t.charCodeAt(++o))>>>18),n(128|h>>>12&63),n(128|h>>>6&63),n(128|63&h)):(n(224|h>>>12),n(128|h>>>6&63),n(128|63&h))}return us(r,0,s)}(tr(e)),{mtime:0});return{contentType:Es,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Sr.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(tr(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:tr(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=tr(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Ps=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:Rs(t.url,{compression:Sr.Base64}),encodedBody:ks(p({},t,{compression:Sr.Base64,ba:void 0}))}:{url:Ts(t.url,"compression"),encodedBody:ks(p({},t,{compression:void 0,ba:void 0}))};try{e=ks(t)}catch(e){if(E(t.compression,ir(t.url,"compression")))return le.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&E(t.compression,ir(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?x(new Uint8Array(i)):ArrayBuffer.isView(i)&&x(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Ss=!0,r()):{url:t.url,encodedBody:e}},Os=t=>{try{return Ps(t)}catch(e){return le.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Is=function(){var t=_((function*(t){var e=tr(t.data),i=yield function(t,e,i){return k.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{ba:{contentType:Es,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Cs=/Failed to fetch|NetworkError|Load failed/i,Ms=t=>"TypeError"===(null==t?void 0:t.name)&&Cs.test((null==t?void 0:t.message)||""),As=t=>{var e=Os(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,h=s.body,l=s.estimatedSize,u=new Headers;hi(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var e,i;v=!0,c.abort((e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",i))}),t.timeout)}}var _=e=>{v&&"AbortError"===(null==e?void 0:e.name)||Ms(e)?le.warn(e):le.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;n(i,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t._a&&52428.8>(l||0),body:h,signal:null==(f=d)?void 0:f.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){le.error(t)}null==t.callback||t.callback(r)})))).catch(_).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),_(t)}}},Ds=t=>{try{var e,r=Ps(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,h=o.estimatedSize;if(!a)return;var l=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(i.sendBeacon(s,l))return;var u=N(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(N(u)&&u.length>1&&(null!=h?h:0)>16384){var d=Math.ceil(u.length/2),v=e=>N(t.data)?e:p({},t.data,{batch:e});return Ds(p({},t,{data:v(u.slice(0,d))})),void Ds(p({},t,{data:v(u.slice(d))}))}le.warn("Beacon of ~"+(null!=h?h:0)+" bytes was rejected by the browser, falling back to fetch"),As(p({},t,{_a:!0}))}catch(t){le.warn("Beacon send failed",t)}},Ns=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return Rs(i===Sr.GZipJS?Ts(t,"compression"):t,p({},s?{[s]:Date.now().toString()}:{},i===Sr.GZipJS?{}:{compression:i}))},Us=[];n&&Us.push({transport:"fetch",method:As}),o&&Us.push({transport:"XHR",method(t){var e=Os(t);if(e){var i=new o,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;hi(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(a)}}}),null!=i&&i.sendBeacon&&Us.push({transport:"sendBeacon",method:Ds});var Bs=3e3;class Fs{constructor(t,e){this.wa=!0,this.ka=[],this.Sa=tt((null==e?void 0:e.flush_interval_ms)||Bs,250,5e3,le.createLogger("flush interval"),Bs),this.xa=t}enqueue(t){this.ka.push(t),this.Ca||this.Ta()}unload(){this.Ma();var t=this.ka.length>0?this.Ea():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ia(p({},t,{transport:"sendBeacon"}))}))}enable(){this.wa=!1,this.Ta()}Ta(){var t=this;this.wa||(this.Ca=setTimeout((()=>{if(this.Ma(),this.ka.length>0){var e=this.Ea(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&N(i.data)&&hi(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ia(i)};for(var r in e)i()}}),this.Sa))}Ia(t){try{this.xa(t)}catch(t){le.error(t)}}Ma(){clearTimeout(this.Ca),this.Ca=void 0}Ea(){var t={};return hi(this.ka,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;L(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.ka=[],t}}var Ls=["retriesPerformedSoFar"];class js{constructor(e){this.Ra=!1,this.Pa=3e3,this.ka=[],this._instance=e,this.ka=[],this.Aa=!0,!L(t)&&"onLine"in t.navigator&&(this.Aa=t.navigator.onLine,this.Fa=()=>{this.Aa=!0,this.La()},this.Oa=()=>{this.Aa=!1},_i(t,"online",this.Fa),_i(t,"offline",this.Oa))}get length(){return this.ka.length}retriableRequest(t){var e=t.retriesPerformedSoFar,i=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,Ls);W(e)&&(i.url=Rs(i.url,{retry_count:e})),this._instance._send_request(p({},i,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.xn(p({retriesPerformedSoFar:e},i));0===t.statusCode&&le.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!=e?e:0)+" retries.")}null==i.callback||i.callback(t)}}))}xn(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.ka.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),le.warn(s),this.Ra||(this.Ra=!0,this.Da())}Da(){if(this.$a&&clearTimeout(this.$a),0===this.ka.length)return this.Ra=!1,void(this.$a=void 0);this.$a=setTimeout((()=>{this.Aa&&this.ka.length>0&&this.La(),this.Da()}),this.Pa)}La(){var t=Date.now(),e=[],i=this.ka.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.ka=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.$a&&(clearTimeout(this.$a),this.$a=void 0),this.Ra=!1,L(t)||(this.Fa&&(t.removeEventListener("online",this.Fa),this.Fa=void 0),this.Oa&&(t.removeEventListener("offline",this.Oa),this.Oa=void 0)),this.ka)){var i=e.requestOptions;try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){le.error(t)}}this.ka=[]}}class zs{constructor(t){this.Na=()=>{var t,e,i,r;this.qa||(this.qa={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),h=(null==s?void 0:s.scrollHeight)||0;this.qa.lastScrollY=Math.ceil(n),this.qa.maxScrollY=Math.max(n,null!==(t=this.qa.maxScrollY)&&void 0!==t?t:0),this.qa.maxScrollHeight=Math.max(o,null!==(e=this.qa.maxScrollHeight)&&void 0!==e?e:0),this.qa.lastContentY=a,this.qa.maxContentY=Math.max(a,null!==(i=this.qa.maxContentY)&&void 0!==i?i:0),this.qa.maxContentHeight=Math.max(h,null!==(r=this.qa.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get ja(){return this._instance.config.scroll_root_selector}getContext(){return this.qa}resetContext(){var t=this.qa;return setTimeout(this.Na,0),t}startMeasuringScrollPosition(){_i(t,"scroll",this.Na,{capture:!0}),_i(t,"scrollend",this.Na,{capture:!0}),_i(t,"resize",this.Na)}scrollElement(){if(!this.ja)return null==t?void 0:t.document.documentElement;var e=N(this.ja)?this.ja:[this.ja];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}Ba(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.ja){var r=this.scrollElement();return r&&r[i]||0}return t?"y"===e?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.Ba("y")}scrollX(){return this.Ba("x")}}var qs=t=>_r(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class Hs{constructor(t,e,i,r){this.ot=t=>{var e=this.Ha();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Ua(this._instance)};this.za.register({[Le]:i})}},this._instance=t,this.Wa=e,this.za=i,this.Ua=r||qs,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[Le]}getSetOnceProps(){var t,e=null==(t=this.Ha())?void 0:t.props;return e?"r"in e?pr(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return hi(di(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+C(i)]=e})),t}}class Gs{on(t,e){return this.Va[t]||(this.Va[t]=[]),this.Va[t].push(e),()=>{this.Va[t]=this.Va[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Va[t]||[])i(e);for(var r of this.Va["*"]||[])r(t,e)}constructor(){this.Va={}}}var Ws=ue("[SessionId]"),Vs=864e5;class Ys{on(t,e){return this.Ga.on(t,e)}constructor(t,e,i){var r;if(this.Za=null,this.Qa=null,this.Ja=[],this.Ka=void 0,this.Ya=!1,this.Ga=new Gs,this.Xa=(t,e)=>!(!W(t)||!W(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Xe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qi=t.config,this.za=t.persistence,this.st=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.eo=void 0,this._sessionActivityTimestamp=null,this.io=e||bi,this.ro=i||bi;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*tt(this.qi.session_idle_timeout_seconds||1800,60,36e3,Ws.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.no(),this.so="ph_"+s+"_window_id",this.ao="ph_"+s+"_primary_window_exists",this.oo()){var n=ji.Br(this.so),o=ji.Br(this.ao);n&&!o?this.st=n:ji.qr(this.so),ji.Dr(this.ao,!0)}null!=(r=this.qi.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.qi.bootstrap.sessionID),this.lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return L(this.Ja)&&(this.Ja=[]),this.Ja.push(t),this._e&&t(this._e,this.st),()=>{this.Ja=this.Ja.filter((e=>e!==t))}}oo(){return"memory"!==this.qi.persistence&&!this.za.Hs&&ji.Nr()}uo(t){t!==this.st&&(this.st=t,this.oo()&&ji.Dr(this.so,t))}ho(){return this.st?this.st:this.oo()?ji.Br(this.so):null}do(t){var e=this.Za;return!q(e)&&!q(t)&&5e3>Math.abs(t-e)}vo(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this._e||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this._e=t,s&&!r||s&&this.do(e)||(this.Za=e,this.za.register({[Ee]:[e,t,i]}))}co(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return W(e)&&e>0}fo(){this.co()?this.za.refreshKey(Ee):(this.za.flush(),this.za.load())}po(){var t;if(!q(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Za){this.fo();var e=this.mo();e[1]===this._e&&e[2]===this._sessionStartTimestamp&&(this.Za=this._sessionActivityTimestamp,this.za.register({[Ee]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var t=this.mo()[0],e=W(t)?t:0,i=W(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}bo(t){return this.fo(),this.Xa(t,this.yo())}mo(){var t=this.za.props[Ee];return N(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Za=null,this.eo=void 0,clearTimeout(this._o),this._o=void 0,this.vo(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void Ws.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Ws.error("Invalid sessionID in bootstrap",t)}}(t);return!L(i)&&(e?this.eo={sessionId:t,sessionStartTimestamp:i}:this.vo(t,(new Date).getTime(),i),!0)}destroy(){this.Ya=!0,this.po(),clearTimeout(this._o),this._o=void 0,this.Ka&&t&&(t.removeEventListener(ii,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&ji.qr(this.ao)},_i(t,ii,this.Ka,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.qi.cookieless_mode===Xe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this._e;if(i)this.Qa=r;else if(q(this.Qa)||this.Qa>r||r-this.Qa>=1e3){var n,o;null==(n=(o=this.za).syncCookieProperties)||n.call(o),this.Qa=r}var a=this.mo(),h=a[1],l=a[2],u=!L(s)&&h!==s,d=this.yo(),v=this.ho(),c=this.eo,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Vs),p=c?_:W(l)&&Math.abs(r-l)>Vs,f=!1,g=u,m=!h||!!c,w=h,y=!m&&!t&&this.Xa(r,d);if(y){(y=this.bo(r))||Ws.info("cross-tab refresh kept the session alive",{sessionId:h});var b=this.mo();h=b[1],l=b[2]}if(m||y||p){g=!1;var x=c&&!_;h=x?c.sessionId:this.io(),v=this.ro(),Ws.info("new session ID assigned",{sessionId:h,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),l=x?c.sessionStartTimestamp:r,this.eo=void 0,f=!0}else v||(v=this.ro(),f=!0),(g=g||h!==w)&&(Ws.info("adopted cross-tab session id",{sessionId:h,windowId:v}),f=!0);var E=W(d)&&t&&!p?d:r,S=W(l)?l:(new Date).getTime();this.uo(v),this.vo(h,E,S),t||this.no();var T={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.Ja.forEach((t=>t(h,v,T))),{sessionId:h,windowId:v,sessionStartTimestamp:S,changeReason:f?T:void 0,lastActivityTimestamp:d}}no(){this.Ya||(clearTimeout(this._o),this._o=setTimeout((()=>{if(!this.Ya)if(this.bo((new Date).getTime())){var t=this._e;this.resetSessionId(),this.Ga.emit("forcedIdleReset",{idleSessionId:t})}else this.no()}),1.1*this.sessionTimeoutMs))}}function Js(){return(Js=_((function*(){var t=null==i?void 0:i.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=null==e?void 0:e.model;return j(r)&&r.length>0?r:void 0}catch(t){return void le.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ks(t,e,i){return tr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Xs="custom",Qs="i.posthog.com",Zs=/^\/static\//,tn=["/s/","/e/","/i/"];class en{constructor(t){this.wo={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Qs,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.wo[this.apiHost]||(this.wo[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":Xs),this.wo[this.apiHost]}ko(t){if(Zs.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}So(t){var e=er(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}xo(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=er(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&tn.some((t=>0===e.indexOf(t)))){var a=this.So(r);if(a){var h,l=this.apiHost,u=this.Co;(null==(h=u)?void 0:h.apiHost)===l&&u.rewriteRequestPath===s||(u={apiHost:l,rewriteRequestPath:s,urls:new Set},this.Co=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Co,i=this.So(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.xo(t,e,this.uiHost+e);if("flags"===t)return this.xo(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.ko(e);if(i)return this.xo(t,e,""+i+e)}if(this.region===Xs)return this.xo(t,e,this.apiHost+e);var r=Qs+e;switch(t){case"assets":return this.xo(t,e,"https://"+this.region+"-assets."+r);case"api":return this.xo(t,e,"https://"+this.region+"."+r)}}}var rn=ue("[Surveys]"),sn={ignoreConditions:!1,ignoreDelay:!1,displayType:Nr.Popover},nn=ue("[PostHog ExternalIntegrations]"),on={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class an{constructor(t){this._instance=t}_s(t,e){var i;null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return nn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=d.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t._s(on[n],(()=>{var e;null==(e=d.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=d.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=d.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class hn{constructor(t,e){this.I=t,this.ns=e,this.To=new Map,this.Xn=!1}add(t){var e=this;return _((function*(){if(e.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.To.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.To.set(t.name,t);try{var i=t.setup(e.ns);i&&(yield i)}catch(i){var r=e.To.get(t.name)===t;r&&e.To.delete(t.name),e.I.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.Mo(t)}}))()}dispose(){if(!this.Xn){this.Xn=!0;var t=Array.from(this.To.values()).reverse();for(var e of(this.To.clear(),t))this.Mo(e)}}Mo(t){try{var e=null==t.dispose?void 0:t.dispose();e&&U(e.then)&&e.then(void 0,(e=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class ln{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);L(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var un="extensionsRemoteConfig";class dn{constructor(t){this.Xn=!1,this.instance=t,this.I=le,this.Eo=t.Io,this.kv=new ln(t),this.onEvent=t=>Er(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Xn)return Er((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.Ro.on(un,e);return this.Eo&&e(this.Eo),Er(i)},this.Po=new hn(le.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(me))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(me);return"string"==typeof t?t:void 0}get library(){return{name:v.LIB_NAME,version:v.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.Po.add(t)}capture(t,e,i){var r=this;return _((function*(){i?r.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return Er(this.instance.Ao(t))}handleRemoteConfig(t){this.Xn||(this.Eo=t,this.instance.Ro.emit(un,t))}sendRequest(t,e){var i=this;return _((function*(){var r;void 0===e&&(e={});var s=i.instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",t),n={method:e.method,url:e.query?Rs(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.Xn||(this.Xn=!0,this.Po.dispose())}}var vn,cn={},_n=0,pn=()=>{},fn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',gn="Surveys module not available",mn="sanitize_properties is deprecated. Use before_send instead",wn="Invalid value for property_denylist config: ",yn=["token","distinct_id",Ve],bn="posthog",$n=!xs&&-1===(null==l?void 0:l.indexOf("MSIE"))&&-1===(null==l?void 0:l.indexOf("Mozilla")),xn=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ci(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:pn,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:s&&j(null==s?void 0:s.search)&&-1!==s.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,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.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(t){le.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ti,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Bs},error_tracking:{},_onCapture:pn},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:qi,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:t&&t>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},En=[["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"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],Sn=t=>{var e={};for(var i of En){var r=i[0],s=i[1];L(t[r])||(e[s]=t[r])}var n=li({},e,t),o=t.__preview_external_dependency_versioned_paths;return L(o)||(L(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),j(o)&&L(t.asset_host)&&(n.asset_host=o)),N(t.property_blacklist)&&(L(t.property_denylist)?n.property_denylist=t.property_blacklist:N(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:le.error(wn+t.property_denylist)),n};class Tn{constructor(){this.__forceAllowLocalhost=!1}get Fo(){return this.__forceAllowLocalhost}set Fo(t){le.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Rn{Lo(t,e){if(t){var i=this.To.indexOf(t);-1!==i&&this.To.splice(i,1)}return this.To.push(e),null==e.initialize||e.initialize(),e}Oo(){return this.config.cookieless_mode===Xe||this.config.cookieless_mode===Ke&&this.consent.isRejected()}Do(){if(!this.Oo()&&this.get_distinct_id()===We){var t=this.persistence;if(t){this.$o()||t.load(!0);var e=this.get_distinct_id();if(!e||e===We){var i=this.config.get_device_id(bi());this.register({distinct_id:i,$device_id:i}),t.set_property(Fe,Qe)}this.No()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Tn,this.qo=!1,this.version=v.LIB_VERSION,this.jo=new Set,this.Bo="",this.Ro=new Gs,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xn(),this.SentryIntegration=Yi,this.sentryIntegration=t=>function(t,e){var i=Vi(t,e);return{name:Wi,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Uo=!1,this.zo=null,this.Wo=null,this.Vo=null,this.scrollManager=new zs(this),this.pageViewManager=new Ji(this),this.rateLimiter=new jr(this),this.requestRouter=new en(this),this.consent=new zi(this),this.externalIntegrations=new an(this);var e=null!==(t=Rn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=j(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=j(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>le.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==bn){var r,s=null!==(r=cn[i])&&void 0!==r?r:new Rn;return s._init(t,e,i),cn[i]=s,cn[bn][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o,a=j(e)?e.trim():"";if(!a)return le.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 a!==(null==(o=this.config)?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=xn(i.defaults),i.debug=this.Go(i.debug),this.Zo=i,this.Qo=[],i.person_profiles?this.Wo=i.person_profiles:i.process_person&&(this.Wo=i.process_person);var h=xn(i.defaults),l=Sn(i),u=li({},h,l,{name:r,token:a});B(h.rageclick)&&B(l.rageclick)&&(u.rageclick=li({},h.rageclick,l.rageclick)),B(h.session_recording)&&B(l.session_recording)&&(u.session_recording=li({},h.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&le.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Sr.GZipJS;var d=this.$o();if(this.persistence=new xr(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(p({},this.config,{persistence:"sessionStorage"}),d,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&ji.Nr()){var c=ji.Br(this.Bo);N(c)&&c.forEach((t=>{j(t)&&this.jo.add(t)}))}else ji.qr(this.Bo);var _=p({},this.persistence.props),f=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Jo=new Fs((t=>this.Ko(t)),this.config.request_queue_config),this.Yo=new js(this),this.__request_queue=[];var g=this.Oo();if(g||(this.sessionManager=new Ys(this),this.sessionPropsManager=new Hs(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Xo()}))),this.tl(),this.config.__preview_deferred_init_extensions?(le.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.el(g)}),0)):(le.info("Initializing extensions synchronously"),this.el(g)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&le.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:_,s:f}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var m=i.bootstrap.distinctID,w=this.get_distinct_id(),y=this.persistence.get_property(Fe);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==m&&y===Qe)this.identify(m);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==m&&y===Ze)le.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 b=this.config.get_device_id(bi()),x=i.bootstrap.isIdentifiedID?b:m;this.persistence.set_property(Fe,i.bootstrap.isIdentifiedID?Ze:Qe),this.register({distinct_id:m,$device_id:x})}}if(g)this.register_once({distinct_id:We,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(bi());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Fe,Qe)}return _i(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||bi();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Fe,Ze)),e()},s=i.user();"then"in s&&U(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Gi.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Gi.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Gi.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,ri),identify:t=>e(t,ni),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.il())):this.il(),U(this.config._onCapture)&&this.config._onCapture!==pn&&(le.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&le.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.config.disableDeviceModel||function(){return Js.apply(this,arguments)}().then((t=>{t&&this.register({[we]:t})})).catch(pn),this}rl(t){var e=t;return j(e.name)&&U(e.setup)}nl(t,e){this.rl(t)?e.push((()=>{this.sl().add(t).catch(pn)})):this.To.push(t)}tl(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=Rn.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.al)||r.call(this),this.al=void 0,this.featureFlags=new o(this)),U(this.featureFlags.onReloading)&&U(this.featureFlags.setup)?this.al||(this.al=this.featureFlags.onReloading((()=>{this.Ro.emit("featureFlagsReloading",!0)})),this.sl().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}el(t){var e,i,r,s,n,o,a,h=performance.now(),l=p({},Rn.__defaultExtensionClasses,this.config.__extensionClasses),u=[];l.exceptions&&this.To.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new l.exceptions(this)),l.historyAutocapture&&this.To.push(this.historyAutocapture=new l.historyAutocapture(this)),l.tracingHeaders&&this.To.push(this.tracingHeaders=new l.tracingHeaders(this)),l.siteApps&&this.To.push(this.siteApps=new l.siteApps(this)),l.sessionRecording&&!t&&this.To.push(this.sessionRecording=new l.sessionRecording(this)),this.config.disable_scroll_properties||u.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),l.autocapture&&this.nl(this.autocapture=new l.autocapture(this),u),l.surveys&&this.nl(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new l.surveys(this),u),l.logs&&this.To.push(this.logs=null!==(r=this.logs)&&void 0!==r?r:new l.logs(this)),l.metrics&&this.To.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new l.metrics(this)),l.conversations&&this.To.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new l.conversations(this)),l.productTours&&this.To.push(this.productTours=new l.productTours(this)),l.heatmaps&&this.To.push(this.heatmaps=new l.heatmaps(this)),l.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new l.webVitalsAutocapture(this)),l.exceptionObserver&&this.To.push(this.exceptionObserver=new l.exceptionObserver(this)),l.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new l.deadClicksAutocapture(this,Hi)),l.toolbar&&this.To.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new l.toolbar(this)),l.experiments&&this.To.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new l.experiments(this)),this.To.forEach((t=>{t.initialize&&u.push((()=>{null==t.initialize||t.initialize()}))})),u.push((()=>{if(this.ol){var t=this.ol;this.ol=void 0,this.To.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.ll(u,h)}ll(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.ll(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){le.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Ye]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Je]:r}),this.config.__preview_deferred_init_extensions&&le.info("PostHog extensions initialized ("+r+"ms)")}pa(t){var e;if(!r||!r.body)return le.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ol=t),this.Io=t,this.compression=void 0,t.ok){var i,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=I(s.supportedCompression,Sr.GZipJS)?Sr.GZipJS:I(s.supportedCompression,Sr.Base64)?Sr.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:ti}),null==(e=this.ul)||e.handleRemoteConfig(t),this.To.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}il(){try{this.config.loaded(this)}catch(t){le.critical("`loaded` function failed",t)}if(this.hl(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Oo())&&this.dl()}),1),this.vl=new qr(this),this.vl.load()}hl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Jo)||t.enable())}_dom_loaded(){this.is_capturing()&&ai(this.__request_queue,(t=>this.Ko(t))),this.__request_queue=[],this.hl()}_handle_unload(){var t,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.cl()&&this.capture(si),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Jo)||r.unload(),null==(s=this.Yo)||s.unload()):this.cl()&&this.capture(si,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?$n?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(L(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=p({},t);s.timeout=s.timeout||6e4;var n,o,a,l,u,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&L(s.compression)&&s.data&&(s.compression=Sr.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(u=(l=(N(n=s.data)?n:[n]).map((t=>p({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=u.properties)?void 0:a.token)&&void 0!==o?o:null==u?void 0:u.token,batch:l,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),N(t)?t.map((t=>p({},t,{sent_at:e}))):p({},t,{sent_at:e})}(s.data))),s.url=Ns(s.url,s.method,s.compression,s.timestampMode);var v=Us.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:r.method)&&void 0!==i?i:v[0].method;if(!c)throw new Error("No available transport method");var _=t=>{try{c(t)}catch(t){Ms(t)?le.warn(t):le.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===Sr.GZipJS&&h&&"undefined"!=typeof Promise&&!Ss?Is(s).then((t=>{_(t)})).catch((e=>{if(S(e))return Ss=!0,void _(p({},s,{compression:void 0,url:Ns(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return S(t)||e===b})(e)&&(Ss=!0),_(s)})):c(s)})(p({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Ko(t){this.Yo?this.Yo.retriableRequest(t):this._send_request(t)}_execute_array(t){_n++;try{var e,i=[],r=[],s=[];ai(t,(t=>{if(t)if(N(e=t[0]))s.push(t);else if(U(t))try{t.call(this)}catch(e){le.error("Error executing queued PostHog call",t,e)}else N(t)&&"alias"===e?i.push(t):N(t)&&-1!==e.indexOf("capture")&&U(this[e])?s.push(t):r.push(t)}));var n=function(t,e){ai(t,(function(t){try{if(N(t[0])){var i=e;hi(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){le.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{_n--}}push(t){if(_n>0&&N(t)&&j(t[0])){var e=Rn.prototype[t[0]];U(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jo){if(this.is_capturing())if(!L(t)&&j(t)){this.Do();var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var l=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==l||!l.isRateLimited){null!=e&&e.$current_url&&!j(null==e?void 0:e.$current_url)&&(le.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i._originatedFromCaptureException||le.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 u=new Date,d=(null==i?void 0:i.timestamp)||u,v=oe(null==i?void 0:i.uuid,bi),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===ri&&this.config.__preview_capture_bot_pageviews&&h&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),l&&(c.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);var _="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property(Ie);(null==i?void 0:i.$set)&&!_&&(c.$set=null==i?void 0:i.$set);var f=null==i?void 0:i.$unset;f&&(c.$unset=f);var m,w,y,b=_?void 0:this.pl(null==i?void 0:i.$set_once,t!==oi,t===ni);if(b&&(c.$set_once=b),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>j(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){if(e!==Object(e))return o?o(e):e;if(!a.has(e)){var r;if(a.add(e),N(e))r=[],ai(e,(e=>{r.push(t(e))}));else{var s={};hi(e,((e,i)=>{a.has(e)||(s[i]=t(e,i))})),r=s}return r}}(n)),c.timestamp=d,L(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=u),_&&(c.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return g.forEach(r),e.forEach(r),i}(c.properties,yn)),t===Ar.DISMISSED||t===Ar.SENT){var x=null==e?void 0:e[Dr.SURVEY_ID],E=null==e?void 0:e[Dr.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){rn.error("Failed to persist survey seen state",t)}})({id:x,current_iteration:E}),c.$set=p({},c.$set,{[(m={id:x,current_iteration:E},w=t===Ar.SENT?"responded":"dismissed",y="$survey_"+w+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(y="$survey_"+w+"/"+m.id+"/"+m.current_iteration),y)]:!0})}else t===Ar.SHOWN&&(c.$set=p({},c.$set,{[Dr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Br.SHOWN){var S=null==e?void 0:e[Fr.TOUR_TYPE];S&&(c.$set=p({},c.$set,{[Fr.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var T=p({},c.properties.$set,c.$set);if(F(T)||this.setPersonPropertiesForFlags(T),!H(this.config.before_send)){var R=this.kn(c);if(!R)return;(c=R).uuid=oe(c.uuid,bi)}this.Ro.emit("eventCaptured",c);var k=null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),P={method:"POST",url:k,data:c,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(k)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Ko(P):this.Jo.enqueue(P),c}le.critical("This capture call is ignored due to client rate limiting.")}}else le.error("No event name provided to posthog.capture")}else le.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}sl(){var t;return null!==(t=this.ul)&&void 0!==t?t:this.ul=new dn(this)}Ao(t){this.Ho.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.Ho.indexOf(t);-1!==i&&this.Ho.splice(i,1)}}}gl(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Vo=null,this.persistence.get_property(Fe)===Qe&&(null==(r=this.sessionPersistence)||r.clear(),this.jo.clear(),this.ml()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.gl();var h=a?void 0:this.persistence.remove_event_timer(e),u=p({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Oo()&&(u[Ve]=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!j(u.distinct_id)&&!G(u.distinct_id)||z(u.distinct_id))&&le.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var c,_=function(e,i,r,n){var o,a,h,u;if(void 0===n&&(n=!1),!l)return{};var d,c=e?[...nr,...i||[]]:[],_=function(t){for(var e=0;re.length>e;e++){var i=re[e],r=i[1],s=i[0].exec(t),n=s&&(U(r)?r(s,t):r);if(n)return n}return["",""]}(l),p=_[0],f=_[1],g=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};L(r)||(m.detectGoogleSearchApp=r);var w={},y=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,b=null==(a=navigator)?void 0:a.maxTouchPoints,x=null==t||null==(h=t.screen)?void 0:h.width,E=null==t||null==(u=t.screen)?void 0:u.height,S=null==t?void 0:t.devicePixelRatio;L(y)||(w.userAgentDataPlatform=y),L(b)||(w.maxTouchPoints=b),L(x)||(w.screenWidth=x),L(E)||(w.screenHeight=E),L(S)||(w.devicePixelRatio=S);var T,R,k,P,O,I,C,M,A=li(di({$os:p,$os_version:f,$browser:te(l,navigator.vendor,g,m),$device:se(l),$device_type:(R=l,k=w,M=se(R),M===ot||M===nt||"Kobo"===M||"Kindle Fire"===M||M===Nt?st:M===St||M===Rt||M===Tt||M===Mt?"Console":M===ht?"Wearable":M?et:"Android"===(null==k?void 0:k.userAgentDataPlatform)&&(null!==(P=null==k?void 0:k.maxTouchPoints)&&void 0!==P?P:0)>0?600>Math.min(null!==(O=null==k?void 0:k.screenWidth)&&void 0!==O?O:0,null!==(I=null==k?void 0:k.screenHeight)&&void 0!==I?I:0)/(null!==(C=null==k?void 0:k.devicePixelRatio)&&void 0!==C?C:1)?et:st:"Desktop"),$timezone:fr(),$timezone_offset:gr()}),{$current_url:rr(n?ae(null==s?void 0:s.href):null==s?void 0:s.href,c,ar),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:l.length>1e3?l.substring(0,997)+"...":l,$browser_version:ie(l,navigator.vendor,g,m),$browser_language:dr(),$browser_language_prefix:(T=dr(),"string"==typeof T?T.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=v.SDK_DIST_CHANNEL),A}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var f=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),g=f.windowId;u.$session_id=f.sessionId,u.$window_id=g}this.sessionPropsManager&&li(u,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&li(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(m=this.Yo)?void 0:m.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Xs&&(u.$lib_custom_api_host=this.config.api_host),c=e!==ri||a?e!==si||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),u=li(u,c),e===ri&&r&&(u.title=r.title),!L(h)){var w=n.getTime()-h;u.$duration=parseFloat((w/1e3).toFixed(3))}l&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties();hi(["$referrer","$referring_domain"],(t=>{t in y&&delete b[t]}));var x={};if(this.Ho.length>0)for(var E of this.Ho.slice())try{li(x,E())}catch(t){le.error("Failed to produce browser extension event properties",t)}(u=li({},_,y,b,p({},x,u))).$is_identified=this._isIdentified(),N(this.config.property_denylist)?hi(this.config.property_denylist,(function(t){delete u[t]})):le.error(wn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(le.error(mn),u=S(u,e));var T=this.yl();return u.$process_person_profile=T,T&&!a&&this.bl("_calculate_event_properties"),u}pl(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.yl())return t;if(this.qo&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=li({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(le.error(mn),o=a(o,"$set_once")),e&&(this.qo=!0),F(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.gl(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.jo.add(t))),this.ml()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.jo.delete(t),this.ml()}_l(t,e){this.register({[t]:e})}Xo(){this.jo.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.jo.clear(),this.ml()}ml(){var t;if(this.Bo)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Hs||!ji.Nr())ji.qr(this.Bo);else{var e=[];this.jo.forEach((t=>e.push(t))),e.length>0?ji.Dr(this.Bo,e):ji.qr(this.Bo)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Ro.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:gn}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:gn})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:gn})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=sn),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:gn}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:gn})}wl(t){return!t||z(t)?(le.critical("Unique user id has not been set in posthog.identify"),!1):t===We?(le.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(le.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return le.uninitializedWarning("posthog.identify");if(G(t)&&(t=t.toString(),le.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.wl(t)&&this.bl("posthog.identify")){this.Do();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.gl(!1),o=this.persistence.Ws(),a=!1;try{var h=this.get_distinct_id();this.register({$user_id:t}),this.get_property(me)||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),t!==h&&t!==this.get_property(ye)&&(this.unregister(ye),this.register({distinct_id:t}));var l,u=(this.persistence.get_property(Fe)||Qe)===Qe,d=t!==h,v=!d&&u;if(d&&u)this.persistence.set_property(Fe,Ze),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(ni,{distinct_id:t,$anon_distinct_id:h},{$set:e||{},$set_once:i||{}}),this.Vo=Ks(t,e,i),null==(l=this.featureFlags)||l.setAnonymousDistinctId(h);else if(v){this.persistence.set_property(Fe,Ze);var c=e||{},_=i||{};this.setPersonPropertiesForFlags({$set:c,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:c,$set_once:_}),this.Vo=Ks(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Ne)):v&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Qs(a)}}}setPersonProperties(t,e){if((t||e)&&this.bl("posthog.setPersonProperties")){var i=Ks(this.get_distinct_id(),t,e);this.Vo!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Vo=i):le.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(N(t)?t:[t]).filter((t=>j(t)&&t.length>0));0!==i.length&&this.bl("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Vo=null)}group(t,e,i){var r;if(t&&e){null==(r=this.persistence)||r.syncCookieProperties(),this.gl();var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},s,{[t]:e})}),n||i){var o={$group_type:t,$group_key:e};i&&(o.$group_set=i),this.capture(oi,o)}i&&this.setGroupPropertiesForFlags({[t]:i}),n&&!i&&this.reloadFeatureFlags()}else le.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.bl("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=V(t)?t:null==t?void 0:t.resetDeviceID,i=V(t)||null==t?void 0:t.bootstrap;this.kl(e,!1,i)}kl(t,e,i){var r,s,n;if(void 0===e&&(e=!1),le.info("reset"),!this.__loaded)return le.uninitializedWarning("posthog.reset");var o=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(r=this.Zo)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(me),h=this.get_property(we),l=this.get_property(xe),u=this.is_capturing();this.consent.reset(),e||!u||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(n=this.persistence)||null==n.Ws?void 0:n.Ws(),v=!1;try{var c,_,f,g,m,w,y,b,x,E,S,T,R,k;if(null==(c=this.persistence)||c.clear(),null==(_=this.sessionPersistence)||_.clear(),this.jo.clear(),this.ml(),L(l)||null==(S=this.persistence)||S.register({[xe]:l}),null==(f=this.surveys)||f.reset(),null==(g=this.vl)||g.stop(),null==(m=this.featureFlags)||m.reset(),null==(w=this.conversations)||w.reset(),null==(y=this.logs)||y.reset(),null==(b=this.metrics)||b.reset(),null==(x=this.persistence)||x.set_property(Fe,Qe),null==(E=this.sessionManager)||E.resetSessionId(),this.Vo=null,this.config.cookieless_mode===Xe)this.register_once({distinct_id:We,$device_id:null},"");else{var P=this.config.get_device_id(bi());this.register_once({distinct_id:P,$device_id:t?P:a},""),t||L(h)||this.register({[we]:h})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this.Oo()||(null==(k=this.persistence)||k.set_property(Fe,i.isIdentifiedID?Ze:Qe),this.register({distinct_id:i.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(L(o)||null!=(R=this.sessionManager)&&R.setBootstrapSessionId(o,!0))){var O=p({},i);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,v=!0}finally{var I;d&&(null==(I=this.persistence)||null==I.Qs||I.Qs(v))}this.reloadFeatureFlags()}shutdown(t){var e=this;return _((function*(){var t,i,r,s,n,o;if(e.__loaded){null==(t=e.vl)||t.stop(),e.sl().dispose(),null==(i=e.sessionRecording)||i.dispose(),null==(r=e.logs)||r.flushLogs("sendBeacon"),null==(s=e.metrics)||s.flush("sendBeacon"),null==(n=e.Jo)||n.unload(),null==(o=e.Yo)||o.unload();try{var a;null==(a=e.featureFlags)||a.destroy()}catch(t){le.error("Error while destroying feature flags",t)}}else le.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(fe)?(le.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(L(e)&&(e=this.get_distinct_id()),t!==e?(this._l(ye,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(le.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=p({},this.config);if(B(t)){var i,r,s,n,o,a,h,l,u,d,c,_;li(this.config,Sn(t));var f=this.$o();null==(i=this.persistence)||i.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(p({},this.config,{persistence:"sessionStorage"}),f,!1);var g,m=this.Go(this.config.debug);V(m)&&(this.config.debug=m),V(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,Ri.Nr()&&Ri.Dr("ph_debug",!0),le.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,Ri.Nr()&&Ri.qr("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.No(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:Rn.Cl}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:bn;return e!==bn&&(e=bn+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Fe))===Ze||(null==(e=this.sessionPersistence)?void 0:e.get_property(Fe))===Ze}yl(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ti&&!this._isIdentified()&&F(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[ye])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ge]))}cl(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yl()||this.bl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bl(t){return"never"===this.config.person_profiles?(le.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._l(Ge,!0),!0)}$o(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ke)}No(){var t,e,i,r,s=this.$o();return(null==(t=this.persistence)?void 0:t.Hs)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.Hs)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.jo.clear(),this.ml()),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==Xe){if(this.Oo()){var i,r,s,n,o;this.kl(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Ys(this),this.pageViewManager=new Ji(this),this.persistence&&(this.sessionPropsManager=new Hs(this,this.sessionManager,this.persistence));var a,h=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=Rn.__defaultExtensionClasses)?void 0:o.sessionRecording;h&&(this.sessionRecording=this.Lo(this.sessionRecording,new h(this)),this.Io&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Io)))}var l,u;this.consent.optInOut(!0),this.No(),this.hl(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==Ke&&(null==(l=this.surveys)||l.loadIfEnabled()),(L(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.dl()}else le.warn(fn)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==Xe?(this.config.cookieless_mode===Ke&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===Ke&&(this.register({distinct_id:We,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.dl(),this.hl())):le.warn(fn)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Xe||(this.config.cookieless_mode===Ke?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.No()}_is_bot(){return i?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&O(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>O(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver}(i,this.config.custom_blocked_useragents):void 0}dl(){r&&("visible"===r.visibilityState?this.Uo||(this.Uo=!0,this.capture(ri,{title:r.title},{send_instantly:!0}),this.zo&&(r.removeEventListener(ei,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),_i(r,ei,this.zo)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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 t=this.Zo||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(le.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):function(t,e,i,r,s){var n=e in t&&!H(t[e]),o=i in t&&!H(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,le)}kn(t){var e;if(H(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(K),r=N(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),H(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return J(t.event)?le.warn(o+". This can cause unexpected behavior."):le.info(o),null}s.properties&&!F(s.properties)||le.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return le.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&H(s.properties[a]))return le.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.Ss)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Go(t){var e=V(t)&&!t,i=Ri.Nr()&&"true"===Ri.Pr("ph_debug");return!e&&(!!i||t)}}Rn.__defaultExtensionClasses={},Rn.Cl={trace:vn=()=>{},debug:vn,info:vn,warn:vn,error:vn,fatal:vn},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=ui(t.prototype[e[i]])}(Rn,["identify"]);var kn=function(){v.SDK_DIST_CHANNEL="npm";var e=cn[bn]=new Rn;return function(){function e(){e.done||(e.done=!0,$n=!1,hi(cn,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():_i(r,"DOMContentLoaded",e,{capture:!1}):t&&le.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Sr as Compression,Ur as DEFAULT_PRODUCT_TOUR_APPEARANCE,Nr as DisplaySurveyType,Rn as PostHog,Br as ProductTourEventName,Fr as ProductTourEventProperties,Ar as SurveyEventName,Dr as SurveyEventProperties,Tr as SurveyEventType,kr as SurveyPosition,Cr as SurveyQuestionBranchingType,Ir as SurveyQuestionType,Mr as SurveySchedule,Pr as SurveyTabPosition,Or as SurveyType,Rr as SurveyWidgetType,kn as default,kn as posthog,Hr as severityLevels};
2
2
  //# sourceMappingURL=module.slim.js.map