db-studio 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +22 -22
- package/dist/index.js.map +1 -1
- package/dist/web-dist/assets/{_pathlessLayout-BQk5gSGn.js → _pathlessLayout-aKKQKRJX.js} +1 -1
- package/dist/web-dist/assets/_pathlessLayout-s6cwJxH6.js +2 -0
- package/dist/web-dist/assets/{_queryId-Buy3oA5p.js → _queryId-DnPgn-AJ.js} +1 -1
- package/dist/web-dist/assets/{_table-CQ2NX0I8.js → _table-Bgt0zJ9m.js} +1 -1
- package/dist/web-dist/assets/{_table-BnMBHUzk.js → _table-CU8PHZQE.js} +1 -1
- package/dist/web-dist/assets/{_table-CE0TjrEn.js → _table-DIbpzW3q.js} +1 -1
- package/dist/web-dist/assets/{abap-B7CMCXo3.js → abap-DQayJW6v.js} +1 -1
- package/dist/web-dist/assets/{apex-D6pniLV0.js → apex-Djzlm7in.js} +1 -1
- package/dist/web-dist/assets/{azcli-DayXln6N.js → azcli-Bbikkqe4.js} +1 -1
- package/dist/web-dist/assets/{badge-BIuMcm7O.js → badge-HtbO9hWg.js} +1 -1
- package/dist/web-dist/assets/{bat-knBi4IWo.js → bat-BUFda2RT.js} +1 -1
- package/dist/web-dist/assets/{bicep-CqySwd8I.js → bicep-CuUgDHWX.js} +1 -1
- package/dist/web-dist/assets/{browser-DQEdJbyz.js → browser-B6gU7HWo.js} +1 -1
- package/dist/web-dist/assets/{bundle-mjs-qYDTi1yn.js → bundle-mjs-DEMZsBkP.js} +1 -1
- package/dist/web-dist/assets/{cameligo-D1w-uj2C.js → cameligo-DITobApP.js} +1 -1
- package/dist/web-dist/assets/{chat-sidebar-CApWlRXq.js → chat-sidebar-Cr2fVFDF.js} +4 -4
- package/dist/web-dist/assets/{clojure-D7bkK2B8.js → clojure-DTFcSI8F.js} +1 -1
- package/dist/web-dist/assets/{code-editor-Dwq67W-h.js → code-editor-BpsclD2u.js} +1 -1
- package/dist/web-dist/assets/{coffee-Dpij46Wn.js → coffee-CmIRg0oP.js} +1 -1
- package/dist/web-dist/assets/{connect-B0x9CNlf.js → connect-BM4hZPnz.js} +1 -1
- package/dist/web-dist/assets/{constants-BFCsZ8ll.js → constants-BBxXyYPa.js} +3 -3
- package/dist/web-dist/assets/{cpp-DWDORc6B.js → cpp-BwBWpZT1.js} +1 -1
- package/dist/web-dist/assets/{csharp-FpOMvD_o.js → csharp-BnWK75m3.js} +1 -1
- package/dist/web-dist/assets/{csp-4WiITR2R.js → csp-Dohj3XYI.js} +1 -1
- package/dist/web-dist/assets/{css-DMOWqvgH.js → css-DN4GbnxY.js} +1 -1
- package/dist/web-dist/assets/{cssMode-DHL98brF.js → cssMode-CiAtMuTk.js} +1 -1
- package/dist/web-dist/assets/{cypher-Byev8hZE.js → cypher-CKAK8eD4.js} +1 -1
- package/dist/web-dist/assets/{dart--T4f3SxI.js → dart-imWXBTLy.js} +1 -1
- package/dist/web-dist/assets/{database.store-BAbH5Geu.js → database.store-73Wsz2L5.js} +10 -10
- package/dist/web-dist/assets/{dist-D4lNl-zm.js → dist-D4HUXaJv.js} +1 -1
- package/dist/web-dist/assets/{dist-C_AEsM_Y.js → dist-DwRWhVwY.js} +1 -1
- package/dist/web-dist/assets/{dockerfile-CTL_qQGw.js → dockerfile-CXOK4zpC.js} +1 -1
- package/dist/web-dist/assets/{ecl-D2-VZ5jm.js → ecl-lOrW9o9k.js} +1 -1
- package/dist/web-dist/assets/{editor.api-DaW7cLxE.js → editor.api-DSevzNN8.js} +1 -1
- package/dist/web-dist/assets/{elixir-C__1cTub.js → elixir-DgvzEwPU.js} +1 -1
- package/dist/web-dist/assets/{esm-DHRCgDAS.js → esm-DC8GK2En.js} +1 -1
- package/dist/web-dist/assets/{flow9-U08FhG_o.js → flow9-l3BJy5NQ.js} +1 -1
- package/dist/web-dist/assets/{format-cell-value-BDXXdObX.js → format-cell-value-CuhjnBNV.js} +1 -1
- package/dist/web-dist/assets/{freemarker2-EL1xRRz-.js → freemarker2-73G2DeCz.js} +1 -1
- package/dist/web-dist/assets/{fsharp-BYeUdvUi.js → fsharp-sfou20I_.js} +1 -1
- package/dist/web-dist/assets/{go-D7V_ae37.js → go-DnjkNg4Q.js} +1 -1
- package/dist/web-dist/assets/{graphql-C-zVsbUk.js → graphql-BJFXvNDL.js} +1 -1
- package/dist/web-dist/assets/{handlebars-BgZpkJkF.js → handlebars-DXg2L0KG.js} +1 -1
- package/dist/web-dist/assets/{hcl-B7_QCGTQ.js → hcl-B4FYtDde.js} +1 -1
- package/dist/web-dist/assets/{highlighted-body-OFNGDK62-D8XE2uMh.js → highlighted-body-OFNGDK62-Bi4CQl8I.js} +1 -1
- package/dist/web-dist/assets/{html-e4Xrzf8r.js → html-BvAUQUXw.js} +1 -1
- package/dist/web-dist/assets/{htmlMode-B6WabTqV.js → htmlMode-hZ3EloXT.js} +1 -1
- package/dist/web-dist/assets/{icons-D72QQyd5.js → icons-CheF8KGp.js} +1 -1
- package/dist/web-dist/assets/{index-DlECfzV9.js → index-YCx2RIFq.js} +4 -4
- package/dist/web-dist/assets/{indexes-BBz0Je_a.js → indexes-BYqaS45O.js} +1 -1
- package/dist/web-dist/assets/{ini-B8RMyZP2.js → ini-H3EW14Oa.js} +1 -1
- package/dist/web-dist/assets/{java-B0bzjGsf.js → java-Cu5qHMXc.js} +1 -1
- package/dist/web-dist/assets/{javascript-BSAFurIc.js → javascript-bJHYh6Or.js} +1 -1
- package/dist/web-dist/assets/{json-editor-DoEopjNh.js → json-editor-ZcSS1MRc.js} +1 -1
- package/dist/web-dist/assets/{jsonMode-CMXGrtoZ.js → jsonMode-CDMOUPss.js} +1 -1
- package/dist/web-dist/assets/{julia-Bg58EZ4Y.js → julia-CZ0npMib.js} +1 -1
- package/dist/web-dist/assets/{keys-6E3ilH7R.js → keys-By5o7bPm.js} +1 -1
- package/dist/web-dist/assets/{kotlin-DW9Z0gYb.js → kotlin-BpW0qHIt.js} +1 -1
- package/dist/web-dist/assets/{label-Dcwj4aRe.js → label-C93T1BbF.js} +1 -1
- package/dist/web-dist/assets/{less-Bx9gqQ4s.js → less-DTBM-Kxp.js} +1 -1
- package/dist/web-dist/assets/{lexon-CSuDDXgE.js → lexon-CLOvNp8v.js} +1 -1
- package/dist/web-dist/assets/{liquid-BmNDruwv.js → liquid-IpfBCIUY.js} +1 -1
- package/dist/web-dist/assets/{logs-BgfXuAGG.js → logs-CnLvqVtL.js} +1 -1
- package/dist/web-dist/assets/{lspLanguageFeatures-CvWt81ki.js → lspLanguageFeatures-CnYZSn_O.js} +1 -1
- package/dist/web-dist/assets/{lua-CyCE05f5.js → lua-BERpVknn.js} +1 -1
- package/dist/web-dist/assets/{m3-B4TowLdg.js → m3-B_gILjHh.js} +1 -1
- package/dist/web-dist/assets/{markdown-DUAXYKYX.js → markdown-DamaZSqy.js} +1 -1
- package/dist/web-dist/assets/{mdx-DWKx4rlR.js → mdx-BTw_ghf-.js} +1 -1
- package/dist/web-dist/assets/{mermaid-GHXKKRXX-Ci1jaQj_.js → mermaid-GHXKKRXX-B7fOqMvZ.js} +1 -1
- package/dist/web-dist/assets/{middleware-YebY3a0i.js → middleware-DKaxoFZs.js} +1 -1
- package/dist/web-dist/assets/{mips-B8pYMMky.js → mips-BkjI-_01.js} +1 -1
- package/dist/web-dist/assets/{module-BfdI0fnl.js → module-BbdCXsK0.js} +1 -1
- package/dist/web-dist/assets/{monaco-theme-C8nJMjlg.js → monaco-theme-DkPj5STI.js} +4 -4
- package/dist/web-dist/assets/{msdax-Dl7lqaqA.js → msdax-5OSOIuww.js} +1 -1
- package/dist/web-dist/assets/{mysql-CxF1irIT.js → mysql-CMtxQW5J.js} +1 -1
- package/dist/web-dist/assets/{objective-c-nxQNwVWR.js → objective-c-CoW52So-.js} +1 -1
- package/dist/web-dist/assets/{overlay.store-D93IGU3a.js → overlay.store-BL-3zX6X.js} +1 -1
- package/dist/web-dist/assets/{pascal-CJDb1n8F.js → pascal-BxyU4sPJ.js} +1 -1
- package/dist/web-dist/assets/{pascaligo-DNMesjCc.js → pascaligo-C63_040U.js} +1 -1
- package/dist/web-dist/assets/{perl-Ct14C4yC.js → perl-ayfptt23.js} +1 -1
- package/dist/web-dist/assets/{personal-preferences.store-BXE0mRKp.js → personal-preferences.store-BIr71Re8.js} +1 -1
- package/dist/web-dist/assets/{pgsql-B2EenuF0.js → pgsql-CPGqMVI3.js} +1 -1
- package/dist/web-dist/assets/{php-D953oiSq.js → php-DA-YJ6wI.js} +1 -1
- package/dist/web-dist/assets/{pla-DTXlQw1d.js → pla-DesDCKWW.js} +1 -1
- package/dist/web-dist/assets/{postiats-JN8Ouz04.js → postiats-B8yhii_n.js} +1 -1
- package/dist/web-dist/assets/{powerquery-5V8-uvAS.js → powerquery-CG8tCOct.js} +1 -1
- package/dist/web-dist/assets/{powershell-CB8eXyFq.js → powershell-C68aZHza.js} +1 -1
- package/dist/web-dist/assets/{preload-helper-B3GI5Aqe.js → preload-helper-DZhPwQp1.js} +1 -1
- package/dist/web-dist/assets/{protobuf-B9TJJ9C4.js → protobuf-OaVxpJrs.js} +1 -1
- package/dist/web-dist/assets/{pug-Bm8fNuV-.js → pug-0lOSC2rA.js} +1 -1
- package/dist/web-dist/assets/{python-C5yAejbi.js → python-C8ab8TeJ.js} +1 -1
- package/dist/web-dist/assets/{qsharp-R8gbdykE.js → qsharp-BmHeDwNl.js} +1 -1
- package/dist/web-dist/assets/{queries.store-Qbtkt7ze.js → queries.store-Dwdw-Gej.js} +1 -1
- package/dist/web-dist/assets/{query-runner-DwuQkpxh.js → query-runner-C430BH5I.js} +3 -3
- package/dist/web-dist/assets/{r-M-_jtR31.js → r-DoHxhOJg.js} +1 -1
- package/dist/web-dist/assets/{radix-ui-41WpuKNR.js → radix-ui-ByvuE8TW.js} +1 -1
- package/dist/web-dist/assets/{razor-C1QqRako.js → razor-DynaHCXX.js} +1 -1
- package/dist/web-dist/assets/{react-46S5qMHL.js → react-CKF1H7h0.js} +1 -1
- package/dist/web-dist/assets/{react-dom-BmawA5F6.js → react-dom-DQQG0g0D.js} +1 -1
- package/dist/web-dist/assets/{redis-Se45CWCe.js → redis-CSL-jfR-.js} +1 -1
- package/dist/web-dist/assets/{redis-value-DG_0UKZy.js → redis-value-Bf0tOet0.js} +1 -1
- package/dist/web-dist/assets/{redshift-6LxiBjWf.js → redshift-Cb-LWZ8f.js} +1 -1
- package/dist/web-dist/assets/{restructuredtext-DQZZ8qkw.js → restructuredtext-DTqnvYsu.js} +1 -1
- package/dist/web-dist/assets/{rolldown-runtime-CpVMLIgb.js → rolldown-runtime-0wqQW3ea.js} +1 -1
- package/dist/web-dist/assets/{ruby-CCIHgGuA.js → ruby-DbgDuslH.js} +1 -1
- package/dist/web-dist/assets/{runner-DOkX5y17.js → runner-DFzqBXp0.js} +1 -1
- package/dist/web-dist/assets/{rust-DE79jE85.js → rust-CWzrsIL_.js} +1 -1
- package/dist/web-dist/assets/{sb-vTusoyll.js → sb-BghszYt-.js} +1 -1
- package/dist/web-dist/assets/{scala-BfDNOQ4o.js → scala-Cw9RU1Qz.js} +1 -1
- package/dist/web-dist/assets/schema-B_EtHxTf.js +1 -0
- package/dist/web-dist/assets/{schema-CgNnxiB7.js → schema-iTfBKwXl.js} +1 -1
- package/dist/web-dist/assets/{scheme-07Nz-Ikg.js → scheme-DeYmvmAH.js} +1 -1
- package/dist/web-dist/assets/{scss-C2T-BIyo.js → scss-D_S6B2H1.js} +1 -1
- package/dist/web-dist/assets/{select-DzeVPveq.js → select-DU0HoKZ4.js} +1 -1
- package/dist/web-dist/assets/{separator-3IoeVup6.js → separator-CZgXYjVQ.js} +1 -1
- package/dist/web-dist/assets/{sheet-sidebar-Bne7asEZ.js → sheet-sidebar-KvxY47ZZ.js} +1 -1
- package/dist/web-dist/assets/{shell-CYk99G96.js → shell-B59ItoUV.js} +1 -1
- package/dist/web-dist/assets/{solidity-DZfw6XST.js → solidity-De0h6YhL.js} +1 -1
- package/dist/web-dist/assets/{sophia-9ELY8Wd6.js → sophia-DWmKHYE0.js} +1 -1
- package/dist/web-dist/assets/{sparql-DBCoTLhO.js → sparql-0sKQlAae.js} +1 -1
- package/dist/web-dist/assets/{spinner-Z77kD_hS.js → spinner-FJ-tXoFX.js} +1 -1
- package/dist/web-dist/assets/{sql-DSSHZrVP.js → sql-Cafrv7gm.js} +1 -1
- package/dist/web-dist/assets/{st-9goatbhG.js → st-qkFqcB41.js} +1 -1
- package/dist/web-dist/assets/{swift-C8IWUoth.js → swift-CDPKFfVs.js} +1 -1
- package/dist/web-dist/assets/{systemverilog-DFmMGPsp.js → systemverilog-rjtBmhAJ.js} +1 -1
- package/dist/web-dist/assets/{table-Cwbi0FDw.js → table-DmoKTp5U.js} +1 -1
- package/dist/web-dist/assets/{tables-BPh2zM7Q.js → tables-By-PTDwU.js} +4 -4
- package/dist/web-dist/assets/{tanstack-BE6ru2gB.js → tanstack-Cb7WFPRi.js} +1 -1
- package/dist/web-dist/assets/{tcl-9sp6ieFk.js → tcl-C0NrUCCP.js} +1 -1
- package/dist/web-dist/assets/{tsMode-BjCfzjtF.js → tsMode-C2yuf0pi.js} +1 -1
- package/dist/web-dist/assets/{twig-PTQx-ucO.js → twig-RBrBABOf.js} +1 -1
- package/dist/web-dist/assets/{typescript-BGXEvFAl.js → typescript-DWkZjHjp.js} +1 -1
- package/dist/web-dist/assets/{typespec-k1Hrq-4g.js → typespec-DfQiGud4.js} +1 -1
- package/dist/web-dist/assets/{use-database-engine-CKCp55rb.js → use-database-engine-Mwmv8X7V.js} +1 -1
- package/dist/web-dist/assets/{use-theme-CLKCtULg.js → use-theme-BLw5dtZV.js} +1 -1
- package/dist/web-dist/assets/{utils-Cr2_fSDl.js → utils-awMbhLwX.js} +1 -1
- package/dist/web-dist/assets/{vb-BBuEtOk5.js → vb-BslxQW9i.js} +1 -1
- package/dist/web-dist/assets/{visualizer-XPaDmMrd.js → visualizer-LoD_yU5U.js} +1 -1
- package/dist/web-dist/assets/{vscode-jtB6jKBB.js → vscode-Ba8jYSS7.js} +1 -1
- package/dist/web-dist/assets/{wgsl-MO-DpoEc.js → wgsl-Bq67ZIFU.js} +1 -1
- package/dist/web-dist/assets/{workers-7JruDoqH.js → workers-rMl5Xrk2.js} +1 -1
- package/dist/web-dist/assets/{xml-C0nHIB7q.js → xml-PfDqoe6w.js} +1 -1
- package/dist/web-dist/assets/{yaml-CN9StMra.js → yaml-CIuY3cB5.js} +1 -1
- package/dist/web-dist/index.html +30 -30
- package/package.json +2 -3
- package/dist/web-dist/assets/_pathlessLayout-WF7WipqP.js +0 -2
- package/dist/web-dist/assets/schema-B8WxzFU1.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@2.0.0"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bbbc2bd5-e5fb-44c4-9185-8618c7b66692",e._sentryDebugIdIdentifier="sentry-dbid-bbbc2bd5-e5fb-44c4-9185-8618c7b66692")}catch{}})();var v=typeof window<"u"?window:void 0,J=typeof globalThis<"u"?globalThis:v;typeof self>"u"&&(J.self=J),typeof File>"u"&&(J.File=function(){});var ce=J?.navigator,b=J?.document,Q=J?.location,Ji=J?.fetch,Zi=J!=null&&J.XMLHttpRequest&&"withCredentials"in new J.XMLHttpRequest?J.XMLHttpRequest:void 0,is=J?.AbortController,ya=J?.CompressionStream,le=ce?.userAgent,$=v??{},rs="1.372.10",ne={DEBUG:!1,LIB_VERSION:rs,LIB_NAME:"web",JS_SDK_VERSION:rs};function ss(e,t,i,r,s,n,a){try{var o=e[n](a),l=o.value}catch(c){i(c);return}o.done?t(l):Promise.resolve(l).then(r,s)}function _e(e){return function(){var t=this,i=arguments;return new Promise((function(r,s){var n=e.apply(t,i);function a(l){ss(n,r,s,a,o,"next",l)}function o(l){ss(n,r,s,a,o,"throw",l)}a(void 0)}))}}function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},m.apply(null,arguments)}function sn(e,t){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function Qi(){return Qi=_e((function*(e,t,i){t===void 0&&(t=!0);try{var r=new CompressionStream("gzip"),s=r.writable.getWriter(),n=s.write(new TextEncoder().encode(e)).then((()=>s.close())).catch((function(){var l=_e((function*(c){try{yield s.abort(c)}catch{}throw c}));return function(c){return l.apply(this,arguments)}})()),a=new Response(r.readable).blob(),[o]=yield Promise.all([a,n]);return o}catch(l){if(i!=null&&i.rethrow)throw l;return t&&console.error("Failed to gzip compress data",l),null}})),Qi.apply(this,arguments)}var ba=["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"],ns=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var i=e.toLowerCase();return ba.concat(t).some((r=>{var s=r.toLowerCase();return i.indexOf(s)!==-1}))},wa=["$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 q(e,t){return e.indexOf(t)!==-1}var xi=function(e){return e.trim()},er=function(e){return e.replace(/^\$/,"")},nn=Object.prototype,an=nn.hasOwnProperty,ki=nn.toString,D=Array.isArray||function(e){return ki.call(e)==="[object Array]"},Te=e=>typeof e=="function",Y=e=>e===Object(e)&&!D(e),ot=e=>{if(Y(e)){for(var t in e)if(an.call(e,t))return!1;return!0}return!1},E=e=>e===void 0,W=e=>ki.call(e)=="[object String]",Qt=e=>W(e)&&e.trim().length===0,Me=e=>e===null,N=e=>E(e)||Me(e),fe=e=>ki.call(e)=="[object Number]"&&e==e,rt=e=>fe(e)&&e>0,Se=e=>ki.call(e)==="[object Boolean]",Ea=e=>e instanceof FormData,xa=e=>q(wa,e);function on(e){return e===null||typeof e!="object"}function si(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Dr(e){return typeof Event<"u"&&(function(t,i){try{return t instanceof i}catch{return!1}})(e,Event)}var ka=[!0,"true",1,"1","yes"],Fi=e=>q(ka,e),Sa=[!1,"false",0,"0","no"];function Pe(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),fe(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(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),Pe(s||i,t,i,r))}var Pa=class{constructor(e){this.$t={},this.zt=e.zt,this.Zt=Pe(e.bucketSize,0,100,e.Gt),this.Qt=Pe(e.refillRate,0,this.Zt,e.Gt),this.Jt=Pe(e.refillInterval,0,864e5,e.Gt)}Kt(e,t){var i=Math.floor((t-e.lastAccess)/this.Jt);i>0&&(e.tokens=Math.min(e.tokens+i*this.Qt,this.Zt),e.lastAccess=e.lastAccess+i*this.Jt)}consumeRateLimit(e){var t,i=Date.now(),r=String(e),s=this.$t[r];return s?this.Kt(s,i):this.$t[r]=s={tokens:this.Zt,lastAccess:i},s.tokens===0||(s.tokens--,s.tokens===0&&((t=this.zt)==null||t.call(this,e)),s.tokens===0)}stop(){this.$t={}}},Wt,as,Ii,he="Mobile",ni="iOS",Ce="Android",dt="Tablet",ln=Ce+" "+dt,un="iPad",cn="Apple",hn=cn+" Watch",Ot="Safari",vt="BlackBerry",dn="Samsung",vn=dn+"Browser",pn=dn+" Internet",Ye="Chrome",$a=Ye+" OS",_n=Ye+" "+ni,Ur="Internet Explorer",gn=Ur+" "+he,jr="Opera",Ra=jr+" Mini",Hr="Edge",fn="Microsoft "+Hr,ct="Firefox",mn=ct+" "+ni,Nt="Nintendo",Dt="PlayStation",ht="Xbox",yn=Ce+" "+he,bn=he+" "+Ot,St="Windows",tr=St+" Phone",os="Nokia",ir="Ouya",wn="Generic",Fa=wn+" "+he.toLowerCase(),En=wn+" "+dt.toLowerCase(),rr="Konqueror",re="(\\d+(\\.\\d+)?)",Ti=new RegExp("Version/"+re),Ia=new RegExp(ht,"i"),Ta=new RegExp(Dt+" \\w+","i"),Oa=new RegExp(Nt+" \\w+","i"),zr=new RegExp(vt+"|PlayBook|BB10","i"),Ca={"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"},xn=function(e,t){return t=t||"",q(e," OPR/")&&q(e,"Mini")?Ra:q(e," OPR/")?jr:zr.test(e)?vt:q(e,"IE"+he)||q(e,"WPDesktop")?gn:q(e,vn)?pn:q(e,Hr)||q(e,"Edg/")?fn:q(e,"FBIOS")?"Facebook "+he:q(e,"UCWEB")||q(e,"UCBrowser")?"UC Browser":q(e,"CriOS")?_n:q(e,"CrMo")||q(e,Ye)?Ye:q(e,Ce)&&q(e,Ot)?yn:q(e,"FxiOS")?mn:q(e.toLowerCase(),rr.toLowerCase())?rr:((i,r)=>r&&q(r,cn)||(function(s){return q(s,Ot)&&!q(s,Ye)&&!q(s,Ce)})(i))(e,t)?q(e,he)?bn:Ot:q(e,ct)?ct:q(e,"MSIE")||q(e,"Trident/")?Ur:q(e,"Gecko")?ct:""},Ma={[gn]:[new RegExp("rv:"+re)],[fn]:[new RegExp(Hr+"?\\/"+re)],[Ye]:[new RegExp("("+Ye+"|CrMo)\\/"+re)],[_n]:[new RegExp("CriOS\\/"+re)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+re)],[Ot]:[Ti],[bn]:[Ti],[jr]:[new RegExp("(Opera|OPR)\\/"+re)],[ct]:[new RegExp(ct+"\\/"+re)],[mn]:[new RegExp("FxiOS\\/"+re)],[rr]:[new RegExp("Konqueror[:/]?"+re,"i")],[vt]:[new RegExp(vt+" "+re),Ti],[yn]:[new RegExp("android\\s"+re,"i")],[pn]:[new RegExp(vn+"\\/"+re)],[Ur]:[new RegExp("(rv:|MSIE )"+re)],Mozilla:[new RegExp("rv:"+re)]},Aa=function(e,t){var i=Ma[xn(e,t)];if(E(i))return null;for(var r=0;i.length>r;r++){var s=e.match(i[r]);if(s)return parseFloat(s[s.length-2])}return null},ls=[[new RegExp(ht+"; "+ht+" (.*?)[);]","i"),e=>[ht,e&&e[1]||""]],[new RegExp(Nt,"i"),[Nt,""]],[new RegExp(Dt,"i"),[Dt,""]],[zr,[vt,""]],[new RegExp(St,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[tr,""];if(new RegExp(he).test(t)&&!/IEMobile\b/.test(t))return[St+" "+he,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=Ca[i[1]]||"";return/arm/i.test(t)&&(r="RT"),[St,r]}return[St,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[ni,[e[3],e[4],e[5]||"0"].join(".")]:[ni,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=E(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ce+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ce+")","i"),e=>e&&e[2]?[Ce,[e[2],e[3],e[4]||"0"].join(".")]:[Ce,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[$a,""]],[/Linux|debian/i,["Linux",""]]],us=function(e){return Oa.test(e)?Nt:Ta.test(e)?Dt:Ia.test(e)?ht:new RegExp(ir,"i").test(e)?ir:new RegExp("("+tr+"|WPDesktop)","i").test(e)?tr:/iPad/.test(e)?un:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?hn:zr.test(e)?vt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(os,"i").test(e)?os:/(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(he).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)?Ce:ln:new RegExp("(pda|"+he+")","i").test(e)?Fa:new RegExp(dt,"i").test(e)&&!new RegExp(dt+" pc","i").test(e)?En:""},La=e=>e instanceof Error,kn={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},qa=kn.info;function Sn(e){if(Se(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(D(e))return{arrayValue:{values:e.map((t=>Sn(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function cs(e){var t=[];for(var i in e){var r=e[i];Me(r)||E(r)||t.push({key:i,value:Sn(r)})}return t}function Na(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return Ii&&i.length===as||(as=i.length,Ii=i.reduce(((r,s)=>{Wt||(Wt={});var n=Wt[s];if(n)r[n[0]]=n[1];else for(var a=e(s),o=a.length-1;o>=0;o--){var l=a[o],c=l?.filename,u=t[s];if(c&&u){r[c]=u,Wt[s]=[c,u];break}}return r}),{})),Ii}}var Da=class{constructor(e,t,i){i===void 0&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(t),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return _e((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&D(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:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,r;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),m({},e,{cause:i,stack:r})}applyChunkIds(e,t){return e.map((i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i)))}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 _e((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:(i=t.type)!==null&&i!==void 0?i:"generic",handled:(r=t.handled)===null||r===void 0||r,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var a=[n];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,m({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:Na(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var r=(s,n)=>{if(4>=n){var a=this.buildCoercingContext(e,t,n);return this.applyCoercers(s,a)}};return m({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:s=>r(s,i),next:s=>r(s,i+1)})}},pt="?";function sr(e,t,i,r,s){var n={platform:e,filename:t,function:i==="<anonymous>"?pt:i,in_app:!0};return E(r)||(n.lineno=r),E(s)||(n.colno=s),n}var Pn=(e,t)=>{var i=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return i||r?[e.indexOf("@")!==-1?e.split("@")[0]:pt,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Ua=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ja=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ha=/\((\S*)(?::(\d+))(?::(\d+))\)/,za=(e,t)=>{var i=Ua.exec(e);if(i){var[,r,s,n]=i;return sr(t,r,pt,+s,+n)}var a=ja.exec(e);if(a){if(a[2]&&a[2].indexOf("eval")===0){var o=Ha.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,c]=Pn(a[1]||pt,a[2]);return sr(t,c,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},Va=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Wa=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ba=(e,t)=>{var i=Va.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Wa.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]||pt;return[n,s]=Pn(n,s),sr(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},hs=/\(error: (.*)\)/,Ga=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=W(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 si(e,"DOMException")}isDOMError(e){return si(e,"DOMError")}},Ya=class{match(e){return(t=>t 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 String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}},Xa=class{constructor(){}match(e){return si(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Ka=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ja=class{match(e){return typeof e=="string"}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:r??"Error",value:s??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(Ka);return r&&(t=r[1],i=r[2]),[t,i]}},Za=["fatal","error","warning","log","info","debug"];function $n(e,t){t===void 0&&(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(t>=s.length)return r===i.length?s:s.length>t?s.slice(0,t)+"...":s}return""}var Qa=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(i=t.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Dr(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+$n(e)}isSeverityLevel(e){return W(e)&&!Qt(e)&&Za.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(La(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},eo=class{match(e){return Dr(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+$n(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},to=class{match(e){return on(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},io=class{match(e){return si(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Dr(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return on(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},ai="$message",oi="$timestamp",ro=new Set([ai,oi]),Oi={enabled:!0,max_bytes:32768};function li(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Oi.enabled,max_bytes:no(e.max_bytes,Oi.max_bytes)}:m({},Oi)}var so=class{constructor(e){this.Yt=[],this.Xt=0,this.qt=li(e)}setConfig(e){this.qt=li(e),this.er()}add(e){var t=(function(r){var s=(function(c){var u=new WeakSet;try{return JSON.stringify(c,((h,d)=>{if(typeof d=="bigint")return d.toString();if(typeof d!="function"&&typeof d!="symbol"){if(d instanceof Date)return d.toISOString();if(d instanceof Error)return{name:d.name,message:d.message,stack:d.stack};if(d&&typeof d=="object"){if(u.has(d))return"[Circular]";u.add(d)}return d}}))}catch{return}})(r);if(s)try{var n=JSON.parse(s);if(!Y(n))return;var a=n,o=a[ai],l=a[oi];return!W(o)||o.trim().length===0||!W(l)&&!fe(l)?void 0:{step:a,json:s}}catch{return}})(e);if(t){var i=(function(r){if(typeof TextEncoder<"u")return new TextEncoder().encode(r).length;for(var s=encodeURIComponent(r),n=0,a=0;s.length>a;a++)s[a]==="%"?(n+=1,a+=2):n+=1;return n})(t.json);i>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:i}),this.Xt+=i,this.er())}}getAttachable(){return this.Yt.map((e=>e.step))}clear(){this.Yt=[],this.Xt=0}size(){return this.Yt.length}er(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var e=this.Yt.shift();e&&(this.Xt-=e.bytes)}}};function no(e,t){if(!fe(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}var Rn=function(e,t){var{debugEnabled:i}=t===void 0?{}:t,r={k(s){if(v&&(ne.DEBUG||$.POSTHOG_DEBUG||i)&&!E(v.console)&&v.console){for(var n=("__rrweb_original__"in v.console[s])?v.console[s].__rrweb_original__:v.console[s],a=arguments.length,o=new Array(a>1?a-1:0),l=1;a>l;l++)o[l-1]=arguments[l];n(e,...o)}},debug(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("debug",...n)},info(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("log",...n)},warn(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("warn",...n)},error(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("error",...n)},critical(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];console.error(e,...n)},uninitializedWarning(s){r.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>Rn(e+" "+s,n)};return r},w=Rn("[PostHog.js]"),z=w.createLogger,ao=z("[ExternalScriptsLoader]"),Ci=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return ao.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=b?.querySelectorAll("script");if(r){for(var s,n=function(){if(r[a].src===t){var l=r[a];return l.__posthog_loading_callback_fired?{v:i()}:(l.addEventListener("load",(c=>{l.__posthog_loading_callback_fired=!0,i(void 0,c)})),l.onerror=c=>i(c),{v:void 0})}},a=0;r.length>a;a++)if(s=n())return s.v}var o=()=>{if(!b)return i("document not found");var l=b.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=t,l.onload=h=>{l.__posthog_loading_callback_fired=!0,i(void 0,h)},l.onerror=h=>i(h),e.config.prepare_external_dependency_script&&(l=e.config.prepare_external_dependency_script(l)),!l)return i("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")b.head.appendChild(l);else{var c,u=b.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):b.body.appendChild(l)}};b!=null&&b.body?o():b?.addEventListener("DOMContentLoaded",o)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if(t!=="remote-config"){var r;if(e.config.__preview_external_dependency_versioned_paths)r=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var s="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=e.requestRouter.endpointFor("assets",s)}Ci(e,r,i)}else Ci(e,e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js"),i)},$.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{Ci(e,e.requestRouter.endpointFor("api",t),i)};var Fn="$people_distinct_id",ui="$device_id",Pt="__alias",$t="__timers",nr="$autocapture_disabled_server_side",ar="$heatmaps_enabled_server_side",or="$exception_capture_enabled_server_side",lr="$error_tracking_suppression_rules",ur="$error_tracking_capture_extension_exceptions",cr="$web_vitals_enabled_server_side",Vr="$dead_clicks_enabled_server_side",hr="$product_tours_enabled_server_side",dr="$web_vitals_allowed_metrics",Rt="$session_recording_remote_config",In="$replay_override_sampling",Tn="$replay_override_linked_flag",On="$replay_override_url_trigger",Cn="$replay_override_event_trigger",ci="$sesid",Wr="$session_is_sampled",lt="$enabled_feature_flags",ei="$active_feature_flags",Ft="$early_access_features",vr="$feature_flag_details",pr="$feature_flag_payloads",_r="$feature_flag_request_id",Ie="$override_feature_flags",st="$override_feature_flag_payloads",It="$stored_person_properties",We="$stored_group_properties",gr="$surveys",fr="$surveys_activated",ti="ph_product_tours",Ct="$flag_call_reported",mr="$flag_call_reported_session_id",yr="$feature_flag_errors",hi="$feature_flag_evaluated_at",we="$user_state",br="$client_session_props",wr="$capture_rate_limit",Er="$initial_campaign_params",xr="$initial_referrer_info",di="$initial_person_info",vi="$epp",Mn="__POSTHOG_TOOLBAR__",Bt="$posthog_cookieless",An="$sdk_debug_extensions_init_method",Ln="$sdk_debug_extensions_init_time_ms",qn="$sdk_debug_recording_script_not_loaded",kr="PostHog loadExternalDependency extension not found.",Be="on_reject",Oe="always",Ze="anonymous",Qe="identified",Sr="identified_only",pi="visibilitychange",_i="beforeunload",nt="$pageview",Mi="$pageleave",Ai="$identify",ds="$groupidentify";function Gt(e,t){D(e)&&e.forEach(t)}function j(e,t){if(!N(e))if(D(e))e.forEach(t);else if(Ea(e))e.forEach(((r,s)=>t(r,s)));else for(var i in e)an.call(e,i)&&t(e[i],i)}var B=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)s[n]!==void 0&&(e[n]=s[n]);return e};function ii(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 vs=function(e){try{return e()}catch{return}},oo=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];return e.apply(this,i)}catch(s){w.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),w.critical(s)}}},Br=function(e){var t={};return j(e,(function(i,r){(W(i)&&i.length>0||fe(i))&&(t[r]=i)})),t},lo=["herokuapp.com","vercel.app","netlify.app"];function uo(e){var t=e?.hostname;if(!W(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of lo)if(i===r)return!1;return!0}function X(e,t,i,r){var{capture:s=!1,passive:n=!0}=r??{};e?.addEventListener(t,i,{capture:s,passive:n})}function Nn(e){return e.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return fe(e)&&isFinite(e)&&Math.floor(e)===e});var co=class Pr{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,r,s){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(s)||0>t||0>i||0>r||0>s||t>0xffffffffffff||i>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/Math.pow(2,8),n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new Pr(n)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),i!==3&&i!==5&&i!==7&&i!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Pr(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var i=0;16>i;i++){var r=this.bytes[i]-t.bytes[i];if(r!==0)return Math.sign(r)}return 0}},ho=class{constructor(){this.S=0,this.C=0,this.I=new vo}generate(){var e=this.generateOrAbort();if(E(e)){this.S=0;var t=this.generateOrAbort();if(E(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return co.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}},ps,Dn=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};v&&!E(v.crypto)&&crypto.getRandomValues&&(Dn=e=>crypto.getRandomValues(e));var vo=class{constructor(){this.M=new Uint32Array(8),this.O=1/0}nextUint32(){return this.M.length>this.O||(Dn(this.M),this.O=0),this.M[this.O++]}},Ue=()=>po().toString(),po=()=>(ps||(ps=new ho)).generate(),ft="",_o=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ke={R:()=>!!b,D(e){w.error("cookieStore error: "+e)},A(e){if(b){try{for(var t=e+"=",i=b.cookie.split(";").filter((n=>n.length)),r=0;i.length>r;r++){for(var s=i[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(t)===0)return decodeURIComponent(s.substring(t.length,s.length))}}catch{}return null}},F(e){var t;try{t=JSON.parse(ke.A(e))||{}}catch{}return t},N(e,t,i,r,s){if(b)try{var n="",a="",o=(function(u,h){if(h){var d=(function(p,g){if(g===void 0&&(g=b),ft)return ft;if(!g||["localhost","127.0.0.1"].includes(p))return"";for(var R=p.split("."),P=Math.min(R.length,8),T="dmn_chk_"+Ue();!ft&&P--;){var F=R.slice(P).join("."),O=T+"=1;domain=."+F+";path=/";g.cookie=O+";max-age=3",g.cookie.includes(T)&&(g.cookie=O+";max-age=0",ft=F)}return ft})(u);if(!d){var _=(p=>{var g=p.match(_o);return g?g[0]:""})(u);_!==d&&w.info("Warning: cookie subdomain discovery mismatch",_,d),d=_}return d?"; domain=."+d:""}return""})(b.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+o+a;return c.length>3686.4&&w.warn("cookieStore warning: large cookie, len="+c.length),b.cookie=c,c}catch{return}},q(e,t){if(b!=null&&b.cookie)try{ke.N(e,"",-1,t)}catch{return}}},Li=null,V={R(){if(!Me(Li))return Li;var e=!0;if(E(v))e=!1;else try{var t="__mplssupport__";V.N(t,"xyz"),V.A(t)!=='"xyz"'&&(e=!1),V.q(t)}catch{e=!1}return e||w.error("localStorage unsupported; falling back to cookie store"),Li=e,e},D(e){w.error("localStorage error: "+e)},A(e){try{return v?.localStorage.getItem(e)}catch(t){V.D(t)}return null},F(e){try{return JSON.parse(V.A(e))||{}}catch{}return null},N(e,t){try{v?.localStorage.setItem(e,JSON.stringify(t))}catch(i){V.D(i)}},q(e){try{v?.localStorage.removeItem(e)}catch(t){V.D(t)}}},go=[ui,"distinct_id",ci,Wr,vi,di,we],Yt={},fo={R:()=>!0,D(e){w.error("memoryStorage error: "+e)},A:e=>Yt[e]||null,F:e=>Yt[e]||null,N(e,t){Yt[e]=t},q(e){delete Yt[e]}},He=null,ee={R(){if(!Me(He))return He;if(He=!0,E(v))He=!1;else try{var e="__support__";ee.N(e,"xyz"),ee.A(e)!=='"xyz"'&&(He=!1),ee.q(e)}catch{He=!1}return He},D(e){w.error("sessionStorage error: ",e)},A(e){try{return v?.sessionStorage.getItem(e)}catch(t){ee.D(t)}return null},F(e){try{return JSON.parse(ee.A(e))||null}catch{}return null},N(e,t){try{v?.sessionStorage.setItem(e,JSON.stringify(t))}catch(i){ee.D(i)}},q(e){try{v?.sessionStorage.removeItem(e)}catch(t){ee.D(t)}}},mo=class{constructor(e){this._instance=e}get qt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.qt.cookieless_mode===Oe||this.isRejected()||this.consent===-1&&this.qt.cookieless_mode===Be}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qt.opt_out_capturing_by_default}optInOut(e){this.nr.N(this.sr,e?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}get sr(){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 ir(){var e=this.nr.A(this.sr);return Fi(e)?1:q(Sa,e)?0:-1}get nr(){var e=this.qt.opt_out_capturing_persistence_type,t=e==="localStorage"?V:ke;if(!this.ar||this.ar!==t){this.ar=t;var i=e==="localStorage"?ke:V;i.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(Fi(i.A(this.sr))),i.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[ce?.doNotTrack,ce?.msDoNotTrack,$.doNotTrack].some((e=>Fi(e)))}},Xt=z("[Dead Clicks]"),yo=()=>!0,bo=e=>{var t,i=!((t=e.instance.persistence)==null||!t.get_property(Vr)),r=e.instance.config.capture_dead_clicks;return Se(r)?r:!!Y(r)||i},_s=class{get lazyLoadedDeadClicksAutocapture(){return this.ur}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Vr]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr((()=>{this.hr()})):this.stop()}lr(e){var t,i;(t=$.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?Xt.error("failed to load script",r):e()}))}hr(){var e;if(b){if(!this.ur&&(e=$.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=Y(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ur=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ur.start(b),Xt.info("starting...")}}else Xt.error("`document` not found. Cannot start.")}stop(){this.ur&&(this.ur.stop(),this.ur=void 0,Xt.info("stopping..."))}},qi=z("[SegmentIntegration]"),Un="posthog-js";function jn(e,t){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=t===void 0?{}:t;return o=>{var l,c,u,h,d;if(n!=="*"&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});var _=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());o.tags["PostHog Person URL"]=_,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=((l=o.exception)==null?void 0:l.values)||[],R=g.map((T=>m({},T,{stacktrace:T.stacktrace?m({},T.stacktrace,{type:"raw",frames:(T.stacktrace.frames||[]).map((F=>m({},F,{platform:"web:javascript"})))}):void 0}))),P={$exception_message:((c=g[0])==null?void 0:c.value)||o.message,$exception_type:(u=g[0])==null?void 0:u.type,$exception_level:o.level,$exception_list:R,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((h=g[0])==null?void 0:h.value)||o.message,$sentry_exception_type:(d=g[0])==null?void 0:d.type,$sentry_tags:o.tags};return i&&r&&(P.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+o.event_id),a&&((p=e.exceptions)==null||p.sendExceptionEvent(P)),o}}var wo=class{constructor(e,t,i,r,s,n){this.name=Un,this.setupOnce=function(a){a(jn(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:n==null||n}))}}},gs=class{constructor(e){this.cr=(t,i,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength)&&(w.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.vr()}vr(){var e;this.pr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.cr)}destroy(){var e;(e=this.pr)==null||e.call(this),this.pr=void 0}doPageView(e,t){var i,r=this.gr(e,t);return this.dr={pathname:(i=v?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.gr(e,(t=this.dr)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.dr)==null?void 0:e.pageViewId}}gr(e,t){var i=this.dr;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:a,maxScrollY:o,maxContentHeight:l,lastContentY:c,maxContentY:u}=s;if(!(E(n)||E(a)||E(o)||E(l)||E(c)||E(u))){n=Math.ceil(n),a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var h=n>1?Pe(a/n,0,1,w):1,d=n>1?Pe(o/n,0,1,w):1,_=l>1?Pe(c/l,0,1,w):1,p=l>1?Pe(u/l,0,1,w):1;r=B(r,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:o,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}},Eo={[Fn]:{exposure:"hidden"},[Pt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[$t]:{exposure:"hidden"},[nr]:{exposure:"event"},[ar]:{exposure:"hidden"},[or]:{exposure:"event"},[lr]:{exposure:"hidden"},[ur]:{exposure:"event"},[cr]:{exposure:"event"},[Vr]:{exposure:"event"},[hr]:{exposure:"hidden"},[dr]:{exposure:"event"},[Rt]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[ci]:{exposure:"hidden"},[Wr]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[lt]:{exposure:"derived",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Y(e))return{};for(var t={},i=Object.keys(e),r=0;i.length>r;r++)t["$feature/"+i[r]]=e[i[r]];return t}},[ei]:{exposure:"event"},[Ft]:{exposure:"hidden"},[vr]:{exposure:"hidden"},[pr]:{exposure:"event"},[_r]:{exposure:"event"},[Ie]:{exposure:"event"},[st]:{exposure:"hidden"},[It]:{exposure:"hidden"},[We]:{exposure:"hidden"},[gr]:{exposure:"hidden"},[fr]:{exposure:"event"},[ti]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ct]:{exposure:"hidden"},[mr]:{exposure:"hidden"},[yr]:{exposure:"hidden"},[hi]:{exposure:"hidden"},[we]:{exposure:"hidden"},[br]:{exposure:"hidden"},[wr]:{exposure:"hidden"},[Er]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[di]:{exposure:"hidden"},[vi]:{exposure:"hidden"},[In]:{exposure:"event"},[Tn]:{exposure:"event"},[On]:{exposure:"event"},[Cn]:{exposure:"event"},[An]:{exposure:"event"},[Ln]:{exposure:"event"},[qn]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},xo=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],gi=e=>{var t=b?.createElement("a");return E(t)?null:(t.href=e,t)},fi=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!D(i)||2>i.length)return"";var a=i[1];try{a=decodeURIComponent(a)}catch{w.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Ut=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[1],n=(r[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),c=[],u=0;l.length>u;u++){var h=l[u].split("=");D(h)&&(t.includes(h[0])?c.push(h[0]+"="+i):c.push(l[u]))}var d=o;return a!=null&&(d+="?"+c.join("&")),s!=null&&(d+="#"+s),d},mi=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Kt="https?://(.*)",_t=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ko=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",..._t],jt="<masked>",So=["li_fat_id"];function Hn(e,t,i){if(!b)return{};var r,s=t?[..._t,...i||[]]:[],n=zn(Ut(b.URL,s,jt),e);return B((r={},j(So,(function(a){var o=ke.A(a);r[a]=o||null})),r),n)}function zn(e,t){var i=ko.concat(t||[]),r={};return j(i,(function(s){r[s]=fi(e,s)||null})),r}function Vn(e){var t=(function(n){return n?n.search(Kt+"google.([^/?]*)")===0?"google":n.search(Kt+"bing.com")===0?"bing":n.search(Kt+"yahoo.com")===0?"yahoo":n.search(Kt+"duckduckgo.com")===0?"duckduckgo":null:null})(e),i=t!="yahoo"?"q":"p",r={};if(!Me(t)){r.$search_engine=t;var s=b?fi(b.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function fs(){return navigator.language||navigator.userLanguage}var yi="$direct";function Wn(){return b?.referrer||yi}function Bn(e,t){var i=e?[..._t,...t||[]]:[],r=Q?.href.substring(0,1e3);return{r:Wn().substring(0,1e3),u:r?Ut(r,i,jt):void 0}}function Gn(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:i==null?void 0:i==yi?yi:(t=gi(i))==null?void 0:t.host};if(r){s.$current_url=r;var n=gi(r);s.$host=n?.host,s.$pathname=n?.pathname,B(s,zn(r))}return i&&B(s,Vn(i)),s}function Yn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Po(){try{return new Date().getTimezoneOffset()}catch{return}}var $o=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ni=class{constructor(e,t){this.qt=e,this.props={},this.mr=!1,this.yr=(i=>{var r="";return i.token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"})(e),this.nr=this.br(e),this.load(),e.debug&&w.info("Persistence loaded",e.persistence,m({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._r}br(e){$o.indexOf(e.persistence.toLowerCase())===-1&&(w.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(r){r===void 0&&(r=[]);var s=[...go,...r];return m({},V,{F(n){try{var a={};try{a=ke.F(n)||{}}catch{}var o=B(a,JSON.parse(V.A(n)||"{}"));return V.N(n,o),o}catch{}return null},N(n,a,o,l,c,u){try{V.N(n,a,void 0,void 0,u);var h={};s.forEach((d=>{a[d]&&(h[d]=a[d])})),Object.keys(h).length&&ke.N(n,h,o,l,c,u)}catch(d){V.D(d)}},q(n,a){try{v?.localStorage.removeItem(n),ke.q(n,a)}catch(o){V.D(o)}}})})(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return i==="localstorage"&&V.R()?V:i==="localstorage+cookie"&&t.R()?t:i==="sessionstorage"&&ee.R()?ee:i==="memory"?fo:i==="cookie"?ke:t.R()?t:ke}wr(e){var t=e??this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[hi];return!i||typeof i!="number"||Date.now()-i>t}properties(){var e={};return j(this.props,((t,i)=>{var r=(s=>{var n=Eo[s];if(n)return n;for(var[a,o]of xo)if(s.indexOf(a)===0)return o})(i);if(r?.exposure==="derived"){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,i===lt?()=>this.wr():()=>!1))return;r.transformToEventProperties&&B(e,r.transformToEventProperties(t))}else r&&r.exposure!=="event"||(e[i]=t)})),e}load(){if(!this._r){var e=this.nr.F(this.yr);e&&(this.props=B({},e))}}save(){this._r||this.nr.N(this.yr,this.props,this.Sr,this.kr,this.Cr,this.qt.debug)}remove(){this.nr.q(this.yr,!1),this.nr.q(this.yr,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(Y(e)){E(t)&&(t="None"),this.Sr=E(i)?this.Ir:i;var r=!1;if(j(e,((s,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.Tr(n,s),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(Y(e)){this.Sr=E(t)?this.Ir:t;var i=!1;if(j(e,((r,s)=>{e.hasOwnProperty(s)&&this.props[s]!==r&&(this.Tr(s,r),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Er(e),this.save())}update_campaign_params(){if(!this.mr){var e=Hn(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);ot(Br(e))||this.register(e),this.mr=!0}}update_search_keyword(){var e;this.register((e=b?.referrer)?Vn(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Wn(),$referring_domain:b!=null&&b.referrer&&((e=gi(b.referrer))==null?void 0:e.host)||yi},void 0)}set_initial_person_info(){this.props[Er]||this.props[xr]||this.register_once({[di]:Bn(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};j([xr,Er],(s=>{var n=this.props[s];n&&j(n,(function(a,o){e["$initial_"+er(o)]=a}))}));var t,i,r=this.props[di];return r&&B(e,(t=Gn(r),i={},j(t,(function(s,n){i["$initial_"+er(n)]=s})),i)),e}safe_merge(e){return j(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this.Ir=this.Sr=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||!((n,a)=>{if(n.length!==a.length)return!1;var o=[...n].sort(),l=[...a].sort();return o.every(((c,u)=>c===l[u]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.br(e),s=this.props;this.clear(),this.nr=r,this.props=s,this.save()}}set_disabled(e){this._r=e,this._r?this.remove():this.save()}set_cross_subdomain(e){e!==this.kr&&(this.kr=e,this.remove(),this.save())}set_secure(e){e!==this.Cr&&(this.Cr=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[$t]||{};i[e]=t,this.Tr($t,i),this.save()}remove_event_timer(e){var t=this.props[$t]||{},i=t[e];return E(i)||(delete t[e],this.Tr($t,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.Tr(e,t),this.save()}Tr(e,t){this.props[e]=t}Er(e){delete this.props[e]}},mt={Activation:"events",Cancellation:"cancelEvents"},Di={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Tt={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ui={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},$r={Popover:"popover",Inline:"inline"},Ro={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},ms={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ys=z("[RateLimiter]"),Fo=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((r=>{ys.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){ys.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:i});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,r;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,a=new Date().getTime(),o=(t=(i=this.instance.persistence)==null?void 0:i.get_property(wr))!==null&&t!==void 0?t:{tokens:s,last:a};o.tokens+=(a-o.last)/1e3*n,o.last=a,o.tokens>s&&(o.tokens=s);var l=1>o.tokens;return l||e||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(r=this.instance.persistence)==null||r.set_property(wr,o),{isRateLimited:l,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},yt=z("[RemoteConfig]"),Xn=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Mr(e){var t,i;(t=$.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Pr(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 yt.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Or();if(this._instance.Lr())return void yt.warn("Remote config is disabled. Falling back to local config.");this.Mr((e=>{if(!e)return yt.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pr((t=>{this.Rr(t),this.Or()}));this.Rr(e),this.Or()}))}catch(e){yt.error("Error loading remote config",e)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){this._instance.Lr()||b?.visibilityState==="hidden"||this._instance.reloadFeatureFlags()}Or(){var e;if(!this.Fr){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.Fr=setInterval((()=>{this.refresh()}),t))}}Rr(e){var t;e||yt.error("Failed to fetch remote config from PostHog."),this._instance.Rr(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}},xe={GZipJS:"gzip-js",Base64:"base64"},ge=Uint8Array,ae=Uint16Array,gt=Uint32Array,Gr=new ge([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]),Yr=new ge([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]),bs=new ge([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Kn=function(e,t){for(var i=new ae(31),r=0;31>r;++r)i[r]=t+=1<<e[r-1];var s=new gt(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Jn=Kn(Gr,2),Rr=Jn[1];Jn[0][28]=258,Rr[258]=28;for(var ws=Kn(Yr,0)[1],Fr=new ae(32768),H=0;32768>H;++H){var et=(43690&H)>>>1|(21845&H)<<1;Fr[H]=((65280&(et=(61680&(et=(52428&et)>>>2|(13107&et)<<2))>>>4|(3855&et)<<4))>>>8|(255&et)<<8)>>>1}var Mt=function(e,t,i){for(var r=e.length,s=0,n=new ae(t);r>s;++s)++n[e[s]-1];var a,o=new ae(t);for(s=0;t>s;++s)o[s]=o[s-1]+n[s-1]<<1;if(i){a=new ae(1<<t);var l=15-t;for(s=0;r>s;++s)if(e[s])for(var c=s<<4|e[s],u=t-e[s],h=o[e[s]-1]++<<u,d=h|(1<<u)-1;d>=h;++h)a[Fr[h]>>>l]=c}else for(a=new ae(r),s=0;r>s;++s)a[s]=Fr[o[e[s]-1]++]>>>15-e[s];return a},Xe=new ge(288);for(H=0;144>H;++H)Xe[H]=8;for(H=144;256>H;++H)Xe[H]=9;for(H=256;280>H;++H)Xe[H]=7;for(H=280;288>H;++H)Xe[H]=8;var bi=new ge(32);for(H=0;32>H;++H)bi[H]=5;var Io=Mt(Xe,9,0),To=Mt(bi,5,0),Zn=function(e){return(e/8>>0)+(7&e&&1)},Qn=function(e,t,i){(i==null||i>e.length)&&(i=e.length);var r=new(e instanceof ae?ae:e instanceof gt?gt:ge)(i-t);return r.set(e.subarray(t,i)),r},Re=function(e,t,i){var r=t/8>>0;e[r]|=i<<=7&t,e[r+1]|=i>>>8},bt=function(e,t,i){var r=t/8>>0;e[r]|=i<<=7&t,e[r+1]|=i>>>8,e[r+2]|=i>>>16},ji=function(e,t){for(var i=[],r=0;e.length>r;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new ge(0),0];if(s==1){var a=new ge(i[0].s+1);return a[i[0].s]=1,[a,1]}i.sort((function(f,S){return f.f-S.f})),i.push({s:-1,f:25001});var o=i[0],l=i[1],c=0,u=1,h=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=s-1;)o=i[i[h].f>i[c].f?c++:h++],l=i[c!=u&&i[h].f>i[c].f?c++:h++],i[u++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(r=1;s>r;++r)n[r].s>d&&(d=n[r].s);var _=new ae(d+1),p=Ir(i[u-1],_,0);if(p>t){r=0;var g=0,R=p-t,P=1<<R;for(n.sort((function(f,S){return _[S.s]-_[f.s]||f.f-S.f}));s>r;++r){var T=n[r].s;if(t>=_[T])break;g+=P-(1<<p-_[T]),_[T]=t}for(g>>>=R;g>0;){var F=n[r].s;t>_[F]?g-=1<<t-_[F]++-1:++r}for(;r>=0&&g;--r){var O=n[r].s;_[O]==t&&(--_[O],++g)}p=t}return[new ge(_),p]},Ir=function(e,t,i){return e.s==-1?Math.max(Ir(e.l,t,i+1),Ir(e.r,t,i+1)):t[e.s]=i},Es=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new ae(++t),r=0,s=e[0],n=1,a=function(l){i[r++]=l},o=1;t>=o;++o)if(e[o]==s&&o!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(s),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(s);n=1,s=e[o]}return[i.subarray(0,r),t]},wt=function(e,t){for(var i=0,r=0;t.length>r;++r)i+=e[r]*t[r];return i},Tr=function(e,t,i){var r=i.length,s=Zn(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;r>n;++n)e[s+n+4]=i[n];return 8*(s+4+r)},xs=function(e,t,i,r,s,n,a,o,l,c,u){Re(t,u++,i),++s[256];for(var h=ji(s,15),d=h[0],_=h[1],p=ji(n,15),g=p[0],R=p[1],P=Es(d),T=P[0],F=P[1],O=Es(g),f=O[0],S=O[1],k=new ae(19),y=0;T.length>y;++y)k[31&T[y]]++;for(y=0;f.length>y;++y)k[31&f[y]]++;for(var x=ji(k,7),I=x[0],C=x[1],M=19;M>4&&!I[bs[M-1]];--M);var A,L,K,Z,oe=c+5<<3,G=wt(s,Xe)+wt(n,bi)+a,te=wt(s,d)+wt(n,g)+a+14+3*M+wt(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(G>=oe&&te>=oe)return Tr(t,u,e.subarray(l,l+c));if(Re(t,u,1+(G>te)),u+=2,G>te){A=Mt(d,_,0),L=d,K=Mt(g,R,0),Z=g;var de=Mt(I,C,0);for(Re(t,u,F-257),Re(t,u+5,S-1),Re(t,u+10,M-4),u+=14,y=0;M>y;++y)Re(t,u+3*y,I[bs[y]]);u+=3*M;for(var ve=[T,f],$e=0;2>$e;++$e){var ue=ve[$e];for(y=0;ue.length>y;++y)Re(t,u,de[me=31&ue[y]]),u+=I[me],me>15&&(Re(t,u,ue[y]>>>5&127),u+=ue[y]>>>12)}}else A=Io,L=Xe,K=To,Z=bi;for(y=0;o>y;++y)if(r[y]>255){var me;bt(t,u,A[257+(me=r[y]>>>18&31)]),u+=L[me+257],me>7&&(Re(t,u,r[y]>>>23&31),u+=Gr[me]);var ye=31&r[y];bt(t,u,K[ye]),u+=Z[ye],ye>3&&(bt(t,u,r[y]>>>5&8191),u+=Yr[ye])}else bt(t,u,A[r[y]]),u+=L[r[y]];return bt(t,u,A[256]),u+L[256]},Oo=new gt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Co=(function(){for(var e=new gt(256),t=0;256>t;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e})(),Hi=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Mo(e,t){t===void 0&&(t={});var i=(function(){var h=4294967295;return{p(d){for(var _=h,p=0;d.length>p;++p)_=Co[255&_^d[p]]^_>>>8;h=_},d(){return 4294967295^h}}})(),r=e.length;i.p(e);var s,n,a,o,l,c=(o=10+((s=t).filename&&s.filename.length+1||0),l=8,(function(h,d,_,p,g,R){var P=h.length,T=new ge(p+P+5*(1+Math.floor(P/7e3))+g),F=T.subarray(p,T.length-g),O=0;if(!d||8>P)for(var f=0;P>=f;f+=65535){var S=f+65535;P>S?O=Tr(F,O,h.subarray(f,S)):(F[f]=!0,O=Tr(F,O,h.subarray(f,P)))}else{for(var k=Oo[d-1],y=k>>>13,x=8191&k,I=(1<<_)-1,C=new ae(32768),M=new ae(I+1),A=Math.ceil(_/3),L=2*A,K=function(Ri){return(h[Ri]^h[Ri+1]<<A^h[Ri+2]<<L)&I},Z=new gt(25e3),oe=new ae(288),G=new ae(32),te=0,de=0,ve=(f=0,0),$e=0,ue=0;P>f;++f){var me=K(f),ye=32767&f,Je=M[me];if(C[ye]=Je,M[me]=ye,f>=$e){var zt=P-f;if((te>7e3||ve>24576)&&zt>423){O=xs(h,F,0,Z,oe,G,de,ve,ue,f-ue,O),ve=te=de=0,ue=f;for(var be=0;286>be;++be)oe[be]=0;for(be=0;30>be;++be)G[be]=0}var je=2,Vt=0,pa=x,Ae=ye-Je&32767;if(zt>2&&me==K(f-Ae))for(var _a=Math.min(y,zt)-1,ga=Math.min(32767,f),fa=Math.min(258,zt);ga>=Ae&&--pa&&ye!=Je;){if(h[f+je]==h[f+je-Ae]){for(var Le=0;fa>Le&&h[f+Le]==h[f+Le-Ae];++Le);if(Le>je){if(je=Le,Vt=Ae,Le>_a)break;var ma=Math.min(Ae,Le-2),Zr=0;for(be=0;ma>be;++be){var $i=f-Ae+be+32768&32767,Qr=$i-C[$i]+32768&32767;Qr>Zr&&(Zr=Qr,Je=$i)}}}Ae+=(ye=Je)-(Je=C[ye])+32768&32767}if(Vt){Z[ve++]=268435456|Rr[je]<<18|ws[Vt];var es=31&Rr[je],ts=31&ws[Vt];de+=Gr[es]+Yr[ts],++oe[257+es],++G[ts],$e=f+je,++te}else Z[ve++]=h[f],++oe[h[f]]}}O=xs(h,F,!0,Z,oe,G,de,ve,ue,f-ue,O)}return Qn(T,0,p+Zn(O)+g)})(n=e,(a=t).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+a.mem,o,l)),u=c.length;return(function(h,d){var _=d.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>d.level?4:d.level==9?2:0,h[9]=3,d.mtime!=0&&Hi(h,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),_){h[3]=8;for(var p=0;_.length>=p;++p)h[p+10]=_.charCodeAt(p)}})(c,t),Hi(c,u-8,i.d()),Hi(c,u-4,r),c}var Ao=!!Zi||!!Ji,ea="text/plain",ks=!1,Si=function(e,t,i){var r;i===void 0&&(i=!0);var[s,n]=e.split("?"),a=m({},t),o=(r=n?.split("&").map((c=>{var u,[h,d]=c.split("="),_=i&&(u=a[h])!==null&&u!==void 0?u:d;return delete a[h],h+"="+_})))!==null&&r!==void 0?r:[],l=(function(c,u){var h,d;u===void 0&&(u="&");var _=[];return j(c,(function(p,g){E(p)||E(g)||g==="undefined"||(h=encodeURIComponent((R=>R instanceof File)(p)?p.name:p.toString()),d=encodeURIComponent(g),_[_.length]=d+"="+h)})),_.join(u)})(a);return l&&o.push(l),s+"?"+o.join("&")},ut=(e,t)=>JSON.stringify(e,((i,r)=>typeof r=="bigint"?r.toString():r),t),zi=e=>{if(e.tr)return e.tr;var{data:t,compression:i}=e;if(t){if(i===xe.GZipJS){var r=Mo((function(a,o){var l=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var c=new ge(a.length+(a.length>>>1)),u=0,h=function(g){c[u++]=g},d=0;l>d;++d){if(u+5>c.length){var _=new ge(u+8+(l-d<<1));_.set(c),c=_}var p=a.charCodeAt(d);128>p?h(p):2048>p?(h(192|p>>>6),h(128|63&p)):p>55295&&57344>p?(h(240|(p=65536+(1047552&p)|1023&a.charCodeAt(++d))>>>18),h(128|p>>>12&63),h(128|p>>>6&63),h(128|63&p)):(h(224|p>>>12),h(128|p>>>6&63),h(128|63&p))}return Qn(c,0,u)})(ut(t)),{mtime:0});return{contentType:ea,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===xe.Base64){var s=(a=>"data="+encodeURIComponent(typeof a=="string"?a:ut(a)))((function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,((o,l)=>String.fromCharCode(parseInt(l,16)))))})(ut(t)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=ut(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Lo=(function(){var e=_e((function*(t){var i=yield(function(s,n,a){return Qi.apply(this,arguments)})(ut(t.data),ne.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return m({},t,{tr:{contentType:ea,body:r,estimatedSize:r.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),Ss=(e,t)=>Si(e,{_:new Date().getTime().toString(),ver:ne.JS_SDK_VERSION,compression:t}),ri=[];Ji&&ri.push({transport:"fetch",method(e){var t,i,{contentType:r,body:s,estimatedSize:n}=(t=zi(e))!==null&&t!==void 0?t:{},a=new Headers;j(e.headers,(function(u,h){a.append(h,u)})),r&&a.append("Content-Type",r);var o=e.url,l=null;if(is){var c=new is;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}Ji(o,m({method:e?.method||"GET",headers:a,keepalive:e.method==="POST"&&52428.8>(n||0),body:s,signal:(i=l)==null?void 0:i.signal},e.fetchOptions)).then((u=>u.text().then((h=>{var d={statusCode:u.status,text:h};if(u.status===200)try{d.json=JSON.parse(h)}catch(_){w.error(_)}e.callback==null||e.callback(d)})))).catch((u=>{w.error(u),e.callback==null||e.callback({statusCode:0,error:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Zi&&ri.push({transport:"XHR",method(e){var t,i=new Zi;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=(t=zi(e))!==null&&t!==void 0?t:{};j(e.headers,(function(n,a){i.setRequestHeader(a,n)})),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(i.readyState===4){var n={statusCode:i.status,text:i.responseText};if(i.status===200)try{n.json=JSON.parse(i.responseText)}catch{}e.callback==null||e.callback(n)}},i.send(s)}}),ce!=null&&ce.sendBeacon&&ri.push({transport:"sendBeacon",method(e){var t=Si(e.url,{beacon:"1"});try{var i,{contentType:r,body:s}=(i=zi(e))!==null&&i!==void 0?i:{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});ce.sendBeacon(t,n)}catch{}}});var Or=3e3,qo=class{constructor(e,t){this.Ar=!0,this.Nr=[],this.$r=Pe(t?.flush_interval_ms||Or,250,5e3,w.createLogger("flush interval"),Or),this.Dr=e}enqueue(e){this.Nr.push(e),this.qr||this.jr()}unload(){this.Hr();var e=this.Nr.length>0?this.Ur():{},t=Object.values(e);[...t.filter((i=>i.url.indexOf("/e")===0)),...t.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Dr(m({},i,{transport:"sendBeacon"}))}))}enable(){this.Ar=!1,this.jr()}jr(){var e=this;this.Ar||(this.qr=setTimeout((()=>{if(this.Hr(),this.Nr.length>0){var t=this.Ur(),i=function(){var s=t[r],n=new Date().getTime();s.data&&D(s.data)&&j(s.data,(a=>{a.offset=Math.abs(a.timestamp-n),delete a.timestamp})),e.Dr(s)};for(var r in t)i()}}),this.$r))}Hr(){clearTimeout(this.qr),this.qr=void 0}Ur(){var e={};return j(this.Nr,(t=>{var i,r=t,s=(r?r.batchKey:null)||r.url;E(e[s])&&(e[s]=m({},r,{data:[]})),(i=e[s].data)==null||i.push(r.data)})),this.Nr=[],e}},No=["retriesPerformedSoFar"],Do=class{constructor(e){this.Br=!1,this.zr=3e3,this.Nr=[],this._instance=e,this.Nr=[],this.Vr=!0,!E(v)&&"onLine"in v.navigator&&(this.Vr=v.navigator.onLine,this.Wr=()=>{this.Vr=!0,this.Zr()},this.Gr=()=>{this.Vr=!1},X(v,"online",this.Wr),X(v,"offline",this.Gr))}get length(){return this.Nr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=sn(e,No);rt(t)&&(i.url=Si(i.url,{retry_count:t})),this._instance._send_request(m({},i,{callback:r=>{r.statusCode===200||r.statusCode>=400&&500>r.statusCode||(t??0)>=10?i.callback==null||i.callback(r):this.Qr(m({retriesPerformedSoFar:t},i))}}))}Qr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(n){var a=3e3*Math.pow(2,n),o=a/2,l=Math.min(18e5,a),c=Math.random()-.5;return Math.ceil(l+c*(l-o))})(t),r=Date.now()+i;this.Nr.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),w.warn(s),this.Br||(this.Br=!0,this.Jr())}Jr(){if(this.Kr&&clearTimeout(this.Kr),this.Nr.length===0)return this.Br=!1,void(this.Kr=void 0);this.Kr=setTimeout((()=>{this.Vr&&this.Nr.length>0&&this.Zr(),this.Jr()}),this.zr)}Zr(){var e=Date.now(),t=[],i=this.Nr.filter((s=>e>s.retryAt||(t.push(s),!1)));if(this.Nr=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Kr&&(clearTimeout(this.Kr),this.Kr=void 0),this.Br=!1,E(v)||(this.Wr&&(v.removeEventListener("online",this.Wr),this.Wr=void 0),this.Gr&&(v.removeEventListener("offline",this.Gr),this.Gr=void 0)),this.Nr))try{this._instance._send_request(m({},e,{transport:"sendBeacon"}))}catch(t){w.error(t)}this.Nr=[]}},Uo=class{constructor(e){this.Yr=()=>{var t,i,r,s;this.Xr||(this.Xr={});var n=this.scrollElement(),a=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=a+(n?.clientHeight||0),c=n?.scrollHeight||0;this.Xr.lastScrollY=Math.ceil(a),this.Xr.maxScrollY=Math.max(a,(t=this.Xr.maxScrollY)!==null&&t!==void 0?t:0),this.Xr.maxScrollHeight=Math.max(o,(i=this.Xr.maxScrollHeight)!==null&&i!==void 0?i:0),this.Xr.lastContentY=l,this.Xr.maxContentY=Math.max(l,(r=this.Xr.maxContentY)!==null&&r!==void 0?r:0),this.Xr.maxContentHeight=Math.max(c,(s=this.Xr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get ei(){return this._instance.config.scroll_root_selector}getContext(){return this.Xr}resetContext(){var e=this.Xr;return setTimeout(this.Yr,0),e}startMeasuringScrollPosition(){X(v,"scroll",this.Yr,{capture:!0}),X(v,"scrollend",this.Yr,{capture:!0}),X(v,"resize",this.Yr)}scrollElement(){if(!this.ei)return v?.document.documentElement;for(var e of D(this.ei)?this.ei:[this.ei]){var t=v?.document.querySelector(e);if(t)return t}}scrollY(){if(this.ei){var e=this.scrollElement();return e&&e.scrollTop||0}return v&&(v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop)||0}scrollX(){if(this.ei){var e=this.scrollElement();return e&&e.scrollLeft||0}return v&&(v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft)||0}},jo=e=>Bn(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties),Ps=class{constructor(e,t,i,r){this.ti=s=>{var n=this.ri();if(!n||n.sessionId!==s){var a={sessionId:s,props:this.ii(this._instance)};this.ni.register({[br]:a})}},this._instance=e,this.si=t,this.ni=i,this.ii=r||jo,this.si.onSessionId(this.ti)}ri(){return this.ni.props[br]}getSetOnceProps(){var e,t=(e=this.ri())==null?void 0:e.props;return t?"r"in t?Gn(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 j(Br(this.getSetOnceProps()),((t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+er(i)]=t})),e}},Xr=class{constructor(){this.oi={}}on(e,t){return this.oi[e]||(this.oi[e]=[]),this.oi[e].push(t),()=>{this.oi[e]=this.oi[e].filter((i=>i!==t))}}emit(e,t){for(var i of this.oi[e]||[])i(t);for(var r of this.oi["*"]||[])r(e,t)}},Vi=z("[SessionId]"),$s=class{on(e,t){return this.ai.on(e,t)}constructor(e,t,i){var r;if(this.ui=[],this.li=void 0,this.ai=new Xr,this.hi=(l,c)=>!(!rt(l)||!rt(c))&&Math.abs(l-c)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Oe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=e.config,this.ni=e.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=t||Ue,this.fi=i||Ue;var s=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*Pe(this.qt.session_idle_timeout_seconds||1800,60,36e3,Vi.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+s+"_window_id",this.mi="ph_"+s+"_primary_window_exists",this.yi()){var n=ee.F(this.gi),a=ee.F(this.mi);n&&!a?this.ci=n:ee.q(this.gi),ee.N(this.mi,!0)}if((r=this.qt.bootstrap)!=null&&r.sessionID)try{var o=(l=>{var c=this.qt.bootstrap.sessionID.replace(/-/g,"");if(c.length!==32)throw new Error("Not a valid UUID");if(c[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(c.substring(0,12),16)})();this.bi(this.qt.bootstrap.sessionID,new Date().getTime(),o)}catch(l){Vi.error("Invalid sessionID in bootstrap",l)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return E(this.ui)&&(this.ui=[]),this.ui.push(e),this.di&&e(this.di,this.ci),()=>{this.ui=this.ui.filter((t=>t!==e))}}yi(){return this.qt.persistence!=="memory"&&!this.ni._r&&ee.R()}xi(e){e!==this.ci&&(this.ci=e,this.yi()&&ee.N(this.gi,e))}Si(){return this.ci?this.ci:this.yi()?ee.F(this.gi):null}bi(e,t,i){e===this.di&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.di=e,this.ni.register({[ci]:[t,e,i]}))}ki(){var e=this.ni.props[ci];return D(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.bi(null,null,null)}destroy(){clearTimeout(this.Ci),this.Ci=void 0,this.li&&v&&(v.removeEventListener(_i,this.li,{capture:!1}),this.li=void 0),this.ui=[]}wi(){this.li=()=>{this.yi()&&ee.q(this.mi)},X(v,_i,this.li,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.qt.cookieless_mode===Oe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[r,s,n]=this.ki(),a=this.Si(),o=rt(n)&&Math.abs(i-n)>864e5,l=!1,c=!s,u=!c&&!e&&this.hi(i,r);c||u||o?(s=this.vi(),a=this.fi(),Vi.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:o}}),n=i,l=!0):a||(a=this.fi(),l=!0);var h=rt(r)&&e&&!o?r:i,d=rt(n)?n:new Date().getTime();return this.xi(a),this.bi(s,h,d),e||this.pi(),l&&this.ui.forEach((_=>_(s,a,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:o}:void 0))),{sessionId:s,windowId:a,sessionStartTimestamp:d,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:o}:void 0,lastActivityTimestamp:r}}pi(){clearTimeout(this.Ci),this.Ci=setTimeout((()=>{var[e]=this.ki();if(this.hi(new Date().getTime(),e)){var t=this.di;this.resetSessionId(),this.ai.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},ta=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&ns(i,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((s=>ns(s?.brand,t))))return!0}catch{}return!!e.webdriver},wi=function(e,t){if(!(function(i){try{new RegExp(i)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function Rs(e,t,i){return ut({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var ia={exact:(e,t)=>t.some((i=>e.some((r=>i===r)))),is_not:(e,t)=>t.every((i=>e.every((r=>i!==r)))),regex:(e,t)=>t.some((i=>e.some((r=>wi(i,r))))),not_regex:(e,t)=>t.every((i=>e.every((r=>!wi(i,r))))),icontains:(e,t)=>t.map(Jt).some((i=>e.map(Jt).some((r=>i.includes(r))))),not_icontains:(e,t)=>t.map(Jt).every((i=>e.map(Jt).every((r=>!i.includes(r))))),gt:(e,t)=>t.some((i=>{var r=parseFloat(i);return!isNaN(r)&&e.some((s=>r>parseFloat(s)))})),lt:(e,t)=>t.some((i=>{var r=parseFloat(i);return!isNaN(r)&&e.some((s=>r<parseFloat(s)))}))},Jt=e=>e.toLowerCase();function ra(e,t){return!e||Object.entries(e).every((i=>{var[r,s]=i,n=t?.[r];if(E(n)||Me(n))return!1;var a=[String(n)],o=ia[s.operator];return!!o&&o(s.values,a)}))}var Cr="custom",Fs="i.posthog.com",Ho=/^\/static\//,zo=class{constructor(e){this.Ii={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"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=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Fs,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Ii[this.apiHost]||(this.Ii[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Cr),this.Ii[this.apiHost]}Ti(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof t=="string"&&Ho.test(e))return t.trim().replace(/\/$/,"")||void 0}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(e==="assets"){var i=this.Ti(t);if(i)return""+i+t}if(this.region===Cr)return this.apiHost+t;var r=Fs+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}},U=z("[Surveys]"),Mr="seenSurvey_",Vo=[Di.Popover,Di.Widget,Di.API],Wo={ignoreConditions:!1,ignoreDelay:!1,displayType:$r.Popover},Bo=z("[PostHog ExternalIntegrations]"),Go={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Yo=class{constructor(e){this._instance=e}lr(e,t){var i;(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(r=>{if(r)return Bo.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(n){var a,o,l;!r||(a=$.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[n]||e.lr(Go[n],(()=>{var c;(c=$.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[n])==null||c.start(e._instance)})),!r&&(o=$.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[n]&&((l=$.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[n])==null||l.stop())};for(var[i,r]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;t(i)}}},tt,At={},Wi=0,Ar=()=>{},Is='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Et="Surveys module not available",Ts="sanitize_properties is deprecated. Use before_send instead",sa="Invalid value for property_denylist config: ",at="posthog",na=!Ao&&le?.indexOf("MSIE")===-1&&le?.indexOf("Mozilla")===-1,Os=e=>{var t;return m({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:uo(b?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ar,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:Q&&W(Q?.search)&&Q.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(t=v.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(i){w.error("Bad HTTP status: "+i.statusCode+" "+i.text)},get_device_id:i=>i,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Sr,before_send:void 0,request_queue_config:{flush_interval_ms:Or},error_tracking:{},_onCapture:Ar,__preview_eager_load_replay:!1},(i=>({rageclick:!i||"2025-11-30">i||{content_ignorelist:!0},capture_pageview:!i||"2025-05-24">i||"history_change",session_recording:i&&i>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:i&&i>="2026-01-30"?"head":"body",internal_or_test_user_hostname:i&&i>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},Xo=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Cs=e=>{var t={};for(var[i,r]of Xo)E(e[i])||(t[r]=e[i]);var s=B({},t,e);return D(e.property_blacklist)&&(E(e.property_denylist)?s.property_denylist=e.property_blacklist:D(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:w.error(sa+e.property_denylist)),s},Ko=class{constructor(){this.__forceAllowLocalhost=!1}get Ei(){return this.__forceAllowLocalhost}set Ei(e){w.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Lt=class Ge{Mi(t,i){if(t){var r=this.Pi.indexOf(t);r!==-1&&this.Pi.splice(r,1)}return this.Pi.push(i),i.initialize==null||i.initialize(),i}Ri(){return this.config.cookieless_mode===Oe||this.config.cookieless_mode===Be&&this.consent.isRejected()}get decideEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)==null?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)==null?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new Ko,this.Oi=!1,this.version=ne.LIB_VERSION,this.Li=new Xr,this.Pi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Os(),this.SentryIntegration=wo,this.sentryIntegration=r=>(function(s,n){var a=jn(s,n);return{name:Un,processEvent:o=>a(o)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Ai=null,this.Ni=null,this.$i=null,this.scrollManager=new Uo(this),this.pageViewManager=new gs(this),this.rateLimiter=new Fo(this),this.requestRouter=new zo(this),this.consent=new mo(this),this.externalIntegrations=new Yo(this);var i=(t=Ge.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(r,s,n)=>{var a=W(r)?{[r]:s}:r;this.setPersonProperties(a),n?.({})},set_once:(r,s,n)=>{var a=W(r)?{[r]:s}:r;this.setPersonProperties(void 0,a),n?.({})}},this.on("eventCaptured",(r=>w.info('send "'+r?.event+'"',r)))}init(t,i,r){if(r&&r!==at){var s,n=(s=At[r])!==null&&s!==void 0?s:new Ge;return n._init(t,i,r),At[r]=n,At[at][r]=n,n}return this._init(t,i,r)}_init(t,i,r){var s,n;if(i===void 0&&(i={}),E(t)||Qt(t))return w.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={},i.debug=this.Di(i.debug),this.qi=i,this.ji=[],i.person_profiles?this.Ni=i.person_profiles:i.process_person&&(this.Ni=i.process_person),this.set_config(B({},Os(i.defaults),Cs(i),{name:r,token:t})),this.config.on_xhr_error&&w.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:xe.GZipJS;var a=this.Hi();this.persistence=new Ni(this.config,a),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ni(m({},this.config,{persistence:"sessionStorage"}),a);var o=m({},this.persistence.props),l=m({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ui=new qo((R=>this.Bi(R)),this.config.request_queue_config),this.zi=new Do(this),this.__request_queue=[];var c=this.Ri();if(c||(this.sessionManager=new $s(this),this.sessionPropsManager=new Ps(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(w.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Vi(c)}),0)):(w.info("Initializing extensions synchronously"),this.Vi(c)),ne.DEBUG=ne.DEBUG||this.config.debug,ne.DEBUG&&w.info("Starting in debug mode",{this:this,config:i,thisC:m({},this.config),p:o,s:l}),!this.config.identity_distinct_id||(s=i.bootstrap)!=null&&s.distinctID||(i.bootstrap=m({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((n=i.bootstrap)==null?void 0:n.distinctID)!==void 0){var u=i.bootstrap.distinctID,h=this.get_distinct_id(),d=this.persistence.get_property(we);if(i.bootstrap.isIdentifiedID&&h!=null&&h!==u&&d===Ze)this.identify(u);else if(i.bootstrap.isIdentifiedID&&h!=null&&h!==u&&d===Qe)w.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var _=this.config.get_device_id(Ue()),p=i.bootstrap.isIdentifiedID?_:u;this.persistence.set_property(we,i.bootstrap.isIdentifiedID?Qe:Ze),this.register({distinct_id:u,$device_id:p})}}if(c)this.register_once({distinct_id:Bt,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(Ue());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(we,Ze)}return X(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?(function(R,P){var T=R.config.segment;if(!T)return P();(function(F,O){var f=F.config.segment;if(!f)return O();var S=y=>{var x=()=>y.anonymousId()||Ue();F.config.get_device_id=x,y.id()&&(F.register({distinct_id:y.id(),$device_id:x()}),F.persistence.set_property(we,Qe)),O()},k=f.user();"then"in k&&Te(k.then)?k.then(S):S(k)})(R,(()=>{T.register((F=>{Promise&&Promise.resolve||qi.warn("This browser does not have Promise support, and can not use the segment integration");var O=(f,S)=>{if(!S)return f;f.event.userId||f.event.anonymousId===F.get_distinct_id()||(qi.info("No userId set, resetting PostHog"),F.reset()),f.event.userId&&f.event.userId!==F.get_distinct_id()&&(qi.info("UserId set, identifying with PostHog"),F.identify(f.event.userId));var k=F.calculateEventProperties(S,f.event.properties);return f.event.properties=Object.assign({},k,f.event.properties),f};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:f=>O(f,f.event.event),page:f=>O(f,nt),identify:f=>O(f,Ai),screen:f=>O(f,"$screen")}})(R)).then((()=>{P()}))}))})(this,(()=>this.Wi())):this.Wi(),Te(this.config._onCapture)&&this.config._onCapture!==Ar&&(w.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(R=>this.config._onCapture(R.event,R)))),this.config.ip&&w.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}Vi(t){var i,r,s,n,a,o,l,c=performance.now(),u=m({},Ge.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.Pi.push(this.featureFlags=(i=this.featureFlags)!==null&&i!==void 0?i:new u.featureFlags(this)),u.exceptions&&this.Pi.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new u.exceptions(this)),u.historyAutocapture&&this.Pi.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Pi.push(new u.tracingHeaders(this)),u.siteApps&&this.Pi.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Pi.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Pi.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Pi.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new u.surveys(this)),u.logs&&this.Pi.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new u.logs(this)),u.conversations&&this.Pi.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new u.conversations(this)),u.productTours&&this.Pi.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Pi.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Pi.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Pi.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Pi.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,bo)),u.toolbar&&this.Pi.push(this.toolbar=(o=this.toolbar)!==null&&o!==void 0?o:new u.toolbar(this)),u.experiments&&this.Pi.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new u.experiments(this)),this.Pi.forEach((d=>{d.initialize&&h.push((()=>{d.initialize==null||d.initialize()}))})),h.push((()=>{if(this.Zi){var d=this.Zi;this.Zi=void 0,this.Rr(d)}})),this.Gi(h,c)}Gi(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.Gi(t,i)}),0);var r=t.shift();if(r)try{r()}catch(n){w.error("Error initializing extension:",n)}}var s=Math.round(performance.now()-i);this.register_for_session({[An]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ln]:s}),this.config.__preview_deferred_init_extensions&&w.info("PostHog extensions initialized ("+s+"ms)")}Rr(t){var i;if(!b||!b.body)return w.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Rr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Zi=t),this.Qi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=q(t.supportedCompression,xe.GZipJS)?xe.GZipJS:q(t.supportedCompression,xe.Base64)?xe.Base64:void 0),(i=t.analytics)!=null&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Ni?this.Ni:Sr}),this.Pi.forEach((r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(t)))}Wi(){try{this.config.loaded(this)}catch(r){w.critical("`loaded` function failed",r)}if(this.Ji(),this.config.internal_or_test_user_hostname&&Q!=null&&Q.hostname){var t=Q.hostname,i=this.config.internal_or_test_user_hostname;(typeof i=="string"?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ri())&&this.Ki()}),1),this.Yi=new Xn(this),this.Yi.load()}Ji(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Ui)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Gt(this.__request_queue,(t=>this.Bi(t))),this.__request_queue=[],this.Ji()}_handle_unload(){var t,i,r,s;(t=this.surveys)==null||t.handlePageUnload(),this.config.request_batching?(this.Xi()&&this.capture(Mi),(i=this.logs)==null||i.flushLogs("sendBeacon"),(r=this.Ui)==null||r.unload(),(s=this.zi)==null||s.unload()):this.Xi()&&this.capture(Mi,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(na?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Si(t.url,{ip:this.config.ip?1:0}),t.headers=m({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(i=>{var r,s,n,a=m({},i);a.timeout=a.timeout||6e4,a.url=Ss(a.url,a.compression);var o=(r=a.transport)!==null&&r!==void 0?r:"fetch",l=ri.filter((u=>!a.disableTransport||!u.transport||!a.disableTransport.includes(u.transport))),c=(s=(n=(function(u,h){for(var d=0;u.length>d;d++)if(u[d].transport===o)return u[d]})(l))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!c)throw new Error("No available transport method");o!=="sendBeacon"&&a.data&&a.compression===xe.GZipJS&&ya&&!ks?Lo(a).then((u=>{c(u)})).catch((u=>{if((h=>!(!h||typeof h!="object")&&("name"in h?String(h.name):"")==="NotReadableError")(u))return ks=!0,void c(m({},a,{compression:void 0,url:Ss(i.url,void 0)}));c(a)})):c(a)})(m({},t,{callback:i=>{var r,s;this.rateLimiter.checkForLimiting(i),400>i.statusCode||(r=(s=this.config).on_request_error)==null||r.call(s,i),t.callback==null||t.callback(i)}}))))}Bi(t){this.zi?this.zi.retriableRequest(t):this._send_request(t)}_execute_array(t){Wi++;try{var i,r=[],s=[],n=[];Gt(t,(o=>{o&&(D(i=o[0])?n.push(o):Te(o)?o.call(this):D(o)&&i==="alias"?r.push(o):D(o)&&i.indexOf("capture")!==-1&&Te(this[i])?n.push(o):s.push(o))}));var a=function(o,l){Gt(o,(function(c){if(D(c[0])){var u=l;j(c,(function(h){u=u[h[0]].apply(u,h.slice(1))}))}else l[c[0]].apply(l,c.slice(1))}))};a(r,this),a(s,this),a(n,this)}finally{Wi--}}push(t){if(Wi>0&&D(t)&&W(t[0])){var i=Ge.prototype[t[0]];Te(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,r){var s,n,a,o,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ui){if(this.is_capturing())if(!E(t)&&W(t)){var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(!c||this.config.__preview_capture_bot_pageviews){var u=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(u==null||!u.isRateLimited){i!=null&&i.$current_url&&!W(i?.$current_url)&&(w.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),i==null||delete i.$current_url),t!=="$exception"||r!=null&&r.en||w.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=r?.timestamp||h,_=Ue(),p={uuid:_,event:t,properties:this.calculateEventProperties(t,i||{},d,_)};t===nt&&this.config.__preview_capture_bot_pageviews&&c&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),r!=null&&r.$set&&(p.$set=r?.$set);var g,R,P,T=this.tn(r?.$set_once,t!==ds,t===Ai);if(T&&(p.$set_once=T),r!=null&&r._noTruncate||(n=this.config.properties_string_max_length,a=p,o=x=>W(x)?x.slice(0,n):x,l=new Set,p=(function x(I,C){return I!==Object(I)?o?o(I):I:l.has(I)?void 0:(l.add(I),D(I)?(M=[],Gt(I,(A=>{M.push(x(A))}))):(M={},j(I,((A,L)=>{l.has(A)||(M[L]=x(A,L))}))),M);var M})(a)),p.timestamp=d,E(r?.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=h),t===Tt.DISMISSED||t===Tt.SENT){var F=i?.[Ui.SURVEY_ID],O=i?.[Ui.SURVEY_ITERATION];(x=>{try{var I=(C=>((M,A)=>{var L=""+Mr+A.id;return A.current_iteration&&A.current_iteration>0&&(L=""+Mr+A.id+"_"+A.current_iteration),L})(0,C))(x);if(localStorage.getItem(I))return;localStorage.setItem(I,"true")}catch(C){U.error("Failed to persist survey seen state",C)}})({id:F,current_iteration:O}),p.$set=m({},p.$set,{[(g={id:F,current_iteration:O},R=t===Tt.SENT?"responded":"dismissed",P="$survey_"+R+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(P="$survey_"+R+"/"+g.id+"/"+g.current_iteration),P)]:!0})}else t===Tt.SHOWN&&(p.$set=m({},p.$set,{[Ui.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===Ro.SHOWN){var f=i?.[ms.TOUR_TYPE];f&&(p.$set=m({},p.$set,{[ms.TOUR_LAST_SEEN_DATE+"/"+f]:new Date().toISOString()}))}var S=m({},p.properties.$set,p.$set);if(ot(S)||this.setPersonPropertiesForFlags(S),!N(this.config.before_send)){var k=this.rn(p);if(!k)return;p=k}this.Li.emit("eventCaptured",p);var y={method:"POST",url:(s=r?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Bi(y):this.Ui.enqueue(y),p}w.critical("This capture call is ignored due to client rate limiting.")}}else w.error("No event name provided to posthog.capture")}else w.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,r,s,n){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;var a=n?void 0:this.persistence.remove_event_timer(t),o=m({},i);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Ri()&&(o.$cookieless_mode=!0),t==="$snapshot"){var l=m({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!W(o.distinct_id)&&!fe(o.distinct_id)||Qt(o.distinct_id))&&w.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var c,u=(function(P,T){var F,O,f,S;if(!le)return{};var k,y,x,I,C,M,A,L,K=P?[..._t,...T||[]]:[],[Z,oe]=(function(G){for(var te=0;ls.length>te;te++){var[de,ve]=ls[te],$e=de.exec(G),ue=$e&&(Te(ve)?ve($e,G):ve);if(ue)return ue}return["",""]})(le);return B(Br({$os:Z,$os_version:oe,$browser:xn(le,navigator.vendor),$device:us(le),$device_type:(y=le,x={userAgentDataPlatform:(F=navigator)==null||(F=F.userAgentData)==null?void 0:F.platform,maxTouchPoints:(O=navigator)==null?void 0:O.maxTouchPoints,screenWidth:v==null||(f=v.screen)==null?void 0:f.width,screenHeight:v==null||(S=v.screen)==null?void 0:S.height,devicePixelRatio:v?.devicePixelRatio},L=us(y),L===un||L===ln||L==="Kobo"||L==="Kindle Fire"||L===En?dt:L===Nt||L===ht||L===Dt||L===ir?"Console":L===hn?"Wearable":L?he:x?.userAgentDataPlatform==="Android"&&((I=x?.maxTouchPoints)!==null&&I!==void 0?I:0)>0?600>Math.min((C=x?.screenWidth)!==null&&C!==void 0?C:0,(M=x?.screenHeight)!==null&&M!==void 0?M:0)/((A=x?.devicePixelRatio)!==null&&A!==void 0?A:1)?he:dt:"Desktop"),$timezone:Yn(),$timezone_offset:Po()}),{$current_url:Ut(Q?.href,K,jt),$host:Q?.host,$pathname:Q?.pathname,$raw_user_agent:le.length>1e3?le.substring(0,997)+"...":le,$browser_version:Aa(le,navigator.vendor),$browser_language:fs(),$browser_language_prefix:(k=fs(),typeof k=="string"?k.split("-")[0]:void 0),$screen_height:v?.screen.height,$screen_width:v?.screen.width,$viewport_height:v?.innerHeight,$viewport_width:v?.innerWidth,$lib:ne.LIB_NAME,$lib_version:ne.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(n,r.getTime());o.$session_id=h,o.$window_id=d}this.sessionPropsManager&&B(o,this.sessionPropsManager.getSessionProps());try{var _;this.sessionRecording&&B(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(_=this.zi)==null?void 0:_.length}catch(P){o.$sdk_debug_error_capturing_properties=String(P)}if(this.requestRouter.region===Cr&&(o.$lib_custom_api_host=this.config.api_host),c=t!==nt||n?t!==Mi||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),o=B(o,c),t===nt&&b&&(o.title=b.title),!E(a)){var p=r.getTime()-a;o.$duration=parseFloat((p/1e3).toFixed(3))}le&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=B({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),D(this.config.property_denylist)?j(this.config.property_denylist,(function(P){delete o[P]})):w.error(sa+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(w.error(Ts),o=g(o,t));var R=this.nn();return o.$process_person_profile=R,R&&!n&&this.sn("_calculate_event_properties"),o}tn(t,i,r){var s;if(i===void 0&&(i=!0),r===void 0&&(r=!1),!this.persistence||!this.nn()||this.Oi&&!r)return t;var n=B({},this.persistence.get_initial_props(),((s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps())||{},t||{}),a=this.config.sanitize_properties;return a&&(w.error(Ts),n=a(n,"$set_once")),i&&(this.Oi=!0),ot(n)?void 0:n}register(t,i){var r;(r=this.persistence)==null||r.register(t,i)}register_once(t,i,r){var s;(s=this.persistence)==null||s.register_once(t,i,r)}register_for_session(t){var i;(i=this.sessionPersistence)==null||i.register(t)}unregister(t){var i;(i=this.persistence)==null||i.unregister(t)}unregister_for_session(t){var i;(i=this.sessionPersistence)==null||i.unregister(t)}an(t,i){this.register({[t]:i})}getFeatureFlag(t,i){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,i)}isFeatureEnabled(t,i){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(t,i)}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,i,r){var s;(s=this.featureFlags)==null||s.updateFlags(t,i,r)}updateEarlyAccessFeatureEnrollment(t,i,r){var s;(s=this.featureFlags)==null||s.updateEarlyAccessFeatureEnrollment(t,i,r)}getEarlyAccessFeatures(t,i,r){var s;return i===void 0&&(i=!1),(s=this.featureFlags)==null?void 0:s.getEarlyAccessFeatures(t,i,r)}on(t,i){return this.Li.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Et}),()=>{})}onSessionId(t){var i,r;return(i=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&i!==void 0?i:()=>{}}getSurveys(t,i){i===void 0&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Et})}getActiveMatchingSurveys(t,i){i===void 0&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Et})}renderSurvey(t,i){var r;(r=this.surveys)==null||r.renderSurvey(t,i)}displaySurvey(t,i){var r;i===void 0&&(i=Wo),(r=this.surveys)==null||r.displaySurvey(t,i)}cancelPendingSurvey(t){var i;(i=this.surveys)==null||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,r;return(i=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&i!==void 0?i:{visible:!1,disabledReason:Et}}canRenderSurveyAsync(t,i){var r,s;return i===void 0&&(i=!1),(r=(s=this.surveys)==null?void 0:s.canRenderSurveyAsync(t,i))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:Et})}un(t){return!t||Qt(t)?(w.critical("Unique user id has not been set in posthog.identify"),!1):t===Bt?(w.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(w.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,r){if(!this.__loaded||!this.persistence)return w.uninitializedWarning("posthog.identify");if(fe(t)&&(t=t.toString(),w.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.un(t)&&this.sn("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:t}),this.get_property(ui)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),t!==s&&t!==this.get_property(Pt)&&(this.unregister(Pt),this.register({distinct_id:t}));var n,a=(this.persistence.get_property(we)||Ze)===Ze;t!==s&&a?(this.persistence.set_property(we,Qe),this.setPersonPropertiesForFlags({$set:i||{},$set_once:r||{}},!1),this.capture(Ai,{distinct_id:t,$anon_distinct_id:s},{$set:i||{},$set_once:r||{}}),this.$i=Rs(t,i,r),(n=this.featureFlags)==null||n.setAnonymousDistinctId(s)):(i||r)&&this.setPersonProperties(i,r),t!==s&&(this.reloadFeatureFlags(),this.unregister(Ct))}}setPersonProperties(t,i){if((t||i)&&this.sn("posthog.setPersonProperties")){var r=Rs(this.get_distinct_id(),t,i);this.$i!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.$i=r):w.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,r){if(t&&i){var s=this.getGroups(),n=s[t]!==i;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:m({},s,{[t]:i})}),n||r){var a={$group_type:t,$group_key:i};r&&(a.$group_set=r),this.capture(ds,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else w.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var r;i===void 0&&(i=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){var t;(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){var r;i===void 0&&(i=!0),this.sn("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;(i=this.featureFlags)==null||i.resetGroupPropertiesForFlags(t)}reset(t){var i,r,s,n,a,o,l,c;if(w.info("reset"),!this.__loaded)return w.uninitializedWarning("posthog.reset");var u=this.get_property(ui);if(this.consent.reset(),(i=this.persistence)==null||i.clear(),(r=this.sessionPersistence)==null||r.clear(),(s=this.surveys)==null||s.reset(),(n=this.Yi)==null||n.stop(),(a=this.featureFlags)==null||a.reset(),(o=this.conversations)==null||o.reset(),(l=this.persistence)==null||l.set_property(we,Ze),(c=this.sessionManager)==null||c.resetSessionId(),this.$i=null,this.config.cookieless_mode===Oe)this.register_once({distinct_id:Bt,$device_id:null},"");else{var h=this.config.get_device_id(Ue());this.register_once({distinct_id:h,$device_id:t?h:u},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,i){var r;this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),(r=this.conversations)==null||r.ln()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.hn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(t!=null&&t.withTimestamp&&r){var n,a=(n=t.timestampLookBack)!==null&&n!==void 0?n:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-a,0)}return s}alias(t,i){return t===this.get_property(Fn)?(w.critical("Attempting to create alias for existing People user - aborting."),-2):this.sn("posthog.alias")?(E(i)&&(i=this.get_distinct_id()),t!==i?(this.an(Pt,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(w.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=m({},this.config);if(Y(t)){var r,s,n,a,o,l,c,u,h,d;B(this.config,Cs(t));var _=this.Hi();(r=this.persistence)==null||r.update_config(this.config,i,_),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ni(m({},this.config,{persistence:"sessionStorage"}),_);var p=this.Di(this.config.debug);Se(p)&&(this.config.debug=p),Se(this.config.debug)&&(this.config.debug?(ne.DEBUG=!0,V.R()&&V.N("ph_debug",!0),w.info("set_config",{config:t,oldConfig:i,newConfig:m({},this.config)})):(ne.DEBUG=!1,V.R()&&V.q("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(n=this.exceptions)==null||n.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(l=this.heatmaps)==null||l.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(u=this.deadClicksAutocapture)==null||u.startIfEnabledOrStop(),(h=this.surveys)==null||h.loadIfEnabled(),this.cn(),(d=this.externalIntegrations)==null||d.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){ne.LIB_NAME=t,ne.LIB_VERSION=i}startSessionRecording(t){var i,r,s,n,a,o=t===!0,l={sampling:o||!(t==null||!t.sampling),linked_flag:o||!(t==null||!t.linked_flag),url_trigger:o||!(t==null||!t.url_trigger),event_trigger:o||!(t==null||!t.event_trigger)};Object.values(l).some(Boolean)&&((i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),l.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),l.linked_flag&&((s=this.sessionRecording)==null||s.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,i){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(m({},s,i))}}addExceptionStep(t,i){var r;(r=this.exceptions)==null||r.addExceptionStep(t,i)}captureLog(t){var i;(i=this.logs)==null||i.captureLog(t)}get logger(){var t,i;return(t=(i=this.logs)==null?void 0:i.logger)!==null&&t!==void 0?t:Ge.dn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,r;return(i=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&i!==void 0&&i}get_property(t){var i;return(i=this.persistence)==null?void 0:i.props[t]}getSessionProperty(t){var i;return(i=this.sessionPersistence)==null?void 0:i.props[t]}toString(){var t,i=(t=this.config.name)!==null&&t!==void 0?t:at;return i!==at&&(i=at+"."+i),i}_isIdentified(){var t,i;return((t=this.persistence)==null?void 0:t.get_property(we))===Qe||((i=this.sessionPersistence)==null?void 0:i.get_property(we))===Qe}nn(){var t,i;return!(this.config.person_profiles==="never"||this.config.person_profiles===Sr&&!this._isIdentified()&&ot(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Pt])&&((i=this.persistence)==null||(i=i.props)==null||!i[vi]))}Xi(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.nn()||this.sn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.sn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}sn(t){return this.config.person_profiles==="never"?(w.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.an(vi,!0),!0)}Hi(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Be)}cn(){var t,i,r,s,n=this.Hi();return((t=this.persistence)==null?void 0:t._r)!==n&&((r=this.persistence)==null||r.set_disabled(n)),((i=this.sessionPersistence)==null?void 0:i._r)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==Oe){if(this.Ri()){var r,s,n,a,o;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new $s(this),this.pageViewManager=new gs(this),this.persistence&&(this.sessionPropsManager=new Ps(this,this.sessionManager,this.persistence));var l,c=(n=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&n!==void 0?n:(o=Ge.__defaultExtensionClasses)==null?void 0:o.sessionRecording;c&&(this.sessionRecording=this.Mi(this.sessionRecording,new c(this)),this.Qi&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.Qi)))}var u,h;this.consent.optInOut(!0),this.cn(),this.Ji(),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),this.config.cookieless_mode==Be&&((u=this.surveys)==null||u.loadIfEnabled()),(E(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((h=t?.captureEventName)!==null&&h!==void 0?h:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ki()}else w.warn(Is)}opt_out_capturing(){var t,i,r;this.config.cookieless_mode!==Oe?(this.config.cookieless_mode===Be&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===Be&&(this.register({distinct_id:Bt,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(i=this.sessionManager)==null||i.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.Ki())):w.warn(Is)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Oe||(this.config.cookieless_mode===Be?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cn()}_is_bot(){return ce?ta(ce,this.config.custom_blocked_useragents):void 0}Ki(){b&&(b.visibilityState==="visible"?this.Fi||(this.Fi=!0,this.capture(nt,{title:b.title},{send_instantly:!0}),this.Ai&&(b.removeEventListener(pi,this.Ai),this.Ai=null)):this.Ai||(this.Ai=this.Ki.bind(this),X(b,pi,this.Ai)))}debug(t){t===!1?(v?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v?.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}))}Lr(){var t,i,r,s,n,a,o=this.qi||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(w.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):(r="advanced_disable_decide",s=w,n=(i="advanced_disable_flags")in(t=o)&&!N(t[i]),a=r in t&&!N(t[r]),n?t[i]:!!a&&(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[r]))}rn(t){if(N(this.config.before_send))return t;var i=D(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var s of i){if(r=s(r),N(r)){var n="Event '"+t.event+"' was rejected in beforeSend function";return xa(t.event)?w.warn(n+". This can cause unexpected behavior."):w.info(n),null}r.properties&&!ot(r.properties)||w.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var t;return(t=this.pageViewManager.dr)==null?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(r)})}Di(t){var i=Se(t)&&!t,r=V.R()&&V.A("ph_debug")==="true";return!i&&(!!r||t)}};Lt.__defaultExtensionClasses={},Lt.dn={trace:tt=()=>{},debug:tt,info:tt,warn:tt,error:tt,fatal:tt},(function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=oo(e.prototype[t[i]])})(Lt,["identify"]);var Jo=1,Zo=3,Qo=11;function Ms(e){return e instanceof Element&&(e.id===Mn||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Ke(e){return!!e&&e.nodeType===Jo}function Ee(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function aa(e){return!!e&&e.nodeType===Zo}function oa(e){return!!e&&e.nodeType===Qo&&Ke(e.host)}function Kr(e){return e?xi(e).split(/\s+/):[]}function As(e){var t=v?.location.href;return!!(t&&e&&e.some((i=>t.match(i))))}function Ei(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 Kr(t)}function la(e){return N(e)?null:xi(e).split(/(\s+)/).filter((t=>qt(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ht(e){var t="";return qr(e)&&!ca(e)&&e.childNodes&&e.childNodes.length&&j(e.childNodes,(function(i){var r;aa(i)&&i.textContent&&(t+=(r=la(i.textContent))!==null&&r!==void 0?r:"")})),xi(t)}function Ls(e){return E(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Jr=["a","button","form","input","select","textarea","label"];function qs(e,t){if(E(t))return!0;var i,r=function(n){if(t.some((a=>n.matches(a))))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function ua(e){var t=e.parentNode;return!(!t||!Ke(t))&&t}var el=["next","previous","prev",">","<"],Ns=[".ph-no-rageclick",".ph-no-capture"],Lr=e=>!e||Ee(e,"html")||!Ke(e),Ds=(e,t)=>{if(!v||Lr(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],s=e;s.parentNode&&!Ee(s,"body");)if(oa(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=ua(s);if(!n)break;if(t||Jr.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var a=v.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function qr(e){for(var t=e;t.parentNode&&!Ee(t,"body");t=t.parentNode){var i=Ei(t);if(q(i,"ph-sensitive")||q(i,"ph-no-capture"))return!1}if(q(Ei(e),"ph-include"))return!0;var r=e.type||"";if(W(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!W(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 ca(e){return!!(Ee(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ee(e,"select")||Ee(e,"textarea")||e.getAttribute("contenteditable")==="true")}var ha="(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})",tl=new RegExp("^(?:"+ha+")$"),il=new RegExp(ha),da="\\d{3}-?\\d{2}-?\\d{4}",rl=new RegExp("^("+da+")$"),sl=new RegExp("("+da+")");function qt(e,t){return t===void 0&&(t=!0),!(N(e)||W(e)&&(e=xi(e),(t?tl:il).test((e||"").replace(/[- ]/g,""))||(t?rl:sl).test(e)))}function Us(e){var t=Ht(e);return qt(t=(t+" "+va(e)).trim())?t:""}function va(e){var t="";return e&&e.childNodes&&e.childNodes.length&&j(e.childNodes,(function(i){var r;if(i&&((r=i.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=Ht(i);t=(t+" "+s).trim(),i.childNodes&&i.childNodes.length&&(t=(t+" "+va(i)).trim())}catch(n){w.error("[AutoCapture]",n)}})),t}function js(e){return e.replace(/"|\\"/g,'\\"')}function nl(e){var t=e.attr__class;return t?D(t)?t:Kr(t):void 0}var Hs=class{constructor(e){this.disabled=e===!1;var t=Y(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&&this.timeoutMs>i-r.timestamp){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}},Bi="$copy_autocapture",Gi=z("[AutoCapture]");function Yi(e,t){return t.length>e?t.slice(0,e)+"...":t}function al(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Ke(t));return t}function ol(e,t){var i,r,{e:s,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t;if(!Ke(e))return{props:{}};for(var c=[e],u=e;u.parentNode&&!Ee(u,"body");)if(oa(u.parentNode))c.push(u.parentNode.host),u=u.parentNode.host;else{if(!Ke(u.parentNode))break;c.push(u.parentNode),u=u.parentNode}var h,d,_=[],p={},g=!1,R=!1;if(j(c,(f=>{var S=qr(f);if(Ee(f,"a")){var k=f.getAttribute("href");g=S&&!!k&&qt(k)&&k}q(Ei(f),"ph-no-capture")&&(R=!0),_.push((function(y,x,I,C){var M=y.tagName.toLowerCase(),A={tag_name:M};Jr.indexOf(M)>-1&&!I&&(A.$el_text=M.toLowerCase()==="a"||M.toLowerCase()==="button"?Yi(1024,Us(y)):Yi(1024,Ht(y)));var L=Ei(y);L.length>0&&(A.classes=L.filter((function(G){return G!==""}))),j(y.attributes,(function(G){var te;if((!ca(y)||["name","id","class","aria-label"].indexOf(G.name)!==-1)&&(C==null||!C.includes(G.name))&&!x&&qt(G.value)&&(!W(te=G.name)||te.substring(0,10)!=="_ngcontent"&&te.substring(0,7)!=="_nghost")){var de=G.value;G.name==="class"&&(de=Kr(de).join(" ")),A["attr__"+G.name]=Yi(1024,de)}}));for(var K=1,Z=1,oe=y;oe=al(oe);)K++,oe.tagName===y.tagName&&Z++;return A.nth_child=K,A.nth_of_type=Z,A})(f,n,a,o)),B(p,(function(y){if(!qr(y))return{};var x={};return j(y.attributes,(function(I){if(I.name&&I.name.indexOf("data-ph-capture-attribute")===0){var C=I.name.replace("data-ph-capture-attribute-",""),M=I.value;C&&M&&qt(M)&&(x[C]=M)}})),x})(f))})),R)return{props:{},explicitNoCapture:R};if(a||(_[0].$el_text=Ee(e,"a")||Ee(e,"button")?Us(e):Ht(e)),g){var P,T;_[0].attr__href=g;var F=(P=gi(g))==null?void 0:P.host,O=v==null||(T=v.location)==null?void 0:T.host;F&&O&&F!==O&&(h=g)}return{props:B({$event_type:s.type,$ce_version:1},l?{}:{$elements:_},{$elements_chain:(d=_,(function(f){return f.map((S=>{var k,y,x="";if(S.tag_name&&(x+=S.tag_name),S.attr_class)for(var I of(S.attr_class.sort(),S.attr_class))x+="."+I.replace(/"/g,"");var C=m({},S.text?{text:S.text}:{},{"nth-child":(k=S.nth_child)!==null&&k!==void 0?k:0,"nth-of-type":(y=S.nth_of_type)!==null&&y!==void 0?y:0},S.href?{href:S.href}:{},S.attr_id?{attr_id:S.attr_id}:{},S.attributes),M={};return ii(C).sort(((A,L)=>{var[K]=A,[Z]=L;return K.localeCompare(Z)})).forEach((A=>{var[L,K]=A;return M[js(L.toString())]=js(K.toString())})),(x+=":")+ii(M).map((A=>{var[L,K]=A;return L+'="'+K+'"'})).join("")})).join(";")})((function(f){return f.map((S=>{var k,y,x={text:(k=S.$el_text)==null?void 0:k.slice(0,400),tag_name:S.tag_name,href:(y=S.attr__href)==null?void 0:y.slice(0,2048),attr_class:nl(S),attr_id:S.attr__id,nth_child:S.nth_child,nth_of_type:S.nth_of_type,attributes:{}};return ii(S).filter((I=>{var[C]=I;return C.indexOf("attr__")===0})).forEach((I=>{var[C,M]=I;return x.attributes[C]=M})),x}))})(d)))},(i=_[0])!=null&&i.$el_text?{$el_text:(r=_[0])==null?void 0:r.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},p)}}var xt=z("[ExceptionAutocapture]");function zs(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return Te(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch{return()=>{}}}var ll=z("[TracingHeaders]"),qe=z("[Web Vitals]"),Vs=9e5,Ws="disabled",Bs="lazy_loading",kt="awaiting_config",Zt="missing_config";z("[SessionRecording]"),z("[SessionRecording]");var Nr="[SessionRecording]",Ne=z(Nr),ul=z("[Heatmaps]");function Gs(e){return Y(e)&&"clientX"in e&&"clientY"in e&&fe(e.clientX)&&fe(e.clientY)}var Ys=z("[Product Tours]"),cl=["$set_once","$set"],De=z("[SiteApps]"),Xs="Error while initializing PostHog app with config id ";function it(e,t,i){if(N(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{return!1}default:return!1}}var hl=class{constructor(e){this.vn=new Xr,this.fn=(t,i)=>this.pn(t,i)&&this.gn(t,i)&&this.mn(t,i)&&this.yn(t,i),this.pn=(t,i)=>i==null||!i.event||t?.event===i?.event,this._instance=e,this.bn=new Set,this._n=new Set}init(){var e,t;E((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook(((i,r)=>{this.on(i,r)}))}register(e){var t,i;if(!E((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((n=>{var a,o;(a=this._n)==null||a.add(n),(o=n.steps)==null||o.forEach((l=>{var c;(c=this.bn)==null||c.add(l?.event||"")}))})),(i=this._instance)!=null&&i.autocapture)){var r,s=new Set;e.forEach((n=>{var a;(a=n.steps)==null||a.forEach((o=>{o!=null&&o.selector&&s.add(o?.selector)}))})),(r=this._instance)==null||r.autocapture.setElementSelectors(s)}}on(e,t){var i;t!=null&&e.length!=0&&(this.bn.has(e)||this.bn.has(t?.event))&&this._n&&((i=this._n)==null?void 0:i.size)>0&&this._n.forEach((r=>{this.wn(t,r)&&this.vn.emit("actionCaptured",r.name)}))}xn(e){this.onAction("actionCaptured",(t=>e(t)))}wn(e,t){if(t?.steps==null)return!1;for(var i of t.steps)if(this.fn(e,i))return!0;return!1}onAction(e,t){return this.vn.on(e,t)}gn(e,t){if(t!=null&&t.url){var i,r=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!r||typeof r!="string"||!it(r,t.url,t.url_matching||"contains"))return!1}return!0}mn(e,t){return!!this.Sn(e,t)&&!!this.kn(e,t)&&!!this.Cn(e,t)}Sn(e,t){var i;if(t==null||!t.href)return!0;var r=this.In(e);if(r.length>0)return r.some((a=>it(a.href,t.href,t.href_matching||"exact")));var s,n=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!n&&it((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}kn(e,t){var i;if(t==null||!t.text)return!0;var r=this.In(e);if(r.length>0)return r.some((l=>it(l.text,t.text,t.text_matching||"exact")||it(l.$el_text,t.text,t.text_matching||"exact")));var s,n,a,o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!o&&(s=(function(l){for(var c,u=[],h=/(?::|")text="(.*?)"/g;!N(c=h.exec(l));)u.includes(c[1])||u.push(c[1]);return u})(o),n=t.text,a=t.text_matching||"exact",s.some((l=>it(l,n,a))))}Cn(e,t){var i,r;if(t==null||!t.selector)return!0;var s=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(s!=null&&s.includes(t.selector))return!0;var n=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch{return!1}return!1}In(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}yn(e,t){return t==null||!t.properties||t.properties.length===0||ra(t.properties.reduce(((i,r)=>{var s=D(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return i[r.key]={values:s,operator:r.operator||"exact"},i}),{}),e?.properties)}},dl=class{constructor(e){this._instance=e,this.Tn=new Map,this.En=new Map,this.Mn=new Map}Pn(e,t){return!!e&&ra(e.propertyFilters,t?.properties)}Rn(e,t){var i=new Map;return e.forEach((r=>{var s;(s=r.conditions)==null||(s=s[t])==null||(s=s.values)==null||s.forEach((n=>{if(n!=null&&n.name){var a=i.get(n.name)||[];a.push(r.id),i.set(n.name,a)}}))})),i}On(e,t,i){var r=(i===mt.Activation?this.Tn:this.En).get(e),s=[];return this.Ln((n=>{s=n.filter((a=>r?.includes(a.id)))})),s.filter((n=>{var a,o=(a=n.conditions)==null||(a=a[i])==null||(a=a.values)==null?void 0:a.find((l=>l.name===e));return this.Pn(o,t)}))}register(e){var t;E((t=this._instance)==null?void 0:t._addCaptureHook)||(this.Fn(e),this.An(e))}An(e){var t=e.filter((i=>{var r,s;return((r=i.conditions)==null?void 0:r.actions)&&((s=i.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));t.length!==0&&(this.Nn??(this.Nn=new hl(this._instance),this.Nn.init(),this.Nn.xn((i=>{this.onAction(i)}))),t.forEach((i=>{var r,s,n,a,o;i.conditions&&(r=i.conditions)!=null&&r.actions&&(s=i.conditions)!=null&&(s=s.actions)!=null&&s.values&&((n=i.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0&&((a=this.Nn)==null||a.register(i.conditions.actions.values),(o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null||o.forEach((l=>{if(l&&l.name){var c=this.Mn.get(l.name);c&&c.push(i.id),this.Mn.set(l.name,c||[i.id])}})))})))}Fn(e){var t,i=e.filter((s=>{var n,a;return((n=s.conditions)==null?void 0:n.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),r=e.filter((s=>{var n,a;return((n=s.conditions)==null?void 0:n.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));i.length===0&&r.length===0||((t=this._instance)==null||t._addCaptureHook(((s,n)=>{this.onEvent(s,n)})),this.Tn=this.Rn(e,mt.Activation),this.En=this.Rn(e,mt.Cancellation))}onEvent(e,t){var i,r=this.le(),s=this.$n(),n=this.Dn(),a=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[s])||[];if(n===e&&t&&a.length>0){var o,l;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var c=(t==null||(o=t.properties)==null?void 0:o.$survey_id)||(t==null||(l=t.properties)==null?void 0:l.$product_tour_id);if(c){var u=a.indexOf(c);0>u||(a.splice(u,1),this.qn(a))}}else{if(this.En.has(e)){var h=this.On(e,t,mt.Cancellation);h.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map((_=>_.id))}),h.forEach((_=>{var p=a.indexOf(_.id);0>p||a.splice(p,1),this.jn(_.id)})),this.qn(a))}if(this.Tn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Tn.get(e)});var d=this.On(e,t,mt.Activation);this.qn(a.concat(d.map((_=>_.id))||[]))}}}onAction(e){var t,i=this.$n(),r=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[i])||[];this.Mn.has(e)&&this.qn(r.concat(this.Mn.get(e)||[]))}qn(e){var t=this.le(),i=[...new Set(e)].filter((r=>!this.Hn(r)));t.info("updating activated items",{activatedItems:i}),this.Un(i)}getActivatedIds(){var e,t=this.$n();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Tn}Bn(){return this.Nn}},vl=class extends dl{constructor(e){super(e)}$n(){return fr}Dn(){return Tt.SHOWN}Ln(e){var t;(t=this._instance)==null||t.getSurveys(e)}jn(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}le(){return U}Un(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[fr]:e})}Hn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Xi="SDK is not enabled or survey functionality is not yet loaded",Ks="Disabled. Not loading surveys.",pl=v!=null&&v.location?mi(v.location.hash,"__posthog")||mi(location.hash,"state"):null,Js="_postHogToolbarParams",Zs=z("[Toolbar]"),ie=z("[FeatureFlags]"),ze=z("[FeatureFlags]",{debugEnabled:!0}),Ki=`" failed. Feature flags didn't load in time.`,Qs=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},en=e=>{var t={};for(var[i,r]of ii(e||{}))r&&(t[i]=r);return t},Fe=z("[Error tracking]"),tn="Refusing to render web experiment since the viewer is a likely bot",_l={icontains:(e,t)=>!!v&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!v&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!v&&wi(t.href,e),not_regex:(e,t)=>!!v&&!wi(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},gl=class se{get qt(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),i.getWebExperiments((s=>{se.zn("retrieved web experiments from the server"),i.Vn=new Map,s.forEach((n=>{if(n.feature_flag_key){var a;i.Vn&&(se.zn("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=i.Vn)==null||a.set(n.feature_flag_key,n));var o=i._instance.getFeatureFlag(n.feature_flag_key);W(o)&&n.variants[o]&&i.Wn(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var c=n.variants[l];se.Zn(c)&&i.Wn(n.name,l,c.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())se.zn(tn);else if(!this.qt.disable_web_experiments){if(N(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();se.zn("applying feature flags",t),t.forEach((i=>{var r;if(this.Vn&&(r=this.Vn)!=null&&r.has(i)){var s,n=this._instance.getFeatureFlag(i),a=(s=this.Vn)==null?void 0:s.get(i);n&&a!=null&&a.variants[n]&&this.Wn(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var t=se.getWindowLocation();if(t!=null&&t.search){var i=fi(t?.search,"__experiment_id"),r=fi(t?.search,"__experiment_variant");i&&r&&(se.zn("previewing web experiments "+i+" && "+r),this.getWebExperiments((s=>{this.Gn(parseInt(i),r,s)}),!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,r){if(this.qt.disable_web_experiments&&!r)return t([]);var s=this._instance.get_property("$web_experiments");if(s&&!i)return t(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:n=>t(n.statusCode===200&&n.json&&n.json.experiments||[])})}Gn(t,i,r){var s=r.filter((n=>n.id===t));s&&s.length>0&&(se.zn("Previewing web experiment ["+s[0].name+"] with variant ["+i+"]"),this.Wn(s[0].name,i,s[0].variants[i].transforms))}static Zn(t){return!N(t.conditions)&&se.Qn(t)&&se.Jn(t)}static Qn(t){var i;if(N(t.conditions)||N((i=t.conditions)==null?void 0:i.url))return!0;var r,s,n,a=se.getWindowLocation();return!!a&&((r=t.conditions)==null||!r.url||_l[(s=(n=t.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](t.conditions.url,a))}static getWindowLocation(){return v?.location}static Jn(t){var i;if(N(t.conditions)||N((i=t.conditions)==null?void 0:i.utm))return!0;var r=Hn();if(r.utm_source){var s,n,a,o,l,c,u,h,d=(s=t.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=t.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==r.utm_campaign,_=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=t.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==r.utm_source,p=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==r.utm_medium,g=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_term||((h=t.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==r.utm_term;return d&&p&&g&&_}return!1}static zn(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];w.info("[WebExperiments] "+t,r)}Wn(t,i,r){this._is_bot()?se.zn(tn):i!=="control"?r.forEach((s=>{if(s.selector){var n;se.zn("applying transform of variant "+i+" for experiment "+t+" ",s),((n=document)==null?void 0:n.querySelectorAll(s.selector))?.forEach((a=>{var o=a;s.html&&(o.innerHTML=s.html),s.css&&o.setAttribute("style",s.css)}))}})):se.zn("Control variants leave the page unmodified.")}_is_bot(){return ce&&this._instance?ta(ce,this.qt.custom_blocked_useragents):void 0}},pe=z("[Conversations]"),Ve="Conversations not available yet.",Pi={featureFlags:class{constructor(e){this.Kn=!1,this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=e,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get ni(){return this._instance.persistence}os(e){return this._instance.get_property(e)}us(){var e,t;return(e=(t=this.ni)==null?void 0:t.wr(this.qt.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}ls(){return!!this.us()&&(this.ss||this.Xn||(this.ss=!0,ie.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hs(){var e,t=(e=this.qt.evaluation_contexts)!==null&&e!==void 0?e:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.ns||(ie.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),t!=null&&t.length?t.filter((i=>{var r=i&&typeof i=="string"&&i.trim().length>0;return r||ie.error("Invalid evaluation context found:",i,"Expected non-empty string"),r})):[]}cs(){return this.hs().length>0}initialize(){var e,t,{config:i}=this._instance,r=(e=(t=i.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var s,n,a=(s=(n=i.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&s!==void 0?s:{},o=Object.keys(r).filter((c=>!!r[c])).reduce(((c,u)=>(c[u]=r[u]||!1,c)),{}),l=Object.keys(a).filter((c=>o[c])).reduce(((c,u)=>(a[u]&&(c[u]=a[u]),c)),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(e,t,i){var r=i!=null&&i.merge?this.getFlagVariants():{},s=i!=null&&i.merge?this.getFlagPayloads():{},n=m({},r,e),a=m({},s,t),o={};for(var[l,c]of Object.entries(n)){var u=typeof c=="string";o[l]={key:l,enabled:!!u||!!c,variant:u?c:void 0,reason:void 0,metadata:E(a?.[l])?void 0:{id:0,version:void 0,description:void 0,payload:a[l]}}}this.receivedFeatureFlags({flags:o})}get hasLoadedFlags(){return this.Yn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.os(vr),t=this.os(Ie),i=this.os(st);if(!i&&!t)return e||{};var r=B({},e||{});for(var s of[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])]){var n,a,o=r[s],l=t?.[s],c=E(l)?(n=o?.enabled)!==null&&n!==void 0&&n:!!l,u=E(l)?o.variant:typeof l=="string"?l:void 0,h=i?.[s],d=m({},o,{enabled:c,variant:c?u??o?.variant:void 0});c!==o?.enabled&&(d.original_enabled=o?.enabled),u!==o?.variant&&(d.original_variant=o?.variant),h&&(d.metadata=m({},o?.metadata,{payload:h,original_payload:o==null||(a=o.metadata)==null?void 0:a.payload})),r[s]=d}return this.Kn||(ie.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.Kn=!0),r}getFlagVariants(){var e=this.os(lt),t=this.os(Ie);if(!t)return e||{};for(var i=B({},e),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this.Kn||(ie.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Kn=!0),i}getFlagPayloads(){var e=this.os(pr),t=this.os(st);if(!t)return e||{};for(var i=B({},e||{}),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this.Kn||(ie.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Kn=!0),i}reloadFeatureFlags(){this.es||this.qt.advanced_disable_feature_flags||this.ds||(this._instance.Li.emit("featureFlagsReloading",!0),this.ds=setTimeout((()=>{this.vs()}),5))}fs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Yn||this.Xn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.es=e}vs(e){var t;if(this.fs(),!this._instance.Lr())if(this.Xn)this.ts=!0;else{var i=this.qt.token,r=this.os(ui),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:m({},((t=this.ni)==null?void 0:t.get_initial_props())||{},this.os(It)||{}),group_properties:this.os(We),timezone:Yn()};Me(r)||E(r)||(s.$device_id=r),(e!=null&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.cs()&&(s.evaluation_contexts=this.hs());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Xn=!0,this._instance._send_request({method:"POST",url:n,data:s,compression:this.qt.disable_compression?void 0:xe.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback:a=>{var o,l,c,u=!0;if(a.statusCode===200&&(this.ts||(this.$anon_distinct_id=void 0),u=!1),this.Xn=!1,!s.disable_flags||this.ts){this.rs=!u;var h=[];a.error?a.error instanceof Error?h.push(a.error.name==="AbortError"?"timeout":"connection_error"):h.push("unknown_error"):a.statusCode!==200&&h.push("api_error_"+a.statusCode),(o=a.json)!=null&&o.errorsWhileComputingFlags&&h.push("errors_while_computing_flags");var d,_=!((l=a.json)==null||(l=l.quotaLimited)==null||!l.includes("feature_flags"));_&&h.push("quota_limited"),(c=this.ni)==null||c.register({[yr]:h}),_?ie.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."):(s.disable_flags||this.receivedFeatureFlags((d=a.json)!==null&&d!==void 0?d:{},u,{partialResponse:!!this.qt.advanced_only_evaluate_survey_feature_flags}),this.ts&&(this.ts=!1,this.vs()))}}})}}getFeatureFlag(e,t){var i;if(t===void 0&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var r=this.getFeatureFlagResult(e,t);return(i=r?.variant)!==null&&i!==void 0?i:r?.enabled}}else ie.warn('getFeatureFlag for key "'+e+Ki)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var i=this.getFlagVariants(),r=e in i,s=i[e],n=this.getFlagPayloads()[e],a=String(s),o=this.os(_r)||void 0,l=this.os(hi)||void 0,c=this.os(Ct)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var u,h=this._instance.get_session_id(),d=this.os(mr);h&&h!==d&&(c={},(u=this.ni)==null||u.register({[Ct]:c,[mr]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in c)||!c[e].includes(a))){var _,p,g,R,P,T,F,O,f,S;D(c[e])?c[e].push(a):c[e]=[a],(_=this.ni)==null||_.register({[Ct]:c});var k=this.getFeatureFlagDetails(e),y=[...(p=this.os(yr))!==null&&p!==void 0?p:[]];E(s)&&y.push("flag_missing");var x={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((g=this.qt.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[e])||null,$feature_flag_bootstrapped_payload:((R=this.qt.bootstrap)==null||(R=R.featureFlagPayloads)==null?void 0:R[e])||null,$used_bootstrap_value:!this.rs};E(k==null||(P=k.metadata)==null?void 0:P.version)||(x.$feature_flag_version=k.metadata.version);var I,C=(T=k==null||(F=k.reason)==null?void 0:F.description)!==null&&T!==void 0?T:k==null||(O=k.reason)==null?void 0:O.code;C&&(x.$feature_flag_reason=C),k!=null&&(f=k.metadata)!=null&&f.id&&(x.$feature_flag_id=k.metadata.id),E(k?.original_variant)&&E(k?.original_enabled)||(x.$feature_flag_original_response=E(k.original_variant)?k.original_enabled:k.original_variant),k!=null&&(S=k.metadata)!=null&&S.original_payload&&(x.$feature_flag_original_payload=k==null||(I=k.metadata)==null?void 0:I.original_payload),y.length&&(x.$feature_flag_error=y.join(",")),this._instance.capture("$feature_flag_called",x)}if(r){var M=n;if(!E(n))try{M=JSON.parse(n)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:M}}}}else ie.warn('getFeatureFlagResult for key "'+e+Ki)}getRemoteConfigPayload(e,t){var i=this.qt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.cs()&&(r.evaluation_contexts=this.hs()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.qt.disable_compression?void 0:xe.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback(s){var n,a=(n=s.json)==null?void 0:n.featureFlagPayloads;t(a?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.rs){if(this.Yn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return E(i)?void 0:!!i}ie.warn('isFeatureEnabled for key "'+e+Ki)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,i){if(this.ni){this.Yn=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,c,u,h){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var d=(y=>{var x=y.flags;return x?(y.featureFlags=Object.fromEntries(Object.keys(x).map((I=>{var C;return[I,(C=x[I].variant)!==null&&C!==void 0?C:x[I].enabled]}))),y.featureFlagPayloads=Object.fromEntries(Object.keys(x).filter((I=>x[I].enabled)).filter((I=>{var C;return(C=x[I].metadata)==null?void 0:C.payload})).map((I=>{var C;return[I,(C=x[I].metadata)==null?void 0:C.payload]})))):ie.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),y})(a),_=d.flags,p=d.featureFlags,g=d.featureFlagPayloads;if(p){var R=a.requestId,P=a.evaluatedAt;if(D(p)){ie.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var T={};if(p)for(var F=0;p.length>F;F++)T[p[F]]=!0;o&&o.register({[ei]:p,[lt]:T})}else{var O=p,f=g,S=_;if(h!=null&&h.partialResponse)O=m({},l,O),f=m({},c,f),S=m({},u,S);else if(a.errorsWhileComputingFlags)if(_){var k=new Set(Object.keys(_).filter((y=>{var x;return!((x=_[y])!=null&&x.failed)})));O=m({},l,Object.fromEntries(Object.entries(O).filter((y=>{var[x]=y;return k.has(x)})))),f=m({},c,Object.fromEntries(Object.entries(f||{}).filter((y=>{var[x]=y;return k.has(x)})))),S=m({},u,Object.fromEntries(Object.entries(S||{}).filter((y=>{var[x]=y;return k.has(x)}))))}else O=m({},l,O),f=m({},c,f),S=m({},u,S);o&&o.register(m({[ei]:Object.keys(en(O)),[lt]:O||{},[pr]:f||{},[vr]:S||{}},R?{[_r]:R}:{},P?{[hi]:P}:{}))}}})(e,this.ni,r,s,n,i),t||(this.ss=!1),this.ps(t)}}override(e,t){t===void 0&&(t=!1),ie.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.ni)return ie.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.ni.unregister(Ie),this.ni.unregister(st),this.ps(),ze.info("All overrides cleared");if(D(e)){var t=Qs(e);return this.ni.register({[Ie]:t}),this.ps(),ze.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var i,r=e;if(this.Kn=!!((i=r.suppressWarning)!==null&&i!==void 0&&i),"flags"in r){if(r.flags===!1)this.ni.unregister(Ie),ze.info("Flag overrides cleared");else if(r.flags){if(D(r.flags)){var s=Qs(r.flags);this.ni.register({[Ie]:s})}else this.ni.register({[Ie]:r.flags});ze.info("Flag overrides set",{flags:r.flags})}}"payloads"in r&&(r.payloads===!1?(this.ni.unregister(st),ze.info("Payload overrides cleared")):r.payloads&&(this.ni.register({[st]:r.payloads}),ze.info("Payload overrides set",{payloads:r.payloads}))),this.ps();return}if(e&&typeof e=="object")return this.ni.register({[Ie]:e}),this.ps(),ze.info("Flag overrides set",{flags:e});ie.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Yn){var{flags:t,flagVariants:i}=this.gs();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,s=(this.os(Ft)||[]).find((l=>l.flagKey===e)),n={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(a.$early_access_feature_name=s.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=m({},this.getFlagVariants(),{[e]:t});(r=this.ni)==null||r.register({[ei]:Object.keys(en(o)),[lt]:o}),this.ps()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var r=this.os(Ft),s=i?"&"+i.map((n=>"stage="+n)).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+s),method:"GET",callback:n=>{var a,o;if(n.json){var l=n.json.earlyAccessFeatures;return(a=this.ni)==null||a.unregister(Ft),(o=this.ni)==null||o.register({[Ft]:l}),e(l)}}})}gs(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((i=>t[i])),flagVariants:Object.keys(t).filter((i=>t[i])).reduce(((i,r)=>(i[r]=t[r],i)),{})}}ps(e){var{flags:t,flagVariants:i}=this.gs();this.featureFlagEventHandlers.forEach((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this.os(It)||{},r=e?.$set||(e!=null&&e.$set_once?{}:e),s=e?.$set_once,n={};if(s)for(var a in s)({}).hasOwnProperty.call(s,a)&&(a in i||(n[a]=s[a]));this._instance.register({[It]:m({},i,n,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(It)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this.os(We)||{};Object.keys(i).length!==0&&Object.keys(i).forEach((r=>{i[r]=m({},i[r],e[r]),delete e[r]})),this._instance.register({[We]:m({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.os(We)||{};this._instance.register({[We]:m({},t,{[e]:{}})})}else this._instance.unregister(We)}reset(){this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.fs(),this.Kn=!1}}},fl={sessionRecording:class{get qt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var e;return!((e=this.ys)==null||!e.isStarted)}get status(){var e,t;return this.bs===kt||this.bs===Zt?this.bs:(e=(t=this.ys)==null?void 0:t.status)!==null&&e!==void 0?e:this.bs}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.bs=Ws,this._s=void 0,this._instance=e,!this._instance.sessionManager)throw Ne.error("started without valid sessionManager"),new Error(Nr+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===Oe)throw new Error(Nr+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get ws(){var e,t=!((e=this._instance.get_property(Rt))==null||!e.enabled),i=!this.qt.disable_session_recording,r=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return v&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this.ws||(t=this.ys)==null||!t.isStarted){var i=!E(Object.assign)&&!E(Array.from);this.ws&&i?(this.xs(e),Ne.info("starting")):(this.bs=Ws,this.stopRecording())}}xs(e){var t,i,r;this.ws&&(this.bs!==kt&&this.bs!==Zt&&(this.bs=Bs),$!=null&&(t=$.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=$.__PosthogExtensions__)!=null&&i.initSessionRecording?this.Ss(e):(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.ks,(s=>{if(s)return Ne.error("could not load recorder",s);this.Ss(e)})))}stopRecording(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.stop()}Cs(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.discard()}Is(){var e;(e=this.ni)==null||e.unregister(Wr)}Ts(e,t){if(N(e))return null;var i,r=fe(e)?e:parseFloat(e);return typeof(i=r)!="number"||!Number.isFinite(i)||0>i||i>1?(Ne.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}Es(e){if(this.ni){var t,i,r=this.ni,s=()=>{var n,a=e.sessionRecording===!1?void 0:e.sessionRecording,o=this.Ts((n=this.qt.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.Ts(a?.sampleRate,"remote config sampleRate"),c=o??l;N(c)&&this.Is();var u=a?.minimumDurationMilliseconds;r.register({[Rt]:m({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:m({capturePerformance:e.capturePerformance},a?.networkPayloadCapture),canvasRecording:{enabled:a?.recordCanvas,fps:a?.canvasFps,quality:a?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:E(u)?null:u,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers,version:a?.version,triggerGroups:a?.triggerGroups})})};s(),(t=this._s)==null||t.call(this),this._s=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording===!1?(this.Es(e),this.Cs()):(this.Es(e),this.startIfEnabledOrStop()):(this.bs===kt&&(this.bs=Zt,Ne.warn("config refresh failed, recording will not start until page reload")),this.startIfEnabledOrStop())}log(e,t){var i;t===void 0&&(t="log"),(i=this.ys)!=null&&i.log?this.ys.log(e,t):Ne.warn("log called before recorder was ready")}get ks(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Rt);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Ms(){var e,t=this._instance.get_property(Rt);if(!t)return!1;var i=(e=(typeof t=="object"?t:JSON.parse(t)).cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-i}Ss(e){var t,i;if((t=$.__PosthogExtensions__)==null||!t.initSessionRecording)return Ne.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[qn]:!0});if(this.ys||(this.ys=(i=$.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ms()){if(this.bs===Zt||this.bs===kt)return;this.bs=kt,Ne.info("persisted remote config is stale, requesting fresh config before starting"),new Xn(this._instance).load();return}this.bs=Bs,this.ys.start(e)}onRRwebEmit(e){var t;(t=this.ys)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.ys||(t=this.ni)==null||t.register({[Tn]:!0}),(e=this.ys)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.ys||(t=this.ni)==null||t.register({[In]:!0}),(e=this.ys)==null||e.overrideSampling()}overrideTrigger(e){var t,i;this.ys||(i=this.ni)==null||i.register({[e==="url"?On:Cn]:!0}),(t=this.ys)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.ys)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!((i=this.ys)==null||!i.tryAddCustomEvent(e,t))}}},ml={autocapture:class{constructor(e){this.Ps=!1,this.Rs=null,this.Os=!1,this.instance=e,this.rageclicks=new Hs(e.config.rageclick),this.Ls=null}initialize(){this.startIfEnabled()}get qt(){var e,t,i=Y(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map((r=>new RegExp(r))),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map((r=>new RegExp(r))),i}Fs(){if(this.isBrowserSupported()){if(v&&b){var e=i=>{i=i||v?.event;try{this.As(i)}catch(r){Gi.error("Failed to capture event",r)}};if(X(b,"submit",e,{capture:!0}),X(b,"change",e,{capture:!0}),X(b,"click",e,{capture:!0}),this.qt.capture_copied_text){var t=i=>{i=i||v?.event;try{this.As(i,Bi)}catch(r){Gi.error("Failed to capture copy/cut event",r)}};X(b,"copy",t,{capture:!0}),X(b,"cut",t,{capture:!0})}}}else Gi.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Ps&&(this.Fs(),this.Ps=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Os=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[nr]:!!e.autocapture_opt_out}),this.Rs=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Ls=e}getElementSelectors(e){var t,i=[];return(t=this.Ls)==null||t.forEach((r=>{b?.querySelectorAll(r)?.forEach((s=>{e===s&&i.push(r)}))})),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[nr];if(Me(this.Rs)&&!Se(i)&&!this.instance.Lr())return!1;var r=(t=this.Rs)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!r}As(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,r=Ls(e);aa(r)&&(r=r.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&(function(h,d){if(!v||Lr(h))return!1;var _,p,g;if(Se(d)?(_=!!d&&Ns,p=void 0):(_=(g=d?.css_selector_ignorelist)!==null&&g!==void 0?g:Ns,p=d?.content_ignorelist),_===!1)return!1;var{targetElementList:R}=Ds(h,!1);return!(function(P,T){if(P===!1||E(P))return!1;var F;if(P===!0)F=el;else{if(!D(P))return!1;if(P.length>10)return w.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;F=P.map((O=>O.toLowerCase()))}return T.some((O=>{var{safeText:f,ariaLabel:S}=O;return F.some((k=>f.includes(k)||S.includes(k)))}))})(p,R.map((P=>{var T;return{safeText:Ht(P).toLowerCase(),ariaLabel:((T=P.getAttribute("aria-label"))==null?void 0:T.toLowerCase().trim())||""}})))&&!qs(R,_)})(r,this.instance.config.rageclick)&&this.As(e,"$rageclick");var s=t===Bi;if(r&&(function(h,d,_,p,g){var R,P,T,F;if(_===void 0&&(_=void 0),!v||Lr(h)||(R=_)!=null&&R.url_allowlist&&!As(_.url_allowlist)||(P=_)!=null&&P.url_ignorelist&&As(_.url_ignorelist))return!1;if((T=_)!=null&&T.dom_event_allowlist){var O=_.dom_event_allowlist;if(O&&!O.some((x=>d.type===x)))return!1}var{parentIsUsefulElement:f,targetElementList:S}=Ds(h,p);if(!(function(x,I){var C=I?.element_allowlist;if(E(C))return!0;var M,A=function(K){if(C.some((Z=>K.tagName.toLowerCase()===Z)))return{v:!0}};for(var L of x)if(M=A(L))return M.v;return!1})(S,_)||!qs(S,(F=_)==null?void 0:F.css_selector_allowlist))return!1;var k=v.getComputedStyle(h);if(k&&k.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0;var y=h.tagName.toLowerCase();switch(y){case"html":return!1;case"form":return(g||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(g||["change","click"]).indexOf(d.type)>=0;default:return f?(g||["click"]).indexOf(d.type)>=0:(g||["click"]).indexOf(d.type)>=0&&(Jr.indexOf(y)>-1||h.getAttribute("contenteditable")==="true")}})(r,e,this.qt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:a}=ol(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsChainAsString:this.Os});if(a)return!1;var o=this.getElementSelectors(r);if(o&&o.length>0&&(n.$element_selectors=o),t===Bi){var l,c=la(v==null||(l=v.getSelection())==null?void 0:l.toString()),u=e.type||"clipboard";if(!c)return!1;n.$selected_content=c,n.$copy_type=u}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return Te(b?.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Ns=(v==null||(t=v.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(w.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.$s&&this.$s(),this.$s=void 0,w.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(v&&v.history){var i=this;(e=v.history.pushState)!=null&&e.__posthog_wrapped__||zs(v.history,"pushState",(r=>function(s,n,a){r.call(this,s,n,a),i.Ds("pushState")})),(t=v.history.replaceState)!=null&&t.__posthog_wrapped__||zs(v.history,"replaceState",(r=>function(s,n,a){r.call(this,s,n,a),i.Ds("replaceState")})),this.qs()}}Ds(e){try{var t,i=v==null||(t=v.location)==null?void 0:t.pathname;if(!i)return;i!==this.Ns&&this.isEnabled&&this._instance.capture(nt,{navigation_type:e}),this.Ns=i}catch(r){w.error("Error capturing "+e+" pageview",r)}}qs(){if(!this.$s){var e=()=>{this.Ds("popstate")};X(v,"popstate",e),this.$s=()=>{v&&v.removeEventListener("popstate",e)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(e){var t;this.js=!1,this.Ps=!1,this.Hs=null,this.instance=e,this.js=!((t=this.instance.persistence)==null||!t.props[ar]),this.rageclicks=new Hs(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Y(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return N(this.qt.capture_heatmaps)?N(this.qt.enable_heatmaps)?this.js:this.qt.enable_heatmaps:this.qt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Ps)return;ul.info("starting..."),this.Us(),this.At()}else{var e;clearInterval((e=this.Hs)!==null&&e!==void 0?e:void 0),this.Bs(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ar]:t}),this.js=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.M;return this.M=void 0,e}zs(e){this.Mt(e.originalEvent,"deadclick")}At(){this.Hs&&clearInterval(this.Hs),this.Hs=b?.visibilityState==="visible"?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}Us(){v&&b&&(this.Vs=this.Zr.bind(this),X(v,_i,this.Vs),this.Ws=e=>this.Mt(e||v?.event),X(b,"click",this.Ws,{capture:!0}),this.Zs=e=>this.Gs(e||v?.event),X(b,"mousemove",this.Zs,{capture:!0}),this.Qs=new _s(this.instance,yo,this.zs.bind(this)),this.Qs.startIfEnabledOrStop(),this.Js=this.At.bind(this),X(b,pi,this.Js),this.Ps=!0)}Bs(){var e;v&&b&&(this.Vs&&v.removeEventListener(_i,this.Vs),this.Ws&&b.removeEventListener("click",this.Ws,{capture:!0}),this.Zs&&b.removeEventListener("mousemove",this.Zs,{capture:!0}),this.Js&&b.removeEventListener(pi,this.Js),clearTimeout(this.Ks),(e=this.Qs)==null||e.stop(),this.Ps=!1)}Ys(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=(function(a,o,l){for(var c=a;c&&Ke(c)&&!Ee(c,"body");){if(c===l)return!1;if(q(o,v?.getComputedStyle(c).position))return!0;c=ua(c)}return!1})(Ls(e),["fixed","sticky"],s);return{x:e.clientX+(n?0:r),y:e.clientY+(n?0:i),target_fixed:n,type:t}}Mt(e,t){var i;if(t===void 0&&(t="click"),!Ms(e.target)&&Gs(e)){var r=this.Ys(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Xs(m({},r,{type:"rageclick"})),this.Xs(r)}}Gs(e){!Ms(e.target)&&Gs(e)&&(clearTimeout(this.Ks),this.Ks=setTimeout((()=>{this.Xs(this.Ys(e,"mousemove"))}),500))}Xs(e){if(v){var t=v.location.href,i=this.qt.custom_personal_data_properties,r=Ut(t,this.qt.mask_personal_data_properties?[..._t,...i||[]]:[],jt);this.M=this.M||{},this.M[r]||(this.M[r]=[]),this.M[r].push(e)}}Zr(){this.M&&!ot(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:_s,webVitalsAutocapture:class{constructor(e){var t;this.js=!1,this.Ps=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),this.M.metrics.length!==0&&(this._instance.capture("$web_vitals",this.M.metrics.reduce(((i,r)=>m({},i,{["$web_vitals_"+r.name+"_event"]:m({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=i=>{var r,s=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(E(s))qe.error("Could not read session ID. Dropping metrics!");else{this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.io();E(n)||(N(i?.name)||N(i?.value)?qe.error("Invalid metric received",i):!this.no||this.no>i.value?(this.M.url!==n&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),E(this.M.url)&&(this.M.url=n),this.M.firstMetricTimestamp=E(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.M.metrics.push(m({},i,{$current_url:n,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.M.metrics.length===this.allowedMetrics.length&&this.eo()):qe.error("Ignoring metric with value >= "+this.no,i))}},this.so=()=>{if(!this.Ps){var i,r,s,n,a=$.__PosthogExtensions__;E(a)||E(a.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:r,onFCP:s,onINP:n}=a.postHogWebVitalsCallbacks),i&&r&&s&&n?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.ht.bind(this)),this.Ps=!0):qe.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.js=!((t=this._instance.persistence)==null||!t.props[cr]),this.startIfEnabled()}get oo(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=Y(this.oo)?(e=this.oo)==null?void 0:e.web_vitals_allowed_metrics:void 0;return N(i)?((t=this._instance.persistence)==null?void 0:t.props[dr])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(Y(this.oo)?this.oo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Y(this.oo)?this.oo.web_vitals_attribution:void 0;return e!=null&&e}get no(){var e=Y(this.oo)&&fe(this.oo.__web_vitals_max_value)?this.oo.__web_vitals_max_value:Vs;return e>0&&6e4>=e?Vs:e}get isEnabled(){var e=Q?.protocol;if(e!=="http:"&&e!=="https:")return qe.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Y(this.oo)?this.oo.web_vitals:Se(this.oo)?this.oo:void 0;return Se(t)?t:this.js}startIfEnabled(){this.isEnabled&&!this.Ps&&(qe.info("enabled, starting..."),this.lr(this.so))}onRemoteConfig(e){if("capturePerformance"in e){var t=Y(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=Y(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[cr]:t}),this._instance.persistence.register({[dr]:i})),this.js=t,this.startIfEnabled()}}lr(e){var t,i;(t=$.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(r=>{r?qe.error("failed to load script",r):e()}))}io(){var e=v?v.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties;return Ut(e,this._instance.config.mask_personal_data_properties?[..._t,...t||[]]:[],jt)}qe.error("Could not determine current URL")}}},yl={exceptionObserver:class{constructor(e){var t,i,r;this.so=()=>{var s;if(v&&this.isEnabled&&(s=$.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var n=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ao&&this.qt.capture_unhandled_errors&&(this.ao=n(this.captureException.bind(this))),!this.uo&&this.qt.capture_unhandled_rejections&&(this.uo=a(this.captureException.bind(this))),!this.lo&&this.qt.capture_console_errors&&(this.lo=o(this.captureException.bind(this)))}catch(l){xt.error("failed to start",l),this.ho()}}},this._instance=e,this.co=!((t=this._instance.persistence)==null||!t.props[or]),this.do=new Pa({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,Gt:xt}),this.qt=this.vo(),this.startIfEnabledOrStop()}vo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Y(e)?t=m({},t,e):(E(e)?this.co:e)&&(t=m({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(xt.info("enabled"),this.ho(),this.lr(this.so)):this.ho()}lr(e){var t,i;(t=$.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return xt.error("failed to load script",r);e()}))}ho(){var e,t,i;(e=this.ao)==null||e.call(this),this.ao=void 0,(t=this.uo)==null||t.call(this),this.uo=void 0,(i=this.lo)==null||i.call(this),this.lo=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.co=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[or]:this.co}),this.qt=this.vo(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.vo()}captureException(e){var t,i,r,s=(t=e==null||(i=e.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&t!==void 0?t:"Exception";this.do.consumeRateLimit(s)?xt.info("Skipping exception capture because of client rate limiting.",{exception:s}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.fo=[],this.po=new Da([new Ga,new io,new Xa,new Ya,new eo,new Qa,new Ja,new to],(function(r){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;s>a;a++)n[a-1]=arguments[a];return function(o,l){l===void 0&&(l=0);for(var c=[],u=o.split(`
|
|
1
|
+
(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"db-studio@2.0.1"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bbbc2bd5-e5fb-44c4-9185-8618c7b66692",e._sentryDebugIdIdentifier="sentry-dbid-bbbc2bd5-e5fb-44c4-9185-8618c7b66692")}catch{}})();var v=typeof window<"u"?window:void 0,J=typeof globalThis<"u"?globalThis:v;typeof self>"u"&&(J.self=J),typeof File>"u"&&(J.File=function(){});var ce=J?.navigator,b=J?.document,Q=J?.location,Ji=J?.fetch,Zi=J!=null&&J.XMLHttpRequest&&"withCredentials"in new J.XMLHttpRequest?J.XMLHttpRequest:void 0,is=J?.AbortController,ya=J?.CompressionStream,le=ce?.userAgent,$=v??{},rs="1.372.10",ne={DEBUG:!1,LIB_VERSION:rs,LIB_NAME:"web",JS_SDK_VERSION:rs};function ss(e,t,i,r,s,n,a){try{var o=e[n](a),l=o.value}catch(c){i(c);return}o.done?t(l):Promise.resolve(l).then(r,s)}function _e(e){return function(){var t=this,i=arguments;return new Promise((function(r,s){var n=e.apply(t,i);function a(l){ss(n,r,s,a,o,"next",l)}function o(l){ss(n,r,s,a,o,"throw",l)}a(void 0)}))}}function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},m.apply(null,arguments)}function sn(e,t){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function Qi(){return Qi=_e((function*(e,t,i){t===void 0&&(t=!0);try{var r=new CompressionStream("gzip"),s=r.writable.getWriter(),n=s.write(new TextEncoder().encode(e)).then((()=>s.close())).catch((function(){var l=_e((function*(c){try{yield s.abort(c)}catch{}throw c}));return function(c){return l.apply(this,arguments)}})()),a=new Response(r.readable).blob(),[o]=yield Promise.all([a,n]);return o}catch(l){if(i!=null&&i.rethrow)throw l;return t&&console.error("Failed to gzip compress data",l),null}})),Qi.apply(this,arguments)}var ba=["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"],ns=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var i=e.toLowerCase();return ba.concat(t).some((r=>{var s=r.toLowerCase();return i.indexOf(s)!==-1}))},wa=["$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 q(e,t){return e.indexOf(t)!==-1}var xi=function(e){return e.trim()},er=function(e){return e.replace(/^\$/,"")},nn=Object.prototype,an=nn.hasOwnProperty,ki=nn.toString,D=Array.isArray||function(e){return ki.call(e)==="[object Array]"},Te=e=>typeof e=="function",Y=e=>e===Object(e)&&!D(e),ot=e=>{if(Y(e)){for(var t in e)if(an.call(e,t))return!1;return!0}return!1},E=e=>e===void 0,W=e=>ki.call(e)=="[object String]",Qt=e=>W(e)&&e.trim().length===0,Me=e=>e===null,N=e=>E(e)||Me(e),fe=e=>ki.call(e)=="[object Number]"&&e==e,rt=e=>fe(e)&&e>0,Se=e=>ki.call(e)==="[object Boolean]",Ea=e=>e instanceof FormData,xa=e=>q(wa,e);function on(e){return e===null||typeof e!="object"}function si(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Dr(e){return typeof Event<"u"&&(function(t,i){try{return t instanceof i}catch{return!1}})(e,Event)}var ka=[!0,"true",1,"1","yes"],Fi=e=>q(ka,e),Sa=[!1,"false",0,"0","no"];function Pe(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),fe(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(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),Pe(s||i,t,i,r))}var Pa=class{constructor(e){this.$t={},this.zt=e.zt,this.Zt=Pe(e.bucketSize,0,100,e.Gt),this.Qt=Pe(e.refillRate,0,this.Zt,e.Gt),this.Jt=Pe(e.refillInterval,0,864e5,e.Gt)}Kt(e,t){var i=Math.floor((t-e.lastAccess)/this.Jt);i>0&&(e.tokens=Math.min(e.tokens+i*this.Qt,this.Zt),e.lastAccess=e.lastAccess+i*this.Jt)}consumeRateLimit(e){var t,i=Date.now(),r=String(e),s=this.$t[r];return s?this.Kt(s,i):this.$t[r]=s={tokens:this.Zt,lastAccess:i},s.tokens===0||(s.tokens--,s.tokens===0&&((t=this.zt)==null||t.call(this,e)),s.tokens===0)}stop(){this.$t={}}},Wt,as,Ii,he="Mobile",ni="iOS",Ce="Android",dt="Tablet",ln=Ce+" "+dt,un="iPad",cn="Apple",hn=cn+" Watch",Ot="Safari",vt="BlackBerry",dn="Samsung",vn=dn+"Browser",pn=dn+" Internet",Ye="Chrome",$a=Ye+" OS",_n=Ye+" "+ni,Ur="Internet Explorer",gn=Ur+" "+he,jr="Opera",Ra=jr+" Mini",Hr="Edge",fn="Microsoft "+Hr,ct="Firefox",mn=ct+" "+ni,Nt="Nintendo",Dt="PlayStation",ht="Xbox",yn=Ce+" "+he,bn=he+" "+Ot,St="Windows",tr=St+" Phone",os="Nokia",ir="Ouya",wn="Generic",Fa=wn+" "+he.toLowerCase(),En=wn+" "+dt.toLowerCase(),rr="Konqueror",re="(\\d+(\\.\\d+)?)",Ti=new RegExp("Version/"+re),Ia=new RegExp(ht,"i"),Ta=new RegExp(Dt+" \\w+","i"),Oa=new RegExp(Nt+" \\w+","i"),zr=new RegExp(vt+"|PlayBook|BB10","i"),Ca={"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"},xn=function(e,t){return t=t||"",q(e," OPR/")&&q(e,"Mini")?Ra:q(e," OPR/")?jr:zr.test(e)?vt:q(e,"IE"+he)||q(e,"WPDesktop")?gn:q(e,vn)?pn:q(e,Hr)||q(e,"Edg/")?fn:q(e,"FBIOS")?"Facebook "+he:q(e,"UCWEB")||q(e,"UCBrowser")?"UC Browser":q(e,"CriOS")?_n:q(e,"CrMo")||q(e,Ye)?Ye:q(e,Ce)&&q(e,Ot)?yn:q(e,"FxiOS")?mn:q(e.toLowerCase(),rr.toLowerCase())?rr:((i,r)=>r&&q(r,cn)||(function(s){return q(s,Ot)&&!q(s,Ye)&&!q(s,Ce)})(i))(e,t)?q(e,he)?bn:Ot:q(e,ct)?ct:q(e,"MSIE")||q(e,"Trident/")?Ur:q(e,"Gecko")?ct:""},Ma={[gn]:[new RegExp("rv:"+re)],[fn]:[new RegExp(Hr+"?\\/"+re)],[Ye]:[new RegExp("("+Ye+"|CrMo)\\/"+re)],[_n]:[new RegExp("CriOS\\/"+re)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+re)],[Ot]:[Ti],[bn]:[Ti],[jr]:[new RegExp("(Opera|OPR)\\/"+re)],[ct]:[new RegExp(ct+"\\/"+re)],[mn]:[new RegExp("FxiOS\\/"+re)],[rr]:[new RegExp("Konqueror[:/]?"+re,"i")],[vt]:[new RegExp(vt+" "+re),Ti],[yn]:[new RegExp("android\\s"+re,"i")],[pn]:[new RegExp(vn+"\\/"+re)],[Ur]:[new RegExp("(rv:|MSIE )"+re)],Mozilla:[new RegExp("rv:"+re)]},Aa=function(e,t){var i=Ma[xn(e,t)];if(E(i))return null;for(var r=0;i.length>r;r++){var s=e.match(i[r]);if(s)return parseFloat(s[s.length-2])}return null},ls=[[new RegExp(ht+"; "+ht+" (.*?)[);]","i"),e=>[ht,e&&e[1]||""]],[new RegExp(Nt,"i"),[Nt,""]],[new RegExp(Dt,"i"),[Dt,""]],[zr,[vt,""]],[new RegExp(St,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[tr,""];if(new RegExp(he).test(t)&&!/IEMobile\b/.test(t))return[St+" "+he,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=Ca[i[1]]||"";return/arm/i.test(t)&&(r="RT"),[St,r]}return[St,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[ni,[e[3],e[4],e[5]||"0"].join(".")]:[ni,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=E(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ce+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ce+")","i"),e=>e&&e[2]?[Ce,[e[2],e[3],e[4]||"0"].join(".")]:[Ce,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[$a,""]],[/Linux|debian/i,["Linux",""]]],us=function(e){return Oa.test(e)?Nt:Ta.test(e)?Dt:Ia.test(e)?ht:new RegExp(ir,"i").test(e)?ir:new RegExp("("+tr+"|WPDesktop)","i").test(e)?tr:/iPad/.test(e)?un:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?hn:zr.test(e)?vt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(os,"i").test(e)?os:/(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(he).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)?Ce:ln:new RegExp("(pda|"+he+")","i").test(e)?Fa:new RegExp(dt,"i").test(e)&&!new RegExp(dt+" pc","i").test(e)?En:""},La=e=>e instanceof Error,kn={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},qa=kn.info;function Sn(e){if(Se(e))return{boolValue:e};if(typeof e=="number")return Number.isFinite(e)?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:{stringValue:String(e)};if(typeof e=="string")return{stringValue:e};if(D(e))return{arrayValue:{values:e.map((t=>Sn(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function cs(e){var t=[];for(var i in e){var r=e[i];Me(r)||E(r)||t.push({key:i,value:Sn(r)})}return t}function Na(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return Ii&&i.length===as||(as=i.length,Ii=i.reduce(((r,s)=>{Wt||(Wt={});var n=Wt[s];if(n)r[n[0]]=n[1];else for(var a=e(s),o=a.length-1;o>=0;o--){var l=a[o],c=l?.filename,u=t[s];if(c&&u){r[c]=u,Wt[s]=[c,u];break}}return r}),{})),Ii}}var Da=class{constructor(e,t,i){i===void 0&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(t),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return _e((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&D(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:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,r;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),m({},e,{cause:i,stack:r})}applyChunkIds(e,t){return e.map((i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i)))}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 _e((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:(i=t.type)!==null&&i!==void 0?i:"generic",handled:(r=t.handled)===null||r===void 0||r,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var a=[n];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,m({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:Na(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var r=(s,n)=>{if(4>=n){var a=this.buildCoercingContext(e,t,n);return this.applyCoercers(s,a)}};return m({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:s=>r(s,i),next:s=>r(s,i+1)})}},pt="?";function sr(e,t,i,r,s){var n={platform:e,filename:t,function:i==="<anonymous>"?pt:i,in_app:!0};return E(r)||(n.lineno=r),E(s)||(n.colno=s),n}var Pn=(e,t)=>{var i=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return i||r?[e.indexOf("@")!==-1?e.split("@")[0]:pt,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Ua=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ja=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ha=/\((\S*)(?::(\d+))(?::(\d+))\)/,za=(e,t)=>{var i=Ua.exec(e);if(i){var[,r,s,n]=i;return sr(t,r,pt,+s,+n)}var a=ja.exec(e);if(a){if(a[2]&&a[2].indexOf("eval")===0){var o=Ha.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,c]=Pn(a[1]||pt,a[2]);return sr(t,c,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},Va=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Wa=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ba=(e,t)=>{var i=Va.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Wa.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]||pt;return[n,s]=Pn(n,s),sr(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},hs=/\(error: (.*)\)/,Ga=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=W(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 si(e,"DOMException")}isDOMError(e){return si(e,"DOMError")}},Ya=class{match(e){return(t=>t 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 String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}},Xa=class{constructor(){}match(e){return si(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Ka=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ja=class{match(e){return typeof e=="string"}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:r??"Error",value:s??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(Ka);return r&&(t=r[1],i=r[2]),[t,i]}},Za=["fatal","error","warning","log","info","debug"];function $n(e,t){t===void 0&&(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(t>=s.length)return r===i.length?s:s.length>t?s.slice(0,t)+"...":s}return""}var Qa=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(i=t.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Dr(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+$n(e)}isSeverityLevel(e){return W(e)&&!Qt(e)&&Za.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(La(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},eo=class{match(e){return Dr(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+$n(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},to=class{match(e){return on(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},io=class{match(e){return si(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Dr(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return on(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},ai="$message",oi="$timestamp",ro=new Set([ai,oi]),Oi={enabled:!0,max_bytes:32768};function li(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Oi.enabled,max_bytes:no(e.max_bytes,Oi.max_bytes)}:m({},Oi)}var so=class{constructor(e){this.Yt=[],this.Xt=0,this.qt=li(e)}setConfig(e){this.qt=li(e),this.er()}add(e){var t=(function(r){var s=(function(c){var u=new WeakSet;try{return JSON.stringify(c,((h,d)=>{if(typeof d=="bigint")return d.toString();if(typeof d!="function"&&typeof d!="symbol"){if(d instanceof Date)return d.toISOString();if(d instanceof Error)return{name:d.name,message:d.message,stack:d.stack};if(d&&typeof d=="object"){if(u.has(d))return"[Circular]";u.add(d)}return d}}))}catch{return}})(r);if(s)try{var n=JSON.parse(s);if(!Y(n))return;var a=n,o=a[ai],l=a[oi];return!W(o)||o.trim().length===0||!W(l)&&!fe(l)?void 0:{step:a,json:s}}catch{return}})(e);if(t){var i=(function(r){if(typeof TextEncoder<"u")return new TextEncoder().encode(r).length;for(var s=encodeURIComponent(r),n=0,a=0;s.length>a;a++)s[a]==="%"?(n+=1,a+=2):n+=1;return n})(t.json);i>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:i}),this.Xt+=i,this.er())}}getAttachable(){return this.Yt.map((e=>e.step))}clear(){this.Yt=[],this.Xt=0}size(){return this.Yt.length}er(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var e=this.Yt.shift();e&&(this.Xt-=e.bytes)}}};function no(e,t){if(!fe(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}var Rn=function(e,t){var{debugEnabled:i}=t===void 0?{}:t,r={k(s){if(v&&(ne.DEBUG||$.POSTHOG_DEBUG||i)&&!E(v.console)&&v.console){for(var n=("__rrweb_original__"in v.console[s])?v.console[s].__rrweb_original__:v.console[s],a=arguments.length,o=new Array(a>1?a-1:0),l=1;a>l;l++)o[l-1]=arguments[l];n(e,...o)}},debug(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("debug",...n)},info(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("log",...n)},warn(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("warn",...n)},error(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];r.k("error",...n)},critical(){for(var s=arguments.length,n=new Array(s),a=0;s>a;a++)n[a]=arguments[a];console.error(e,...n)},uninitializedWarning(s){r.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>Rn(e+" "+s,n)};return r},w=Rn("[PostHog.js]"),z=w.createLogger,ao=z("[ExternalScriptsLoader]"),Ci=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return ao.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=b?.querySelectorAll("script");if(r){for(var s,n=function(){if(r[a].src===t){var l=r[a];return l.__posthog_loading_callback_fired?{v:i()}:(l.addEventListener("load",(c=>{l.__posthog_loading_callback_fired=!0,i(void 0,c)})),l.onerror=c=>i(c),{v:void 0})}},a=0;r.length>a;a++)if(s=n())return s.v}var o=()=>{if(!b)return i("document not found");var l=b.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=t,l.onload=h=>{l.__posthog_loading_callback_fired=!0,i(void 0,h)},l.onerror=h=>i(h),e.config.prepare_external_dependency_script&&(l=e.config.prepare_external_dependency_script(l)),!l)return i("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")b.head.appendChild(l);else{var c,u=b.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):b.body.appendChild(l)}};b!=null&&b.body?o():b?.addEventListener("DOMContentLoaded",o)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if(t!=="remote-config"){var r;if(e.config.__preview_external_dependency_versioned_paths)r=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var s="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=e.requestRouter.endpointFor("assets",s)}Ci(e,r,i)}else Ci(e,e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js"),i)},$.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{Ci(e,e.requestRouter.endpointFor("api",t),i)};var Fn="$people_distinct_id",ui="$device_id",Pt="__alias",$t="__timers",nr="$autocapture_disabled_server_side",ar="$heatmaps_enabled_server_side",or="$exception_capture_enabled_server_side",lr="$error_tracking_suppression_rules",ur="$error_tracking_capture_extension_exceptions",cr="$web_vitals_enabled_server_side",Vr="$dead_clicks_enabled_server_side",hr="$product_tours_enabled_server_side",dr="$web_vitals_allowed_metrics",Rt="$session_recording_remote_config",In="$replay_override_sampling",Tn="$replay_override_linked_flag",On="$replay_override_url_trigger",Cn="$replay_override_event_trigger",ci="$sesid",Wr="$session_is_sampled",lt="$enabled_feature_flags",ei="$active_feature_flags",Ft="$early_access_features",vr="$feature_flag_details",pr="$feature_flag_payloads",_r="$feature_flag_request_id",Ie="$override_feature_flags",st="$override_feature_flag_payloads",It="$stored_person_properties",We="$stored_group_properties",gr="$surveys",fr="$surveys_activated",ti="ph_product_tours",Ct="$flag_call_reported",mr="$flag_call_reported_session_id",yr="$feature_flag_errors",hi="$feature_flag_evaluated_at",we="$user_state",br="$client_session_props",wr="$capture_rate_limit",Er="$initial_campaign_params",xr="$initial_referrer_info",di="$initial_person_info",vi="$epp",Mn="__POSTHOG_TOOLBAR__",Bt="$posthog_cookieless",An="$sdk_debug_extensions_init_method",Ln="$sdk_debug_extensions_init_time_ms",qn="$sdk_debug_recording_script_not_loaded",kr="PostHog loadExternalDependency extension not found.",Be="on_reject",Oe="always",Ze="anonymous",Qe="identified",Sr="identified_only",pi="visibilitychange",_i="beforeunload",nt="$pageview",Mi="$pageleave",Ai="$identify",ds="$groupidentify";function Gt(e,t){D(e)&&e.forEach(t)}function j(e,t){if(!N(e))if(D(e))e.forEach(t);else if(Ea(e))e.forEach(((r,s)=>t(r,s)));else for(var i in e)an.call(e,i)&&t(e[i],i)}var B=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;t>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)s[n]!==void 0&&(e[n]=s[n]);return e};function ii(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 vs=function(e){try{return e()}catch{return}},oo=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];return e.apply(this,i)}catch(s){w.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),w.critical(s)}}},Br=function(e){var t={};return j(e,(function(i,r){(W(i)&&i.length>0||fe(i))&&(t[r]=i)})),t},lo=["herokuapp.com","vercel.app","netlify.app"];function uo(e){var t=e?.hostname;if(!W(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of lo)if(i===r)return!1;return!0}function X(e,t,i,r){var{capture:s=!1,passive:n=!0}=r??{};e?.addEventListener(t,i,{capture:s,passive:n})}function Nn(e){return e.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return fe(e)&&isFinite(e)&&Math.floor(e)===e});var co=class Pr{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,r,s){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(s)||0>t||0>i||0>r||0>s||t>0xffffffffffff||i>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/Math.pow(2,8),n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new Pr(n)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),i!==3&&i!==5&&i!==7&&i!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Pr(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var i=0;16>i;i++){var r=this.bytes[i]-t.bytes[i];if(r!==0)return Math.sign(r)}return 0}},ho=class{constructor(){this.S=0,this.C=0,this.I=new vo}generate(){var e=this.generateOrAbort();if(E(e)){this.S=0;var t=this.generateOrAbort();if(E(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return co.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}},ps,Dn=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};v&&!E(v.crypto)&&crypto.getRandomValues&&(Dn=e=>crypto.getRandomValues(e));var vo=class{constructor(){this.M=new Uint32Array(8),this.O=1/0}nextUint32(){return this.M.length>this.O||(Dn(this.M),this.O=0),this.M[this.O++]}},Ue=()=>po().toString(),po=()=>(ps||(ps=new ho)).generate(),ft="",_o=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ke={R:()=>!!b,D(e){w.error("cookieStore error: "+e)},A(e){if(b){try{for(var t=e+"=",i=b.cookie.split(";").filter((n=>n.length)),r=0;i.length>r;r++){for(var s=i[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(t)===0)return decodeURIComponent(s.substring(t.length,s.length))}}catch{}return null}},F(e){var t;try{t=JSON.parse(ke.A(e))||{}}catch{}return t},N(e,t,i,r,s){if(b)try{var n="",a="",o=(function(u,h){if(h){var d=(function(p,g){if(g===void 0&&(g=b),ft)return ft;if(!g||["localhost","127.0.0.1"].includes(p))return"";for(var R=p.split("."),P=Math.min(R.length,8),T="dmn_chk_"+Ue();!ft&&P--;){var F=R.slice(P).join("."),O=T+"=1;domain=."+F+";path=/";g.cookie=O+";max-age=3",g.cookie.includes(T)&&(g.cookie=O+";max-age=0",ft=F)}return ft})(u);if(!d){var _=(p=>{var g=p.match(_o);return g?g[0]:""})(u);_!==d&&w.info("Warning: cookie subdomain discovery mismatch",_,d),d=_}return d?"; domain=."+d:""}return""})(b.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+o+a;return c.length>3686.4&&w.warn("cookieStore warning: large cookie, len="+c.length),b.cookie=c,c}catch{return}},q(e,t){if(b!=null&&b.cookie)try{ke.N(e,"",-1,t)}catch{return}}},Li=null,V={R(){if(!Me(Li))return Li;var e=!0;if(E(v))e=!1;else try{var t="__mplssupport__";V.N(t,"xyz"),V.A(t)!=='"xyz"'&&(e=!1),V.q(t)}catch{e=!1}return e||w.error("localStorage unsupported; falling back to cookie store"),Li=e,e},D(e){w.error("localStorage error: "+e)},A(e){try{return v?.localStorage.getItem(e)}catch(t){V.D(t)}return null},F(e){try{return JSON.parse(V.A(e))||{}}catch{}return null},N(e,t){try{v?.localStorage.setItem(e,JSON.stringify(t))}catch(i){V.D(i)}},q(e){try{v?.localStorage.removeItem(e)}catch(t){V.D(t)}}},go=[ui,"distinct_id",ci,Wr,vi,di,we],Yt={},fo={R:()=>!0,D(e){w.error("memoryStorage error: "+e)},A:e=>Yt[e]||null,F:e=>Yt[e]||null,N(e,t){Yt[e]=t},q(e){delete Yt[e]}},He=null,ee={R(){if(!Me(He))return He;if(He=!0,E(v))He=!1;else try{var e="__support__";ee.N(e,"xyz"),ee.A(e)!=='"xyz"'&&(He=!1),ee.q(e)}catch{He=!1}return He},D(e){w.error("sessionStorage error: ",e)},A(e){try{return v?.sessionStorage.getItem(e)}catch(t){ee.D(t)}return null},F(e){try{return JSON.parse(ee.A(e))||null}catch{}return null},N(e,t){try{v?.sessionStorage.setItem(e,JSON.stringify(t))}catch(i){ee.D(i)}},q(e){try{v?.sessionStorage.removeItem(e)}catch(t){ee.D(t)}}},mo=class{constructor(e){this._instance=e}get qt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.qt.cookieless_mode===Oe||this.isRejected()||this.consent===-1&&this.qt.cookieless_mode===Be}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qt.opt_out_capturing_by_default}optInOut(e){this.nr.N(this.sr,e?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}get sr(){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 ir(){var e=this.nr.A(this.sr);return Fi(e)?1:q(Sa,e)?0:-1}get nr(){var e=this.qt.opt_out_capturing_persistence_type,t=e==="localStorage"?V:ke;if(!this.ar||this.ar!==t){this.ar=t;var i=e==="localStorage"?ke:V;i.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(Fi(i.A(this.sr))),i.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[ce?.doNotTrack,ce?.msDoNotTrack,$.doNotTrack].some((e=>Fi(e)))}},Xt=z("[Dead Clicks]"),yo=()=>!0,bo=e=>{var t,i=!((t=e.instance.persistence)==null||!t.get_property(Vr)),r=e.instance.config.capture_dead_clicks;return Se(r)?r:!!Y(r)||i},_s=class{get lazyLoadedDeadClicksAutocapture(){return this.ur}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Vr]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr((()=>{this.hr()})):this.stop()}lr(e){var t,i;(t=$.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?Xt.error("failed to load script",r):e()}))}hr(){var e;if(b){if(!this.ur&&(e=$.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=Y(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ur=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ur.start(b),Xt.info("starting...")}}else Xt.error("`document` not found. Cannot start.")}stop(){this.ur&&(this.ur.stop(),this.ur=void 0,Xt.info("stopping..."))}},qi=z("[SegmentIntegration]"),Un="posthog-js";function jn(e,t){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=t===void 0?{}:t;return o=>{var l,c,u,h,d;if(n!=="*"&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});var _=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());o.tags["PostHog Person URL"]=_,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=((l=o.exception)==null?void 0:l.values)||[],R=g.map((T=>m({},T,{stacktrace:T.stacktrace?m({},T.stacktrace,{type:"raw",frames:(T.stacktrace.frames||[]).map((F=>m({},F,{platform:"web:javascript"})))}):void 0}))),P={$exception_message:((c=g[0])==null?void 0:c.value)||o.message,$exception_type:(u=g[0])==null?void 0:u.type,$exception_level:o.level,$exception_list:R,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((h=g[0])==null?void 0:h.value)||o.message,$sentry_exception_type:(d=g[0])==null?void 0:d.type,$sentry_tags:o.tags};return i&&r&&(P.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+o.event_id),a&&((p=e.exceptions)==null||p.sendExceptionEvent(P)),o}}var wo=class{constructor(e,t,i,r,s,n){this.name=Un,this.setupOnce=function(a){a(jn(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:n==null||n}))}}},gs=class{constructor(e){this.cr=(t,i,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength)&&(w.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.vr()}vr(){var e;this.pr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.cr)}destroy(){var e;(e=this.pr)==null||e.call(this),this.pr=void 0}doPageView(e,t){var i,r=this.gr(e,t);return this.dr={pathname:(i=v?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.gr(e,(t=this.dr)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.dr)==null?void 0:e.pageViewId}}gr(e,t){var i=this.dr;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:a,maxScrollY:o,maxContentHeight:l,lastContentY:c,maxContentY:u}=s;if(!(E(n)||E(a)||E(o)||E(l)||E(c)||E(u))){n=Math.ceil(n),a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var h=n>1?Pe(a/n,0,1,w):1,d=n>1?Pe(o/n,0,1,w):1,_=l>1?Pe(c/l,0,1,w):1,p=l>1?Pe(u/l,0,1,w):1;r=B(r,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:o,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}},Eo={[Fn]:{exposure:"hidden"},[Pt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[$t]:{exposure:"hidden"},[nr]:{exposure:"event"},[ar]:{exposure:"hidden"},[or]:{exposure:"event"},[lr]:{exposure:"hidden"},[ur]:{exposure:"event"},[cr]:{exposure:"event"},[Vr]:{exposure:"event"},[hr]:{exposure:"hidden"},[dr]:{exposure:"event"},[Rt]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[ci]:{exposure:"hidden"},[Wr]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[lt]:{exposure:"derived",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!Y(e))return{};for(var t={},i=Object.keys(e),r=0;i.length>r;r++)t["$feature/"+i[r]]=e[i[r]];return t}},[ei]:{exposure:"event"},[Ft]:{exposure:"hidden"},[vr]:{exposure:"hidden"},[pr]:{exposure:"event"},[_r]:{exposure:"event"},[Ie]:{exposure:"event"},[st]:{exposure:"hidden"},[It]:{exposure:"hidden"},[We]:{exposure:"hidden"},[gr]:{exposure:"hidden"},[fr]:{exposure:"event"},[ti]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ct]:{exposure:"hidden"},[mr]:{exposure:"hidden"},[yr]:{exposure:"hidden"},[hi]:{exposure:"hidden"},[we]:{exposure:"hidden"},[br]:{exposure:"hidden"},[wr]:{exposure:"hidden"},[Er]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[di]:{exposure:"hidden"},[vi]:{exposure:"hidden"},[In]:{exposure:"event"},[Tn]:{exposure:"event"},[On]:{exposure:"event"},[Cn]:{exposure:"event"},[An]:{exposure:"event"},[Ln]:{exposure:"event"},[qn]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},xo=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],gi=e=>{var t=b?.createElement("a");return E(t)?null:(t.href=e,t)},fi=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!D(i)||2>i.length)return"";var a=i[1];try{a=decodeURIComponent(a)}catch{w.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Ut=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[1],n=(r[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),c=[],u=0;l.length>u;u++){var h=l[u].split("=");D(h)&&(t.includes(h[0])?c.push(h[0]+"="+i):c.push(l[u]))}var d=o;return a!=null&&(d+="?"+c.join("&")),s!=null&&(d+="#"+s),d},mi=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Kt="https?://(.*)",_t=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ko=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",..._t],jt="<masked>",So=["li_fat_id"];function Hn(e,t,i){if(!b)return{};var r,s=t?[..._t,...i||[]]:[],n=zn(Ut(b.URL,s,jt),e);return B((r={},j(So,(function(a){var o=ke.A(a);r[a]=o||null})),r),n)}function zn(e,t){var i=ko.concat(t||[]),r={};return j(i,(function(s){r[s]=fi(e,s)||null})),r}function Vn(e){var t=(function(n){return n?n.search(Kt+"google.([^/?]*)")===0?"google":n.search(Kt+"bing.com")===0?"bing":n.search(Kt+"yahoo.com")===0?"yahoo":n.search(Kt+"duckduckgo.com")===0?"duckduckgo":null:null})(e),i=t!="yahoo"?"q":"p",r={};if(!Me(t)){r.$search_engine=t;var s=b?fi(b.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function fs(){return navigator.language||navigator.userLanguage}var yi="$direct";function Wn(){return b?.referrer||yi}function Bn(e,t){var i=e?[..._t,...t||[]]:[],r=Q?.href.substring(0,1e3);return{r:Wn().substring(0,1e3),u:r?Ut(r,i,jt):void 0}}function Gn(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:i==null?void 0:i==yi?yi:(t=gi(i))==null?void 0:t.host};if(r){s.$current_url=r;var n=gi(r);s.$host=n?.host,s.$pathname=n?.pathname,B(s,zn(r))}return i&&B(s,Vn(i)),s}function Yn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Po(){try{return new Date().getTimezoneOffset()}catch{return}}var $o=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ni=class{constructor(e,t){this.qt=e,this.props={},this.mr=!1,this.yr=(i=>{var r="";return i.token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"})(e),this.nr=this.br(e),this.load(),e.debug&&w.info("Persistence loaded",e.persistence,m({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._r}br(e){$o.indexOf(e.persistence.toLowerCase())===-1&&(w.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(r){r===void 0&&(r=[]);var s=[...go,...r];return m({},V,{F(n){try{var a={};try{a=ke.F(n)||{}}catch{}var o=B(a,JSON.parse(V.A(n)||"{}"));return V.N(n,o),o}catch{}return null},N(n,a,o,l,c,u){try{V.N(n,a,void 0,void 0,u);var h={};s.forEach((d=>{a[d]&&(h[d]=a[d])})),Object.keys(h).length&&ke.N(n,h,o,l,c,u)}catch(d){V.D(d)}},q(n,a){try{v?.localStorage.removeItem(n),ke.q(n,a)}catch(o){V.D(o)}}})})(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return i==="localstorage"&&V.R()?V:i==="localstorage+cookie"&&t.R()?t:i==="sessionstorage"&&ee.R()?ee:i==="memory"?fo:i==="cookie"?ke:t.R()?t:ke}wr(e){var t=e??this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[hi];return!i||typeof i!="number"||Date.now()-i>t}properties(){var e={};return j(this.props,((t,i)=>{var r=(s=>{var n=Eo[s];if(n)return n;for(var[a,o]of xo)if(s.indexOf(a)===0)return o})(i);if(r?.exposure==="derived"){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,i===lt?()=>this.wr():()=>!1))return;r.transformToEventProperties&&B(e,r.transformToEventProperties(t))}else r&&r.exposure!=="event"||(e[i]=t)})),e}load(){if(!this._r){var e=this.nr.F(this.yr);e&&(this.props=B({},e))}}save(){this._r||this.nr.N(this.yr,this.props,this.Sr,this.kr,this.Cr,this.qt.debug)}remove(){this.nr.q(this.yr,!1),this.nr.q(this.yr,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(Y(e)){E(t)&&(t="None"),this.Sr=E(i)?this.Ir:i;var r=!1;if(j(e,((s,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.Tr(n,s),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(Y(e)){this.Sr=E(t)?this.Ir:t;var i=!1;if(j(e,((r,s)=>{e.hasOwnProperty(s)&&this.props[s]!==r&&(this.Tr(s,r),i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Er(e),this.save())}update_campaign_params(){if(!this.mr){var e=Hn(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);ot(Br(e))||this.register(e),this.mr=!0}}update_search_keyword(){var e;this.register((e=b?.referrer)?Vn(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Wn(),$referring_domain:b!=null&&b.referrer&&((e=gi(b.referrer))==null?void 0:e.host)||yi},void 0)}set_initial_person_info(){this.props[Er]||this.props[xr]||this.register_once({[di]:Bn(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};j([xr,Er],(s=>{var n=this.props[s];n&&j(n,(function(a,o){e["$initial_"+er(o)]=a}))}));var t,i,r=this.props[di];return r&&B(e,(t=Gn(r),i={},j(t,(function(s,n){i["$initial_"+er(n)]=s})),i)),e}safe_merge(e){return j(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this.Ir=this.Sr=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||!((n,a)=>{if(n.length!==a.length)return!1;var o=[...n].sort(),l=[...a].sort();return o.every(((c,u)=>c===l[u]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.br(e),s=this.props;this.clear(),this.nr=r,this.props=s,this.save()}}set_disabled(e){this._r=e,this._r?this.remove():this.save()}set_cross_subdomain(e){e!==this.kr&&(this.kr=e,this.remove(),this.save())}set_secure(e){e!==this.Cr&&(this.Cr=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[$t]||{};i[e]=t,this.Tr($t,i),this.save()}remove_event_timer(e){var t=this.props[$t]||{},i=t[e];return E(i)||(delete t[e],this.Tr($t,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.Tr(e,t),this.save()}Tr(e,t){this.props[e]=t}Er(e){delete this.props[e]}},mt={Activation:"events",Cancellation:"cancelEvents"},Di={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Tt={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ui={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},$r={Popover:"popover",Inline:"inline"},Ro={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},ms={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ys=z("[RateLimiter]"),Fo=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((r=>{ys.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){ys.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:i});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,r;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,a=new Date().getTime(),o=(t=(i=this.instance.persistence)==null?void 0:i.get_property(wr))!==null&&t!==void 0?t:{tokens:s,last:a};o.tokens+=(a-o.last)/1e3*n,o.last=a,o.tokens>s&&(o.tokens=s);var l=1>o.tokens;return l||e||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(r=this.instance.persistence)==null||r.set_property(wr,o),{isRateLimited:l,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},yt=z("[RemoteConfig]"),Xn=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Mr(e){var t,i;(t=$.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Pr(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 yt.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Or();if(this._instance.Lr())return void yt.warn("Remote config is disabled. Falling back to local config.");this.Mr((e=>{if(!e)return yt.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pr((t=>{this.Rr(t),this.Or()}));this.Rr(e),this.Or()}))}catch(e){yt.error("Error loading remote config",e)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){this._instance.Lr()||b?.visibilityState==="hidden"||this._instance.reloadFeatureFlags()}Or(){var e;if(!this.Fr){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.Fr=setInterval((()=>{this.refresh()}),t))}}Rr(e){var t;e||yt.error("Failed to fetch remote config from PostHog."),this._instance.Rr(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}},xe={GZipJS:"gzip-js",Base64:"base64"},ge=Uint8Array,ae=Uint16Array,gt=Uint32Array,Gr=new ge([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]),Yr=new ge([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]),bs=new ge([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Kn=function(e,t){for(var i=new ae(31),r=0;31>r;++r)i[r]=t+=1<<e[r-1];var s=new gt(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Jn=Kn(Gr,2),Rr=Jn[1];Jn[0][28]=258,Rr[258]=28;for(var ws=Kn(Yr,0)[1],Fr=new ae(32768),H=0;32768>H;++H){var et=(43690&H)>>>1|(21845&H)<<1;Fr[H]=((65280&(et=(61680&(et=(52428&et)>>>2|(13107&et)<<2))>>>4|(3855&et)<<4))>>>8|(255&et)<<8)>>>1}var Mt=function(e,t,i){for(var r=e.length,s=0,n=new ae(t);r>s;++s)++n[e[s]-1];var a,o=new ae(t);for(s=0;t>s;++s)o[s]=o[s-1]+n[s-1]<<1;if(i){a=new ae(1<<t);var l=15-t;for(s=0;r>s;++s)if(e[s])for(var c=s<<4|e[s],u=t-e[s],h=o[e[s]-1]++<<u,d=h|(1<<u)-1;d>=h;++h)a[Fr[h]>>>l]=c}else for(a=new ae(r),s=0;r>s;++s)a[s]=Fr[o[e[s]-1]++]>>>15-e[s];return a},Xe=new ge(288);for(H=0;144>H;++H)Xe[H]=8;for(H=144;256>H;++H)Xe[H]=9;for(H=256;280>H;++H)Xe[H]=7;for(H=280;288>H;++H)Xe[H]=8;var bi=new ge(32);for(H=0;32>H;++H)bi[H]=5;var Io=Mt(Xe,9,0),To=Mt(bi,5,0),Zn=function(e){return(e/8>>0)+(7&e&&1)},Qn=function(e,t,i){(i==null||i>e.length)&&(i=e.length);var r=new(e instanceof ae?ae:e instanceof gt?gt:ge)(i-t);return r.set(e.subarray(t,i)),r},Re=function(e,t,i){var r=t/8>>0;e[r]|=i<<=7&t,e[r+1]|=i>>>8},bt=function(e,t,i){var r=t/8>>0;e[r]|=i<<=7&t,e[r+1]|=i>>>8,e[r+2]|=i>>>16},ji=function(e,t){for(var i=[],r=0;e.length>r;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new ge(0),0];if(s==1){var a=new ge(i[0].s+1);return a[i[0].s]=1,[a,1]}i.sort((function(f,S){return f.f-S.f})),i.push({s:-1,f:25001});var o=i[0],l=i[1],c=0,u=1,h=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=s-1;)o=i[i[h].f>i[c].f?c++:h++],l=i[c!=u&&i[h].f>i[c].f?c++:h++],i[u++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(r=1;s>r;++r)n[r].s>d&&(d=n[r].s);var _=new ae(d+1),p=Ir(i[u-1],_,0);if(p>t){r=0;var g=0,R=p-t,P=1<<R;for(n.sort((function(f,S){return _[S.s]-_[f.s]||f.f-S.f}));s>r;++r){var T=n[r].s;if(t>=_[T])break;g+=P-(1<<p-_[T]),_[T]=t}for(g>>>=R;g>0;){var F=n[r].s;t>_[F]?g-=1<<t-_[F]++-1:++r}for(;r>=0&&g;--r){var O=n[r].s;_[O]==t&&(--_[O],++g)}p=t}return[new ge(_),p]},Ir=function(e,t,i){return e.s==-1?Math.max(Ir(e.l,t,i+1),Ir(e.r,t,i+1)):t[e.s]=i},Es=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new ae(++t),r=0,s=e[0],n=1,a=function(l){i[r++]=l},o=1;t>=o;++o)if(e[o]==s&&o!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(s),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(s);n=1,s=e[o]}return[i.subarray(0,r),t]},wt=function(e,t){for(var i=0,r=0;t.length>r;++r)i+=e[r]*t[r];return i},Tr=function(e,t,i){var r=i.length,s=Zn(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;r>n;++n)e[s+n+4]=i[n];return 8*(s+4+r)},xs=function(e,t,i,r,s,n,a,o,l,c,u){Re(t,u++,i),++s[256];for(var h=ji(s,15),d=h[0],_=h[1],p=ji(n,15),g=p[0],R=p[1],P=Es(d),T=P[0],F=P[1],O=Es(g),f=O[0],S=O[1],k=new ae(19),y=0;T.length>y;++y)k[31&T[y]]++;for(y=0;f.length>y;++y)k[31&f[y]]++;for(var x=ji(k,7),I=x[0],C=x[1],M=19;M>4&&!I[bs[M-1]];--M);var A,L,K,Z,oe=c+5<<3,G=wt(s,Xe)+wt(n,bi)+a,te=wt(s,d)+wt(n,g)+a+14+3*M+wt(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(G>=oe&&te>=oe)return Tr(t,u,e.subarray(l,l+c));if(Re(t,u,1+(G>te)),u+=2,G>te){A=Mt(d,_,0),L=d,K=Mt(g,R,0),Z=g;var de=Mt(I,C,0);for(Re(t,u,F-257),Re(t,u+5,S-1),Re(t,u+10,M-4),u+=14,y=0;M>y;++y)Re(t,u+3*y,I[bs[y]]);u+=3*M;for(var ve=[T,f],$e=0;2>$e;++$e){var ue=ve[$e];for(y=0;ue.length>y;++y)Re(t,u,de[me=31&ue[y]]),u+=I[me],me>15&&(Re(t,u,ue[y]>>>5&127),u+=ue[y]>>>12)}}else A=Io,L=Xe,K=To,Z=bi;for(y=0;o>y;++y)if(r[y]>255){var me;bt(t,u,A[257+(me=r[y]>>>18&31)]),u+=L[me+257],me>7&&(Re(t,u,r[y]>>>23&31),u+=Gr[me]);var ye=31&r[y];bt(t,u,K[ye]),u+=Z[ye],ye>3&&(bt(t,u,r[y]>>>5&8191),u+=Yr[ye])}else bt(t,u,A[r[y]]),u+=L[r[y]];return bt(t,u,A[256]),u+L[256]},Oo=new gt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Co=(function(){for(var e=new gt(256),t=0;256>t;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e})(),Hi=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Mo(e,t){t===void 0&&(t={});var i=(function(){var h=4294967295;return{p(d){for(var _=h,p=0;d.length>p;++p)_=Co[255&_^d[p]]^_>>>8;h=_},d(){return 4294967295^h}}})(),r=e.length;i.p(e);var s,n,a,o,l,c=(o=10+((s=t).filename&&s.filename.length+1||0),l=8,(function(h,d,_,p,g,R){var P=h.length,T=new ge(p+P+5*(1+Math.floor(P/7e3))+g),F=T.subarray(p,T.length-g),O=0;if(!d||8>P)for(var f=0;P>=f;f+=65535){var S=f+65535;P>S?O=Tr(F,O,h.subarray(f,S)):(F[f]=!0,O=Tr(F,O,h.subarray(f,P)))}else{for(var k=Oo[d-1],y=k>>>13,x=8191&k,I=(1<<_)-1,C=new ae(32768),M=new ae(I+1),A=Math.ceil(_/3),L=2*A,K=function(Ri){return(h[Ri]^h[Ri+1]<<A^h[Ri+2]<<L)&I},Z=new gt(25e3),oe=new ae(288),G=new ae(32),te=0,de=0,ve=(f=0,0),$e=0,ue=0;P>f;++f){var me=K(f),ye=32767&f,Je=M[me];if(C[ye]=Je,M[me]=ye,f>=$e){var zt=P-f;if((te>7e3||ve>24576)&&zt>423){O=xs(h,F,0,Z,oe,G,de,ve,ue,f-ue,O),ve=te=de=0,ue=f;for(var be=0;286>be;++be)oe[be]=0;for(be=0;30>be;++be)G[be]=0}var je=2,Vt=0,pa=x,Ae=ye-Je&32767;if(zt>2&&me==K(f-Ae))for(var _a=Math.min(y,zt)-1,ga=Math.min(32767,f),fa=Math.min(258,zt);ga>=Ae&&--pa&&ye!=Je;){if(h[f+je]==h[f+je-Ae]){for(var Le=0;fa>Le&&h[f+Le]==h[f+Le-Ae];++Le);if(Le>je){if(je=Le,Vt=Ae,Le>_a)break;var ma=Math.min(Ae,Le-2),Zr=0;for(be=0;ma>be;++be){var $i=f-Ae+be+32768&32767,Qr=$i-C[$i]+32768&32767;Qr>Zr&&(Zr=Qr,Je=$i)}}}Ae+=(ye=Je)-(Je=C[ye])+32768&32767}if(Vt){Z[ve++]=268435456|Rr[je]<<18|ws[Vt];var es=31&Rr[je],ts=31&ws[Vt];de+=Gr[es]+Yr[ts],++oe[257+es],++G[ts],$e=f+je,++te}else Z[ve++]=h[f],++oe[h[f]]}}O=xs(h,F,!0,Z,oe,G,de,ve,ue,f-ue,O)}return Qn(T,0,p+Zn(O)+g)})(n=e,(a=t).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+a.mem,o,l)),u=c.length;return(function(h,d){var _=d.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>d.level?4:d.level==9?2:0,h[9]=3,d.mtime!=0&&Hi(h,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),_){h[3]=8;for(var p=0;_.length>=p;++p)h[p+10]=_.charCodeAt(p)}})(c,t),Hi(c,u-8,i.d()),Hi(c,u-4,r),c}var Ao=!!Zi||!!Ji,ea="text/plain",ks=!1,Si=function(e,t,i){var r;i===void 0&&(i=!0);var[s,n]=e.split("?"),a=m({},t),o=(r=n?.split("&").map((c=>{var u,[h,d]=c.split("="),_=i&&(u=a[h])!==null&&u!==void 0?u:d;return delete a[h],h+"="+_})))!==null&&r!==void 0?r:[],l=(function(c,u){var h,d;u===void 0&&(u="&");var _=[];return j(c,(function(p,g){E(p)||E(g)||g==="undefined"||(h=encodeURIComponent((R=>R instanceof File)(p)?p.name:p.toString()),d=encodeURIComponent(g),_[_.length]=d+"="+h)})),_.join(u)})(a);return l&&o.push(l),s+"?"+o.join("&")},ut=(e,t)=>JSON.stringify(e,((i,r)=>typeof r=="bigint"?r.toString():r),t),zi=e=>{if(e.tr)return e.tr;var{data:t,compression:i}=e;if(t){if(i===xe.GZipJS){var r=Mo((function(a,o){var l=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var c=new ge(a.length+(a.length>>>1)),u=0,h=function(g){c[u++]=g},d=0;l>d;++d){if(u+5>c.length){var _=new ge(u+8+(l-d<<1));_.set(c),c=_}var p=a.charCodeAt(d);128>p?h(p):2048>p?(h(192|p>>>6),h(128|63&p)):p>55295&&57344>p?(h(240|(p=65536+(1047552&p)|1023&a.charCodeAt(++d))>>>18),h(128|p>>>12&63),h(128|p>>>6&63),h(128|63&p)):(h(224|p>>>12),h(128|p>>>6&63),h(128|63&p))}return Qn(c,0,u)})(ut(t)),{mtime:0});return{contentType:ea,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===xe.Base64){var s=(a=>"data="+encodeURIComponent(typeof a=="string"?a:ut(a)))((function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,((o,l)=>String.fromCharCode(parseInt(l,16)))))})(ut(t)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=ut(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Lo=(function(){var e=_e((function*(t){var i=yield(function(s,n,a){return Qi.apply(this,arguments)})(ut(t.data),ne.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return m({},t,{tr:{contentType:ea,body:r,estimatedSize:r.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),Ss=(e,t)=>Si(e,{_:new Date().getTime().toString(),ver:ne.JS_SDK_VERSION,compression:t}),ri=[];Ji&&ri.push({transport:"fetch",method(e){var t,i,{contentType:r,body:s,estimatedSize:n}=(t=zi(e))!==null&&t!==void 0?t:{},a=new Headers;j(e.headers,(function(u,h){a.append(h,u)})),r&&a.append("Content-Type",r);var o=e.url,l=null;if(is){var c=new is;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}Ji(o,m({method:e?.method||"GET",headers:a,keepalive:e.method==="POST"&&52428.8>(n||0),body:s,signal:(i=l)==null?void 0:i.signal},e.fetchOptions)).then((u=>u.text().then((h=>{var d={statusCode:u.status,text:h};if(u.status===200)try{d.json=JSON.parse(h)}catch(_){w.error(_)}e.callback==null||e.callback(d)})))).catch((u=>{w.error(u),e.callback==null||e.callback({statusCode:0,error:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Zi&&ri.push({transport:"XHR",method(e){var t,i=new Zi;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=(t=zi(e))!==null&&t!==void 0?t:{};j(e.headers,(function(n,a){i.setRequestHeader(a,n)})),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(i.readyState===4){var n={statusCode:i.status,text:i.responseText};if(i.status===200)try{n.json=JSON.parse(i.responseText)}catch{}e.callback==null||e.callback(n)}},i.send(s)}}),ce!=null&&ce.sendBeacon&&ri.push({transport:"sendBeacon",method(e){var t=Si(e.url,{beacon:"1"});try{var i,{contentType:r,body:s}=(i=zi(e))!==null&&i!==void 0?i:{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});ce.sendBeacon(t,n)}catch{}}});var Or=3e3,qo=class{constructor(e,t){this.Ar=!0,this.Nr=[],this.$r=Pe(t?.flush_interval_ms||Or,250,5e3,w.createLogger("flush interval"),Or),this.Dr=e}enqueue(e){this.Nr.push(e),this.qr||this.jr()}unload(){this.Hr();var e=this.Nr.length>0?this.Ur():{},t=Object.values(e);[...t.filter((i=>i.url.indexOf("/e")===0)),...t.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Dr(m({},i,{transport:"sendBeacon"}))}))}enable(){this.Ar=!1,this.jr()}jr(){var e=this;this.Ar||(this.qr=setTimeout((()=>{if(this.Hr(),this.Nr.length>0){var t=this.Ur(),i=function(){var s=t[r],n=new Date().getTime();s.data&&D(s.data)&&j(s.data,(a=>{a.offset=Math.abs(a.timestamp-n),delete a.timestamp})),e.Dr(s)};for(var r in t)i()}}),this.$r))}Hr(){clearTimeout(this.qr),this.qr=void 0}Ur(){var e={};return j(this.Nr,(t=>{var i,r=t,s=(r?r.batchKey:null)||r.url;E(e[s])&&(e[s]=m({},r,{data:[]})),(i=e[s].data)==null||i.push(r.data)})),this.Nr=[],e}},No=["retriesPerformedSoFar"],Do=class{constructor(e){this.Br=!1,this.zr=3e3,this.Nr=[],this._instance=e,this.Nr=[],this.Vr=!0,!E(v)&&"onLine"in v.navigator&&(this.Vr=v.navigator.onLine,this.Wr=()=>{this.Vr=!0,this.Zr()},this.Gr=()=>{this.Vr=!1},X(v,"online",this.Wr),X(v,"offline",this.Gr))}get length(){return this.Nr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=sn(e,No);rt(t)&&(i.url=Si(i.url,{retry_count:t})),this._instance._send_request(m({},i,{callback:r=>{r.statusCode===200||r.statusCode>=400&&500>r.statusCode||(t??0)>=10?i.callback==null||i.callback(r):this.Qr(m({retriesPerformedSoFar:t},i))}}))}Qr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(n){var a=3e3*Math.pow(2,n),o=a/2,l=Math.min(18e5,a),c=Math.random()-.5;return Math.ceil(l+c*(l-o))})(t),r=Date.now()+i;this.Nr.push({retryAt:r,requestOptions:e});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),w.warn(s),this.Br||(this.Br=!0,this.Jr())}Jr(){if(this.Kr&&clearTimeout(this.Kr),this.Nr.length===0)return this.Br=!1,void(this.Kr=void 0);this.Kr=setTimeout((()=>{this.Vr&&this.Nr.length>0&&this.Zr(),this.Jr()}),this.zr)}Zr(){var e=Date.now(),t=[],i=this.Nr.filter((s=>e>s.retryAt||(t.push(s),!1)));if(this.Nr=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Kr&&(clearTimeout(this.Kr),this.Kr=void 0),this.Br=!1,E(v)||(this.Wr&&(v.removeEventListener("online",this.Wr),this.Wr=void 0),this.Gr&&(v.removeEventListener("offline",this.Gr),this.Gr=void 0)),this.Nr))try{this._instance._send_request(m({},e,{transport:"sendBeacon"}))}catch(t){w.error(t)}this.Nr=[]}},Uo=class{constructor(e){this.Yr=()=>{var t,i,r,s;this.Xr||(this.Xr={});var n=this.scrollElement(),a=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=a+(n?.clientHeight||0),c=n?.scrollHeight||0;this.Xr.lastScrollY=Math.ceil(a),this.Xr.maxScrollY=Math.max(a,(t=this.Xr.maxScrollY)!==null&&t!==void 0?t:0),this.Xr.maxScrollHeight=Math.max(o,(i=this.Xr.maxScrollHeight)!==null&&i!==void 0?i:0),this.Xr.lastContentY=l,this.Xr.maxContentY=Math.max(l,(r=this.Xr.maxContentY)!==null&&r!==void 0?r:0),this.Xr.maxContentHeight=Math.max(c,(s=this.Xr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get ei(){return this._instance.config.scroll_root_selector}getContext(){return this.Xr}resetContext(){var e=this.Xr;return setTimeout(this.Yr,0),e}startMeasuringScrollPosition(){X(v,"scroll",this.Yr,{capture:!0}),X(v,"scrollend",this.Yr,{capture:!0}),X(v,"resize",this.Yr)}scrollElement(){if(!this.ei)return v?.document.documentElement;for(var e of D(this.ei)?this.ei:[this.ei]){var t=v?.document.querySelector(e);if(t)return t}}scrollY(){if(this.ei){var e=this.scrollElement();return e&&e.scrollTop||0}return v&&(v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop)||0}scrollX(){if(this.ei){var e=this.scrollElement();return e&&e.scrollLeft||0}return v&&(v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft)||0}},jo=e=>Bn(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties),Ps=class{constructor(e,t,i,r){this.ti=s=>{var n=this.ri();if(!n||n.sessionId!==s){var a={sessionId:s,props:this.ii(this._instance)};this.ni.register({[br]:a})}},this._instance=e,this.si=t,this.ni=i,this.ii=r||jo,this.si.onSessionId(this.ti)}ri(){return this.ni.props[br]}getSetOnceProps(){var e,t=(e=this.ri())==null?void 0:e.props;return t?"r"in t?Gn(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 j(Br(this.getSetOnceProps()),((t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+er(i)]=t})),e}},Xr=class{constructor(){this.oi={}}on(e,t){return this.oi[e]||(this.oi[e]=[]),this.oi[e].push(t),()=>{this.oi[e]=this.oi[e].filter((i=>i!==t))}}emit(e,t){for(var i of this.oi[e]||[])i(t);for(var r of this.oi["*"]||[])r(e,t)}},Vi=z("[SessionId]"),$s=class{on(e,t){return this.ai.on(e,t)}constructor(e,t,i){var r;if(this.ui=[],this.li=void 0,this.ai=new Xr,this.hi=(l,c)=>!(!rt(l)||!rt(c))&&Math.abs(l-c)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Oe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=e.config,this.ni=e.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=t||Ue,this.fi=i||Ue;var s=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*Pe(this.qt.session_idle_timeout_seconds||1800,60,36e3,Vi.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+s+"_window_id",this.mi="ph_"+s+"_primary_window_exists",this.yi()){var n=ee.F(this.gi),a=ee.F(this.mi);n&&!a?this.ci=n:ee.q(this.gi),ee.N(this.mi,!0)}if((r=this.qt.bootstrap)!=null&&r.sessionID)try{var o=(l=>{var c=this.qt.bootstrap.sessionID.replace(/-/g,"");if(c.length!==32)throw new Error("Not a valid UUID");if(c[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(c.substring(0,12),16)})();this.bi(this.qt.bootstrap.sessionID,new Date().getTime(),o)}catch(l){Vi.error("Invalid sessionID in bootstrap",l)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return E(this.ui)&&(this.ui=[]),this.ui.push(e),this.di&&e(this.di,this.ci),()=>{this.ui=this.ui.filter((t=>t!==e))}}yi(){return this.qt.persistence!=="memory"&&!this.ni._r&&ee.R()}xi(e){e!==this.ci&&(this.ci=e,this.yi()&&ee.N(this.gi,e))}Si(){return this.ci?this.ci:this.yi()?ee.F(this.gi):null}bi(e,t,i){e===this.di&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.di=e,this.ni.register({[ci]:[t,e,i]}))}ki(){var e=this.ni.props[ci];return D(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.bi(null,null,null)}destroy(){clearTimeout(this.Ci),this.Ci=void 0,this.li&&v&&(v.removeEventListener(_i,this.li,{capture:!1}),this.li=void 0),this.ui=[]}wi(){this.li=()=>{this.yi()&&ee.q(this.mi)},X(v,_i,this.li,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.qt.cookieless_mode===Oe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[r,s,n]=this.ki(),a=this.Si(),o=rt(n)&&Math.abs(i-n)>864e5,l=!1,c=!s,u=!c&&!e&&this.hi(i,r);c||u||o?(s=this.vi(),a=this.fi(),Vi.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:o}}),n=i,l=!0):a||(a=this.fi(),l=!0);var h=rt(r)&&e&&!o?r:i,d=rt(n)?n:new Date().getTime();return this.xi(a),this.bi(s,h,d),e||this.pi(),l&&this.ui.forEach((_=>_(s,a,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:o}:void 0))),{sessionId:s,windowId:a,sessionStartTimestamp:d,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:o}:void 0,lastActivityTimestamp:r}}pi(){clearTimeout(this.Ci),this.Ci=setTimeout((()=>{var[e]=this.ki();if(this.hi(new Date().getTime(),e)){var t=this.di;this.resetSessionId(),this.ai.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},ta=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&ns(i,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((s=>ns(s?.brand,t))))return!0}catch{}return!!e.webdriver},wi=function(e,t){if(!(function(i){try{new RegExp(i)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function Rs(e,t,i){return ut({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var ia={exact:(e,t)=>t.some((i=>e.some((r=>i===r)))),is_not:(e,t)=>t.every((i=>e.every((r=>i!==r)))),regex:(e,t)=>t.some((i=>e.some((r=>wi(i,r))))),not_regex:(e,t)=>t.every((i=>e.every((r=>!wi(i,r))))),icontains:(e,t)=>t.map(Jt).some((i=>e.map(Jt).some((r=>i.includes(r))))),not_icontains:(e,t)=>t.map(Jt).every((i=>e.map(Jt).every((r=>!i.includes(r))))),gt:(e,t)=>t.some((i=>{var r=parseFloat(i);return!isNaN(r)&&e.some((s=>r>parseFloat(s)))})),lt:(e,t)=>t.some((i=>{var r=parseFloat(i);return!isNaN(r)&&e.some((s=>r<parseFloat(s)))}))},Jt=e=>e.toLowerCase();function ra(e,t){return!e||Object.entries(e).every((i=>{var[r,s]=i,n=t?.[r];if(E(n)||Me(n))return!1;var a=[String(n)],o=ia[s.operator];return!!o&&o(s.values,a)}))}var Cr="custom",Fs="i.posthog.com",Ho=/^\/static\//,zo=class{constructor(e){this.Ii={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"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=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Fs,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Ii[this.apiHost]||(this.Ii[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Cr),this.Ii[this.apiHost]}Ti(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof t=="string"&&Ho.test(e))return t.trim().replace(/\/$/,"")||void 0}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(e==="assets"){var i=this.Ti(t);if(i)return""+i+t}if(this.region===Cr)return this.apiHost+t;var r=Fs+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}},U=z("[Surveys]"),Mr="seenSurvey_",Vo=[Di.Popover,Di.Widget,Di.API],Wo={ignoreConditions:!1,ignoreDelay:!1,displayType:$r.Popover},Bo=z("[PostHog ExternalIntegrations]"),Go={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Yo=class{constructor(e){this._instance=e}lr(e,t){var i;(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(r=>{if(r)return Bo.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(n){var a,o,l;!r||(a=$.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[n]||e.lr(Go[n],(()=>{var c;(c=$.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[n])==null||c.start(e._instance)})),!r&&(o=$.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[n]&&((l=$.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[n])==null||l.stop())};for(var[i,r]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;t(i)}}},tt,At={},Wi=0,Ar=()=>{},Is='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Et="Surveys module not available",Ts="sanitize_properties is deprecated. Use before_send instead",sa="Invalid value for property_denylist config: ",at="posthog",na=!Ao&&le?.indexOf("MSIE")===-1&&le?.indexOf("Mozilla")===-1,Os=e=>{var t;return m({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:uo(b?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ar,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:Q&&W(Q?.search)&&Q.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(t=v.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(i){w.error("Bad HTTP status: "+i.statusCode+" "+i.text)},get_device_id:i=>i,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Sr,before_send:void 0,request_queue_config:{flush_interval_ms:Or},error_tracking:{},_onCapture:Ar,__preview_eager_load_replay:!1},(i=>({rageclick:!i||"2025-11-30">i||{content_ignorelist:!0},capture_pageview:!i||"2025-05-24">i||"history_change",session_recording:i&&i>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:i&&i>="2026-01-30"?"head":"body",internal_or_test_user_hostname:i&&i>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},Xo=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Cs=e=>{var t={};for(var[i,r]of Xo)E(e[i])||(t[r]=e[i]);var s=B({},t,e);return D(e.property_blacklist)&&(E(e.property_denylist)?s.property_denylist=e.property_blacklist:D(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:w.error(sa+e.property_denylist)),s},Ko=class{constructor(){this.__forceAllowLocalhost=!1}get Ei(){return this.__forceAllowLocalhost}set Ei(e){w.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Lt=class Ge{Mi(t,i){if(t){var r=this.Pi.indexOf(t);r!==-1&&this.Pi.splice(r,1)}return this.Pi.push(i),i.initialize==null||i.initialize(),i}Ri(){return this.config.cookieless_mode===Oe||this.config.cookieless_mode===Be&&this.consent.isRejected()}get decideEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)==null?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)==null?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.webPerformance=new Ko,this.Oi=!1,this.version=ne.LIB_VERSION,this.Li=new Xr,this.Pi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Os(),this.SentryIntegration=wo,this.sentryIntegration=r=>(function(s,n){var a=jn(s,n);return{name:Un,processEvent:o=>a(o)}})(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Ai=null,this.Ni=null,this.$i=null,this.scrollManager=new Uo(this),this.pageViewManager=new gs(this),this.rateLimiter=new Fo(this),this.requestRouter=new zo(this),this.consent=new mo(this),this.externalIntegrations=new Yo(this);var i=(t=Ge.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(r,s,n)=>{var a=W(r)?{[r]:s}:r;this.setPersonProperties(a),n?.({})},set_once:(r,s,n)=>{var a=W(r)?{[r]:s}:r;this.setPersonProperties(void 0,a),n?.({})}},this.on("eventCaptured",(r=>w.info('send "'+r?.event+'"',r)))}init(t,i,r){if(r&&r!==at){var s,n=(s=At[r])!==null&&s!==void 0?s:new Ge;return n._init(t,i,r),At[r]=n,At[at][r]=n,n}return this._init(t,i,r)}_init(t,i,r){var s,n;if(i===void 0&&(i={}),E(t)||Qt(t))return w.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={},i.debug=this.Di(i.debug),this.qi=i,this.ji=[],i.person_profiles?this.Ni=i.person_profiles:i.process_person&&(this.Ni=i.process_person),this.set_config(B({},Os(i.defaults),Cs(i),{name:r,token:t})),this.config.on_xhr_error&&w.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:xe.GZipJS;var a=this.Hi();this.persistence=new Ni(this.config,a),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ni(m({},this.config,{persistence:"sessionStorage"}),a);var o=m({},this.persistence.props),l=m({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ui=new qo((R=>this.Bi(R)),this.config.request_queue_config),this.zi=new Do(this),this.__request_queue=[];var c=this.Ri();if(c||(this.sessionManager=new $s(this),this.sessionPropsManager=new Ps(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(w.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Vi(c)}),0)):(w.info("Initializing extensions synchronously"),this.Vi(c)),ne.DEBUG=ne.DEBUG||this.config.debug,ne.DEBUG&&w.info("Starting in debug mode",{this:this,config:i,thisC:m({},this.config),p:o,s:l}),!this.config.identity_distinct_id||(s=i.bootstrap)!=null&&s.distinctID||(i.bootstrap=m({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((n=i.bootstrap)==null?void 0:n.distinctID)!==void 0){var u=i.bootstrap.distinctID,h=this.get_distinct_id(),d=this.persistence.get_property(we);if(i.bootstrap.isIdentifiedID&&h!=null&&h!==u&&d===Ze)this.identify(u);else if(i.bootstrap.isIdentifiedID&&h!=null&&h!==u&&d===Qe)w.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var _=this.config.get_device_id(Ue()),p=i.bootstrap.isIdentifiedID?_:u;this.persistence.set_property(we,i.bootstrap.isIdentifiedID?Qe:Ze),this.register({distinct_id:u,$device_id:p})}}if(c)this.register_once({distinct_id:Bt,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(Ue());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(we,Ze)}return X(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?(function(R,P){var T=R.config.segment;if(!T)return P();(function(F,O){var f=F.config.segment;if(!f)return O();var S=y=>{var x=()=>y.anonymousId()||Ue();F.config.get_device_id=x,y.id()&&(F.register({distinct_id:y.id(),$device_id:x()}),F.persistence.set_property(we,Qe)),O()},k=f.user();"then"in k&&Te(k.then)?k.then(S):S(k)})(R,(()=>{T.register((F=>{Promise&&Promise.resolve||qi.warn("This browser does not have Promise support, and can not use the segment integration");var O=(f,S)=>{if(!S)return f;f.event.userId||f.event.anonymousId===F.get_distinct_id()||(qi.info("No userId set, resetting PostHog"),F.reset()),f.event.userId&&f.event.userId!==F.get_distinct_id()&&(qi.info("UserId set, identifying with PostHog"),F.identify(f.event.userId));var k=F.calculateEventProperties(S,f.event.properties);return f.event.properties=Object.assign({},k,f.event.properties),f};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:f=>O(f,f.event.event),page:f=>O(f,nt),identify:f=>O(f,Ai),screen:f=>O(f,"$screen")}})(R)).then((()=>{P()}))}))})(this,(()=>this.Wi())):this.Wi(),Te(this.config._onCapture)&&this.config._onCapture!==Ar&&(w.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(R=>this.config._onCapture(R.event,R)))),this.config.ip&&w.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}Vi(t){var i,r,s,n,a,o,l,c=performance.now(),u=m({},Ge.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.Pi.push(this.featureFlags=(i=this.featureFlags)!==null&&i!==void 0?i:new u.featureFlags(this)),u.exceptions&&this.Pi.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new u.exceptions(this)),u.historyAutocapture&&this.Pi.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Pi.push(new u.tracingHeaders(this)),u.siteApps&&this.Pi.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Pi.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Pi.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Pi.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new u.surveys(this)),u.logs&&this.Pi.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new u.logs(this)),u.conversations&&this.Pi.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new u.conversations(this)),u.productTours&&this.Pi.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Pi.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Pi.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Pi.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Pi.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,bo)),u.toolbar&&this.Pi.push(this.toolbar=(o=this.toolbar)!==null&&o!==void 0?o:new u.toolbar(this)),u.experiments&&this.Pi.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new u.experiments(this)),this.Pi.forEach((d=>{d.initialize&&h.push((()=>{d.initialize==null||d.initialize()}))})),h.push((()=>{if(this.Zi){var d=this.Zi;this.Zi=void 0,this.Rr(d)}})),this.Gi(h,c)}Gi(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.Gi(t,i)}),0);var r=t.shift();if(r)try{r()}catch(n){w.error("Error initializing extension:",n)}}var s=Math.round(performance.now()-i);this.register_for_session({[An]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ln]:s}),this.config.__preview_deferred_init_extensions&&w.info("PostHog extensions initialized ("+s+"ms)")}Rr(t){var i;if(!b||!b.body)return w.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Rr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Zi=t),this.Qi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=q(t.supportedCompression,xe.GZipJS)?xe.GZipJS:q(t.supportedCompression,xe.Base64)?xe.Base64:void 0),(i=t.analytics)!=null&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Ni?this.Ni:Sr}),this.Pi.forEach((r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(t)))}Wi(){try{this.config.loaded(this)}catch(r){w.critical("`loaded` function failed",r)}if(this.Ji(),this.config.internal_or_test_user_hostname&&Q!=null&&Q.hostname){var t=Q.hostname,i=this.config.internal_or_test_user_hostname;(typeof i=="string"?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ri())&&this.Ki()}),1),this.Yi=new Xn(this),this.Yi.load()}Ji(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Ui)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Gt(this.__request_queue,(t=>this.Bi(t))),this.__request_queue=[],this.Ji()}_handle_unload(){var t,i,r,s;(t=this.surveys)==null||t.handlePageUnload(),this.config.request_batching?(this.Xi()&&this.capture(Mi),(i=this.logs)==null||i.flushLogs("sendBeacon"),(r=this.Ui)==null||r.unload(),(s=this.zi)==null||s.unload()):this.Xi()&&this.capture(Mi,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(na?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Si(t.url,{ip:this.config.ip?1:0}),t.headers=m({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(i=>{var r,s,n,a=m({},i);a.timeout=a.timeout||6e4,a.url=Ss(a.url,a.compression);var o=(r=a.transport)!==null&&r!==void 0?r:"fetch",l=ri.filter((u=>!a.disableTransport||!u.transport||!a.disableTransport.includes(u.transport))),c=(s=(n=(function(u,h){for(var d=0;u.length>d;d++)if(u[d].transport===o)return u[d]})(l))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!c)throw new Error("No available transport method");o!=="sendBeacon"&&a.data&&a.compression===xe.GZipJS&&ya&&!ks?Lo(a).then((u=>{c(u)})).catch((u=>{if((h=>!(!h||typeof h!="object")&&("name"in h?String(h.name):"")==="NotReadableError")(u))return ks=!0,void c(m({},a,{compression:void 0,url:Ss(i.url,void 0)}));c(a)})):c(a)})(m({},t,{callback:i=>{var r,s;this.rateLimiter.checkForLimiting(i),400>i.statusCode||(r=(s=this.config).on_request_error)==null||r.call(s,i),t.callback==null||t.callback(i)}}))))}Bi(t){this.zi?this.zi.retriableRequest(t):this._send_request(t)}_execute_array(t){Wi++;try{var i,r=[],s=[],n=[];Gt(t,(o=>{o&&(D(i=o[0])?n.push(o):Te(o)?o.call(this):D(o)&&i==="alias"?r.push(o):D(o)&&i.indexOf("capture")!==-1&&Te(this[i])?n.push(o):s.push(o))}));var a=function(o,l){Gt(o,(function(c){if(D(c[0])){var u=l;j(c,(function(h){u=u[h[0]].apply(u,h.slice(1))}))}else l[c[0]].apply(l,c.slice(1))}))};a(r,this),a(s,this),a(n,this)}finally{Wi--}}push(t){if(Wi>0&&D(t)&&W(t[0])){var i=Ge.prototype[t[0]];Te(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,r){var s,n,a,o,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ui){if(this.is_capturing())if(!E(t)&&W(t)){var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(!c||this.config.__preview_capture_bot_pageviews){var u=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(u==null||!u.isRateLimited){i!=null&&i.$current_url&&!W(i?.$current_url)&&(w.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),i==null||delete i.$current_url),t!=="$exception"||r!=null&&r.en||w.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=r?.timestamp||h,_=Ue(),p={uuid:_,event:t,properties:this.calculateEventProperties(t,i||{},d,_)};t===nt&&this.config.__preview_capture_bot_pageviews&&c&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),r!=null&&r.$set&&(p.$set=r?.$set);var g,R,P,T=this.tn(r?.$set_once,t!==ds,t===Ai);if(T&&(p.$set_once=T),r!=null&&r._noTruncate||(n=this.config.properties_string_max_length,a=p,o=x=>W(x)?x.slice(0,n):x,l=new Set,p=(function x(I,C){return I!==Object(I)?o?o(I):I:l.has(I)?void 0:(l.add(I),D(I)?(M=[],Gt(I,(A=>{M.push(x(A))}))):(M={},j(I,((A,L)=>{l.has(A)||(M[L]=x(A,L))}))),M);var M})(a)),p.timestamp=d,E(r?.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=h),t===Tt.DISMISSED||t===Tt.SENT){var F=i?.[Ui.SURVEY_ID],O=i?.[Ui.SURVEY_ITERATION];(x=>{try{var I=(C=>((M,A)=>{var L=""+Mr+A.id;return A.current_iteration&&A.current_iteration>0&&(L=""+Mr+A.id+"_"+A.current_iteration),L})(0,C))(x);if(localStorage.getItem(I))return;localStorage.setItem(I,"true")}catch(C){U.error("Failed to persist survey seen state",C)}})({id:F,current_iteration:O}),p.$set=m({},p.$set,{[(g={id:F,current_iteration:O},R=t===Tt.SENT?"responded":"dismissed",P="$survey_"+R+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(P="$survey_"+R+"/"+g.id+"/"+g.current_iteration),P)]:!0})}else t===Tt.SHOWN&&(p.$set=m({},p.$set,{[Ui.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===Ro.SHOWN){var f=i?.[ms.TOUR_TYPE];f&&(p.$set=m({},p.$set,{[ms.TOUR_LAST_SEEN_DATE+"/"+f]:new Date().toISOString()}))}var S=m({},p.properties.$set,p.$set);if(ot(S)||this.setPersonPropertiesForFlags(S),!N(this.config.before_send)){var k=this.rn(p);if(!k)return;p=k}this.Li.emit("eventCaptured",p);var y={method:"POST",url:(s=r?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Bi(y):this.Ui.enqueue(y),p}w.critical("This capture call is ignored due to client rate limiting.")}}else w.error("No event name provided to posthog.capture")}else w.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,r,s,n){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;var a=n?void 0:this.persistence.remove_event_timer(t),o=m({},i);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.Ri()&&(o.$cookieless_mode=!0),t==="$snapshot"){var l=m({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!W(o.distinct_id)&&!fe(o.distinct_id)||Qt(o.distinct_id))&&w.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var c,u=(function(P,T){var F,O,f,S;if(!le)return{};var k,y,x,I,C,M,A,L,K=P?[..._t,...T||[]]:[],[Z,oe]=(function(G){for(var te=0;ls.length>te;te++){var[de,ve]=ls[te],$e=de.exec(G),ue=$e&&(Te(ve)?ve($e,G):ve);if(ue)return ue}return["",""]})(le);return B(Br({$os:Z,$os_version:oe,$browser:xn(le,navigator.vendor),$device:us(le),$device_type:(y=le,x={userAgentDataPlatform:(F=navigator)==null||(F=F.userAgentData)==null?void 0:F.platform,maxTouchPoints:(O=navigator)==null?void 0:O.maxTouchPoints,screenWidth:v==null||(f=v.screen)==null?void 0:f.width,screenHeight:v==null||(S=v.screen)==null?void 0:S.height,devicePixelRatio:v?.devicePixelRatio},L=us(y),L===un||L===ln||L==="Kobo"||L==="Kindle Fire"||L===En?dt:L===Nt||L===ht||L===Dt||L===ir?"Console":L===hn?"Wearable":L?he:x?.userAgentDataPlatform==="Android"&&((I=x?.maxTouchPoints)!==null&&I!==void 0?I:0)>0?600>Math.min((C=x?.screenWidth)!==null&&C!==void 0?C:0,(M=x?.screenHeight)!==null&&M!==void 0?M:0)/((A=x?.devicePixelRatio)!==null&&A!==void 0?A:1)?he:dt:"Desktop"),$timezone:Yn(),$timezone_offset:Po()}),{$current_url:Ut(Q?.href,K,jt),$host:Q?.host,$pathname:Q?.pathname,$raw_user_agent:le.length>1e3?le.substring(0,997)+"...":le,$browser_version:Aa(le,navigator.vendor),$browser_language:fs(),$browser_language_prefix:(k=fs(),typeof k=="string"?k.split("-")[0]:void 0),$screen_height:v?.screen.height,$screen_width:v?.screen.width,$viewport_height:v?.innerHeight,$viewport_width:v?.innerWidth,$lib:ne.LIB_NAME,$lib_version:ne.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(n,r.getTime());o.$session_id=h,o.$window_id=d}this.sessionPropsManager&&B(o,this.sessionPropsManager.getSessionProps());try{var _;this.sessionRecording&&B(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(_=this.zi)==null?void 0:_.length}catch(P){o.$sdk_debug_error_capturing_properties=String(P)}if(this.requestRouter.region===Cr&&(o.$lib_custom_api_host=this.config.api_host),c=t!==nt||n?t!==Mi||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),o=B(o,c),t===nt&&b&&(o.title=b.title),!E(a)){var p=r.getTime()-a;o.$duration=parseFloat((p/1e3).toFixed(3))}le&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=B({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),D(this.config.property_denylist)?j(this.config.property_denylist,(function(P){delete o[P]})):w.error(sa+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(w.error(Ts),o=g(o,t));var R=this.nn();return o.$process_person_profile=R,R&&!n&&this.sn("_calculate_event_properties"),o}tn(t,i,r){var s;if(i===void 0&&(i=!0),r===void 0&&(r=!1),!this.persistence||!this.nn()||this.Oi&&!r)return t;var n=B({},this.persistence.get_initial_props(),((s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps())||{},t||{}),a=this.config.sanitize_properties;return a&&(w.error(Ts),n=a(n,"$set_once")),i&&(this.Oi=!0),ot(n)?void 0:n}register(t,i){var r;(r=this.persistence)==null||r.register(t,i)}register_once(t,i,r){var s;(s=this.persistence)==null||s.register_once(t,i,r)}register_for_session(t){var i;(i=this.sessionPersistence)==null||i.register(t)}unregister(t){var i;(i=this.persistence)==null||i.unregister(t)}unregister_for_session(t){var i;(i=this.sessionPersistence)==null||i.unregister(t)}an(t,i){this.register({[t]:i})}getFeatureFlag(t,i){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return(i=this.featureFlags)==null?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(t,i)}isFeatureEnabled(t,i){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(t,i)}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,i,r){var s;(s=this.featureFlags)==null||s.updateFlags(t,i,r)}updateEarlyAccessFeatureEnrollment(t,i,r){var s;(s=this.featureFlags)==null||s.updateEarlyAccessFeatureEnrollment(t,i,r)}getEarlyAccessFeatures(t,i,r){var s;return i===void 0&&(i=!1),(s=this.featureFlags)==null?void 0:s.getEarlyAccessFeatures(t,i,r)}on(t,i){return this.Li.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Et}),()=>{})}onSessionId(t){var i,r;return(i=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&i!==void 0?i:()=>{}}getSurveys(t,i){i===void 0&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Et})}getActiveMatchingSurveys(t,i){i===void 0&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Et})}renderSurvey(t,i){var r;(r=this.surveys)==null||r.renderSurvey(t,i)}displaySurvey(t,i){var r;i===void 0&&(i=Wo),(r=this.surveys)==null||r.displaySurvey(t,i)}cancelPendingSurvey(t){var i;(i=this.surveys)==null||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,r;return(i=(r=this.surveys)==null?void 0:r.canRenderSurvey(t))!==null&&i!==void 0?i:{visible:!1,disabledReason:Et}}canRenderSurveyAsync(t,i){var r,s;return i===void 0&&(i=!1),(r=(s=this.surveys)==null?void 0:s.canRenderSurveyAsync(t,i))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:Et})}un(t){return!t||Qt(t)?(w.critical("Unique user id has not been set in posthog.identify"),!1):t===Bt?(w.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(w.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,r){if(!this.__loaded||!this.persistence)return w.uninitializedWarning("posthog.identify");if(fe(t)&&(t=t.toString(),w.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.un(t)&&this.sn("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:t}),this.get_property(ui)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),t!==s&&t!==this.get_property(Pt)&&(this.unregister(Pt),this.register({distinct_id:t}));var n,a=(this.persistence.get_property(we)||Ze)===Ze;t!==s&&a?(this.persistence.set_property(we,Qe),this.setPersonPropertiesForFlags({$set:i||{},$set_once:r||{}},!1),this.capture(Ai,{distinct_id:t,$anon_distinct_id:s},{$set:i||{},$set_once:r||{}}),this.$i=Rs(t,i,r),(n=this.featureFlags)==null||n.setAnonymousDistinctId(s)):(i||r)&&this.setPersonProperties(i,r),t!==s&&(this.reloadFeatureFlags(),this.unregister(Ct))}}setPersonProperties(t,i){if((t||i)&&this.sn("posthog.setPersonProperties")){var r=Rs(this.get_distinct_id(),t,i);this.$i!==r?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.$i=r):w.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,r){if(t&&i){var s=this.getGroups(),n=s[t]!==i;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:m({},s,{[t]:i})}),n||r){var a={$group_type:t,$group_key:i};r&&(a.$group_set=r),this.capture(ds,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else w.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var r;i===void 0&&(i=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){var t;(t=this.featureFlags)==null||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){var r;i===void 0&&(i=!0),this.sn("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;(i=this.featureFlags)==null||i.resetGroupPropertiesForFlags(t)}reset(t){var i,r,s,n,a,o,l,c;if(w.info("reset"),!this.__loaded)return w.uninitializedWarning("posthog.reset");var u=this.get_property(ui);if(this.consent.reset(),(i=this.persistence)==null||i.clear(),(r=this.sessionPersistence)==null||r.clear(),(s=this.surveys)==null||s.reset(),(n=this.Yi)==null||n.stop(),(a=this.featureFlags)==null||a.reset(),(o=this.conversations)==null||o.reset(),(l=this.persistence)==null||l.set_property(we,Ze),(c=this.sessionManager)==null||c.resetSessionId(),this.$i=null,this.config.cookieless_mode===Oe)this.register_once({distinct_id:Bt,$device_id:null},"");else{var h=this.config.get_device_id(Ue());this.register_once({distinct_id:h,$device_id:t?h:u},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,i){var r;this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),(r=this.conversations)==null||r.ln()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.hn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(t!=null&&t.withTimestamp&&r){var n,a=(n=t.timestampLookBack)!==null&&n!==void 0?n:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-a,0)}return s}alias(t,i){return t===this.get_property(Fn)?(w.critical("Attempting to create alias for existing People user - aborting."),-2):this.sn("posthog.alias")?(E(i)&&(i=this.get_distinct_id()),t!==i?(this.an(Pt,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(w.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=m({},this.config);if(Y(t)){var r,s,n,a,o,l,c,u,h,d;B(this.config,Cs(t));var _=this.Hi();(r=this.persistence)==null||r.update_config(this.config,i,_),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ni(m({},this.config,{persistence:"sessionStorage"}),_);var p=this.Di(this.config.debug);Se(p)&&(this.config.debug=p),Se(this.config.debug)&&(this.config.debug?(ne.DEBUG=!0,V.R()&&V.N("ph_debug",!0),w.info("set_config",{config:t,oldConfig:i,newConfig:m({},this.config)})):(ne.DEBUG=!1,V.R()&&V.q("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(n=this.exceptions)==null||n.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(l=this.heatmaps)==null||l.startIfEnabled(),(c=this.exceptionObserver)==null||c.startIfEnabledOrStop(),(u=this.deadClicksAutocapture)==null||u.startIfEnabledOrStop(),(h=this.surveys)==null||h.loadIfEnabled(),this.cn(),(d=this.externalIntegrations)==null||d.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){ne.LIB_NAME=t,ne.LIB_VERSION=i}startSessionRecording(t){var i,r,s,n,a,o=t===!0,l={sampling:o||!(t==null||!t.sampling),linked_flag:o||!(t==null||!t.linked_flag),url_trigger:o||!(t==null||!t.url_trigger),event_trigger:o||!(t==null||!t.event_trigger)};Object.values(l).some(Boolean)&&((i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),l.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),l.linked_flag&&((s=this.sessionRecording)==null||s.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,i){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(m({},s,i))}}addExceptionStep(t,i){var r;(r=this.exceptions)==null||r.addExceptionStep(t,i)}captureLog(t){var i;(i=this.logs)==null||i.captureLog(t)}get logger(){var t,i;return(t=(i=this.logs)==null?void 0:i.logger)!==null&&t!==void 0?t:Ge.dn}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,r;return(i=(r=this.toolbar)==null?void 0:r.loadToolbar(t))!==null&&i!==void 0&&i}get_property(t){var i;return(i=this.persistence)==null?void 0:i.props[t]}getSessionProperty(t){var i;return(i=this.sessionPersistence)==null?void 0:i.props[t]}toString(){var t,i=(t=this.config.name)!==null&&t!==void 0?t:at;return i!==at&&(i=at+"."+i),i}_isIdentified(){var t,i;return((t=this.persistence)==null?void 0:t.get_property(we))===Qe||((i=this.sessionPersistence)==null?void 0:i.get_property(we))===Qe}nn(){var t,i;return!(this.config.person_profiles==="never"||this.config.person_profiles===Sr&&!this._isIdentified()&&ot(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Pt])&&((i=this.persistence)==null||(i=i.props)==null||!i[vi]))}Xi(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.nn()||this.sn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.sn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}sn(t){return this.config.person_profiles==="never"?(w.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.an(vi,!0),!0)}Hi(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Be)}cn(){var t,i,r,s,n=this.Hi();return((t=this.persistence)==null?void 0:t._r)!==n&&((r=this.persistence)==null||r.set_disabled(n)),((i=this.sessionPersistence)==null?void 0:i._r)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==Oe){if(this.Ri()){var r,s,n,a,o;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new $s(this),this.pageViewManager=new gs(this),this.persistence&&(this.sessionPropsManager=new Ps(this,this.sessionManager,this.persistence));var l,c=(n=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&n!==void 0?n:(o=Ge.__defaultExtensionClasses)==null?void 0:o.sessionRecording;c&&(this.sessionRecording=this.Mi(this.sessionRecording,new c(this)),this.Qi&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this.Qi)))}var u,h;this.consent.optInOut(!0),this.cn(),this.Ji(),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),this.config.cookieless_mode==Be&&((u=this.surveys)==null||u.loadIfEnabled()),(E(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((h=t?.captureEventName)!==null&&h!==void 0?h:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ki()}else w.warn(Is)}opt_out_capturing(){var t,i,r;this.config.cookieless_mode!==Oe?(this.config.cookieless_mode===Be&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===Be&&(this.register({distinct_id:Bt,$device_id:null}),(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,(i=this.sessionManager)==null||i.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.Ki())):w.warn(Is)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Oe||(this.config.cookieless_mode===Be?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cn()}_is_bot(){return ce?ta(ce,this.config.custom_blocked_useragents):void 0}Ki(){b&&(b.visibilityState==="visible"?this.Fi||(this.Fi=!0,this.capture(nt,{title:b.title},{send_instantly:!0}),this.Ai&&(b.removeEventListener(pi,this.Ai),this.Ai=null)):this.Ai||(this.Ai=this.Ki.bind(this),X(b,pi,this.Ai)))}debug(t){t===!1?(v?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v?.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}))}Lr(){var t,i,r,s,n,a,o=this.qi||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(w.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):(r="advanced_disable_decide",s=w,n=(i="advanced_disable_flags")in(t=o)&&!N(t[i]),a=r in t&&!N(t[r]),n?t[i]:!!a&&(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[r]))}rn(t){if(N(this.config.before_send))return t;var i=D(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var s of i){if(r=s(r),N(r)){var n="Event '"+t.event+"' was rejected in beforeSend function";return xa(t.event)?w.warn(n+". This can cause unexpected behavior."):w.info(n),null}r.properties&&!ot(r.properties)||w.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var t;return(t=this.pageViewManager.dr)==null?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(r)})}Di(t){var i=Se(t)&&!t,r=V.R()&&V.A("ph_debug")==="true";return!i&&(!!r||t)}};Lt.__defaultExtensionClasses={},Lt.dn={trace:tt=()=>{},debug:tt,info:tt,warn:tt,error:tt,fatal:tt},(function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=oo(e.prototype[t[i]])})(Lt,["identify"]);var Jo=1,Zo=3,Qo=11;function Ms(e){return e instanceof Element&&(e.id===Mn||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Ke(e){return!!e&&e.nodeType===Jo}function Ee(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function aa(e){return!!e&&e.nodeType===Zo}function oa(e){return!!e&&e.nodeType===Qo&&Ke(e.host)}function Kr(e){return e?xi(e).split(/\s+/):[]}function As(e){var t=v?.location.href;return!!(t&&e&&e.some((i=>t.match(i))))}function Ei(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 Kr(t)}function la(e){return N(e)?null:xi(e).split(/(\s+)/).filter((t=>qt(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ht(e){var t="";return qr(e)&&!ca(e)&&e.childNodes&&e.childNodes.length&&j(e.childNodes,(function(i){var r;aa(i)&&i.textContent&&(t+=(r=la(i.textContent))!==null&&r!==void 0?r:"")})),xi(t)}function Ls(e){return E(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Jr=["a","button","form","input","select","textarea","label"];function qs(e,t){if(E(t))return!0;var i,r=function(n){if(t.some((a=>n.matches(a))))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function ua(e){var t=e.parentNode;return!(!t||!Ke(t))&&t}var el=["next","previous","prev",">","<"],Ns=[".ph-no-rageclick",".ph-no-capture"],Lr=e=>!e||Ee(e,"html")||!Ke(e),Ds=(e,t)=>{if(!v||Lr(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],s=e;s.parentNode&&!Ee(s,"body");)if(oa(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=ua(s);if(!n)break;if(t||Jr.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var a=v.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function qr(e){for(var t=e;t.parentNode&&!Ee(t,"body");t=t.parentNode){var i=Ei(t);if(q(i,"ph-sensitive")||q(i,"ph-no-capture"))return!1}if(q(Ei(e),"ph-include"))return!0;var r=e.type||"";if(W(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!W(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 ca(e){return!!(Ee(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ee(e,"select")||Ee(e,"textarea")||e.getAttribute("contenteditable")==="true")}var ha="(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})",tl=new RegExp("^(?:"+ha+")$"),il=new RegExp(ha),da="\\d{3}-?\\d{2}-?\\d{4}",rl=new RegExp("^("+da+")$"),sl=new RegExp("("+da+")");function qt(e,t){return t===void 0&&(t=!0),!(N(e)||W(e)&&(e=xi(e),(t?tl:il).test((e||"").replace(/[- ]/g,""))||(t?rl:sl).test(e)))}function Us(e){var t=Ht(e);return qt(t=(t+" "+va(e)).trim())?t:""}function va(e){var t="";return e&&e.childNodes&&e.childNodes.length&&j(e.childNodes,(function(i){var r;if(i&&((r=i.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=Ht(i);t=(t+" "+s).trim(),i.childNodes&&i.childNodes.length&&(t=(t+" "+va(i)).trim())}catch(n){w.error("[AutoCapture]",n)}})),t}function js(e){return e.replace(/"|\\"/g,'\\"')}function nl(e){var t=e.attr__class;return t?D(t)?t:Kr(t):void 0}var Hs=class{constructor(e){this.disabled=e===!1;var t=Y(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&&this.timeoutMs>i-r.timestamp){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}},Bi="$copy_autocapture",Gi=z("[AutoCapture]");function Yi(e,t){return t.length>e?t.slice(0,e)+"...":t}function al(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Ke(t));return t}function ol(e,t){var i,r,{e:s,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t;if(!Ke(e))return{props:{}};for(var c=[e],u=e;u.parentNode&&!Ee(u,"body");)if(oa(u.parentNode))c.push(u.parentNode.host),u=u.parentNode.host;else{if(!Ke(u.parentNode))break;c.push(u.parentNode),u=u.parentNode}var h,d,_=[],p={},g=!1,R=!1;if(j(c,(f=>{var S=qr(f);if(Ee(f,"a")){var k=f.getAttribute("href");g=S&&!!k&&qt(k)&&k}q(Ei(f),"ph-no-capture")&&(R=!0),_.push((function(y,x,I,C){var M=y.tagName.toLowerCase(),A={tag_name:M};Jr.indexOf(M)>-1&&!I&&(A.$el_text=M.toLowerCase()==="a"||M.toLowerCase()==="button"?Yi(1024,Us(y)):Yi(1024,Ht(y)));var L=Ei(y);L.length>0&&(A.classes=L.filter((function(G){return G!==""}))),j(y.attributes,(function(G){var te;if((!ca(y)||["name","id","class","aria-label"].indexOf(G.name)!==-1)&&(C==null||!C.includes(G.name))&&!x&&qt(G.value)&&(!W(te=G.name)||te.substring(0,10)!=="_ngcontent"&&te.substring(0,7)!=="_nghost")){var de=G.value;G.name==="class"&&(de=Kr(de).join(" ")),A["attr__"+G.name]=Yi(1024,de)}}));for(var K=1,Z=1,oe=y;oe=al(oe);)K++,oe.tagName===y.tagName&&Z++;return A.nth_child=K,A.nth_of_type=Z,A})(f,n,a,o)),B(p,(function(y){if(!qr(y))return{};var x={};return j(y.attributes,(function(I){if(I.name&&I.name.indexOf("data-ph-capture-attribute")===0){var C=I.name.replace("data-ph-capture-attribute-",""),M=I.value;C&&M&&qt(M)&&(x[C]=M)}})),x})(f))})),R)return{props:{},explicitNoCapture:R};if(a||(_[0].$el_text=Ee(e,"a")||Ee(e,"button")?Us(e):Ht(e)),g){var P,T;_[0].attr__href=g;var F=(P=gi(g))==null?void 0:P.host,O=v==null||(T=v.location)==null?void 0:T.host;F&&O&&F!==O&&(h=g)}return{props:B({$event_type:s.type,$ce_version:1},l?{}:{$elements:_},{$elements_chain:(d=_,(function(f){return f.map((S=>{var k,y,x="";if(S.tag_name&&(x+=S.tag_name),S.attr_class)for(var I of(S.attr_class.sort(),S.attr_class))x+="."+I.replace(/"/g,"");var C=m({},S.text?{text:S.text}:{},{"nth-child":(k=S.nth_child)!==null&&k!==void 0?k:0,"nth-of-type":(y=S.nth_of_type)!==null&&y!==void 0?y:0},S.href?{href:S.href}:{},S.attr_id?{attr_id:S.attr_id}:{},S.attributes),M={};return ii(C).sort(((A,L)=>{var[K]=A,[Z]=L;return K.localeCompare(Z)})).forEach((A=>{var[L,K]=A;return M[js(L.toString())]=js(K.toString())})),(x+=":")+ii(M).map((A=>{var[L,K]=A;return L+'="'+K+'"'})).join("")})).join(";")})((function(f){return f.map((S=>{var k,y,x={text:(k=S.$el_text)==null?void 0:k.slice(0,400),tag_name:S.tag_name,href:(y=S.attr__href)==null?void 0:y.slice(0,2048),attr_class:nl(S),attr_id:S.attr__id,nth_child:S.nth_child,nth_of_type:S.nth_of_type,attributes:{}};return ii(S).filter((I=>{var[C]=I;return C.indexOf("attr__")===0})).forEach((I=>{var[C,M]=I;return x.attributes[C]=M})),x}))})(d)))},(i=_[0])!=null&&i.$el_text?{$el_text:(r=_[0])==null?void 0:r.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},p)}}var xt=z("[ExceptionAutocapture]");function zs(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return Te(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch{return()=>{}}}var ll=z("[TracingHeaders]"),qe=z("[Web Vitals]"),Vs=9e5,Ws="disabled",Bs="lazy_loading",kt="awaiting_config",Zt="missing_config";z("[SessionRecording]"),z("[SessionRecording]");var Nr="[SessionRecording]",Ne=z(Nr),ul=z("[Heatmaps]");function Gs(e){return Y(e)&&"clientX"in e&&"clientY"in e&&fe(e.clientX)&&fe(e.clientY)}var Ys=z("[Product Tours]"),cl=["$set_once","$set"],De=z("[SiteApps]"),Xs="Error while initializing PostHog app with config id ";function it(e,t,i){if(N(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{return!1}default:return!1}}var hl=class{constructor(e){this.vn=new Xr,this.fn=(t,i)=>this.pn(t,i)&&this.gn(t,i)&&this.mn(t,i)&&this.yn(t,i),this.pn=(t,i)=>i==null||!i.event||t?.event===i?.event,this._instance=e,this.bn=new Set,this._n=new Set}init(){var e,t;E((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook(((i,r)=>{this.on(i,r)}))}register(e){var t,i;if(!E((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((n=>{var a,o;(a=this._n)==null||a.add(n),(o=n.steps)==null||o.forEach((l=>{var c;(c=this.bn)==null||c.add(l?.event||"")}))})),(i=this._instance)!=null&&i.autocapture)){var r,s=new Set;e.forEach((n=>{var a;(a=n.steps)==null||a.forEach((o=>{o!=null&&o.selector&&s.add(o?.selector)}))})),(r=this._instance)==null||r.autocapture.setElementSelectors(s)}}on(e,t){var i;t!=null&&e.length!=0&&(this.bn.has(e)||this.bn.has(t?.event))&&this._n&&((i=this._n)==null?void 0:i.size)>0&&this._n.forEach((r=>{this.wn(t,r)&&this.vn.emit("actionCaptured",r.name)}))}xn(e){this.onAction("actionCaptured",(t=>e(t)))}wn(e,t){if(t?.steps==null)return!1;for(var i of t.steps)if(this.fn(e,i))return!0;return!1}onAction(e,t){return this.vn.on(e,t)}gn(e,t){if(t!=null&&t.url){var i,r=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!r||typeof r!="string"||!it(r,t.url,t.url_matching||"contains"))return!1}return!0}mn(e,t){return!!this.Sn(e,t)&&!!this.kn(e,t)&&!!this.Cn(e,t)}Sn(e,t){var i;if(t==null||!t.href)return!0;var r=this.In(e);if(r.length>0)return r.some((a=>it(a.href,t.href,t.href_matching||"exact")));var s,n=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!n&&it((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}kn(e,t){var i;if(t==null||!t.text)return!0;var r=this.In(e);if(r.length>0)return r.some((l=>it(l.text,t.text,t.text_matching||"exact")||it(l.$el_text,t.text,t.text_matching||"exact")));var s,n,a,o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!o&&(s=(function(l){for(var c,u=[],h=/(?::|")text="(.*?)"/g;!N(c=h.exec(l));)u.includes(c[1])||u.push(c[1]);return u})(o),n=t.text,a=t.text_matching||"exact",s.some((l=>it(l,n,a))))}Cn(e,t){var i,r;if(t==null||!t.selector)return!0;var s=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(s!=null&&s.includes(t.selector))return!0;var n=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch{return!1}return!1}In(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}yn(e,t){return t==null||!t.properties||t.properties.length===0||ra(t.properties.reduce(((i,r)=>{var s=D(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return i[r.key]={values:s,operator:r.operator||"exact"},i}),{}),e?.properties)}},dl=class{constructor(e){this._instance=e,this.Tn=new Map,this.En=new Map,this.Mn=new Map}Pn(e,t){return!!e&&ra(e.propertyFilters,t?.properties)}Rn(e,t){var i=new Map;return e.forEach((r=>{var s;(s=r.conditions)==null||(s=s[t])==null||(s=s.values)==null||s.forEach((n=>{if(n!=null&&n.name){var a=i.get(n.name)||[];a.push(r.id),i.set(n.name,a)}}))})),i}On(e,t,i){var r=(i===mt.Activation?this.Tn:this.En).get(e),s=[];return this.Ln((n=>{s=n.filter((a=>r?.includes(a.id)))})),s.filter((n=>{var a,o=(a=n.conditions)==null||(a=a[i])==null||(a=a.values)==null?void 0:a.find((l=>l.name===e));return this.Pn(o,t)}))}register(e){var t;E((t=this._instance)==null?void 0:t._addCaptureHook)||(this.Fn(e),this.An(e))}An(e){var t=e.filter((i=>{var r,s;return((r=i.conditions)==null?void 0:r.actions)&&((s=i.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0}));t.length!==0&&(this.Nn??(this.Nn=new hl(this._instance),this.Nn.init(),this.Nn.xn((i=>{this.onAction(i)}))),t.forEach((i=>{var r,s,n,a,o;i.conditions&&(r=i.conditions)!=null&&r.actions&&(s=i.conditions)!=null&&(s=s.actions)!=null&&s.values&&((n=i.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0&&((a=this.Nn)==null||a.register(i.conditions.actions.values),(o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null||o.forEach((l=>{if(l&&l.name){var c=this.Mn.get(l.name);c&&c.push(i.id),this.Mn.set(l.name,c||[i.id])}})))})))}Fn(e){var t,i=e.filter((s=>{var n,a;return((n=s.conditions)==null?void 0:n.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),r=e.filter((s=>{var n,a;return((n=s.conditions)==null?void 0:n.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));i.length===0&&r.length===0||((t=this._instance)==null||t._addCaptureHook(((s,n)=>{this.onEvent(s,n)})),this.Tn=this.Rn(e,mt.Activation),this.En=this.Rn(e,mt.Cancellation))}onEvent(e,t){var i,r=this.le(),s=this.$n(),n=this.Dn(),a=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[s])||[];if(n===e&&t&&a.length>0){var o,l;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var c=(t==null||(o=t.properties)==null?void 0:o.$survey_id)||(t==null||(l=t.properties)==null?void 0:l.$product_tour_id);if(c){var u=a.indexOf(c);0>u||(a.splice(u,1),this.qn(a))}}else{if(this.En.has(e)){var h=this.On(e,t,mt.Cancellation);h.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map((_=>_.id))}),h.forEach((_=>{var p=a.indexOf(_.id);0>p||a.splice(p,1),this.jn(_.id)})),this.qn(a))}if(this.Tn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Tn.get(e)});var d=this.On(e,t,mt.Activation);this.qn(a.concat(d.map((_=>_.id))||[]))}}}onAction(e){var t,i=this.$n(),r=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[i])||[];this.Mn.has(e)&&this.qn(r.concat(this.Mn.get(e)||[]))}qn(e){var t=this.le(),i=[...new Set(e)].filter((r=>!this.Hn(r)));t.info("updating activated items",{activatedItems:i}),this.Un(i)}getActivatedIds(){var e,t=this.$n();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Tn}Bn(){return this.Nn}},vl=class extends dl{constructor(e){super(e)}$n(){return fr}Dn(){return Tt.SHOWN}Ln(e){var t;(t=this._instance)==null||t.getSurveys(e)}jn(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}le(){return U}Un(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[fr]:e})}Hn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Xi="SDK is not enabled or survey functionality is not yet loaded",Ks="Disabled. Not loading surveys.",pl=v!=null&&v.location?mi(v.location.hash,"__posthog")||mi(location.hash,"state"):null,Js="_postHogToolbarParams",Zs=z("[Toolbar]"),ie=z("[FeatureFlags]"),ze=z("[FeatureFlags]",{debugEnabled:!0}),Ki=`" failed. Feature flags didn't load in time.`,Qs=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},en=e=>{var t={};for(var[i,r]of ii(e||{}))r&&(t[i]=r);return t},Fe=z("[Error tracking]"),tn="Refusing to render web experiment since the viewer is a likely bot",_l={icontains:(e,t)=>!!v&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!v&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!v&&wi(t.href,e),not_regex:(e,t)=>!!v&&!wi(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},gl=class se{get qt(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),i.getWebExperiments((s=>{se.zn("retrieved web experiments from the server"),i.Vn=new Map,s.forEach((n=>{if(n.feature_flag_key){var a;i.Vn&&(se.zn("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=i.Vn)==null||a.set(n.feature_flag_key,n));var o=i._instance.getFeatureFlag(n.feature_flag_key);W(o)&&n.variants[o]&&i.Wn(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var c=n.variants[l];se.Zn(c)&&i.Wn(n.name,l,c.transforms)}}))}),r)},this._instance=t,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())se.zn(tn);else if(!this.qt.disable_web_experiments){if(N(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();se.zn("applying feature flags",t),t.forEach((i=>{var r;if(this.Vn&&(r=this.Vn)!=null&&r.has(i)){var s,n=this._instance.getFeatureFlag(i),a=(s=this.Vn)==null?void 0:s.get(i);n&&a!=null&&a.variants[n]&&this.Wn(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var t=se.getWindowLocation();if(t!=null&&t.search){var i=fi(t?.search,"__experiment_id"),r=fi(t?.search,"__experiment_variant");i&&r&&(se.zn("previewing web experiments "+i+" && "+r),this.getWebExperiments((s=>{this.Gn(parseInt(i),r,s)}),!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,r){if(this.qt.disable_web_experiments&&!r)return t([]);var s=this._instance.get_property("$web_experiments");if(s&&!i)return t(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:n=>t(n.statusCode===200&&n.json&&n.json.experiments||[])})}Gn(t,i,r){var s=r.filter((n=>n.id===t));s&&s.length>0&&(se.zn("Previewing web experiment ["+s[0].name+"] with variant ["+i+"]"),this.Wn(s[0].name,i,s[0].variants[i].transforms))}static Zn(t){return!N(t.conditions)&&se.Qn(t)&&se.Jn(t)}static Qn(t){var i;if(N(t.conditions)||N((i=t.conditions)==null?void 0:i.url))return!0;var r,s,n,a=se.getWindowLocation();return!!a&&((r=t.conditions)==null||!r.url||_l[(s=(n=t.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](t.conditions.url,a))}static getWindowLocation(){return v?.location}static Jn(t){var i;if(N(t.conditions)||N((i=t.conditions)==null?void 0:i.utm))return!0;var r=Hn();if(r.utm_source){var s,n,a,o,l,c,u,h,d=(s=t.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=t.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==r.utm_campaign,_=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=t.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==r.utm_source,p=(l=t.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=t.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==r.utm_medium,g=(u=t.conditions)==null||(u=u.utm)==null||!u.utm_term||((h=t.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==r.utm_term;return d&&p&&g&&_}return!1}static zn(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];w.info("[WebExperiments] "+t,r)}Wn(t,i,r){this._is_bot()?se.zn(tn):i!=="control"?r.forEach((s=>{if(s.selector){var n;se.zn("applying transform of variant "+i+" for experiment "+t+" ",s),((n=document)==null?void 0:n.querySelectorAll(s.selector))?.forEach((a=>{var o=a;s.html&&(o.innerHTML=s.html),s.css&&o.setAttribute("style",s.css)}))}})):se.zn("Control variants leave the page unmodified.")}_is_bot(){return ce&&this._instance?ta(ce,this.qt.custom_blocked_useragents):void 0}},pe=z("[Conversations]"),Ve="Conversations not available yet.",Pi={featureFlags:class{constructor(e){this.Kn=!1,this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=e,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get ni(){return this._instance.persistence}os(e){return this._instance.get_property(e)}us(){var e,t;return(e=(t=this.ni)==null?void 0:t.wr(this.qt.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}ls(){return!!this.us()&&(this.ss||this.Xn||(this.ss=!0,ie.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hs(){var e,t=(e=this.qt.evaluation_contexts)!==null&&e!==void 0?e:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.ns||(ie.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),t!=null&&t.length?t.filter((i=>{var r=i&&typeof i=="string"&&i.trim().length>0;return r||ie.error("Invalid evaluation context found:",i,"Expected non-empty string"),r})):[]}cs(){return this.hs().length>0}initialize(){var e,t,{config:i}=this._instance,r=(e=(t=i.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(r).length){var s,n,a=(s=(n=i.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&s!==void 0?s:{},o=Object.keys(r).filter((c=>!!r[c])).reduce(((c,u)=>(c[u]=r[u]||!1,c)),{}),l=Object.keys(a).filter((c=>o[c])).reduce(((c,u)=>(a[u]&&(c[u]=a[u]),c)),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(e,t,i){var r=i!=null&&i.merge?this.getFlagVariants():{},s=i!=null&&i.merge?this.getFlagPayloads():{},n=m({},r,e),a=m({},s,t),o={};for(var[l,c]of Object.entries(n)){var u=typeof c=="string";o[l]={key:l,enabled:!!u||!!c,variant:u?c:void 0,reason:void 0,metadata:E(a?.[l])?void 0:{id:0,version:void 0,description:void 0,payload:a[l]}}}this.receivedFeatureFlags({flags:o})}get hasLoadedFlags(){return this.Yn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.os(vr),t=this.os(Ie),i=this.os(st);if(!i&&!t)return e||{};var r=B({},e||{});for(var s of[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])]){var n,a,o=r[s],l=t?.[s],c=E(l)?(n=o?.enabled)!==null&&n!==void 0&&n:!!l,u=E(l)?o.variant:typeof l=="string"?l:void 0,h=i?.[s],d=m({},o,{enabled:c,variant:c?u??o?.variant:void 0});c!==o?.enabled&&(d.original_enabled=o?.enabled),u!==o?.variant&&(d.original_variant=o?.variant),h&&(d.metadata=m({},o?.metadata,{payload:h,original_payload:o==null||(a=o.metadata)==null?void 0:a.payload})),r[s]=d}return this.Kn||(ie.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.Kn=!0),r}getFlagVariants(){var e=this.os(lt),t=this.os(Ie);if(!t)return e||{};for(var i=B({},e),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this.Kn||(ie.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Kn=!0),i}getFlagPayloads(){var e=this.os(pr),t=this.os(st);if(!t)return e||{};for(var i=B({},e||{}),r=Object.keys(t),s=0;r.length>s;s++)i[r[s]]=t[r[s]];return this.Kn||(ie.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Kn=!0),i}reloadFeatureFlags(){this.es||this.qt.advanced_disable_feature_flags||this.ds||(this._instance.Li.emit("featureFlagsReloading",!0),this.ds=setTimeout((()=>{this.vs()}),5))}fs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Yn||this.Xn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.es=e}vs(e){var t;if(this.fs(),!this._instance.Lr())if(this.Xn)this.ts=!0;else{var i=this.qt.token,r=this.os(ui),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:m({},((t=this.ni)==null?void 0:t.get_initial_props())||{},this.os(It)||{}),group_properties:this.os(We),timezone:Yn()};Me(r)||E(r)||(s.$device_id=r),(e!=null&&e.disableFlags||this.qt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.cs()&&(s.evaluation_contexts=this.hs());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Xn=!0,this._instance._send_request({method:"POST",url:n,data:s,compression:this.qt.disable_compression?void 0:xe.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback:a=>{var o,l,c,u=!0;if(a.statusCode===200&&(this.ts||(this.$anon_distinct_id=void 0),u=!1),this.Xn=!1,!s.disable_flags||this.ts){this.rs=!u;var h=[];a.error?a.error instanceof Error?h.push(a.error.name==="AbortError"?"timeout":"connection_error"):h.push("unknown_error"):a.statusCode!==200&&h.push("api_error_"+a.statusCode),(o=a.json)!=null&&o.errorsWhileComputingFlags&&h.push("errors_while_computing_flags");var d,_=!((l=a.json)==null||(l=l.quotaLimited)==null||!l.includes("feature_flags"));_&&h.push("quota_limited"),(c=this.ni)==null||c.register({[yr]:h}),_?ie.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."):(s.disable_flags||this.receivedFeatureFlags((d=a.json)!==null&&d!==void 0?d:{},u,{partialResponse:!!this.qt.advanced_only_evaluate_survey_feature_flags}),this.ts&&(this.ts=!1,this.vs()))}}})}}getFeatureFlag(e,t){var i;if(t===void 0&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var r=this.getFeatureFlagResult(e,t);return(i=r?.variant)!==null&&i!==void 0?i:r?.enabled}}else ie.warn('getFeatureFlag for key "'+e+Ki)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.rs)if(this.Yn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var i=this.getFlagVariants(),r=e in i,s=i[e],n=this.getFlagPayloads()[e],a=String(s),o=this.os(_r)||void 0,l=this.os(hi)||void 0,c=this.os(Ct)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var u,h=this._instance.get_session_id(),d=this.os(mr);h&&h!==d&&(c={},(u=this.ni)==null||u.register({[Ct]:c,[mr]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in c)||!c[e].includes(a))){var _,p,g,R,P,T,F,O,f,S;D(c[e])?c[e].push(a):c[e]=[a],(_=this.ni)==null||_.register({[Ct]:c});var k=this.getFeatureFlagDetails(e),y=[...(p=this.os(yr))!==null&&p!==void 0?p:[]];E(s)&&y.push("flag_missing");var x={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((g=this.qt.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[e])||null,$feature_flag_bootstrapped_payload:((R=this.qt.bootstrap)==null||(R=R.featureFlagPayloads)==null?void 0:R[e])||null,$used_bootstrap_value:!this.rs};E(k==null||(P=k.metadata)==null?void 0:P.version)||(x.$feature_flag_version=k.metadata.version);var I,C=(T=k==null||(F=k.reason)==null?void 0:F.description)!==null&&T!==void 0?T:k==null||(O=k.reason)==null?void 0:O.code;C&&(x.$feature_flag_reason=C),k!=null&&(f=k.metadata)!=null&&f.id&&(x.$feature_flag_id=k.metadata.id),E(k?.original_variant)&&E(k?.original_enabled)||(x.$feature_flag_original_response=E(k.original_variant)?k.original_enabled:k.original_variant),k!=null&&(S=k.metadata)!=null&&S.original_payload&&(x.$feature_flag_original_payload=k==null||(I=k.metadata)==null?void 0:I.original_payload),y.length&&(x.$feature_flag_error=y.join(",")),this._instance.capture("$feature_flag_called",x)}if(r){var M=n;if(!E(n))try{M=JSON.parse(n)}catch{}return{key:e,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:M}}}}else ie.warn('getFeatureFlagResult for key "'+e+Ki)}getRemoteConfigPayload(e,t){var i=this.qt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.cs()&&(r.evaluation_contexts=this.hs()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.qt.disable_compression?void 0:xe.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback(s){var n,a=(n=s.json)==null?void 0:n.featureFlagPayloads;t(a?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.rs){if(this.Yn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return E(i)?void 0:!!i}ie.warn('isFeatureEnabled for key "'+e+Ki)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,i){if(this.ni){this.Yn=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,c,u,h){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var d=(y=>{var x=y.flags;return x?(y.featureFlags=Object.fromEntries(Object.keys(x).map((I=>{var C;return[I,(C=x[I].variant)!==null&&C!==void 0?C:x[I].enabled]}))),y.featureFlagPayloads=Object.fromEntries(Object.keys(x).filter((I=>x[I].enabled)).filter((I=>{var C;return(C=x[I].metadata)==null?void 0:C.payload})).map((I=>{var C;return[I,(C=x[I].metadata)==null?void 0:C.payload]})))):ie.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),y})(a),_=d.flags,p=d.featureFlags,g=d.featureFlagPayloads;if(p){var R=a.requestId,P=a.evaluatedAt;if(D(p)){ie.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var T={};if(p)for(var F=0;p.length>F;F++)T[p[F]]=!0;o&&o.register({[ei]:p,[lt]:T})}else{var O=p,f=g,S=_;if(h!=null&&h.partialResponse)O=m({},l,O),f=m({},c,f),S=m({},u,S);else if(a.errorsWhileComputingFlags)if(_){var k=new Set(Object.keys(_).filter((y=>{var x;return!((x=_[y])!=null&&x.failed)})));O=m({},l,Object.fromEntries(Object.entries(O).filter((y=>{var[x]=y;return k.has(x)})))),f=m({},c,Object.fromEntries(Object.entries(f||{}).filter((y=>{var[x]=y;return k.has(x)})))),S=m({},u,Object.fromEntries(Object.entries(S||{}).filter((y=>{var[x]=y;return k.has(x)}))))}else O=m({},l,O),f=m({},c,f),S=m({},u,S);o&&o.register(m({[ei]:Object.keys(en(O)),[lt]:O||{},[pr]:f||{},[vr]:S||{}},R?{[_r]:R}:{},P?{[hi]:P}:{}))}}})(e,this.ni,r,s,n,i),t||(this.ss=!1),this.ps(t)}}override(e,t){t===void 0&&(t=!1),ie.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.ni)return ie.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.ni.unregister(Ie),this.ni.unregister(st),this.ps(),ze.info("All overrides cleared");if(D(e)){var t=Qs(e);return this.ni.register({[Ie]:t}),this.ps(),ze.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var i,r=e;if(this.Kn=!!((i=r.suppressWarning)!==null&&i!==void 0&&i),"flags"in r){if(r.flags===!1)this.ni.unregister(Ie),ze.info("Flag overrides cleared");else if(r.flags){if(D(r.flags)){var s=Qs(r.flags);this.ni.register({[Ie]:s})}else this.ni.register({[Ie]:r.flags});ze.info("Flag overrides set",{flags:r.flags})}}"payloads"in r&&(r.payloads===!1?(this.ni.unregister(st),ze.info("Payload overrides cleared")):r.payloads&&(this.ni.register({[st]:r.payloads}),ze.info("Payload overrides set",{payloads:r.payloads}))),this.ps();return}if(e&&typeof e=="object")return this.ni.register({[Ie]:e}),this.ps(),ze.info("Flag overrides set",{flags:e});ie.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Yn){var{flags:t,flagVariants:i}=this.gs();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,s=(this.os(Ft)||[]).find((l=>l.flagKey===e)),n={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(a.$early_access_feature_name=s.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=m({},this.getFlagVariants(),{[e]:t});(r=this.ni)==null||r.register({[ei]:Object.keys(en(o)),[lt]:o}),this.ps()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var r=this.os(Ft),s=i?"&"+i.map((n=>"stage="+n)).join("&"):"";if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+s),method:"GET",callback:n=>{var a,o;if(n.json){var l=n.json.earlyAccessFeatures;return(a=this.ni)==null||a.unregister(Ft),(o=this.ni)==null||o.register({[Ft]:l}),e(l)}}})}gs(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((i=>t[i])),flagVariants:Object.keys(t).filter((i=>t[i])).reduce(((i,r)=>(i[r]=t[r],i)),{})}}ps(e){var{flags:t,flagVariants:i}=this.gs();this.featureFlagEventHandlers.forEach((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this.os(It)||{},r=e?.$set||(e!=null&&e.$set_once?{}:e),s=e?.$set_once,n={};if(s)for(var a in s)({}).hasOwnProperty.call(s,a)&&(a in i||(n[a]=s[a]));this._instance.register({[It]:m({},i,n,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(It)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this.os(We)||{};Object.keys(i).length!==0&&Object.keys(i).forEach((r=>{i[r]=m({},i[r],e[r]),delete e[r]})),this._instance.register({[We]:m({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.os(We)||{};this._instance.register({[We]:m({},t,{[e]:{}})})}else this._instance.unregister(We)}reset(){this.Yn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.fs(),this.Kn=!1}}},fl={sessionRecording:class{get qt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var e;return!((e=this.ys)==null||!e.isStarted)}get status(){var e,t;return this.bs===kt||this.bs===Zt?this.bs:(e=(t=this.ys)==null?void 0:t.status)!==null&&e!==void 0?e:this.bs}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.bs=Ws,this._s=void 0,this._instance=e,!this._instance.sessionManager)throw Ne.error("started without valid sessionManager"),new Error(Nr+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===Oe)throw new Error(Nr+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get ws(){var e,t=!((e=this._instance.get_property(Rt))==null||!e.enabled),i=!this.qt.disable_session_recording,r=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return v&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this.ws||(t=this.ys)==null||!t.isStarted){var i=!E(Object.assign)&&!E(Array.from);this.ws&&i?(this.xs(e),Ne.info("starting")):(this.bs=Ws,this.stopRecording())}}xs(e){var t,i,r;this.ws&&(this.bs!==kt&&this.bs!==Zt&&(this.bs=Bs),$!=null&&(t=$.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=$.__PosthogExtensions__)!=null&&i.initSessionRecording?this.Ss(e):(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.ks,(s=>{if(s)return Ne.error("could not load recorder",s);this.Ss(e)})))}stopRecording(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.stop()}Cs(){var e,t;(e=this._s)==null||e.call(this),this._s=void 0,(t=this.ys)==null||t.discard()}Is(){var e;(e=this.ni)==null||e.unregister(Wr)}Ts(e,t){if(N(e))return null;var i,r=fe(e)?e:parseFloat(e);return typeof(i=r)!="number"||!Number.isFinite(i)||0>i||i>1?(Ne.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}Es(e){if(this.ni){var t,i,r=this.ni,s=()=>{var n,a=e.sessionRecording===!1?void 0:e.sessionRecording,o=this.Ts((n=this.qt.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.Ts(a?.sampleRate,"remote config sampleRate"),c=o??l;N(c)&&this.Is();var u=a?.minimumDurationMilliseconds;r.register({[Rt]:m({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:m({capturePerformance:e.capturePerformance},a?.networkPayloadCapture),canvasRecording:{enabled:a?.recordCanvas,fps:a?.canvasFps,quality:a?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:E(u)?null:u,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers,version:a?.version,triggerGroups:a?.triggerGroups})})};s(),(t=this._s)==null||t.call(this),this._s=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording===!1?(this.Es(e),this.Cs()):(this.Es(e),this.startIfEnabledOrStop()):(this.bs===kt&&(this.bs=Zt,Ne.warn("config refresh failed, recording will not start until page reload")),this.startIfEnabledOrStop())}log(e,t){var i;t===void 0&&(t="log"),(i=this.ys)!=null&&i.log?this.ys.log(e,t):Ne.warn("log called before recorder was ready")}get ks(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(Rt);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Ms(){var e,t=this._instance.get_property(Rt);if(!t)return!1;var i=(e=(typeof t=="object"?t:JSON.parse(t)).cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-i}Ss(e){var t,i;if((t=$.__PosthogExtensions__)==null||!t.initSessionRecording)return Ne.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[qn]:!0});if(this.ys||(this.ys=(i=$.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ms()){if(this.bs===Zt||this.bs===kt)return;this.bs=kt,Ne.info("persisted remote config is stale, requesting fresh config before starting"),new Xn(this._instance).load();return}this.bs=Bs,this.ys.start(e)}onRRwebEmit(e){var t;(t=this.ys)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.ys||(t=this.ni)==null||t.register({[Tn]:!0}),(e=this.ys)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.ys||(t=this.ni)==null||t.register({[In]:!0}),(e=this.ys)==null||e.overrideSampling()}overrideTrigger(e){var t,i;this.ys||(i=this.ni)==null||i.register({[e==="url"?On:Cn]:!0}),(t=this.ys)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.ys)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!((i=this.ys)==null||!i.tryAddCustomEvent(e,t))}}},ml={autocapture:class{constructor(e){this.Ps=!1,this.Rs=null,this.Os=!1,this.instance=e,this.rageclicks=new Hs(e.config.rageclick),this.Ls=null}initialize(){this.startIfEnabled()}get qt(){var e,t,i=Y(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map((r=>new RegExp(r))),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map((r=>new RegExp(r))),i}Fs(){if(this.isBrowserSupported()){if(v&&b){var e=i=>{i=i||v?.event;try{this.As(i)}catch(r){Gi.error("Failed to capture event",r)}};if(X(b,"submit",e,{capture:!0}),X(b,"change",e,{capture:!0}),X(b,"click",e,{capture:!0}),this.qt.capture_copied_text){var t=i=>{i=i||v?.event;try{this.As(i,Bi)}catch(r){Gi.error("Failed to capture copy/cut event",r)}};X(b,"copy",t,{capture:!0}),X(b,"cut",t,{capture:!0})}}}else Gi.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Ps&&(this.Fs(),this.Ps=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Os=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[nr]:!!e.autocapture_opt_out}),this.Rs=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Ls=e}getElementSelectors(e){var t,i=[];return(t=this.Ls)==null||t.forEach((r=>{b?.querySelectorAll(r)?.forEach((s=>{e===s&&i.push(r)}))})),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[nr];if(Me(this.Rs)&&!Se(i)&&!this.instance.Lr())return!1;var r=(t=this.Rs)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!r}As(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,r=Ls(e);aa(r)&&(r=r.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&(function(h,d){if(!v||Lr(h))return!1;var _,p,g;if(Se(d)?(_=!!d&&Ns,p=void 0):(_=(g=d?.css_selector_ignorelist)!==null&&g!==void 0?g:Ns,p=d?.content_ignorelist),_===!1)return!1;var{targetElementList:R}=Ds(h,!1);return!(function(P,T){if(P===!1||E(P))return!1;var F;if(P===!0)F=el;else{if(!D(P))return!1;if(P.length>10)return w.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;F=P.map((O=>O.toLowerCase()))}return T.some((O=>{var{safeText:f,ariaLabel:S}=O;return F.some((k=>f.includes(k)||S.includes(k)))}))})(p,R.map((P=>{var T;return{safeText:Ht(P).toLowerCase(),ariaLabel:((T=P.getAttribute("aria-label"))==null?void 0:T.toLowerCase().trim())||""}})))&&!qs(R,_)})(r,this.instance.config.rageclick)&&this.As(e,"$rageclick");var s=t===Bi;if(r&&(function(h,d,_,p,g){var R,P,T,F;if(_===void 0&&(_=void 0),!v||Lr(h)||(R=_)!=null&&R.url_allowlist&&!As(_.url_allowlist)||(P=_)!=null&&P.url_ignorelist&&As(_.url_ignorelist))return!1;if((T=_)!=null&&T.dom_event_allowlist){var O=_.dom_event_allowlist;if(O&&!O.some((x=>d.type===x)))return!1}var{parentIsUsefulElement:f,targetElementList:S}=Ds(h,p);if(!(function(x,I){var C=I?.element_allowlist;if(E(C))return!0;var M,A=function(K){if(C.some((Z=>K.tagName.toLowerCase()===Z)))return{v:!0}};for(var L of x)if(M=A(L))return M.v;return!1})(S,_)||!qs(S,(F=_)==null?void 0:F.css_selector_allowlist))return!1;var k=v.getComputedStyle(h);if(k&&k.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0;var y=h.tagName.toLowerCase();switch(y){case"html":return!1;case"form":return(g||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(g||["change","click"]).indexOf(d.type)>=0;default:return f?(g||["click"]).indexOf(d.type)>=0:(g||["click"]).indexOf(d.type)>=0&&(Jr.indexOf(y)>-1||h.getAttribute("contenteditable")==="true")}})(r,e,this.qt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:a}=ol(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsChainAsString:this.Os});if(a)return!1;var o=this.getElementSelectors(r);if(o&&o.length>0&&(n.$element_selectors=o),t===Bi){var l,c=la(v==null||(l=v.getSelection())==null?void 0:l.toString()),u=e.type||"clipboard";if(!c)return!1;n.$selected_content=c,n.$copy_type=u}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return Te(b?.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Ns=(v==null||(t=v.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(w.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.$s&&this.$s(),this.$s=void 0,w.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(v&&v.history){var i=this;(e=v.history.pushState)!=null&&e.__posthog_wrapped__||zs(v.history,"pushState",(r=>function(s,n,a){r.call(this,s,n,a),i.Ds("pushState")})),(t=v.history.replaceState)!=null&&t.__posthog_wrapped__||zs(v.history,"replaceState",(r=>function(s,n,a){r.call(this,s,n,a),i.Ds("replaceState")})),this.qs()}}Ds(e){try{var t,i=v==null||(t=v.location)==null?void 0:t.pathname;if(!i)return;i!==this.Ns&&this.isEnabled&&this._instance.capture(nt,{navigation_type:e}),this.Ns=i}catch(r){w.error("Error capturing "+e+" pageview",r)}}qs(){if(!this.$s){var e=()=>{this.Ds("popstate")};X(v,"popstate",e),this.$s=()=>{v&&v.removeEventListener("popstate",e)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(e){var t;this.js=!1,this.Ps=!1,this.Hs=null,this.instance=e,this.js=!((t=this.instance.persistence)==null||!t.props[ar]),this.rageclicks=new Hs(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Y(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(e=this.qt.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return N(this.qt.capture_heatmaps)?N(this.qt.enable_heatmaps)?this.js:this.qt.enable_heatmaps:this.qt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Ps)return;ul.info("starting..."),this.Us(),this.At()}else{var e;clearInterval((e=this.Hs)!==null&&e!==void 0?e:void 0),this.Bs(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ar]:t}),this.js=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.M;return this.M=void 0,e}zs(e){this.Mt(e.originalEvent,"deadclick")}At(){this.Hs&&clearInterval(this.Hs),this.Hs=b?.visibilityState==="visible"?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}Us(){v&&b&&(this.Vs=this.Zr.bind(this),X(v,_i,this.Vs),this.Ws=e=>this.Mt(e||v?.event),X(b,"click",this.Ws,{capture:!0}),this.Zs=e=>this.Gs(e||v?.event),X(b,"mousemove",this.Zs,{capture:!0}),this.Qs=new _s(this.instance,yo,this.zs.bind(this)),this.Qs.startIfEnabledOrStop(),this.Js=this.At.bind(this),X(b,pi,this.Js),this.Ps=!0)}Bs(){var e;v&&b&&(this.Vs&&v.removeEventListener(_i,this.Vs),this.Ws&&b.removeEventListener("click",this.Ws,{capture:!0}),this.Zs&&b.removeEventListener("mousemove",this.Zs,{capture:!0}),this.Js&&b.removeEventListener(pi,this.Js),clearTimeout(this.Ks),(e=this.Qs)==null||e.stop(),this.Ps=!1)}Ys(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=(function(a,o,l){for(var c=a;c&&Ke(c)&&!Ee(c,"body");){if(c===l)return!1;if(q(o,v?.getComputedStyle(c).position))return!0;c=ua(c)}return!1})(Ls(e),["fixed","sticky"],s);return{x:e.clientX+(n?0:r),y:e.clientY+(n?0:i),target_fixed:n,type:t}}Mt(e,t){var i;if(t===void 0&&(t="click"),!Ms(e.target)&&Gs(e)){var r=this.Ys(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Xs(m({},r,{type:"rageclick"})),this.Xs(r)}}Gs(e){!Ms(e.target)&&Gs(e)&&(clearTimeout(this.Ks),this.Ks=setTimeout((()=>{this.Xs(this.Ys(e,"mousemove"))}),500))}Xs(e){if(v){var t=v.location.href,i=this.qt.custom_personal_data_properties,r=Ut(t,this.qt.mask_personal_data_properties?[..._t,...i||[]]:[],jt);this.M=this.M||{},this.M[r]||(this.M[r]=[]),this.M[r].push(e)}}Zr(){this.M&&!ot(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:_s,webVitalsAutocapture:class{constructor(e){var t;this.js=!1,this.Ps=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),this.M.metrics.length!==0&&(this._instance.capture("$web_vitals",this.M.metrics.reduce(((i,r)=>m({},i,{["$web_vitals_"+r.name+"_event"]:m({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=i=>{var r,s=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(E(s))qe.error("Could not read session ID. Dropping metrics!");else{this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.io();E(n)||(N(i?.name)||N(i?.value)?qe.error("Invalid metric received",i):!this.no||this.no>i.value?(this.M.url!==n&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),E(this.M.url)&&(this.M.url=n),this.M.firstMetricTimestamp=E(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.M.metrics.push(m({},i,{$current_url:n,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.M.metrics.length===this.allowedMetrics.length&&this.eo()):qe.error("Ignoring metric with value >= "+this.no,i))}},this.so=()=>{if(!this.Ps){var i,r,s,n,a=$.__PosthogExtensions__;E(a)||E(a.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:r,onFCP:s,onINP:n}=a.postHogWebVitalsCallbacks),i&&r&&s&&n?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.ht.bind(this)),this.Ps=!0):qe.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.js=!((t=this._instance.persistence)==null||!t.props[cr]),this.startIfEnabled()}get oo(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=Y(this.oo)?(e=this.oo)==null?void 0:e.web_vitals_allowed_metrics:void 0;return N(i)?((t=this._instance.persistence)==null?void 0:t.props[dr])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(Y(this.oo)?this.oo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=Y(this.oo)?this.oo.web_vitals_attribution:void 0;return e!=null&&e}get no(){var e=Y(this.oo)&&fe(this.oo.__web_vitals_max_value)?this.oo.__web_vitals_max_value:Vs;return e>0&&6e4>=e?Vs:e}get isEnabled(){var e=Q?.protocol;if(e!=="http:"&&e!=="https:")return qe.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Y(this.oo)?this.oo.web_vitals:Se(this.oo)?this.oo:void 0;return Se(t)?t:this.js}startIfEnabled(){this.isEnabled&&!this.Ps&&(qe.info("enabled, starting..."),this.lr(this.so))}onRemoteConfig(e){if("capturePerformance"in e){var t=Y(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=Y(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[cr]:t}),this._instance.persistence.register({[dr]:i})),this.js=t,this.startIfEnabled()}}lr(e){var t,i;(t=$.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(r=>{r?qe.error("failed to load script",r):e()}))}io(){var e=v?v.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties;return Ut(e,this._instance.config.mask_personal_data_properties?[..._t,...t||[]]:[],jt)}qe.error("Could not determine current URL")}}},yl={exceptionObserver:class{constructor(e){var t,i,r;this.so=()=>{var s;if(v&&this.isEnabled&&(s=$.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var n=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ao&&this.qt.capture_unhandled_errors&&(this.ao=n(this.captureException.bind(this))),!this.uo&&this.qt.capture_unhandled_rejections&&(this.uo=a(this.captureException.bind(this))),!this.lo&&this.qt.capture_console_errors&&(this.lo=o(this.captureException.bind(this)))}catch(l){xt.error("failed to start",l),this.ho()}}},this._instance=e,this.co=!((t=this._instance.persistence)==null||!t.props[or]),this.do=new Pa({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,Gt:xt}),this.qt=this.vo(),this.startIfEnabledOrStop()}vo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Y(e)?t=m({},t,e):(E(e)?this.co:e)&&(t=m({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(xt.info("enabled"),this.ho(),this.lr(this.so)):this.ho()}lr(e){var t,i;(t=$.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return xt.error("failed to load script",r);e()}))}ho(){var e,t,i;(e=this.ao)==null||e.call(this),this.ao=void 0,(t=this.uo)==null||t.call(this),this.uo=void 0,(i=this.lo)==null||i.call(this),this.lo=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.co=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[or]:this.co}),this.qt=this.vo(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.vo()}captureException(e){var t,i,r,s=(t=e==null||(i=e.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&t!==void 0?t:"Exception";this.do.consumeRateLimit(s)?xt.info("Skipping exception capture because of client rate limiting.",{exception:s}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.fo=[],this.po=new Da([new Ga,new io,new Xa,new Ya,new eo,new Qa,new Ja,new to],(function(r){for(var s=arguments.length,n=new Array(s>1?s-1:0),a=1;s>a;a++)n[a-1]=arguments[a];return function(o,l){l===void 0&&(l=0);for(var c=[],u=o.split(`
|
|
2
2
|
`),h=l;u.length>h;h++){var d=u[h];if(1024>=d.length){var _=hs.test(d)?d.replace(hs,"$1"):d;if(!_.match(/\S*Error: /)){for(var p of n){var g=p(_,r);if(g){c.push(g);break}}if(c.length>=50)break}}}return(function(R){if(!R.length)return[];var P=Array.from(R);return P.reverse(),P.slice(0,50).map((T=>{return m({},T,{filename:T.filename||(F=P,F[F.length-1]||{}).filename,function:T.function||pt});var F}))})(c)}})("web:javascript",za,Ba)),this._instance=e,this.fo=(t=(i=this._instance.persistence)==null?void 0:i.get_property(lr))!==null&&t!==void 0?t:[],this.mo=li(this.yo()),this.bo=new so(this.mo)}onConfigChange(){this.mo=li(this.yo()),this.bo.setConfig(this.mo)}onRemoteConfig(e){var t,i,r;if("errorTracking"in e){var s=(t=(i=e.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],n=(r=e.errorTracking)==null?void 0:r.captureExtensionExceptions;this.fo=s,this._instance.persistence&&this._instance.persistence.register({[lr]:this.fo,[ur]:n})}}get _o(){var e,t=!!this._instance.get_property(ur),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.po.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.mo.enabled)try{if(!W(e)||e.trim().length===0)return void Fe.warn("Ignoring exception step because message must be a non-empty string");var{sanitizedProperties:i,droppedKeys:r}=(function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};var n=[];return{sanitizedProperties:Object.keys(s).reduce(((a,o)=>ro.has(o)?(n.push(o),a):(a[o]=s[o],a)),{}),droppedKeys:n}})(this.wo(t));r.length>0&&Fe.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.bo.add(m({[ai]:e,[oi]:new Date().toISOString()},i))}catch(s){Fe.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.xo(t)){if(this.So(t))return this.ko("Exception dropped: matched a suppression rule"),void Fe.info("Skipping exception capture because a suppression rule matched");if(!this._o&&this.Co(t))return this.ko("Exception dropped: thrown by a browser extension"),void Fe.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Io(t))return this.ko("Exception dropped: thrown by the PostHog SDK"),void Fe.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.mo.enabled&&N(e.$exception_steps)?this.To(e):e;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return r&&this.bo.clear(),r}catch(s){Fe.error("Failed to capture exception event. Dropping this exception.",s),this.bo.clear();return}}catch(s){Fe.error("Failed to process exception event. Ignoring this exception.",s);return}}To(e){try{var t=this.bo.getAttachable();return t.length===0?e:m({},e,{$exception_steps:t})}catch(i){return Fe.error("Failed to read buffered exception steps. Capturing exception without steps.",i),e}}ko(e){this.mo.enabled&&this.bo.add({[ai]:e,[oi]:new Date().toISOString()})}wo(e){return Y(e)?m({},e):{}}yo(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}So(e){if(e.length===0)return!1;var t=e.reduce(((i,r)=>{var{type:s,value:n}=r;return W(s)&&s.length>0&&i.$exception_types.push(s),W(n)&&n.length>0&&i.$exception_values.push(n),i}),{$exception_types:[],$exception_values:[]});return this.fo.some((i=>{var r=i.values.map((s=>{var n,a=ia[s.operator],o=D(s.value)?s.value:[s.value],l=(n=t[s.key])!==null&&n!==void 0?n:[];return o.length>0&&a(o,l)}));return i.type==="OR"?r.some(Boolean):r.every(Boolean)}))}Co(e){return e.flatMap((t=>{var i,r;return(i=(r=t.stacktrace)==null?void 0:r.frames)!==null&&i!==void 0?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}Io(e){if(e.length>0){var t,i,r,s,n=(t=(i=e[0].stacktrace)==null?void 0:i.frames)!==null&&t!==void 0?t:[],a=n[n.length-1];return(r=a==null||(s=a.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}xo(e){return!N(e)&&D(e)}}},bl=m({productTours:class{get ni(){return this._instance.persistence}constructor(e){this.Eo=null,this.Mo=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.ni&&this.ni.register({[hr]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Eo||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(hr)||this.lr((()=>this.Po()))}lr(e){var t,i;(t=$.__PosthogExtensions__)!=null&&t.generateProductTours?e():(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"product-tours",(r=>{r?Ys.error("Could not load product tours script",r):e()}))}Po(){var e;!this.Eo&&(e=$.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Eo=$.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!D(this.Mo)||t){var i=this.ni;if(i){var r=i.props[ti];if(D(r)&&!t)return this.Mo=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:s=>{var n=s.statusCode;if(n!==200||!s.json){var a="Product Tours API could not be loaded, status: "+n;Ys.error(a),e([],{isLoaded:!1,error:a});return}var o=D(s.json.product_tours)?s.json.product_tours:[];this.Mo=o,i&&i.register({[ti]:o}),e(o,{isLoaded:!0})}})}else e(this.Mo,{isLoaded:!0})}getActiveProductTours(e){N(this.Eo)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Eo.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Eo)==null||t.showTourById(e)}previewTour(e){this.Eo?this.Eo.previewTour(e):this.lr((()=>{var t;this.Po(),(t=this.Eo)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Eo)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Eo)==null||e.nextStep()}previousStep(){var e;(e=this.Eo)==null||e.previousStep()}clearCache(){var e;this.Mo=null,(e=this.ni)==null||e.unregister(ti)}resetTour(e){var t;(t=this.Eo)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Eo)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Eo)==null||t.cancelPendingTour(e)}}},Pi),wl={siteApps:class{constructor(e){this._instance=e,this.Ro=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Oo(e,t){if(t){var i=this.globalsForEvent(t);this.Ro.push(i),this.Ro.length>1e3&&(this.Ro=this.Ro.slice(10))}}get siteAppLoaders(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Oo.bind(this));this.Lo=()=>{e(),this.Ro=[],this.Lo=void 0}}}globalsForEvent(e){var t,i,r,s,n,a,o;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:_,$set:p}=e;return{event:m({},sn(e,cl),{properties:m({},e.properties,p?{$set:m({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},p)}:{},_?{$set_once:m({},(r=(s=e.properties)==null?void 0:s.$set_once)!==null&&r!==void 0?r:{},_)}:{}),elements_chain:(n=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(o=e.properties)==null?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var a;!t.errored&&this.Ro.length&&(De.info("Processing "+this.Ro.length+" events for site app with id "+e.id),this.Ro.forEach((o=>t.processEvent==null?void 0:t.processEvent(o))),t.processedBuffer=!0),Object.values(this.apps).every((o=>o.processedBuffer||o.errored))&&((a=this.Lo)==null||a.call(this))},r=!1,s=a=>{t.errored=!a,t.loaded=!0,De.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(a){s(a)}});n&&(t.processEvent=n),r=!0}catch(a){De.error(Xs+e.id,a),s(!1)}if(r&&t.loaded)try{i()}catch(a){De.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}Fo(){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)}Ao(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{i.processEvent==null||i.processEvent(t)}catch(r){De.error("Error while processing event "+e.event+" for site app "+i.id,r)}}}onRemoteConfig(e){var t,i,r,s=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Fo(),void this._instance.on("eventCaptured",(l=>this.Ao(l)))):void De.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.Lo)==null||i.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var n=function(l){var c;$["__$$ph_site_app_"+l]=s._instance,(c=$.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(s._instance,o,(u=>{if(u)return De.error(Xs+l,u)}))};for(var{id:a,url:o}of e.siteApps)n(a)}else De.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},El={tracingHeaders:class{constructor(e){this.No=void 0,this.$o=void 0,this.so=()=>{var t,i,r=this.Do()||[];E(this.No)&&((t=$.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(r,this._instance.get_distinct_id(),this._instance.sessionManager)),E(this.$o)&&((i=$.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null||i._patchFetch(r,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}lr(e){var t,i;(t=$.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return ll.error("failed to load script",r);e()}))}Do(){var e;return(e=this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var e,t;this.Do()?this.lr(this.so):((e=this.No)==null||e.call(this),(t=this.$o)==null||t.call(this),this.No=void 0,this.$o=void 0)}}},xl=m({surveys:class{get qt(){return this._instance.config}constructor(e){this.qo=void 0,this._surveyManager=null,this.jo=!1,this.Ho=[],this.Uo=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.qt.disable_surveys){var t=e.surveys;if(N(t))return U.warn("Flags not loaded yet. Not loading surveys.");var i=D(t);this.qo=i?t.length>0:t,U.info("flags response received, isSurveysEnabled: "+this.qo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(i!=null&&i.startsWith(Mr)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((r=>localStorage.removeItem(r)))}loadIfEnabled(){if(!this._surveyManager)if(this.jo)U.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)U.info(Ks);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())U.info("Not loading surveys in cookieless mode without consent.");else{var e=$?.__PosthogExtensions__;if(e){if(!E(this.qo)||this.qt.advanced_enable_surveys){var t=this.qo||this.qt.advanced_enable_surveys;this.jo=!0;try{var i=e.generateSurveys;if(i)return void this.Bo(i,t);var r=e.loadExternalDependency;if(!r)return void this.zo(kr);r(this._instance,"surveys",(s=>{s||!e.generateSurveys?this.zo("Could not load surveys script",s):this.Bo(e.generateSurveys,t)}))}catch(s){throw this.zo("Error initializing surveys",s),s}finally{this.jo=!1}}}else U.error("PostHog Extensions not found.")}}Bo(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new vl(this._instance),U.info("Surveys loaded successfully"),this.Vo({isLoaded:!0})}zo(e,t){U.error(e,t),this.Vo({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Ho.push(e),this._surveyManager&&this.Vo({isLoaded:!0}),()=>{this.Ho=this.Ho.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.qt.disable_surveys)return U.info(Ks),e([]);var i,r=this._instance.get_property(gr);if(r&&!t)return e(r,{isLoaded:!0});typeof Promise<"u"&&this.Uo?this.Uo.then((s=>{var{surveys:n,context:a}=s;return e(n,a)})):(typeof Promise<"u"&&(this.Uo=new Promise((s=>{i=s}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:s=>{var n;this.Uo=null;var a=s.statusCode;if(a!==200||!s.json){var o="Surveys API could not be loaded, status: "+a;U.error(o);var l={isLoaded:!1,error:o};e([],l),i?.({surveys:[],context:l});return}var c,u=s.json.surveys||[],h=u.filter((_=>(function(p){return!(!p.start_date||p.end_date)})(_)&&((function(p){var g;return!((g=p.conditions)==null||(g=g.events)==null||(g=g.values)==null||!g.length)})(_)||(function(p){var g;return!((g=p.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)})(_))));h.length>0&&((c=this._surveyEventReceiver)==null||c.register(h)),(n=this._instance.persistence)==null||n.register({[gr]:u});var d={isLoaded:!0};e(u,d),i?.({surveys:u,context:d})}}))}Vo(e){for(var t of this.Ho)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){U.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!N(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);U.warn("init was not called")}Wo(e){var t=null;return this.getSurveys((i=>{var r;t=(r=i.find((s=>s.id===e)))!==null&&r!==void 0?r:null})),t}Zo(e){if(N(this._surveyManager))return{eligible:!1,reason:Xi};var t=typeof e=="string"?this.Wo(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(N(this._surveyManager))return U.warn("init was not called"),{visible:!1,disabledReason:Xi};var t=this.Zo(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return N(this._surveyManager)?(U.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Xi})):new Promise((i=>{this.getSurveys((r=>{var s,n=(s=r.find((o=>o.id===e)))!==null&&s!==void 0?s:null;if(n){var a=this.Zo(n);i({visible:a.eligible,disabledReason:a.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var r;if(N(this._surveyManager))U.warn("init was not called");else{var s=typeof e=="string"?this.Wo(e):e;if(s!=null&&s.id)if(Vo.includes(s.type)){var n=b?.querySelector(t);if(n)return(r=s.appearance)!=null&&r.surveyPopupDelaySeconds?(U.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,o;U.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(s,n,i),U.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);U.warn("Survey element not found")}else U.warn("Surveys of type "+s.type+" cannot be rendered in the app");else U.warn("Survey not found")}}displaySurvey(e,t){var i;if(N(this._surveyManager))U.warn("init was not called");else{var r=this.Wo(e);if(r){var s=r;if((i=r.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=m({},r,{appearance:m({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==$r.Popover&&t.initialResponses&&U.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var n=this.canRenderSurvey(r);if(!n.visible)return void U.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==$r.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else U.warn("Survey not found")}}cancelPendingSurvey(e){N(this._surveyManager)?U.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}},Pi),kl={toolbar:class{constructor(e){this.instance=e}Go(e){$.ph_toolbar_state=e}Qo(){var e;return(e=$.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),Nn(this.instance.config)||!v||!b)return!1;e=e??v.location,i=i??v.history;try{if(!t){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}t=v?.localStorage}var r,s=pl||mi(e.hash,"__posthog")||mi(e.hash,"state"),n=s?vs((()=>JSON.parse(atob(decodeURIComponent(s)))))||vs((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&n.action==="ph_authorize"?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(Js)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Jo(e){var t=$.ph_load_toolbar||$.ph_load_editor;!N(t)&&Te(t)?t(e,this.instance):Zs.warn("No toolbar load function found")}loadToolbar(e){var t=!(b==null||!b.getElementById(Mn));if(!v||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=m({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(v.localStorage.setItem(Js,JSON.stringify(m({},r,{source:void 0}))),this.Qo()===2)this.Jo(r);else if(this.Qo()===0){var s;this.Go(1),(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return Zs.error("[Toolbar] Failed to load",n),void this.Go(0);this.Go(2),this.Jo(r)})),X(v,"turbolinks:load",(()=>{this.Go(0),this.loadToolbar(r)}))}return!0}Ko(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},Sl=m({experiments:gl},Pi),Pl=m({},Pi,fl,ml,yl,bl,wl,xl,El,kl,Sl,{conversations:class{constructor(e){this.Yo=void 0,this._conversationsManager=null,this.Xo=!1,this.ea=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;N(t)||(Se(t)?this.Yo=t:(this.Yo=t.enabled,this.ea=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Yo=void 0,this.ea=null}loadIfEnabled(){if(!(this._conversationsManager||this.Xo||this._instance.config.disable_conversations||Nn(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=$?.__PosthogExtensions__;if(e&&!E(this.Yo)&&this.Yo)if(this.ea&&this.ea.token){this.Xo=!0;try{var t=e.initConversations;if(t)return this.ta(t),void(this.Xo=!1);var i=e.loadExternalDependency;if(!i)return void this.ra(kr);i(this._instance,"conversations",(r=>{r||!e.initConversations?this.ra("Could not load conversations script",r):this.ta(e.initConversations),this.Xo=!1}))}catch(r){this.ra("Error initializing conversations",r),this.Xo=!1}}else pe.error("Conversations enabled but missing token in remote config.")}}ta(e){if(this.ea)try{this._conversationsManager=e(this.ea,this._instance),pe.info("Conversations loaded successfully")}catch(t){this.ra("Error completing conversations initialization",t)}else pe.error("Cannot complete initialization: remote config is null")}ra(e,t){pe.error(e,t),this._conversationsManager=null,this.Xo=!1}show(){this._conversationsManager?this._conversationsManager.show():pe.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Yo===!0&&!Me(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var r=this;return _e((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,i):(pe.warn(Ve),null)}))()}getMessages(e,t){var i=this;return _e((function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(pe.warn(Ve),null)}))()}markAsRead(e){var t=this;return _e((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(pe.warn(Ve),null)}))()}getTickets(e){var t=this;return _e((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(pe.warn(Ve),null)}))()}requestRestoreLink(e){var t=this;return _e((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(pe.warn(Ve),null)}))()}restoreFromToken(e){var t=this;return _e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(pe.warn(Ve),null)}))()}restoreFromUrlToken(){var e=this;return _e((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(pe.warn(Ve),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}ln(){var e;(e=this._conversationsManager)==null||e.setIdentity()}hn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.ia=!1,this.na=!1,this.Gt=z("[logs]"),this.sa=[],this.oa=0,this.aa=0,this.ua=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ia=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=(t=e.logs)==null?void 0:t.captureConsoleLogs;!N(i)&&i&&(this.ia=!0,this.loadIfEnabled())}reset(){this.sa=[],this.qr&&(clearTimeout(this.qr),this.qr=void 0),this.oa=0,this.aa=0,this.ua=!1}loadIfEnabled(){if(this.ia&&!this.na){var e=$?.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(i=>{var r;i||(r=e.logs)==null||!r.initializeLogs?this.Gt.error("Could not load logs script",i):(e.logs.initializeLogs(this._instance),this.na=!0)})):this.Gt.error(kr)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(e){var t,i,r,s,n,a;if(this._instance.is_capturing())if(e&&e.body){var o=(t=(i=this._instance.config.logs)==null?void 0:i.flushIntervalMs)!==null&&t!==void 0?t:3e3,l=(r=(s=this._instance.config.logs)==null?void 0:s.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,c=Date.now();if(o>c-this.aa||(this.aa=c,this.oa=0,this.ua=!1),l>this.oa){this.oa++;var u=(function(h,d){var{text:_,number:p}=kn[h.level||"info"]||qa,g=String(Date.now())+"000000",R={};d.distinctId&&(R.posthogDistinctId=d.distinctId),d.sessionId&&(R.sessionId=d.sessionId),d.currentUrl&&(R["url.full"]=d.currentUrl),d.screenName&&(R["screen.name"]=d.screenName),d.appState&&(R["app.state"]=d.appState),d.activeFeatureFlags&&d.activeFeatureFlags.length>0&&(R.feature_flags=d.activeFeatureFlags);var P=m({},R,h.attributes||{}),T={timeUnixNano:g,observedTimeUnixNano:g,severityNumber:p,severityText:_,body:{stringValue:h.body},attributes:cs(P)};return h.trace_id&&(T.traceId=h.trace_id),h.span_id&&(T.spanId=h.span_id),E(h.trace_flags)||(T.flags=h.trace_flags),T})(e,this.la());this.sa.push({record:u}),((n=(a=this._instance.config.logs)==null?void 0:a.maxBufferSize)!==null&&n!==void 0?n:100)>this.sa.length?this.ha():this.flushLogs()}else this.ua||(this.Gt.warn("captureLog dropping logs: exceeded "+l+" logs per "+o+"ms"),this.ua=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.ca||(this.ca={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.ca}flushLogs(e){if(this.qr&&(clearTimeout(this.qr),this.qr=void 0),this.sa.length!==0){var t=this.sa;this.sa=[];var i=this._instance.config.logs,r=m({"service.name":i?.serviceName||"unknown_service"},i?.environment&&{"deployment.environment":i.environment},i?.serviceVersion&&{"service.version":i.serviceVersion},i?.resourceAttributes),s=(function(a,o,l,c){return{resourceLogs:[{resource:{attributes:cs(o)},scopeLogs:[{scope:{name:l,version:c},logRecords:a}]}]}})(t.map((a=>a.record)),r,ne.LIB_NAME,ne.LIB_VERSION),n=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Bi({method:"POST",url:n,data:s,compression:"best-available",batchKey:"logs",transport:e})}}ha(){var e,t;this.qr||(this.qr=setTimeout((()=>{this.qr=void 0,this.flushLogs()}),(e=(t=this._instance.config.logs)==null?void 0:t.flushIntervalMs)!==null&&e!==void 0?e:3e3))}la(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i}if($!=null&&(e=$.location)!=null&&e.href&&(t.currentUrl=$.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(t.activeFeatureFlags=r)}return t}}});Lt.__defaultExtensionClasses=m({},Pl);var rn,$l=(rn=At[at]=new Lt,(function(){function e(){e.done||(e.done=!0,na=!1,j(At,(function(t){t._dom_loaded()})))}b!=null&&b.addEventListener?b.readyState==="complete"?e():X(b,"DOMContentLoaded",e,{capture:!1}):v&&w.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),rn);export{$l as default,$l as posthog};
|