posthog-js 1.421.1 → 1.422.0

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.
Files changed (117) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.es5.js.map +1 -1
  5. package/dist/array.full.js +1 -1
  6. package/dist/array.full.js.map +1 -1
  7. package/dist/array.full.no-external.js +1 -1
  8. package/dist/array.full.no-external.js.map +1 -1
  9. package/dist/array.js +1 -1
  10. package/dist/array.js.map +1 -1
  11. package/dist/array.no-external.js +1 -1
  12. package/dist/array.no-external.js.map +1 -1
  13. package/dist/conversations.js +1 -1
  14. package/dist/conversations.js.map +1 -1
  15. package/dist/crisp-chat-integration.js.map +1 -1
  16. package/dist/customizations.d.ts +23 -1
  17. package/dist/customizations.full.js +1 -1
  18. package/dist/customizations.full.js.map +1 -1
  19. package/dist/customizations.js +1 -1
  20. package/dist/customizations.js.map +1 -1
  21. package/dist/dead-clicks-autocapture.js +1 -1
  22. package/dist/dead-clicks-autocapture.js.map +1 -1
  23. package/dist/default-extensions.js +1 -1
  24. package/dist/default-extensions.js.map +1 -1
  25. package/dist/exception-autocapture.js +1 -1
  26. package/dist/exception-autocapture.js.map +1 -1
  27. package/dist/extension-bundles.js +1 -1
  28. package/dist/extension-bundles.js.map +1 -1
  29. package/dist/external-scripts-loader.js.map +1 -1
  30. package/dist/intercom-integration.js.map +1 -1
  31. package/dist/lazy-recorder.js +1 -1
  32. package/dist/lazy-recorder.js.map +1 -1
  33. package/dist/logs.js +1 -1
  34. package/dist/logs.js.map +1 -1
  35. package/dist/main.d.ts +23 -1
  36. package/dist/main.js +1 -1
  37. package/dist/main.js.map +1 -1
  38. package/dist/module.d.ts +23 -1
  39. package/dist/module.full.d.ts +23 -1
  40. package/dist/module.full.js +1 -1
  41. package/dist/module.full.js.map +1 -1
  42. package/dist/module.full.no-external.d.ts +23 -1
  43. package/dist/module.full.no-external.js +1 -1
  44. package/dist/module.full.no-external.js.map +1 -1
  45. package/dist/module.js +1 -1
  46. package/dist/module.js.map +1 -1
  47. package/dist/module.no-external.d.ts +23 -1
  48. package/dist/module.no-external.js +1 -1
  49. package/dist/module.no-external.js.map +1 -1
  50. package/dist/module.slim.js +1 -1
  51. package/dist/module.slim.js.map +1 -1
  52. package/dist/module.slim.no-external.d.ts +23 -1
  53. package/dist/module.slim.no-external.js +1 -1
  54. package/dist/module.slim.no-external.js.map +1 -1
  55. package/dist/posthog-recorder.js +1 -1
  56. package/dist/posthog-recorder.js.map +1 -1
  57. package/dist/product-tours-preview.js.map +1 -1
  58. package/dist/product-tours.js +1 -1
  59. package/dist/product-tours.js.map +1 -1
  60. package/dist/recorder-v2.js +1 -1
  61. package/dist/recorder-v2.js.map +1 -1
  62. package/dist/recorder.js +1 -1
  63. package/dist/recorder.js.map +1 -1
  64. package/dist/rrweb-plugin-console-record.js +1 -1
  65. package/dist/rrweb-plugin-console-record.js.map +1 -1
  66. package/dist/rrweb.js +1 -1
  67. package/dist/rrweb.js.map +1 -1
  68. package/dist/src/constants.d.ts +1 -0
  69. package/dist/src/extensions/replay/external/lazy-loaded-session-recorder.d.ts +1 -0
  70. package/dist/src/extensions/replay/external/mutation-throttler.d.ts +1 -0
  71. package/dist/src/logs-types.d.ts +24 -0
  72. package/dist/src/posthog-logs.d.ts +24 -1
  73. package/dist/src/utils/console-original.d.ts +6 -0
  74. package/dist/src/utils/globals.d.ts +2 -0
  75. package/dist/surveys-preview.js +1 -1
  76. package/dist/surveys-preview.js.map +1 -1
  77. package/dist/surveys.js +1 -1
  78. package/dist/surveys.js.map +1 -1
  79. package/dist/tracing-headers.js +1 -1
  80. package/dist/tracing-headers.js.map +1 -1
  81. package/dist/web-vitals-soft-navs.js.map +1 -1
  82. package/dist/web-vitals-with-attribution-soft-navs.js.map +1 -1
  83. package/dist/web-vitals-with-attribution.js.map +1 -1
  84. package/dist/web-vitals.js.map +1 -1
  85. package/lib/package.json +1 -1
  86. package/lib/src/constants.d.ts +1 -0
  87. package/lib/src/constants.js +4 -3
  88. package/lib/src/constants.js.map +1 -1
  89. package/lib/src/entrypoints/logs.js +47 -18
  90. package/lib/src/entrypoints/logs.js.map +1 -1
  91. package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.d.ts +1 -0
  92. package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js +9 -0
  93. package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js.map +1 -1
  94. package/lib/src/extensions/replay/external/mutation-throttler.d.ts +1 -0
  95. package/lib/src/extensions/replay/external/mutation-throttler.js +9 -0
  96. package/lib/src/extensions/replay/external/mutation-throttler.js.map +1 -1
  97. package/lib/src/extensions/replay/rrweb-plugins/patch.js +16 -5
  98. package/lib/src/extensions/replay/rrweb-plugins/patch.js.map +1 -1
  99. package/lib/src/logs-types.d.ts +24 -0
  100. package/lib/src/logs-types.js +11 -0
  101. package/lib/src/logs-types.js.map +1 -0
  102. package/lib/src/persistence-key-policy.js +1 -0
  103. package/lib/src/persistence-key-policy.js.map +1 -1
  104. package/lib/src/posthog-core.js +10 -5
  105. package/lib/src/posthog-core.js.map +1 -1
  106. package/lib/src/posthog-logs.d.ts +24 -1
  107. package/lib/src/posthog-logs.js +266 -10
  108. package/lib/src/posthog-logs.js.map +1 -1
  109. package/lib/src/request.js +1 -3
  110. package/lib/src/request.js.map +1 -1
  111. package/lib/src/utils/console-original.d.ts +6 -0
  112. package/lib/src/utils/console-original.js +16 -0
  113. package/lib/src/utils/console-original.js.map +1 -0
  114. package/lib/src/utils/globals.d.ts +2 -0
  115. package/lib/src/utils/globals.js.map +1 -1
  116. package/lib/tsconfig.tsbuildinfo +1 -1
  117. package/package.json +7 -6
