signalpilot-ai-internal 0.10.0__py3-none-any.whl → 0.11.24__py3-none-any.whl

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 (85) hide show
  1. signalpilot_ai_internal/__init__.py +1 -0
  2. signalpilot_ai_internal/_version.py +1 -1
  3. signalpilot_ai_internal/cache_service.py +22 -21
  4. signalpilot_ai_internal/composio_handlers.py +224 -0
  5. signalpilot_ai_internal/composio_service.py +511 -0
  6. signalpilot_ai_internal/database_config_handlers.py +182 -0
  7. signalpilot_ai_internal/database_config_service.py +166 -0
  8. signalpilot_ai_internal/databricks_schema_service.py +907 -0
  9. signalpilot_ai_internal/file_scanner_service.py +5 -146
  10. signalpilot_ai_internal/handlers.py +388 -9
  11. signalpilot_ai_internal/integrations_config.py +256 -0
  12. signalpilot_ai_internal/log_utils.py +31 -0
  13. signalpilot_ai_internal/mcp_handlers.py +532 -0
  14. signalpilot_ai_internal/mcp_server_manager.py +298 -0
  15. signalpilot_ai_internal/mcp_service.py +1255 -0
  16. signalpilot_ai_internal/oauth_token_store.py +141 -0
  17. signalpilot_ai_internal/schema_search_config.yml +17 -11
  18. signalpilot_ai_internal/schema_search_service.py +85 -4
  19. signalpilot_ai_internal/signalpilot_home.py +961 -0
  20. signalpilot_ai_internal/snowflake_schema_service.py +2 -0
  21. signalpilot_ai_internal/test_dbt_mcp_server.py +180 -0
  22. signalpilot_ai_internal/unified_database_schema_service.py +2 -0
  23. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/schemas/signalpilot-ai-internal/package.json.orig → signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/package.json +15 -48
  24. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/package.json → signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/schemas/signalpilot-ai-internal/package.json.orig +9 -52
  25. {signalpilot_ai_internal-0.10.0.data → signalpilot_ai_internal-0.11.24.data}/data/share/jupyter/labextensions/signalpilot-ai-internal/schemas/signalpilot-ai-internal/plugin.json +7 -1
  26. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/122.bab318d6caadb055e29c.js +1 -0
  27. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/129.868ca665e6fc225c20a0.js +1 -0
  28. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/179.fd45a2e75d471d0aa3b9.js +7 -0
  29. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/220.81105a94aa873fc51a94.js +1 -0
  30. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/262.a002dd4630d3b6404a90.js +1 -0
  31. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/353.cc6f6ecacd703bcdb468.js +1 -0
  32. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/364.817a883549d55a0e0576.js +1 -0
  33. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/384.a4daecd44f1e9364e44a.js +1 -0
  34. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/439.667225aab294fb5ed161.js +1 -0
  35. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/447.8138af2522716e5a926f.js +1 -0
  36. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/476.925c73e32f3c07448da0.js +1 -0
  37. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/477.aaa4cc9e87801fb45f5b.js +1 -0
  38. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/481.370056149a59022b700c.js +1 -0
  39. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/510.868ca665e6fc225c20a0.js +1 -0
  40. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/512.835f97f7ccfc70ff5c93.js +1 -0
  41. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/57.6c13335f73de089d6b1e.js +1 -0
  42. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/574.ad2709e91ebcac5bbe68.js +1 -0
  43. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/635.bddbab8e464fe31f0393.js +1 -0
  44. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/713.fda1bcdb10497b0a6ade.js +1 -0
  45. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/741.d046701f475fcbf6697d.js +1 -0
  46. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/785.c306dffd4cfe8a613d13.js +1 -0
  47. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/801.e39898b6f336539f228c.js +1 -0
  48. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/880.77cc0ca10a1860df1b52.js +1 -0
  49. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/936.4e2850b2af985ed0d378.js +1 -0
  50. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/956.eeffe67d7781fd63ef4b.js +2 -0
  51. signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/remoteEntry.055f50d20a31f3068c72.js +1 -0
  52. {signalpilot_ai_internal-0.10.0.data → signalpilot_ai_internal-0.11.24.data}/data/share/jupyter/labextensions/signalpilot-ai-internal/static/third-party-licenses.json +47 -29
  53. {signalpilot_ai_internal-0.10.0.dist-info → signalpilot_ai_internal-0.11.24.dist-info}/METADATA +14 -31
  54. signalpilot_ai_internal-0.11.24.dist-info/RECORD +66 -0
  55. signalpilot_ai_internal-0.11.24.dist-info/licenses/LICENSE +7 -0
  56. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/122.e2dadf63dc64d7b5f1ee.js +0 -1
  57. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/220.328403b5545f268b95c6.js +0 -1
  58. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/262.726e1da31a50868cb297.js +0 -1
  59. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/330.af2e9cb5def5ae2b84d5.js +0 -1
  60. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/353.972abe1d2d66f083f9cc.js +0 -1
  61. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/364.dbec4c2dc12e7b050dcc.js +0 -1
  62. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/384.fa432bdb7fb6b1c95ad6.js +0 -1
  63. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/439.37e271d7a80336daabe2.js +0 -1
  64. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/476.ad22ccddd74ee306fb56.js +0 -1
  65. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/481.73c7a9290b7d35a8b9c1.js +0 -1
  66. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/512.b58fc0093d080b8ee61c.js +0 -1
  67. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/553.b4042a795c91d9ff71ef.js +0 -2
  68. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/57.e9acd2e1f9739037f1ab.js +0 -1
  69. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/635.9720593ee20b768da3ca.js +0 -1
  70. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/713.8e6edc9a965bdd578ca7.js +0 -1
  71. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/741.dc49867fafb03ea2ba4d.js +0 -1
  72. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/742.91e7b516c8699eea3373.js +0 -1
  73. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/785.2d75de1a8d2c3131a8db.js +0 -1
  74. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/786.770dc7bcab77e14cc135.js +0 -7
  75. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/801.ca9e114a30896b669a3c.js +0 -1
  76. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/880.25ddd15aca09421d3765.js +0 -1
  77. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/888.34054db17bcf6e87ec95.js +0 -1
  78. signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/remoteEntry.b05b2f0c9617ba28370d.js +0 -1
  79. signalpilot_ai_internal-0.10.0.dist-info/RECORD +0 -50
  80. signalpilot_ai_internal-0.10.0.dist-info/licenses/LICENSE +0 -29
  81. {signalpilot_ai_internal-0.10.0.data → signalpilot_ai_internal-0.11.24.data}/data/etc/jupyter/jupyter_server_config.d/signalpilot_ai.json +0 -0
  82. {signalpilot_ai_internal-0.10.0.data → signalpilot_ai_internal-0.11.24.data}/data/share/jupyter/labextensions/signalpilot-ai-internal/install.json +0 -0
  83. /signalpilot_ai_internal-0.10.0.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/553.b4042a795c91d9ff71ef.js.LICENSE.txt → /signalpilot_ai_internal-0.11.24.data/data/share/jupyter/labextensions/signalpilot-ai-internal/static/956.eeffe67d7781fd63ef4b.js.LICENSE.txt +0 -0
  84. {signalpilot_ai_internal-0.10.0.data → signalpilot_ai_internal-0.11.24.data}/data/share/jupyter/labextensions/signalpilot-ai-internal/static/style.js +0 -0
  85. {signalpilot_ai_internal-0.10.0.dist-info → signalpilot_ai_internal-0.11.24.dist-info}/WHEEL +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunksignalpilot_ai_internal=self.webpackChunksignalpilot_ai_internal||[]).push([[476],{55476(e,t,i){i.r(t),i.d(t,{Compression:()=>ps,DEFAULT_PRODUCT_TOUR_APPEARANCE:()=>To,DisplaySurveyType:()=>Tn,PostHog:()=>Co,SurveyEventName:()=>Cn,SurveyEventProperties:()=>Fn,SurveyEventType:()=>En,SurveyPosition:()=>kn,SurveyQuestionBranchingType:()=>Rn,SurveyQuestionType:()=>$n,SurveySchedule:()=>In,SurveyTabPosition:()=>Sn,SurveyType:()=>Pn,SurveyWidgetType:()=>xn,default:()=>Mo,posthog:()=>Mo,severityLevels:()=>ds});var r="undefined"!=typeof window?window:void 0,s="undefined"!=typeof globalThis?globalThis:r;"undefined"==typeof self&&(s.self=s),"undefined"==typeof File&&(s.File=function(){});var n=Array.prototype,o=n.forEach,a=n.indexOf,l=null==s?void 0:s.navigator,c=null==s?void 0:s.document,u=null==s?void 0:s.location,h=null==s?void 0:s.fetch,d=null!=s&&s.XMLHttpRequest&&"withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:void 0,p=null==s?void 0:s.AbortController,v=null==l?void 0:l.userAgent,g=null!=r?r:{},_={DEBUG:!1,LIB_VERSION:"1.326.0"};function f(e,t,i,r,s,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(r,s)}function m(e){return function(){var t=this,i=arguments;return new Promise(function(r,s){var n=e.apply(t,i);function o(e){f(n,r,s,o,a,"next",e)}function a(e){f(n,r,s,o,a,"throw",e)}o(void 0)})}}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},y.apply(null,arguments)}function b(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}var w=["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"],E=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return w.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})},x=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function k(e,t){return-1!==e.indexOf(t)}var S=function(e){return e.trim()},P=function(e){return e.replace(/^\$/,"")},$=Array.isArray,R=Object.prototype,I=R.hasOwnProperty,C=R.toString,F=$||function(e){return"[object Array]"===C.call(e)},T=e=>"function"==typeof e,M=e=>e===Object(e)&&!F(e),O=e=>{if(M(e)){for(var t in e)if(I.call(e,t))return!1;return!0}return!1},A=e=>void 0===e,L=e=>"[object String]"==C.call(e),D=e=>L(e)&&0===e.trim().length,N=e=>null===e,j=e=>A(e)||N(e),H=e=>"[object Number]"==C.call(e)&&e==e,q=e=>H(e)&&e>0,U=e=>"[object Boolean]"===C.call(e),V=e=>k(x,e);function B(e){return null===e||"object"!=typeof e}function G(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function W(e){return!A(Event)&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var z=[!0,"true",1,"1","yes"],Y=e=>k(z,e),X=[!1,"false",0,"0","no"];function K(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),H(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),K(s||i,t,i,r))}class J{constructor(e){this.t={},this.i=e.i,this.o=K(e.bucketSize,0,100,e.h),this.m=K(e.refillRate,0,this.o,e.h),this.$=K(e.refillInterval,0,864e5,e.h)}S(e,t){var i=t-e.lastAccess,r=Math.floor(i/this.$);if(r>0){var s=r*this.m;e.tokens=Math.min(e.tokens+s,this.o),e.lastAccess=e.lastAccess+r*this.$}}consumeRateLimit(e){var t,i=Date.now(),r=String(e),s=this.t[r];return s?this.S(s,i):(s={tokens:this.o,lastAccess:i},this.t[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this.i)||t.call(this,e)),0===s.tokens)}stop(){this.t={}}}var Z,Q,ee,te="Mobile",ie="iOS",re="Android",se="Tablet",ne=re+" "+se,oe="iPad",ae="Apple",le=ae+" Watch",ce="Safari",ue="BlackBerry",he="Samsung",de=he+"Browser",pe=he+" Internet",ve="Chrome",ge=ve+" OS",_e=ve+" "+ie,fe="Internet Explorer",me=fe+" "+te,ye="Opera",be=ye+" Mini",we="Edge",Ee="Microsoft "+we,xe="Firefox",ke=xe+" "+ie,Se="Nintendo",Pe="PlayStation",$e="Xbox",Re=re+" "+te,Ie=te+" "+ce,Ce="Windows",Fe=Ce+" Phone",Te="Nokia",Me="Ouya",Oe="Generic",Ae=Oe+" "+te.toLowerCase(),Le=Oe+" "+se.toLowerCase(),De="Konqueror",Ne="(\\d+(\\.\\d+)?)",je=new RegExp("Version/"+Ne),He=new RegExp($e,"i"),qe=new RegExp(Pe+" \\w+","i"),Ue=new RegExp(Se+" \\w+","i"),Ve=new RegExp(ue+"|PlayBook|BB10","i"),Be={"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"},Ge=function(e,t){return t=t||"",k(e," OPR/")&&k(e,"Mini")?be:k(e," OPR/")?ye:Ve.test(e)?ue:k(e,"IE"+te)||k(e,"WPDesktop")?me:k(e,de)?pe:k(e,we)||k(e,"Edg/")?Ee:k(e,"FBIOS")?"Facebook "+te:k(e,"UCWEB")||k(e,"UCBrowser")?"UC Browser":k(e,"CriOS")?_e:k(e,"CrMo")||k(e,ve)?ve:k(e,re)&&k(e,ce)?Re:k(e,"FxiOS")?ke:k(e.toLowerCase(),De.toLowerCase())?De:((e,t)=>t&&k(t,ae)||function(e){return k(e,ce)&&!k(e,ve)&&!k(e,re)}(e))(e,t)?k(e,te)?Ie:ce:k(e,xe)?xe:k(e,"MSIE")||k(e,"Trident/")?fe:k(e,"Gecko")?xe:""},We={[me]:[new RegExp("rv:"+Ne)],[Ee]:[new RegExp(we+"?\\/"+Ne)],[ve]:[new RegExp("("+ve+"|CrMo)\\/"+Ne)],[_e]:[new RegExp("CriOS\\/"+Ne)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ne)],[ce]:[je],[Ie]:[je],[ye]:[new RegExp("(Opera|OPR)\\/"+Ne)],[xe]:[new RegExp(xe+"\\/"+Ne)],[ke]:[new RegExp("FxiOS\\/"+Ne)],[De]:[new RegExp("Konqueror[:/]?"+Ne,"i")],[ue]:[new RegExp(ue+" "+Ne),je],[Re]:[new RegExp("android\\s"+Ne,"i")],[pe]:[new RegExp(de+"\\/"+Ne)],[fe]:[new RegExp("(rv:|MSIE )"+Ne)],Mozilla:[new RegExp("rv:"+Ne)]},ze=function(e,t){var i=Ge(e,t),r=We[i];if(A(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=e.match(n);if(o)return parseFloat(o[o.length-2])}return null},Ye=[[new RegExp($e+"; "+$e+" (.*?)[);]","i"),e=>[$e,e&&e[1]||""]],[new RegExp(Se,"i"),[Se,""]],[new RegExp(Pe,"i"),[Pe,""]],[Ve,[ue,""]],[new RegExp(Ce,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Fe,""];if(new RegExp(te).test(t)&&!/IEMobile\b/.test(t))return[Ce+" "+te,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],s=Be[r]||"";return/arm/i.test(t)&&(s="RT"),[Ce,s]}return[Ce,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[ie,t.join(".")]}return[ie,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=A(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+re+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+re+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[re,t.join(".")]}return[re,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ge,""]],[/Linux|debian/i,["Linux",""]]],Xe=function(e){return Ue.test(e)?Se:qe.test(e)?Pe:He.test(e)?$e:new RegExp(Me,"i").test(e)?Me:new RegExp("("+Fe+"|WPDesktop)","i").test(e)?Fe:/iPad/.test(e)?oe:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?le:Ve.test(e)?ue:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Te,"i").test(e)?Te:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(te).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?re:ne:new RegExp("(pda|"+te+")","i").test(e)?Ae:new RegExp(se,"i").test(e)&&!new RegExp(se+" pc","i").test(e)?Le:""},Ke=e=>e instanceof Error;function Je(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return ee&&i.length===Q||(Q=i.length,ee=i.reduce((i,r)=>{Z||(Z={});var s=Z[r];if(s)i[s[0]]=s[1];else for(var n=e(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,c=t[r];if(l&&c){i[l]=c,Z[r]=[l,c];break}}return i},{})),ee}}class Ze{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return m(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&F(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,r;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),y({},e,{cause:i,stack:r})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return m(function*(){var i=e;for(var r of t.modifiers)i=yield r(i);return i})()}convertToExceptionList(e,t){var i,r,s,n={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,y({},t,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:Je(this.stackParser)}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var r=(i,r)=>{if(r<=4){var s=this.buildCoercingContext(e,t,r);return this.applyCoercers(i,s)}};return y({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,i),next:e=>r(e,i+1)})}}var Qe="?";function et(e,t,i,r,s){var n={platform:e,filename:t,function:"<anonymous>"===i?Qe:i,in_app:!0};return A(r)||(n.lineno=r),A(s)||(n.colno=s),n}var tt=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:Qe,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},it=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,rt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,st=/\((\S*)(?::(\d+))(?::(\d+))\)/,nt=(e,t)=>{var i=it.exec(e);if(i){var[,r,s,n]=i;return et(t,r,Qe,+s,+n)}var o=rt.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=st.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=tt(o[1]||Qe,o[2]);return et(t,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},ot=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,at=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,lt=(e,t)=>{var i=ot.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=at.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||Qe;return[n,s]=tt(n,s),et(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},ct=/\(error: (.*)\)/;class ut{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=L(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return G(e,"DOMException")}isDOMError(e){return G(e,"DOMError")}}class ht{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&"string"==typeof i.error.message?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class dt{constructor(){}match(e){return G(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var pt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class vt{match(e){return"string"==typeof e}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(pt);return r&&(t=r[1],i=r[2]),[t,i]}}var gt=["fatal","error","warning","log","info","debug"];function _t(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(!(s.length>t))return r===i.length||s.length<=t?s:s.slice(0,t)+"..."}return""}class ft{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return W(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+_t(e)}isSeverityLevel(e){return L(e)&&!D(e)&&gt.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(Ke(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class mt{match(e){return W(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+_t(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class yt{match(e){return B(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class bt{match(e){return G(e,"PromiseRejectionEvent")}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return B(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){if(B(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var wt=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={k:function(t){if(r&&(_.DEBUG||g.POSTHOG_DEBUG||i)&&!A(r.console)&&r.console){for(var s=("__rrweb_original__"in r.console[t]?r.console[t].__rrweb_original__:r.console[t]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];s(e,...o)}},info:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];s.k("log",...t)},warn:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];s.k("warn",...t)},error:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];s.k("error",...t)},critical:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning:e=>{s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>wt(e+" "+t,i)};return s},Et=wt("[PostHog.js]"),xt=Et.createLogger,kt=xt("[ExternalScriptsLoader]"),St=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return kt.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==c?void 0:c.querySelectorAll("script");if(r)for(var s,n=function(){if(r[o].src===t){var e=r[o];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}},o=0;o<r.length;o++)if(s=n())return s.v;var a=()=>{if(!c)return i("document not found");var r=c.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,i(void 0,e)},r.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");var s,n=c.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):c.body.appendChild(r)};null!=c&&c.body?a():null==c||c.addEventListener("DOMContentLoaded",a)};g.__PosthogExtensions__=g.__PosthogExtensions__||{},g.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{var r="/static/"+t+".js?v="+e.version;if("remote-config"===t&&(r="/array/"+e.config.token+"/config.js"),"toolbar"===t){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=e.requestRouter.endpointFor("assets",r);St(e,n,i)},g.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);St(e,r,i)};var Pt={};function $t(e,t,i){if(F(e))if(o&&e.forEach===o)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(var r=0,s=e.length;r<s;r++)if(r in e&&t.call(i,e[r],r)===Pt)return}function Rt(e,t,i){if(!j(e)){if(F(e))return $t(e,t,i);if((e=>e instanceof FormData)(e)){for(var r of e.entries())if(t.call(i,r[1],r[0])===Pt)return}else for(var s in e)if(I.call(e,s)&&t.call(i,e[s],s)===Pt)return}}var It=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return $t(i,function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])}),e},Ct=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return $t(i,function(t){$t(t,function(t){e.push(t)})}),e};function Ft(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var Tt=function(e){try{return e()}catch(e){return}},Mt=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return e.apply(this,i)}catch(e){Et.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Et.critical(e)}}},Ot=function(e){var t={};return Rt(e,function(e,i){(L(e)&&e.length>0||H(e))&&(t[i]=e)}),t},At=["herokuapp.com","vercel.app","netlify.app"];function Lt(e){var t=null==e?void 0:e.hostname;if(!L(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of At)if(i===r)return!1;return!0}function Dt(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}function Nt(e,t,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:s,passive:n})}var jt="$people_distinct_id",Ht="__alias",qt="__timers",Ut="$autocapture_disabled_server_side",Vt="$heatmaps_enabled_server_side",Bt="$exception_capture_enabled_server_side",Gt="$error_tracking_suppression_rules",Wt="$error_tracking_capture_extension_exceptions",zt="$web_vitals_enabled_server_side",Yt="$dead_clicks_enabled_server_side",Xt="$product_tours_enabled_server_side",Kt="$web_vitals_allowed_metrics",Jt="$session_recording_remote_config",Zt="$sesid",Qt="$session_is_sampled",ei="$enabled_feature_flags",ti="$early_access_features",ii="$feature_flag_details",ri="$stored_person_properties",si="$stored_group_properties",ni="$surveys",oi="$flag_call_reported",ai="$user_state",li="$client_session_props",ci="$capture_rate_limit",ui="$initial_campaign_params",hi="$initial_referrer_info",di="$initial_person_info",pi="$epp",vi="__POSTHOG_TOOLBAR__",gi="$posthog_cookieless",_i=[jt,Ht,"__cmpns",qt,"$session_recording_enabled_server_side",Vt,Zt,ei,Gt,ai,ti,ii,si,ri,ni,oi,li,ci,ui,hi,pi,di,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function fi(e){return e instanceof Element&&(e.id===vi||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function mi(e){return!!e&&1===e.nodeType}function yi(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function bi(e){return!!e&&3===e.nodeType}function wi(e){return!!e&&11===e.nodeType}function Ei(e){return e?S(e).split(/\s+/):[]}function xi(e){var t=null==r?void 0:r.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function ki(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Ei(t)}function Si(e){return j(e)?null:S(e).split(/(\s+)/).filter(e=>Vi(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Pi(e){var t="";return Ai(e)&&!Li(e)&&e.childNodes&&e.childNodes.length&&Rt(e.childNodes,function(e){var i;bi(e)&&e.textContent&&(t+=null!==(i=Si(e.textContent))&&void 0!==i?i:"")}),S(t)}function $i(e){return A(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Ri=["a","button","form","input","select","textarea","label"];function Ii(e,t){if(A(t))return!0;var i,r=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function Ci(e){var t=e.parentNode;return!(!t||!mi(t))&&t}var Fi=["next","previous","prev",">","<"],Ti=[".ph-no-rageclick",".ph-no-capture"],Mi=e=>!e||yi(e,"html")||!mi(e),Oi=(e,t)=>{if(!r||Mi(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],n=e;n.parentNode&&!yi(n,"body");)if(wi(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Ci(n);if(!o)break;if(t||Ri.indexOf(o.tagName.toLowerCase())>-1)i=!0;else{var a=r.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}s.push(o),n=o}return{parentIsUsefulElement:i,targetElementList:s}};function Ai(e){for(var t=e;t.parentNode&&!yi(t,"body");t=t.parentNode){var i=ki(t);if(k(i,"ph-sensitive")||k(i,"ph-no-capture"))return!1}if(k(ki(e),"ph-include"))return!0;var r=e.type||"";if(L(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!L(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Li(e){return!!(yi(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||yi(e,"select")||yi(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Di="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Ni=new RegExp("^(?:"+Di+")$"),ji=new RegExp(Di),Hi="\\d{3}-?\\d{2}-?\\d{4}",qi=new RegExp("^("+Hi+")$"),Ui=new RegExp("("+Hi+")");function Vi(e,t){if(void 0===t&&(t=!0),j(e))return!1;if(L(e)){if(e=S(e),(t?Ni:ji).test((e||"").replace(/[- ]/g,"")))return!1;if((t?qi:Ui).test(e))return!1}return!0}function Bi(e){var t=Pi(e);return Vi(t=(t+" "+Gi(e)).trim())?t:""}function Gi(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Rt(e.childNodes,function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=Pi(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Gi(e)).trim())}catch(e){Et.error("[AutoCapture]",e)}}),t}function Wi(e){return function(e){var t=e.map(e=>{var t,i,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))r+="."+s.replace(/"/g,"");var n=y({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Ft(n).sort((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)}).forEach(e=>{var[t,i]=e;return o[zi(t.toString())]=zi(i.toString())}),(r+=":")+Ft(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")});return t.join(";")}(function(e){return e.map(e=>{var t,i,r={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:Yi(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Ft(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r})}(e))}function zi(e){return e.replace(/"|\\"/g,'\\"')}function Yi(e){var t=e.attr__class;return t?F(t)?t:Ei(t):void 0}class Xi{constructor(e){this.disabled=!1===e;var t=M(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&i-r.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var Ki=e=>{var t=null==c?void 0:c.createElement("a");return A(t)?null:(t.href=e,t)},Ji=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!F(i)||i.length<2)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){Et.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Zi=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),u=[],h=0;h<c.length;h++){var d=c[h].split("=");F(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(c[h]))}var p=l;return null!=a&&(p+="?"+u.join("&")),null!=n&&(p+="#"+n),p},Qi=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},er="$copy_autocapture",tr=xt("[AutoCapture]");function ir(e,t){return t.length>e?t.slice(0,e)+"...":t}function rr(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!mi(t));return t}class sr{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Xi(e.config.rageclick),this.C=null}get R(){var e,t,i=M(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>new RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),i}F(){if(this.isBrowserSupported()){if(r&&c){var e=e=>{e=e||(null==r?void 0:r.event);try{this.M(e)}catch(e){tr.error("Failed to capture event",e)}};if(Nt(c,"submit",e,{capture:!0}),Nt(c,"change",e,{capture:!0}),Nt(c,"click",e,{capture:!0}),this.R.capture_copied_text){var t=e=>{e=e||(null==r?void 0:r.event),this.M(e,er)};Nt(c,"copy",t,{capture:!0}),Nt(c,"cut",t,{capture:!0})}}}else tr.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ut]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,i=[];return null==(t=this.C)||t.forEach(t=>{var r=null==c?void 0:c.querySelectorAll(t);null==r||r.forEach(r=>{e===r&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[Ut],r=this.T;if(N(r)&&!U(i)&&!this.instance.O())return!1;var s=null!==(t=this.T)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}M(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,s=$i(e);bi(s)&&(s=s.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!r||Mi(e))return!1;var i,s,n;if(U(t)?(i=!!t&&Ti,s=void 0):(i=null!==(n=null==t?void 0:t.css_selector_ignorelist)&&void 0!==n?n:Ti,s=null==t?void 0:t.content_ignorelist),!1===i)return!1;var{targetElementList:o}=Oi(e,!1);return!function(e,t){if(!1===e||A(e))return!1;var i;if(!0===e)i=Fi;else{if(!F(e))return!1;if(e.length>10)return Et.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:r}=e;return i.some(e=>t.includes(e)||r.includes(e))})}(s,o.map(e=>{var t;return{safeText:Pi(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!Ii(o,i)}(s,this.instance.config.rageclick)&&this.M(e,"$rageclick");var n=t===er;if(s&&function(e,t,i,s,n){var o,a,l,c;if(void 0===i&&(i=void 0),!r||Mi(e))return!1;if(null!=(o=i)&&o.url_allowlist&&!xi(i.url_allowlist))return!1;if(null!=(a=i)&&a.url_ignorelist&&xi(i.url_ignorelist))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some(e=>t.type===e))return!1}var{parentIsUsefulElement:h,targetElementList:d}=Oi(e,s);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(A(i))return!0;var r,s=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(r=s(n))return r.v;return!1}(d,i))return!1;if(!Ii(d,null==(c=i)?void 0:c.css_selector_allowlist))return!1;var p=r.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var v=e.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return h?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(Ri.indexOf(v)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.R,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=function(e,t){for(var i,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],h=e;h.parentNode&&!yi(h,"body");)wi(h.parentNode)?(u.push(h.parentNode.host),h=h.parentNode.host):(u.push(h.parentNode),h=h.parentNode);var d,p=[],v={},g=!1,_=!1;if(Rt(u,e=>{var t=Ai(e);"a"===e.tagName.toLowerCase()&&(g=e.getAttribute("href"),g=t&&g&&Vi(g)&&g),k(ki(e),"ph-no-capture")&&(_=!0),p.push(function(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};Ri.indexOf(s)>-1&&!i&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=ir(1024,Bi(e)):n.$el_text=ir(1024,Pi(e)));var o=ki(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),Rt(e.attributes,function(i){var s;if((!Li(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!t&&Vi(i.value)&&(s=i.name,!L(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=Ei(o).join(" ")),n["attr__"+i.name]=ir(1024,o)}});for(var a=1,l=1,c=e;c=rr(c);)a++,c.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l));var i=function(e){if(!Ai(e))return{};var t={};return Rt(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&Vi(r)&&(t[i]=r)}}),t}(e);It(v,i)}),_)return{props:{},explicitNoCapture:_};if(a||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?p[0].$el_text=Bi(e):p[0].$el_text=Pi(e)),g){var f,m;p[0].attr__href=g;var y=null==(f=Ki(g))?void 0:f.host,b=null==r||null==(m=r.location)?void 0:m.host;y&&b&&y!==b&&(d=g)}return{props:It({$event_type:n.type,$ce_version:1},c?{}:{$elements:p},{$elements_chain:Wi(p)},null!=(i=p[0])&&i.$el_text?{$el_text:null==(s=p[0])?void 0:s.$el_text}:{},d&&"click"===n.type?{$external_click_url:d}:{},v)}}(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),t===er){var c,u=Si(null==r||null==(c=r.getSelection())?void 0:c.toString()),h=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=h}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return T(null==c?void 0:c.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return H(e)&&isFinite(e)&&Math.floor(e)===e});var nr="0123456789abcdef";class or{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||e<0||t<0||i<0||r<0||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,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 or(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+nr.charAt(this.bytes[t]>>>4)+nr.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new or(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class ar{constructor(){this.A=0,this.D=0,this.j=new ur}generate(){var e=this.generateOrAbort();if(A(e)){this.A=0;var t=this.generateOrAbort();if(A(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return or.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var lr,cr=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};r&&!A(r.crypto)&&crypto.getRandomValues&&(cr=e=>crypto.getRandomValues(e));class ur{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(cr(this.N),this.U=0),this.N[this.U++]}}var hr=()=>dr().toString(),dr=()=>(lr||(lr=new ar)).generate(),pr="",vr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,gr={H:()=>!!c,B:function(e){Et.error("cookieStore error: "+e)},q:function(e){if(c){try{for(var t=e+"=",i=c.cookie.split(";").filter(e=>e.length),r=0;r<i.length;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}},W:function(e){var t;try{t=JSON.parse(gr.q(e))||{}}catch(e){}return t},G:function(e,t,i,r,s){if(c)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=c),pr)return pr;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+hr();!pr&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",pr=n)}return pr}(e);if(!i){var r=(e=>{var t=e.match(vr);return t?t[0]:""})(e);r!==i&&Et.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(c.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+24*i*60*60*1e3),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Et.warn("cookieStore warning: large cookie, len="+u.length),c.cookie=u,u}catch(e){return}},V:function(e,t){if(null!=c&&c.cookie)try{gr.G(e,"",-1,t)}catch(e){return}}},_r=null,fr={H:function(){if(!N(_r))return _r;var e=!0;if(A(r))e=!1;else try{var t="__mplssupport__";fr.G(t,"xyz"),'"xyz"'!==fr.q(t)&&(e=!1),fr.V(t)}catch(t){e=!1}return e||Et.error("localStorage unsupported; falling back to cookie store"),_r=e,e},B:function(e){Et.error("localStorage error: "+e)},q:function(e){try{return null==r?void 0:r.localStorage.getItem(e)}catch(e){fr.B(e)}return null},W:function(e){try{return JSON.parse(fr.q(e))||{}}catch(e){}return null},G:function(e,t){try{null==r||r.localStorage.setItem(e,JSON.stringify(t))}catch(e){fr.B(e)}},V:function(e){try{null==r||r.localStorage.removeItem(e)}catch(e){fr.B(e)}}},mr=["$device_id","distinct_id",Zt,Qt,pi,di],yr={},br={H:function(){return!0},B:function(e){Et.error("memoryStorage error: "+e)},q:function(e){return yr[e]||null},W:function(e){return yr[e]||null},G:function(e,t){yr[e]=t},V:function(e){delete yr[e]}},wr=null,Er={H:function(){if(!N(wr))return wr;if(wr=!0,A(r))wr=!1;else try{var e="__support__";Er.G(e,"xyz"),'"xyz"'!==Er.q(e)&&(wr=!1),Er.V(e)}catch(e){wr=!1}return wr},B:function(e){Et.error("sessionStorage error: ",e)},q:function(e){try{return null==r?void 0:r.sessionStorage.getItem(e)}catch(e){Er.B(e)}return null},W:function(e){try{return JSON.parse(Er.q(e))||null}catch(e){}return null},G:function(e,t){try{null==r||r.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){Er.B(e)}},V:function(e){try{null==r||r.sessionStorage.removeItem(e)}catch(e){Er.B(e)}}},xr=function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e}({});class kr{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?xr.DENIED:this.K}isOptedOut(){return"always"===this.R.cookieless_mode||this.consent===xr.DENIED||this.consent===xr.PENDING&&(this.R.opt_out_capturing_by_default||"on_reject"===this.R.cookieless_mode)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===xr.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return Y(e)?xr.GRANTED:k(X,e)?xr.DENIED:xr.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z="localStorage"===e?fr:gr;var t="localStorage"===e?gr:fr;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(Y(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!Dt([null==l?void 0:l.doNotTrack,null==l?void 0:l.msDoNotTrack,g.doNotTrack],e=>Y(e))}}var Sr=xt("[Dead Clicks]"),Pr=()=>!0,$r=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(Yt)),r=e.instance.config.capture_dead_clicks;return U(r)?r:!!M(r)||i};class Rr{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Yt]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it(()=>{this.et()})}it(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?Sr.error("failed to load script",t):e()})}et(){var e;if(c){if(!this.tt&&null!=(e=g.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=M(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=g.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(c),Sr.info("starting...")}}else Sr.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Sr.info("stopping..."))}}var Ir=xt("[ExceptionAutocapture]");class Cr{constructor(e){var t,i,s;this.rt=()=>{var e;if(r&&this.isEnabled&&null!=(e=g.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=g.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=g.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=g.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=t(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=i(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=s(this.captureException.bind(this)))}catch(e){Ir.error("failed to start",e),this.ut()}}},this._instance=e,this.ht=!(null==(t=this._instance.persistence)||!t.props[Bt]),this.dt=new J({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,h:Ir}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return M(e)?t=y({},t,e):(A(e)?this.ht:e)&&(t=y({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ir.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return Ir.error("failed to load script",t);e()})}ut(){var e,t,i;null==(e=this.st)||e.call(this),this.st=void 0,null==(t=this.nt)||t.call(this),this.nt=void 0,null==(i=this.ot)||i.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[Bt]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,i,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this.dt.consumeRateLimit(r)?Ir.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(e)}}function Fr(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return T(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch(e){return()=>{}}}class Tr{constructor(e){var t;this._instance=e,this.ct=(null==r||null==(t=r.location)?void 0:t.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Et.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,Et.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(r&&r.history){var i=this;null!=(e=r.history.pushState)&&e.__posthog_wrapped__||Fr(r.history,"pushState",e=>function(t,r,s){e.call(this,t,r,s),i._t("pushState")}),null!=(t=r.history.replaceState)&&t.__posthog_wrapped__||Fr(r.history,"replaceState",e=>function(t,r,s){e.call(this,t,r,s),i._t("replaceState")}),this.yt()}}_t(e){try{var t,i=null==r||null==(t=r.location)?void 0:t.pathname;if(!i)return;i!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=i}catch(t){Et.error("Error capturing "+e+" pageview",t)}}yt(){if(!this.ft){var e=()=>{this._t("popstate")};Nt(r,"popstate",e),this.ft=()=>{r&&r.removeEventListener("popstate",e)}}}}var Mr=xt("[SegmentIntegration]"),Or="posthog-js";function Ar(e,t){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{var a,l,c,u,h;if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var d=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p=(null==(a=t.exception)?void 0:a.values)||[],v=p.map(e=>y({},e,{stacktrace:e.stacktrace?y({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>y({},e,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(l=p[0])?void 0:l.value)||t.message,$exception_type:null==(c=p[0])?void 0:c.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(u=p[0])?void 0:u.value)||t.message,$sentry_exception_type:null==(h=p[0])?void 0:h.type,$sentry_tags:t.tags};return i&&r&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),o&&e.exceptions.sendExceptionEvent(g),t}}class Lr{constructor(e,t,i,r,s,n){this.name=Or,this.setupOnce=function(o){o(Ar(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Dr=null!=r&&r.location?Qi(r.location.hash,"__posthog")||Qi(location.hash,"state"):null,Nr="_postHogToolbarParams",jr=xt("[Toolbar]"),Hr=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e}(Hr||{});class qr{constructor(e){this.instance=e}bt(e){g.ph_toolbar_state=e}wt(){var e;return null!==(e=g.ph_toolbar_state)&&void 0!==e?e:Hr.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),!r||!c)return!1;e=null!=e?e:r.location,i=null!=i?i:r.history;try{if(!t){try{r.localStorage.setItem("test","test"),r.localStorage.removeItem("test")}catch(e){return!1}t=null==r?void 0:r.localStorage}var s,n=Dr||Qi(e.hash,"__posthog")||Qi(e.hash,"state"),o=n?Tt(()=>JSON.parse(atob(decodeURIComponent(n))))||Tt(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?((s=o).source="url",s&&Object.keys(s).length>0&&(o.desiredHash?e.hash=o.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Nr)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}xt(e){var t=g.ph_load_toolbar||g.ph_load_editor;!j(t)&&T(t)?t(e,this.instance):jr.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==c||!c.getElementById(vi));if(!r||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=y({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(r.localStorage.setItem(Nr,JSON.stringify(y({},s,{source:void 0}))),this.wt()===Hr.LOADED)this.xt(s);else if(this.wt()===Hr.UNINITIALIZED){var n;this.bt(Hr.LOADING),null==(n=g.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return jr.error("[Toolbar] Failed to load",e),void this.bt(Hr.UNINITIALIZED);this.bt(Hr.LOADED),this.xt(s)}),Nt(r,"turbolinks:load",()=>{this.bt(Hr.UNINITIALIZED),this.loadToolbar(s)})}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var Ur=xt("[TracingHeaders]");class Vr{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var e,t;A(this.$t)&&(null==(e=g.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),A(this.St)&&(null==(t=g.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return Ur.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):(null==(e=this.$t)||e.call(this),null==(t=this.St)||t.call(this),this.$t=void 0,this.St=void 0)}}var Br="https?://(.*)",Gr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Wr=Ct(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Gr),zr="<masked>",Yr=["li_fat_id"];function Xr(e,t,i){if(!c)return{};var r,s=t?Ct([],Gr,i||[]):[],n=Kr(Zi(c.URL,s,zr),e),o=(r={},Rt(Yr,function(e){var t=gr.q(e);r[e]=t||null}),r);return It(o,n)}function Kr(e,t){var i=Wr.concat(t||[]),r={};return Rt(i,function(t){var i=Ji(e,t);r[t]=i||null}),r}function Jr(e){var t=function(e){return e?0===e.search(Br+"google.([^/?]*)")?"google":0===e.search(Br+"bing.com")?"bing":0===e.search(Br+"yahoo.com")?"yahoo":0===e.search(Br+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",r={};if(!N(t)){r.$search_engine=t;var s=c?Ji(c.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Zr(){return navigator.language||navigator.userLanguage}function Qr(){return(null==c?void 0:c.referrer)||"$direct"}function es(e,t){var i=e?Ct([],Gr,t||[]):[],r=null==u?void 0:u.href.substring(0,1e3);return{r:Qr().substring(0,1e3),u:r?Zi(r,i,zr):void 0}}function ts(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:null==i?void 0:"$direct"==i?"$direct":null==(t=Ki(i))?void 0:t.host};if(r){s.$current_url=r;var n=Ki(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=Kr(r);It(s,o)}if(i){var a=Jr(i);It(s,a)}return s}function is(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function rs(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function ss(e,t){if(!v)return{};var i,s,n,o=e?Ct([],Gr,t||[]):[],[a,l]=function(e){for(var t=0;t<Ye.length;t++){var[i,r]=Ye[t],s=i.exec(e),n=s&&(T(r)?r(s,e):r);if(n)return n}return["",""]}(v);return It(Ot({$os:a,$os_version:l,$browser:Ge(v,navigator.vendor),$device:Xe(v),$device_type:(s=v,n=Xe(s),n===oe||n===ne||"Kobo"===n||"Kindle Fire"===n||n===Le?se:n===Se||n===$e||n===Pe||n===Me?"Console":n===le?"Wearable":n?te:"Desktop"),$timezone:is(),$timezone_offset:rs()}),{$current_url:Zi(null==u?void 0:u.href,o,zr),$host:null==u?void 0:u.host,$pathname:null==u?void 0:u.pathname,$raw_user_agent:v.length>1e3?v.substring(0,997)+"...":v,$browser_version:ze(v,navigator.vendor),$browser_language:Zr(),$browser_language_prefix:(i=Zr(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==r?void 0:r.screen.height,$screen_width:null==r?void 0:r.screen.width,$viewport_height:null==r?void 0:r.innerHeight,$viewport_width:null==r?void 0:r.innerWidth,$lib:"web",$lib_version:_.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var ns=xt("[Web Vitals]"),os=9e5;class as{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),0!==this.N.metrics.length&&(this._instance.capture("$web_vitals",this.N.metrics.reduce((e,t)=>y({},e,{["$web_vitals_"+t.name+"_event"]:y({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=e=>{var t,i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(A(i))ns.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Ct();A(r)||(j(null==e?void 0:e.name)||j(null==e?void 0:e.value)?ns.error("Invalid metric received",e):this.Rt&&e.value>=this.Rt?ns.error("Ignoring metric with value >= "+this.Rt,e):(this.N.url!==r&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),A(this.N.url)&&(this.N.url=r),this.N.firstMetricTimestamp=A(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.N.metrics.push(y({},e,{$current_url:r,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{var e,t,i,r,s=g.__PosthogExtensions__;A(s)||A(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.It.bind(this)),this.P=!0):ns.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.kt=!(null==(t=this._instance.persistence)||!t.props[zt]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=M(this._instance.config.capture_performance)?null==(e=this._instance.config.capture_performance)?void 0:e.web_vitals_allowed_metrics:void 0;return A(i)?(null==(t=this._instance.persistence)?void 0:t.props[Kt])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(M(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var e=M(this._instance.config.capture_performance)&&H(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:os;return 0<e&&e<=6e4?os:e}get isEnabled(){var e=null==u?void 0:u.protocol;if("http:"!==e&&"https:"!==e)return ns.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=M(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:U(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return U(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(ns.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=M(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=M(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[zt]:t}),this._instance.persistence.register({[Kt]:i})),this.kt=t,this.startIfEnabled()}it(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks&&e(),null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"web-vitals",t=>{t?ns.error("failed to load script",t):e()})}Ct(){var e=r?r.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,s=t?Ct([],Gr,i||[]):[];return Zi(e,s,zr)}ns.error("Could not determine current URL")}}var ls=xt("[Heatmaps]");function cs(e){return M(e)&&"clientX"in e&&"clientY"in e&&H(e.clientX)&&H(e.clientY)}class us{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!(null==(t=this.instance.persistence)||!t.props[Vt]),this.rageclicks=new Xi(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return M(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return A(this.instance.config.capture_heatmaps)?A(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;ls.info("starting..."),this.Mt(),this.Ot()}else{var e;clearInterval(null!==(e=this.Ft)&&void 0!==e?e:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Vt]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}Dt(e){this.jt(e.originalEvent,"deadclick")}Ot(){this.Ft&&clearInterval(this.Ft),this.Ft=function(e){return"visible"===(null==e?void 0:e.visibilityState)}(c)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Mt(){r&&c&&(this.Nt=this.Lt.bind(this),Nt(r,"beforeunload",this.Nt),this.Ut=e=>this.jt(e||(null==r?void 0:r.event)),Nt(c,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||(null==r?void 0:r.event)),Nt(c,"mousemove",this.zt,{capture:!0}),this.Bt=new Rr(this.instance,Pr,this.Dt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Ot.bind(this),Nt(c,"visibilitychange",this.qt),this.P=!0)}At(){var e;r&&c&&(this.Nt&&r.removeEventListener("beforeunload",this.Nt),this.Ut&&c.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&c.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&c.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),null==(e=this.Bt)||e.stop(),this.P=!1)}Gt(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,t,i){for(var s=e;s&&mi(s)&&!yi(s,"body");){if(s===i)return!1;if(k(t,null==r?void 0:r.getComputedStyle(s).position))return!0;s=Ci(s)}return!1}($i(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:i),target_fixed:o,type:t}}jt(e,t){var i;if(void 0===t&&(t="click"),!fi(e.target)&&cs(e)){var r=this.Gt(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.Vt(y({},r,{type:"rageclick"})),this.Vt(r)}}Ht(e){!fi(e.target)&&cs(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout(()=>{this.Vt(this.Gt(e,"mousemove"))},500))}Vt(e){if(r){var t=r.location.href,i=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=i?Ct([],Gr,s||[]):[],o=Zi(t,n,zr);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!O(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class hs{constructor(e){this.Jt=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(Et.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){var e;this.Xt=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.Jt)}destroy(){var e;null==(e=this.Xt)||e.call(this),this.Xt=void 0}doPageView(e,t){var i,s=this.Qt(e,t);return this.Kt={pathname:null!==(i=null==r?void 0:r.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Qt(e,null==(t=this.Kt)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.Kt)?void 0:e.pageViewId}}Qt(e,t){var i=this.Kt;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=s;if(!(A(n)||A(o)||A(a)||A(l)||A(c)||A(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var h=n<=1?1:K(o/n,0,1,Et),d=n<=1?1:K(a/n,0,1,Et),p=l<=1?1:K(c/l,0,1,Et),v=l<=1?1:K(u/l,0,1,Et);r=It(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}var ds=["fatal","error","warning","log","info","debug"],ps=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),vs=Uint8Array,gs=Uint16Array,_s=Uint32Array,fs=new vs([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]),ms=new vs([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]),ys=new vs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bs=function(e,t){for(var i=new gs(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var s=new _s(i[30]);for(r=1;r<30;++r)for(var n=i[r];n<i[r+1];++n)s[n]=n-i[r]<<5|r;return[i,s]},ws=bs(fs,2),Es=ws[0],xs=ws[1];Es[28]=258,xs[258]=28;for(var ks=bs(ms,0)[1],Ss=new gs(32768),Ps=0;Ps<32768;++Ps){var $s=(43690&Ps)>>>1|(21845&Ps)<<1;$s=(61680&($s=(52428&$s)>>>2|(13107&$s)<<2))>>>4|(3855&$s)<<4,Ss[Ps]=((65280&$s)>>>8|(255&$s)<<8)>>>1}var Rs=function(e,t,i){for(var r=e.length,s=0,n=new gs(t);s<r;++s)++n[e[s]-1];var o,a=new gs(t);for(s=0;s<t;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new gs(1<<t);var l=15-t;for(s=0;s<r;++s)if(e[s])for(var c=s<<4|e[s],u=t-e[s],h=a[e[s]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)o[Ss[h]>>>l]=c}else for(o=new gs(r),s=0;s<r;++s)o[s]=Ss[a[e[s]-1]++]>>>15-e[s];return o},Is=new vs(288);for(Ps=0;Ps<144;++Ps)Is[Ps]=8;for(Ps=144;Ps<256;++Ps)Is[Ps]=9;for(Ps=256;Ps<280;++Ps)Is[Ps]=7;for(Ps=280;Ps<288;++Ps)Is[Ps]=8;var Cs=new vs(32);for(Ps=0;Ps<32;++Ps)Cs[Ps]=5;var Fs=Rs(Is,9,0),Ts=Rs(Cs,5,0),Ms=function(e){return(e/8|0)+(7&e&&1)},Os=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof gs?gs:e instanceof _s?_s:vs)(i-t);return r.set(e.subarray(t,i)),r},As=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8},Ls=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8,e[r+2]|=i>>>16},Ds=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new vs(0),0];if(1==s){var o=new vs(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[c].f<i[h].f?c++:h++],l=i[c!=u&&i[c].f<i[h].f?c++:h++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(r=1;r<s;++r)n[r].s>d&&(d=n[r].s);var p=new gs(d+1),v=Ns(i[u-1],p,0);if(v>t){r=0;var g=0,_=v-t,f=1<<_;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<s;++r){var m=n[r].s;if(!(p[m]>t))break;g+=f-(1<<v-p[m]),p[m]=t}for(g>>>=_;g>0;){var y=n[r].s;p[y]<t?g-=1<<t-p[y]++-1:++r}for(;r>=0&&g;--r){var b=n[r].s;p[b]==t&&(--p[b],++g)}v=t}return[new vs(p),v]},Ns=function(e,t,i){return-1==e.s?Math.max(Ns(e.l,t,i+1),Ns(e.r,t,i+1)):t[e.s]=i},js=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new gs(++t),r=0,s=e[0],n=1,o=function(e){i[r++]=e},a=1;a<=t;++a)if(e[a]==s&&a!=t)++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=e[a]}return[i.subarray(0,r),t]},Hs=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},qs=function(e,t,i){var r=i.length,s=Ms(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;n<r;++n)e[s+n+4]=i[n];return 8*(s+4+r)},Us=function(e,t,i,r,s,n,o,a,l,c,u){As(t,u++,i),++s[256];for(var h=Ds(s,15),d=h[0],p=h[1],v=Ds(n,15),g=v[0],_=v[1],f=js(d),m=f[0],y=f[1],b=js(g),w=b[0],E=b[1],x=new gs(19),k=0;k<m.length;++k)x[31&m[k]]++;for(k=0;k<w.length;++k)x[31&w[k]]++;for(var S=Ds(x,7),P=S[0],$=S[1],R=19;R>4&&!P[ys[R-1]];--R);var I,C,F,T,M=c+5<<3,O=Hs(s,Is)+Hs(n,Cs)+o,A=Hs(s,d)+Hs(n,g)+o+14+3*R+Hs(x,P)+(2*x[16]+3*x[17]+7*x[18]);if(M<=O&&M<=A)return qs(t,u,e.subarray(l,l+c));if(As(t,u,1+(A<O)),u+=2,A<O){I=Rs(d,p,0),C=d,F=Rs(g,_,0),T=g;var L=Rs(P,$,0);for(As(t,u,y-257),As(t,u+5,E-1),As(t,u+10,R-4),u+=14,k=0;k<R;++k)As(t,u+3*k,P[ys[k]]);u+=3*R;for(var D=[m,w],N=0;N<2;++N){var j=D[N];for(k=0;k<j.length;++k){var H=31&j[k];As(t,u,L[H]),u+=P[H],H>15&&(As(t,u,j[k]>>>5&127),u+=j[k]>>>12)}}}else I=Fs,C=Is,F=Ts,T=Cs;for(k=0;k<a;++k)if(r[k]>255){H=r[k]>>>18&31,Ls(t,u,I[H+257]),u+=C[H+257],H>7&&(As(t,u,r[k]>>>23&31),u+=fs[H]);var q=31&r[k];Ls(t,u,F[q]),u+=T[q],q>3&&(Ls(t,u,r[k]>>>5&8191),u+=ms[q])}else Ls(t,u,I[r[k]]),u+=C[r[k]];return Ls(t,u,I[256]),u+C[256]},Vs=new _s([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Bs=function(){for(var e=new _s(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Gs=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};var Ws=!!d||!!h,zs="text/plain",Ys=function(e,t,i){var r;void 0===i&&(i=!0);var[s,n]=e.split("?"),o=y({},t),a=null!==(r=null==n?void 0:n.split("&").map(e=>{var t,[r,s]=e.split("="),n=i&&null!==(t=o[r])&&void 0!==t?t:s;return delete o[r],r+"="+n}))&&void 0!==r?r:[],l=function(e,t){var i,r;void 0===t&&(t="&");var s=[];return Rt(e,function(e,t){A(e)||A(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),s[s.length]=r+"="+i)}),s.join(t)}(o);return l&&a.push(l),s+"?"+a.join("&")},Xs=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),Ks=e=>{var{data:t,compression:i}=e;if(t){if(i===ps.GZipJS){var r=function(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=Bs[255&i^t[r]]^i>>>8;e=i},d:function(){return 4294967295^e}}}(),r=e.length;i.p(e);var s,n=function(e,t,i){return function(e,t,i,r,s,n){var o=e.length,a=new vs(r+o+5*(1+Math.floor(o/7e3))+8),l=a.subarray(r,a.length-8),c=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var h=u+65535;h<o?c=qs(l,c,e.subarray(u,h)):(l[u]=n,c=qs(l,c,e.subarray(u,o)))}else{for(var d=Vs[t-1],p=d>>>13,v=8191&d,g=(1<<i)-1,_=new gs(32768),f=new gs(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new _s(25e3),E=new gs(288),x=new gs(32),k=0,S=0,P=(u=0,0),$=0,R=0;u<o;++u){var I=b(u),C=32767&u,F=f[I];if(_[C]=F,f[I]=C,$<=u){var T=o-u;if((k>7e3||P>24576)&&T>423){c=Us(e,l,0,w,E,x,S,P,R,u-R,c),P=k=S=0,R=u;for(var M=0;M<286;++M)E[M]=0;for(M=0;M<30;++M)x[M]=0}var O=2,A=0,L=v,D=C-F&32767;if(T>2&&I==b(u-D))for(var N=Math.min(p,T)-1,j=Math.min(32767,u),H=Math.min(258,T);D<=j&&--L&&C!=F;){if(e[u+O]==e[u+O-D]){for(var q=0;q<H&&e[u+q]==e[u+q-D];++q);if(q>O){if(O=q,A=D,q>N)break;var U=Math.min(D,q-2),V=0;for(M=0;M<U;++M){var B=u-D+M+32768&32767,G=B-_[B]+32768&32767;G>V&&(V=G,F=B)}}}D+=(C=F)-(F=_[C])+32768&32767}if(A){w[P++]=268435456|xs[O]<<18|ks[A];var W=31&xs[O],z=31&ks[A];S+=fs[W]+ms[z],++E[257+W],++x[z],$=u+O,++k}else w[P++]=e[u],++E[e[u]]}}c=Us(e,l,n,w,E,x,S,P,R,u-R,c)}return Os(a,0,r+Ms(c)+8)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,i,0,!0)}(e,t,10+((s=t).filename&&s.filename.length+1||0)),o=n.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Gs(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}}(n,t),Gs(n,o-8,i.d()),Gs(n,o-4,r),n}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new vs(e.length+(e.length>>>1)),r=0,s=function(e){i[r++]=e},n=0;n<t;++n){if(r+5>i.length){var o=new vs(r+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);a<128?s(a):a<2048?(s(192|a>>>6),s(128|63&a)):a>55295&&a<57344?(s(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return Os(i,0,r)}(Xs(t)),{mtime:0}),s=new Blob([r],{type:zs});return{contentType:zs,body:s,estimatedSize:s.size}}if(i===ps.Base64){var n=function(e){var t,i,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,c="",u=[];if(!e)return e;e=function(e){var t,i,r,s,n="";for(t=i=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=e.charCodeAt(s),a=null;o<128?i++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),N(a)||(i>t&&(n+=e.substring(t,i)),n+=a,t=i=s+1)}return i>t&&(n+=e.substring(t,e.length)),n}(e);do{t=(n=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,i=n>>12&63,r=n>>6&63,s=63&n,u[l++]=o.charAt(t)+o.charAt(i)+o.charAt(r)+o.charAt(s)}while(a<e.length);switch(c=u.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}(Xs(t)),o=(e=>"data="+encodeURIComponent("string"==typeof e?e:Xs(e)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Xs(t);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Js=[];h&&Js.push({transport:"fetch",method:e=>{var t,i,{contentType:r,body:s,estimatedSize:n}=null!==(t=Ks(e))&&void 0!==t?t:{},o=new Headers;Rt(e.headers,function(e,t){o.append(t,e)}),r&&o.append("Content-Type",r);var a=e.url,l=null;if(p){var c=new p;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),e.timeout)}}h(a,y({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&(n||0)<52428.8,body:s,signal:null==(i=l)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){Et.error(e)}null==e.callback||e.callback(r)})).catch(t=>{Et.error(t),null==e.callback||e.callback({statusCode:0,text:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),d&&Js.push({transport:"XHR",method:e=>{var t,i=new d;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=null!==(t=Ks(e))&&void 0!==t?t:{};Rt(e.headers,function(e,t){i.setRequestHeader(t,e)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(s)}}),null!=l&&l.sendBeacon&&Js.push({transport:"sendBeacon",method:e=>{var t=Ys(e.url,{beacon:"1"});try{var i,{contentType:r,body:s}=null!==(i=Ks(e))&&void 0!==i?i:{},n="string"==typeof s?new Blob([s],{type:r}):s;l.sendBeacon(t,n)}catch(e){}}});var Zs=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function Qs(e,t,i){return Xs({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var en={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>Zs(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Zs(t,e))),icontains:(e,t)=>t.map(tn).some(t=>e.map(tn).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(tn).every(t=>e.map(tn).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},tn=e=>e.toLowerCase();function rn(e,t){return!e||Object.entries(e).every(e=>{var[i,r]=e,s=null==t?void 0:t[i];if(A(s)||N(s))return!1;var n=[String(s)],o=en[r.operator];return!!o&&o(r.values,n)})}var sn=xt("[Error tracking]");class nn{constructor(e){var t,i;this.Zt=[],this.ti=new Ze([new ut,new bt,new dt,new ht,new mt,new ft,new vt,new yt],function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return function(t,r){void 0===r&&(r=0);for(var s=[],n=t.split("\n"),o=r;o<n.length;o++){var a=n[o];if(!(a.length>1024)){var l=ct.test(a)?a.replace(ct,"$1"):a;if(!l.match(/\S*Error: /)){for(var c of i){var u=c(l,e);if(u){s.push(u);break}}if(s.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return y({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||Qe});var i})}(s)}}("web:javascript",nt,lt)),this._instance=e,this.Zt=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(Gt))&&void 0!==t?t:[]}onRemoteConfig(e){var t,i,r,s=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this.Zt=s,this._instance.persistence&&this._instance.persistence.register({[Gt]:this.Zt,[Wt]:n})}get ii(){var e,t=!!this._instance.get_property(Wt),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void sn.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void sn.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void sn.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:r}=t;return L(i)&&i.length>0&&e.$exception_types.push(i),L(r)&&r.length>0&&e.$exception_values.push(r),e},{$exception_types:[],$exception_values:[]});return this.Zt.some(e=>{var i=e.values.map(e=>{var i,r=en[e.operator],s=F(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}si(e){return e.flatMap(e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}ni(e){if(e.length>0){var t,i,r,s,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}ei(e){return!j(e)&&F(e)}}var on=xt("[FeatureFlags]"),an=xt("[FeatureFlags]",{debugEnabled:!0}),ln="$active_feature_flags",cn="$override_feature_flags",un="$feature_flag_payloads",hn="$override_feature_flag_payloads",dn="$feature_flag_request_id",pn="$feature_flag_evaluated_at",vn=e=>{var t={};for(var[i,r]of Ft(e||{}))r&&(t[i]=r);return t},gn=function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e}({});class _n{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this._instance=e,this.featureFlagEventHandlers=[]}ci(){var e=this._instance.config.evaluation_environments;return null!=e&&e.length?e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||on.error("Invalid evaluation environment found:",e,"Expected non-empty string"),t}):[]}fi(){return this.ci().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.pi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.gi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(ii),t=this._instance.get_property(cn),i=this._instance.get_property(hn);if(!i&&!t)return e||{};var r=It({},e||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var n of s){var o,a,l=r[n],c=null==t?void 0:t[n],u=A(c)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!c,h=A(c)?l.variant:"string"==typeof c?c:void 0,d=null==i?void 0:i[n],p=y({},l,{enabled:u,variant:u?null!=h?h:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),h!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),d&&(p.metadata=y({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=p}return this.oi||(on.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.oi=!0),r}getFlagVariants(){var e=this._instance.get_property(ei),t=this._instance.get_property(cn);if(!t)return e||{};for(var i=It({},e),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this.oi||(on.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.oi=!0),i}getFlagPayloads(){var e=this._instance.get_property(un),t=this._instance.get_property(hn);if(!t)return e||{};for(var i=It({},e||{}),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this.oi||(on.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.oi=!0),i}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.pi||(this.pi=setTimeout(()=>{this.gi()},5))}mi(){clearTimeout(this.pi),this.pi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.pi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}gi(e){var t;if(this.mi(),!this._instance.O())if(this.li)this.hi=!0;else{var i=this._instance.config.token,r=this._instance.get_property("$device_id"),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:y({},(null==(t=this._instance.persistence)?void 0:t.get_initial_props())||{},this._instance.get_property(ri)||{}),group_properties:this._instance.get_property(si)};N(r)||A(r)||(s.$device_id=r),(null!=e&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.fi()&&(s.evaluation_environments=this.ci());var n=this._instance.config.__preview_remote_config,o=n?"/flags/?v=2":"/flags/?v=2&config=true",a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",l=this._instance.requestRouter.endpointFor("flags",o+a);n&&(s.timezone=is()),this.li=!0,this._instance._send_request({method:"POST",url:l,data:s,compression:this._instance.config.disable_compression?void 0:ps.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,i,r=!0;if(200===e.statusCode&&(this.hi||(this.$anon_distinct_id=void 0),r=!1),this.li=!1,this.di||(this.di=!0,this._instance.yi(null!==(i=e.json)&&void 0!==i?i:{})),!s.disable_flags||this.hi)if(this.vi=!r,e.json&&null!=(t=e.json.quotaLimited)&&t.includes(gn.FeatureFlags))on.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var n;s.disable_flags||this.receivedFeatureFlags(null!==(n=e.json)&&void 0!==n?n:{},r),this.hi&&(this.hi=!1,this.gi())}}})}}getFeatureFlag(e,t){if(void 0===t&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],r=""+i,s=this._instance.get_property(dn)||void 0,n=this._instance.get_property(pn)||void 0,o=this._instance.get_property(oi)||{};if((t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(r))){var a,l,c,u,h,d,p,v,g;F(o[e])?o[e].push(r):o[e]=[r],null==(a=this._instance.persistence)||a.register({[oi]:o});var _=this.getFeatureFlagDetails(e),f={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:n,$feature_flag_bootstrapped_response:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlags)?void 0:l[e])||null,$feature_flag_bootstrapped_payload:(null==(c=this._instance.config.bootstrap)||null==(c=c.featureFlagPayloads)?void 0:c[e])||null,$used_bootstrap_value:!this.vi};A(null==_||null==(u=_.metadata)?void 0:u.version)||(f.$feature_flag_version=_.metadata.version);var m,y=null!==(h=null==_||null==(d=_.reason)?void 0:d.description)&&void 0!==h?h:null==_||null==(p=_.reason)?void 0:p.code;y&&(f.$feature_flag_reason=y),null!=_&&null!=(v=_.metadata)&&v.id&&(f.$feature_flag_id=_.metadata.id),A(null==_?void 0:_.original_variant)&&A(null==_?void 0:_.original_enabled)||(f.$feature_flag_original_response=A(_.original_variant)?_.original_enabled:_.original_variant),null!=_&&null!=(g=_.metadata)&&g.original_payload&&(f.$feature_flag_original_payload=null==_||null==(m=_.metadata)?void 0:m.original_payload),this._instance.capture("$feature_flag_called",f)}return i}on.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.fi()&&(r.evaluation_environments=this.ci()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:ps.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:i=>{var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==s?void 0:s[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return A(i)?void 0:!!i}on.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ai=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(e,t,i,r,s){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var n=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(e=>t[e].enabled).filter(e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload}).map(e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]}))):on.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var c=e.requestId,u=e.evaluatedAt;if(F(a)){on.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var h={};if(a)for(var d=0;d<a.length;d++)h[a[d]]=!0;t&&t.register({[ln]:a,[ei]:h})}else{var p=a,v=l,g=o;e.errorsWhileComputingFlags&&(p=y({},i,p),v=y({},r,v),g=y({},s,g)),t&&t.register(y({[ln]:Object.keys(vn(p)),[ei]:p||{},[un]:v||{},[ii]:g||{}},c?{[dn]:c}:{},u?{[pn]:u}:{}))}}}(e,this._instance.persistence,i,r,s),this.bi(t)}}override(e,t){void 0===t&&(t=!1),on.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return on.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._instance.persistence.unregister(cn),this._instance.persistence.unregister(hn),this.bi(),an.info("All overrides cleared");if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,i=e;if(this.oi=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t),"flags"in i)if(!1===i.flags)this._instance.persistence.unregister(cn),an.info("Flag overrides cleared");else if(i.flags){if(F(i.flags)){for(var r={},s=0;s<i.flags.length;s++)r[i.flags[s]]=!0;this._instance.persistence.register({[cn]:r})}else this._instance.persistence.register({[cn]:i.flags});an.info("Flag overrides set",{flags:i.flags})}return"payloads"in i&&(!1===i.payloads?(this._instance.persistence.unregister(hn),an.info("Payload overrides cleared")):i.payloads&&(this._instance.persistence.register({[hn]:i.payloads}),an.info("Payload overrides set",{payloads:i.payloads}))),void this.bi()}this.bi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:i}=this.wi();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,s=(this._instance.get_property(ti)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=y({},this.getFlagVariants(),{[e]:t});null==(r=this._instance.persistence)||r.register({[ln]:Object.keys(vn(a)),[ei]:a}),this.bi()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this._instance.get_property(ti),s=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:t=>{var i,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(i=this._instance.persistence)||i.unregister(ti),null==(r=this._instance.persistence)||r.register({[ti]:s}),e(s)}}})}wi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}bi(e){var{flags:t,flagVariants:i}=this.wi();this.featureFlagEventHandlers.forEach(r=>r(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(ri)||{};this._instance.register({[ri]:y({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ri)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(si)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=y({},i[t],e[t]),delete e[t]}),this._instance.register({[si]:y({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(si)||{};this._instance.register({[si]:y({},t,{[e]:{}})})}else this._instance.unregister(si)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.mi(),this.oi=!1}}var fn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class mn{constructor(e,t){this.R=e,this.props={},this.xi=!1,this.Ei=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.Y=this.$i(e),this.load(),e.debug&&Et.info("Persistence loaded",e.persistence,y({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.Si}$i(e){-1===fn.indexOf(e.persistence.toLowerCase())&&(Et.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...mr,...e];return y({},fr,{W:function(e){try{var t={};try{t=gr.W(e)||{}}catch(e){}var i=It(t,JSON.parse(fr.q(e)||"{}"));return fr.G(e,i),i}catch(e){}return null},G:function(e,i,r,s,n,o){try{fr.G(e,i,void 0,void 0,o);var a={};t.forEach(e=>{i[e]&&(a[e]=i[e])}),Object.keys(a).length&&gr.G(e,a,r,s,n,o)}catch(e){fr.B(e)}},V:function(e,t){try{null==r||r.localStorage.removeItem(e),gr.V(e,t)}catch(e){fr.B(e)}}})}(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return"localstorage"===i&&fr.H()?fr:"localstorage+cookie"===i&&t.H()?t:"sessionstorage"===i&&Er.H()?Er:"memory"===i?br:"cookie"===i?gr:t.H()?t:gr}properties(){var e={};return Rt(this.props,function(t,i){if(i===ei&&M(t))for(var r=Object.keys(t),s=0;s<r.length;s++)e["$feature/"+r[s]]=t[r[s]];else o=i,l=!1,(N(n=_i)?l:a&&n.indexOf===a?-1!=n.indexOf(o):(Rt(n,function(e){if(l||(l=e===o))return Pt}),l))||(e[i]=t);var n,o,l}),e}load(){if(!this.Si){var e=this.Y.W(this.Ei);e&&(this.props=It({},e))}}save(){this.Si||this.Y.G(this.Ei,this.props,this.ki,this.Pi,this.Ti,this.R.debug)}remove(){this.Y.V(this.Ei,!1),this.Y.V(this.Ei,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(M(e)){A(t)&&(t="None"),this.ki=A(i)?this.Ii:i;var r=!1;if(Rt(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(M(e)){this.ki=A(t)?this.Ii:t;var i=!1;if(Rt(e,(t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.xi){var e=Xr(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);O(Ot(e))||this.register(e),this.xi=!0}}update_search_keyword(){var e;this.register((e=null==c?void 0:c.referrer)?Jr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Qr(),$referring_domain:null!=c&&c.referrer&&(null==(e=Ki(c.referrer))?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[ui]||this.props[hi]||this.register_once({[di]:es(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Rt([hi,ui],t=>{var i=this.props[t];i&&Rt(i,function(t,i){e["$initial_"+P(i)]=t})});var t,i,r=this.props[di];if(r){var s=(t=ts(r),i={},Rt(t,function(e,t){i["$initial_"+P(t)]=e}),i);It(e,s)}return e}safe_merge(e){return Rt(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.Ii=this.ki=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),r=[...t].sort();return i.every((e,t)=>e===r[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.$i(e),s=this.props;this.clear(),this.Y=r,this.props=s,this.save()}}set_disabled(e){this.Si=e,this.Si?this.remove():this.save()}set_cross_subdomain(e){e!==this.Pi&&(this.Pi=e,this.remove(),this.save())}set_secure(e){e!==this.Ti&&(this.Ti=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[qt]||{};i[e]=t,this.props[qt]=i,this.save()}remove_event_timer(e){var t=(this.props[qt]||{})[e];return A(t)||(delete this.props[qt][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var yn=xt("[Product Tours]"),bn="ph_product_tours";class wn{constructor(e){this.Ci=null,this.Ri=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[Xt]:!(null==e||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Ci||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(Xt)||this.it(()=>this.Fi())}it(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?yn.error("Could not load product tours script",t):e()})}Fi(){var e;!this.Ci&&null!=(e=g.__PosthogExtensions__)&&e.generateProductTours&&(this.Ci=g.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!F(this.Ri)||t){var i=this._instance.persistence;if(i){var r=i.props[bn];if(F(r)&&!t)return this.Ri=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{var r=t.statusCode;if(200!==r||!t.json){var s="Product Tours API could not be loaded, status: "+r;return yn.error(s),void e([],{isLoaded:!1,error:s})}var n=F(t.json.product_tours)?t.json.product_tours:[];this.Ri=n,i&&i.register({[bn]:n}),e(n,{isLoaded:!0})}})}else e(this.Ri,{isLoaded:!0})}getActiveProductTours(e){j(this.Ci)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ci.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.Ci)||t.showTourById(e)}previewTour(e){this.Ci?this.Ci.previewTour(e):this.it(()=>{var t;this.Fi(),null==(t=this.Ci)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.Ci)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.Ci)||e.nextStep()}previousStep(){var e;null==(e=this.Ci)||e.previousStep()}clearCache(){var e;this.Ri=null,null==(e=this._instance.persistence)||e.unregister(bn)}resetTour(e){var t;null==(t=this.Ci)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.Ci)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.Ci)||t.cancelPendingTour(e)}}var En=function(e){return e.Activation="events",e.Cancellation="cancelEvents",e}({}),xn=function(e){return e.Button="button",e.Tab="tab",e.Selector="selector",e}({}),kn=function(e){return e.TopLeft="top_left",e.TopRight="top_right",e.TopCenter="top_center",e.MiddleLeft="middle_left",e.MiddleRight="middle_right",e.MiddleCenter="middle_center",e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger",e}({}),Sn=function(e){return e.Top="top",e.Left="left",e.Right="right",e.Bottom="bottom",e}({}),Pn=function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e}({}),$n=function(e){return e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link",e}({}),Rn=function(e){return e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question",e}({}),In=function(e){return e.Once="once",e.Recurring="recurring",e.Always="always",e}({}),Cn=function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e.ABANDONED="survey abandoned",e}({}),Fn=function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e.PRODUCT_TOUR_ID="$product_tour_id",e.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",e}({}),Tn=function(e){return e.Popover="popover",e.Inline="inline",e}({}),Mn=xt("[Surveys]"),On="seenSurvey_",An=(e,t)=>{var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i},Ln=e=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})(On,e),Dn=[Pn.Popover,Pn.Widget,Pn.API],Nn={ignoreConditions:!1,ignoreDelay:!1,displayType:Tn.Popover};class jn{constructor(){this.Mi={},this.Mi={}}on(e,t){return this.Mi[e]||(this.Mi[e]=[]),this.Mi[e].push(t),()=>{this.Mi[e]=this.Mi[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.Mi[e]||[])i(t);for(var r of this.Mi["*"]||[])r(e,t)}}function Hn(e,t,i){if(j(e))return!1;switch(i){case"exact":return e===t;case"contains":var r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class qn{constructor(e){this.Oi=new jn,this.Ai=(e,t)=>this.Di(e,t)&&this.ji(e,t)&&this.Li(e,t)&&this.Ni(e,t),this.Di=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.Ui=new Set,this.zi=new Set}init(){var e,t;A(null==(e=this._instance)?void 0:e.Hi)||null==(t=this._instance)||t.Hi((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!A(null==(t=this._instance)?void 0:t.Hi)&&(e.forEach(e=>{var t,i;null==(t=this.zi)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.Ui)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)})}),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(e,t){var i;null!=t&&0!=e.length&&(this.Ui.has(e)||this.Ui.has(null==t?void 0:t.event))&&this.zi&&(null==(i=this.zi)?void 0:i.size)>0&&this.zi.forEach(e=>{this.Bi(t,e)&&this.Oi.emit("actionCaptured",e.name)})}qi(e){this.onAction("actionCaptured",t=>e(t))}Bi(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.Ai(e,i))return!0;return!1}onAction(e,t){return this.Oi.on(e,t)}ji(e,t){if(null!=t&&t.url){var i,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Hn(r,t.url,t.url_matching||"contains"))return!1}return!0}Li(e,t){return!!this.Wi(e,t)&&!!this.Gi(e,t)&&!!this.Vi(e,t)}Wi(e,t){var i;if(null==t||!t.href)return!0;var r=this.Ji(e);if(r.length>0)return r.some(e=>Hn(e.href,t.href,t.href_matching||"exact"));var s,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&Hn((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}Gi(e,t){var i;if(null==t||!t.text)return!0;var r=this.Ji(e);if(r.length>0)return r.some(e=>Hn(e.text,t.text,t.text_matching||"exact")||Hn(e.$el_text,t.text,t.text_matching||"exact"));var s,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(e){for(var t,i=[],r=/(?::|")text="(.*?)"/g;!j(t=r.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",s.some(e=>Hn(e,n,o)))}Vi(e,t){var i,r;if(null==t||!t.selector)return!0;var s=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(t.selector))return!0;var n=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){return!1}return!1}Ji(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}Ni(e,t){return null==t||!t.properties||0===t.properties.length||rn(t.properties.reduce((e,t)=>{var i=F(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class Un{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&rn(e.propertyFilters,null==t?void 0:t.properties)}Zi(e,t){var i=new Map;return e.forEach(e=>{var r;null==(r=e.conditions)||null==(r=r[t])||null==(r=r.values)||r.forEach(t=>{if(null!=t&&t.name){var r=i.get(t.name)||[];r.push(e.id),i.set(t.name,r)}})}),i}te(e,t,i){var r=(i===En.Activation?this.Ki:this.Yi).get(e),s=[];return this.ie(e=>{s=e.filter(e=>null==r?void 0:r.includes(e.id))}),s.filter(r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find(t=>t.name===e);return this.Qi(n,t)})}register(e){var t;A(null==(t=this._instance)?void 0:t.Hi)||(this.ee(e),this.re(e))}re(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.se&&(this.se=new qn(this._instance),this.se.init(),this.se.qi(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,r,s,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.se)||s.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var i=this.Xi.get(t.name);i&&i.push(e.id),this.Xi.set(t.name,i||[e.id])}}))}))}ee(e){var t,i=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0});0===i.length&&0===r.length||(null==(t=this._instance)||t.Hi((e,t)=>{this.onEvent(e,t)}),this.Ki=this.Zi(e,En.Activation),this.Yi=this.Zi(e,En.Cancellation))}onEvent(e,t){var i,r=this.ne(),s=this.oe(),n=this.ae(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===e&&t&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var c=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(c){var u=o.indexOf(c);u>=0&&(o.splice(u,1),this.le(o))}}else{if(this.Yi.has(e)){var h=this.te(e,t,En.Cancellation);h.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(e=>e.id)}),h.forEach(e=>{var t=o.indexOf(e.id);t>=0&&o.splice(t,1),this.ue(e.id)}),this.le(o))}if(this.Ki.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Ki.get(e)});var d=this.te(e,t,En.Activation);this.le(o.concat(d.map(e=>e.id)||[]))}}}onAction(e){var t,i=this.oe(),r=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this.Xi.has(e)&&this.le(r.concat(this.Xi.get(e)||[]))}le(e){var t,i=this.ne(),r=this.oe(),s=[...new Set(e)].filter(e=>!this.he(e));i.info("updating activated items",{activatedItems:s}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[r]:s})}getActivatedIds(){var e,t=this.oe();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}}class Vn extends Un{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return Cn.SHOWN}ie(e){var t;null==(t=this._instance)||t.getSurveys(e)}ue(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}ne(){return Mn}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class Bn{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(j(t))return Mn.warn("Flags not loaded yet. Not loading surveys.");var i=F(t);this.ve=i?t.length>0:t,Mn.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(On)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)Mn.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Mn.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Mn.info("Not loading surveys in cookieless mode without consent.");else{var e=null==g?void 0:g.__PosthogExtensions__;if(e){if(!A(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var i=e.generateSurveys;if(i)return void this.ge(i,t);var r=e.loadExternalDependency;if(!r)return void this._e("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",i=>{i||!e.generateSurveys?this._e("Could not load surveys script",i):this.ge(e.generateSurveys,t)})}catch(e){throw this._e("Error initializing surveys",e),e}finally{this.ce=!1}}}else Mn.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Vn(this._instance),Mn.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){Mn.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this._instance.config.disable_surveys)return Mn.info("Disabled. Not loading surveys."),e([]);var i,r=this._instance.get_property(ni);if(r&&!t)return e(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.pe?this.pe.then(t=>{var{surveys:i,context:r}=t;return e(i,r)}):("undefined"!=typeof Promise&&(this.pe=new Promise(e=>{i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var r;this.pe=null;var s=t.statusCode;if(200!==s||!t.json){var n="Surveys API could not be loaded, status: "+s;Mn.error(n);var o={isLoaded:!1,error:n};return e([],o),void(null==i||i({surveys:[],context:o}))}var a,l=t.json.surveys||[],c=l.filter(e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e)));c.length>0&&(null==(a=this._surveyEventReceiver)||a.register(c)),null==(r=this._instance.persistence)||r.register({[ni]:l});var u={isLoaded:!0};e(l,u),null==i||i({surveys:l,context:u})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){Mn.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!j(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Mn.warn("init was not called")}ye(e){var t=null;return this.getSurveys(i=>{var r;t=null!==(r=i.find(t=>t.id===e))&&void 0!==r?r:null}),t}be(e){if(j(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t="string"==typeof e?this.ye(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(j(this._surveyManager))return Mn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.be(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return j(this._surveyManager)?(Mn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(i=>{this.getSurveys(t=>{var r,s=null!==(r=t.find(t=>t.id===e))&&void 0!==r?r:null;if(s){var n=this.be(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var r;if(j(this._surveyManager))Mn.warn("init was not called");else{var s="string"==typeof e?this.ye(e):e;if(null!=s&&s.id)if(Dn.includes(s.type)){var n=null==c?void 0:c.querySelector(t);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(Mn.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;Mn.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(s,n,i),Mn.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);Mn.warn("Survey element not found")}else Mn.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Mn.warn("Survey not found")}}displaySurvey(e,t){var i;if(j(this._surveyManager))Mn.warn("init was not called");else{var r=this.ye(e);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=y({},r,{appearance:y({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===t.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void Mn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==Tn.Inline?this._surveyManager.handlePopoverSurvey(s,t.properties):this.renderSurvey(s,t.selector,t.properties)}else Mn.warn("Survey not found")}}cancelPendingSurvey(e){j(this._surveyManager)?Mn.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}var Gn=xt("[Conversations]");class Wn{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;j(t)||(U(t)?this.we=t:(this.we=t.enabled,this.Ee=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.we=void 0,this.Ee=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==g?void 0:g.__PosthogExtensions__;if(e&&!A(this.we)&&this.we)if(this.Ee&&this.Ee.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.$e(t),void(this.xe=!1);var i=e.loadExternalDependency;if(!i)return void this.Se("PostHog loadExternalDependency extension not found.");i(this._instance,"conversations",t=>{t||!e.initConversations?this.Se("Could not load conversations script",t):this.$e(e.initConversations),this.xe=!1})}catch(e){this.Se("Error initializing conversations",e),this.xe=!1}}else Gn.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),Gn.info("Conversations loaded successfully")}catch(e){this.Se("Error completing conversations initialization",e)}else Gn.error("Cannot complete initialization: remote config is null")}Se(e,t){Gn.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():Gn.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.we&&!N(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var r=this;return m(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,i):(Gn.warn("Conversations not available yet."),null)})()}getMessages(e,t){var i=this;return m(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Gn.warn("Conversations not available yet."),null)})()}markAsRead(e){var t=this;return m(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Gn.warn("Conversations not available yet."),null)})()}getTickets(e){var t=this;return m(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Gn.warn("Conversations not available yet."),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}}class zn{constructor(e){var t;this.ke=!1,this.Pe=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.ke=!0)}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!j(i)&&i&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=xt("[logs]"),t=null==g?void 0:g.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",i=>{var r;i||null==(r=t.logs)||!r.initializeLogs?e.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.Pe=!0)}):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}}var Yn=xt("[RateLimiter]");class Xn{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Yn.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Yn.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.captureEventsPerSecond=(null==(t=e.config.rate_limiting)?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(i=e.config.rate_limiting)?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,r;void 0===e&&(e=!1);var s=(new Date).getTime(),n=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(ci))&&void 0!==t?t:{tokens:this.captureEventsBurstLimit,last:s};n.tokens+=(s-n.last)/1e3*this.captureEventsPerSecond,n.last=s,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var o=n.tokens<1;return o||e||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,null==(r=this.instance.persistence)||r.set_property(ci,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Kn=xt("[RemoteConfig]");class Jn{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=g._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}Te(e){var t,i;null!=(t=g.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(Kn.error("PostHog Extensions not found. Cannot load remote config."),e())}Ie(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Kn.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.O())return void Kn.warn("Remote config is disabled. Falling back to local config.");this.Te(e=>{if(!e)return Kn.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ie(e=>{this.yi(e)});this.yi(e)})}catch(e){Kn.error("Error loading remote config",e)}}yi(e){e?this._instance.config.__preview_remote_config?(this._instance.yi(e),!1!==e.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Kn.info("__preview_remote_config is disabled. Logging config instead",e):Kn.error("Failed to fetch remote config from PostHog.")}}var Zn=3e3;class Qn{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=K((null==t?void 0:t.flush_interval_ms)||Zn,250,5e3,Et.createLogger("flush interval"),Zn),this.Me=e}enqueue(e){this.Re.push(e),this.Oe||this.Ae()}unload(){this.De();var e=this.Re.length>0?this.je():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Me(y({},e,{transport:"sendBeacon"}))})}enable(){this.Ce=!1,this.Ae()}Ae(){var e=this;this.Ce||(this.Oe=setTimeout(()=>{if(this.De(),this.Re.length>0){var t=this.je(),i=function(){var i=t[r],s=(new Date).getTime();i.data&&F(i.data)&&Rt(i.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),e.Me(i)};for(var r in t)i()}},this.Fe))}De(){clearTimeout(this.Oe),this.Oe=void 0}je(){var e={};return Rt(this.Re,t=>{var i,r=t,s=(r?r.batchKey:null)||r.url;A(e[s])&&(e[s]=y({},r,{data:[]})),null==(i=e[s].data)||i.push(r.data)}),this.Re=[],e}}var eo=["retriesPerformedSoFar"];class to{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!A(r)&&"onLine"in r.navigator&&(this.Ue=r.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},Nt(r,"online",this.ze),Nt(r,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=b(e,eo);q(t)&&(i.url=Ys(i.url,{retry_count:t})),this._instance._send_request(y({},i,{callback:e=>{200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this.Be(y({retriesPerformedSoFar:t},i)):null==i.callback||i.callback(e)}}))}Be(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,r=Math.min(18e5,t),s=(Math.random()-.5)*(r-i);return Math.ceil(r+s)}(t),r=Date.now()+i;this.Re.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Et.warn(s),this.Le||(this.Le=!0,this.qe())}qe(){if(this.We&&clearTimeout(this.We),0===this.Re.length)return this.Le=!1,void(this.We=void 0);this.We=setTimeout(()=>{this.Ue&&this.Re.length>0&&this.Lt(),this.qe()},this.Ne)}Lt(){var e=Date.now(),t=[],i=this.Re.filter(i=>i.retryAt<e||(t.push(i),!1));if(this.Re=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.We&&(clearTimeout(this.We),this.We=void 0),this.Le=!1,A(r)||(this.ze&&(r.removeEventListener("online",this.ze),this.ze=void 0),this.He&&(r.removeEventListener("offline",this.He),this.He=void 0)),this.Re))try{this._instance._send_request(y({},e,{transport:"sendBeacon"}))}catch(e){Et.error(e)}this.Re=[]}}class io{constructor(e){this.Ge=()=>{var e,t,i,r;this.Ve||(this.Ve={});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.Ve.lastScrollY=Math.ceil(n),this.Ve.maxScrollY=Math.max(n,null!==(e=this.Ve.maxScrollY)&&void 0!==e?e:0),this.Ve.maxScrollHeight=Math.max(o,null!==(t=this.Ve.maxScrollHeight)&&void 0!==t?t:0),this.Ve.lastContentY=a,this.Ve.maxContentY=Math.max(a,null!==(i=this.Ve.maxContentY)&&void 0!==i?i:0),this.Ve.maxContentHeight=Math.max(l,null!==(r=this.Ve.maxContentHeight)&&void 0!==r?r:0)},this._instance=e}getContext(){return this.Ve}resetContext(){var e=this.Ve;return setTimeout(this.Ge,0),e}startMeasuringScrollPosition(){Nt(r,"scroll",this.Ge,{capture:!0}),Nt(r,"scrollend",this.Ge,{capture:!0}),Nt(r,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==r?void 0:r.document.documentElement;var e=F(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=null==r?void 0:r.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return r&&(r.scrollY||r.pageYOffset||r.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return r&&(r.scrollX||r.pageXOffset||r.document.documentElement.scrollLeft)||0}}var ro=e=>es(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class so{constructor(e,t,i,r){this.Je=e=>{var t=this.Ke();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.Ye(this._instance)};this.Xe.register({[li]:i})}},this._instance=e,this.Qe=t,this.Xe=i,this.Ye=r||ro,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[li]}getSetOnceProps(){var e,t=null==(e=this.Ke())?void 0:e.props;return t?"r"in t?ts(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Rt(Ot(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+P(i)]=t}),e}}var no=xt("[SessionId]");class oo{on(e,t){return this.Ze.on(e,t)}constructor(e,t,i){var r;if(this.tr=[],this.ir=void 0,this.Ze=new jn,this.er=(e,t)=>!(!q(e)||!q(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Xe=e.persistence,this.rr=void 0,this.sr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.nr=t||hr,this.ar=i||hr;var s=this.R.persistence_name||this.R.token,n=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*K(n,60,36e3,no.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+s+"_window_id",this.hr="ph_"+s+"_primary_window_exists",this.dr()){var o=Er.W(this.ur),a=Er.W(this.hr);o&&!a?this.rr=o:Er.V(this.ur),Er.G(this.hr,!0)}if(null!=(r=this.R.bootstrap)&&r.sessionID)try{var l=(()=>{var e=this.R.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.vr(this.R.bootstrap.sessionID,(new Date).getTime(),l)}catch(e){no.error("Invalid sessionID in bootstrap",e)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return A(this.tr)&&(this.tr=[]),this.tr.push(e),this.sr&&e(this.sr,this.rr),()=>{this.tr=this.tr.filter(t=>t!==e)}}dr(){return"memory"!==this.R.persistence&&!this.Xe.Si&&Er.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&Er.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?Er.W(this.ur):null}vr(e,t,i){e===this.sr&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.sr=e,this.Xe.register({[Zt]:[t,e,i]}))}_r(){var e=this.Xe.props[Zt];return F(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.vr(null,null,null)}destroy(){clearTimeout(this.mr),this.mr=void 0,this.ir&&r&&(r.removeEventListener("beforeunload",this.ir,{capture:!1}),this.ir=void 0),this.tr=[]}cr(){this.ir=()=>{this.dr()&&Er.V(this.hr)},Nt(r,"beforeunload",this.ir,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),"always"===this.R.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[r,s,n]=this._r(),o=this.gr(),a=q(n)&&Math.abs(i-n)>864e5,l=!1,c=!s,u=!c&&!e&&this.er(i,r);c||u||a?(s=this.nr(),o=this.ar(),no.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.ar(),l=!0);var h=q(r)&&e&&!a?r:i,d=q(n)?n:(new Date).getTime();return this.pr(o),this.vr(s,h,d),e||this.lr(),l&&this.tr.forEach(e=>e(s,o,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0)),{sessionId:s,windowId:o,sessionStartTimestamp:d,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}lr(){clearTimeout(this.mr),this.mr=setTimeout(()=>{var[e]=this._r();if(this.er((new Date).getTime(),e)){var t=this.sr;this.resetSessionId(),this.Ze.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var ao=["$set_once","$set"],lo=xt("[SiteApps]");class co{constructor(e){this._instance=e,this.yr=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}br(e,t){if(t){var i=this.globalsForEvent(t);this.yr.push(i),this.yr.length>1e3&&(this.yr=this.yr.slice(10))}}get siteAppLoaders(){var e;return null==(e=g._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Hi(this.br.bind(this));this.wr=()=>{e(),this.yr=[],this.wr=void 0}}}globalsForEvent(e){var t,i,r,s,n,o,a;if(!e)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(u))l[h]={id:c[h],type:h,properties:d};var{$set_once:p,$set:v}=e;return{event:y({},b(e,ao),{properties:y({},e.properties,v?{$set:y({},null!==(t=null==(i=e.properties)?void 0:i.$set)&&void 0!==t?t:{},v)}:{},p?{$set_once:y({},null!==(r=null==(s=e.properties)?void 0:s.$set_once)&&void 0!==r?r:{},p)}:{}),elements_chain:null!==(n=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.yr.length&&(lo.info("Processing "+this.yr.length+" events for site app with id "+e.id),this.yr.forEach(e=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.wr)||i.call(this))},r=!1,s=s=>{t.errored=!s,t.loaded=!0,lo.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback:e=>{s(e)}});n&&(t.processEvent=n),r=!0}catch(t){lo.error("Error while initializing PostHog app with config id "+e.id,t),s(!1)}if(r&&t.loaded)try{i()}catch(i){lo.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}Er(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}$r(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){lo.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,r,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Er(),void this._instance.on("eventCaptured",e=>this.$r(e))):void lo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.wr)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var n=function(e){var t;g["__$$ph_site_app_"+e]=s._instance,null==(t=g.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,a,t=>{if(t)return lo.error("Error while initializing PostHog app with config id "+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else lo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var uo=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&E(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some(e=>E(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},ho=function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e}({}),po="i.posthog.com";class vo{constructor(e){this.Sr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+po,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Sr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=ho.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=ho.EU:this.Sr[this.apiHost]=ho.CUSTOM),this.Sr[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===ho.CUSTOM)return this.apiHost+t;var i=po+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var go={icontains:(e,t)=>!!r&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!r&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!r&&Zs(t.href,e),not_regex:(e,t)=>!!r&&!Zs(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class _o{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{_o.kr("retrieved web experiments from the server"),t.Pr=new Map,e.forEach(e=>{if(e.feature_flag_key){var i;t.Pr&&(_o.kr("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Pr)||i.set(e.feature_flag_key,e));var r=t._instance.getFeatureFlag(e.feature_flag_key);L(r)&&e.variants[r]&&t.Tr(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var s in e.variants){var n=e.variants[s];_o.Ir(n)&&t.Tr(e.name,s,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}onFeatureFlags(e){if(this._is_bot())_o.kr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(j(this.Pr))return this.Pr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_o.kr("applying feature flags",e),e.forEach(e=>{var t;if(this.Pr&&null!=(t=this.Pr)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),s=null==(i=this.Pr)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this.Tr(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var e=_o.getWindowLocation();if(null!=e&&e.search){var t=Ji(null==e?void 0:e.search,"__experiment_id"),i=Ji(null==e?void 0:e.search,"__experiment_variant");t&&i&&(_o.kr("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.Cr(parseInt(t),i,e)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var i=t.json.experiments||[];return e(i)}})}Cr(e,t,i){var r=i.filter(t=>t.id===e);r&&r.length>0&&(_o.kr("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.Tr(r[0].name,t,r[0].variants[t].transforms))}static Ir(e){return!j(e.conditions)&&_o.Rr(e)&&_o.Fr(e)}static Rr(e){var t;if(j(e.conditions)||j(null==(t=e.conditions)?void 0:t.url))return!0;var i,r,s,n=_o.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||go[null!==(r=null==(s=e.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==r?void 0:r.location}static Fr(e){var t;if(j(e.conditions)||j(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Xr();if(i.utm_source){var r,s,n,o,a,l,c,u,h=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,v=null==(c=e.conditions)||null==(c=c.utm)||!c.utm_term||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_term)==i.utm_term;return h&&p&&v&&d}return!1}static kr(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];Et.info("[WebExperiments] "+e,i)}Tr(e,t,i){this._is_bot()?_o.kr("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach(i=>{if(i.selector){var r;_o.kr("applying transform of variant "+t+" for experiment "+e+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach(e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)})}}):_o.kr("Control variants leave the page unmodified.")}_is_bot(){return l&&this._instance?uo(l,this._instance.config.custom_blocked_useragents):void 0}}var fo=xt("[PostHog ExternalIntegrations]"),mo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class yo{constructor(e){this._instance=e}it(e,t){var i;null==(i=g.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return fo.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(t){var i,s,n;!r||null!=(i=g.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e.it(mo[t],()=>{var i;null==(i=g.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)}),!r&&null!=(s=g.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[t]&&(null==(n=g.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t(i)}}}var bo="[SessionRecording]",wo=xt(bo);class Eo{get started(){var e;return!(null==(e=this.Mr)||!e.isStarted)}get status(){return this.Mr?this.Mr.status:this.Or&&!this.Ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Or=!1,this.Dr=void 0,this._instance=e,!this._instance.sessionManager)throw wo.error("started without valid sessionManager"),new Error(bo+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(bo+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!(null==(e=this._instance.get_property(Jt))||!e.enabled),i=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return r&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.Ar||null==(t=this.Mr)||!t.isStarted){var i=!A(Object.assign)&&!A(Array.from);this.Ar&&i?(this.jr(e),wo.info("starting")):this.stopRecording()}}jr(e){var t,i,r;this.Ar&&(null!=g&&null!=(t=g.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=g.__PosthogExtensions__)&&i.initSessionRecording?this.Lr(e):null==(r=g.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Nr,t=>{if(t)return wo.error("could not load recorder",t);this.Lr(e)}))}stopRecording(){var e,t;null==(e=this.Dr)||e.call(this),this.Dr=void 0,null==(t=this.Mr)||t.stop()}Ur(){var e;null==(e=this._instance.persistence)||e.unregister(Qt)}zr(e){if(this._instance.persistence){var t,i,r=this._instance.persistence,s=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,i=null==t?void 0:t.sampleRate,s=j(i)?null:parseFloat(i);j(s)&&this.Ur();var n=null==t?void 0:t.minimumDurationMilliseconds;r.register({[Jt]:y({enabled:!!t},t,{networkPayloadCapture:y({capturePerformance:e.capturePerformance},null==t?void 0:t.networkPayloadCapture),canvasRecording:{enabled:null==t?void 0:t.recordCanvas,fps:null==t?void 0:t.canvasFps,quality:null==t?void 0:t.canvasQuality},sampleRate:s,minimumDurationMilliseconds:A(n)?null:n,endpoint:null==t?void 0:t.endpoint,triggerMatchType:null==t?void 0:t.triggerMatchType,masking:null==t?void 0:t.masking,urlTriggers:null==t?void 0:t.urlTriggers})})};s(),null==(t=this.Dr)||t.call(this),this.Dr=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?!1!==e.sessionRecording?(this.zr(e),this.Or=!0,this.startIfEnabledOrStop()):this.Or=!0:wo.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.Mr)&&i.log?this.Mr.log(e,t):wo.warn("log called before recorder was ready")}get Nr(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(Jt);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}Lr(e){var t,i;if(null==(t=g.__PosthogExtensions__)||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Mr||(this.Mr=null==(i=g.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.Mr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Mr.start(e)}onRRwebEmit(e){var t;null==(t=this.Mr)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Mr||null==(t=this._instance.persistence)||t.register({$replay_override_linked_flag:!0}),null==(e=this.Mr)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Mr||null==(t=this._instance.persistence)||t.register({$replay_override_sampling:!0}),null==(e=this.Mr)||e.overrideSampling()}overrideTrigger(e){var t,i;this.Mr||null==(i=this._instance.persistence)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this.Mr)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.Mr)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.Mr)||!i.tryAddCustomEvent(e,t))}}var xo={},ko=()=>{},So="posthog",Po=!Ws&&-1===(null==v?void 0:v.indexOf("MSIE"))&&-1===(null==v?void 0:v.indexOf("Mozilla")),$o=e=>{var t;return y({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Lt(null==c?void 0:c.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ko,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,debug:u&&L(null==u?void 0:u.search)&&-1!==u.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:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==r||null==(t=r.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;Et.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Zn},error_tracking:{},_onCapture:ko,__preview_eager_load_replay:!1},(e=>({rageclick:!(e&&e>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(e&&e>="2025-05-24")||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(e))},Ro=e=>{var t={};A(e.process_person)||(t.person_profiles=e.process_person),A(e.xhr_headers)||(t.request_headers=e.xhr_headers),A(e.cookie_name)||(t.persistence_name=e.cookie_name),A(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),A(e.store_google)||(t.save_campaign_params=e.store_google),A(e.verbose)||(t.debug=e.verbose);var i=It({},t,e);return F(e.property_blacklist)&&(A(e.property_denylist)?i.property_denylist=e.property_blacklist:F(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:Et.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class Io{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){Et.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Co{get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){this.webPerformance=new Io,this.Br=!1,this.version=_.LIB_VERSION,this.qr=new jn,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=$o(),this.SentryIntegration=Lr,this.sentryIntegration=e=>function(e,t){var i=Ar(e,t);return{name:Or,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Wr=!1,this.Gr=null,this.Vr=null,this.Jr=null,this.featureFlags=new _n(this),this.toolbar=new qr(this),this.scrollManager=new io(this),this.pageViewManager=new hs(this),this.surveys=new Bn(this),this.conversations=new Wn(this),this.logs=new zn(this),this.experiments=new _o(this),this.exceptions=new nn(this),this.rateLimiter=new Xn(this),this.requestRouter=new vo(this),this.consent=new kr(this),this.externalIntegrations=new yo(this),this.people={set:(e,t,i)=>{var r=L(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=L(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",e=>Et.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==So){var r,s=null!==(r=xo[i])&&void 0!==r?r:new Co;return s._init(e,t,i),xo[i]=s,xo[So][i]=s,s}return this._init(e,t,i)}_init(e,t,i){var s;if(void 0===t&&(t={}),A(e)||D(e))return Et.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Kr(t.debug),this.Yr=t,this.Xr=[],t.person_profiles&&(this.Vr=t.person_profiles),this.set_config(It({},$o(t.defaults),Ro(t),{name:i,token:e})),this.config.on_xhr_error&&Et.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:ps.GZipJS;var n=this.Qr();this.persistence=new mn(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mn(y({},this.config,{persistence:"sessionStorage"}),n);var o=y({},this.persistence.props),a=y({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Zr=new Qn(e=>this.ts(e),this.config.request_queue_config),this.es=new to(this),this.__request_queue=[];var l="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new oo(this),this.sessionPropsManager=new so(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Et.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.rs(l)},0)):(Et.info("Initializing extensions synchronously"),this.rs(l)),_.DEBUG=_.DEBUG||this.config.debug,_.DEBUG&&Et.info("Starting in debug mode",{this:this,config:t,thisC:y({},this.config),p:o,s:a}),void 0!==(null==(s=t.bootstrap)?void 0:s.distinctID)){var c,u,h=this.config.get_device_id(hr()),d=null!=(c=t.bootstrap)&&c.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(ai,null!=(u=t.bootstrap)&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:d})}if(this.ss()){var p,v,g=Object.keys((null==(p=t.bootstrap)?void 0:p.featureFlags)||{}).filter(e=>{var i;return!(null==(i=t.bootstrap)||null==(i=i.featureFlags)||!i[e])}).reduce((e,i)=>{var r;return e[i]=(null==(r=t.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,e},{}),f=Object.keys((null==(v=t.bootstrap)?void 0:v.featureFlagPayloads)||{}).filter(e=>g[e]).reduce((e,i)=>{var r,s;return null!=(r=t.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(e[i]=null==(s=t.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]),e},{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:f})}if(l)this.register_once({distinct_id:gi,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(hr());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(ai,"anonymous")}return Nt(r,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||hr();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(ai,"identified")),t()},s=i.user();"then"in s&&T(s.then)?s.then(r):r(s)}(e,()=>{i.register((e=>{Promise&&Promise.resolve||Mr.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Mr.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Mr.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then(()=>{t()})})}(this,()=>this.ns()):this.ns(),T(this.config._onCapture)&&this.config._onCapture!==ko&&(Et.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Et.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}rs(e){var t=performance.now();this.historyAutocapture=new Tr(this),this.historyAutocapture.startIfEnabled();var i=[];i.push(()=>{new Vr(this).startIfEnabledOrStop()}),i.push(()=>{var e;this.siteApps=new co(this),null==(e=this.siteApps)||e.init()}),e||i.push(()=>{this.sessionRecording=new Eo(this),this.sessionRecording.startIfEnabledOrStop()}),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.push(()=>{this.autocapture=new sr(this),this.autocapture.startIfEnabled()}),i.push(()=>{this.surveys.loadIfEnabled()}),i.push(()=>{this.logs.loadIfEnabled()}),i.push(()=>{this.conversations.loadIfEnabled()}),i.push(()=>{this.productTours=new wn(this),this.productTours.loadIfEnabled()}),i.push(()=>{this.heatmaps=new us(this),this.heatmaps.startIfEnabled()}),i.push(()=>{this.webVitalsAutocapture=new as(this)}),i.push(()=>{this.exceptionObserver=new Cr(this),this.exceptionObserver.startIfEnabledOrStop()}),i.push(()=>{this.deadClicksAutocapture=new Rr(this,$r),this.deadClicksAutocapture.startIfEnabled()}),i.push(()=>{if(this.os){var e=this.os;this.os=void 0,this.yi(e)}}),this.ls(i,t)}ls(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.ls(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){Et.error("Error initializing extension:",e)}}var r=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&Et.info("PostHog extensions initialized ("+r+"ms)")}yi(e){var t,i,r,s,n,o,a,l,u;if(!c||!c.body)return Et.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.yi(e)},500);this.config.__preview_deferred_init_extensions&&(this.os=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=k(e.supportedCompression,ps.GZipJS)?ps.GZipJS:k(e.supportedCompression,ps.Base64)?ps.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Vr?this.Vr:"identified_only"}),null==(i=this.siteApps)||i.onRemoteConfig(e),null==(r=this.sessionRecording)||r.onRemoteConfig(e),null==(s=this.autocapture)||s.onRemoteConfig(e),null==(n=this.heatmaps)||n.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),null==(o=this.productTours)||o.onRemoteConfig(e),null==(a=this.webVitalsAutocapture)||a.onRemoteConfig(e),null==(l=this.exceptionObserver)||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),null==(u=this.deadClicksAutocapture)||u.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(e){Et.critical("`loaded` function failed",e)}this.us(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.hs()},1),new Jn(this).load(),this.featureFlags.flags()}us(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Zr)||e.enable())}_dom_loaded(){this.is_capturing()&&$t(this.__request_queue,e=>this.ts(e)),this.__request_queue=[],this.us()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.ds()&&this.capture("$pageleave"),null==(e=this.Zr)||e.unload(),null==(t=this.es)||t.unload()):this.ds()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Po?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ys(e.url,{ip:this.config.ip?1:0}),e.headers=y({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,r,s=y({},e);s.timeout=s.timeout||6e4,s.url=Ys(s.url,{_:(new Date).getTime().toString(),ver:_.LIB_VERSION,compression:s.compression});var n=null!==(t=s.transport)&&void 0!==t?t:"fetch",o=Js.filter(e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport)),a=null!==(i=null==(r=Dt(o,e=>e.transport===n))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(y({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&(null==(i=(r=this.config).on_request_error)||i.call(r,t)),null==e.callback||e.callback(t)}}))))}ts(e){this.es?this.es.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],r=[],s=[];$t(e,e=>{e&&(t=e[0],F(t)?s.push(e):T(e)?e.call(this):F(e)&&"alias"===t?i.push(e):F(e)&&-1!==t.indexOf("capture")&&T(this[t])?s.push(e):r.push(e))});var n=function(e,t){$t(e,function(e){if(F(e[0])){var i=t;Rt(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};n(i,this),n(r,this),n(s,this)}ss(){var e,t;return(null==(e=this.config.bootstrap)?void 0:e.featureFlags)&&Object.keys(null==(t=this.config.bootstrap)?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!A(e)&&L(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!s||this.config.__preview_capture_bot_pageviews){var n=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=t&&t.$current_url&&!L(null==t?void 0:t.$current_url)&&(Et.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),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 o=new Date,a=(null==i?void 0:i.timestamp)||o,l=hr(),c={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},a,l)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&s&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),n&&(c.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==i?void 0:i.$set)&&(c.$set=null==i?void 0:i.$set);var u,h="$groupidentify"!==e,d=this.vs(null==i?void 0:i.$set_once,h);if(d&&(c.$set_once=d),(c=function(e,t){return i=e,r=e=>L(e)&&!N(t)?e.slice(0,t):e,s=new Set,function e(t,i){return t!==Object(t)?r?r(t):t:s.has(t)?void 0:(s.add(t),F(t)?(n=[],$t(t,t=>{n.push(e(t))})):(n={},Rt(t,(t,i)=>{s.has(t)||(n[i]=e(t))})),n);var n}(i);var i,r,s}(c,null!=i&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,A(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=o),e===Cn.DISMISSED||e===Cn.SENT){var p=null==t?void 0:t[Fn.SURVEY_ID],v=null==t?void 0:t[Fn.SURVEY_ITERATION];u={id:p,current_iteration:v},localStorage.getItem(Ln(u))||localStorage.setItem(Ln(u),"true"),c.$set=y({},c.$set,{[An({id:p,current_iteration:v},e===Cn.SENT?"responded":"dismissed")]:!0})}else e===Cn.SHOWN&&(c.$set=y({},c.$set,{[Fn.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var g=y({},c.properties.$set,c.$set);if(O(g)||this.setPersonPropertiesForFlags(g),!j(this.config.before_send)){var _=this.cs(c);if(!_)return;c=_}this.qr.emit("eventCaptured",c);var f={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.ts(f):this.Zr.enqueue(f),c}Et.critical("This capture call is ignored due to client rate limiting.")}}else Et.error("No event name provided to posthog.capture")}else Et.uninitializedWarning("posthog.capture")}Hi(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,r,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var n=s?void 0:this.persistence.remove_event_timer(e),o=y({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),"$snapshot"===e){var a=y({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!L(o.distinct_id)&&!H(o.distinct_id)||D(o.distinct_id))&&Et.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var l,u=ss(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime());o.$session_id=h,o.$window_id=d}this.sessionPropsManager&&It(o,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&It(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(p=this.es)?void 0:p.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===ho.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),l="$pageview"!==e||s?"$pageleave"!==e||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),o=It(o,l),"$pageview"===e&&c&&(o.title=c.title),!A(n)){var g=i.getTime()-n;o.$duration=parseFloat((g/1e3).toFixed(3))}v&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=It({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),F(this.config.property_denylist)?Rt(this.config.property_denylist,function(e){delete o[e]}):Et.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(Et.error("sanitize_properties is deprecated. Use before_send instead"),o=_(o,e));var f=this.fs();return o.$process_person_profile=f,f&&!s&&this.ps("_calculate_event_properties"),o}vs(e,t){var i;if(void 0===t&&(t=!0),!this.persistence||!this.fs())return e;if(this.Br)return e;var r=this.persistence.get_initial_props(),s=null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps(),n=It({},r,s||{},e||{}),o=this.config.sanitize_properties;return o&&(Et.error("sanitize_properties is deprecated. Use before_send instead"),n=o(n,"$set_once")),t&&(this.Br=!0),O(n)?void 0:n}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var r;null==(r=this.persistence)||r.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}gs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(e){return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,i){var r=null!=i&&i.merge?this.featureFlags.getFlagVariants():{},s=null!=i&&i.merge?this.featureFlags.getFlagPayloads():{},n=y({},r,e),o=y({},s,t),a={};for(var[l,c]of Object.entries(n)){var u="string"==typeof c;a[l]={key:l,enabled:!!u||Boolean(c),variant:u?c:void 0,reason:void 0,metadata:A(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.featureFlags.receivedFeatureFlags({flags:a})}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return void 0===t&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.qr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){void 0===t&&(t=Nn),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return void 0===t&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Et.uninitializedWarning("posthog.identify");if(H(e)&&(e=e.toString(),Et.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))Et.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==gi){if(this.ps("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==r&&e!==this.get_property(Ht)&&(this.unregister(Ht),this.register({distinct_id:e}));var n="anonymous"===(this.persistence.get_property(ai)||"anonymous");e!==r&&n?(this.persistence.set_property(ai,"identified"),this.setPersonPropertiesForFlags(y({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.Jr=Qs(e,t,i),this.featureFlags.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(oi))}}else Et.critical('The string "'+gi+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Et.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var i=Qs(this.get_distinct_id(),e,t);this.Jr!==i?(this.setPersonPropertiesForFlags(y({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=i):Et.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:y({},r,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),r[e]===t||i||this.reloadFeatureFlags()}else Et.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0),this.ps("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,s;if(Et.info("reset"),!this.__loaded)return Et.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(ai,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.Jr=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:gi,$device_id:null},"");else{var o=this.config.get_device_id(hr());this.register_once({distinct_id:o,$device_id:e?o:n},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.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(e,t){return e===this.get_property(jt)?(Et.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(A(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(Ht,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Et.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=y({},this.config);if(M(e)){var i,r,s,n,o,a,l;It(this.config,Ro(e));var c=this.Qr();null==(i=this.persistence)||i.update_config(this.config,t,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mn(y({},this.config,{persistence:"sessionStorage"}),c);var u=this.Kr(this.config.debug);U(u)&&(this.config.debug=u),U(this.config.debug)&&(this.config.debug?(_.DEBUG=!0,fr.H()&&fr.G("ph_debug","true"),Et.info("set_config",{config:e,oldConfig:t,newConfig:y({},this.config)})):(_.DEBUG=!1,fr.H()&&fr.V("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this._s(),null==(l=this.externalIntegrations)||l.startIfEnabledOrStop()}}startSessionRecording(e){var t,i,r,s,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(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 e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(y({},r,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:So;return t!==So&&(t=So+"."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property(ai))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property(ai))}fs(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&O(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[Ht])&&(null==(t=this.persistence)||null==(t=t.props)||!t[pi]))}ds(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.fs()||this.ps("posthog.createPersonProfile")&&this.setPersonProperties({},{})}ps(e){return"never"===this.config.person_profiles?(Et.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(pi,!0),!0)}Qr(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||e&&!!t}_s(){var e,t,i,r,s=this.Qr();return(null==(e=this.persistence)?void 0:e.Si)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t.Si)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(e){var t,i,r,s;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new oo(this),this.pageViewManager=new hs(this),this.persistence&&(this.sessionPropsManager=new so(this,this.sessionManager,this.persistence)),this.sessionRecording=new Eo(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this._s(),this.us(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),(A(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(s=null==e?void 0:e.captureEventName)&&void 0!==s?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hs()):Et.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,i;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._s(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:gi,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.hs())):Et.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===xr.GRANTED?"granted":e===xr.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._s()}_is_bot(){return l?uo(l,this.config.custom_blocked_useragents):void 0}hs(){c&&("visible"===c.visibilityState?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:c.title},{send_instantly:!0}),this.Gr&&(c.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),Nt(c,"visibilitychange",this.Gr)))}debug(e){!1===e?(null==r||r.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==r||r.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}))}O(){var e,t,i,r,s,n,o=this.Yr||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Et.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",r=Et,s=(t="advanced_disable_flags")in(e=o)&&!A(e[t]),n=i in e&&!A(e[i]),s?e[t]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}cs(e){if(j(this.config.before_send))return e;var t=F(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),j(i)){var s="Event '"+e.event+"' was rejected in beforeSend function";return V(e.event)?Et.warn(s+". This can cause unexpected behavior."):Et.info(s),null}i.properties&&!O(i.properties)||Et.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.Kt)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Kr(e){var t=U(e)&&!e,i=fr.H()&&"true"===fr.q("ph_debug");return!t&&(!!i||e)}}!function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=Mt(e.prototype[t[i]])}(Co,["identify"]);var Fo,To={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},Mo=(Fo=xo[So]=new Co,function(){function e(){e.done||(e.done=!0,Po=!1,Rt(xo,function(e){e._dom_loaded()}))}null!=c&&c.addEventListener?"complete"===c.readyState?e():Nt(c,"DOMContentLoaded",e,{capture:!1}):r&&Et.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Fo)}}]);