posthog-js 1.412.0 → 1.412.1
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.
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/product-tours-preview.js +1 -1
- package/dist/product-tours-preview.js.map +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/product-tours.js.map +1 -1
- package/dist/rrweb.js +1 -1
- package/dist/rrweb.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +6 -6
package/dist/module.slim.js
CHANGED
|
@@ -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,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent,h="undefined"!=typeof globalThis?globalThis:t;h&&"undefined"==typeof self&&(h.self=h),h&&"undefined"==typeof File&&(h.File=function(){});var d=null!=t?t:{},v={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"};function c(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).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 P(){return P=_((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(),l=(yield Promise.all([a,o]))[0];return yield R(l,r),l}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),P.apply(this,arguments)}var k=["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 k.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function I(t,e){return-1!==t.indexOf(e)}var M=function(t){return t.replace(/^\$/,"")},A=Object.prototype,C=A.hasOwnProperty,D=A.toString,U=Array.isArray||function(t){return"[object Array]"===D.call(t)},N=t=>"function"==typeof t,B=t=>t===Object(t)&&!U(t),F=t=>{if(B(t)){for(var e in t)if(C.call(t,e))return!1;return!0}return!1},L=t=>void 0===t,z=t=>"[object String]"==D.call(t),j=t=>z(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",lt=at+" Watch",ut="Safari",ht="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",Pt=rt+" "+et,kt=et+" "+ut,Ot="Windows",It=Ot+" Phone",Mt="Nokia",At="Ouya",Ct="Generic",Dt=Ct+" "+et.toLowerCase(),Ut=Ct+" "+st.toLowerCase(),Nt="Konqueror",Bt="Oculus Browser",Ft="Vivaldi",Lt="Yandex",zt="Whale",jt="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(ht+"|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)?ht: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,zt+"/")?zt:I(t,jt+"/")||I(t,"Ddg/")?jt: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,ut)?Pt:I(t,"FxiOS")?Et:I(t.toLowerCase(),Nt.toLowerCase())?Nt:I(t,Gt+"/")?Gt:((t,e)=>e&&I(e,at)||function(t){return I(t,ut)&&!I(t,_t)&&!I(t,rt)}(t))(t,e)?I(t,et)?kt:ut: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)],[ut]:[Yt],[kt]:[Yt],[wt]:[new RegExp("(Opera|OPR)\\/"+Vt)],[xt]:[new RegExp(xt+"\\/"+Vt)],[Et]:[new RegExp("FxiOS\\/"+Vt)],[Nt]:[new RegExp("Konqueror[:/]?"+Vt,"i")],[ht]:[new RegExp(ht+" "+Vt),Yt],[Pt]:[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)],[zt]:[new RegExp(zt+"\\/"+Vt)],[Gt]:[new RegExp(Gt+"\\/"+Vt)],[jt]:[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,[ht,""]],[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(At,"i").test(t)?At: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)?lt:Qt.test(t)?ht:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Mt,"i").test(t)?Mt:/(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)?Ut:""},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 le=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={k(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.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("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)=>le(e+" "+t,i)};return s},ue=le("[PostHog.js]"),he=ue.createLogger,de=he("[ExternalScriptsLoader]"),ve=(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=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===e){var t=s[a];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var l=()=>{if(!r)return i("document not found");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=>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?l():null==r||r.addEventListener("DOMContentLoaded",l)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.strict_script_versioning)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}ve(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");ve(t,o,i)}},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);ve(t,r,i)};v.DEBUG=!1,v.LIB_VERSION="1.412.0",v.LIB_NAME="web";var ce="$people_distinct_id",_e="$device_id",pe="$device_model",fe="__alias",ge="__timers",me="$dead_clicks_enabled_server_side",we="$session_recording_remote_config",ye="$sesid",be="$session_is_sampled",$e="$enabled_feature_flags",xe="$minimal_flag_called_events",Ee="$surveys_loaded_at",Se="$flag_call_reported",Te="$feature_flag_evaluated_at",Re="$user_state",Pe="$client_session_props",ke="$capture_rate_limit",Oe="$initial_campaign_params",Ie="$initial_referrer_info",Me="$initial_person_info",Ae="$epp",Ce="$posthog_cookieless",De="$cookieless_mode",Ue="$sdk_debug_extensions_init_method",Ne="$sdk_debug_extensions_init_time_ms",Be="on_reject",Fe="always",Le="anonymous",ze="identified",je="identified_only",qe="visibilitychange",He="beforeunload",Ge="$pageview",We="$pageleave",Ve="$identify",Ye="$groupidentify";function Je(t,e){U(t)&&t.forEach(e)}function Ke(t,e){if(!H(t))if(U(t))t.forEach(e);else if(Y(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)C.call(t,i)&&e(t[i],i)}var Xe=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},Qe=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){ue.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ue.critical(t)}}},Ze=function(t){var e={};return Ke(t,(function(t,i){(z(t)&&t.length>0||G(t))&&(e[i]=t)})),e};var ti=["herokuapp.com","vercel.app","netlify.app"];function ei(t){var e=null==t?void 0:t.hostname;if(!z(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of ti)if(i===r)return!1;return!0}function ii(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 ri=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 si{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 si(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 si(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 ni{generate(){var t=this.generateOrAbort();if(!L(t))return t;this.S=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.S)this.S=t,this.C();else{if(this.S>=t+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return si.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.R.nextUint32())}C(){this.I=1024*this.R.nextUint32()+(1023&this.R.nextUint32())}constructor(){this.S=0,this.I=0,this.R=new li}}var oi,ai=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&&(ai=t=>crypto.getRandomValues(t));class li{nextUint32(){return this.O.length>this.N||(ai(this.O),this.N=0),this.O[this.N++]}constructor(){this.O=new Uint32Array(8),this.N=1/0}}var ui=()=>hi().toString(),hi=()=>(oi||(oi=new ni)).generate(),di="",vi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ci={P:()=>!!r,j(t){ue.error("cookieStore error: "+t)},q:ri,H(t){var e;try{e=JSON.parse(ci.q(t))||{}}catch(t){}return e},A(t,e,i,s,n){if(!r)return!1;try{var o="",a="",l=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),di)return di;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_"+ui();!di&&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",di=o)}return di}(t);if(!i){var s=(t=>{var e=t.match(vi);return e?e[0]:""})(t);s!==i&&ue.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&ue.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,!0}catch(t){return!1}},F(t,e){if(null!=r&&r.cookie)try{ci.A(t,"",-1,e)}catch(t){return}}},_i=null,pi={P(){if(!q(_i))return _i;var e=!0;if(L(t))e=!1;else try{var i="__mplssupport__";pi.A(i,"xyz"),'"xyz"'!==pi.q(i)&&(e=!1),pi.F(i)}catch(t){e=!1}return e||ue.error("localStorage unsupported; falling back to cookie store"),_i=e,e},j(t){ue.error("localStorage error: "+t)},q(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){pi.j(t)}return null},H(t){try{return JSON.parse(pi.q(t))||{}}catch(t){}return null},A(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){pi.j(t)}return!1},F(e){try{null==t||t.localStorage.removeItem(e)}catch(t){pi.j(t)}}},fi=[_e,"distinct_id",ye,be,Ae,Me,Re],gi={},mi={P:()=>!0,j(t){ue.error("memoryStorage error: "+t)},q:t=>gi[t]||null,H:t=>gi[t]||null,A:(t,e)=>(gi[t]=e,!0),F(t){delete gi[t]}},wi=null,yi={P(){if(!q(wi))return wi;if(wi=!0,L(t))wi=!1;else try{var e="__support__";yi.A(e,"xyz"),'"xyz"'!==yi.q(e)&&(wi=!1),yi.F(e)}catch(t){wi=!1}return wi},j(t){ue.error("sessionStorage error: ",t)},q(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){yi.j(t)}return null},H(t){try{return JSON.parse(yi.q(t))||null}catch(t){}return null},A(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){yi.j(t)}return!1},F(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){yi.j(t)}}};class bi{constructor(t){this._instance=t}get Pe(){return this._instance.config}get consent(){return this.ti()?0:this.ei}isOptedOut(){return this.Pe.cookieless_mode===Fe||this.isRejected()||-1===this.consent&&this.Pe.cookieless_mode===Be}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Pe.opt_out_capturing_by_default}optInOut(t){this.ii.A(this.ri,t?1:0,this.Pe.cookie_expiration,this.Pe.cross_subdomain_cookie,this.Pe.secure_cookie)}reset(){this.ii.F(this.ri,this.Pe.cross_subdomain_cookie)}get ri(){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 ei(){var t=this.ii.q(this.ri);return Q(t)?1:I(Z,t)?0:-1}get ii(){var t=this.Pe.opt_out_capturing_persistence_type,e="localStorage"===t?pi:ci;if(!this.ni||this.ni!==e){this.ni=e;var i="localStorage"===t?ci:pi;i.q(this.ri)&&(this.ni.q(this.ri)||this.optInOut(Q(i.q(this.ri))),i.F(this.ri,this.Pe.cross_subdomain_cookie))}return this.ni}ti(){return!!this.Pe.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack].some((t=>Q(t)))}}var $i=["next","previous","prev",">","<","+","-","−","–"];he("[Dead Clicks]");var xi=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(me)),r=t.instance.config.capture_dead_clicks;return V(r)?r:!!B(r)||i},Ei=he("[SegmentIntegration]");var Si="posthog-js";function Ti(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,l=i.sendExceptionsToPostHog,u=void 0===l||l;return e=>{var i,o,l,h,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==(l=_[0])?void 0:l.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=_[0])?void 0:h.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),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class Ri{constructor(t,e,i,r,s,n){this.name=Si,this.setupOnce=function(o){o(Ti(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Pi{constructor(t){this.li=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ue.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.ui=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.hi()}hi(){var t;this.di=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.li)}destroy(){var t;null==(t=this.di)||t.call(this),this.di=void 0}doPageView(e,i){var r,s=this.vi(e,i);return this.ui={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.vi(t,null==(e=this.ui)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ui)?void 0:t.pageViewId}}vi(t,e){var i=this.ui;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,l=s.maxContentHeight,u=s.lastContentY,h=s.maxContentY;if(!(L(n)||L(o)||L(a)||L(l)||L(u)||L(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?tt(o/n,0,1,ue):1,v=n>1?tt(a/n,0,1,ue):1,c=l>1?tt(u/l,0,1,ue):1,_=l>1?tt(h/l,0,1,ue):1;r=Xe(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:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$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"],Oi={[ce]:{exposure:"hidden"},[fe]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[ge]:{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"},[me]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[we]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[ye]:{exposure:"hidden"},[be]:{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"},[$e]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!B(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},$active_feature_flags:{exposure:"event",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},$feature_flag_details:{exposure:"hidden",storageGroup:"flags"},$feature_flag_payloads:{exposure:"event",storageGroup:"flags"},$feature_flag_request_id:{exposure:"event",storageGroup:"flags",volatile:!0},[xe]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"event"},$override_feature_flag_payloads:{exposure:"hidden"},$stored_person_properties:{exposure:"hidden"},$stored_group_properties:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[Ee]:{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"},[Se]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},$feature_flag_errors:{exposure:"hidden"},[Te]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Re]:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[ke]:{exposure:"hidden"},[Oe]:{exposure:"hidden"},[Ie]:{exposure:"hidden"},[Me]:{exposure:"hidden"},[Ae]:{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"},[Ue]:{exposure:"event"},[Ne]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Ii=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Mi=t=>{var e=Oi[t];if(e)return e;for(var i of Ii){var r=i[1];if(0===t.indexOf(i[0]))return r}},Ai=(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},Ci=t=>{var e=null==r?void 0:r.createElement("a");return L(e)?null:(e.href=t,e)},Di=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(!U(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){ue.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ui=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],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");U(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},Ni="https?://(.*)",Bi=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Fi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Bi],Li="<masked>",zi=["li_fat_id"];function ji(t,e){var i=Fi.concat(e||[]),r={};return Ke(i,(function(e){var i=Di(t,e);r[e]=i||null})),r}function qi(t){var e=function(t){return t?0===t.search(Ni+"google.([^/?]*)")?"google":0===t.search(Ni+"bing.com")?"bing":0===t.search(Ni+"yahoo.com")?"yahoo":0===t.search(Ni+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!q(e)){s.$search_engine=e;var n=r?Di(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function Hi(){return navigator.language||navigator.userLanguage}var Gi="$direct";function Wi(){return(null==r?void 0:r.referrer)||Gi}function Vi(t,e,i){void 0===i&&(i=!1);var r=t?[...Bi,...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:Wi().substring(0,1e3),u:o?Ui(o,r,Li):void 0}}function Yi(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==Gi?Gi:null==(i=Ci(r))?void 0:i.host};if(n){o.$current_url=n;var a=Ci(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=ji(n);Xe(o,l)}if(r){var u=qi(r);Xe(o,u)}return o}function Ji(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Ki(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Xi={flags:Te,surveys:Ee},Qi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Zi="main";class tr{constructor(e,i,r){if(void 0===r&&(r=!0),this.ci={},this.fi=!1,this.pi=!1,this.Pe=e,this.gi=r,this.props={},this.mi=void 0,this.yi=(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.ii=this.bi(e),this.pi=this.wi(e),this.load(),e.debug&&ue.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();ii(t,"beforeunload",s,{capture:!1}),ii(t,"pagehide",s,{capture:!1})}}xi(){var t,e=null==(t=this.Pe)?void 0:t.persistence_save_debounce_ms;return G(e)&&e>0?e:0}isDisabled(){return!!this.ki}bi(e){-1===Qi.indexOf(e.persistence.toLowerCase())&&(ue.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=[...fi,...e];return p({},pi,{H(t){try{var e={};try{e=ci.H(t)||{}}catch(t){}var r,s=JSON.parse(pi.q(t)||"{}");if(i){var n={};for(var o in e){var a=e[o];q(a)||""===a||(n[o]=a)}r=Xe(s,n)}else r=Xe(e,s);return pi.A(t,r),r}catch(t){}return null},A(t,e,i,s,n,o){var a=pi.A(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t])})),Object.keys(l).length&&ci.A(t,l,i,s,n,o)}catch(t){pi.j(t)}return a},F(e,i){try{null==t||t.localStorage.removeItem(e),ci.F(e,i)}catch(t){pi.j(t)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&pi.P()?(i=pi,s=!0):"localstorage+cookie"===n&&r.P()?(i=r,s=!0):"sessionstorage"===n&&yi.P()?i=yi:"memory"===n?i=mi:"cookie"===n?i=ci:r.P()?(i=r,s=!0):i=ci,this.fi=s,i}Si(t){return this.yi+"__"+t}wi(t){return this.fi&&!!t.split_storage}_isFeatureFlagCacheStale(t){var e=null!=t?t:this.Pe.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[Te];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return Ke(this.props,((e,i)=>{var r=Mi(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===$e?()=>this._isFeatureFlagCacheStale():()=>!1))return;r.transformToEventProperties&&Xe(t,r.transformToEventProperties(e))}else if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,(()=>!1)))return;t[i]=e}})),t}load(){if(!this.ki){var t=this.ii.H(this.yi);t&&(this.props=Xe({},t)),this.pi&&this.Mi()}}Mi(){for(var t of ki){var e=pi.H(this.Si(t));if(e&&!F(e)){var i=this.Ti(t);i.persisted=!0,this.Ei(t)||(i.fingerprint=this.Ii(e,t)),this.Pi(t,e)||Xe(this.props,e)}}}Ei(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Mi(e))?void 0:i.storageGroup)===t}))}Pi(t,e){var i=Xi[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.ki){var i=this.pi?null==(e=Mi(t))?void 0:e.storageGroup:void 0,r=i?pi.H(this.Si(i)):this.ii.H(this.yi);if(r&&t in r)this.Ri(t,r[t]);else{if(i){var s=this.ii.H(this.yi);if(s&&t in s)return void this.Ri(t,s[t])}this.Li(t)}}}save(){if(!this.ki){var t=this.xi();t>0?L(this.Oi)&&(this.Oi=setTimeout((()=>{this.Oi=void 0,this.Fi()}),t)):this.Fi()}}flush(){L(this.Oi)||(clearTimeout(this.Oi),this.Oi=void 0,this.Fi())}Fi(){this.ki||(this.pi?this.Ai():this.Di(this.ii,this.yi,this.props,Zi))}Ai(){var t=this.$i(),e=t.main,i=t.groups;for(var r of(this.Di(this.ii,this.yi,e,Zi),ki)){var s,n=i[r];(!F(n)||null!=(s=this.ci[r])&&s.persisted)&&this.Di(pi,this.Si(r),n,r)}}$i(){var t={},e={flags:{},surveys:{}};return Ke(this.props,((i,r)=>{var s,n=null==(s=Mi(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ii(t,e){if(e===Zi)return JSON.stringify(t)+"|"+this.Ni+"|"+this.qi+"|"+this.ji;var i={};return Ke(t,((t,e)=>{var r;i[e]=null!=(r=Mi(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}Di(t,e,i,r){var s=this.Ti(r);if(r===Zi||s.dirty||L(s.fingerprint)){var n;try{if((n=this.Ii(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0}t.A(e,i,this.Ni,this.qi,this.ji,this.Pe.debug)?(s.dirty=!1,r!==Zi&&(s.persisted=!0),L(n)||(s.fingerprint=n)):this.Pe.debug&&ue.warn('failed to persist storage entry "'+e+'"; will retry on next save')}}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(L(this.Oi)||(clearTimeout(this.Oi),this.Oi=void 0),this.ii.F(this.yi,!1),this.ii.F(this.yi,!0),!i&&this.gi)for(var r of ki)pi.F(this.Si(r));i?delete this.ci[Zi]:this.ci={}}clear(){this.remove(),this.props={}}register_once(t,e,i){if(B(t)){L(e)&&(e="None"),this.Ni=L(i)?this.Bi:i;var r=!1;if(Ke(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Ri(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(B(t)){this.Ni=L(e)?this.Bi:e;var i=!1;if(Ke(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.Ri(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Li(t),this.save())}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this.mi){var e=function(t,e,i){if(!r)return{};var s,n=e?[...Bi,...i||[]]:[],o=ji(Ui(r.URL,n,Li),t),a=(s={},Ke(zi,(function(t){var e=ri(t);s[t]=e||null})),s);return Xe(a,o)}(this.Pe.custom_campaign_params,this.Pe.mask_personal_data_properties,this.Pe.custom_personal_data_properties);F(Ze(e))||this.register(e),this.mi=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?qi(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Wi(),$referring_domain:null!=r&&r.referrer&&(null==(t=Ci(r.referrer))?void 0:t.host)||Gi},void 0)}set_initial_person_info(){this.props[Oe]||this.props[Ie]||this.register_once({[Me]:Vi(this.Pe.mask_personal_data_properties,this.Pe.custom_personal_data_properties,this.Pe.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Ke([Ie,Oe],(e=>{var i=this.props[e];i&&Ke(i,(function(e,i){t["$initial_"+M(i)]=e}))}));var e=this.props[Me];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=Yi(t,e),r={};return Ke(i,(function(t,e){r["$initial_"+M(e)]=t})),r}(e,this.Pe.disable_capture_url_hashes);Xe(t,i)}return t}safe_merge(t){return Ke(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){this.Bi=this.Ni=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var r=t.persistence!==e.persistence||!((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||[]),s=r?this.bi(t):this.ii,n=this.wi(t);if(r||n!==this.pi){var o=this.props;this.clear(),this.ii=s,this.pi=n,this.props=o,this.save()}}set_disabled(t){this.ki=t,this.ki?this.remove():this.save()}set_cross_subdomain(t){t!==this.qi&&(this.qi=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ji&&(this.ji=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[ge]||{};i[t]=e,this.Ri(ge,i),this.save()}remove_event_timer(t){var e=this.props[ge]||{},i=e[t];return L(i)||(delete e[t],this.Ri(ge,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Ri(t,e),this.save()}Ri(t,e){var i;this.props[t]=e,null!=(i=Mi(t))&&i.volatile||this.Hi(t)}Li(t){delete this.props[t],this.Hi(t)}Hi(t){var e,i=null==(e=Mi(t))?void 0:e.storageGroup;i&&(this.Ti(i).dirty=!0)}Ti(t){return this.ci[t]||(this.ci[t]={})}}function er(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&N(i.then)&&i.then(void 0,(()=>{}))}}}}var ir={GZipJS:"gzip-js",Base64:"base64"},rr={Activation:"events",Cancellation:"cancelEvents"},sr={Button:"button",Tab:"tab",Selector:"selector"},nr={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"},or={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},ar={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},lr={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},ur={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},hr={Once:"once",Recurring:"recurring",Always:"always"},dr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},vr={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"},cr={Popover:"popover",Inline:"inline"},_r={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},pr={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"},gr=he("[RateLimiter]");class mr{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=>{gr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void gr.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(ke))&&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 l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var u=(G(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this.Ui(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(ke,a),{isRateLimited:l,remainingTokens:a.tokens}}zi(t){var e=this.instance.config.property_denylist;return!U(e)||!e.includes(t)}Wi(){var t;if(this.zi("$current_url")&&this.zi("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}Ui(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Wi(),o=this.zi("$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 wr=he("[RemoteConfig]");class yr{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}Vi(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()}Zi(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 wr.info("Using preloaded remote config",this.remoteConfig),this.Gi(this.remoteConfig),void this.Qi();if(this._instance._shouldDisableFlags())return void wr.warn("Remote config is disabled. Falling back to local config.");this.Vi((t=>{if(!t)return wr.info("No config found after loading remote JS config. Falling back to JSON."),void this.Zi((t=>{this.Gi(t.json,t),this.Qi()}));this.Gi(t),this.Qi()}))}catch(t){wr.error("Error loading remote config",t),this.Gi()}}stop(){this.Ki&&(clearInterval(this.Ki),this.Ki=void 0)}refresh(){!this._instance._shouldDisableFlags()&&r&&"hidden"!==r.visibilityState&&this._instance.reloadFeatureFlags()}Qi(){var t;if(!this.Ki){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Ki=setInterval((()=>{this.refresh()}),e))}}Gi(t,e){!t&&e&&(0===e.statusCode?e.error||wr.warn("Failed to fetch remote config from PostHog."):wr.error("Failed to fetch remote config from PostHog."));try{this._instance.Gi(t?{ok:!0,config:t}:{ok:!1})}catch(t){wr.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){wr.error("Error loading feature flags",t)}}}var br=["fatal","error","warning","log","info","debug"],$r=Uint8Array,xr=Uint16Array,Er=Uint32Array,Sr=new $r([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]),Tr=new $r([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]),Rr=new $r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pr=function(t,e){for(var i=new xr(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Er(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]},kr=Pr(Sr,2),Or=kr[1];kr[0][28]=258,Or[258]=28;for(var Ir=Pr(Tr,0)[1],Mr=new xr(32768),Ar=0;32768>Ar;++Ar){var Cr=(43690&Ar)>>>1|(21845&Ar)<<1;Mr[Ar]=((65280&(Cr=(61680&(Cr=(52428&Cr)>>>2|(13107&Cr)<<2))>>>4|(3855&Cr)<<4))>>>8|(255&Cr)<<8)>>>1}var Dr=function(t,e,i){for(var r=t.length,s=0,n=new xr(e);r>s;++s)++n[t[s]-1];var o,a=new xr(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new xr(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[Mr[d]>>>l]=u}else for(o=new xr(r),s=0;r>s;++s)o[s]=Mr[a[t[s]-1]++]>>>15-t[s];return o},Ur=new $r(288);for(Ar=0;144>Ar;++Ar)Ur[Ar]=8;for(Ar=144;256>Ar;++Ar)Ur[Ar]=9;for(Ar=256;280>Ar;++Ar)Ur[Ar]=7;for(Ar=280;288>Ar;++Ar)Ur[Ar]=8;var Nr=new $r(32);for(Ar=0;32>Ar;++Ar)Nr[Ar]=5;var Br=Dr(Ur,9,0),Fr=Dr(Nr,5,0),Lr=function(t){return(t/8>>0)+(7&t&&1)},zr=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof xr?xr:t instanceof Er?Er:$r)(i-e);return r.set(t.subarray(e,i)),r},jr=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},qr=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Hr=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 $r(0),0];if(1==s){var o=new $r(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],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new xr(v+1),_=Gr(i[h-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 $r(c),_]},Gr=function(t,e,i){return-1==t.s?Math.max(Gr(t.l,e,i+1),Gr(t.r,e,i+1)):e[t.s]=i},Wr=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new xr(++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]},Vr=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Yr=function(t,e,i){var r=i.length,s=Lr(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)},Jr=function(t,e,i,r,s,n,o,a,l,u,h){jr(e,h++,i),++s[256];for(var d=Hr(s,15),v=d[0],c=d[1],_=Hr(n,15),p=_[0],f=_[1],g=Wr(v),m=g[0],w=g[1],y=Wr(p),b=y[0],x=y[1],E=new xr(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=Hr(E,7),R=T[0],P=T[1],k=19;k>4&&!R[Rr[k-1]];--k);var O,I,M,A,C=u+5<<3,D=Vr(s,Ur)+Vr(n,Nr)+o,U=Vr(s,v)+Vr(n,p)+o+14+3*k+Vr(E,R)+(2*E[16]+3*E[17]+7*E[18]);if(D>=C&&U>=C)return Yr(e,h,t.subarray(l,l+u));if(jr(e,h,1+(D>U)),h+=2,D>U){O=Dr(v,c,0),I=v,M=Dr(p,f,0),A=p;var N=Dr(R,P,0);for(jr(e,h,w-257),jr(e,h+5,x-1),jr(e,h+10,k-4),h+=14,S=0;k>S;++S)jr(e,h+3*S,R[Rr[S]]);h+=3*k;for(var B=[m,b],F=0;2>F;++F){var L=B[F];for(S=0;L.length>S;++S)jr(e,h,N[z=31&L[S]]),h+=R[z],z>15&&(jr(e,h,L[S]>>>5&127),h+=L[S]>>>12)}}else O=Br,I=Ur,M=Fr,A=Nr;for(S=0;a>S;++S)if(r[S]>255){var z;qr(e,h,O[257+(z=r[S]>>>18&31)]),h+=I[z+257],z>7&&(jr(e,h,r[S]>>>23&31),h+=Sr[z]);var j=31&r[S];qr(e,h,M[j]),h+=A[j],j>3&&(qr(e,h,r[S]>>>5&8191),h+=Tr[j])}else qr(e,h,O[r[S]]),h+=I[r[S]];return qr(e,h,O[256]),h+I[256]},Kr=new Er([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Xr=function(){for(var t=new Er(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Qr=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Zr(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=Xr[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new $r(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=Yr(l,u,t.subarray(h,d)):(l[h]=!0,u=Yr(l,u,t.subarray(h,o)))}else{for(var v=Kr[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new xr(32768),g=new xr(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 Er(25e3),x=new xr(288),E=new xr(32),S=0,T=0,R=(h=0,0),P=0,k=0;o>h;++h){var O=y(h),I=32767&h,M=g[O];if(f[I]=M,g[O]=I,h>=P){var A=o-h;if((S>7e3||R>24576)&&A>423){u=Jr(t,l,0,b,x,E,T,R,k,h-k,u),R=S=T=0,k=h;for(var C=0;286>C;++C)x[C]=0;for(C=0;30>C;++C)E[C]=0}var D=2,U=0,N=_,B=I-M&32767;if(A>2&&O==y(h-B))for(var F=Math.min(c,A)-1,L=Math.min(32767,h),z=Math.min(258,A);L>=B&&--N&&I!=M;){if(t[h+D]==t[h+D-B]){for(var j=0;z>j&&t[h+j]==t[h+j-B];++j);if(j>D){if(D=j,U=B,j>F)break;var q=Math.min(B,j-2),H=0;for(C=0;q>C;++C){var G=h-B+C+32768&32767,W=G-f[G]+32768&32767;W>H&&(H=W,M=G)}}}B+=(I=M)-(M=f[I])+32768&32767}if(U){b[R++]=268435456|Or[D]<<18|Ir[U];var V=31&Or[D],Y=31&Ir[U];T+=Sr[V]+Tr[Y],++x[257+V],++E[Y],P=h+D,++S}else b[R++]=t[h],++x[t[h]]}}u=Jr(t,l,!0,b,x,E,T,R,k,h-k,u)}return zr(a,0,r+Lr(u)+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,l)),h=u.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&&Qr(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)}}(u,e),Qr(u,h-8,i.d()),Qr(u,h-4,r),u}var ts=!!o||!!n,es="text/plain",is=!1,rs=(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:"")},ss=function(t,e,i){var r;void 0===i&&(i=!0);var s=t.split("?"),n=s[0],o=s[1],a=p({},e),l=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:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return Ke(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 u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},ns=t=>{if(t.Yi)return t.Yi;var e=t.data,i=t.compression;if(e){if(i===ir.GZipJS){var r=Zr(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new $r(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 $r(s+8+(i-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return zr(r,0,s)}(Ai(e)),{mtime:0});return{contentType:es,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===ir.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(Ai(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Ai(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Ai(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},os=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:ss(t.url,{compression:ir.Base64}),encodedBody:ns(p({},t,{compression:ir.Base64,Yi:void 0}))}:{url:rs(t.url,"compression"),encodedBody:ns(p({},t,{compression:void 0,Yi:void 0}))};try{e=ns(t)}catch(e){if(E(t.compression,Di(t.url,"compression")))return ue.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&E(t.compression,Di(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?x(new Uint8Array(i)):ArrayBuffer.isView(i)&&x(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(is=!0,r()):{url:t.url,encodedBody:e}},as=t=>{try{return os(t)}catch(e){return ue.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},ls=function(){var t=_((function*(t){var e=Ai(t.data),i=yield function(t,e,i){return P.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{Yi:{contentType:es,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),us=/Failed to fetch|NetworkError|Load failed/i,hs=t=>{var e=as(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,l=s.body,u=s.estimatedSize,h=new Headers;Ke(t.headers,(function(t,e){h.append(e,t)})),o&&h.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)||(t=>"TypeError"===(null==t?void 0:t.name)&&us.test((null==t?void 0:t.message)||""))(e)?ue.warn(e):ue.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:h,keepalive:"POST"===t.method&&!t.Xi&&52428.8>(u||0),body:l,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){ue.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=os(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(i.sendBeacon(s,u))return;var h=U(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(U(h)&&h.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(h.length/2),v=e=>U(t.data)?e:p({},t.data,{batch:e});return ds(p({},t,{data:v(h.slice(0,d))})),void ds(p({},t,{data:v(h.slice(d))}))}ue.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),hs(p({},t,{Xi:!0}))}catch(t){ue.warn("Beacon send failed",t)}},vs=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return ss(i===ir.GZipJS?rs(t,"compression"):t,p({},s?{[s]:Date.now().toString()}:{},i===ir.GZipJS?{}:{compression:i}))},cs=[];n&&cs.push({transport:"fetch",method:hs}),o&&cs.push({transport:"XHR",method(t){var e=as(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;Ke(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&&cs.push({transport:"sendBeacon",method:ds});var _s=3e3;class ps{constructor(t,e){this.tr=!0,this.er=[],this.ir=tt((null==e?void 0:e.flush_interval_ms)||_s,250,5e3,ue.createLogger("flush interval"),_s),this.rr=t}enqueue(t){this.er.push(t),this.nr||this.sr()}unload(){this.ar();var t=this.er.length>0?this.lr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.ur(p({},t,{transport:"sendBeacon"}))}))}enable(){this.tr=!1,this.sr()}sr(){var t=this;this.tr||(this.nr=setTimeout((()=>{if(this.ar(),this.er.length>0){var e=this.lr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&U(i.data)&&Ke(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.ur(i)};for(var r in e)i()}}),this.ir))}ur(t){try{this.rr(t)}catch(t){ue.error(t)}}ar(){clearTimeout(this.nr),this.nr=void 0}lr(){var t={};return Ke(this.er,(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.er=[],t}}var fs=["retriesPerformedSoFar"];class gs{constructor(e){this.hr=!1,this.dr=3e3,this.er=[],this._instance=e,this.er=[],this.vr=!0,!L(t)&&"onLine"in t.navigator&&(this.vr=t.navigator.onLine,this.cr=()=>{this.vr=!0,this.pr()},this.gr=()=>{this.vr=!1},ii(t,"online",this.cr),ii(t,"offline",this.gr))}get length(){return this.er.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,fs);W(e)&&(i.url=ss(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.Lt(p({retriesPerformedSoFar:e},i));0===t.statusCode&&ue.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)}}))}Lt(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.er.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),ue.warn(s),this.hr||(this.hr=!0,this.mr())}mr(){if(this.yr&&clearTimeout(this.yr),0===this.er.length)return this.hr=!1,void(this.yr=void 0);this.yr=setTimeout((()=>{this.vr&&this.er.length>0&&this.pr(),this.mr()}),this.dr)}pr(){var t=Date.now(),e=[],i=this.er.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.er=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.yr&&(clearTimeout(this.yr),this.yr=void 0),this.hr=!1,L(t)||(this.cr&&(t.removeEventListener("online",this.cr),this.cr=void 0),this.gr&&(t.removeEventListener("offline",this.gr),this.gr=void 0)),this.er)){var i=e.requestOptions;try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){ue.error(t)}}this.er=[]}}class ms{constructor(t){this.br=()=>{var t,e,i,r;this._r||(this._r={});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),l=(null==s?void 0:s.scrollHeight)||0;this._r.lastScrollY=Math.ceil(n),this._r.maxScrollY=Math.max(n,null!==(t=this._r.maxScrollY)&&void 0!==t?t:0),this._r.maxScrollHeight=Math.max(o,null!==(e=this._r.maxScrollHeight)&&void 0!==e?e:0),this._r.lastContentY=a,this._r.maxContentY=Math.max(a,null!==(i=this._r.maxContentY)&&void 0!==i?i:0),this._r.maxContentHeight=Math.max(l,null!==(r=this._r.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get wr(){return this._instance.config.scroll_root_selector}getContext(){return this._r}resetContext(){var t=this._r;return setTimeout(this.br,0),t}startMeasuringScrollPosition(){ii(t,"scroll",this.br,{capture:!0}),ii(t,"scrollend",this.br,{capture:!0}),ii(t,"resize",this.br)}scrollElement(){if(!this.wr)return null==t?void 0:t.document.documentElement;var e=U(this.wr)?this.wr:[this.wr];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}kr(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.wr){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.kr("y")}scrollX(){return this.kr("x")}}var ws=t=>Vi(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 ys{constructor(t,e,i,r){this.Sr=t=>{var e=this.Cr();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Mr(this._instance)};this.Tr.register({[Pe]:i})}},this._instance=t,this.Er=e,this.Tr=i,this.Mr=r||ws,this.Er.onSessionId(this.Sr)}Cr(){return this.Tr.props[Pe]}getSetOnceProps(){var t,e=null==(t=this.Cr())?void 0:t.props;return e?"r"in e?Yi(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 Ke(Ze(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+M(i)]=e})),t}}class bs{on(t,e){return this.Ir[t]||(this.Ir[t]=[]),this.Ir[t].push(e),()=>{this.Ir[t]=this.Ir[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Ir[t]||[])i(e);for(var r of this.Ir["*"]||[])r(t,e)}constructor(){this.Ir={}}}var $s=he("[SessionId]");class xs{on(t,e){return this.Pr.on(t,e)}constructor(t,e,i){var r;if(this.Rr=null,this.Lr=[],this.Or=void 0,this.Fr=!1,this.Pr=new bs,this.Ar=(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===Fe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Pe=t.config,this.Tr=t.persistence,this.Dr=void 0,this.$r=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Nr=e||ui,this.qr=i||ui;var s=this.Pe.persistence_name||this.Pe.token;if(this._sessionTimeoutMs=1e3*tt(this.Pe.session_idle_timeout_seconds||1800,60,36e3,$s.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.jr(),this.Br="ph_"+s+"_window_id",this.Hr="ph_"+s+"_primary_window_exists",this.Ur()){var n=yi.H(this.Br),o=yi.H(this.Hr);n&&!o?this.Dr=n:yi.F(this.Br),yi.A(this.Hr,!0)}if(null!=(r=this.Pe.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Pe.bootstrap.sessionID.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)})();this.zr(this.Pe.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){$s.error("Invalid sessionID in bootstrap",t)}this.Wr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return L(this.Lr)&&(this.Lr=[]),this.Lr.push(t),this.$r&&t(this.$r,this.Dr),()=>{this.Lr=this.Lr.filter((e=>e!==t))}}Ur(){return"memory"!==this.Pe.persistence&&!this.Tr.ki&&yi.P()}Vr(t){t!==this.Dr&&(this.Dr=t,this.Ur()&&yi.A(this.Br,t))}Zr(){return this.Dr?this.Dr:this.Ur()?yi.H(this.Br):null}Gr(t){var e=this.Rr;return!q(e)&&!q(t)&&5e3>Math.abs(t-e)}zr(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.$r||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.$r=t,s&&!r||s&&this.Gr(e)||(this.Rr=e,this.Tr.register({[ye]:[e,t,i]}))}Qr(){var t,e=null==(t=this.Pe)?void 0:t.persistence_save_debounce_ms;return W(e)&&e>0}Jr(){this.Qr()?this.Tr.refreshKey(ye):(this.Tr.flush(),this.Tr.load())}Kr(){var t;if(!q(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Rr){this.Jr();var e=this.Yr();e[1]===this.$r&&e[2]===this._sessionStartTimestamp&&(this.Rr=this._sessionActivityTimestamp,this.Tr.register({[ye]:[this._sessionActivityTimestamp,null!==(t=this.$r)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Tr.flush())}}Xr(){var t=this.Yr()[0],e=W(t)?t:0,i=W(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}tn(t){return this.Jr(),this.Ar(t,this.Xr())}Yr(){var t=this.Tr.props[ye];return U(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Rr=null,clearTimeout(this.en),this.en=void 0,this.zr(null,null,null)}destroy(){this.Fr=!0,this.Kr(),clearTimeout(this.en),this.en=void 0,this.Or&&t&&(t.removeEventListener(He,this.Or,{capture:!1}),this.Or=void 0),this.Lr=[]}Wr(){this.Or=()=>{this.Kr(),this.Ur()&&yi.F(this.Hr)},ii(t,He,this.Or,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Pe.cookieless_mode===Fe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),r=this.Yr(),s=r[1],n=r[2],o=this.Xr(),a=this.Zr(),l=W(n)&&Math.abs(i-n)>864e5,u=!1,h=!1,d=!s,v=s,c=!d&&!t&&this.Ar(i,o);if(c){(c=this.tn(i))||$s.info("cross-tab refresh kept the session alive",{sessionId:s});var _=this.Yr();s=_[1],n=_[2]}d||c||l?(s=this.Nr(),a=this.qr(),$s.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l}}),n=i,u=!0):(a||(a=this.qr(),u=!0),(h=s!==v)&&($s.info("adopted cross-tab session id",{sessionId:s,windowId:a}),u=!0));var p=W(o)&&t&&!l?o:i,f=W(n)?n:(new Date).getTime();this.Vr(a),this.zr(s,p,f),t||this.jr();var g={noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l,crossTabAdoption:h};return u&&this.Lr.forEach((t=>t(s,a,g))),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:u?g:void 0,lastActivityTimestamp:o}}jr(){this.Fr||(clearTimeout(this.en),this.en=setTimeout((()=>{if(!this.Fr)if(this.tn((new Date).getTime())){var t=this.$r;this.resetSessionId(),this.Pr.emit("forcedIdleReset",{idleSessionId:t})}else this.jr()}),1.1*this.sessionTimeoutMs))}}function Es(){return(Es=_((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 z(r)&&r.length>0?r:void 0}catch(t){return void ue.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ss(t,e,i){return Ai({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Ts="custom",Rs="i.posthog.com",Ps=/^\/static\//;class ks{constructor(t){this.rn={},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("."+Rs,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.rn[this.apiHost]||(this.rn[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":Ts),this.rn[this.apiHost]}nn(t){if(Ps.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.nn(e);if(i)return""+i+e}if(this.region===Ts)return this.apiHost+e;var r=Rs+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var Os=he("[Surveys]"),Is={ignoreConditions:!1,ignoreDelay:!1,displayType:cr.Popover},Ms=he("[PostHog ExternalIntegrations]"),As={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Cs{constructor(t){this._instance=t}ai(t,e){var i;null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Ms.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.ai(As[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 Ds{constructor(t,e){this.rt=t,this.sn=e,this.an=new Map,this.ln=!1}add(t){var e=this;return _((function*(){if(e.ln)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.an.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.an.set(t.name,t);try{var i=t.setup(e.sn);i&&(yield i)}catch(i){var r=e.an.get(t.name)===t;r&&e.an.delete(t.name),e.rt.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.un(t)}}))()}dispose(){if(!this.ln){this.ln=!0;var t=Array.from(this.an.values()).reverse();for(var e of(this.an.clear(),t))this.un(e)}}un(t){try{var e=null==t.dispose?void 0:t.dispose();e&&N(e.then)&&e.then(void 0,(e=>{this.rt.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.rt.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class Us{constructor(t){this._instance=t}get(t){var e;return null==(e=this._instance.persistence)?void 0:e.get_property(t)}set(t,e){var i;null==(i=this._instance.persistence)||i.set_property(t,e)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var Ns="extensionsRemoteConfig";class Bs{constructor(t){this.ln=!1,this.instance=t,this.rt=ue.createLogger("[BrowserExtensions]"),this.hn=t.dn,this.kv=new Us(t),this.onEvent=t=>er(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.rt.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.ln)return er((()=>{}));var e=e=>{try{t(e)}catch(t){this.rt.error("Browser extension remote config listener failed",t)}},i=this.instance._internalEventEmitter.on(Ns,e);return this.hn&&e(this.hn),er(i)},this.cn=new Ds(this.rt,this)}get logger(){return this.rt}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(_e))&&void 0!==t?t:this.distinctId}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.cn.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.fn(t))}handleRemoteConfig(t){this.ln||(this.hn=t,this.instance._internalEventEmitter.emit(Ns,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?ss(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.ln||(this.ln=!0,this.cn.dispose())}}var Fs,Ls={},zs=0,js=()=>{},qs='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Hs="Surveys module not available",Gs="sanitize_properties is deprecated. Use before_send instead",Ws="Invalid value for property_denylist config: ",Vs=["token","distinct_id",De],Ys="posthog",Js=!ts&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),Ks=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:ei(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:js,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&&z(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:!1,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){ue.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:je,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:_s},error_tracking:{},_onCapture:js},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:$i,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)}))(e))},Xs=[["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"]],Qs=t=>{var e={};for(var i of Xs){var r=i[0],s=i[1];L(t[r])||(e[s]=t[r])}var n=Xe({},e,t),o=t.__preview_external_dependency_versioned_paths;return L(o)||(L(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),z(o)&&L(t.asset_host)&&(n.asset_host=o)),U(t.property_blacklist)&&(L(t.property_denylist)?n.property_denylist=t.property_blacklist:U(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ue.error(Ws+t.property_denylist)),n};class Zs{constructor(){this.__forceAllowLocalhost=!1}get pn(){return this.__forceAllowLocalhost}set pn(t){ue.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class tn{gn(t,e){if(t){var i=this.an.indexOf(t);-1!==i&&this.an.splice(i,1)}return this.an.push(e),null==e.initialize||e.initialize(),e}mn(){return this.config.cookieless_mode===Fe||this.config.cookieless_mode===Be&&this.consent.isRejected()}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 Zs,this.yn=!1,this.version=v.LIB_VERSION,this._internalEventEmitter=new bs,this.an=[],this.bn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ks(),this.SentryIntegration=Ri,this.sentryIntegration=t=>function(t,e){var i=Ti(t,e);return{name:Si,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._n=!1,this.wn=null,this.xn=null,this.kn=null,this.scrollManager=new ms(this),this.pageViewManager=new Pi(this),this.rateLimiter=new mr(this),this.requestRouter=new ks(this),this.consent=new bi(this),this.externalIntegrations=new Cs(this);var e=null!==(t=tn.__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=z(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=z(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>ue.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Ys){var r,s=null!==(r=Ls[i])&&void 0!==r?r:new tn;return s._init(t,e,i),Ls[i]=s,Ls[Ys][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o,a=z(e)?e.trim():"";if(!a)return ue.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=Ks(i.defaults),i.debug=this.Sn(i.debug),this.Cn=i,this.Mn=[],i.person_profiles?this.xn=i.person_profiles:i.process_person&&(this.xn=i.process_person);var l=Ks(i.defaults),u=Qs(i),h=Xe({},l,u,{name:r,token:a});B(l.rageclick)&&B(u.rageclick)&&(h.rageclick=Xe({},l.rageclick,u.rageclick)),B(l.session_recording)&&B(u.session_recording)&&(h.session_recording=Xe({},l.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&ue.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ir.GZipJS;var d=this.Tn();this.persistence=new tr(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new tr(p({},this.config,{persistence:"sessionStorage"}),d,!1);var c=p({},this.persistence.props),_=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.En=new ps((t=>this.In(t)),this.config.request_queue_config),this.Pn=new gs(this),this.__request_queue=[];var f=this.mn();if(f||(this.sessionManager=new xs(this),this.sessionPropsManager=new ys(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(ue.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Rn(f)}),0)):(ue.info("Initializing extensions synchronously"),this.Rn(f)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&ue.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:c,s:_}),!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 g=i.bootstrap.distinctID,m=this.get_distinct_id(),w=this.persistence.get_property(Re);if(i.bootstrap.isIdentifiedID&&null!=m&&m!==g&&w===Le)this.identify(g);else if(i.bootstrap.isIdentifiedID&&null!=m&&m!==g&&w===ze)ue.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var y=this.config.get_device_id(ui()),b=i.bootstrap.isIdentifiedID?y:g;this.persistence.set_property(Re,i.bootstrap.isIdentifiedID?ze:Le),this.register({distinct_id:g,$device_id:b})}}if(f)this.register_once({distinct_id:Ce,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(ui());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(Re,Le)}return ii(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()||ui();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Re,ze)),e()},s=i.user();"then"in s&&N(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Ei.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()||(Ei.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Ei.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,Ge),identify:t=>e(t,Ve),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.Ln())):this.Ln(),N(this.config._onCapture)&&this.config._onCapture!==js&&(ue.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&ue.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 Es.apply(this,arguments)}().then((t=>{t&&this.register({[pe]:t})})).catch(js),this}Rn(t){var e,i,r,s,n,o,a,l,u=performance.now(),h=p({},tn.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.an.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new h.featureFlags(this)),h.exceptions&&this.an.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new h.exceptions(this)),h.historyAutocapture&&this.an.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.an.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.an.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.an.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.an.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.an.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new h.surveys(this)),h.logs&&this.an.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new h.logs(this)),h.metrics&&this.an.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new h.metrics(this)),h.conversations&&this.an.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.an.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.an.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.an.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.an.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.an.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,xi)),h.toolbar&&this.an.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.an.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.an.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.On){var t=this.On;this.On=void 0,this.an.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.Fn(d,u)}Fn(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Fn(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){ue.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Ue]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ne]:r}),this.config.__preview_deferred_init_extensions&&ue.info("PostHog extensions initialized ("+r+"ms)")}Gi(t){var e;if(!r||!r.body)return ue.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Gi(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.On=t),this.dn=t,this.compression=void 0,t.ok){var i,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=I(s.supportedCompression,ir.GZipJS)?ir.GZipJS:I(s.supportedCompression,ir.Base64)?ir.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.xn?this.xn:je}),null==(e=this.An)||e.handleRemoteConfig(t),this.an.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}Ln(){try{this.config.loaded(this)}catch(t){ue.critical("`loaded` function failed",t)}if(this.Dn(),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.mn())&&this.$n()}),1),this.Nn=new yr(this),this.Nn.load()}Dn(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.En)||t.enable())}_dom_loaded(){this.is_capturing()&&Je(this.__request_queue,(t=>this.In(t))),this.__request_queue=[],this.Dn()}_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.qn()&&this.capture(We),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.En)||r.unload(),null==(s=this.Pn)||s.unload()):this.qn()&&this.capture(We,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Js?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,u,h,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&L(s.compression)&&s.data&&(s.compression=ir.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(h=(u=U(n=s.data)?n:[n])[0])||null==(a=h.properties)?void 0:a.token)&&void 0!==o?o:null==h?void 0:h.token,batch:u,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),U(t)?t.map((t=>p({},t,{sent_at:e}))):p({},t,{sent_at:e})}(s.data))),s.url=vs(s.url,s.method,s.compression,s.timestampMode);var v=cs.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");"sendBeacon"!==d&&s.data&&s.compression===ir.GZipJS&&l&&"undefined"!=typeof Promise&&!is?ls(s).then((t=>{c(t)})).catch((e=>{if(S(e))return is=!0,void c(p({},s,{compression:void 0,url:vs(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)&&(is=!0),c(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}))}In(t){this.Pn?this.Pn.retriableRequest(t):this._send_request(t)}_execute_array(t){zs++;try{var e,i=[],r=[],s=[];Je(t,(t=>{if(t)if(U(e=t[0]))s.push(t);else if(N(t))try{t.call(this)}catch(e){ue.error("Error executing queued PostHog call",t,e)}else U(t)&&"alias"===e?i.push(t):U(t)&&-1!==e.indexOf("capture")&&N(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Je(t,(function(t){try{if(U(t[0])){var i=e;Ke(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){ue.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{zs--}}push(t){if(zs>0&&U(t)&&z(t[0])){var e=tn.prototype[t[0]];N(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a,l,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.En){if(this.is_capturing())if(!L(t)&&z(t)){var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var d=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==d||!d.isRateLimited){if(this.bn.length>0){var v={};for(var c of this.bn.slice())try{Xe(v,c())}catch(t){ue.error("Failed to produce browser extension event properties",t)}e=p({},v,null!=e?e:{})}var _;null!=(r=e)&&r.$current_url&&!z(null==(s=e)?void 0:s.$current_url)&&(ue.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==(_=e)||delete _.$current_url),"$exception"!==t||null!=i&&i._originatedFromCaptureException||ue.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 f=new Date,m=(null==i?void 0:i.timestamp)||f,w=oe(null==i?void 0:i.uuid,ui),y={uuid:w,event:t,properties:this.calculateEventProperties(t,e||{},m,w)};t===Ge&&this.config.__preview_capture_bot_pageviews&&h&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),d&&(y.properties.$lib_rate_limit_remaining_tokens=d.remainingTokens);var b="$feature_flag_called"===t&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property(xe);(null==i?void 0:i.$set)&&!b&&(y.$set=null==i?void 0:i.$set);var x=null==i?void 0:i.$unset;x&&(y.$unset=x);var E,S,T,R=b?void 0:this.Bn(null==i?void 0:i.$set_once,t!==Ye,t===Ve);if(R&&(y.$set_once=R),null!=i&&i._noTruncate||(o=this.config.properties_string_max_length,a=y,l=t=>z(t)?t.slice(0,o):t,u=new Set,y=function t(e,i){if(e!==Object(e))return l?l(e):e;if(!u.has(e)){var r;if(u.add(e),U(e))r=[],Je(e,(e=>{r.push(t(e))}));else{var s={};Ke(e,((e,i)=>{u.has(e)||(s[i]=t(e,i))})),r=s}return r}}(a)),y.timestamp=m,L(null==i?void 0:i.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=f),b&&(y.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}(y.properties,Vs)),t===dr.DISMISSED||t===dr.SENT){var P,k,O=null==(P=e)?void 0:P[vr.SURVEY_ID],I=null==(k=e)?void 0:k[vr.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){Os.error("Failed to persist survey seen state",t)}})({id:O,current_iteration:I}),y.$set=p({},y.$set,{[(E={id:O,current_iteration:I},S=t===dr.SENT?"responded":"dismissed",T="$survey_"+S+"/"+E.id,E.current_iteration&&E.current_iteration>0&&(T="$survey_"+S+"/"+E.id+"/"+E.current_iteration),T)]:!0})}else t===dr.SHOWN&&(y.$set=p({},y.$set,{[vr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===pr.SHOWN){var M,A=null==(M=e)?void 0:M[fr.TOUR_TYPE];A&&(y.$set=p({},y.$set,{[fr.TOUR_LAST_SEEN_DATE+"/"+A]:(new Date).toISOString()}))}var C=p({},y.properties.$set,y.$set);if(F(C)||this.setPersonPropertiesForFlags(C),!H(this.config.before_send)){var D=this.Pt(y);if(!D)return;(y=D).uuid=oe(y.uuid,ui)}this._internalEventEmitter.emit("eventCaptured",y);var N=null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),B={method:"POST",url:N,data:y,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(N)?"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.In(B):this.En.enqueue(B),y}ue.critical("This capture call is ignored due to client rate limiting.")}}else ue.error("No event name provided to posthog.capture")}else ue.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}Hn(){var t;return null!==(t=this.An)&&void 0!==t?t:this.An=new Bs(this)}fn(t){this.bn.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.bn.indexOf(t);-1!==i&&this.bn.splice(i,1)}}}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;var l=a?void 0:this.persistence.remove_event_timer(e),h=p({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.mn()&&(h[De]=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!z(h.distinct_id)&&!G(h.distinct_id)||j(h.distinct_id))&&ue.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var c,_=function(e,i,r,n){var o,a,l,h;if(void 0===n&&(n=!1),!u)return{};var d,c=e?[...Bi,...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&&(N(r)?r(s,t):r);if(n)return n}return["",""]}(u),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==(l=t.screen)?void 0:l.width,E=null==t||null==(h=t.screen)?void 0:h.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,P,k,O,I,M,A,C=Xe(Ze({$os:p,$os_version:f,$browser:te(u,navigator.vendor,g,m),$device:se(u),$device_type:(R=u,P=w,A=se(R),A===ot||A===nt||"Kobo"===A||"Kindle Fire"===A||A===Ut?st:A===St||A===Rt||A===Tt||A===At?"Console":A===lt?"Wearable":A?et:"Android"===(null==P?void 0:P.userAgentDataPlatform)&&(null!==(k=null==P?void 0:P.maxTouchPoints)&&void 0!==k?k:0)>0?600>Math.min(null!==(O=null==P?void 0:P.screenWidth)&&void 0!==O?O:0,null!==(I=null==P?void 0:P.screenHeight)&&void 0!==I?I:0)/(null!==(M=null==P?void 0:P.devicePixelRatio)&&void 0!==M?M:1)?et:st:"Desktop"),$timezone:Ji(),$timezone_offset:Ki()}),{$current_url:Ui(n?ae(null==s?void 0:s.href):null==s?void 0:s.href,c,Li),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:ie(u,navigator.vendor,g,m),$browser_language:Hi(),$browser_language_prefix:(T=Hi(),"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&&(C.$sdk_dist_channel=v.SDK_DIST_CHANNEL),C}(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()),g=f.windowId;h.$session_id=f.sessionId,h.$window_id=g}this.sessionPropsManager&&Xe(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&Xe(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Pn)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Ts&&(h.$lib_custom_api_host=this.config.api_host),c=e!==Ge||a?e!==We||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=Xe(h,c),e===Ge&&r&&(h.title=r.title),!L(l)){var w=n.getTime()-l;h.$duration=parseFloat((w/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties();Ke(["$referrer","$referring_domain"],(t=>{t in y&&delete b[t]})),(h=Xe({},_,y,b,h)).$is_identified=this._isIdentified(),U(this.config.property_denylist)?Ke(this.config.property_denylist,(function(t){delete h[t]})):ue.error(Ws+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(ue.error(Gs),h=x(h,e));var E=this.Un();return h.$process_person_profile=E,E&&!a&&this.zn("_calculate_event_properties"),h}Bn(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Un())return t;if(this.yn&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Xe({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(ue.error(Gs),o=a(o,"$set_once")),e&&(this.yn=!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;null==(e=this.sessionPersistence)||e.register(t)}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t)}Wn(t,e){this.register({[t]:e})}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._internalEventEmitter.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:Hs}),()=>{})}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:Hs})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Hs})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Is),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:Hs}}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:Hs})}Vn(t){return!t||j(t)?(ue.critical("Unique user id has not been set in posthog.identify"),!1):t===Ce?(ue.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())||(ue.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 ue.uninitializedWarning("posthog.identify");if(G(t)&&(t=t.toString(),ue.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Vn(t)&&this.zn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(_e)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(fe)&&(this.unregister(fe),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(Re)||Le)===Le,o=t!==r,a=!o&&n;if(o&&n)this.persistence.set_property(Re,ze),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(Ve,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.kn=Ss(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r);else if(a){this.persistence.set_property(Re,ze);var l=e||{},u=i||{};this.setPersonPropertiesForFlags({$set:l,$set_once:u},!1),this.capture("$set",{$set:l,$set_once:u}),this.kn=Ss(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);o?(this.reloadFeatureFlags(),this.unregister(Se)):a&&(e||i)&&this.reloadFeatureFlags()}}setPersonProperties(t,e){if((t||e)&&this.zn("posthog.setPersonProperties")){var i=Ss(this.get_distinct_id(),t,e);this.kn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.kn=i):ue.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(U(t)?t:[t]).filter((t=>z(t)&&t.length>0));0!==i.length&&this.zn("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.kn=null)}group(t,e,i){if(t&&e){var r=this.getGroups(),s=r[t]!==e;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},r,{[t]:e})}),s||i){var n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(Ye,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),s&&!i&&this.reloadFeatureFlags()}else ue.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.zn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){this.Zn(t)}Zn(t,e){var i,r,s,n,o,a,l,u,h,d;if(void 0===e&&(e=!1),ue.info("reset"),!this.__loaded)return ue.uninitializedWarning("posthog.reset");var v,c=this.get_property(_e),_=this.get_property(pe),p=this.get_property(we),f=this.is_capturing();if(this.consent.reset(),e||!f||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."),null==(i=this.persistence)||i.clear(),null==(r=this.sessionPersistence)||r.clear(),L(p)||null==(v=this.persistence)||v.register({[we]:p}),null==(s=this.surveys)||s.reset(),null==(n=this.Nn)||n.stop(),null==(o=this.featureFlags)||o.reset(),null==(a=this.conversations)||a.reset(),null==(l=this.logs)||l.reset(),null==(u=this.metrics)||u.reset(),null==(h=this.persistence)||h.set_property(Re,Le),null==(d=this.sessionManager)||d.resetSessionId(),this.kn=null,this.config.cookieless_mode===Fe)this.register_once({distinct_id:Ce,$device_id:null},"");else{var g=this.config.get_device_id(ui());this.register_once({distinct_id:g,$device_id:t?g:c},""),t||L(_)||this.register({[pe]:_})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(t){var e=this;return _((function*(){var t,i,r,s,n,o,a;e.__loaded?(null==(t=e.Nn)||t.stop(),null==(i=e.An)||i.dispose(),null==(r=e.logs)||r.flushLogs("sendBeacon"),null==(s=e.metrics)||s.flush("sendBeacon"),null==(n=e.En)||n.unload(),null==(o=e.Pn)||o.unload(),null==(a=e.featureFlags)||a.destroy()):ue.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(ce)?(ue.critical("Attempting to create alias for existing People user - aborting."),-2):this.zn("posthog.alias")?(L(e)&&(e=this.get_distinct_id()),t!==e?(this.Wn(fe,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(ue.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,l,u,h,d,c;Xe(this.config,Qs(t));var _=this.Tn();null==(i=this.persistence)||i.update_config(this.config,e,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new tr(p({},this.config,{persistence:"sessionStorage"}),_,!1);var f=this.Sn(this.config.debug);V(f)&&(this.config.debug=f),V(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,pi.P()&&pi.A("ph_debug",!0),ue.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,pi.P()&&pi.F("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.tracingHeaders)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(h=this.deadClicksAutocapture)||h.startIfEnabledOrStop(),null==(d=this.surveys)||d.loadIfEnabled(),this.Jn(),null==(c=this.externalIntegrations)||c.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:tn.Kn}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:Ys;return e!==Ys&&(e=Ys+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Re))===ze||(null==(e=this.sessionPersistence)?void 0:e.get_property(Re))===ze}Un(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===je&&!this._isIdentified()&&F(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[fe])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ae]))}qn(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Un()||this.zn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.zn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}zn(t){return"never"===this.config.person_profiles?(ue.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Wn(Ae,!0),!0)}Tn(){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!==Be)}Jn(){var t,e,i,r,s=this.Tn();return(null==(t=this.persistence)?void 0:t.ki)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.ki)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==Fe){if(this.mn()){var i,r,s,n,o;this.Zn(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new xs(this),this.pageViewManager=new Pi(this),this.persistence&&(this.sessionPropsManager=new ys(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=tn.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.gn(this.sessionRecording,new l(this)),this.dn&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.dn)))}var u,h;this.consent.optInOut(!0),this.Jn(),this.Dn(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==Be&&(null==(u=this.surveys)||u.loadIfEnabled()),(L(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$n()}else ue.warn(qs)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==Fe?(this.config.cookieless_mode===Be&&this.consent.isOptedIn()&&this.Zn(!0,!0),this.consent.optInOut(!1),this.Jn(),this.config.cookieless_mode===Be&&(this.register({distinct_id:Ce,$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.$n(),this.Dn())):ue.warn(qs)}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===Fe||(this.config.cookieless_mode===Be?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Jn()}_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}$n(){r&&("visible"===r.visibilityState?this._n||(this._n=!0,this.capture(Ge,{title:r.title},{send_instantly:!0}),this.wn&&(r.removeEventListener(qe,this.wn),this.wn=null)):this.wn||(this.wn=this.$n.bind(this),ii(r,qe,this.wn)))}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.Cn||{};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?(ue.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,ue)}Pt(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=U(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),H(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return J(t.event)?ue.warn(o+". This can cause unexpected behavior."):ue.info(o),null}s.properties&&!F(s.properties)||ue.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(s.properties&&H(s.properties[a]))return ue.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.ui)?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)})}Sn(t){var e=V(t)&&!t,i=pi.P()&&"true"===pi.q("ph_debug");return!e&&(!!i||t)}}tn.__defaultExtensionClasses={},tn.Kn={trace:Fs=()=>{},debug:Fs,info:Fs,warn:Fs,error:Fs,fatal:Fs},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Qe(t.prototype[e[i]])}(tn,["identify"]);var en=function(){v.SDK_DIST_CHANNEL="npm";var e=Ls[Ys]=new tn;return function(){function e(){e.done||(e.done=!0,Js=!1,Ke(Ls,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():ii(r,"DOMContentLoaded",e,{capture:!1}):t&&ue.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{ir as Compression,_r as DEFAULT_PRODUCT_TOUR_APPEARANCE,cr as DisplaySurveyType,tn as PostHog,pr as ProductTourEventName,fr as ProductTourEventProperties,dr as SurveyEventName,vr as SurveyEventProperties,rr as SurveyEventType,nr as SurveyPosition,ur as SurveyQuestionBranchingType,lr as SurveyQuestionType,hr as SurveySchedule,or as SurveyTabPosition,ar as SurveyType,sr as SurveyWidgetType,en as default,en as posthog,br 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,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent,h="undefined"!=typeof globalThis?globalThis:t;h&&"undefined"==typeof self&&(h.self=h),h&&"undefined"==typeof File&&(h.File=function(){});var d=null!=t?t:{},v={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"};function c(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).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 P(){return P=_((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(),l=(yield Promise.all([a,o]))[0];return yield R(l,r),l}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),P.apply(this,arguments)}var k=["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 k.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function I(t,e){return-1!==t.indexOf(e)}var M=function(t){return t.replace(/^\$/,"")},A=Object.prototype,C=A.hasOwnProperty,D=A.toString,U=Array.isArray||function(t){return"[object Array]"===D.call(t)},N=t=>"function"==typeof t,B=t=>t===Object(t)&&!U(t),F=t=>{if(B(t)){for(var e in t)if(C.call(t,e))return!1;return!0}return!1},L=t=>void 0===t,z=t=>"[object String]"==D.call(t),j=t=>z(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",lt=at+" Watch",ut="Safari",ht="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",Pt=rt+" "+et,kt=et+" "+ut,Ot="Windows",It=Ot+" Phone",Mt="Nokia",At="Ouya",Ct="Generic",Dt=Ct+" "+et.toLowerCase(),Ut=Ct+" "+st.toLowerCase(),Nt="Konqueror",Bt="Oculus Browser",Ft="Vivaldi",Lt="Yandex",zt="Whale",jt="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(ht+"|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)?ht: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,zt+"/")?zt:I(t,jt+"/")||I(t,"Ddg/")?jt: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,ut)?Pt:I(t,"FxiOS")?Et:I(t.toLowerCase(),Nt.toLowerCase())?Nt:I(t,Gt+"/")?Gt:((t,e)=>e&&I(e,at)||function(t){return I(t,ut)&&!I(t,_t)&&!I(t,rt)}(t))(t,e)?I(t,et)?kt:ut: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)],[ut]:[Yt],[kt]:[Yt],[wt]:[new RegExp("(Opera|OPR)\\/"+Vt)],[xt]:[new RegExp(xt+"\\/"+Vt)],[Et]:[new RegExp("FxiOS\\/"+Vt)],[Nt]:[new RegExp("Konqueror[:/]?"+Vt,"i")],[ht]:[new RegExp(ht+" "+Vt),Yt],[Pt]:[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)],[zt]:[new RegExp(zt+"\\/"+Vt)],[Gt]:[new RegExp(Gt+"\\/"+Vt)],[jt]:[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,[ht,""]],[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(At,"i").test(t)?At: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)?lt:Qt.test(t)?ht:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Mt,"i").test(t)?Mt:/(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)?Ut:""},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 le=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={k(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.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("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)=>le(e+" "+t,i)};return s},ue=le("[PostHog.js]"),he=ue.createLogger,de=he("[ExternalScriptsLoader]"),ve=(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=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===e){var t=s[a];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var l=()=>{if(!r)return i("document not found");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=>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?l():null==r||r.addEventListener("DOMContentLoaded",l)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.strict_script_versioning)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}ve(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");ve(t,o,i)}},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);ve(t,r,i)};v.DEBUG=!1,v.LIB_VERSION="1.412.1",v.LIB_NAME="web";var ce="$people_distinct_id",_e="$device_id",pe="$device_model",fe="__alias",ge="__timers",me="$dead_clicks_enabled_server_side",we="$session_recording_remote_config",ye="$sesid",be="$session_is_sampled",$e="$enabled_feature_flags",xe="$minimal_flag_called_events",Ee="$surveys_loaded_at",Se="$flag_call_reported",Te="$feature_flag_evaluated_at",Re="$user_state",Pe="$client_session_props",ke="$capture_rate_limit",Oe="$initial_campaign_params",Ie="$initial_referrer_info",Me="$initial_person_info",Ae="$epp",Ce="$posthog_cookieless",De="$cookieless_mode",Ue="$sdk_debug_extensions_init_method",Ne="$sdk_debug_extensions_init_time_ms",Be="on_reject",Fe="always",Le="anonymous",ze="identified",je="identified_only",qe="visibilitychange",He="beforeunload",Ge="$pageview",We="$pageleave",Ve="$identify",Ye="$groupidentify";function Je(t,e){U(t)&&t.forEach(e)}function Ke(t,e){if(!H(t))if(U(t))t.forEach(e);else if(Y(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)C.call(t,i)&&e(t[i],i)}var Xe=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},Qe=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){ue.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ue.critical(t)}}},Ze=function(t){var e={};return Ke(t,(function(t,i){(z(t)&&t.length>0||G(t))&&(e[i]=t)})),e};var ti=["herokuapp.com","vercel.app","netlify.app"];function ei(t){var e=null==t?void 0:t.hostname;if(!z(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of ti)if(i===r)return!1;return!0}function ii(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 ri=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 si{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 si(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 si(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 ni{generate(){var t=this.generateOrAbort();if(!L(t))return t;this.S=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.S)this.S=t,this.C();else{if(this.S>=t+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return si.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.R.nextUint32())}C(){this.I=1024*this.R.nextUint32()+(1023&this.R.nextUint32())}constructor(){this.S=0,this.I=0,this.R=new li}}var oi,ai=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&&(ai=t=>crypto.getRandomValues(t));class li{nextUint32(){return this.O.length>this.N||(ai(this.O),this.N=0),this.O[this.N++]}constructor(){this.O=new Uint32Array(8),this.N=1/0}}var ui=()=>hi().toString(),hi=()=>(oi||(oi=new ni)).generate(),di="",vi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ci={P:()=>!!r,j(t){ue.error("cookieStore error: "+t)},q:ri,H(t){var e;try{e=JSON.parse(ci.q(t))||{}}catch(t){}return e},A(t,e,i,s,n){if(!r)return!1;try{var o="",a="",l=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),di)return di;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_"+ui();!di&&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",di=o)}return di}(t);if(!i){var s=(t=>{var e=t.match(vi);return e?e[0]:""})(t);s!==i&&ue.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&ue.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,!0}catch(t){return!1}},F(t,e){if(null!=r&&r.cookie)try{ci.A(t,"",-1,e)}catch(t){return}}},_i=null,pi={P(){if(!q(_i))return _i;var e=!0;if(L(t))e=!1;else try{var i="__mplssupport__";pi.A(i,"xyz"),'"xyz"'!==pi.q(i)&&(e=!1),pi.F(i)}catch(t){e=!1}return e||ue.error("localStorage unsupported; falling back to cookie store"),_i=e,e},j(t){ue.error("localStorage error: "+t)},q(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){pi.j(t)}return null},H(t){try{return JSON.parse(pi.q(t))||{}}catch(t){}return null},A(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){pi.j(t)}return!1},F(e){try{null==t||t.localStorage.removeItem(e)}catch(t){pi.j(t)}}},fi=[_e,"distinct_id",ye,be,Ae,Me,Re],gi={},mi={P:()=>!0,j(t){ue.error("memoryStorage error: "+t)},q:t=>gi[t]||null,H:t=>gi[t]||null,A:(t,e)=>(gi[t]=e,!0),F(t){delete gi[t]}},wi=null,yi={P(){if(!q(wi))return wi;if(wi=!0,L(t))wi=!1;else try{var e="__support__";yi.A(e,"xyz"),'"xyz"'!==yi.q(e)&&(wi=!1),yi.F(e)}catch(t){wi=!1}return wi},j(t){ue.error("sessionStorage error: ",t)},q(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){yi.j(t)}return null},H(t){try{return JSON.parse(yi.q(t))||null}catch(t){}return null},A(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){yi.j(t)}return!1},F(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){yi.j(t)}}};class bi{constructor(t){this._instance=t}get Pe(){return this._instance.config}get consent(){return this.ti()?0:this.ei}isOptedOut(){return this.Pe.cookieless_mode===Fe||this.isRejected()||-1===this.consent&&this.Pe.cookieless_mode===Be}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Pe.opt_out_capturing_by_default}optInOut(t){this.ii.A(this.ri,t?1:0,this.Pe.cookie_expiration,this.Pe.cross_subdomain_cookie,this.Pe.secure_cookie)}reset(){this.ii.F(this.ri,this.Pe.cross_subdomain_cookie)}get ri(){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 ei(){var t=this.ii.q(this.ri);return Q(t)?1:I(Z,t)?0:-1}get ii(){var t=this.Pe.opt_out_capturing_persistence_type,e="localStorage"===t?pi:ci;if(!this.ni||this.ni!==e){this.ni=e;var i="localStorage"===t?ci:pi;i.q(this.ri)&&(this.ni.q(this.ri)||this.optInOut(Q(i.q(this.ri))),i.F(this.ri,this.Pe.cross_subdomain_cookie))}return this.ni}ti(){return!!this.Pe.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack].some((t=>Q(t)))}}var $i=["next","previous","prev",">","<","+","-","−","–"];he("[Dead Clicks]");var xi=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(me)),r=t.instance.config.capture_dead_clicks;return V(r)?r:!!B(r)||i},Ei=he("[SegmentIntegration]");var Si="posthog-js";function Ti(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,l=i.sendExceptionsToPostHog,u=void 0===l||l;return e=>{var i,o,l,h,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==(l=_[0])?void 0:l.type,$exception_level:e.level,$exception_list:f,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=_[0])?void 0:h.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),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class Ri{constructor(t,e,i,r,s,n){this.name=Si,this.setupOnce=function(o){o(Ti(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Pi{constructor(t){this.li=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ue.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.ui=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.hi()}hi(){var t;this.di=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.li)}destroy(){var t;null==(t=this.di)||t.call(this),this.di=void 0}doPageView(e,i){var r,s=this.vi(e,i);return this.ui={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.vi(t,null==(e=this.ui)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ui)?void 0:t.pageViewId}}vi(t,e){var i=this.ui;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,l=s.maxContentHeight,u=s.lastContentY,h=s.maxContentY;if(!(L(n)||L(o)||L(a)||L(l)||L(u)||L(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?tt(o/n,0,1,ue):1,v=n>1?tt(a/n,0,1,ue):1,c=l>1?tt(u/l,0,1,ue):1,_=l>1?tt(h/l,0,1,ue):1;r=Xe(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:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$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"],Oi={[ce]:{exposure:"hidden"},[fe]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[ge]:{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"},[me]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[we]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[ye]:{exposure:"hidden"},[be]:{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"},[$e]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!B(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},$active_feature_flags:{exposure:"event",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},$feature_flag_details:{exposure:"hidden",storageGroup:"flags"},$feature_flag_payloads:{exposure:"event",storageGroup:"flags"},$feature_flag_request_id:{exposure:"event",storageGroup:"flags",volatile:!0},[xe]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"event"},$override_feature_flag_payloads:{exposure:"hidden"},$stored_person_properties:{exposure:"hidden"},$stored_group_properties:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[Ee]:{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"},[Se]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},$feature_flag_errors:{exposure:"hidden"},[Te]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Re]:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[ke]:{exposure:"hidden"},[Oe]:{exposure:"hidden"},[Ie]:{exposure:"hidden"},[Me]:{exposure:"hidden"},[Ae]:{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"},[Ue]:{exposure:"event"},[Ne]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Ii=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Mi=t=>{var e=Oi[t];if(e)return e;for(var i of Ii){var r=i[1];if(0===t.indexOf(i[0]))return r}},Ai=(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},Ci=t=>{var e=null==r?void 0:r.createElement("a");return L(e)?null:(e.href=t,e)},Di=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(!U(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){ue.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ui=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],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");U(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},Ni="https?://(.*)",Bi=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Fi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Bi],Li="<masked>",zi=["li_fat_id"];function ji(t,e){var i=Fi.concat(e||[]),r={};return Ke(i,(function(e){var i=Di(t,e);r[e]=i||null})),r}function qi(t){var e=function(t){return t?0===t.search(Ni+"google.([^/?]*)")?"google":0===t.search(Ni+"bing.com")?"bing":0===t.search(Ni+"yahoo.com")?"yahoo":0===t.search(Ni+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!q(e)){s.$search_engine=e;var n=r?Di(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function Hi(){return navigator.language||navigator.userLanguage}var Gi="$direct";function Wi(){return(null==r?void 0:r.referrer)||Gi}function Vi(t,e,i){void 0===i&&(i=!1);var r=t?[...Bi,...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:Wi().substring(0,1e3),u:o?Ui(o,r,Li):void 0}}function Yi(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==Gi?Gi:null==(i=Ci(r))?void 0:i.host};if(n){o.$current_url=n;var a=Ci(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=ji(n);Xe(o,l)}if(r){var u=qi(r);Xe(o,u)}return o}function Ji(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Ki(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Xi={flags:Te,surveys:Ee},Qi=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Zi="main";class tr{constructor(e,i,r){if(void 0===r&&(r=!0),this.ci={},this.fi=!1,this.pi=!1,this.Pe=e,this.gi=r,this.props={},this.mi=void 0,this.yi=(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.ii=this.bi(e),this.pi=this.wi(e),this.load(),e.debug&&ue.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();ii(t,"beforeunload",s,{capture:!1}),ii(t,"pagehide",s,{capture:!1})}}xi(){var t,e=null==(t=this.Pe)?void 0:t.persistence_save_debounce_ms;return G(e)&&e>0?e:0}isDisabled(){return!!this.ki}bi(e){-1===Qi.indexOf(e.persistence.toLowerCase())&&(ue.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=[...fi,...e];return p({},pi,{H(t){try{var e={};try{e=ci.H(t)||{}}catch(t){}var r,s=JSON.parse(pi.q(t)||"{}");if(i){var n={};for(var o in e){var a=e[o];q(a)||""===a||(n[o]=a)}r=Xe(s,n)}else r=Xe(e,s);return pi.A(t,r),r}catch(t){}return null},A(t,e,i,s,n,o){var a=pi.A(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t])})),Object.keys(l).length&&ci.A(t,l,i,s,n,o)}catch(t){pi.j(t)}return a},F(e,i){try{null==t||t.localStorage.removeItem(e),ci.F(e,i)}catch(t){pi.j(t)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&pi.P()?(i=pi,s=!0):"localstorage+cookie"===n&&r.P()?(i=r,s=!0):"sessionstorage"===n&&yi.P()?i=yi:"memory"===n?i=mi:"cookie"===n?i=ci:r.P()?(i=r,s=!0):i=ci,this.fi=s,i}Si(t){return this.yi+"__"+t}wi(t){return this.fi&&!!t.split_storage}_isFeatureFlagCacheStale(t){var e=null!=t?t:this.Pe.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[Te];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return Ke(this.props,((e,i)=>{var r=Mi(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===$e?()=>this._isFeatureFlagCacheStale():()=>!1))return;r.transformToEventProperties&&Xe(t,r.transformToEventProperties(e))}else if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,(()=>!1)))return;t[i]=e}})),t}load(){if(!this.ki){var t=this.ii.H(this.yi);t&&(this.props=Xe({},t)),this.pi&&this.Mi()}}Mi(){for(var t of ki){var e=pi.H(this.Si(t));if(e&&!F(e)){var i=this.Ti(t);i.persisted=!0,this.Ei(t)||(i.fingerprint=this.Ii(e,t)),this.Pi(t,e)||Xe(this.props,e)}}}Ei(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Mi(e))?void 0:i.storageGroup)===t}))}Pi(t,e){var i=Xi[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.ki){var i=this.pi?null==(e=Mi(t))?void 0:e.storageGroup:void 0,r=i?pi.H(this.Si(i)):this.ii.H(this.yi);if(r&&t in r)this.Ri(t,r[t]);else{if(i){var s=this.ii.H(this.yi);if(s&&t in s)return void this.Ri(t,s[t])}this.Li(t)}}}save(){if(!this.ki){var t=this.xi();t>0?L(this.Oi)&&(this.Oi=setTimeout((()=>{this.Oi=void 0,this.Fi()}),t)):this.Fi()}}flush(){L(this.Oi)||(clearTimeout(this.Oi),this.Oi=void 0,this.Fi())}Fi(){this.ki||(this.pi?this.Ai():this.Di(this.ii,this.yi,this.props,Zi))}Ai(){var t=this.$i(),e=t.main,i=t.groups;for(var r of(this.Di(this.ii,this.yi,e,Zi),ki)){var s,n=i[r];(!F(n)||null!=(s=this.ci[r])&&s.persisted)&&this.Di(pi,this.Si(r),n,r)}}$i(){var t={},e={flags:{},surveys:{}};return Ke(this.props,((i,r)=>{var s,n=null==(s=Mi(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ii(t,e){if(e===Zi)return JSON.stringify(t)+"|"+this.Ni+"|"+this.qi+"|"+this.ji;var i={};return Ke(t,((t,e)=>{var r;i[e]=null!=(r=Mi(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}Di(t,e,i,r){var s=this.Ti(r);if(r===Zi||s.dirty||L(s.fingerprint)){var n;try{if((n=this.Ii(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0}t.A(e,i,this.Ni,this.qi,this.ji,this.Pe.debug)?(s.dirty=!1,r!==Zi&&(s.persisted=!0),L(n)||(s.fingerprint=n)):this.Pe.debug&&ue.warn('failed to persist storage entry "'+e+'"; will retry on next save')}}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(L(this.Oi)||(clearTimeout(this.Oi),this.Oi=void 0),this.ii.F(this.yi,!1),this.ii.F(this.yi,!0),!i&&this.gi)for(var r of ki)pi.F(this.Si(r));i?delete this.ci[Zi]:this.ci={}}clear(){this.remove(),this.props={}}register_once(t,e,i){if(B(t)){L(e)&&(e="None"),this.Ni=L(i)?this.Bi:i;var r=!1;if(Ke(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Ri(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(B(t)){this.Ni=L(e)?this.Bi:e;var i=!1;if(Ke(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.Ri(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Li(t),this.save())}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this.mi){var e=function(t,e,i){if(!r)return{};var s,n=e?[...Bi,...i||[]]:[],o=ji(Ui(r.URL,n,Li),t),a=(s={},Ke(zi,(function(t){var e=ri(t);s[t]=e||null})),s);return Xe(a,o)}(this.Pe.custom_campaign_params,this.Pe.mask_personal_data_properties,this.Pe.custom_personal_data_properties);F(Ze(e))||this.register(e),this.mi=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?qi(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Wi(),$referring_domain:null!=r&&r.referrer&&(null==(t=Ci(r.referrer))?void 0:t.host)||Gi},void 0)}set_initial_person_info(){this.props[Oe]||this.props[Ie]||this.register_once({[Me]:Vi(this.Pe.mask_personal_data_properties,this.Pe.custom_personal_data_properties,this.Pe.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Ke([Ie,Oe],(e=>{var i=this.props[e];i&&Ke(i,(function(e,i){t["$initial_"+M(i)]=e}))}));var e=this.props[Me];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=Yi(t,e),r={};return Ke(i,(function(t,e){r["$initial_"+M(e)]=t})),r}(e,this.Pe.disable_capture_url_hashes);Xe(t,i)}return t}safe_merge(t){return Ke(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){this.Bi=this.Ni=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var r=t.persistence!==e.persistence||!((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||[]),s=r?this.bi(t):this.ii,n=this.wi(t);if(r||n!==this.pi){var o=this.props;this.clear(),this.ii=s,this.pi=n,this.props=o,this.save()}}set_disabled(t){this.ki=t,this.ki?this.remove():this.save()}set_cross_subdomain(t){t!==this.qi&&(this.qi=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ji&&(this.ji=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[ge]||{};i[t]=e,this.Ri(ge,i),this.save()}remove_event_timer(t){var e=this.props[ge]||{},i=e[t];return L(i)||(delete e[t],this.Ri(ge,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Ri(t,e),this.save()}Ri(t,e){var i;this.props[t]=e,null!=(i=Mi(t))&&i.volatile||this.Hi(t)}Li(t){delete this.props[t],this.Hi(t)}Hi(t){var e,i=null==(e=Mi(t))?void 0:e.storageGroup;i&&(this.Ti(i).dirty=!0)}Ti(t){return this.ci[t]||(this.ci[t]={})}}function er(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&N(i.then)&&i.then(void 0,(()=>{}))}}}}var ir={GZipJS:"gzip-js",Base64:"base64"},rr={Activation:"events",Cancellation:"cancelEvents"},sr={Button:"button",Tab:"tab",Selector:"selector"},nr={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"},or={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},ar={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},lr={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},ur={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},hr={Once:"once",Recurring:"recurring",Always:"always"},dr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},vr={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"},cr={Popover:"popover",Inline:"inline"},_r={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},pr={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"},gr=he("[RateLimiter]");class mr{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=>{gr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void gr.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(ke))&&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 l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var u=(G(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this.Ui(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(ke,a),{isRateLimited:l,remainingTokens:a.tokens}}zi(t){var e=this.instance.config.property_denylist;return!U(e)||!e.includes(t)}Wi(){var t;if(this.zi("$current_url")&&this.zi("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}Ui(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Wi(),o=this.zi("$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 wr=he("[RemoteConfig]");class yr{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}Vi(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()}Zi(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 wr.info("Using preloaded remote config",this.remoteConfig),this.Gi(this.remoteConfig),void this.Qi();if(this._instance._shouldDisableFlags())return void wr.warn("Remote config is disabled. Falling back to local config.");this.Vi((t=>{if(!t)return wr.info("No config found after loading remote JS config. Falling back to JSON."),void this.Zi((t=>{this.Gi(t.json,t),this.Qi()}));this.Gi(t),this.Qi()}))}catch(t){wr.error("Error loading remote config",t),this.Gi()}}stop(){this.Ki&&(clearInterval(this.Ki),this.Ki=void 0)}refresh(){!this._instance._shouldDisableFlags()&&r&&"hidden"!==r.visibilityState&&this._instance.reloadFeatureFlags()}Qi(){var t;if(!this.Ki){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Ki=setInterval((()=>{this.refresh()}),e))}}Gi(t,e){!t&&e&&(0===e.statusCode?e.error||wr.warn("Failed to fetch remote config from PostHog."):wr.error("Failed to fetch remote config from PostHog."));try{this._instance.Gi(t?{ok:!0,config:t}:{ok:!1})}catch(t){wr.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){wr.error("Error loading feature flags",t)}}}var br=["fatal","error","warning","log","info","debug"],$r=Uint8Array,xr=Uint16Array,Er=Uint32Array,Sr=new $r([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]),Tr=new $r([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]),Rr=new $r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pr=function(t,e){for(var i=new xr(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Er(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]},kr=Pr(Sr,2),Or=kr[1];kr[0][28]=258,Or[258]=28;for(var Ir=Pr(Tr,0)[1],Mr=new xr(32768),Ar=0;32768>Ar;++Ar){var Cr=(43690&Ar)>>>1|(21845&Ar)<<1;Mr[Ar]=((65280&(Cr=(61680&(Cr=(52428&Cr)>>>2|(13107&Cr)<<2))>>>4|(3855&Cr)<<4))>>>8|(255&Cr)<<8)>>>1}var Dr=function(t,e,i){for(var r=t.length,s=0,n=new xr(e);r>s;++s)++n[t[s]-1];var o,a=new xr(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new xr(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[Mr[d]>>>l]=u}else for(o=new xr(r),s=0;r>s;++s)o[s]=Mr[a[t[s]-1]++]>>>15-t[s];return o},Ur=new $r(288);for(Ar=0;144>Ar;++Ar)Ur[Ar]=8;for(Ar=144;256>Ar;++Ar)Ur[Ar]=9;for(Ar=256;280>Ar;++Ar)Ur[Ar]=7;for(Ar=280;288>Ar;++Ar)Ur[Ar]=8;var Nr=new $r(32);for(Ar=0;32>Ar;++Ar)Nr[Ar]=5;var Br=Dr(Ur,9,0),Fr=Dr(Nr,5,0),Lr=function(t){return(t/8>>0)+(7&t&&1)},zr=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof xr?xr:t instanceof Er?Er:$r)(i-e);return r.set(t.subarray(e,i)),r},jr=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},qr=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Hr=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 $r(0),0];if(1==s){var o=new $r(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],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new xr(v+1),_=Gr(i[h-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 $r(c),_]},Gr=function(t,e,i){return-1==t.s?Math.max(Gr(t.l,e,i+1),Gr(t.r,e,i+1)):e[t.s]=i},Wr=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new xr(++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]},Vr=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Yr=function(t,e,i){var r=i.length,s=Lr(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)},Jr=function(t,e,i,r,s,n,o,a,l,u,h){jr(e,h++,i),++s[256];for(var d=Hr(s,15),v=d[0],c=d[1],_=Hr(n,15),p=_[0],f=_[1],g=Wr(v),m=g[0],w=g[1],y=Wr(p),b=y[0],x=y[1],E=new xr(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=Hr(E,7),R=T[0],P=T[1],k=19;k>4&&!R[Rr[k-1]];--k);var O,I,M,A,C=u+5<<3,D=Vr(s,Ur)+Vr(n,Nr)+o,U=Vr(s,v)+Vr(n,p)+o+14+3*k+Vr(E,R)+(2*E[16]+3*E[17]+7*E[18]);if(D>=C&&U>=C)return Yr(e,h,t.subarray(l,l+u));if(jr(e,h,1+(D>U)),h+=2,D>U){O=Dr(v,c,0),I=v,M=Dr(p,f,0),A=p;var N=Dr(R,P,0);for(jr(e,h,w-257),jr(e,h+5,x-1),jr(e,h+10,k-4),h+=14,S=0;k>S;++S)jr(e,h+3*S,R[Rr[S]]);h+=3*k;for(var B=[m,b],F=0;2>F;++F){var L=B[F];for(S=0;L.length>S;++S)jr(e,h,N[z=31&L[S]]),h+=R[z],z>15&&(jr(e,h,L[S]>>>5&127),h+=L[S]>>>12)}}else O=Br,I=Ur,M=Fr,A=Nr;for(S=0;a>S;++S)if(r[S]>255){var z;qr(e,h,O[257+(z=r[S]>>>18&31)]),h+=I[z+257],z>7&&(jr(e,h,r[S]>>>23&31),h+=Sr[z]);var j=31&r[S];qr(e,h,M[j]),h+=A[j],j>3&&(qr(e,h,r[S]>>>5&8191),h+=Tr[j])}else qr(e,h,O[r[S]]),h+=I[r[S]];return qr(e,h,O[256]),h+I[256]},Kr=new Er([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Xr=function(){for(var t=new Er(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Qr=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Zr(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=Xr[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new $r(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=Yr(l,u,t.subarray(h,d)):(l[h]=!0,u=Yr(l,u,t.subarray(h,o)))}else{for(var v=Kr[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new xr(32768),g=new xr(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 Er(25e3),x=new xr(288),E=new xr(32),S=0,T=0,R=(h=0,0),P=0,k=0;o>h;++h){var O=y(h),I=32767&h,M=g[O];if(f[I]=M,g[O]=I,h>=P){var A=o-h;if((S>7e3||R>24576)&&A>423){u=Jr(t,l,0,b,x,E,T,R,k,h-k,u),R=S=T=0,k=h;for(var C=0;286>C;++C)x[C]=0;for(C=0;30>C;++C)E[C]=0}var D=2,U=0,N=_,B=I-M&32767;if(A>2&&O==y(h-B))for(var F=Math.min(c,A)-1,L=Math.min(32767,h),z=Math.min(258,A);L>=B&&--N&&I!=M;){if(t[h+D]==t[h+D-B]){for(var j=0;z>j&&t[h+j]==t[h+j-B];++j);if(j>D){if(D=j,U=B,j>F)break;var q=Math.min(B,j-2),H=0;for(C=0;q>C;++C){var G=h-B+C+32768&32767,W=G-f[G]+32768&32767;W>H&&(H=W,M=G)}}}B+=(I=M)-(M=f[I])+32768&32767}if(U){b[R++]=268435456|Or[D]<<18|Ir[U];var V=31&Or[D],Y=31&Ir[U];T+=Sr[V]+Tr[Y],++x[257+V],++E[Y],P=h+D,++S}else b[R++]=t[h],++x[t[h]]}}u=Jr(t,l,!0,b,x,E,T,R,k,h-k,u)}return zr(a,0,r+Lr(u)+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,l)),h=u.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&&Qr(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)}}(u,e),Qr(u,h-8,i.d()),Qr(u,h-4,r),u}var ts=!!o||!!n,es="text/plain",is=!1,rs=(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:"")},ss=function(t,e,i){var r;void 0===i&&(i=!0);var s=t.split("?"),n=s[0],o=s[1],a=p({},e),l=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:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return Ke(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 u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},ns=t=>{if(t.Yi)return t.Yi;var e=t.data,i=t.compression;if(e){if(i===ir.GZipJS){var r=Zr(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new $r(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 $r(s+8+(i-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return zr(r,0,s)}(Ai(e)),{mtime:0});return{contentType:es,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===ir.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(Ai(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Ai(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Ai(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},os=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:ss(t.url,{compression:ir.Base64}),encodedBody:ns(p({},t,{compression:ir.Base64,Yi:void 0}))}:{url:rs(t.url,"compression"),encodedBody:ns(p({},t,{compression:void 0,Yi:void 0}))};try{e=ns(t)}catch(e){if(E(t.compression,Di(t.url,"compression")))return ue.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&E(t.compression,Di(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?x(new Uint8Array(i)):ArrayBuffer.isView(i)&&x(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(is=!0,r()):{url:t.url,encodedBody:e}},as=t=>{try{return os(t)}catch(e){return ue.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},ls=function(){var t=_((function*(t){var e=Ai(t.data),i=yield function(t,e,i){return P.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{Yi:{contentType:es,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),us=/Failed to fetch|NetworkError|Load failed/i,hs=t=>{var e=as(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,l=s.body,u=s.estimatedSize,h=new Headers;Ke(t.headers,(function(t,e){h.append(e,t)})),o&&h.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)||(t=>"TypeError"===(null==t?void 0:t.name)&&us.test((null==t?void 0:t.message)||""))(e)?ue.warn(e):ue.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:h,keepalive:"POST"===t.method&&!t.Xi&&52428.8>(u||0),body:l,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){ue.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=os(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(i.sendBeacon(s,u))return;var h=U(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(U(h)&&h.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(h.length/2),v=e=>U(t.data)?e:p({},t.data,{batch:e});return ds(p({},t,{data:v(h.slice(0,d))})),void ds(p({},t,{data:v(h.slice(d))}))}ue.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),hs(p({},t,{Xi:!0}))}catch(t){ue.warn("Beacon send failed",t)}},vs=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return ss(i===ir.GZipJS?rs(t,"compression"):t,p({},s?{[s]:Date.now().toString()}:{},i===ir.GZipJS?{}:{compression:i}))},cs=[];n&&cs.push({transport:"fetch",method:hs}),o&&cs.push({transport:"XHR",method(t){var e=as(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;Ke(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&&cs.push({transport:"sendBeacon",method:ds});var _s=3e3;class ps{constructor(t,e){this.tr=!0,this.er=[],this.ir=tt((null==e?void 0:e.flush_interval_ms)||_s,250,5e3,ue.createLogger("flush interval"),_s),this.rr=t}enqueue(t){this.er.push(t),this.nr||this.sr()}unload(){this.ar();var t=this.er.length>0?this.lr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.ur(p({},t,{transport:"sendBeacon"}))}))}enable(){this.tr=!1,this.sr()}sr(){var t=this;this.tr||(this.nr=setTimeout((()=>{if(this.ar(),this.er.length>0){var e=this.lr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&U(i.data)&&Ke(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.ur(i)};for(var r in e)i()}}),this.ir))}ur(t){try{this.rr(t)}catch(t){ue.error(t)}}ar(){clearTimeout(this.nr),this.nr=void 0}lr(){var t={};return Ke(this.er,(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.er=[],t}}var fs=["retriesPerformedSoFar"];class gs{constructor(e){this.hr=!1,this.dr=3e3,this.er=[],this._instance=e,this.er=[],this.vr=!0,!L(t)&&"onLine"in t.navigator&&(this.vr=t.navigator.onLine,this.cr=()=>{this.vr=!0,this.pr()},this.gr=()=>{this.vr=!1},ii(t,"online",this.cr),ii(t,"offline",this.gr))}get length(){return this.er.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,fs);W(e)&&(i.url=ss(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.Lt(p({retriesPerformedSoFar:e},i));0===t.statusCode&&ue.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)}}))}Lt(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.er.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),ue.warn(s),this.hr||(this.hr=!0,this.mr())}mr(){if(this.yr&&clearTimeout(this.yr),0===this.er.length)return this.hr=!1,void(this.yr=void 0);this.yr=setTimeout((()=>{this.vr&&this.er.length>0&&this.pr(),this.mr()}),this.dr)}pr(){var t=Date.now(),e=[],i=this.er.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.er=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.yr&&(clearTimeout(this.yr),this.yr=void 0),this.hr=!1,L(t)||(this.cr&&(t.removeEventListener("online",this.cr),this.cr=void 0),this.gr&&(t.removeEventListener("offline",this.gr),this.gr=void 0)),this.er)){var i=e.requestOptions;try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){ue.error(t)}}this.er=[]}}class ms{constructor(t){this.br=()=>{var t,e,i,r;this._r||(this._r={});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),l=(null==s?void 0:s.scrollHeight)||0;this._r.lastScrollY=Math.ceil(n),this._r.maxScrollY=Math.max(n,null!==(t=this._r.maxScrollY)&&void 0!==t?t:0),this._r.maxScrollHeight=Math.max(o,null!==(e=this._r.maxScrollHeight)&&void 0!==e?e:0),this._r.lastContentY=a,this._r.maxContentY=Math.max(a,null!==(i=this._r.maxContentY)&&void 0!==i?i:0),this._r.maxContentHeight=Math.max(l,null!==(r=this._r.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get wr(){return this._instance.config.scroll_root_selector}getContext(){return this._r}resetContext(){var t=this._r;return setTimeout(this.br,0),t}startMeasuringScrollPosition(){ii(t,"scroll",this.br,{capture:!0}),ii(t,"scrollend",this.br,{capture:!0}),ii(t,"resize",this.br)}scrollElement(){if(!this.wr)return null==t?void 0:t.document.documentElement;var e=U(this.wr)?this.wr:[this.wr];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}kr(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.wr){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.kr("y")}scrollX(){return this.kr("x")}}var ws=t=>Vi(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 ys{constructor(t,e,i,r){this.Sr=t=>{var e=this.Cr();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Mr(this._instance)};this.Tr.register({[Pe]:i})}},this._instance=t,this.Er=e,this.Tr=i,this.Mr=r||ws,this.Er.onSessionId(this.Sr)}Cr(){return this.Tr.props[Pe]}getSetOnceProps(){var t,e=null==(t=this.Cr())?void 0:t.props;return e?"r"in e?Yi(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 Ke(Ze(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+M(i)]=e})),t}}class bs{on(t,e){return this.Ir[t]||(this.Ir[t]=[]),this.Ir[t].push(e),()=>{this.Ir[t]=this.Ir[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Ir[t]||[])i(e);for(var r of this.Ir["*"]||[])r(t,e)}constructor(){this.Ir={}}}var $s=he("[SessionId]");class xs{on(t,e){return this.Pr.on(t,e)}constructor(t,e,i){var r;if(this.Rr=null,this.Lr=[],this.Or=void 0,this.Fr=!1,this.Pr=new bs,this.Ar=(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===Fe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Pe=t.config,this.Tr=t.persistence,this.Dr=void 0,this.$r=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Nr=e||ui,this.qr=i||ui;var s=this.Pe.persistence_name||this.Pe.token;if(this._sessionTimeoutMs=1e3*tt(this.Pe.session_idle_timeout_seconds||1800,60,36e3,$s.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.jr(),this.Br="ph_"+s+"_window_id",this.Hr="ph_"+s+"_primary_window_exists",this.Ur()){var n=yi.H(this.Br),o=yi.H(this.Hr);n&&!o?this.Dr=n:yi.F(this.Br),yi.A(this.Hr,!0)}if(null!=(r=this.Pe.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Pe.bootstrap.sessionID.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)})();this.zr(this.Pe.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){$s.error("Invalid sessionID in bootstrap",t)}this.Wr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return L(this.Lr)&&(this.Lr=[]),this.Lr.push(t),this.$r&&t(this.$r,this.Dr),()=>{this.Lr=this.Lr.filter((e=>e!==t))}}Ur(){return"memory"!==this.Pe.persistence&&!this.Tr.ki&&yi.P()}Vr(t){t!==this.Dr&&(this.Dr=t,this.Ur()&&yi.A(this.Br,t))}Zr(){return this.Dr?this.Dr:this.Ur()?yi.H(this.Br):null}Gr(t){var e=this.Rr;return!q(e)&&!q(t)&&5e3>Math.abs(t-e)}zr(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.$r||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.$r=t,s&&!r||s&&this.Gr(e)||(this.Rr=e,this.Tr.register({[ye]:[e,t,i]}))}Qr(){var t,e=null==(t=this.Pe)?void 0:t.persistence_save_debounce_ms;return W(e)&&e>0}Jr(){this.Qr()?this.Tr.refreshKey(ye):(this.Tr.flush(),this.Tr.load())}Kr(){var t;if(!q(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Rr){this.Jr();var e=this.Yr();e[1]===this.$r&&e[2]===this._sessionStartTimestamp&&(this.Rr=this._sessionActivityTimestamp,this.Tr.register({[ye]:[this._sessionActivityTimestamp,null!==(t=this.$r)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Tr.flush())}}Xr(){var t=this.Yr()[0],e=W(t)?t:0,i=W(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}tn(t){return this.Jr(),this.Ar(t,this.Xr())}Yr(){var t=this.Tr.props[ye];return U(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Rr=null,clearTimeout(this.en),this.en=void 0,this.zr(null,null,null)}destroy(){this.Fr=!0,this.Kr(),clearTimeout(this.en),this.en=void 0,this.Or&&t&&(t.removeEventListener(He,this.Or,{capture:!1}),this.Or=void 0),this.Lr=[]}Wr(){this.Or=()=>{this.Kr(),this.Ur()&&yi.F(this.Hr)},ii(t,He,this.Or,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Pe.cookieless_mode===Fe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),r=this.Yr(),s=r[1],n=r[2],o=this.Xr(),a=this.Zr(),l=W(n)&&Math.abs(i-n)>864e5,u=!1,h=!1,d=!s,v=s,c=!d&&!t&&this.Ar(i,o);if(c){(c=this.tn(i))||$s.info("cross-tab refresh kept the session alive",{sessionId:s});var _=this.Yr();s=_[1],n=_[2]}d||c||l?(s=this.Nr(),a=this.qr(),$s.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l}}),n=i,u=!0):(a||(a=this.qr(),u=!0),(h=s!==v)&&($s.info("adopted cross-tab session id",{sessionId:s,windowId:a}),u=!0));var p=W(o)&&t&&!l?o:i,f=W(n)?n:(new Date).getTime();this.Vr(a),this.zr(s,p,f),t||this.jr();var g={noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l,crossTabAdoption:h};return u&&this.Lr.forEach((t=>t(s,a,g))),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:u?g:void 0,lastActivityTimestamp:o}}jr(){this.Fr||(clearTimeout(this.en),this.en=setTimeout((()=>{if(!this.Fr)if(this.tn((new Date).getTime())){var t=this.$r;this.resetSessionId(),this.Pr.emit("forcedIdleReset",{idleSessionId:t})}else this.jr()}),1.1*this.sessionTimeoutMs))}}function Es(){return(Es=_((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 z(r)&&r.length>0?r:void 0}catch(t){return void ue.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ss(t,e,i){return Ai({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Ts="custom",Rs="i.posthog.com",Ps=/^\/static\//;class ks{constructor(t){this.rn={},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("."+Rs,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.rn[this.apiHost]||(this.rn[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":Ts),this.rn[this.apiHost]}nn(t){if(Ps.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.nn(e);if(i)return""+i+e}if(this.region===Ts)return this.apiHost+e;var r=Rs+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var Os=he("[Surveys]"),Is={ignoreConditions:!1,ignoreDelay:!1,displayType:cr.Popover},Ms=he("[PostHog ExternalIntegrations]"),As={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Cs{constructor(t){this._instance=t}ai(t,e){var i;null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Ms.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.ai(As[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 Ds{constructor(t,e){this.rt=t,this.sn=e,this.an=new Map,this.ln=!1}add(t){var e=this;return _((function*(){if(e.ln)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.an.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.an.set(t.name,t);try{var i=t.setup(e.sn);i&&(yield i)}catch(i){var r=e.an.get(t.name)===t;r&&e.an.delete(t.name),e.rt.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.un(t)}}))()}dispose(){if(!this.ln){this.ln=!0;var t=Array.from(this.an.values()).reverse();for(var e of(this.an.clear(),t))this.un(e)}}un(t){try{var e=null==t.dispose?void 0:t.dispose();e&&N(e.then)&&e.then(void 0,(e=>{this.rt.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.rt.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class Us{constructor(t){this._instance=t}get(t){var e;return null==(e=this._instance.persistence)?void 0:e.get_property(t)}set(t,e){var i;null==(i=this._instance.persistence)||i.set_property(t,e)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var Ns="extensionsRemoteConfig";class Bs{constructor(t){this.ln=!1,this.instance=t,this.rt=ue.createLogger("[BrowserExtensions]"),this.hn=t.dn,this.kv=new Us(t),this.onEvent=t=>er(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.rt.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.ln)return er((()=>{}));var e=e=>{try{t(e)}catch(t){this.rt.error("Browser extension remote config listener failed",t)}},i=this.instance._internalEventEmitter.on(Ns,e);return this.hn&&e(this.hn),er(i)},this.cn=new Ds(this.rt,this)}get logger(){return this.rt}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(_e))&&void 0!==t?t:this.distinctId}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.cn.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.fn(t))}handleRemoteConfig(t){this.ln||(this.hn=t,this.instance._internalEventEmitter.emit(Ns,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?ss(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.ln||(this.ln=!0,this.cn.dispose())}}var Fs,Ls={},zs=0,js=()=>{},qs='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Hs="Surveys module not available",Gs="sanitize_properties is deprecated. Use before_send instead",Ws="Invalid value for property_denylist config: ",Vs=["token","distinct_id",De],Ys="posthog",Js=!ts&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),Ks=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:ei(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:js,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&&z(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:!1,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){ue.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:je,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:_s},error_tracking:{},_onCapture:js},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:$i,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)}))(e))},Xs=[["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"]],Qs=t=>{var e={};for(var i of Xs){var r=i[0],s=i[1];L(t[r])||(e[s]=t[r])}var n=Xe({},e,t),o=t.__preview_external_dependency_versioned_paths;return L(o)||(L(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),z(o)&&L(t.asset_host)&&(n.asset_host=o)),U(t.property_blacklist)&&(L(t.property_denylist)?n.property_denylist=t.property_blacklist:U(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ue.error(Ws+t.property_denylist)),n};class Zs{constructor(){this.__forceAllowLocalhost=!1}get pn(){return this.__forceAllowLocalhost}set pn(t){ue.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class tn{gn(t,e){if(t){var i=this.an.indexOf(t);-1!==i&&this.an.splice(i,1)}return this.an.push(e),null==e.initialize||e.initialize(),e}mn(){return this.config.cookieless_mode===Fe||this.config.cookieless_mode===Be&&this.consent.isRejected()}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 Zs,this.yn=!1,this.version=v.LIB_VERSION,this._internalEventEmitter=new bs,this.an=[],this.bn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ks(),this.SentryIntegration=Ri,this.sentryIntegration=t=>function(t,e){var i=Ti(t,e);return{name:Si,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._n=!1,this.wn=null,this.xn=null,this.kn=null,this.scrollManager=new ms(this),this.pageViewManager=new Pi(this),this.rateLimiter=new mr(this),this.requestRouter=new ks(this),this.consent=new bi(this),this.externalIntegrations=new Cs(this);var e=null!==(t=tn.__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=z(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=z(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>ue.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Ys){var r,s=null!==(r=Ls[i])&&void 0!==r?r:new tn;return s._init(t,e,i),Ls[i]=s,Ls[Ys][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o,a=z(e)?e.trim():"";if(!a)return ue.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=Ks(i.defaults),i.debug=this.Sn(i.debug),this.Cn=i,this.Mn=[],i.person_profiles?this.xn=i.person_profiles:i.process_person&&(this.xn=i.process_person);var l=Ks(i.defaults),u=Qs(i),h=Xe({},l,u,{name:r,token:a});B(l.rageclick)&&B(u.rageclick)&&(h.rageclick=Xe({},l.rageclick,u.rageclick)),B(l.session_recording)&&B(u.session_recording)&&(h.session_recording=Xe({},l.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&ue.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ir.GZipJS;var d=this.Tn();this.persistence=new tr(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new tr(p({},this.config,{persistence:"sessionStorage"}),d,!1);var c=p({},this.persistence.props),_=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.En=new ps((t=>this.In(t)),this.config.request_queue_config),this.Pn=new gs(this),this.__request_queue=[];var f=this.mn();if(f||(this.sessionManager=new xs(this),this.sessionPropsManager=new ys(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(ue.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Rn(f)}),0)):(ue.info("Initializing extensions synchronously"),this.Rn(f)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&ue.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:c,s:_}),!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 g=i.bootstrap.distinctID,m=this.get_distinct_id(),w=this.persistence.get_property(Re);if(i.bootstrap.isIdentifiedID&&null!=m&&m!==g&&w===Le)this.identify(g);else if(i.bootstrap.isIdentifiedID&&null!=m&&m!==g&&w===ze)ue.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var y=this.config.get_device_id(ui()),b=i.bootstrap.isIdentifiedID?y:g;this.persistence.set_property(Re,i.bootstrap.isIdentifiedID?ze:Le),this.register({distinct_id:g,$device_id:b})}}if(f)this.register_once({distinct_id:Ce,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(ui());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(Re,Le)}return ii(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()||ui();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Re,ze)),e()},s=i.user();"then"in s&&N(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Ei.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()||(Ei.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Ei.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,Ge),identify:t=>e(t,Ve),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.Ln())):this.Ln(),N(this.config._onCapture)&&this.config._onCapture!==js&&(ue.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&ue.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 Es.apply(this,arguments)}().then((t=>{t&&this.register({[pe]:t})})).catch(js),this}Rn(t){var e,i,r,s,n,o,a,l,u=performance.now(),h=p({},tn.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.an.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new h.featureFlags(this)),h.exceptions&&this.an.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new h.exceptions(this)),h.historyAutocapture&&this.an.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.an.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.an.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.an.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.an.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.an.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new h.surveys(this)),h.logs&&this.an.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new h.logs(this)),h.metrics&&this.an.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new h.metrics(this)),h.conversations&&this.an.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.an.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.an.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.an.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.an.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.an.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,xi)),h.toolbar&&this.an.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.an.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.an.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.On){var t=this.On;this.On=void 0,this.an.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.Fn(d,u)}Fn(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Fn(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){ue.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Ue]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ne]:r}),this.config.__preview_deferred_init_extensions&&ue.info("PostHog extensions initialized ("+r+"ms)")}Gi(t){var e;if(!r||!r.body)return ue.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Gi(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.On=t),this.dn=t,this.compression=void 0,t.ok){var i,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=I(s.supportedCompression,ir.GZipJS)?ir.GZipJS:I(s.supportedCompression,ir.Base64)?ir.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.xn?this.xn:je}),null==(e=this.An)||e.handleRemoteConfig(t),this.an.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}Ln(){try{this.config.loaded(this)}catch(t){ue.critical("`loaded` function failed",t)}if(this.Dn(),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.mn())&&this.$n()}),1),this.Nn=new yr(this),this.Nn.load()}Dn(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.En)||t.enable())}_dom_loaded(){this.is_capturing()&&Je(this.__request_queue,(t=>this.In(t))),this.__request_queue=[],this.Dn()}_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.qn()&&this.capture(We),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.En)||r.unload(),null==(s=this.Pn)||s.unload()):this.qn()&&this.capture(We,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Js?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,u,h,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&L(s.compression)&&s.data&&(s.compression=ir.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(h=(u=U(n=s.data)?n:[n])[0])||null==(a=h.properties)?void 0:a.token)&&void 0!==o?o:null==h?void 0:h.token,batch:u,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),U(t)?t.map((t=>p({},t,{sent_at:e}))):p({},t,{sent_at:e})}(s.data))),s.url=vs(s.url,s.method,s.compression,s.timestampMode);var v=cs.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");"sendBeacon"!==d&&s.data&&s.compression===ir.GZipJS&&l&&"undefined"!=typeof Promise&&!is?ls(s).then((t=>{c(t)})).catch((e=>{if(S(e))return is=!0,void c(p({},s,{compression:void 0,url:vs(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)&&(is=!0),c(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}))}In(t){this.Pn?this.Pn.retriableRequest(t):this._send_request(t)}_execute_array(t){zs++;try{var e,i=[],r=[],s=[];Je(t,(t=>{if(t)if(U(e=t[0]))s.push(t);else if(N(t))try{t.call(this)}catch(e){ue.error("Error executing queued PostHog call",t,e)}else U(t)&&"alias"===e?i.push(t):U(t)&&-1!==e.indexOf("capture")&&N(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Je(t,(function(t){try{if(U(t[0])){var i=e;Ke(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){ue.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{zs--}}push(t){if(zs>0&&U(t)&&z(t[0])){var e=tn.prototype[t[0]];N(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a,l,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.En){if(this.is_capturing())if(!L(t)&&z(t)){var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var d=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==d||!d.isRateLimited){if(this.bn.length>0){var v={};for(var c of this.bn.slice())try{Xe(v,c())}catch(t){ue.error("Failed to produce browser extension event properties",t)}e=p({},v,null!=e?e:{})}var _;null!=(r=e)&&r.$current_url&&!z(null==(s=e)?void 0:s.$current_url)&&(ue.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==(_=e)||delete _.$current_url),"$exception"!==t||null!=i&&i._originatedFromCaptureException||ue.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 f=new Date,m=(null==i?void 0:i.timestamp)||f,w=oe(null==i?void 0:i.uuid,ui),y={uuid:w,event:t,properties:this.calculateEventProperties(t,e||{},m,w)};t===Ge&&this.config.__preview_capture_bot_pageviews&&h&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),d&&(y.properties.$lib_rate_limit_remaining_tokens=d.remainingTokens);var b="$feature_flag_called"===t&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property(xe);(null==i?void 0:i.$set)&&!b&&(y.$set=null==i?void 0:i.$set);var x=null==i?void 0:i.$unset;x&&(y.$unset=x);var E,S,T,R=b?void 0:this.Bn(null==i?void 0:i.$set_once,t!==Ye,t===Ve);if(R&&(y.$set_once=R),null!=i&&i._noTruncate||(o=this.config.properties_string_max_length,a=y,l=t=>z(t)?t.slice(0,o):t,u=new Set,y=function t(e,i){if(e!==Object(e))return l?l(e):e;if(!u.has(e)){var r;if(u.add(e),U(e))r=[],Je(e,(e=>{r.push(t(e))}));else{var s={};Ke(e,((e,i)=>{u.has(e)||(s[i]=t(e,i))})),r=s}return r}}(a)),y.timestamp=m,L(null==i?void 0:i.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=f),b&&(y.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}(y.properties,Vs)),t===dr.DISMISSED||t===dr.SENT){var P,k,O=null==(P=e)?void 0:P[vr.SURVEY_ID],I=null==(k=e)?void 0:k[vr.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){Os.error("Failed to persist survey seen state",t)}})({id:O,current_iteration:I}),y.$set=p({},y.$set,{[(E={id:O,current_iteration:I},S=t===dr.SENT?"responded":"dismissed",T="$survey_"+S+"/"+E.id,E.current_iteration&&E.current_iteration>0&&(T="$survey_"+S+"/"+E.id+"/"+E.current_iteration),T)]:!0})}else t===dr.SHOWN&&(y.$set=p({},y.$set,{[vr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===pr.SHOWN){var M,A=null==(M=e)?void 0:M[fr.TOUR_TYPE];A&&(y.$set=p({},y.$set,{[fr.TOUR_LAST_SEEN_DATE+"/"+A]:(new Date).toISOString()}))}var C=p({},y.properties.$set,y.$set);if(F(C)||this.setPersonPropertiesForFlags(C),!H(this.config.before_send)){var D=this.Pt(y);if(!D)return;(y=D).uuid=oe(y.uuid,ui)}this._internalEventEmitter.emit("eventCaptured",y);var N=null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),B={method:"POST",url:N,data:y,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(N)?"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.In(B):this.En.enqueue(B),y}ue.critical("This capture call is ignored due to client rate limiting.")}}else ue.error("No event name provided to posthog.capture")}else ue.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}Hn(){var t;return null!==(t=this.An)&&void 0!==t?t:this.An=new Bs(this)}fn(t){this.bn.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.bn.indexOf(t);-1!==i&&this.bn.splice(i,1)}}}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;var l=a?void 0:this.persistence.remove_event_timer(e),h=p({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.mn()&&(h[De]=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!z(h.distinct_id)&&!G(h.distinct_id)||j(h.distinct_id))&&ue.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var c,_=function(e,i,r,n){var o,a,l,h;if(void 0===n&&(n=!1),!u)return{};var d,c=e?[...Bi,...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&&(N(r)?r(s,t):r);if(n)return n}return["",""]}(u),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==(l=t.screen)?void 0:l.width,E=null==t||null==(h=t.screen)?void 0:h.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,P,k,O,I,M,A,C=Xe(Ze({$os:p,$os_version:f,$browser:te(u,navigator.vendor,g,m),$device:se(u),$device_type:(R=u,P=w,A=se(R),A===ot||A===nt||"Kobo"===A||"Kindle Fire"===A||A===Ut?st:A===St||A===Rt||A===Tt||A===At?"Console":A===lt?"Wearable":A?et:"Android"===(null==P?void 0:P.userAgentDataPlatform)&&(null!==(k=null==P?void 0:P.maxTouchPoints)&&void 0!==k?k:0)>0?600>Math.min(null!==(O=null==P?void 0:P.screenWidth)&&void 0!==O?O:0,null!==(I=null==P?void 0:P.screenHeight)&&void 0!==I?I:0)/(null!==(M=null==P?void 0:P.devicePixelRatio)&&void 0!==M?M:1)?et:st:"Desktop"),$timezone:Ji(),$timezone_offset:Ki()}),{$current_url:Ui(n?ae(null==s?void 0:s.href):null==s?void 0:s.href,c,Li),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:ie(u,navigator.vendor,g,m),$browser_language:Hi(),$browser_language_prefix:(T=Hi(),"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&&(C.$sdk_dist_channel=v.SDK_DIST_CHANNEL),C}(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()),g=f.windowId;h.$session_id=f.sessionId,h.$window_id=g}this.sessionPropsManager&&Xe(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&Xe(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Pn)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Ts&&(h.$lib_custom_api_host=this.config.api_host),c=e!==Ge||a?e!==We||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=Xe(h,c),e===Ge&&r&&(h.title=r.title),!L(l)){var w=n.getTime()-l;h.$duration=parseFloat((w/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties();Ke(["$referrer","$referring_domain"],(t=>{t in y&&delete b[t]})),(h=Xe({},_,y,b,h)).$is_identified=this._isIdentified(),U(this.config.property_denylist)?Ke(this.config.property_denylist,(function(t){delete h[t]})):ue.error(Ws+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(ue.error(Gs),h=x(h,e));var E=this.Un();return h.$process_person_profile=E,E&&!a&&this.zn("_calculate_event_properties"),h}Bn(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Un())return t;if(this.yn&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Xe({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(ue.error(Gs),o=a(o,"$set_once")),e&&(this.yn=!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;null==(e=this.sessionPersistence)||e.register(t)}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t)}Wn(t,e){this.register({[t]:e})}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._internalEventEmitter.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:Hs}),()=>{})}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:Hs})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Hs})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Is),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:Hs}}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:Hs})}Vn(t){return!t||j(t)?(ue.critical("Unique user id has not been set in posthog.identify"),!1):t===Ce?(ue.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())||(ue.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 ue.uninitializedWarning("posthog.identify");if(G(t)&&(t=t.toString(),ue.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Vn(t)&&this.zn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(_e)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(fe)&&(this.unregister(fe),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(Re)||Le)===Le,o=t!==r,a=!o&&n;if(o&&n)this.persistence.set_property(Re,ze),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(Ve,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.kn=Ss(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r);else if(a){this.persistence.set_property(Re,ze);var l=e||{},u=i||{};this.setPersonPropertiesForFlags({$set:l,$set_once:u},!1),this.capture("$set",{$set:l,$set_once:u}),this.kn=Ss(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);o?(this.reloadFeatureFlags(),this.unregister(Se)):a&&(e||i)&&this.reloadFeatureFlags()}}setPersonProperties(t,e){if((t||e)&&this.zn("posthog.setPersonProperties")){var i=Ss(this.get_distinct_id(),t,e);this.kn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.kn=i):ue.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(U(t)?t:[t]).filter((t=>z(t)&&t.length>0));0!==i.length&&this.zn("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.kn=null)}group(t,e,i){if(t&&e){var r=this.getGroups(),s=r[t]!==e;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},r,{[t]:e})}),s||i){var n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(Ye,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),s&&!i&&this.reloadFeatureFlags()}else ue.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.zn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){this.Zn(t)}Zn(t,e){var i,r,s,n,o,a,l,u,h,d;if(void 0===e&&(e=!1),ue.info("reset"),!this.__loaded)return ue.uninitializedWarning("posthog.reset");var v,c=this.get_property(_e),_=this.get_property(pe),p=this.get_property(we),f=this.is_capturing();if(this.consent.reset(),e||!f||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."),null==(i=this.persistence)||i.clear(),null==(r=this.sessionPersistence)||r.clear(),L(p)||null==(v=this.persistence)||v.register({[we]:p}),null==(s=this.surveys)||s.reset(),null==(n=this.Nn)||n.stop(),null==(o=this.featureFlags)||o.reset(),null==(a=this.conversations)||a.reset(),null==(l=this.logs)||l.reset(),null==(u=this.metrics)||u.reset(),null==(h=this.persistence)||h.set_property(Re,Le),null==(d=this.sessionManager)||d.resetSessionId(),this.kn=null,this.config.cookieless_mode===Fe)this.register_once({distinct_id:Ce,$device_id:null},"");else{var g=this.config.get_device_id(ui());this.register_once({distinct_id:g,$device_id:t?g:c},""),t||L(_)||this.register({[pe]:_})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(t){var e=this;return _((function*(){var t,i,r,s,n,o,a;e.__loaded?(null==(t=e.Nn)||t.stop(),null==(i=e.An)||i.dispose(),null==(r=e.logs)||r.flushLogs("sendBeacon"),null==(s=e.metrics)||s.flush("sendBeacon"),null==(n=e.En)||n.unload(),null==(o=e.Pn)||o.unload(),null==(a=e.featureFlags)||a.destroy()):ue.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(ce)?(ue.critical("Attempting to create alias for existing People user - aborting."),-2):this.zn("posthog.alias")?(L(e)&&(e=this.get_distinct_id()),t!==e?(this.Wn(fe,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(ue.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,l,u,h,d,c;Xe(this.config,Qs(t));var _=this.Tn();null==(i=this.persistence)||i.update_config(this.config,e,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new tr(p({},this.config,{persistence:"sessionStorage"}),_,!1);var f=this.Sn(this.config.debug);V(f)&&(this.config.debug=f),V(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,pi.P()&&pi.A("ph_debug",!0),ue.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,pi.P()&&pi.F("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.tracingHeaders)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(h=this.deadClicksAutocapture)||h.startIfEnabledOrStop(),null==(d=this.surveys)||d.loadIfEnabled(),this.Jn(),null==(c=this.externalIntegrations)||c.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:tn.Kn}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:Ys;return e!==Ys&&(e=Ys+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Re))===ze||(null==(e=this.sessionPersistence)?void 0:e.get_property(Re))===ze}Un(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===je&&!this._isIdentified()&&F(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[fe])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ae]))}qn(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Un()||this.zn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.zn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}zn(t){return"never"===this.config.person_profiles?(ue.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Wn(Ae,!0),!0)}Tn(){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!==Be)}Jn(){var t,e,i,r,s=this.Tn();return(null==(t=this.persistence)?void 0:t.ki)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.ki)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==Fe){if(this.mn()){var i,r,s,n,o;this.Zn(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new xs(this),this.pageViewManager=new Pi(this),this.persistence&&(this.sessionPropsManager=new ys(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=tn.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.gn(this.sessionRecording,new l(this)),this.dn&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.dn)))}var u,h;this.consent.optInOut(!0),this.Jn(),this.Dn(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==Be&&(null==(u=this.surveys)||u.loadIfEnabled()),(L(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$n()}else ue.warn(qs)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==Fe?(this.config.cookieless_mode===Be&&this.consent.isOptedIn()&&this.Zn(!0,!0),this.consent.optInOut(!1),this.Jn(),this.config.cookieless_mode===Be&&(this.register({distinct_id:Ce,$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.$n(),this.Dn())):ue.warn(qs)}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===Fe||(this.config.cookieless_mode===Be?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Jn()}_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}$n(){r&&("visible"===r.visibilityState?this._n||(this._n=!0,this.capture(Ge,{title:r.title},{send_instantly:!0}),this.wn&&(r.removeEventListener(qe,this.wn),this.wn=null)):this.wn||(this.wn=this.$n.bind(this),ii(r,qe,this.wn)))}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.Cn||{};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?(ue.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,ue)}Pt(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=U(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),H(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return J(t.event)?ue.warn(o+". This can cause unexpected behavior."):ue.info(o),null}s.properties&&!F(s.properties)||ue.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(s.properties&&H(s.properties[a]))return ue.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.ui)?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)})}Sn(t){var e=V(t)&&!t,i=pi.P()&&"true"===pi.q("ph_debug");return!e&&(!!i||t)}}tn.__defaultExtensionClasses={},tn.Kn={trace:Fs=()=>{},debug:Fs,info:Fs,warn:Fs,error:Fs,fatal:Fs},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Qe(t.prototype[e[i]])}(tn,["identify"]);var en=function(){v.SDK_DIST_CHANNEL="npm";var e=Ls[Ys]=new tn;return function(){function e(){e.done||(e.done=!0,Js=!1,Ke(Ls,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():ii(r,"DOMContentLoaded",e,{capture:!1}):t&&ue.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{ir as Compression,_r as DEFAULT_PRODUCT_TOUR_APPEARANCE,cr as DisplaySurveyType,tn as PostHog,pr as ProductTourEventName,fr as ProductTourEventProperties,dr as SurveyEventName,vr as SurveyEventProperties,rr as SurveyEventType,nr as SurveyPosition,ur as SurveyQuestionBranchingType,lr as SurveyQuestionType,hr as SurveySchedule,or as SurveyTabPosition,ar as SurveyType,sr as SurveyWidgetType,en as default,en as posthog,br as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.slim.js.map
|