@@ -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,h=null==i?void 0:i.userAgent,u="undefined"!=typeof globalThis?globalThis:t;u&&"undefined"==typeof self&&(u.self=u),u&&"undefined"==typeof File&&(u.File=function(){});var d=null!=t?t:{},v={DEBUG:!1,LIB_VERSION:"0.6.0",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 k(){return k=_((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=_((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),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}})),k.apply(this,arguments)}var P=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],O=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return P.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function I(t,e){return-1!==t.indexOf(e)}var C=function(t){return t.replace(/^\$/,"")},M=Object.prototype,A=M.hasOwnProperty,N=M.toString,D=Array.isArray||function(t){return"[object Array]"===N.call(t)},U=t=>"function"==typeof t,B=t=>t===Object(t)&&!D(t),F=t=>{if(B(t)){for(var e in t)if(A.call(t,e))return!1;return!0}return!1},L=t=>void 0===t,j=t=>"[object String]"==N.call(t),z=t=>j(t)&&0===t.trim().length,q=t=>null===t,H=t=>L(t)||q(t),G=t=>"[object Number]"==N.call(t)&&t==t,W=t=>G(t)&&t>0,V=t=>"[object Boolean]"===N.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",ht="Safari",ut="BlackBerry",dt="Samsung",vt=dt+"Browser",ct=dt+" Internet",_t="Chrome",pt=_t+" OS",ft=_t+" "+it,gt="Internet Explorer",mt=gt+" "+et,wt="Opera",yt=wt+" Mini",bt="Edge",$t="Microsoft "+bt,xt="Firefox",Et=xt+" "+it,St="Nintendo",Tt="PlayStation",Rt="Xbox",kt=rt+" "+et,Pt=et+" "+ht,Ot="Windows",It=Ot+" Phone",Ct="Nokia",Mt="Ouya",At="Generic",Nt=At+" "+et.toLowerCase(),Dt=At+" "+st.toLowerCase(),Ut="Konqueror",Bt="Oculus Browser",Ft="Vivaldi",Lt="Yandex",jt="Whale",zt="DuckDuckGo",qt="Pale Moon",Ht="Waterfox",Gt="Brave",Wt="Google Search App",Vt="(\\d+(\\.\\d+)?)",Yt=new RegExp("Version/"+Vt),Jt=new RegExp(Rt,"i"),Kt=new RegExp(Tt+" \\w+","i"),Xt=new RegExp(St+" \\w+","i"),Qt=new RegExp(ut+"|PlayBook|BB10","i"),Zt={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},te=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Gt:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&I(t,"GSA/")?Wt:I(t," OPR/")&&I(t,"Mini")?yt:I(t," OPR/")?wt:Qt.test(t)?ut:I(t,"IE"+et)||I(t,"WPDesktop")?mt:I(t,"OculusBrowser")?Bt:I(t,vt)?ct:I(t,bt)||I(t,"Edg/")?$t:I(t,Ft+"/")?Ft:I(t,"YaBrowser/")?Lt:I(t,jt+"/")?jt:I(t,zt+"/")||I(t,"Ddg/")?zt:I(t,"FBIOS")?"Facebook "+et:I(t,"UCWEB")||I(t,"UCBrowser")?"UC Browser":I(t,"CriOS")?ft:I(t,"CrMo")||I(t,_t)?_t:I(t,rt)&&I(t,ht)?kt:I(t,"FxiOS")?Et:I(t.toLowerCase(),Ut.toLowerCase())?Ut:I(t,Gt+"/")?Gt:((t,e)=>e&&I(e,at)||function(t){return I(t,ht)&&!I(t,_t)&&!I(t,rt)}(t))(t,e)?I(t,et)?Pt:ht: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)],[ht]:[Yt],[Pt]:[Yt],[wt]:[new RegExp("(Opera|OPR)\\/"+Vt)],[xt]:[new RegExp(xt+"\\/"+Vt)],[Et]:[new RegExp("FxiOS\\/"+Vt)],[Ut]:[new RegExp("Konqueror[:/]?"+Vt,"i")],[ut]:[new RegExp(ut+" "+Vt),Yt],[kt]:[new RegExp("android\\s"+Vt,"i")],[ct]:[new RegExp(vt+"\\/"+Vt)],[Bt]:[new RegExp("OculusBrowser\\/"+Vt)],[Ft]:[new RegExp(Ft+"\\/"+Vt)],[Lt]:[new RegExp("YaBrowser\\/"+Vt)],[jt]:[new RegExp(jt+"\\/"+Vt)],[Gt]:[new RegExp(Gt+"\\/"+Vt)],[zt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Vt)],[qt]:[new RegExp("PaleMoon\\/"+Vt)],[Ht]:[new RegExp(Ht+"\\/"+Vt)],[Wt]:[new RegExp("GSA\\/"+Vt)],[gt]:[new RegExp("(rv:|MSIE )"+Vt)],Mozilla:[new RegExp("rv:"+Vt)]},ie=function(t,e,i,r){var s=te(t,e,i,r),n=ee[s];if(L(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},re=[[new RegExp(Rt+"; "+Rt+" (.*?)[);]","i"),t=>[Rt,t&&t[1]||""]],[new RegExp(St,"i"),[St,""]],[new RegExp(Tt,"i"),[Tt,""]],[Qt,[ut,""]],[new RegExp(Ot,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[It,""];if(new RegExp(et).test(e)&&!/IEMobile\b/.test(e))return[Ot+" "+et,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Zt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[Ot,r]}return[Ot,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[it,[t[3],t[4],t[5]||"0"].join(".")]:[it,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=L(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+rt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+rt+")","i"),t=>t&&t[2]?[rt,[t[2],t[3],t[4]||"0"].join(".")]:[rt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[pt,""]],[/Linux|debian/i,["Linux",""]]],se=function(t){return Xt.test(t)?St:Kt.test(t)?Tt:Jt.test(t)?Rt:new RegExp(Mt,"i").test(t)?Mt:new RegExp("("+It+"|WPDesktop)","i").test(t)?It:/iPad/.test(t)?ot:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?lt:Qt.test(t)?ut:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ct,"i").test(t)?Ct:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(et).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?rt:nt:new RegExp("(pda|"+et+")","i").test(t)?Nt:new RegExp(st,"i").test(t)&&!new RegExp(st+" pc","i").test(t)?Dt:""},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={P(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.P("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.P("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.P("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.P("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},he=le("[PostHog.js]"),ue=he.createLogger,de=ue("[ExternalScriptsLoader]"),ve=t=>{var e=null==r?void 0:r.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},ce=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return de.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=ve(e);if(s){if(s.__posthog_loading_callback_fired)return i();var n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,i(t)})))}var o=()=>{if(!r)return i("document not found");if(ve(e))return ce(t,e,i);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?o():null==r||r.addEventListener("DOMContentLoaded",o)},_e={},pe=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=_e[s];if("fallback"===r&&n){if(ve(n))return void ce(t,n,i);delete _e[s]}ce(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=pe(t,e);_e[s]=a;var l=ve(s);null==l||null==(o=l.parentNode)||o.removeChild(l),ce(t,a,i)}else i(void 0,n)}:i)}else ce(t,pe(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");ce(t,o,i)}},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);ce(t,r,i)};v.DEBUG=!1,v.LIB_VERSION="1.421.1",v.LIB_NAME="web";var fe="$people_distinct_id",ge="distinct_id",me="$device_id",we="$device_model",ye="__alias",be="__timers",$e="$dead_clicks_enabled_server_side",xe="$session_recording_remote_config",Ee="$sesid",Se="$session_is_sampled",Te="$enabled_feature_flags",Re="$active_feature_flags",ke="$feature_flag_details",Pe="$feature_flag_payloads",Oe="$feature_flag_request_id",Ie="$minimal_flag_called_events",Ce="$stored_person_properties",Me="$stored_group_properties",Ae="$groups",Ne="$surveys_loaded_at",De="$flag_call_reported",Ue="$feature_flag_errors",Be="$feature_flag_evaluated_at",Fe="$user_state",Le="$client_session_props",je="$capture_rate_limit",ze="$initial_campaign_params",qe="$initial_referrer_info",He="$initial_person_info",Ge="$epp",We="$posthog_cookieless",Ve="$cookieless_mode",Ye="$sdk_debug_extensions_init_method",Je="$sdk_debug_extensions_init_time_ms",Ke="on_reject",Xe="always",Qe="anonymous",Ze="identified",ti="identified_only",ei="visibilitychange",ii="beforeunload",ri="$pageview",si="$pageleave",ni="$identify",oi="$groupidentify";function ai(t,e){D(t)&&t.forEach(e)}function li(t,e){if(!H(t))if(D(t))t.forEach(e);else if(Y(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)A.call(t,i)&&e(t[i],i)}var hi=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t},ui=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){he.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),he.critical(t)}}},di=function(t){var e={};return li(t,(function(t,i){(j(t)&&t.length>0||G(t))&&(e[i]=t)})),e};var vi=["herokuapp.com","vercel.app","netlify.app"];function ci(t){var e=null==t?void 0:t.hostname;if(!j(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of vi)if(i===r)return!1;return!0}function _i(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var pi=t=>{if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return G(t)&&isFinite(t)&&Math.floor(t)===t});class fi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new fi(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new fi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class gi{generate(){var t=this.generateOrAbort();if(!L(t))return t;this.Dr=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.Dr)this.Dr=t,this.Fr();else{if(this.Dr>=t+1e4)return;this.Nr++,this.Nr>4398046511103&&(this.Dr++,this.Fr())}return fi.fromFieldsV7(this.Dr,Math.trunc(this.Nr/Math.pow(2,30)),this.Nr&Math.pow(2,30)-1,this.qr.nextUint32())}Fr(){this.Nr=1024*this.qr.nextUint32()+(1023&this.qr.nextUint32())}constructor(){this.Dr=0,this.Nr=0,this.qr=new yi}}var mi,wi=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!L(t.crypto)&&crypto.getRandomValues&&(wi=t=>crypto.getRandomValues(t));class yi{nextUint32(){return this.yt.length>this.jr||(wi(this.yt),this.jr=0),this.yt[this.jr++]}constructor(){this.yt=new Uint32Array(8),this.jr=1/0}}var bi=()=>$i().toString(),$i=()=>(mi||(mi=new gi)).generate(),xi="",Ei=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Si={Br:()=>!!r,Wr(t){he.error("cookieStore error: "+t)},Ur:pi,zr(t){var e;try{e=JSON.parse(Si.Ur(t))||{}}catch(t){}return e},Hr(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),xi)return xi;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+bi();!xi&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",xi=o)}return xi}(t);if(!i){var s=(t=>{var e=t.match(Ei);return e?e[0]:""})(t);s!==i&&he.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var h=new Date;h.setTime(h.getTime()+864e5*i),o="; expires="+h.toUTCString()}n&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&he.warn("cookieStore warning: large cookie, len="+u.length),r.cookie=u,!0}catch(t){return!1}},$r(t,e){if(null!=r&&r.cookie)try{Si.Hr(t,"",-1,e)}catch(t){return}}},Ti=null,Ri={Br(){if(!q(Ti))return Ti;var e=!0;if(L(t))e=!1;else try{var i="__mplssupport__";Ri.Hr(i,"xyz"),'"xyz"'!==Ri.Ur(i)&&(e=!1),Ri.$r(i)}catch(t){e=!1}return e||he.error("localStorage unsupported; falling back to cookie store"),Ti=e,e},Wr(t){he.error("localStorage error: "+t)},Ur(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Ri.Wr(t)}return null},zr(t){try{return JSON.parse(Ri.Ur(t))||{}}catch(t){}return null},Hr(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ri.Wr(t)}return!1},$r(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Ri.Wr(t)}}},ki=[Ce,Re,Te,ke,Pe,Oe,Be,Ue,De],Pi=[me,ge,Ee,Se,Ge,He,Fe],Oi=t=>t+"_cpm",Ii=["__proto__","constructor","prototype"],Ci=t=>{if(!B(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Ii.indexOf(i)&&(e[i]=t[i])})),e},Mi=function(t,e){void 0===e&&(e=[]);var i={};return[...Pi,...e].forEach((e=>{var r=t[e];L(r)||q(r)||""===r||(i[e]=r)})),i},Ai=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Ni=(t,e)=>({p:e,f:Ai(JSON.stringify(t))}),Di=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=Si.zr(Oi(t)),r=(null==i?void 0:i.f)===Ai(e)&&D(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Ui=(t,e)=>e+"|"+(Si.Ur(Oi(t))||""),Bi={},Fi={Br:()=>!0,Wr(t){he.error("memoryStorage error: "+t)},Ur:t=>Bi[t]||null,zr:t=>Bi[t]||null,Hr:(t,e)=>(Bi[t]=e,!0),$r(t){delete Bi[t]}},Li=null,ji={Br(){if(!q(Li))return Li;if(Li=!0,L(t))Li=!1;else try{var e="__support__";ji.Hr(e,"xyz"),'"xyz"'!==ji.Ur(e)&&(Li=!1),ji.$r(e)}catch(t){Li=!1}return Li},Wr(t){he.error("sessionStorage error: ",t)},Ur(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){ji.Wr(t)}return null},zr(t){try{return JSON.parse(ji.Ur(t))||null}catch(t){}return null},Hr(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){ji.Wr(t)}return!1},$r(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){ji.Wr(t)}}};class zi{constructor(t){this._instance=t}get Wi(){return this._instance.config}get consent(){return this._s()?0:this.ws}isOptedOut(){return this.Wi.cookieless_mode===Xe||this.isRejected()||-1===this.consent&&this.Wi.cookieless_mode===Ke}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Wi.opt_out_capturing_by_default}optInOut(t){this.ks.Hr(this.Ss,t?1:0,this.Wi.cookie_expiration,this.Wi.cross_subdomain_cookie,this.Wi.secure_cookie)}reset(){this.ks.$r(this.Ss,this.Wi.cross_subdomain_cookie)}get Ss(){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 ws(){var t=this.ks.Ur(this.Ss);return Q(t)?1:I(Z,t)?0:-1}get ks(){var t=this.Wi.opt_out_capturing_persistence_type,e="localStorage"===t?Ri:Si;if(!this.xs||this.xs!==e){this.xs=e;var i="localStorage"===t?Si:Ri;i.Ur(this.Ss)&&(this.xs.Ur(this.Ss)||this.optInOut(Q(i.Ur(this.Ss))),i.$r(this.Ss,this.Wi.cross_subdomain_cookie))}return this.xs}_s(){return!!this.Wi.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack].some((t=>Q(t)))}}var qi=["next","previous","prev",">","<","+","-","−","–"];ue("[Dead Clicks]");var Hi=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property($e)),r=t.instance.config.capture_dead_clicks;return V(r)?r:!!B(r)||i},Gi=ue("[SegmentIntegration]");var Wi="posthog-js";function Vi(t,e){var i=void 0===e?{}:e,r=i.organization,s=i.projectId,n=i.prefix,o=i.severityAllowList,a=void 0===o?["error"]:o,l=i.sendExceptionsToPostHog,h=void 0===l||l;return e=>{var i,o,l,u,d;if("*"!==a&&!a.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,_=(null==(i=e.exception)?void 0:i.values)||[],f=_.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(o=_[0])?void 0:o.value)||e.message,$exception_type:null==(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==(u=_[0])?void 0:u.value)||e.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),h&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class Yi{constructor(t,e,i,r,s,n){this.name=Wi,this.setupOnce=function(o){o(Vi(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Ji{constructor(t){this.Es=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(he.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Is=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Rs()}Rs(){var t;this.Ps=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Es)}destroy(){var t;null==(t=this.Ps)||t.call(this),this.Ps=void 0}doPageView(e,i){var r,s=this.As(e,i);return this.Is={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.As(t,null==(e=this.Is)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Is)?void 0:t.pageViewId}}As(t,e){var i=this.Is;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,h=s.lastContentY,u=s.maxContentY;if(!(L(n)||L(o)||L(a)||L(l)||L(h)||L(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?tt(o/n,0,1,he):1,v=n>1?tt(a/n,0,1,he):1,c=l>1?tt(h/l,0,1,he):1,_=l>1?tt(u/l,0,1,he):1;r=hi(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:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Ki=["flags","surveys"],Xi={[fe]:{exposure:"hidden"},[ye]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[be]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$exception_capture_enabled_server_side:{exposure:"event"},$error_tracking_suppression_rules:{exposure:"hidden"},$error_tracking_capture_extension_exceptions:{exposure:"event"},$web_vitals_enabled_server_side:{exposure:"event"},[$e]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[xe]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[Se]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:t=>q(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Te]:{exposure:"hidden",storageGroup:"flags"},[Re]:{exposure:"hidden",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},[ke]:{exposure:"hidden",storageGroup:"flags"},[Pe]:{exposure:"hidden",storageGroup:"flags"},[Oe]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ie]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"hidden"},$override_feature_flag_payloads:{exposure:"hidden"},[Ce]:{exposure:"hidden"},[Me]:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[Ne]:{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"},[De]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},[Ae]:{exposure:"event"},[Ue]:{exposure:"hidden"},[Be]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Fe]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[je]:{exposure:"hidden"},[ze]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[He]:{exposure:"hidden"},[Ge]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[Ye]:{exposure:"event"},[Je]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Qi=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Zi=t=>{var e=Xi[t];if(e)return e;for(var i of Qi){var r=i[1];if(0===t.indexOf(i[0]))return r}},tr=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return r=[],null!==(i=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(e))return"[Circular]";r.push(e)}return e}})))&&void 0!==i?i:"null"}var i,r},er=t=>{var e=null==r?void 0:r.createElement("a");return L(e)?null:(e.href=t,e)},ir=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!D(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){he.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},rr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");D(d)&&(e.includes(d[0])?h.push(d[0]+"="+i):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},sr="https?://(.*)",nr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],or=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...nr],ar="<masked>",lr=["li_fat_id"];function hr(t,e){var i=or.concat(e||[]),r={};return li(i,(function(e){var i=ir(t,e);r[e]=i||null})),r}function ur(t){var e=function(t){return t?0===t.search(sr+"google.([^/?]*)")?"google":0===t.search(sr+"bing.com")?"bing":0===t.search(sr+"yahoo.com")?"yahoo":0===t.search(sr+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!q(e)){s.$search_engine=e;var n=r?ir(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function dr(){return navigator.language||navigator.userLanguage}var vr="$direct";function cr(){return(null==r?void 0:r.referrer)||vr}function _r(t,e,i){void 0===i&&(i=!1);var r=t?[...nr,...e||[]]:[],n=i?ae(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:cr().substring(0,1e3),u:o?rr(o,r,ar):void 0}}function pr(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?ae(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==vr?vr:null==(i=er(r))?void 0:i.host};if(n){o.$current_url=n;var a=er(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=hr(n);hi(o,l)}if(r){var h=ur(r);hi(o,h)}return o}function fr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function gr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var mr={flags:Be,surveys:Ne},wr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],yr=t=>t+"_cookie_identity_change_pending",br="main",$r=(t,e)=>{li(t,((i,r)=>{var s=Zi(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class xr{constructor(e,i,r){if(void 0===r&&(r=!0),this.Fs={},this.Os=!1,this.Ls=!1,this.Ds=!1,this.$s=!1,this.Wi=e,this.Ns=r,this.props={},this.qs=void 0,this.js=(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.ks=this.Bs(e),this.Ls=this.Hs(e),this.load(),e.debug&&he.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();_i(t,"beforeunload",s,{capture:!1}),_i(t,"pagehide",s,{capture:!1})}}Us(){var t,e=null==(t=this.Wi)?void 0:t.persistence_save_debounce_ms;return G(e)&&e>0?e:0}zs(t){if(this.Wi.cookieWinsOnConflict&&"localstorage+cookie"===this.Wi.persistence.toLowerCase())if(t)try{var e=Mi(t,this.Wi.cookie_persisted_properties||[]),i=Ni(e,this.Wi.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=Si.Ur(this.js)||void 0;s&&Ui(this.js,s)===r&&(this.Ws=r,this.Vs=s)}catch(t){}else try{var n=Si.Ur(this.js)||void 0;this.Ws=n?Ui(this.js,n):void 0,this.Vs=n}catch(t){}}syncCookieProperties(){return this.Gs(this.Wi)}Gs(t,e){if(void 0===e&&(e=!1),this.Zs&&!e||this.$s||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=Si.Ur(this.js)||void 0}catch(t){}if(!i||i===this.Vs)return!1;var r,s=Ui(this.js,i);try{r=Ci(JSON.parse(i))}catch(t){return!1}if((Si.Ur(this.js)||void 0)!==i)return!1;this.Ws=s,this.Vs=i;var n=Di(this.js,i),o=[...Pi,...n.properties],a={};if(Object.keys(r).forEach((t=>{var e=r[t];(L(e)||q(e)||""===e||t===Fe&&e!==Qe&&e!==Ze)&&(a[t]=!0,delete r[t])})),F(r))return!1;var l=ge in r||r[Fe]===Qe||r[Fe]===Ze,h=this.props[ge],u=this.props[Fe],d=hi({},this.props);[...Pi,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||t!==ge&&t!==Fe)){var e=d[t];!n.isValid&&-1!==Pi.indexOf(t)&&(!1===e||0===e)||delete d[t]}})),this.props=hi(d,r),!l||Fe in r||Fe in this.props||this.Qs(Fe,Qe);var v=this.props[ge],c=this.props[Fe];return!l||v===h&&c===u||(this.Ds=!0,ji.Hr(yr(this.js),!0),this.Js(Ce),this.Js(Re),this.Js(Te),this.Js(ke),this.Js(Pe),this.Js(Oe),this.Js(Be),this.Js(Ue),this.Js(De),c===Qe&&(u===Ze||r[Fe]===Qe||!L(h)&&v!==h)&&($r(this.props,r),this.Js(Me)),c===Ze?this.props.$user_id=v:delete this.props.$user_id,this.Js(ye)),!0}consumeCookieIdentityChange(){var t=yr(this.js),e=this.Ds||!!ji.Ur(t);return this.Ds=!1,e&&ji.$r(t),e}Ks(t){return void 0===t&&(t=!1),!(this.$s||this.Zs&&!t||!this.Wi.cookieWinsOnConflict||"localstorage+cookie"!==this.Wi.persistence.toLowerCase()||(this.$s=!0,0))}Ys(){this.$s&&(L(this.Xs)||(clearTimeout(this.Xs),this.Xs=void 0),delete this.Fs[br],this.ta(!0))}ea(t){if(void 0===t&&(t=!0),this.$s)try{t?this.Ys():L(this.Xs)||(clearTimeout(this.Xs),this.Xs=void 0)}finally{this.$s=!1}}isDisabled(){return!!this.Zs}Bs(e){-1===wr.indexOf(e.persistence.toLowerCase())&&(he.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=[...Pi,...e];return p({},Ri,{zr(t){try{var e,s={};try{e=Si.Ur(t)||void 0,s=e?Ci(JSON.parse(e)):{}}catch(t){}var n,o=JSON.parse(Ri.Ur(t)||"{}");if(i){var a=Di(t,e),l=[...Pi,...a.properties],h={};Object.keys(s).forEach((t=>{var e=s[t];q(e)||""===e||t===Fe&&e!==Qe&&e!==Ze||(h[t]=e)}));var u=ge in h||h[Fe]===Qe||h[Fe]===Ze;if(Object.keys(h).length>0){var d,v=o[ge],c=null!==(d=o[Fe])&&void 0!==d?d:Qe;r.forEach((t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||t!==ge&&t!==Fe)){var e=o[t];!a.isValid&&-1!==Pi.indexOf(t)&&(!1===e||0===e)||delete o[t]}})),!u||Fe in s||Fe in o||(o[Fe]=Qe),!u||(ge in h?h[ge]:o[ge])===v&&(Fe in h?h[Fe]:o[Fe])===c||(ki.forEach((t=>delete o[t])),h[Fe]===Ze&&ge in h?o.$user_id=h[ge]:delete o.$user_id,h[Fe]!==Ze&&(delete o[Ae],delete o[Me]),delete o.__alias)}n=hi(o,h)}else n=hi(s,o);return Ri.Hr(t,n),n}catch(t){}return null},Hr(t,r,s,n,o,a){var l=Ri.Hr(t,r,void 0,void 0,a);try{var h=Mi(r,e);if(Object.keys(h).length){if(i){var u=Oi(t),d=Ni(h,e);if(Si.Hr(u,d,s,n,o,a),Si.Ur(u)!==JSON.stringify(d)){Si.$r(u,n);var v=Mi(r);return Si.Hr(t,v,s,n,o,a),l}}Si.Hr(t,h,s,n,o,a)}}catch(t){Ri.Wr(t)}return l},$r(e,i){try{null==t||t.localStorage.removeItem(e),Si.$r(e,i),Si.$r(Oi(e),i)}catch(t){Ri.Wr(t)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Ri.Br()?(i=Ri,s=!0):"localstorage+cookie"===n&&r.Br()?(i=r,s=!0):"sessionstorage"===n&&ji.Br()?i=ji:"memory"===n?i=Fi:"cookie"===n?i=Si:r.Br()?(i=r,s=!0):i=Si,this.Os=s,i}ia(t){return this.js+"__"+t}Hs(t){return this.Os&&!!t.split_storage}properties(){var t={};return li(this.props,((e,i)=>{var r=Zi(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.Zs||t){var e=this.Wi.cookieWinsOnConflict&&"localstorage+cookie"===this.Wi.persistence.toLowerCase(),i=e?Ri.zr(this.js):null,r={};if(e)try{li(r=Ci(Si.zr(this.js)),((t,e)=>{(L(t)||q(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.ks.zr(this.js);if(s&&(this.props=hi({},s)),this.Ls&&this.ra(),e&&s){var n,o,a=null==i?void 0:i[ge],l=null!==(n=null==i?void 0:i[Fe])&&void 0!==n?n:Qe,h=s[ge],u=null!==(o=s[Fe])&&void 0!==o?o:Qe;if(h!==a||u!==l){this.Ds=!0,ji.Hr(yr(this.js),!0);var d=hi({},this.props);ki.forEach((t=>delete d[t])),u===Qe&&(l===Ze||r[Fe]===Qe||!L(a)&&h!==a)&&($r(d,r),delete d[Me]),this.props=d;var v=new Set;ki.forEach((t=>{var e,i=null==(e=Zi(t))?void 0:e.storageGroup;i&&v.add(i)})),v.forEach((t=>{var e={};li(this.props,((i,r)=>{var s;(null==(s=Zi(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),F(e)?(Ri.$r(this.ia(t)),this.Fs[t]={}):Ri.Hr(this.ia(t),e)&&(this.Fs[t]={persisted:!0,fingerprint:this.na(e,t)})}))}}ji.Ur(yr(this.js))&&(this.Ds=!0)}}ra(){for(var t of Ki){var e=Ri.zr(this.ia(t));if(e&&!F(e)){var i=this.sa(t);i.persisted=!0,this.aa(t)||(i.fingerprint=this.na(e,t)),this.oa(t,e)||hi(this.props,e)}}}aa(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Zi(e))?void 0:i.storageGroup)===t}))}oa(t,e){var i=mr[t];if(!i)return!1;var r=e[i],s=this.props[i];return G(r)&&G(s)&&s>r}refreshKey(t){var e;if(!this.Zs){var i=this.Ls?null==(e=Zi(t))?void 0:e.storageGroup:void 0,r=i?Ri.zr(this.ia(i)):this.ks.zr(this.js);if(r&&t in r)this.Qs(t,r[t]);else{if(i){var s=this.ks.zr(this.js);if(s&&t in s)return void this.Qs(t,s[t])}this.Js(t)}}}save(){if(!this.Zs){var t=this.Us();t>0?L(this.Xs)&&(this.Xs=setTimeout((()=>{this.Xs=void 0,this.ta()}),t)):this.ta()}}flush(){L(this.Xs)||(clearTimeout(this.Xs),this.Xs=void 0,this.ta())}ta(t){void 0===t&&(t=!1),this.Zs||this.$s&&!t||(t||this.syncCookieProperties(),this.Ls?this.la():this.ua(this.ks,this.js,this.props,br)&&this.zs(this.props))}la(){var t=this.ha(),e=t.main,i=t.groups;for(var r of(this.ua(this.ks,this.js,e,br)&&this.zs(e),Ki)){var s,n=i[r];(!F(n)||null!=(s=this.Fs[r])&&s.persisted)&&this.ua(Ri,this.ia(r),n,r)}}ha(){var t={},e={flags:{},surveys:{}};return li(this.props,((i,r)=>{var s,n=null==(s=Zi(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}na(t,e){if(e===br)return JSON.stringify(t)+"|"+this.da+"|"+this.va+"|"+this.ca;var i={};return li(t,((t,e)=>{var r;i[e]=null!=(r=Zi(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}ua(t,e,i,r){var s,n=this.sa(r);if(r!==br&&!n.dirty&&!L(n.fingerprint))return!1;try{if((s=this.na(i,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Hr(e,i,this.da,this.va,this.ca,this.Wi.debug)?(n.dirty=!1,r!==br&&(n.persisted=!0),L(s)||(n.fingerprint=s),!0):(this.Wi.debug&&he.warn('failed to persist storage entry "'+e+'"; will retry on next save'),!1)}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(L(this.Xs)||(clearTimeout(this.Xs),this.Xs=void 0),this.ks.$r(this.js,!1),this.ks.$r(this.js,!0),!i&&this.Ns)for(var r of Ki)Ri.$r(this.ia(r));i?delete this.Fs[br]:this.Fs={},this.Ws=void 0,this.Vs=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(B(t)){this.syncCookieProperties(),L(e)&&(e="None"),this.da=L(i)?this.fa:i;var r=!1;if(li(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Qs(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(B(t)){this.syncCookieProperties(),this.da=L(e)?this.fa:e;var i=!1;if(li(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||B(e)||D(e))&&(this.Qs(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.Js(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this.qs){var e=function(t,e,i){if(!r)return{};var s,n=e?[...nr,...i||[]]:[],o=hr(rr(r.URL,n,ar),t),a=(s={},li(lr,(function(t){var e=pi(t);s[t]=e||null})),s);return hi(a,o)}(this.Wi.custom_campaign_params,this.Wi.mask_personal_data_properties,this.Wi.custom_personal_data_properties);F(di(e))||this.register(e),this.qs=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?ur(t):{})}update_referrer_info(){var t;this.register_once({$referrer:cr(),$referring_domain:null!=r&&r.referrer&&(null==(t=er(r.referrer))?void 0:t.host)||vr},void 0)}set_initial_person_info(){this.props[ze]||this.props[qe]||this.register_once({[He]:_r(this.Wi.mask_personal_data_properties,this.Wi.custom_personal_data_properties,this.Wi.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};li([qe,ze],(e=>{var i=this.props[e];i&&li(i,(function(e,i){t["$initial_"+C(i)]=e}))}));var e=this.props[He];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=pr(t,e),r={};return li(i,(function(t,e){r["$initial_"+C(e)]=t})),r}(e,this.Wi.disable_capture_url_hashes);hi(t,i)}return t}safe_merge(t){return li(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){var r=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),n=r||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,l=!!this.Zs&&!a;a||this.Gs(e,l),this.Wi=t,!a&&(r||s||o)&&(this.Ws=void 0,this.Vs=void 0,this.Gs(p({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),l));var h=n||o?this.Bs(t):this.ks,u=this.Hs(t),d=n||u!==this.Ls,v=!a&&(d||t.cross_subdomain_cookie!==this.va||t.secure_cookie!==this.ca)&&this.Ks(l);try{if(this.fa=this.da=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.ks=h,this.Ls=u,this.props=c,this.save()}else o&&(this.ks=h,a||(delete this.Fs[br],this.ta()))}finally{v&&this.ea()}}set_disabled(t){this.Zs=t,this.Zs?this.remove():this.save()}set_cross_subdomain(t){t!==this.va&&(this.va=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ca&&(this.ca=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[be]||{};i[t]=e,this.Qs(be,i),this.save()}remove_event_timer(t){var e=this.props[be]||{},i=e[t];return L(i)||(delete e[t],this.Qs(be,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Qs(t,e),this.save()}Qs(t,e){var i;this.props[t]=e,null!=(i=Zi(t))&&i.volatile||this.pa(t)}Js(t){delete this.props[t],this.pa(t)}pa(t){var e,i=null==(e=Zi(t))?void 0:e.storageGroup;i&&(this.sa(i).dirty=!0)}sa(t){return this.Fs[t]||(this.Fs[t]={})}}function Er(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&U(i.then)&&i.then(void 0,(()=>{}))}}}}var Sr={GZipJS:"gzip-js",Base64:"base64"},Tr={Activation:"events",Cancellation:"cancelEvents"},Rr={Button:"button",Tab:"tab",Selector:"selector"},kr={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Pr={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Or={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Ir={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Cr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Mr={Once:"once",Recurring:"recurring",Always:"always"},Ar={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Nr={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"},Dr={Popover:"popover",Inline:"inline"},Ur={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Br={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Fr={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Lr=ue("[RateLimiter]");class jr{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{Lr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Lr.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(je))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(G(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.ga(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(je,a),{isRateLimited:l,remainingTokens:a.tokens}}ma(t){var e=this.instance.config.property_denylist;return!D(e)||!e.includes(t)}ya(){var t;if(this.ma("$current_url")&&this.ma("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}ga(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ya(),o=this.ma("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var zr=ue("[RemoteConfig]");class qr{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=d._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ba(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()}_a(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return zr.info("Using preloaded remote config",this.remoteConfig),void this.wa(this.remoteConfig);if(this._instance._shouldDisableFlags())return void zr.warn("Remote config is disabled. Falling back to local config.");this.ba((t=>{if(!t)return zr.info("No config found after loading remote JS config. Falling back to JSON."),void this._a((t=>{this.wa(t.json,t)}));this.wa(t)}))}catch(t){zr.error("Error loading remote config",t),this.wa()}}wa(t,e){!t&&e&&(0===e.statusCode?e.error||zr.warn("Failed to fetch remote config from PostHog."):zr.error("Failed to fetch remote config from PostHog."));try{this._instance.wa(t?{ok:!0,config:t}:{ok:!1})}catch(t){zr.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){zr.error("Error loading feature flags",t)}}}var Hr=["fatal","error","warning","log","info","debug"],Gr=Uint8Array,Wr=Uint16Array,Vr=Uint32Array,Yr=new Gr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Jr=new Gr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Kr=new Gr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xr=function(t,e){for(var i=new Wr(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Vr(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Qr=Xr(Yr,2),Zr=Qr[1];Qr[0][28]=258,Zr[258]=28;for(var ts=Xr(Jr,0)[1],es=new Wr(32768),is=0;32768>is;++is){var rs=(43690&is)>>>1|(21845&is)<<1;es[is]=((65280&(rs=(61680&(rs=(52428&rs)>>>2|(13107&rs)<<2))>>>4|(3855&rs)<<4))>>>8|(255&rs)<<8)>>>1}var ss=function(t,e,i){for(var r=t.length,s=0,n=new Wr(e);r>s;++s)++n[t[s]-1];var o,a=new Wr(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Wr(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[es[d]>>>l]=h}else for(o=new Wr(r),s=0;r>s;++s)o[s]=es[a[t[s]-1]++]>>>15-t[s];return o},ns=new Gr(288);for(is=0;144>is;++is)ns[is]=8;for(is=144;256>is;++is)ns[is]=9;for(is=256;280>is;++is)ns[is]=7;for(is=280;288>is;++is)ns[is]=8;var os=new Gr(32);for(is=0;32>is;++is)os[is]=5;var as=ss(ns,9,0),ls=ss(os,5,0),hs=function(t){return(t/8>>0)+(7&t&&1)},us=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Wr?Wr:t instanceof Vr?Vr:Gr)(i-e);return r.set(t.subarray(e,i)),r},ds=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},vs=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},cs=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Gr(0),0];if(1==s){var o=new Gr(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],h=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[d].f>i[h].f?h++:d++],l=i[h!=u&&i[d].f>i[h].f?h++:d++],i[u++]={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 Wr(v+1),_=_s(i[u-1],c,0);if(_>e){r=0;var p=0,f=_-e,g=1<<f;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<_-c[m]),c[m]=e}for(p>>>=f;p>0;){var w=n[r].s;e>c[w]?p-=1<<e-c[w]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}_=e}return[new Gr(c),_]},_s=function(t,e,i){return-1==t.s?Math.max(_s(t.l,e,i+1),_s(t.r,e,i+1)):e[t.s]=i},ps=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Wr(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},fs=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},gs=function(t,e,i){var r=i.length,s=hs(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},ms=function(t,e,i,r,s,n,o,a,l,h,u){ds(e,u++,i),++s[256];for(var d=cs(s,15),v=d[0],c=d[1],_=cs(n,15),p=_[0],f=_[1],g=ps(v),m=g[0],w=g[1],y=ps(p),b=y[0],x=y[1],E=new Wr(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;b.length>S;++S)E[31&b[S]]++;for(var T=cs(E,7),R=T[0],k=T[1],P=19;P>4&&!R[Kr[P-1]];--P);var O,I,C,M,A=h+5<<3,N=fs(s,ns)+fs(n,os)+o,D=fs(s,v)+fs(n,p)+o+14+3*P+fs(E,R)+(2*E[16]+3*E[17]+7*E[18]);if(N>=A&&D>=A)return gs(e,u,t.subarray(l,l+h));if(ds(e,u,1+(N>D)),u+=2,N>D){O=ss(v,c,0),I=v,C=ss(p,f,0),M=p;var U=ss(R,k,0);for(ds(e,u,w-257),ds(e,u+5,x-1),ds(e,u+10,P-4),u+=14,S=0;P>S;++S)ds(e,u+3*S,R[Kr[S]]);u+=3*P;for(var B=[m,b],F=0;2>F;++F){var L=B[F];for(S=0;L.length>S;++S)ds(e,u,U[j=31&L[S]]),u+=R[j],j>15&&(ds(e,u,L[S]>>>5&127),u+=L[S]>>>12)}}else O=as,I=ns,C=ls,M=os;for(S=0;a>S;++S)if(r[S]>255){var j;vs(e,u,O[257+(j=r[S]>>>18&31)]),u+=I[j+257],j>7&&(ds(e,u,r[S]>>>23&31),u+=Yr[j]);var z=31&r[S];vs(e,u,C[z]),u+=M[z],z>3&&(vs(e,u,r[S]>>>5&8191),u+=Jr[z])}else vs(e,u,O[r[S]]),u+=I[r[S]];return vs(e,u,O[256]),u+I[256]},ws=new Vr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ys=function(){for(var t=new Vr(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),bs=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function $s(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=ys[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,h=(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 Gr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=gs(l,h,t.subarray(u,d)):(l[u]=!0,h=gs(l,h,t.subarray(u,o)))}else{for(var v=ws[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new Wr(32768),g=new Wr(p+1),m=Math.ceil(i/3),w=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<w)&p},b=new Vr(25e3),x=new Wr(288),E=new Wr(32),S=0,T=0,R=(u=0,0),k=0,P=0;o>u;++u){var O=y(u),I=32767&u,C=g[O];if(f[I]=C,g[O]=I,u>=k){var M=o-u;if((S>7e3||R>24576)&&M>423){h=ms(t,l,0,b,x,E,T,R,P,u-P,h),R=S=T=0,P=u;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)E[A]=0}var N=2,D=0,U=_,B=I-C&32767;if(M>2&&O==y(u-B))for(var F=Math.min(c,M)-1,L=Math.min(32767,u),j=Math.min(258,M);L>=B&&--U&&I!=C;){if(t[u+N]==t[u+N-B]){for(var z=0;j>z&&t[u+z]==t[u+z-B];++z);if(z>N){if(N=z,D=B,z>F)break;var q=Math.min(B,z-2),H=0;for(A=0;q>A;++A){var G=u-B+A+32768&32767,W=G-f[G]+32768&32767;W>H&&(H=W,C=G)}}}B+=(I=C)-(C=f[I])+32768&32767}if(D){b[R++]=268435456|Zr[N]<<18|ts[D];var V=31&Zr[N],Y=31&ts[D];T+=Yr[V]+Jr[Y],++x[257+V],++E[Y],k=u+N,++S}else b[R++]=t[u],++x[t[u]]}}h=ms(t,l,!0,b,x,E,T,R,P,u-P,h)}return us(a,0,r+hs(h)+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)),u=h.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&bs(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(h,e),bs(h,u-8,i.d()),bs(h,u-4,r),h}var xs=!!o||!!n,Es="text/plain",Ss=!1,Ts=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Rs=function(t,e,i){var r;void 0===i&&(i=!0);var s=t.split("?"),n=s[0],o=s[1],a=p({},e),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:[],h=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return li(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 h&&l.push(h),l.length>0?n+"?"+l.join("&"):n},ks=t=>{if(t.Sa)return t.Sa;var e=t.data,i=t.compression;if(e){if(i===Sr.GZipJS){var r=$s(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Gr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new Gr(s+8+(i-o<<1));a.set(r),r=a}var 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 us(r,0,s)}(tr(e)),{mtime:0});return{contentType:Es,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Sr.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(tr(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:tr(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=tr(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Ps=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:Rs(t.url,{compression:Sr.Base64}),encodedBody:ks(p({},t,{compression:Sr.Base64,Sa:void 0}))}:{url:Ts(t.url,"compression"),encodedBody:ks(p({},t,{compression:void 0,Sa:void 0}))};try{e=ks(t)}catch(e){if(E(t.compression,ir(t.url,"compression")))return he.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&E(t.compression,ir(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?x(new Uint8Array(i)):ArrayBuffer.isView(i)&&x(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Ss=!0,r()):{url:t.url,encodedBody:e}},Os=t=>{try{return Ps(t)}catch(e){return he.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Is=function(){var t=_((function*(t){var e=tr(t.data),i=yield function(t,e,i){return k.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{Sa:{contentType:Es,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Cs=/Failed to fetch|NetworkError|Load failed/i,Ms=t=>"TypeError"===(null==t?void 0:t.name)&&Cs.test((null==t?void 0:t.message)||""),As=t=>{var e=Os(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,l=s.body,h=s.estimatedSize,u=new Headers;li(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var e,i;v=!0,c.abort((e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",i))}),t.timeout)}}var _=e=>{v&&"AbortError"===(null==e?void 0:e.name)||Ms(e)?he.warn(e):he.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;n(i,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t.xa&&52428.8>(h||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){he.error(t)}null==t.callback||t.callback(r)})))).catch(_).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),_(t)}}},Ns=t=>{try{var e,r=Ps(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(i.sendBeacon(s,h))return;var u=D(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(D(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=e=>D(t.data)?e:p({},t.data,{batch:e});return Ns(p({},t,{data:v(u.slice(0,d))})),void Ns(p({},t,{data:v(u.slice(d))}))}he.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),As(p({},t,{xa:!0}))}catch(t){he.warn("Beacon send failed",t)}},Ds=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return Rs(i===Sr.GZipJS?Ts(t,"compression"):t,p({},s?{[s]:Date.now().toString()}:{},i===Sr.GZipJS?{}:{compression:i}))},Us=[];n&&Us.push({transport:"fetch",method:As}),o&&Us.push({transport:"XHR",method(t){var e=Os(t);if(e){var i=new o,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;li(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(a)}}}),null!=i&&i.sendBeacon&&Us.push({transport:"sendBeacon",method:Ns});var Bs=3e3;class Fs{constructor(t,e){this.Ca=!0,this.Ta=[],this.Ma=tt((null==e?void 0:e.flush_interval_ms)||Bs,250,5e3,he.createLogger("flush interval"),Bs),this.Ea=t}enqueue(t){this.Ta.push(t),this.Ia||this.Ra()}unload(){this.Pa();var t=this.Ta.length>0?this.Aa():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Fa(p({},t,{transport:"sendBeacon"}))}))}enable(){this.Ca=!1,this.Ra()}Ra(){var t=this;this.Ca||(this.Ia=setTimeout((()=>{if(this.Pa(),this.Ta.length>0){var e=this.Aa(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&D(i.data)&&li(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Fa(i)};for(var r in e)i()}}),this.Ma))}Fa(t){try{this.Ea(t)}catch(t){he.error(t)}}Pa(){clearTimeout(this.Ia),this.Ia=void 0}Aa(){var t={};return li(this.Ta,(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.Ta=[],t}}var Ls=["retriesPerformedSoFar"];class js{constructor(e){this.Oa=!1,this.La=3e3,this.Ta=[],this._instance=e,this.Ta=[],this.Da=!0,!L(t)&&"onLine"in t.navigator&&(this.Da=t.navigator.onLine,this.$a=()=>{this.Da=!0,this.Na()},this.qa=()=>{this.Da=!1},_i(t,"online",this.$a),_i(t,"offline",this.qa))}get length(){return this.Ta.length}retriableRequest(t){var e=t.retriesPerformedSoFar,i=function(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}(t,Ls);W(e)&&(i.url=Rs(i.url,{retry_count:e})),this._instance._send_request(p({},i,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.Rn(p({retriesPerformedSoFar:e},i));0===t.statusCode&&he.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)}}))}Rn(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.Ta.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),he.warn(s),this.Oa||(this.Oa=!0,this.ja())}ja(){if(this.Ba&&clearTimeout(this.Ba),0===this.Ta.length)return this.Oa=!1,void(this.Ba=void 0);this.Ba=setTimeout((()=>{this.Da&&this.Ta.length>0&&this.Na(),this.ja()}),this.La)}Na(){var t=Date.now(),e=[],i=this.Ta.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Ta=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.Ba&&(clearTimeout(this.Ba),this.Ba=void 0),this.Oa=!1,L(t)||(this.$a&&(t.removeEventListener("online",this.$a),this.$a=void 0),this.qa&&(t.removeEventListener("offline",this.qa),this.qa=void 0)),this.Ta)){var i=e.requestOptions;try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){he.error(t)}}this.Ta=[]}}class zs{constructor(t){this.Ha=()=>{var t,e,i,r;this.Ua||(this.Ua={});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.Ua.lastScrollY=Math.ceil(n),this.Ua.maxScrollY=Math.max(n,null!==(t=this.Ua.maxScrollY)&&void 0!==t?t:0),this.Ua.maxScrollHeight=Math.max(o,null!==(e=this.Ua.maxScrollHeight)&&void 0!==e?e:0),this.Ua.lastContentY=a,this.Ua.maxContentY=Math.max(a,null!==(i=this.Ua.maxContentY)&&void 0!==i?i:0),this.Ua.maxContentHeight=Math.max(l,null!==(r=this.Ua.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get za(){return this._instance.config.scroll_root_selector}getContext(){return this.Ua}resetContext(){var t=this.Ua;return setTimeout(this.Ha,0),t}startMeasuringScrollPosition(){_i(t,"scroll",this.Ha,{capture:!0}),_i(t,"scrollend",this.Ha,{capture:!0}),_i(t,"resize",this.Ha)}scrollElement(){if(!this.za)return null==t?void 0:t.document.documentElement;var e=D(this.za)?this.za:[this.za];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}Wa(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.za){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.Wa("y")}scrollX(){return this.Wa("x")}}var qs=t=>_r(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class Hs{constructor(t,e,i,r){this.st=t=>{var e=this.Va();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Ga(this._instance)};this.Za.register({[Le]:i})}},this._instance=t,this.Qa=e,this.Za=i,this.Ga=r||qs,this.Qa.onSessionId(this.st)}Va(){return this.Za.props[Le]}getSetOnceProps(){var t,e=null==(t=this.Va())?void 0:t.props;return e?"r"in e?pr(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return li(di(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+C(i)]=e})),t}}class Gs{on(t,e){return this.Ja[t]||(this.Ja[t]=[]),this.Ja[t].push(e),()=>{this.Ja[t]=this.Ja[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Ja[t]||[])i(e);for(var r of this.Ja["*"]||[])r(t,e)}constructor(){this.Ja={}}}var Ws=ue("[SessionId]"),Vs=864e5;class Ys{on(t,e){return this.Ka.on(t,e)}constructor(t,e,i){var r;if(this.Ya=null,this.Xa=null,this.eo=[],this.io=void 0,this.ro=!1,this.Ka=new Gs,this.no=(t,e)=>!(!W(t)||!W(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Xe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Wi=t.config,this.Za=t.persistence,this.ut=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.so=void 0,this._sessionActivityTimestamp=null,this.ao=e||bi,this.oo=i||bi;var s=this.Wi.persistence_name||this.Wi.token;if(this._sessionTimeoutMs=1e3*tt(this.Wi.session_idle_timeout_seconds||1800,60,36e3,Ws.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lo(),this.uo="ph_"+s+"_window_id",this.ho="ph_"+s+"_primary_window_exists",this.do()){var n=ji.zr(this.uo),o=ji.zr(this.ho);n&&!o?this.ut=n:ji.$r(this.uo),ji.Hr(this.ho,!0)}null!=(r=this.Wi.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Wi.bootstrap.sessionID),this.vo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return L(this.eo)&&(this.eo=[]),this.eo.push(t),this._e&&t(this._e,this.ut),()=>{this.eo=this.eo.filter((e=>e!==t))}}do(){return"memory"!==this.Wi.persistence&&!this.Za.Zs&&ji.Br()}co(t){t!==this.ut&&(this.ut=t,this.do()&&ji.Hr(this.uo,t))}fo(){return this.ut?this.ut:this.do()?ji.zr(this.uo):null}po(t){var e=this.Ya;return!q(e)&&!q(t)&&5e3>Math.abs(t-e)}mo(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this._e||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this._e=t,s&&!r||s&&this.po(e)||(this.Ya=e,this.Za.register({[Ee]:[e,t,i]}))}yo(){var t,e=null==(t=this.Wi)?void 0:t.persistence_save_debounce_ms;return W(e)&&e>0}bo(){this.yo()?this.Za.refreshKey(Ee):(this.Za.flush(),this.Za.load())}_o(){var t;if(!q(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ya){this.bo();var e=this.wo();e[1]===this._e&&e[2]===this._sessionStartTimestamp&&(this.Ya=this._sessionActivityTimestamp,this.Za.register({[Ee]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Za.flush())}}ko(){var t=this.wo()[0],e=W(t)?t:0,i=W(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}So(t){return this.bo(),this.no(t,this.ko())}wo(){var t=this.Za.props[Ee];return D(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ya=null,this.so=void 0,clearTimeout(this.xo),this.xo=void 0,this.mo(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void Ws.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Ws.error("Invalid sessionID in bootstrap",t)}}(t);return!L(i)&&(e?this.so={sessionId:t,sessionStartTimestamp:i}:this.mo(t,(new Date).getTime(),i),!0)}destroy(){this.ro=!0,this._o(),clearTimeout(this.xo),this.xo=void 0,this.io&&t&&(t.removeEventListener(ii,this.io,{capture:!1}),this.io=void 0),this.eo=[]}vo(){this.io=()=>{this._o(),this.do()&&ji.$r(this.ho)},_i(t,ii,this.io,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.Wi.cookieless_mode===Xe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this._e;if(i)this.Xa=r;else if(q(this.Xa)||this.Xa>r||r-this.Xa>=1e3){var n,o;null==(n=(o=this.Za).syncCookieProperties)||n.call(o),this.Xa=r}var a=this.wo(),l=a[1],h=a[2],u=!L(s)&&l!==s,d=this.ko(),v=this.fo(),c=this.so,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Vs),p=c?_:W(h)&&Math.abs(r-h)>Vs,f=!1,g=u,m=!l||!!c,w=l,y=!m&&!t&&this.no(r,d);if(y){(y=this.So(r))||Ws.info("cross-tab refresh kept the session alive",{sessionId:l});var b=this.wo();l=b[1],h=b[2]}if(m||y||p){g=!1;var x=c&&!_;l=x?c.sessionId:this.ao(),v=this.oo(),Ws.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.so=void 0,f=!0}else v||(v=this.oo(),f=!0),(g=g||l!==w)&&(Ws.info("adopted cross-tab session id",{sessionId:l,windowId:v}),f=!0);var E=W(d)&&t&&!p?d:r,S=W(h)?h:(new Date).getTime();this.co(v),this.mo(l,E,S),t||this.lo();var T={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.eo.forEach((t=>t(l,v,T))),{sessionId:l,windowId:v,sessionStartTimestamp:S,changeReason:f?T:void 0,lastActivityTimestamp:d}}lo(){this.ro||(clearTimeout(this.xo),this.xo=setTimeout((()=>{if(!this.ro)if(this.So((new Date).getTime())){var t=this._e;this.resetSessionId(),this.Ka.emit("forcedIdleReset",{idleSessionId:t})}else this.lo()}),1.1*this.sessionTimeoutMs))}}function Js(){return(Js=_((function*(){var t=null==i?void 0:i.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=null==e?void 0:e.model;return j(r)&&r.length>0?r:void 0}catch(t){return void he.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ks(t,e,i){return tr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Xs="custom",Qs="i.posthog.com",Zs=/^\/static\//,tn=["/s/","/e/","/i/"];class en{constructor(t){this.Co={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Qs,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Co[this.apiHost]||(this.Co[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Xs),this.Co[this.apiHost]}To(t){if(Zs.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}Mo(t){var e=er(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}Eo(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=er(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&tn.some((t=>0===e.indexOf(t)))){var a=this.Mo(r);if(a){var l,h=this.apiHost,u=this.Io;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.Io=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Io,i=this.Mo(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.Eo(t,e,this.uiHost+e);if("flags"===t)return this.Eo(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.To(e);if(i)return this.Eo(t,e,""+i+e)}if(this.region===Xs)return this.Eo(t,e,this.apiHost+e);var r=Qs+e;switch(t){case"assets":return this.Eo(t,e,"https://"+this.region+"-assets."+r);case"api":return this.Eo(t,e,"https://"+this.region+"."+r)}}}var rn=ue("[Surveys]"),sn={ignoreConditions:!1,ignoreDelay:!1,displayType:Dr.Popover},nn=ue("[PostHog ExternalIntegrations]"),on={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class an{constructor(t){this._instance=t}Ts(t,e){var i;null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return nn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=d.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.Ts(on[n],(()=>{var e;null==(e=d.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=d.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=d.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class ln{constructor(t,e){this.I=t,this.ds=e,this.Ro=new Map,this.os=!1}add(t){var e=this;return _((function*(){if(e.os)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.Ro.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.Ro.set(t.name,t);try{var i=t.setup(e.ds);i&&(yield i)}catch(i){var r=e.Ro.get(t.name)===t;r&&e.Ro.delete(t.name),e.I.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.Po(t)}}))()}getExtension(t){return this.Ro.get(t)}dispose(){if(!this.os){this.os=!0;var t=Array.from(this.Ro.values()).reverse();for(var e of(this.Ro.clear(),t))this.Po(e)}}Po(t){try{var e=null==t.dispose?void 0:t.dispose();e&&U(e.then)&&e.then(void 0,(e=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class hn{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);L(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var un="extensionsRemoteConfig";class dn{constructor(t){this.os=!1,this.instance=t,this.I=he,this.Ao=t.Fo,this.kv=new hn(t),this.onEvent=t=>Er(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.os)return Er((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.Oo.on(un,e);return this.Ao&&e(this.Ao),Er(i)},this.Lo=new ln(he.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(me))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(me);return"string"==typeof t?t:void 0}get library(){return{name:v.LIB_NAME,version:v.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Lo.add(t)}getExtension(t){return this.Lo.getExtension(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.Do(t))}handleRemoteConfig(t){this.os||(this.Ao=t,this.instance.Oo.emit(un,t))}sendRequest(t,e){var i=this;return _((function*(){var r;void 0===e&&(e={});var s=i.instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",t),n={method:e.method,url:e.query?Rs(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?m.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.os||(this.os=!0,this.Lo.dispose())}}var vn,cn={},_n=0,pn=()=>{},fn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',gn="Surveys module not available",mn="sanitize_properties is deprecated. Use before_send instead",wn="Invalid value for property_denylist config: ",yn=["token","distinct_id",Ve],bn="posthog",$n=!xs&&-1===(null==h?void 0:h.indexOf("MSIE"))&&-1===(null==h?void 0:h.indexOf("Mozilla")),xn=t=>{var e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},En=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ci(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:pn,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&j(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){he.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ti,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Bs},error_tracking:{},_onCapture:pn},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:qi,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:xn(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},Sn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],Tn=t=>{var e={};for(var i of Sn){var r=i[0],s=i[1];L(t[r])||(e[s]=t[r])}var n=hi({},e,t),o=t.__preview_external_dependency_versioned_paths;return L(o)||(L(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),j(o)&&L(t.asset_host)&&(n.asset_host=o)),D(t.property_blacklist)&&(L(t.property_denylist)?n.property_denylist=t.property_blacklist:D(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:he.error(wn+t.property_denylist)),n};class Rn{constructor(){this.__forceAllowLocalhost=!1}get $o(){return this.__forceAllowLocalhost}set $o(t){he.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class kn{No(t,e){if(t){var i=this.Ro.indexOf(t);-1!==i&&this.Ro.splice(i,1)}return this.Ro.push(e),null==e.initialize||e.initialize(),e}qo(){return this.config.cookieless_mode===Xe||this.config.cookieless_mode===Ke&&this.consent.isRejected()}jo(){if(!this.qo()&&this.get_distinct_id()===We){var t=this.persistence;if(t){this.Bo()||t.load(!0);var e=this.get_distinct_id();if(!e||e===We){var i=this.config.get_device_id(bi());this.register({distinct_id:i,$device_id:i}),t.set_property(Fe,Qe)}this.Ho()}}}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 Rn,this.Uo=!1,this.version=v.LIB_VERSION,this.zo=new Set,this.Wo="",this.Oo=new Gs,this.Ro=[],this.Vo=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=En(),this.SentryIntegration=Yi,this.sentryIntegration=t=>function(t,e){var i=Vi(t,e);return{name:Wi,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Go=!1,this.Zo=null,this.Qo=null,this.Jo=null,this.scrollManager=new zs(this),this.pageViewManager=new Ji(this),this.rateLimiter=new jr(this),this.requestRouter=new en(this),this.consent=new zi(this),this.externalIntegrations=new an(this);var e=null!==(t=kn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=j(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=j(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>he.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==bn){var r,s=null!==(r=cn[i])&&void 0!==r?r:new kn;return s._init(t,e,i),cn[i]=s,cn[bn][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o,a=j(e)?e.trim():"";if(!a)return he.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=En(i.defaults),i.debug=this.Ko(i.debug),this.Yo=i,this.Xo=[],i.person_profiles?this.Qo=i.person_profiles:i.process_person&&(this.Qo=i.process_person);var l=En(i.defaults),h=Tn(i),u=hi({},l,h,{name:r,token:a});B(l.rageclick)&&B(h.rageclick)&&(u.rageclick=hi({},l.rageclick,h.rageclick)),B(l.session_recording)&&B(h.session_recording)&&(u.session_recording=hi({},l.session_recording,h.session_recording)),this.set_config(u),this.config.on_xhr_error&&he.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Sr.GZipJS;var d=this.Bo();if(this.persistence=new xr(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(p({},this.config,{persistence:"sessionStorage"}),d,!1),this.Wo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&ji.Br()){var c=ji.zr(this.Wo);D(c)&&c.forEach((t=>{j(t)&&this.zo.add(t)}))}else ji.$r(this.Wo);var _=p({},this.persistence.props),f=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.tl=new Fs((t=>this.el(t)),this.config.request_queue_config),this.il=new js(this),this.__request_queue=[];var g=this.qo();if(g||(this.sessionManager=new Ys(this),this.sessionPropsManager=new Hs(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.rl()}))),this.nl(),this.config.__preview_deferred_init_extensions?(he.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.sl(g)}),0)):(he.info("Initializing extensions synchronously"),this.sl(g)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&he.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:_,s:f}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var m=i.bootstrap.distinctID,w=this.get_distinct_id(),y=this.persistence.get_property(Fe);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==m&&y===Qe)this.identify(m);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==m&&y===Ze)he.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var b=this.config.get_device_id(bi()),x=i.bootstrap.isIdentifiedID?b:m;this.persistence.set_property(Fe,i.bootstrap.isIdentifiedID?Ze:Qe),this.register({distinct_id:m,$device_id:x})}}if(g)this.register_once({distinct_id:We,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(bi());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Fe,Qe)}return _i(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||bi();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Fe,Ze)),e()},s=i.user();"then"in s&&U(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Gi.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Gi.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Gi.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,ri),identify:t=>e(t,ni),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.al())):this.al(),U(this.config._onCapture)&&this.config._onCapture!==pn&&(he.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&he.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return Js.apply(this,arguments)}().then((t=>{t&&this.register({[we]:t})})).catch(pn),this}ol(t){var e=t;return j(e.name)&&U(e.setup)}ll(t,e){this.ol(t)?e.push((()=>{this.ul().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((e=>{he.error('Failed to dispose browser extension "'+t.name+'"',e)}))})):this.Ro.push(t)}nl(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=kn.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.hl)||r.call(this),this.hl=void 0,this.featureFlags=new o(this)),U(this.featureFlags.onReloading)&&U(this.featureFlags.setup)?this.hl||(this.hl=this.featureFlags.onReloading((()=>{this.Oo.emit("featureFlagsReloading",!0)})),this.ul().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}sl(t){var e,i,r,s,n,o,a,l=performance.now(),h=p({},kn.__defaultExtensionClasses,this.config.__extensionClasses),u=[];h.exceptions&&this.Ro.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new h.exceptions(this)),h.historyAutocapture&&this.Ro.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ro.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Ro.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.Ro.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||u.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.ll(this.autocapture=new h.autocapture(this),u),h.surveys&&this.ll(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new h.surveys(this),u),h.logs&&this.ll(this.logs=null!==(r=this.logs)&&void 0!==r?r:new h.logs(this),u),h.metrics&&this.Ro.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new h.metrics(this)),h.conversations&&this.Ro.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new h.conversations(this)),h.productTours&&this.Ro.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ro.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ro.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ro.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ro.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Hi)),h.toolbar&&this.Ro.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new h.toolbar(this)),h.experiments&&this.Ro.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new h.experiments(this)),this.Ro.forEach((t=>{t.initialize&&u.push((()=>{null==t.initialize||t.initialize()}))})),u.push((()=>{if(this.dl){var t=this.dl;this.dl=void 0,this.Ro.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.vl(u,l)}vl(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.vl(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){he.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Ye]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Je]:r}),this.config.__preview_deferred_init_extensions&&he.info("PostHog extensions initialized ("+r+"ms)")}wa(t){var e;if(!r||!r.body)return he.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.wa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.dl=t),this.Fo=t,this.compression=void 0,t.ok){var i,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=I(s.supportedCompression,Sr.GZipJS)?Sr.GZipJS:I(s.supportedCompression,Sr.Base64)?Sr.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Qo?this.Qo:ti}),null==(e=this.cl)||e.handleRemoteConfig(t),this.Ro.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}al(){try{this.config.loaded(this)}catch(t){he.critical("`loaded` function failed",t)}if(this.fl(),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.qo())&&this.pl()}),1),this.gl=new qr(this),this.gl.load()}fl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.tl)||t.enable())}_dom_loaded(){this.is_capturing()&&ai(this.__request_queue,(t=>this.el(t))),this.__request_queue=[],this.fl()}_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.ml()&&this.capture(si),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.tl)||r.unload(),null==(s=this.il)||s.unload()):this.ml()&&this.capture(si,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?$n?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback: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,h,u,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&L(s.compression)&&s.data&&(s.compression=Sr.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(u=(h=(D(n=s.data)?n:[n]).map((t=>p({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=u.properties)?void 0:a.token)&&void 0!==o?o:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),D(t)?t.map((t=>p({},t,{sent_at:e}))):p({},t,{sent_at:e})}(s.data))),s.url=Ds(s.url,s.method,s.compression,s.timestampMode);var v=Us.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:r.method)&&void 0!==i?i:v[0].method;if(!c)throw new Error("No available transport method");var _=t=>{try{c(t)}catch(t){Ms(t)?he.warn(t):he.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===Sr.GZipJS&&l&&"undefined"!=typeof Promise&&!Ss?Is(s).then((t=>{_(t)})).catch((e=>{if(S(e))return Ss=!0,void _(p({},s,{compression:void 0,url:Ds(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return S(t)||e===b})(e)&&(Ss=!0),_(s)})):c(s)})(p({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}el(t){this.il?this.il.retriableRequest(t):this._send_request(t)}_execute_array(t){_n++;try{var e,i=[],r=[],s=[];ai(t,(t=>{if(t)if(D(e=t[0]))s.push(t);else if(U(t))try{t.call(this)}catch(e){he.error("Error executing queued PostHog call",t,e)}else D(t)&&"alias"===e?i.push(t):D(t)&&-1!==e.indexOf("capture")&&U(this[e])?s.push(t):r.push(t)}));var n=function(t,e){ai(t,(function(t){try{if(D(t[0])){var i=e;li(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){he.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{_n--}}push(t){if(_n>0&&D(t)&&j(t[0])){var e=kn.prototype[t[0]];U(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.tl){if(this.is_capturing())if(!L(t)&&j(t)){this.jo();var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var h=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){null!=e&&e.$current_url&&!j(null==e?void 0:e.$current_url)&&(he.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i._originatedFromCaptureException||he.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var u=new Date,d=(null==i?void 0:i.timestamp)||u,v=oe(null==i?void 0:i.uuid,bi),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===ri&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),h&&(c.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var _="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property(Ie);(null==i?void 0:i.$set)&&!_&&(c.$set=null==i?void 0:i.$set);var f=null==i?void 0:i.$unset;f&&(c.$unset=f);var m,w,y,b=_?void 0:this.bl(null==i?void 0:i.$set_once,t!==oi,t===ni);if(b&&(c.$set_once=b),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>j(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){if(e!==Object(e))return o?o(e):e;if(!a.has(e)){var r;if(a.add(e),D(e))r=[],ai(e,(e=>{r.push(t(e))}));else{var s={};li(e,((e,i)=>{a.has(e)||(s[i]=t(e,i))})),r=s}return r}}(n)),c.timestamp=d,L(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=u),_&&(c.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return g.forEach(r),e.forEach(r),i}(c.properties,yn)),t===Ar.DISMISSED||t===Ar.SENT){var x=null==e?void 0:e[Nr.SURVEY_ID],E=null==e?void 0:e[Nr.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){rn.error("Failed to persist survey seen state",t)}})({id:x,current_iteration:E}),c.$set=p({},c.$set,{[(m={id:x,current_iteration:E},w=t===Ar.SENT?"responded":"dismissed",y="$survey_"+w+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(y="$survey_"+w+"/"+m.id+"/"+m.current_iteration),y)]:!0})}else t===Ar.SHOWN&&(c.$set=p({},c.$set,{[Nr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Br.SHOWN){var S=null==e?void 0:e[Fr.TOUR_TYPE];S&&(c.$set=p({},c.$set,{[Fr.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var T=p({},c.properties.$set,c.$set);if(F(T)||this.setPersonPropertiesForFlags(T),!H(this.config.before_send)){var R=this.En(c);if(!R)return;(c=R).uuid=oe(c.uuid,bi)}this.Oo.emit("eventCaptured",c);var k=null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),P={method:"POST",url:k,data:c,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(k)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.el(P):this.tl.enqueue(P),c}he.critical("This capture call is ignored due to client rate limiting.")}}else he.error("No event name provided to posthog.capture")}else he.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}getExtension(t){var e;return null==(e=this.cl)?void 0:e.getExtension(t)}ul(){var t;return null!==(t=this.cl)&&void 0!==t?t:this.cl=new dn(this)}Do(t){this.Vo.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.Vo.indexOf(t);-1!==i&&this.Vo.splice(i,1)}}}_l(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Jo=null,this.persistence.get_property(Fe)===Qe&&(null==(r=this.sessionPersistence)||r.clear(),this.zo.clear(),this.wl()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this._l();var l=a?void 0:this.persistence.remove_event_timer(e),u=p({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.qo()&&(u[Ve]=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!j(u.distinct_id)&&!G(u.distinct_id)||z(u.distinct_id))&&he.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var c,_=function(e,i,r,n){var o,a,l,u;if(void 0===n&&(n=!1),!h)return{};var d,c=e?[...nr,...i||[]]:[],_=function(t){for(var e=0;re.length>e;e++){var i=re[e],r=i[1],s=i[0].exec(t),n=s&&(U(r)?r(s,t):r);if(n)return n}return["",""]}(h),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==(u=t.screen)?void 0:u.height,S=null==t?void 0:t.devicePixelRatio;L(y)||(w.userAgentDataPlatform=y),L(b)||(w.maxTouchPoints=b),L(x)||(w.screenWidth=x),L(E)||(w.screenHeight=E),L(S)||(w.devicePixelRatio=S);var T,R,k,P,O,I,C,M,A=hi(di({$os:p,$os_version:f,$browser:te(h,navigator.vendor,g,m),$device:se(h),$device_type:(R=h,k=w,M=se(R),M===ot||M===nt||"Kobo"===M||"Kindle Fire"===M||M===Dt?st:M===St||M===Rt||M===Tt||M===Mt?"Console":M===lt?"Wearable":M?et:"Android"===(null==k?void 0:k.userAgentDataPlatform)&&(null!==(P=null==k?void 0:k.maxTouchPoints)&&void 0!==P?P:0)>0?600>Math.min(null!==(O=null==k?void 0:k.screenWidth)&&void 0!==O?O:0,null!==(I=null==k?void 0:k.screenHeight)&&void 0!==I?I:0)/(null!==(C=null==k?void 0:k.devicePixelRatio)&&void 0!==C?C:1)?et:st:"Desktop"),$timezone:fr(),$timezone_offset:gr()}),{$current_url:rr(n?ae(null==s?void 0:s.href):null==s?void 0:s.href,c,ar),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:h.length>1e3?h.substring(0,997)+"...":h,$browser_version:ie(h,navigator.vendor,g,m),$browser_language:dr(),$browser_language_prefix:(T=dr(),"string"==typeof T?T.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=v.SDK_DIST_CHANNEL),A}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var f=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),g=f.windowId;u.$session_id=f.sessionId,u.$window_id=g}this.sessionPropsManager&&hi(u,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&hi(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(m=this.il)?void 0:m.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Xs&&(u.$lib_custom_api_host=this.config.api_host),c=e!==ri||a?e!==si||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),u=hi(u,c),e===ri&&r&&(u.title=r.title),!L(l)){var w=n.getTime()-l;u.$duration=parseFloat((w/1e3).toFixed(3))}h&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties();li(["$referrer","$referring_domain"],(t=>{t in y&&delete b[t]}));var x={};if(this.Vo.length>0)for(var E of this.Vo.slice())try{hi(x,E())}catch(t){he.error("Failed to produce browser extension event properties",t)}(u=hi({},_,y,b,p({},x,u))).$is_identified=this._isIdentified(),D(this.config.property_denylist)?li(this.config.property_denylist,(function(t){delete u[t]})):he.error(wn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(he.error(mn),u=S(u,e));var T=this.kl();return u.$process_person_profile=T,T&&!a&&this.Sl("_calculate_event_properties"),u}bl(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.kl())return t;if(this.Uo&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=hi({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(he.error(mn),o=a(o,"$set_once")),e&&(this.Uo=!0),F(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this._l(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.zo.add(t))),this.wl()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.zo.delete(t),this.wl()}xl(t,e){this.register({[t]:e})}rl(){this.zo.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.zo.clear(),this.wl()}wl(){var t;if(this.Wo)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Zs||!ji.Br())ji.$r(this.Wo);else{var e=[];this.zo.forEach((t=>e.push(t))),e.length>0?ji.Hr(this.Wo,e):ji.$r(this.Wo)}}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.Oo.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:gn}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:gn})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:gn})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=sn),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:gn}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:gn})}Cl(t){return!t||z(t)?(he.critical("Unique user id has not been set in posthog.identify"),!1):t===We?(he.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())||(he.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 he.uninitializedWarning("posthog.identify");if(G(t)&&(t=t.toString(),he.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Cl(t)&&this.Sl("posthog.identify")){this.jo();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this._l(!1),o=this.persistence.Ks(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(me)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(ye)&&(this.unregister(ye),this.register({distinct_id:t}));var h,u=(this.persistence.get_property(Fe)||Qe)===Qe,d=t!==l,v=!d&&u;if(d&&u)this.persistence.set_property(Fe,Ze),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Ys(),this.capture(ni,{distinct_id:t,$anon_distinct_id:l},{$set:e||{},$set_once:i||{}}),this.Jo=Ks(t,e,i),null==(h=this.featureFlags)||h.setAnonymousDistinctId(l);else if(v){this.persistence.set_property(Fe,Ze);var c=e||{},_=i||{};this.setPersonPropertiesForFlags({$set:c,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Ys(),this.capture("$set",{$set:c,$set_once:_}),this.Jo=Ks(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(De)):v&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.ea(a)}}}setPersonProperties(t,e){if((t||e)&&this.Sl("posthog.setPersonProperties")){var i=Ks(this.get_distinct_id(),t,e);this.Jo!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Jo=i):he.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(D(t)?t:[t]).filter((t=>j(t)&&t.length>0));0!==i.length&&this.Sl("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Jo=null)}group(t,e,i){var r;if(t&&e){null==(r=this.persistence)||r.syncCookieProperties(),this._l();var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},s,{[t]:e})}),n||i){var o={$group_type:t,$group_key:e};i&&(o.$group_set=i),this.capture(oi,o)}i&&this.setGroupPropertiesForFlags({[t]:i}),n&&!i&&this.reloadFeatureFlags()}else he.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.Sl("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=V(t)?t:null==t?void 0:t.resetDeviceID,i=V(t)||null==t?void 0:t.bootstrap;this.Tl(e,!1,i)}Tl(t,e,i){var r,s,n;if(void 0===e&&(e=!1),he.info("reset"),!this.__loaded)return he.uninitializedWarning("posthog.reset");var o=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(r=this.Yo)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(me),l=this.get_property(we),h=this.get_property(xe),u=this.is_capturing();this.consent.reset(),e||!u||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(n=this.persistence)||null==n.Ks?void 0:n.Ks(),v=!1;try{var c,_,f,g,m,w,y,b,x,E,S,T,R;if(null==(c=this.persistence)||c.clear(),null==(_=this.sessionPersistence)||_.clear(),this.zo.clear(),this.wl(),L(h)||null==(E=this.persistence)||E.register({[xe]:h}),null==(f=this.surveys)||f.reset(),null==(g=this.featureFlags)||g.reset(),null==(m=this.conversations)||m.reset(),null==(w=this.logs)||w.reset(),null==(y=this.metrics)||y.reset(),null==(b=this.persistence)||b.set_property(Fe,Qe),null==(x=this.sessionManager)||x.resetSessionId(),this.Jo=null,this.config.cookieless_mode===Xe)this.register_once({distinct_id:We,$device_id:null},"");else{var k=this.config.get_device_id(bi());this.register_once({distinct_id:k,$device_id:t?k:a},""),t||L(l)||this.register({[we]:l})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this.qo()||(null==(R=this.persistence)||R.set_property(Fe,i.isIdentifiedID?Ze:Qe),this.register({distinct_id:i.distinctID})),null==(S=this.featureFlags)||S.initialize(),!(L(o)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(o,!0))){var P=p({},i);delete P.sessionID,this.config.bootstrap=P}delete this.config.identity_distinct_id,delete this.config.identity_hash,v=!0}finally{var O;d&&(null==(O=this.persistence)||null==O.ea||O.ea(v))}this.reloadFeatureFlags()}shutdown(t){var e=this;return _((function*(){var t,i,r,s,n;if(e.__loaded){e.ul().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.tl)||s.unload(),null==(n=e.il)||n.unload();try{var o;null==(o=e.featureFlags)||o.destroy()}catch(t){he.error("Error while destroying feature flags",t)}}else he.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(fe)?(he.critical("Attempting to create alias for existing People user - aborting."),-2):this.Sl("posthog.alias")?(L(e)&&(e=this.get_distinct_id()),t!==e?(this.xl(ye,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(he.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,h,u,d,c,_;hi(this.config,Tn(t));var f=this.Bo();null==(i=this.persistence)||i.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(p({},this.config,{persistence:"sessionStorage"}),f,!1);var g,m=this.Ko(this.config.debug);V(m)&&(this.config.debug=m),V(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,Ri.Br()&&Ri.Hr("ph_debug",!0),he.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,Ri.Br()&&Ri.$r("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(h=this.heatmaps)||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.Ho(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:kn.Il}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:bn;return e!==bn&&(e=bn+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Fe))===Ze||(null==(e=this.sessionPersistence)?void 0:e.get_property(Fe))===Ze}kl(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ti&&!this._isIdentified()&&F(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[ye])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ge]))}ml(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.kl()||this.Sl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Sl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Sl(t){return"never"===this.config.person_profiles?(he.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.xl(Ge,!0),!0)}Bo(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ke)}Ho(){var t,e,i,r,s=this.Bo();return(null==(t=this.persistence)?void 0:t.Zs)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.Zs)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.zo.clear(),this.wl()),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==Xe){if(this.qo()){var i,r,s,n,o;this.Tl(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Ys(this),this.pageViewManager=new Ji(this),this.persistence&&(this.sessionPropsManager=new Hs(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=kn.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.No(this.sessionRecording,new l(this)),this.Fo&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Fo)))}var h,u;this.consent.optInOut(!0),this.Ho(),this.fl(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==Ke&&(null==(h=this.surveys)||h.loadIfEnabled()),(L(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.pl()}else he.warn(fn)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==Xe?(this.config.cookieless_mode===Ke&&this.consent.isOptedIn()&&this.Tl(!0,!0),this.consent.optInOut(!1),this.Ho(),this.config.cookieless_mode===Ke&&(this.register({distinct_id:We,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.pl(),this.fl())):he.warn(fn)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Xe||(this.config.cookieless_mode===Ke?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ho()}_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}pl(){r&&("visible"===r.visibilityState?this.Go||(this.Go=!0,this.capture(ri,{title:r.title},{send_instantly:!0}),this.Zo&&(r.removeEventListener(ei,this.Zo),this.Zo=null)):this.Zo||(this.Zo=this.pl.bind(this),_i(r,ei,this.Zo)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var t=this.Yo||{};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?(he.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,he)}En(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=D(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),H(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return J(t.event)?he.warn(o+". This can cause unexpected behavior."):he.info(o),null}s.properties&&!F(s.properties)||he.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return he.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&H(s.properties[a]))return he.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.Is)?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)})}Ko(t){var e=V(t)&&!t,i=Ri.Br()&&"true"===Ri.Ur("ph_debug");return!e&&(!!i||t)}}kn.__defaultExtensionClasses={},kn.Il={trace:vn=()=>{},debug:vn,info:vn,warn:vn,error:vn,fatal:vn},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=ui(t.prototype[e[i]])}(kn,["identify"]);var Pn=function(){v.SDK_DIST_CHANNEL="npm";var e=cn[bn]=new kn;return function(){function e(){e.done||(e.done=!0,$n=!1,li(cn,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():_i(r,"DOMContentLoaded",e,{capture:!1}):t&&he.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Sr as Compression,Ur as DEFAULT_PRODUCT_TOUR_APPEARANCE,Dr as DisplaySurveyType,kn as PostHog,Br as ProductTourEventName,Fr as ProductTourEventProperties,Ar as SurveyEventName,Nr as SurveyEventProperties,Tr as SurveyEventType,kr as SurveyPosition,Cr as SurveyQuestionBranchingType,Ir as SurveyQuestionType,Mr as SurveySchedule,Pr as SurveyTabPosition,Or as SurveyType,Rr as SurveyWidgetType,Pn as default,Pn as posthog,Hr as severityLevels};
1
+ var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,h=null==i?void 0:i.userAgent,u="undefined"!=typeof globalThis?globalThis:t;u&&"undefined"==typeof self&&(u.self=u),u&&"undefined"==typeof File&&(u.File=function(){});var d=null!=t?t:{},v={DEBUG:!1,LIB_VERSION:"0.6.0",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=["$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"],g=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),m=["$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"],w=["token"],y=["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"],b=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return y.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function x(t,e){return-1!==t.indexOf(e)}var E=function(t){return t.replace(/^\$/,"")},S=Object.prototype,T=S.hasOwnProperty,R=S.toString,k=Array.isArray||function(t){return"[object Array]"===R.call(t)},P=t=>"function"==typeof t,O=t=>t===Object(t)&&!k(t),I=t=>{if(O(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,M=t=>"[object String]"==R.call(t),A=t=>M(t)&&0===t.trim().length,N=t=>null===t,D=t=>C(t)||N(t),U=t=>"[object Number]"==R.call(t)&&t==t,B=t=>U(t)&&t>0,F=t=>"[object Boolean]"===R.call(t),L=t=>t instanceof FormData,j=t=>x(m,t),z=t=>x(w,t),q=[!0,"true",1,"1","yes"],H=t=>x(q,t),G=[!1,"false",0,"0","no"];function W(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),U(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),W(s||i,e,i,r))}var V="Mobile",Y="iOS",J="Android",K="Tablet",X=J+" "+K,Q="iPad",Z="Apple",tt=Z+" Watch",et="Safari",it="BlackBerry",rt="Samsung",st=rt+"Browser",nt=rt+" Internet",ot="Chrome",at=ot+" OS",lt=ot+" "+Y,ht="Internet Explorer",ut=ht+" "+V,dt="Opera",vt=dt+" Mini",ct="Edge",_t="Microsoft "+ct,pt="Firefox",ft=pt+" "+Y,gt="Nintendo",mt="PlayStation",wt="Xbox",yt=J+" "+V,bt=V+" "+et,$t="Windows",xt=$t+" Phone",Et="Nokia",St="Ouya",Tt="Generic",Rt=Tt+" "+V.toLowerCase(),kt=Tt+" "+K.toLowerCase(),Pt="Konqueror",Ot="Oculus Browser",It="Vivaldi",Ct="Yandex",Mt="Whale",At="DuckDuckGo",Nt="Pale Moon",Dt="Waterfox",Ut="Brave",Bt="Google Search App",Ft="(\\d+(\\.\\d+)?)",Lt=new RegExp("Version/"+Ft),jt=new RegExp(wt,"i"),zt=new RegExp(mt+" \\w+","i"),qt=new RegExp(gt+" \\w+","i"),Ht=new RegExp(it+"|PlayBook|BB10","i"),Gt={"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"},Wt=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Ut:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&x(t,"GSA/")?Bt:x(t," OPR/")&&x(t,"Mini")?vt:x(t," OPR/")?dt:Ht.test(t)?it:x(t,"IE"+V)||x(t,"WPDesktop")?ut:x(t,"OculusBrowser")?Ot:x(t,st)?nt:x(t,ct)||x(t,"Edg/")?_t:x(t,It+"/")?It:x(t,"YaBrowser/")?Ct:x(t,Mt+"/")?Mt:x(t,At+"/")||x(t,"Ddg/")?At:x(t,"FBIOS")?"Facebook "+V:x(t,"UCWEB")||x(t,"UCBrowser")?"UC Browser":x(t,"CriOS")?lt:x(t,"CrMo")||x(t,ot)?ot:x(t,J)&&x(t,et)?yt:x(t,"FxiOS")?ft:x(t.toLowerCase(),Pt.toLowerCase())?Pt:x(t,Ut+"/")?Ut:((t,e)=>e&&x(e,Z)||function(t){return x(t,et)&&!x(t,ot)&&!x(t,J)}(t))(t,e)?x(t,V)?bt:et:x(t,"PaleMoon/")?Nt:x(t,Dt+"/")?Dt:x(t,pt)?pt:x(t,"MSIE")||x(t,"Trident/")?ht:x(t,"Gecko")?pt:"")},Vt={[ut]:[new RegExp("rv:"+Ft)],[_t]:[new RegExp(ct+"?\\/"+Ft)],[ot]:[new RegExp("("+ot+"|CrMo)\\/"+Ft)],[lt]:[new RegExp("CriOS\\/"+Ft)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ft)],[et]:[Lt],[bt]:[Lt],[dt]:[new RegExp("(Opera|OPR)\\/"+Ft)],[pt]:[new RegExp(pt+"\\/"+Ft)],[ft]:[new RegExp("FxiOS\\/"+Ft)],[Pt]:[new RegExp("Konqueror[:/]?"+Ft,"i")],[it]:[new RegExp(it+" "+Ft),Lt],[yt]:[new RegExp("android\\s"+Ft,"i")],[nt]:[new RegExp(st+"\\/"+Ft)],[Ot]:[new RegExp("OculusBrowser\\/"+Ft)],[It]:[new RegExp(It+"\\/"+Ft)],[Ct]:[new RegExp("YaBrowser\\/"+Ft)],[Mt]:[new RegExp(Mt+"\\/"+Ft)],[Ut]:[new RegExp(Ut+"\\/"+Ft)],[At]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ft)],[Nt]:[new RegExp("PaleMoon\\/"+Ft)],[Dt]:[new RegExp(Dt+"\\/"+Ft)],[Bt]:[new RegExp("GSA\\/"+Ft)],[ht]:[new RegExp("(rv:|MSIE )"+Ft)],Mozilla:[new RegExp("rv:"+Ft)]},Yt=function(t,e,i,r){var s=Wt(t,e,i,r),n=Vt[s];if(C(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},Jt=[[new RegExp(wt+"; "+wt+" (.*?)[);]","i"),t=>[wt,t&&t[1]||""]],[new RegExp(gt,"i"),[gt,""]],[new RegExp(mt,"i"),[mt,""]],[Ht,[it,""]],[new RegExp($t,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[xt,""];if(new RegExp(V).test(e)&&!/IEMobile\b/.test(e))return[$t+" "+V,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Gt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[$t,r]}return[$t,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Y,[t[3],t[4],t[5]||"0"].join(".")]:[Y,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=C(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+J+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+J+")","i"),t=>t&&t[2]?[J,[t[2],t[3],t[4]||"0"].join(".")]:[J,""]],[/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/,[at,""]],[/Linux|debian/i,["Linux",""]]],Kt=function(t){return qt.test(t)?gt:zt.test(t)?mt:jt.test(t)?wt:new RegExp(St,"i").test(t)?St:new RegExp("("+xt+"|WPDesktop)","i").test(t)?xt:/iPad/.test(t)?Q:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?tt:Ht.test(t)?it:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Et,"i").test(t)?Et:/(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(V).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)?J:X:new RegExp("(pda|"+V+")","i").test(t)?Rt:new RegExp(K,"i").test(t)&&!new RegExp(K+" pc","i").test(t)?kt:""},Xt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Qt(t,e){return"string"==typeof(i=t)&&Xt.test(i)?t:e();var i}function Zt(t,e){var i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function te(t){return t?t.split("#")[0]:t}var ee,ie="NativeGzipValidationError",re=t=>t.length>=2&&31===t[0]&&139===t[1],se=(t,e)=>t===g.GZipJS||e===g.GZipJS||"gzip"===e,ne=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),oe=t=>{throw Zt(ie,"Native gzip produced invalid output: "+t)},ae=function(){var t=_((function*(t,e){18>t.size&&oe("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());re(i)&&8===i[2]||oe("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(ee)return ee;ee=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;ee[t]=e>>>0}return ee})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&oe("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&oe("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function le(){return le=_((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 ae(l,r),l}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),le.apply(this,arguments)}var he=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={P(i){if(t&&(v.DEBUG||t.POSTHOG_DEBUG||r)&&!C(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.P("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.P("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.P("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.P("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>he(e+" "+t,i)};return s},ue=he("[PostHog.js]"),de=ue.createLogger,ve=de("[ExternalScriptsLoader]"),ce=t=>{var e=null==r?void 0:r.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},_e=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return ve.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=ce(e);if(s){if(s.__posthog_loading_callback_fired)return i();var n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,i(t)})))}var o=()=>{if(!r)return i("document not found");if(ce(e))return _e(t,e,i);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?o():null==r||r.addEventListener("DOMContentLoaded",o)},pe={},fe=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=pe[s];if("fallback"===r&&n){if(ce(n))return void _e(t,n,i);delete pe[s]}_e(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=fe(t,e);pe[s]=a;var l=ce(s);null==l||null==(o=l.parentNode)||o.removeChild(l),_e(t,a,i)}else i(void 0,n)}:i)}else _e(t,fe(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");_e(t,o,i)}},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);_e(t,r,i)};v.DEBUG=!1,v.LIB_VERSION="1.422.0",v.LIB_NAME="web";var ge="$people_distinct_id",me="distinct_id",we="$device_id",ye="$device_model",be="__alias",$e="__timers",xe="$dead_clicks_enabled_server_side",Ee="$session_recording_remote_config",Se="$sesid",Te="$session_is_sampled",Re="$enabled_feature_flags",ke="$active_feature_flags",Pe="$feature_flag_details",Oe="$feature_flag_payloads",Ie="$feature_flag_request_id",Ce="$minimal_flag_called_events",Me="$stored_person_properties",Ae="$stored_group_properties",Ne="$groups",De="$surveys_loaded_at",Ue="$flag_call_reported",Be="$feature_flag_errors",Fe="$feature_flag_evaluated_at",Le="$user_state",je="$client_session_props",ze="$capture_rate_limit",qe="$initial_campaign_params",He="$initial_referrer_info",Ge="$initial_person_info",We="$epp",Ve="$posthog_cookieless",Ye="$cookieless_mode",Je="$sdk_debug_extensions_init_method",Ke="$sdk_debug_extensions_init_time_ms",Xe="on_reject",Qe="always",Ze="anonymous",ti="identified",ei="identified_only",ii="visibilitychange",ri="beforeunload",si="$pageview",ni="$pageleave",oi="$identify",ai="$groupidentify";function li(t,e){k(t)&&t.forEach(e)}function hi(t,e){if(!D(t))if(k(t))t.forEach(e);else if(L(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)T.call(t,i)&&e(t[i],i)}var ui=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},di=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)}}},vi=function(t){var e={};return hi(t,(function(t,i){(M(t)&&t.length>0||U(t))&&(e[i]=t)})),e};var ci=["herokuapp.com","vercel.app","netlify.app"];function _i(t){var e=null==t?void 0:t.hostname;if(!M(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of ci)if(i===r)return!1;return!0}function pi(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 fi=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 U(t)&&isFinite(t)&&Math.floor(t)===t});class gi{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 gi(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 gi(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 mi{generate(){var t=this.generateOrAbort();if(!C(t))return t;this.Fr=0;var e=this.generateOrAbort();if(C(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.Fr)this.Fr=t,this.Nr();else{if(this.Fr>=t+1e4)return;this.qr++,this.qr>4398046511103&&(this.Fr++,this.Nr())}return gi.fromFieldsV7(this.Fr,Math.trunc(this.qr/Math.pow(2,30)),this.qr&Math.pow(2,30)-1,this.jr.nextUint32())}Nr(){this.qr=1024*this.jr.nextUint32()+(1023&this.jr.nextUint32())}constructor(){this.Fr=0,this.qr=0,this.jr=new bi}}var wi,yi=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&&!C(t.crypto)&&crypto.getRandomValues&&(yi=t=>crypto.getRandomValues(t));class bi{nextUint32(){return this.bt.length>this.Br||(yi(this.bt),this.Br=0),this.bt[this.Br++]}constructor(){this.bt=new Uint32Array(8),this.Br=1/0}}var $i=()=>xi().toString(),xi=()=>(wi||(wi=new mi)).generate(),Ei="",Si=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Ti={Hr:()=>!!r,zr(t){ue.error("cookieStore error: "+t)},$r:fi,Vr(t){var e;try{e=JSON.parse(Ti.$r(t))||{}}catch(t){}return e},Ur(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),Ei)return Ei;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_"+$i();!Ei&&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",Ei=o)}return Ei}(t);if(!i){var s=(t=>{var e=t.match(Si);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 h=new Date;h.setTime(h.getTime()+864e5*i),o="; expires="+h.toUTCString()}n&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&ue.warn("cookieStore warning: large cookie, len="+u.length),r.cookie=u,!0}catch(t){return!1}},Wr(t,e){if(null!=r&&r.cookie)try{Ti.Ur(t,"",-1,e)}catch(t){return}}},Ri=null,ki={Hr(){if(!N(Ri))return Ri;var e=!0;if(C(t))e=!1;else try{var i="__mplssupport__";ki.Ur(i,"xyz"),'"xyz"'!==ki.$r(i)&&(e=!1),ki.Wr(i)}catch(t){e=!1}return e||ue.error("localStorage unsupported; falling back to cookie store"),Ri=e,e},zr(t){ue.error("localStorage error: "+t)},$r(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){ki.zr(t)}return null},Vr(t){try{return JSON.parse(ki.$r(t))||{}}catch(t){}return null},Ur(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){ki.zr(t)}return!1},Wr(e){try{null==t||t.localStorage.removeItem(e)}catch(t){ki.zr(t)}}},Pi=[Me,ke,Re,Pe,Oe,Ie,Fe,Be,Ue],Oi=[we,me,Se,Te,We,Ge,Le],Ii=t=>t+"_cpm",Ci=["__proto__","constructor","prototype"],Mi=t=>{if(!O(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Ci.indexOf(i)&&(e[i]=t[i])})),e},Ai=function(t,e){void 0===e&&(e=[]);var i={};return[...Oi,...e].forEach((e=>{var r=t[e];C(r)||N(r)||""===r||(i[e]=r)})),i},Ni=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Di=(t,e)=>({p:e,f:Ni(JSON.stringify(t))}),Ui=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=Ti.Vr(Ii(t)),r=(null==i?void 0:i.f)===Ni(e)&&k(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Bi=(t,e)=>e+"|"+(Ti.$r(Ii(t))||""),Fi={},Li={Hr:()=>!0,zr(t){ue.error("memoryStorage error: "+t)},$r:t=>Fi[t]||null,Vr:t=>Fi[t]||null,Ur:(t,e)=>(Fi[t]=e,!0),Wr(t){delete Fi[t]}},ji=null,zi={Hr(){if(!N(ji))return ji;if(ji=!0,C(t))ji=!1;else try{var e="__support__";zi.Ur(e,"xyz"),'"xyz"'!==zi.$r(e)&&(ji=!1),zi.Wr(e)}catch(t){ji=!1}return ji},zr(t){ue.error("sessionStorage error: ",t)},$r(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){zi.zr(t)}return null},Vr(t){try{return JSON.parse(zi.$r(t))||null}catch(t){}return null},Ur(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){zi.zr(t)}return!1},Wr(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){zi.zr(t)}}};class qi{constructor(t){this._instance=t}get zi(){return this._instance.config}get consent(){return this.ks()?0:this.Ss}isOptedOut(){return this.zi.cookieless_mode===Qe||this.isRejected()||-1===this.consent&&this.zi.cookieless_mode===Xe}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.zi.opt_out_capturing_by_default}optInOut(t){this.xs.Ur(this.Cs,t?1:0,this.zi.cookie_expiration,this.zi.cross_subdomain_cookie,this.zi.secure_cookie)}reset(){this.xs.Wr(this.Cs,this.zi.cross_subdomain_cookie)}get Cs(){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 Ss(){var t=this.xs.$r(this.Cs);return H(t)?1:x(G,t)?0:-1}get xs(){var t=this.zi.opt_out_capturing_persistence_type,e="localStorage"===t?ki:Ti;if(!this.Ts||this.Ts!==e){this.Ts=e;var i="localStorage"===t?Ti:ki;i.$r(this.Cs)&&(this.Ts.$r(this.Cs)||this.optInOut(H(i.$r(this.Cs))),i.Wr(this.Cs,this.zi.cross_subdomain_cookie))}return this.Ts}ks(){return!!this.zi.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack].some((t=>H(t)))}}var Hi=["next","previous","prev",">","<","+","-","−","–"];de("[Dead Clicks]");var Gi=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(xe)),r=t.instance.config.capture_dead_clicks;return F(r)?r:!!O(r)||i},Wi=de("[SegmentIntegration]");var Vi="posthog-js";function Yi(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,h=void 0===l||l;return e=>{var i,o,l,u,d;if("*"!==a&&!a.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,_=(null==(i=e.exception)?void 0:i.values)||[],f=_.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(o=_[0])?void 0:o.value)||e.message,$exception_type:null==(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==(u=_[0])?void 0:u.value)||e.message,$sentry_exception_type:null==(d=_[0])?void 0:d.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),h&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class Ji{constructor(t,e,i,r,s,n){this.name=Vi,this.setupOnce=function(o){o(Yi(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Ki{constructor(t){this.Rs=(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.Ps=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.As()}As(){var t;this.Fs=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Rs)}destroy(){var t;null==(t=this.Fs)||t.call(this),this.Fs=void 0}doPageView(e,i){var r,s=this.Os(e,i);return this.Ps={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.Os(t,null==(e=this.Ps)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ps)?void 0:t.pageViewId}}Os(t,e){var i=this.Ps;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,h=s.lastContentY,u=s.maxContentY;if(!(C(n)||C(o)||C(a)||C(l)||C(h)||C(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?W(o/n,0,1,ue):1,v=n>1?W(a/n,0,1,ue):1,c=l>1?W(h/l,0,1,ue):1,_=l>1?W(u/l,0,1,ue):1;r=ui(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:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Xi=["flags","surveys"],Qi={[ge]:{exposure:"hidden"},[be]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[$e]:{exposure:"hidden"},$autocapture_disabled_server_side:{exposure:"event"},$heatmaps_enabled_server_side:{exposure:"hidden"},$logs_capture_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"},[xe]:{exposure:"event"},$product_tours_enabled_server_side:{exposure:"hidden"},$web_vitals_allowed_metrics:{exposure:"event"},[Ee]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Se]:{exposure:"hidden"},[Te]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:t=>N(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"},[Re]:{exposure:"hidden",storageGroup:"flags"},[ke]:{exposure:"hidden",storageGroup:"flags"},$early_access_features:{exposure:"hidden"},[Pe]:{exposure:"hidden",storageGroup:"flags"},[Oe]:{exposure:"hidden",storageGroup:"flags"},[Ie]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ce]:{exposure:"hidden",storageGroup:"flags"},$override_feature_flags:{exposure:"hidden"},$override_feature_flag_payloads:{exposure:"hidden"},[Me]:{exposure:"hidden"},[Ae]:{exposure:"hidden"},$surveys:{exposure:"hidden",storageGroup:"surveys"},[De]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},$surveys_activated:{exposure:"event"},$surveys_activated_session:{exposure:"hidden"},$surveys_activated_timestamps:{exposure:"hidden"},ph_product_tours:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ue]:{exposure:"hidden"},$flag_call_reported_session_id:{exposure:"hidden"},[Ne]:{exposure:"event"},[Be]:{exposure:"hidden"},[Fe]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Le]:{exposure:"hidden"},[je]:{exposure:"hidden"},[ze]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[He]:{exposure:"hidden"},[Ge]:{exposure:"hidden"},[We]:{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"},[Je]:{exposure:"event"},[Ke]:{exposure:"event"},$sdk_debug_recording_script_not_loaded:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Zi=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],tr=t=>{var e=Qi[t];if(e)return e;for(var i of Zi){var r=i[1];if(0===t.indexOf(i[0]))return r}},er=(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},ir=t=>{var e=null==r?void 0:r.createElement("a");return C(e)?null:(e.href=t,e)},rr=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(!k(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," ")},sr=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("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");k(d)&&(e.includes(d[0])?h.push(d[0]+"="+i):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},nr="https?://(.*)",or=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ar=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...or],lr="<masked>",hr=["li_fat_id"];function ur(t,e){var i=ar.concat(e||[]),r={};return hi(i,(function(e){var i=rr(t,e);r[e]=i||null})),r}function dr(t){var e=function(t){return t?0===t.search(nr+"google.([^/?]*)")?"google":0===t.search(nr+"bing.com")?"bing":0===t.search(nr+"yahoo.com")?"yahoo":0===t.search(nr+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!N(e)){s.$search_engine=e;var n=r?rr(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function vr(){return navigator.language||navigator.userLanguage}var cr="$direct";function _r(){return(null==r?void 0:r.referrer)||cr}function pr(t,e,i){void 0===i&&(i=!1);var r=t?[...or,...e||[]]:[],n=i?te(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:_r().substring(0,1e3),u:o?sr(o,r,lr):void 0}}function fr(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?te(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==cr?cr:null==(i=ir(r))?void 0:i.host};if(n){o.$current_url=n;var a=ir(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=ur(n);ui(o,l)}if(r){var h=dr(r);ui(o,h)}return o}function gr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function mr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var wr={flags:Fe,surveys:De},yr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],br=t=>t+"_cookie_identity_change_pending",$r="main",xr=(t,e)=>{hi(t,((i,r)=>{var s=tr(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class Er{constructor(e,i,r){if(void 0===r&&(r=!0),this.Ls={},this.Ds=!1,this.$s=!1,this.Ns=!1,this.qs=!1,this.zi=e,this.js=r,this.props={},this.Bs=void 0,this.Hs=(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.xs=this.Us(e),this.$s=this.zs(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();pi(t,"beforeunload",s,{capture:!1}),pi(t,"pagehide",s,{capture:!1})}}Ws(){var t,e=null==(t=this.zi)?void 0:t.persistence_save_debounce_ms;return U(e)&&e>0?e:0}Vs(t){if(this.zi.cookieWinsOnConflict&&"localstorage+cookie"===this.zi.persistence.toLowerCase())if(t)try{var e=Ai(t,this.zi.cookie_persisted_properties||[]),i=Di(e,this.zi.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=Ti.$r(this.Hs)||void 0;s&&Bi(this.Hs,s)===r&&(this.Gs=r,this.Zs=s)}catch(t){}else try{var n=Ti.$r(this.Hs)||void 0;this.Gs=n?Bi(this.Hs,n):void 0,this.Zs=n}catch(t){}}syncCookieProperties(){return this.Qs(this.zi)}Qs(t,e){if(void 0===e&&(e=!1),this.Js&&!e||this.qs||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=Ti.$r(this.Hs)||void 0}catch(t){}if(!i||i===this.Zs)return!1;var r,s=Bi(this.Hs,i);try{r=Mi(JSON.parse(i))}catch(t){return!1}if((Ti.$r(this.Hs)||void 0)!==i)return!1;this.Gs=s,this.Zs=i;var n=Ui(this.Hs,i),o=[...Oi,...n.properties],a={};if(Object.keys(r).forEach((t=>{var e=r[t];(C(e)||N(e)||""===e||t===Le&&e!==Ze&&e!==ti)&&(a[t]=!0,delete r[t])})),I(r))return!1;var l=me in r||r[Le]===Ze||r[Le]===ti,h=this.props[me],u=this.props[Le],d=ui({},this.props);[...Oi,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||t!==me&&t!==Le)){var e=d[t];!n.isValid&&-1!==Oi.indexOf(t)&&(!1===e||0===e)||delete d[t]}})),this.props=ui(d,r),!l||Le in r||Le in this.props||this.Ks(Le,Ze);var v=this.props[me],c=this.props[Le];return!l||v===h&&c===u||(this.Ns=!0,zi.Ur(br(this.Hs),!0),this.Ys(Me),this.Ys(ke),this.Ys(Re),this.Ys(Pe),this.Ys(Oe),this.Ys(Ie),this.Ys(Fe),this.Ys(Be),this.Ys(Ue),c===Ze&&(u===ti||r[Le]===Ze||!C(h)&&v!==h)&&(xr(this.props,r),this.Ys(Ae)),c===ti?this.props.$user_id=v:delete this.props.$user_id,this.Ys(be)),!0}consumeCookieIdentityChange(){var t=br(this.Hs),e=this.Ns||!!zi.$r(t);return this.Ns=!1,e&&zi.Wr(t),e}Xs(t){return void 0===t&&(t=!1),!(this.qs||this.Js&&!t||!this.zi.cookieWinsOnConflict||"localstorage+cookie"!==this.zi.persistence.toLowerCase()||(this.qs=!0,0))}ta(){this.qs&&(C(this.ea)||(clearTimeout(this.ea),this.ea=void 0),delete this.Ls[$r],this.ia(!0))}ra(t){if(void 0===t&&(t=!0),this.qs)try{t?this.ta():C(this.ea)||(clearTimeout(this.ea),this.ea=void 0)}finally{this.qs=!1}}isDisabled(){return!!this.Js}Us(e){-1===yr.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=[...Oi,...e];return p({},ki,{Vr(t){try{var e,s={};try{e=Ti.$r(t)||void 0,s=e?Mi(JSON.parse(e)):{}}catch(t){}var n,o=JSON.parse(ki.$r(t)||"{}");if(i){var a=Ui(t,e),l=[...Oi,...a.properties],h={};Object.keys(s).forEach((t=>{var e=s[t];N(e)||""===e||t===Le&&e!==Ze&&e!==ti||(h[t]=e)}));var u=me in h||h[Le]===Ze||h[Le]===ti;if(Object.keys(h).length>0){var d,v=o[me],c=null!==(d=o[Le])&&void 0!==d?d:Ze;r.forEach((t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||t!==me&&t!==Le)){var e=o[t];!a.isValid&&-1!==Oi.indexOf(t)&&(!1===e||0===e)||delete o[t]}})),!u||Le in s||Le in o||(o[Le]=Ze),!u||(me in h?h[me]:o[me])===v&&(Le in h?h[Le]:o[Le])===c||(Pi.forEach((t=>delete o[t])),h[Le]===ti&&me in h?o.$user_id=h[me]:delete o.$user_id,h[Le]!==ti&&(delete o[Ne],delete o[Ae]),delete o.__alias)}n=ui(o,h)}else n=ui(s,o);return ki.Ur(t,n),n}catch(t){}return null},Ur(t,r,s,n,o,a){var l=ki.Ur(t,r,void 0,void 0,a);try{var h=Ai(r,e);if(Object.keys(h).length){if(i){var u=Ii(t),d=Di(h,e);if(Ti.Ur(u,d,s,n,o,a),Ti.$r(u)!==JSON.stringify(d)){Ti.Wr(u,n);var v=Ai(r);return Ti.Ur(t,v,s,n,o,a),l}}Ti.Ur(t,h,s,n,o,a)}}catch(t){ki.zr(t)}return l},Wr(e,i){try{null==t||t.localStorage.removeItem(e),Ti.Wr(e,i),Ti.Wr(Ii(e),i)}catch(t){ki.zr(t)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&ki.Hr()?(i=ki,s=!0):"localstorage+cookie"===n&&r.Hr()?(i=r,s=!0):"sessionstorage"===n&&zi.Hr()?i=zi:"memory"===n?i=Li:"cookie"===n?i=Ti:r.Hr()?(i=r,s=!0):i=Ti,this.Ds=s,i}na(t){return this.Hs+"__"+t}zs(t){return this.Ds&&!!t.split_storage}properties(){var t={};return hi(this.props,((e,i)=>{var r=tr(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.Js||t){var e=this.zi.cookieWinsOnConflict&&"localstorage+cookie"===this.zi.persistence.toLowerCase(),i=e?ki.Vr(this.Hs):null,r={};if(e)try{hi(r=Mi(Ti.Vr(this.Hs)),((t,e)=>{(C(t)||N(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.xs.Vr(this.Hs);if(s&&(this.props=ui({},s)),this.$s&&this.sa(),e&&s){var n,o,a=null==i?void 0:i[me],l=null!==(n=null==i?void 0:i[Le])&&void 0!==n?n:Ze,h=s[me],u=null!==(o=s[Le])&&void 0!==o?o:Ze;if(h!==a||u!==l){this.Ns=!0,zi.Ur(br(this.Hs),!0);var d=ui({},this.props);Pi.forEach((t=>delete d[t])),u===Ze&&(l===ti||r[Le]===Ze||!C(a)&&h!==a)&&(xr(d,r),delete d[Ae]),this.props=d;var v=new Set;Pi.forEach((t=>{var e,i=null==(e=tr(t))?void 0:e.storageGroup;i&&v.add(i)})),v.forEach((t=>{var e={};hi(this.props,((i,r)=>{var s;(null==(s=tr(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),I(e)?(ki.Wr(this.na(t)),this.Ls[t]={}):ki.Ur(this.na(t),e)&&(this.Ls[t]={persisted:!0,fingerprint:this.aa(e,t)})}))}}zi.$r(br(this.Hs))&&(this.Ns=!0)}}sa(){for(var t of Xi){var e=ki.Vr(this.na(t));if(e&&!I(e)){var i=this.oa(t);i.persisted=!0,this.la(t)||(i.fingerprint=this.aa(e,t)),this.ua(t,e)||ui(this.props,e)}}}la(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=tr(e))?void 0:i.storageGroup)===t}))}ua(t,e){var i=wr[t];if(!i)return!1;var r=e[i],s=this.props[i];return U(r)&&U(s)&&s>r}refreshKey(t){var e;if(!this.Js){var i=this.$s?null==(e=tr(t))?void 0:e.storageGroup:void 0,r=i?ki.Vr(this.na(i)):this.xs.Vr(this.Hs);if(r&&t in r)this.Ks(t,r[t]);else{if(i){var s=this.xs.Vr(this.Hs);if(s&&t in s)return void this.Ks(t,s[t])}this.Ys(t)}}}save(){if(!this.Js){var t=this.Ws();t>0?C(this.ea)&&(this.ea=setTimeout((()=>{this.ea=void 0,this.ia()}),t)):this.ia()}}flush(){C(this.ea)||(clearTimeout(this.ea),this.ea=void 0,this.ia())}ia(t){void 0===t&&(t=!1),this.Js||this.qs&&!t||(t||this.syncCookieProperties(),this.$s?this.ha():this.da(this.xs,this.Hs,this.props,$r)&&this.Vs(this.props))}ha(){var t=this.va(),e=t.main,i=t.groups;for(var r of(this.da(this.xs,this.Hs,e,$r)&&this.Vs(e),Xi)){var s,n=i[r];(!I(n)||null!=(s=this.Ls[r])&&s.persisted)&&this.da(ki,this.na(r),n,r)}}va(){var t={},e={flags:{},surveys:{}};return hi(this.props,((i,r)=>{var s,n=null==(s=tr(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}aa(t,e){if(e===$r)return JSON.stringify(t)+"|"+this.ca+"|"+this.fa+"|"+this.pa;var i={};return hi(t,((t,e)=>{var r;i[e]=null!=(r=tr(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}da(t,e,i,r){var s,n=this.oa(r);if(r!==$r&&!n.dirty&&!C(n.fingerprint))return!1;try{if((s=this.aa(i,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Ur(e,i,this.ca,this.fa,this.pa,this.zi.debug)?(n.dirty=!1,r!==$r&&(n.persisted=!0),C(s)||(n.fingerprint=s),!0):(this.zi.debug&&ue.warn('failed to persist storage entry "'+e+'"; will retry on next save'),!1)}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(C(this.ea)||(clearTimeout(this.ea),this.ea=void 0),this.xs.Wr(this.Hs,!1),this.xs.Wr(this.Hs,!0),!i&&this.js)for(var r of Xi)ki.Wr(this.na(r));i?delete this.Ls[$r]:this.Ls={},this.Gs=void 0,this.Zs=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(O(t)){this.syncCookieProperties(),C(e)&&(e="None"),this.ca=C(i)?this.ga:i;var r=!1;if(hi(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Ks(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(O(t)){this.syncCookieProperties(),this.ca=C(e)?this.ga:e;var i=!1;if(hi(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||O(e)||k(e))&&(this.Ks(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.Ys(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this.Bs){var e=function(t,e,i){if(!r)return{};var s,n=e?[...or,...i||[]]:[],o=ur(sr(r.URL,n,lr),t),a=(s={},hi(hr,(function(t){var e=fi(t);s[t]=e||null})),s);return ui(a,o)}(this.zi.custom_campaign_params,this.zi.mask_personal_data_properties,this.zi.custom_personal_data_properties);I(vi(e))||this.register(e),this.Bs=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?dr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:_r(),$referring_domain:null!=r&&r.referrer&&(null==(t=ir(r.referrer))?void 0:t.host)||cr},void 0)}set_initial_person_info(){this.props[qe]||this.props[He]||this.register_once({[Ge]:pr(this.zi.mask_personal_data_properties,this.zi.custom_personal_data_properties,this.zi.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};hi([He,qe],(e=>{var i=this.props[e];i&&hi(i,(function(e,i){t["$initial_"+E(i)]=e}))}));var e=this.props[Ge];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=fr(t,e),r={};return hi(i,(function(t,e){r["$initial_"+E(e)]=t})),r}(e,this.zi.disable_capture_url_hashes);ui(t,i)}return t}safe_merge(t){return hi(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){var r=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),n=r||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,l=!!this.Js&&!a;a||this.Qs(e,l),this.zi=t,!a&&(r||s||o)&&(this.Gs=void 0,this.Zs=void 0,this.Qs(p({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),l));var h=n||o?this.Us(t):this.xs,u=this.zs(t),d=n||u!==this.$s,v=!a&&(d||t.cross_subdomain_cookie!==this.fa||t.secure_cookie!==this.pa)&&this.Xs(l);try{if(this.ga=this.ca=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.xs=h,this.$s=u,this.props=c,this.save()}else o&&(this.xs=h,a||(delete this.Ls[$r],this.ia()))}finally{v&&this.ra()}}set_disabled(t){this.Js=t,this.Js?this.remove():this.save()}set_cross_subdomain(t){t!==this.fa&&(this.fa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.pa&&(this.pa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[$e]||{};i[t]=e,this.Ks($e,i),this.save()}remove_event_timer(t){var e=this.props[$e]||{},i=e[t];return C(i)||(delete e[t],this.Ks($e,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Ks(t,e),this.save()}Ks(t,e){var i;this.props[t]=e,null!=(i=tr(t))&&i.volatile||this.ma(t)}Ys(t){delete this.props[t],this.ma(t)}ma(t){var e,i=null==(e=tr(t))?void 0:e.storageGroup;i&&(this.oa(i).dirty=!0)}oa(t){return this.Ls[t]||(this.Ls[t]={})}}function Sr(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&P(i.then)&&i.then(void 0,(()=>{}))}}}}var Tr={GZipJS:"gzip-js",Base64:"base64"},Rr={Activation:"events",Cancellation:"cancelEvents"},kr={Button:"button",Tab:"tab",Selector:"selector"},Pr={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"},Ir={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Cr={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Mr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Ar={Once:"once",Recurring:"recurring",Always:"always"},Nr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Dr={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Ur={Popover:"popover",Inline:"inline"},Br={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},Fr={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"},Lr={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"},jr=de("[RateLimiter]");class zr{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=>{jr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void jr.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(ze))&&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 h=(U(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.ya(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(ze,a),{isRateLimited:l,remainingTokens:a.tokens}}ba(t){var e=this.instance.config.property_denylist;return!k(e)||!e.includes(t)}_a(){var t;if(this.ba("$current_url")&&this.ba("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}ya(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this._a(),o=this.ba("$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 qr=de("[RemoteConfig]");class Hr{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}wa(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()}ka(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 qr.info("Using preloaded remote config",this.remoteConfig),void this.Sa(this.remoteConfig);if(this._instance._shouldDisableFlags())return void qr.warn("Remote config is disabled. Falling back to local config.");this.wa((t=>{if(!t)return qr.info("No config found after loading remote JS config. Falling back to JSON."),void this.ka((t=>{this.Sa(t.json,t)}));this.Sa(t)}))}catch(t){qr.error("Error loading remote config",t),this.Sa()}}Sa(t,e){!t&&e&&(0===e.statusCode?e.error||qr.warn("Failed to fetch remote config from PostHog."):qr.error("Failed to fetch remote config from PostHog."));try{this._instance.Sa(t?{ok:!0,config:t}:{ok:!1})}catch(t){qr.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){qr.error("Error loading feature flags",t)}}}var Gr=["fatal","error","warning","log","info","debug"],Wr=Uint8Array,Vr=Uint16Array,Yr=Uint32Array,Jr=new Wr([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]),Kr=new Wr([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]),Xr=new Wr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qr=function(t,e){for(var i=new Vr(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Yr(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]},Zr=Qr(Jr,2),ts=Zr[1];Zr[0][28]=258,ts[258]=28;for(var es=Qr(Kr,0)[1],is=new Vr(32768),rs=0;32768>rs;++rs){var ss=(43690&rs)>>>1|(21845&rs)<<1;is[rs]=((65280&(ss=(61680&(ss=(52428&ss)>>>2|(13107&ss)<<2))>>>4|(3855&ss)<<4))>>>8|(255&ss)<<8)>>>1}var ns=function(t,e,i){for(var r=t.length,s=0,n=new Vr(e);r>s;++s)++n[t[s]-1];var o,a=new Vr(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Vr(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=e-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[is[d]>>>l]=h}else for(o=new Vr(r),s=0;r>s;++s)o[s]=is[a[t[s]-1]++]>>>15-t[s];return o},os=new Wr(288);for(rs=0;144>rs;++rs)os[rs]=8;for(rs=144;256>rs;++rs)os[rs]=9;for(rs=256;280>rs;++rs)os[rs]=7;for(rs=280;288>rs;++rs)os[rs]=8;var as=new Wr(32);for(rs=0;32>rs;++rs)as[rs]=5;var ls=ns(os,9,0),hs=ns(as,5,0),us=function(t){return(t/8>>0)+(7&t&&1)},ds=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Vr?Vr:t instanceof Yr?Yr:Wr)(i-e);return r.set(t.subarray(e,i)),r},vs=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},cs=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},_s=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 Wr(0),0];if(1==s){var o=new Wr(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],h=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[d].f>i[h].f?h++:d++],l=i[h!=u&&i[d].f>i[h].f?h++:d++],i[u++]={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 Vr(v+1),_=ps(i[u-1],c,0);if(_>e){r=0;var p=0,f=_-e,g=1<<f;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<_-c[m]),c[m]=e}for(p>>>=f;p>0;){var w=n[r].s;e>c[w]?p-=1<<e-c[w]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==e&&(--c[y],++p)}_=e}return[new Wr(c),_]},ps=function(t,e,i){return-1==t.s?Math.max(ps(t.l,e,i+1),ps(t.r,e,i+1)):e[t.s]=i},fs=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Vr(++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]},gs=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},ms=function(t,e,i){var r=i.length,s=us(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)},ws=function(t,e,i,r,s,n,o,a,l,h,u){vs(e,u++,i),++s[256];for(var d=_s(s,15),v=d[0],c=d[1],_=_s(n,15),p=_[0],f=_[1],g=fs(v),m=g[0],w=g[1],y=fs(p),b=y[0],x=y[1],E=new Vr(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=_s(E,7),R=T[0],k=T[1],P=19;P>4&&!R[Xr[P-1]];--P);var O,I,C,M,A=h+5<<3,N=gs(s,os)+gs(n,as)+o,D=gs(s,v)+gs(n,p)+o+14+3*P+gs(E,R)+(2*E[16]+3*E[17]+7*E[18]);if(N>=A&&D>=A)return ms(e,u,t.subarray(l,l+h));if(vs(e,u,1+(N>D)),u+=2,N>D){O=ns(v,c,0),I=v,C=ns(p,f,0),M=p;var U=ns(R,k,0);for(vs(e,u,w-257),vs(e,u+5,x-1),vs(e,u+10,P-4),u+=14,S=0;P>S;++S)vs(e,u+3*S,R[Xr[S]]);u+=3*P;for(var B=[m,b],F=0;2>F;++F){var L=B[F];for(S=0;L.length>S;++S)vs(e,u,U[j=31&L[S]]),u+=R[j],j>15&&(vs(e,u,L[S]>>>5&127),u+=L[S]>>>12)}}else O=ls,I=os,C=hs,M=as;for(S=0;a>S;++S)if(r[S]>255){var j;cs(e,u,O[257+(j=r[S]>>>18&31)]),u+=I[j+257],j>7&&(vs(e,u,r[S]>>>23&31),u+=Jr[j]);var z=31&r[S];cs(e,u,C[z]),u+=M[z],z>3&&(cs(e,u,r[S]>>>5&8191),u+=Kr[z])}else cs(e,u,O[r[S]]),u+=I[r[S]];return cs(e,u,O[256]),u+I[256]},ys=new Yr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),bs=function(){for(var t=new Yr(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),$s=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function xs(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=bs[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,h=(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 Wr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!e||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=ms(l,h,t.subarray(u,d)):(l[u]=!0,h=ms(l,h,t.subarray(u,o)))}else{for(var v=ys[e-1],c=v>>>13,_=8191&v,p=(1<<i)-1,f=new Vr(32768),g=new Vr(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 Yr(25e3),x=new Vr(288),E=new Vr(32),S=0,T=0,R=(u=0,0),k=0,P=0;o>u;++u){var O=y(u),I=32767&u,C=g[O];if(f[I]=C,g[O]=I,u>=k){var M=o-u;if((S>7e3||R>24576)&&M>423){h=ws(t,l,0,b,x,E,T,R,P,u-P,h),R=S=T=0,P=u;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)E[A]=0}var N=2,D=0,U=_,B=I-C&32767;if(M>2&&O==y(u-B))for(var F=Math.min(c,M)-1,L=Math.min(32767,u),j=Math.min(258,M);L>=B&&--U&&I!=C;){if(t[u+N]==t[u+N-B]){for(var z=0;j>z&&t[u+z]==t[u+z-B];++z);if(z>N){if(N=z,D=B,z>F)break;var q=Math.min(B,z-2),H=0;for(A=0;q>A;++A){var G=u-B+A+32768&32767,W=G-f[G]+32768&32767;W>H&&(H=W,C=G)}}}B+=(I=C)-(C=f[I])+32768&32767}if(D){b[R++]=268435456|ts[N]<<18|es[D];var V=31&ts[N],Y=31&es[D];T+=Jr[V]+Kr[Y],++x[257+V],++E[Y],k=u+N,++S}else b[R++]=t[u],++x[t[u]]}}h=ws(t,l,!0,b,x,E,T,R,P,u-P,h)}return ds(a,0,r+us(h)+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)),u=h.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&&$s(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)}}(h,e),$s(h,u-8,i.d()),$s(h,u-4,r),h}var Es=!!o||!!n,Ss="text/plain",Ts=!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:"")},ks=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:[],h=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return hi(t,(function(t,e){C(t)||C(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 h&&l.push(h),l.length>0?n+"?"+l.join("&"):n},Ps=t=>{if(t.Ca)return t.Ca;var e=t.data,i=t.compression;if(e){if(i===Tr.GZipJS){var r=xs(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Wr(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 Wr(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 ds(r,0,s)}(er(e)),{mtime:0});return{contentType:Ss,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Tr.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(er(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:er(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=er(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Os=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:ks(t.url,{compression:Tr.Base64}),encodedBody:Ps(p({},t,{compression:Tr.Base64,Ca:void 0}))}:{url:Rs(t.url,"compression"),encodedBody:Ps(p({},t,{compression:void 0,Ca:void 0}))};try{e=Ps(t)}catch(e){if(se(t.compression,rr(t.url,"compression")))return ue.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&se(t.compression,rr(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?re(new Uint8Array(i)):ArrayBuffer.isView(i)&&re(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Ts=!0,r()):{url:t.url,encodedBody:e}},Is=t=>{try{return Os(t)}catch(e){return ue.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},Cs=function(){var t=_((function*(t){var e=er(t.data),i=yield function(t,e,i){return le.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{Ca:{contentType:Ss,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Ms=/Failed to fetch|NetworkError|Load failed/i,As=t=>"TypeError"===(null==t?void 0:t.name)&&Ms.test((null==t?void 0:t.message)||""),Ns=t=>{var e=Is(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,l=s.body,h=s.estimatedSize,u=new Headers;hi(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var e;v=!0,c.abort(Zt("AbortError","PostHog request timed out"+((e=t.timeout)?" after "+e+"ms":"")))}),t.timeout)}}var _=e=>{v&&"AbortError"===(null==e?void 0:e.name)||As(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:u,keepalive:"POST"===t.method&&!t.Ta&&52428.8>(h||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 h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(i.sendBeacon(s,h))return;var u=k(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(k(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=e=>k(t.data)?e:p({},t.data,{batch:e});return Ds(p({},t,{data:v(u.slice(0,d))})),void Ds(p({},t,{data:v(u.slice(d))}))}ue.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Ns(p({},t,{Ta:!0}))}catch(t){ue.warn("Beacon send failed",t)}},Us=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return ks(i===Tr.GZipJS?Rs(t,"compression"):t,p({},s?{[s]:Date.now().toString()}:{},i===Tr.GZipJS?{}:{compression:i}))},Bs=[];n&&Bs.push({transport:"fetch",method:Ns}),o&&Bs.push({transport:"XHR",method(t){var e=Is(t);if(e){var i=new o,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;hi(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(a)}}}),null!=i&&i.sendBeacon&&Bs.push({transport:"sendBeacon",method:Ds});var Fs=3e3;class Ls{constructor(t,e){this.Ma=!0,this.Ea=[],this.Ia=W((null==e?void 0:e.flush_interval_ms)||Fs,250,5e3,ue.createLogger("flush interval"),Fs),this.Ra=t}enqueue(t){this.Ea.push(t),this.Pa||this.Aa()}unload(){this.Fa();var t=this.Ea.length>0?this.Oa():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.La(p({},t,{transport:"sendBeacon"}))}))}enable(){this.Ma=!1,this.Aa()}Aa(){var t=this;this.Ma||(this.Pa=setTimeout((()=>{if(this.Fa(),this.Ea.length>0){var e=this.Oa(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&k(i.data)&&hi(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.La(i)};for(var r in e)i()}}),this.Ia))}La(t){try{this.Ra(t)}catch(t){ue.error(t)}}Fa(){clearTimeout(this.Pa),this.Pa=void 0}Oa(){var t={};return hi(this.Ea,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;C(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.Ea=[],t}}var js=["retriesPerformedSoFar"];class zs{constructor(e){this.Da=!1,this.$a=3e3,this.Ea=[],this._instance=e,this.Ea=[],this.Na=!0,!C(t)&&"onLine"in t.navigator&&(this.Na=t.navigator.onLine,this.qa=()=>{this.Na=!0,this.ja()},this.Ba=()=>{this.Na=!1},pi(t,"online",this.qa),pi(t,"offline",this.Ba))}get length(){return this.Ea.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,js);B(e)&&(i.url=ks(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.An(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)}}))}An(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.Ea.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),ue.warn(s),this.Da||(this.Da=!0,this.Ha())}Ha(){if(this.Ua&&clearTimeout(this.Ua),0===this.Ea.length)return this.Da=!1,void(this.Ua=void 0);this.Ua=setTimeout((()=>{this.Na&&this.Ea.length>0&&this.ja(),this.Ha()}),this.$a)}ja(){var t=Date.now(),e=[],i=this.Ea.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Ea=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var e of(this.Ua&&(clearTimeout(this.Ua),this.Ua=void 0),this.Da=!1,C(t)||(this.qa&&(t.removeEventListener("online",this.qa),this.qa=void 0),this.Ba&&(t.removeEventListener("offline",this.Ba),this.Ba=void 0)),this.Ea)){var i=e.requestOptions;try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){ue.error(t)}}this.Ea=[]}}class qs{constructor(t){this.za=()=>{var t,e,i,r;this.Wa||(this.Wa={});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.Wa.lastScrollY=Math.ceil(n),this.Wa.maxScrollY=Math.max(n,null!==(t=this.Wa.maxScrollY)&&void 0!==t?t:0),this.Wa.maxScrollHeight=Math.max(o,null!==(e=this.Wa.maxScrollHeight)&&void 0!==e?e:0),this.Wa.lastContentY=a,this.Wa.maxContentY=Math.max(a,null!==(i=this.Wa.maxContentY)&&void 0!==i?i:0),this.Wa.maxContentHeight=Math.max(l,null!==(r=this.Wa.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Va(){return this._instance.config.scroll_root_selector}getContext(){return this.Wa}resetContext(){var t=this.Wa;return setTimeout(this.za,0),t}startMeasuringScrollPosition(){pi(t,"scroll",this.za,{capture:!0}),pi(t,"scrollend",this.za,{capture:!0}),pi(t,"resize",this.za)}scrollElement(){if(!this.Va)return null==t?void 0:t.document.documentElement;var e=k(this.Va)?this.Va:[this.Va];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}Ga(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.Va){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.Ga("y")}scrollX(){return this.Ga("x")}}var Hs=t=>pr(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 Gs{constructor(t,e,i,r){this.ut=t=>{var e=this.Za();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Qa(this._instance)};this.Ja.register({[je]:i})}},this._instance=t,this.Ka=e,this.Ja=i,this.Qa=r||Hs,this.Ka.onSessionId(this.ut)}Za(){return this.Ja.props[je]}getSetOnceProps(){var t,e=null==(t=this.Za())?void 0:t.props;return e?"r"in e?fr(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return hi(vi(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+E(i)]=e})),t}}class Ws{on(t,e){return this.Ya[t]||(this.Ya[t]=[]),this.Ya[t].push(e),()=>{this.Ya[t]=this.Ya[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Ya[t]||[])i(e);for(var r of this.Ya["*"]||[])r(t,e)}constructor(){this.Ya={}}}var Vs=de("[SessionId]"),Ys=864e5;class Js{on(t,e){return this.Xa.on(t,e)}constructor(t,e,i){var r;if(this.eo=null,this.io=null,this.ro=[],this.no=void 0,this.so=!1,this.Xa=new Ws,this.ao=(t,e)=>!(!B(t)||!B(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Qe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.zi=t.config,this.Ja=t.persistence,this.ct=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.oo=void 0,this._sessionActivityTimestamp=null,this.lo=e||$i,this.uo=i||$i;var s=this.zi.persistence_name||this.zi.token;if(this._sessionTimeoutMs=1e3*W(this.zi.session_idle_timeout_seconds||1800,60,36e3,Vs.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ho(),this.do="ph_"+s+"_window_id",this.vo="ph_"+s+"_primary_window_exists",this.co()){var n=zi.Vr(this.do),o=zi.Vr(this.vo);n&&!o?this.ct=n:zi.Wr(this.do),zi.Ur(this.vo,!0)}null!=(r=this.zi.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.zi.bootstrap.sessionID),this.fo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.ro)&&(this.ro=[]),this.ro.push(t),this._e&&t(this._e,this.ct),()=>{this.ro=this.ro.filter((e=>e!==t))}}co(){return"memory"!==this.zi.persistence&&!this.Ja.Js&&zi.Hr()}po(t){t!==this.ct&&(this.ct=t,this.co()&&zi.Ur(this.do,t))}mo(){return this.ct?this.ct:this.co()?zi.Vr(this.do):null}yo(t){var e=this.eo;return!N(e)&&!N(t)&&5e3>Math.abs(t-e)}bo(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this._e||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this._e=t,s&&!r||s&&this.yo(e)||(this.eo=e,this.Ja.register({[Se]:[e,t,i]}))}_o(){var t,e=null==(t=this.zi)?void 0:t.persistence_save_debounce_ms;return B(e)&&e>0}wo(){this._o()?this.Ja.refreshKey(Se):(this.Ja.flush(),this.Ja.load())}ko(){var t;if(!N(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.eo){this.wo();var e=this.So();e[1]===this._e&&e[2]===this._sessionStartTimestamp&&(this.eo=this._sessionActivityTimestamp,this.Ja.register({[Se]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ja.flush())}}xo(){var t=this.So()[0],e=B(t)?t:0,i=B(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Co(t){return this.wo(),this.ao(t,this.xo())}So(){var t=this.Ja.props[Se];return k(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.eo=null,this.oo=void 0,clearTimeout(this.To),this.To=void 0,this.bo(null,null,null)}setBootstrapSessionId(t,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void Vs.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void Vs.error("Invalid sessionID in bootstrap",t)}}(t);return!C(i)&&(e?this.oo={sessionId:t,sessionStartTimestamp:i}:this.bo(t,(new Date).getTime(),i),!0)}destroy(){this.so=!0,this.ko(),clearTimeout(this.To),this.To=void 0,this.no&&t&&(t.removeEventListener(ri,this.no,{capture:!1}),this.no=void 0),this.ro=[]}fo(){this.no=()=>{this.ko(),this.co()&&zi.Wr(this.vo)},pi(t,ri,this.no,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.zi.cookieless_mode===Qe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this._e;if(i)this.io=r;else if(N(this.io)||this.io>r||r-this.io>=1e3){var n,o;null==(n=(o=this.Ja).syncCookieProperties)||n.call(o),this.io=r}var a=this.So(),l=a[1],h=a[2],u=!C(s)&&l!==s,d=this.xo(),v=this.mo(),c=this.oo,_=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ys),p=c?_:B(h)&&Math.abs(r-h)>Ys,f=!1,g=u,m=!l||!!c,w=l,y=!m&&!t&&this.ao(r,d);if(y){(y=this.Co(r))||Vs.info("cross-tab refresh kept the session alive",{sessionId:l});var b=this.So();l=b[1],h=b[2]}if(m||y||p){g=!1;var x=c&&!_;l=x?c.sessionId:this.lo(),v=this.uo(),Vs.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.oo=void 0,f=!0}else v||(v=this.uo(),f=!0),(g=g||l!==w)&&(Vs.info("adopted cross-tab session id",{sessionId:l,windowId:v}),f=!0);var E=B(d)&&t&&!p?d:r,S=B(h)?h:(new Date).getTime();this.po(v),this.bo(l,E,S),t||this.ho();var T={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return f&&this.ro.forEach((t=>t(l,v,T))),{sessionId:l,windowId:v,sessionStartTimestamp:S,changeReason:f?T:void 0,lastActivityTimestamp:d}}ho(){this.so||(clearTimeout(this.To),this.To=setTimeout((()=>{if(!this.so)if(this.Co((new Date).getTime())){var t=this._e;this.resetSessionId(),this.Xa.emit("forcedIdleReset",{idleSessionId:t})}else this.ho()}),1.1*this.sessionTimeoutMs))}}function Ks(){return(Ks=_((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 M(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 Xs(t,e,i){return er({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Qs="custom",Zs="i.posthog.com",tn=/^\/static\//,en=["/s/","/e/","/i/"];class rn{constructor(t){this.Mo={},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("."+Zs,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Mo[this.apiHost]||(this.Mo[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":Qs),this.Mo[this.apiHost]}Eo(t){if(tn.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}Io(t){var e=ir(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}Ro(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=ir(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&en.some((t=>0===e.indexOf(t)))){var a=this.Io(r);if(a){var l,h=this.apiHost,u=this.Po;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.Po=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Po,i=this.Io(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.Ro(t,e,this.uiHost+e);if("flags"===t)return this.Ro(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.Eo(e);if(i)return this.Ro(t,e,""+i+e)}if(this.region===Qs)return this.Ro(t,e,this.apiHost+e);var r=Zs+e;switch(t){case"assets":return this.Ro(t,e,"https://"+this.region+"-assets."+r);case"api":return this.Ro(t,e,"https://"+this.region+"."+r)}}}var sn=de("[Surveys]"),nn={ignoreConditions:!1,ignoreDelay:!1,displayType:Ur.Popover},on=de("[PostHog ExternalIntegrations]"),an={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ln{constructor(t){this._instance=t}Es(t,e){var i;null==(i=d.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return on.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.Es(an[n],(()=>{var e;null==(e=d.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=d.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=d.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class hn{constructor(t,e){this.I=t,this.cs=e,this.Ao=new Map,this.us=!1}add(t){var e=this;return _((function*(){if(e.us)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.Ao.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.Ao.set(t.name,t);try{var i=t.setup(e.cs);i&&(yield i)}catch(i){var r=e.Ao.get(t.name)===t;r&&e.Ao.delete(t.name),e.I.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.Fo(t)}}))()}getExtension(t){return this.Ao.get(t)}dispose(){if(!this.us){this.us=!0;var t=Array.from(this.Ao.values()).reverse();for(var e of(this.Ao.clear(),t))this.Fo(e)}}Fo(t){try{var e=null==t.dispose?void 0:t.dispose();e&&P(e.then)&&e.then(void 0,(e=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class un{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);C(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.unregister(t)}}var dn="extensionsRemoteConfig";class vn{constructor(t){this.us=!1,this.instance=t,this.I=ue,this.Oo=t.Lo,this.kv=new un(t),this.onEvent=t=>Sr(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.us)return Sr((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.Do.on(dn,e);return this.Oo&&e(this.Oo),Sr(i)},this.$o=new hn(ue.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(we))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(we);return"string"==typeof t?t:void 0}get library(){return{name:v.LIB_NAME,version:v.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.$o.add(t)}getExtension(t){return this.$o.getExtension(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 Sr(this.instance.No(t))}handleRemoteConfig(t){this.us||(this.Oo=t,this.instance.Do.emit(dn,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?ks(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?g.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.us||(this.us=!0,this.$o.dispose())}}var cn,_n={},pn=0,fn=()=>{},gn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',mn="Surveys module not available",wn="sanitize_properties is deprecated. Use before_send instead",yn="Invalid value for property_denylist config: ",bn=["token","distinct_id",Ye],$n="posthog",xn=!Es&&-1===(null==h?void 0:h.indexOf("MSIE"))&&-1===(null==h?void 0:h.indexOf("Mozilla")),En=t=>{var e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},Sn=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:_i(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:fn,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&&M(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){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:ei,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Fs},error_tracking:{},_onCapture:fn},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Hi,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:En(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(e))},Tn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],Rn=t=>{var e={};for(var i of Tn){var r=i[0],s=i[1];C(t[r])||(e[s]=t[r])}var n=ui({},e,t),o=t.__preview_external_dependency_versioned_paths;return C(o)||(C(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),M(o)&&C(t.asset_host)&&(n.asset_host=o)),k(t.property_blacklist)&&(C(t.property_denylist)?n.property_denylist=t.property_blacklist:k(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ue.error(yn+t.property_denylist)),n};class kn{constructor(){this.__forceAllowLocalhost=!1}get qo(){return this.__forceAllowLocalhost}set qo(t){ue.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Pn{jo(t,e){if(t){var i=this.Ao.indexOf(t);-1!==i&&this.Ao.splice(i,1)}return this.Ao.push(e),null==e.initialize||e.initialize(),e}Bo(){return this.config.cookieless_mode===Qe||this.config.cookieless_mode===Xe&&this.consent.isRejected()}Ho(){if(!this.Bo()&&this.get_distinct_id()===Ve){var t=this.persistence;if(t){this.Uo()||t.load(!0);var e=this.get_distinct_id();if(!e||e===Ve){var i=this.config.get_device_id($i());this.register({distinct_id:i,$device_id:i}),t.set_property(Le,Ze)}this.zo()}}}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 kn,this.Wo=!1,this.version=v.LIB_VERSION,this.Vo=new Set,this.Go="",this.Do=new Ws,this.Ao=[],this.Zo=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Sn(),this.SentryIntegration=Ji,this.sentryIntegration=t=>function(t,e){var i=Yi(t,e);return{name:Vi,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Qo=!1,this.Jo=null,this.Ko=null,this.Yo=null,this.scrollManager=new qs(this),this.pageViewManager=new Ki(this),this.rateLimiter=new zr(this),this.requestRouter=new rn(this),this.consent=new qi(this),this.externalIntegrations=new ln(this);var e=null!==(t=Pn.__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=M(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=M(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!==$n){var r,s=null!==(r=_n[i])&&void 0!==r?r:new Pn;return s._init(t,e,i),_n[i]=s,_n[$n][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o,a=M(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=Sn(i.defaults),i.debug=this.Xo(i.debug),this.tl=i,this.el=[],i.person_profiles?this.Ko=i.person_profiles:i.process_person&&(this.Ko=i.process_person);var l=Sn(i.defaults),h=Rn(i),u=ui({},l,h,{name:r,token:a});O(l.rageclick)&&O(h.rageclick)&&(u.rageclick=ui({},l.rageclick,h.rageclick)),O(l.session_recording)&&O(h.session_recording)&&(u.session_recording=ui({},l.session_recording,h.session_recording)),this.set_config(u),this.config.on_xhr_error&&ue.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Tr.GZipJS;var d=this.Uo();if(this.persistence=new Er(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Er(p({},this.config,{persistence:"sessionStorage"}),d,!1),this.Go="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&zi.Hr()){var c=zi.Vr(this.Go);k(c)&&c.forEach((t=>{M(t)&&this.Vo.add(t)}))}else zi.Wr(this.Go);var _=p({},this.persistence.props),f=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.il=new Ls((t=>this.rl(t)),this.config.request_queue_config),this.nl=new zs(this),this.__request_queue=[];var g=this.Bo();if(g||(this.sessionManager=new Js(this),this.sessionPropsManager=new Gs(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.sl()}))),this.al(),this.config.__preview_deferred_init_extensions?(ue.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.ol(g)}),0)):(ue.info("Initializing extensions synchronously"),this.ol(g)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&ue.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:_,s:f}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var m=i.bootstrap.distinctID,w=this.get_distinct_id(),y=this.persistence.get_property(Le);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==m&&y===Ze)this.identify(m);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==m&&y===ti)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 b=this.config.get_device_id($i()),x=i.bootstrap.isIdentifiedID?b:m;this.persistence.set_property(Le,i.bootstrap.isIdentifiedID?ti:Ze),this.register({distinct_id:m,$device_id:x})}}if(g)this.register_once({distinct_id:Ve,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id($i());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Le,Ze)}return pi(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()||$i();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Le,ti)),e()},s=i.user();"then"in s&&P(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Wi.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()||(Wi.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Wi.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,si),identify:t=>e(t,oi),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.ll())):this.ll(),P(this.config._onCapture)&&this.config._onCapture!==fn&&(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 Ks.apply(this,arguments)}().then((t=>{t&&this.register({[ye]:t})})).catch(fn),this}ul(t){var e=t;return M(e.name)&&P(e.setup)}hl(t,e){this.ul(t)?e.push((()=>{this.dl().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((e=>{ue.error('Failed to dispose browser extension "'+t.name+'"',e)}))})):this.Ao.push(t)}al(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=Pn.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.vl)||r.call(this),this.vl=void 0,this.featureFlags=new o(this)),P(this.featureFlags.onReloading)&&P(this.featureFlags.setup)?this.vl||(this.vl=this.featureFlags.onReloading((()=>{this.Do.emit("featureFlagsReloading",!0)})),this.dl().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}ol(t){var e,i,r,s,n,o,a,l=performance.now(),h=p({},Pn.__defaultExtensionClasses,this.config.__extensionClasses),u=[];h.exceptions&&this.Ao.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new h.exceptions(this)),h.historyAutocapture&&this.Ao.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ao.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Ao.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.Ao.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||u.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.hl(this.autocapture=new h.autocapture(this),u),h.surveys&&this.hl(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new h.surveys(this),u),h.logs&&this.hl(this.logs=null!==(r=this.logs)&&void 0!==r?r:new h.logs(this),u),h.metrics&&this.Ao.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new h.metrics(this)),h.conversations&&this.Ao.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new h.conversations(this)),h.productTours&&this.Ao.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ao.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ao.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ao.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ao.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Gi)),h.toolbar&&this.Ao.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new h.toolbar(this)),h.experiments&&this.Ao.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new h.experiments(this)),this.Ao.forEach((t=>{t.initialize&&u.push((()=>{null==t.initialize||t.initialize()}))})),u.push((()=>{if(this.cl){var t=this.cl;this.cl=void 0,this.Ao.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.fl(u,l)}fl(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.fl(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({[Je]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ke]:r}),this.config.__preview_deferred_init_extensions&&ue.info("PostHog extensions initialized ("+r+"ms)")}Sa(t){var e;if(!r||!r.body)return ue.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Sa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.cl=t),this.Lo=t,this.compression=void 0,t.ok){var i,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=x(s.supportedCompression,Tr.GZipJS)?Tr.GZipJS:x(s.supportedCompression,Tr.Base64)?Tr.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Ko?this.Ko:ei}),null==(e=this.pl)||e.handleRemoteConfig(t),this.Ao.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}ll(){try{this.config.loaded(this)}catch(t){ue.critical("`loaded` function failed",t)}if(this.gl(),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.Bo())&&this.ml()}),1),this.yl=new Hr(this),this.yl.load()}gl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.il)||t.enable())}_dom_loaded(){this.is_capturing()&&li(this.__request_queue,(t=>this.rl(t))),this.__request_queue=[],this.gl()}_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.bl()&&this.capture(ni),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.il)||r.unload(),null==(s=this.nl)||s.unload()):this.bl()&&this.capture(ni,null,{transport:"sendBeacon"})}_send_request(t){var e;this.__loaded?xn?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?null!==(e=this.compression)&&void 0!==e?e:t.compressionFallback:t.compression,(C(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,h,u,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&C(s.compression)&&s.data&&(s.compression=Tr.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(u=(h=(k(n=s.data)?n:[n]).map((t=>p({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=u.properties)?void 0:a.token)&&void 0!==o?o:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),k(t)?t.map((t=>p({},t,{sent_at:e}))):p({},t,{sent_at:e})}(s.data))),s.url=Us(s.url,s.method,s.compression,s.timestampMode);var v=Bs.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:r.method)&&void 0!==i?i:v[0].method;if(!c)throw new Error("No available transport method");var _=t=>{try{c(t)}catch(t){As(t)?ue.warn(t):ue.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===Tr.GZipJS&&l&&"undefined"!=typeof Promise&&!Ts?Cs(s).then((t=>{_(t)})).catch((e=>{if(ne(e))return Ts=!0,void _(p({},s,{compression:void 0,url:Us(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 ne(t)||e===ie})(e)&&(Ts=!0),_(s)})):c(s)})(p({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}rl(t){this.nl?this.nl.retriableRequest(t):this._send_request(t)}_execute_array(t){pn++;try{var e,i=[],r=[],s=[];li(t,(t=>{if(t)if(k(e=t[0]))s.push(t);else if(P(t))try{t.call(this)}catch(e){ue.error("Error executing queued PostHog call",t,e)}else k(t)&&"alias"===e?i.push(t):k(t)&&-1!==e.indexOf("capture")&&P(this[e])?s.push(t):r.push(t)}));var n=function(t,e){li(t,(function(t){try{if(k(t[0])){var i=e;hi(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){ue.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{pn--}}push(t){if(pn>0&&k(t)&&M(t[0])){var e=Pn.prototype[t[0]];P(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.il){if(this.is_capturing())if(!C(t)&&M(t)){this.Ho();var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var h=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){null!=e&&e.$current_url&&!M(null==e?void 0:e.$current_url)&&(ue.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i._originatedFromCaptureException||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 u=new Date,d=(null==i?void 0:i.timestamp)||u,v=Qt(null==i?void 0:i.uuid,$i),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===si&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),h&&(c.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var _="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property(Ce);(null==i?void 0:i.$set)&&!_&&(c.$set=null==i?void 0:i.$set);var g=null==i?void 0:i.$unset;g&&(c.$unset=g);var m,w,y,b=_?void 0:this.wl(null==i?void 0:i.$set_once,t!==ai,t===oi);if(b&&(c.$set_once=b),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>M(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){if(e!==Object(e))return o?o(e):e;if(!a.has(e)){var r;if(a.add(e),k(e))r=[],li(e,(e=>{r.push(t(e))}));else{var s={};hi(e,((e,i)=>{a.has(e)||(s[i]=t(e,i))})),r=s}return r}}(n)),c.timestamp=d,C(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=u),_&&(c.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return f.forEach(r),e.forEach(r),i}(c.properties,bn)),t===Nr.DISMISSED||t===Nr.SENT){var x=null==e?void 0:e[Dr.SURVEY_ID],E=null==e?void 0:e[Dr.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){sn.error("Failed to persist survey seen state",t)}})({id:x,current_iteration:E}),c.$set=p({},c.$set,{[(m={id:x,current_iteration:E},w=t===Nr.SENT?"responded":"dismissed",y="$survey_"+w+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(y="$survey_"+w+"/"+m.id+"/"+m.current_iteration),y)]:!0})}else t===Nr.SHOWN&&(c.$set=p({},c.$set,{[Dr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Fr.SHOWN){var S=null==e?void 0:e[Lr.TOUR_TYPE];S&&(c.$set=p({},c.$set,{[Lr.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var T=p({},c.properties.$set,c.$set);if(I(T)||this.setPersonPropertiesForFlags(T),!D(this.config.before_send)){var R=this.Rn(c);if(!R)return;(c=R).uuid=Qt(c.uuid,$i)}this.Do.emit("eventCaptured",c);var P=null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),O={method:"POST",url:P,data:c,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(P)?"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.rl(O):this.il.enqueue(O),c}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)))}getExtension(t){var e;return null==(e=this.pl)?void 0:e.getExtension(t)}dl(){var t;return null!==(t=this.pl)&&void 0!==t?t:this.pl=new vn(this)}No(t){this.Zo.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.Zo.indexOf(t);-1!==i&&this.Zo.splice(i,1)}}}kl(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Yo=null,this.persistence.get_property(Le)===Ze&&(null==(r=this.sessionPersistence)||r.clear(),this.Vo.clear(),this.Sl()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.kl();var l=a?void 0:this.persistence.remove_event_timer(e),u=p({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Bo()&&(u[Ye]=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!M(u.distinct_id)&&!U(u.distinct_id)||A(u.distinct_id))&&ue.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var c,_=function(e,i,r,n){var o,a,l,u;if(void 0===n&&(n=!1),!h)return{};var d,c=e?[...or,...i||[]]:[],_=function(t){for(var e=0;Jt.length>e;e++){var i=Jt[e],r=i[1],s=i[0].exec(t),n=s&&(P(r)?r(s,t):r);if(n)return n}return["",""]}(h),p=_[0],f=_[1],g=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};C(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==(u=t.screen)?void 0:u.height,S=null==t?void 0:t.devicePixelRatio;C(y)||(w.userAgentDataPlatform=y),C(b)||(w.maxTouchPoints=b),C(x)||(w.screenWidth=x),C(E)||(w.screenHeight=E),C(S)||(w.devicePixelRatio=S);var T,R,k,O,I,M,A,N,D=ui(vi({$os:p,$os_version:f,$browser:Wt(h,navigator.vendor,g,m),$device:Kt(h),$device_type:(R=h,k=w,N=Kt(R),N===Q||N===X||"Kobo"===N||"Kindle Fire"===N||N===kt?K:N===gt||N===wt||N===mt||N===St?"Console":N===tt?"Wearable":N?V:"Android"===(null==k?void 0:k.userAgentDataPlatform)&&(null!==(O=null==k?void 0:k.maxTouchPoints)&&void 0!==O?O:0)>0?600>Math.min(null!==(I=null==k?void 0:k.screenWidth)&&void 0!==I?I:0,null!==(M=null==k?void 0:k.screenHeight)&&void 0!==M?M:0)/(null!==(A=null==k?void 0:k.devicePixelRatio)&&void 0!==A?A:1)?V:K:"Desktop"),$timezone:gr(),$timezone_offset:mr()}),{$current_url:sr(n?te(null==s?void 0:s.href):null==s?void 0:s.href,c,lr),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:h.length>1e3?h.substring(0,997)+"...":h,$browser_version:Yt(h,navigator.vendor,g,m),$browser_language:vr(),$browser_language_prefix:(T=vr(),"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&&(D.$sdk_dist_channel=v.SDK_DIST_CHANNEL),D}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var f=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),g=f.windowId;u.$session_id=f.sessionId,u.$window_id=g}this.sessionPropsManager&&ui(u,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&ui(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(m=this.nl)?void 0:m.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Qs&&(u.$lib_custom_api_host=this.config.api_host),c=e!==si||a?e!==ni||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),u=ui(u,c),e===si&&r&&(u.title=r.title),!C(l)){var w=n.getTime()-l;u.$duration=parseFloat((w/1e3).toFixed(3))}h&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties();hi(["$referrer","$referring_domain"],(t=>{t in y&&delete b[t]}));var x={};if(this.Zo.length>0)for(var E of this.Zo.slice())try{ui(x,E())}catch(t){ue.error("Failed to produce browser extension event properties",t)}(u=ui({},_,y,b,p({},x,u))).$is_identified=this._isIdentified(),k(this.config.property_denylist)?hi(this.config.property_denylist,(function(t){delete u[t]})):ue.error(yn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(ue.error(wn),u=S(u,e));var T=this.xl();return u.$process_person_profile=T,T&&!a&&this.Cl("_calculate_event_properties"),u}wl(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.xl())return t;if(this.Wo&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=ui({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(ue.error(wn),o=a(o,"$set_once")),e&&(this.Wo=!0),I(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.kl(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.Vo.add(t))),this.Sl()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.Vo.delete(t),this.Sl()}Tl(t,e){this.register({[t]:e})}sl(){this.Vo.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.Vo.clear(),this.Sl()}Sl(){var t;if(this.Go)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Js||!zi.Hr())zi.Wr(this.Go);else{var e=[];this.Vo.forEach((t=>e.push(t))),e.length>0?zi.Ur(this.Go,e):zi.Wr(this.Go)}}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.Do.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:mn}),()=>{})}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:mn})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:mn})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=nn),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:mn}}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:mn})}Ml(t){return!t||A(t)?(ue.critical("Unique user id has not been set in posthog.identify"),!1):t===Ve?(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(U(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.Ml(t)&&this.Cl("posthog.identify")){this.Ho();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.kl(!1),o=this.persistence.Xs(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(we)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(be)&&(this.unregister(be),this.register({distinct_id:t}));var h,u=(this.persistence.get_property(Le)||Ze)===Ze,d=t!==l,v=!d&&u;if(d&&u)this.persistence.set_property(Le,ti),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.ta(),this.capture(oi,{distinct_id:t,$anon_distinct_id:l},{$set:e||{},$set_once:i||{}}),this.Yo=Xs(t,e,i),null==(h=this.featureFlags)||h.setAnonymousDistinctId(l);else if(v){this.persistence.set_property(Le,ti);var c=e||{},_=i||{};this.setPersonPropertiesForFlags({$set:c,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.ta(),this.capture("$set",{$set:c,$set_once:_}),this.Yo=Xs(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Ue)):v&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.ra(a)}}}setPersonProperties(t,e){if((t||e)&&this.Cl("posthog.setPersonProperties")){var i=Xs(this.get_distinct_id(),t,e);this.Yo!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Yo=i):ue.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(k(t)?t:[t]).filter((t=>M(t)&&t.length>0));0!==i.length&&this.Cl("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Yo=null)}group(t,e,i){var r;if(t&&e){null==(r=this.persistence)||r.syncCookieProperties(),this.kl();var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},s,{[t]:e})}),n||i){var o={$group_type:t,$group_key:e};i&&(o.$group_set=i),this.capture(ai,o)}i&&this.setGroupPropertiesForFlags({[t]:i}),n&&!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.Cl("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=F(t)?t:null==t?void 0:t.resetDeviceID,i=F(t)||null==t?void 0:t.bootstrap;this.El(e,!1,i)}El(t,e,i){var r,s,n;if(void 0===e&&(e=!1),ue.info("reset"),!this.__loaded)return ue.uninitializedWarning("posthog.reset");var o=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(r=this.tl)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var a=this.get_property(we),l=this.get_property(ye),h=this.get_property(Ee),u=this.is_capturing();this.consent.reset(),e||!u||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(n=this.persistence)||null==n.Xs?void 0:n.Xs(),v=!1;try{var c,_,f,g,m,w,y,b,x,E,S,T,R;if(null==(c=this.persistence)||c.clear(),null==(_=this.sessionPersistence)||_.clear(),this.Vo.clear(),this.Sl(),C(h)||null==(E=this.persistence)||E.register({[Ee]:h}),null==(f=this.surveys)||f.reset(),null==(g=this.featureFlags)||g.reset(),null==(m=this.conversations)||m.reset(),null==(w=this.logs)||w.reset(),null==(y=this.metrics)||y.reset(),null==(b=this.persistence)||b.set_property(Le,Ze),null==(x=this.sessionManager)||x.resetSessionId(),this.Yo=null,this.config.cookieless_mode===Qe)this.register_once({distinct_id:Ve,$device_id:null},"");else{var k=this.config.get_device_id($i());this.register_once({distinct_id:k,$device_id:t?k:a},""),t||C(l)||this.register({[ye]:l})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this.Bo()||(null==(R=this.persistence)||R.set_property(Le,i.isIdentifiedID?ti:Ze),this.register({distinct_id:i.distinctID})),null==(S=this.featureFlags)||S.initialize(),!(C(o)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(o,!0))){var P=p({},i);delete P.sessionID,this.config.bootstrap=P}delete this.config.identity_distinct_id,delete this.config.identity_hash,v=!0}finally{var O;d&&(null==(O=this.persistence)||null==O.ra||O.ra(v))}this.reloadFeatureFlags()}shutdown(t){var e=this;return _((function*(){var t,i,r,s,n;if(e.__loaded){e.dl().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.il)||s.unload(),null==(n=e.nl)||n.unload();try{var o;null==(o=e.featureFlags)||o.destroy()}catch(t){ue.error("Error while destroying feature flags",t)}}else 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(ge)?(ue.critical("Attempting to create alias for existing People user - aborting."),-2):this.Cl("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.Tl(be,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(O(t)){var i,r,s,n,o,a,l,h,u,d,c,_;ui(this.config,Rn(t));var f=this.Uo();null==(i=this.persistence)||i.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Er(p({},this.config,{persistence:"sessionStorage"}),f,!1);var g,m=this.Xo(this.config.debug);F(m)&&(this.config.debug=m),F(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,ki.Hr()&&ki.Ur("ph_debug",!0),ue.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,ki.Hr()&&ki.Wr("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(h=this.heatmaps)||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.zo(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:Pn.Pl}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:$n;return e!==$n&&(e=$n+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Le))===ti||(null==(e=this.sessionPersistence)?void 0:e.get_property(Le))===ti}xl(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ei&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[be])&&(null==(e=this.persistence)||null==(e=e.props)||!e[We]))}bl(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.xl()||this.Cl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Cl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Cl(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.Tl(We,!0),!0)}Uo(){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!==Xe)}zo(){var t,e,i,r,s,n=this.Uo();return this.is_capturing()||null==(i=this.logs)||i._onOptOut(),(null==(t=this.persistence)?void 0:t.Js)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(e=this.sessionPersistence)?void 0:e.Js)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.Vo.clear(),this.Sl()),n}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==Qe){if(this.Bo()){var i,r,s,n,o;this.El(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Js(this),this.pageViewManager=new Ki(this),this.persistence&&(this.sessionPropsManager=new Gs(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=Pn.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.jo(this.sessionRecording,new l(this)),this.Lo&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Lo)))}var h,u;this.consent.optInOut(!0),this.zo(),this.gl(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==Xe&&(null==(h=this.surveys)||h.loadIfEnabled()),(C(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.ml()}else ue.warn(gn)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==Qe?(this.config.cookieless_mode===Xe&&this.consent.isOptedIn()&&this.El(!0,!0),this.consent.optInOut(!1),this.zo(),this.config.cookieless_mode===Xe&&(this.register({distinct_id:Ve,$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.ml(),this.gl())):ue.warn(gn)}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===Qe||(this.config.cookieless_mode===Xe?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.zo()}_is_bot(){return i?function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&b(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>b(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver}(i,this.config.custom_blocked_useragents):void 0}ml(){r&&("visible"===r.visibilityState?this.Qo||(this.Qo=!0,this.capture(si,{title:r.title},{send_instantly:!0}),this.Jo&&(r.removeEventListener(ii,this.Jo),this.Jo=null)):this.Jo||(this.Jo=this.ml.bind(this),pi(r,ii,this.Jo)))}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.tl||{};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&&!D(t[e]),o=i in t&&!D(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)}Rn(t){var e;if(D(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(z),r=k(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),D(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&&!I(s.properties)||ue.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return ue.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&D(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.Ps)?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)})}Xo(t){var e=F(t)&&!t,i=ki.Hr()&&"true"===ki.$r("ph_debug");return!e&&(!!i||t)}}Pn.__defaultExtensionClasses={},Pn.Pl={trace:cn=()=>{},debug:cn,info:cn,warn:cn,error:cn,fatal:cn},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=di(t.prototype[e[i]])}(Pn,["identify"]);var On=function(){v.SDK_DIST_CHANNEL="npm";var e=_n[$n]=new Pn;return function(){function e(){e.done||(e.done=!0,xn=!1,hi(_n,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():pi(r,"DOMContentLoaded",e,{capture:!1}):t&&ue.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Tr as Compression,Br as DEFAULT_PRODUCT_TOUR_APPEARANCE,Ur as DisplaySurveyType,Pn as PostHog,Fr as ProductTourEventName,Lr as ProductTourEventProperties,Nr as SurveyEventName,Dr as SurveyEventProperties,Rr as SurveyEventType,Pr as SurveyPosition,Mr as SurveyQuestionBranchingType,Cr as SurveyQuestionType,Ar as SurveySchedule,Or as SurveyTabPosition,Ir as SurveyType,kr as SurveyWidgetType,On as default,On as posthog,Gr as severityLevels};
2
2
  //# sourceMappingURL=module.slim.js.map