db-studio 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/dist/index.js +69 -69
  2. package/dist/index.js.map +1 -1
  3. package/dist/web-dist/assets/_pathlessLayout-DSqP7uLw.js +1 -0
  4. package/dist/web-dist/assets/_pathlessLayout-sBYxFR0u.js +2 -0
  5. package/dist/web-dist/assets/_queryId-D-e6Pm3D.js +1 -0
  6. package/dist/web-dist/assets/_table-CUkeoJ5r.js +1 -0
  7. package/dist/web-dist/assets/{_table-BUNHOVIK.js → _table-CuzwG7mZ.js} +1 -1
  8. package/dist/web-dist/assets/_table-ziU6yws2.js +1 -0
  9. package/dist/web-dist/assets/{abap-B-HzHdT_.js → abap-CNHfI6UP.js} +1 -1
  10. package/dist/web-dist/assets/{apex-t5VcK3BF.js → apex-DTJWTIPK.js} +1 -1
  11. package/dist/web-dist/assets/{azcli-Ce3iuV2p.js → azcli-Degrf7_O.js} +1 -1
  12. package/dist/web-dist/assets/{badge-COF6gx-2.js → badge-BfsYSaL9.js} +1 -1
  13. package/dist/web-dist/assets/{bat-bOBZcLbK.js → bat-og3u3-iX.js} +1 -1
  14. package/dist/web-dist/assets/{bicep-TSicgsnM.js → bicep-DWKWUTZk.js} +1 -1
  15. package/dist/web-dist/assets/{browser-B-fV6CZb.js → browser-ZSYFt_6v.js} +1 -1
  16. package/dist/web-dist/assets/bundle-mjs-DBtz6MiX.js +1 -0
  17. package/dist/web-dist/assets/{cameligo-D-9xpPXV.js → cameligo-wkA_VlQe.js} +1 -1
  18. package/dist/web-dist/assets/chat-sidebar-BzjjNUcW.js +161 -0
  19. package/dist/web-dist/assets/{clojure-9X3x3csE.js → clojure-DOzhadKJ.js} +1 -1
  20. package/dist/web-dist/assets/{code-editor-tPwHd3zF.js → code-editor-BMXfdFhg.js} +2 -2
  21. package/dist/web-dist/assets/{codicon-Brq4_Ui5.ttf → codicon-DF1abBS2.ttf} +0 -0
  22. package/dist/web-dist/assets/{coffee-anOch8Z-.js → coffee-CS5CzV5M.js} +1 -1
  23. package/dist/web-dist/assets/connect-DGQjyh4c.js +1 -0
  24. package/dist/web-dist/assets/constants-iNJwkB3Z.js +20 -0
  25. package/dist/web-dist/assets/{cpp-oW293AoF.js → cpp-BMgiE7AJ.js} +1 -1
  26. package/dist/web-dist/assets/{csharp-BOXMgm5k.js → csharp-Bsvbb6s9.js} +1 -1
  27. package/dist/web-dist/assets/{csp-D67JhNKT.js → csp-BrZ2q231.js} +1 -1
  28. package/dist/web-dist/assets/{css-Bk6H7_K_.js → css-Uqgocp1T.js} +1 -1
  29. package/dist/web-dist/assets/{css.worker-B-fFSVTK.js → css.worker-bHD0dlJO.js} +1507 -1453
  30. package/dist/web-dist/assets/cssMode-BoXwzMyE.js +1 -0
  31. package/dist/web-dist/assets/{cypher-DB0LBjic.js → cypher-BtFHfHba.js} +1 -1
  32. package/dist/web-dist/assets/{dart-CS3MbwLP.js → dart-C5lyYd0g.js} +1 -1
  33. package/dist/web-dist/assets/database.store-BbWvMDJ7.js +57 -0
  34. package/dist/web-dist/assets/dist-BbZuOizk.js +1 -0
  35. package/dist/web-dist/assets/dist-CISR_13N.js +2 -0
  36. package/dist/web-dist/assets/{dockerfile-BGz3qsmk.js → dockerfile-BvQ8yybz.js} +1 -1
  37. package/dist/web-dist/assets/{ecl-lt3qcklx.js → ecl-DkR5NtXz.js} +1 -1
  38. package/dist/web-dist/assets/editor-g1MJRkXV.css +1 -0
  39. package/dist/web-dist/assets/editor.api-BQRmhEY6.js +926 -0
  40. package/dist/web-dist/assets/{editor.worker-BYfbSb3U.js → editor.worker-ByY_fgkM.js} +1328 -1274
  41. package/dist/web-dist/assets/{elixir-cMyUafed.js → elixir-DwgH4lv4.js} +1 -1
  42. package/dist/web-dist/assets/esm-DHn0u-mG.js +1 -0
  43. package/dist/web-dist/assets/{esm-B-4Q6MuQ.js → esm-HKPuItQJ.js} +1 -1
  44. package/dist/web-dist/assets/{flow9-BI9V6TuS.js → flow9-DdhMBw5Q.js} +1 -1
  45. package/dist/web-dist/assets/format-cell-value-CUgsp8Xn.js +1 -0
  46. package/dist/web-dist/assets/{freemarker2-mnCFA3xV.js → freemarker2-g_nJsTeC.js} +2 -2
  47. package/dist/web-dist/assets/{fsharp-I1kqnt0E.js → fsharp-D3Xp09Vk.js} +1 -1
  48. package/dist/web-dist/assets/{go-Cg4qMFVj.js → go-DiDKwy3n.js} +1 -1
  49. package/dist/web-dist/assets/{graphql-CvtHcP49.js → graphql-BgFph-jF.js} +1 -1
  50. package/dist/web-dist/assets/{handlebars-BUcE6Uyy.js → handlebars-RA6uoaMW.js} +1 -1
  51. package/dist/web-dist/assets/{hcl-BkvCdKNu.js → hcl-D4fzt9AB.js} +1 -1
  52. package/dist/web-dist/assets/highlighted-body-JLMTFACH-D8jkzP7m.js +1 -0
  53. package/dist/web-dist/assets/{html-BBqcfykD.js → html-DchTZAEc.js} +1 -1
  54. package/dist/web-dist/assets/{html.worker-CdalOg9p.js → html.worker-CHVREBCJ.js} +1527 -1473
  55. package/dist/web-dist/assets/{htmlMode-D8je66Rk.js → htmlMode-BcLYF6v1.js} +1 -1
  56. package/dist/web-dist/assets/icons-DKLzom80.js +1 -0
  57. package/dist/web-dist/assets/index-DTVRtzpz.css +2 -0
  58. package/dist/web-dist/assets/index-L3nylpEA.js +34 -0
  59. package/dist/web-dist/assets/indexes-B3M1QTrn.js +1 -0
  60. package/dist/web-dist/assets/{ini-CPc8BCWu.js → ini-CjG9jGLJ.js} +1 -1
  61. package/dist/web-dist/assets/{java-C9Yie4SH.js → java-DitR3Nwd.js} +1 -1
  62. package/dist/web-dist/assets/{javascript-CuGq5ydO.js → javascript-l9pEcFVL.js} +1 -1
  63. package/dist/web-dist/assets/{json-editor-Dc1E8Fc-.js → json-editor-CeBQ9FBf.js} +1 -1
  64. package/dist/web-dist/assets/{json.worker-DI02pyM8.js → json.worker-BKCy_srb.js} +2747 -2693
  65. package/dist/web-dist/assets/{jsonMode-BgdTmYik.js → jsonMode-D4edoDNQ.js} +4 -4
  66. package/dist/web-dist/assets/{julia--qJGRfN8.js → julia-_g8mQYsr.js} +1 -1
  67. package/dist/web-dist/assets/{keys-Bs0DRbCB.js → keys-DhNPoWOm.js} +1 -1
  68. package/dist/web-dist/assets/{kotlin-C3MSe-0N.js → kotlin-3o4lP58u.js} +1 -1
  69. package/dist/web-dist/assets/{label-DzHJlGAx.js → label-CavJMZd3.js} +1 -1
  70. package/dist/web-dist/assets/{less-DOBYgWSY.js → less-CdRSAxY_.js} +1 -1
  71. package/dist/web-dist/assets/{lexon-Djd2rGvJ.js → lexon-B1v3Gspe.js} +1 -1
  72. package/dist/web-dist/assets/{liquid-DXfHmR66.js → liquid-3wMbC9OJ.js} +1 -1
  73. package/dist/web-dist/assets/{logs-BortjBc-.js → logs-C22dj_JT.js} +1 -1
  74. package/dist/web-dist/assets/{lspLanguageFeatures-C7-iyD6G.js → lspLanguageFeatures-TaH7V4jh.js} +1 -1
  75. package/dist/web-dist/assets/{lua-Ck8vNcPw.js → lua-D3D-_pEE.js} +1 -1
  76. package/dist/web-dist/assets/{m3-a6Kl4TV0.js → m3-fsgnMtjU.js} +1 -1
  77. package/dist/web-dist/assets/{markdown-DkcRBwO0.js → markdown-DTtmtPZi.js} +1 -1
  78. package/dist/web-dist/assets/{mdx-QI5o45qz.js → mdx-B7jfJVLI.js} +1 -1
  79. package/dist/web-dist/assets/mermaid-WFAXDIZX-qzZppTtW.js +1 -0
  80. package/dist/web-dist/assets/middleware-DLeL20gb.js +1 -0
  81. package/dist/web-dist/assets/{mips-Cc1YVI2p.js → mips-BA6kSOEZ.js} +1 -1
  82. package/dist/web-dist/assets/module-B7dXHbVt.js +3 -0
  83. package/dist/web-dist/assets/monaco-theme-BwGcwpJl.js +68 -0
  84. package/dist/web-dist/assets/monaco-theme-DtsiNm_H.css +1 -0
  85. package/dist/web-dist/assets/{msdax-Bh41xUoQ.js → msdax-B96QDI_e.js} +1 -1
  86. package/dist/web-dist/assets/{mysql-BZTZMxPa.js → mysql-ZJG-Zmb7.js} +1 -1
  87. package/dist/web-dist/assets/{objective-c-CxZIMOHQ.js → objective-c-D1BqZdFg.js} +1 -1
  88. package/dist/web-dist/assets/{overlay.store-DsUdwZjE.js → overlay.store-DoGHwFxO.js} +1 -1
  89. package/dist/web-dist/assets/{pascal-I-WmLkmD.js → pascal-CXwopv-V.js} +1 -1
  90. package/dist/web-dist/assets/{pascaligo-DEZ-6bwf.js → pascaligo-DbxCO0kO.js} +1 -1
  91. package/dist/web-dist/assets/{perl-DfeHQJxJ.js → perl-DL95F-1i.js} +1 -1
  92. package/dist/web-dist/assets/{personal-preferences.store-DXSnKmVN.js → personal-preferences.store-BgUar1W1.js} +1 -1
  93. package/dist/web-dist/assets/{pgsql-OdOoQYPW.js → pgsql-D6V7y-We.js} +1 -1
  94. package/dist/web-dist/assets/{php-CF1bUutw.js → php-Cl4Rc77T.js} +1 -1
  95. package/dist/web-dist/assets/{pla-BHZr0GrY.js → pla-C2-KEJLZ.js} +1 -1
  96. package/dist/web-dist/assets/{postiats-BSB6a63H.js → postiats-CnwS6VBM.js} +1 -1
  97. package/dist/web-dist/assets/{powerquery-Bu0p84Ye.js → powerquery-IxSHxxBc.js} +1 -1
  98. package/dist/web-dist/assets/{powershell-Dcq3YM6T.js → powershell-DAkyXnxj.js} +1 -1
  99. package/dist/web-dist/assets/preload-helper-BmptvQqE.js +1 -0
  100. package/dist/web-dist/assets/{protobuf-CsWrQxqX.js → protobuf-FnPVBP5H.js} +1 -1
  101. package/dist/web-dist/assets/{pug-DLQiv3Bp.js → pug-C_d8B8nZ.js} +1 -1
  102. package/dist/web-dist/assets/{python-BvKEpyP9.js → python-DK9sRx0Y.js} +1 -1
  103. package/dist/web-dist/assets/{qsharp-D8nrRUNu.js → qsharp-DHzbHTnS.js} +1 -1
  104. package/dist/web-dist/assets/{queries.store-BaeyNA64.js → queries.store-CXQwDZiV.js} +1 -1
  105. package/dist/web-dist/assets/query-runner-D0LqVvy4.js +17 -0
  106. package/dist/web-dist/assets/{r-xhyKpGTk.js → r-BreUQjgc.js} +1 -1
  107. package/dist/web-dist/assets/radix-ui-CJhaEsHV.js +41 -0
  108. package/dist/web-dist/assets/{razor-Ceb9S1Rz.js → razor-CI-yLdex.js} +1 -1
  109. package/dist/web-dist/assets/react-CGNcTA1t.js +1 -0
  110. package/dist/web-dist/assets/react-dom-Czf_u9MH.js +9 -0
  111. package/dist/web-dist/assets/{redis-BnpkEvbr.js → redis-BdhjrevD.js} +1 -1
  112. package/dist/web-dist/assets/{redis-value-DMk0-Zuc.js → redis-value-Cq8YBvSS.js} +1 -1
  113. package/dist/web-dist/assets/{redshift-BpxVXjAI.js → redshift-CwVMUyQc.js} +1 -1
  114. package/dist/web-dist/assets/{restructuredtext-5afXtW7D.js → restructuredtext-D6U9PIiF.js} +1 -1
  115. package/dist/web-dist/assets/rolldown-runtime-D_n5YsVB.js +1 -0
  116. package/dist/web-dist/assets/{ruby-CHaoWUHT.js → ruby-D0QS81Wd.js} +1 -1
  117. package/dist/web-dist/assets/runner-BE2YTdi9.js +1 -0
  118. package/dist/web-dist/assets/{rust-Bw0WVsLy.js → rust-Bsq9cLDY.js} +1 -1
  119. package/dist/web-dist/assets/{sb-CEjXmIyG.js → sb-DAQADLLd.js} +1 -1
  120. package/dist/web-dist/assets/{scala-BuaCSaU6.js → scala-oEMLo0pl.js} +1 -1
  121. package/dist/web-dist/assets/schema-B-jmgfHC.js +1 -0
  122. package/dist/web-dist/assets/schema-JCqbh3DE.js +1 -0
  123. package/dist/web-dist/assets/{scheme-DIKzlmFG.js → scheme-DDI6muad.js} +1 -1
  124. package/dist/web-dist/assets/{scss-C2_UsWzg.js → scss-BU9Ttlwm.js} +1 -1
  125. package/dist/web-dist/assets/{select-C-nrz7Tx.js → select-3l4LDMzT.js} +1 -1
  126. package/dist/web-dist/assets/{separator-DnB61XAO.js → separator-BD46sVx9.js} +1 -1
  127. package/dist/web-dist/assets/{sheet-sidebar-BGxJGRbd.js → sheet-sidebar-CjbtFAKn.js} +1 -1
  128. package/dist/web-dist/assets/{shell-2aEL2EVH.js → shell-BI6rOefn.js} +1 -1
  129. package/dist/web-dist/assets/{solidity-D-5XfYE1.js → solidity-B17zzzu-.js} +1 -1
  130. package/dist/web-dist/assets/{sophia-s4MFSvUF.js → sophia-DQi6mooo.js} +1 -1
  131. package/dist/web-dist/assets/{sparql-Dkv46wS5.js → sparql-DGFBDMPi.js} +1 -1
  132. package/dist/web-dist/assets/spinner-D7Cvt3BD.js +1 -0
  133. package/dist/web-dist/assets/{sql-Dz9Xhs8s.js → sql-DGzRlxQo.js} +1 -1
  134. package/dist/web-dist/assets/{st-Cbo0XVmr.js → st-Ceq2dhS_.js} +1 -1
  135. package/dist/web-dist/assets/{swift-B66X97nW.js → swift-8-FeeRSy.js} +1 -1
  136. package/dist/web-dist/assets/{systemverilog-gGKga8Gf.js → systemverilog-mmioB6wo.js} +1 -1
  137. package/dist/web-dist/assets/table-sVAmZLcg.js +1 -0
  138. package/dist/web-dist/assets/tables-TW8L7_FW.js +16 -0
  139. package/dist/web-dist/assets/tanstack-D9GckDbx.js +5 -0
  140. package/dist/web-dist/assets/{tcl-BtbeJsUN.js → tcl-BTUJQo2X.js} +1 -1
  141. package/dist/web-dist/assets/{ts.worker-r_qbh1JO.js → ts.worker-BLC4EdqU.js} +18311 -18257
  142. package/dist/web-dist/assets/{tsMode-BgtcNcpl.js → tsMode-BRJ2WiSx.js} +4 -4
  143. package/dist/web-dist/assets/{twig-0_nXiuYs.js → twig-C6ea54bM.js} +1 -1
  144. package/dist/web-dist/assets/{typescript-Cy_CzC_-.js → typescript-U3aTTn2d.js} +1 -1
  145. package/dist/web-dist/assets/{typespec-DBO6_WMJ.js → typespec-B4z8l2XF.js} +1 -1
  146. package/dist/web-dist/assets/use-database-engine-CG7rZQXQ.js +1 -0
  147. package/dist/web-dist/assets/{use-theme-DBhPknw6.js → use-theme-CKjVHAZg.js} +1 -1
  148. package/dist/web-dist/assets/utils-CZdosIsH.js +1 -0
  149. package/dist/web-dist/assets/{vb-DFJjBsW2.js → vb-BbQNgbjG.js} +1 -1
  150. package/dist/web-dist/assets/visualizer-c23lRr6o.js +1 -0
  151. package/dist/web-dist/assets/{wgsl-U3RBM2M0.js → wgsl-SWAFFAY4.js} +1 -1
  152. package/dist/web-dist/assets/{workers-ClRH6A2w.js → workers-DeOJBffb.js} +1 -1
  153. package/dist/web-dist/assets/{xml-D11j3J2_.js → xml-DM-qLhlQ.js} +1 -1
  154. package/dist/web-dist/assets/{yaml-D7Z_4mnx.js → yaml-BB3LUpV7.js} +1 -1
  155. package/dist/web-dist/index.html +31 -31
  156. package/package.json +22 -22
  157. package/dist/web-dist/assets/_pathlessLayout-CUDS1e28.js +0 -1
  158. package/dist/web-dist/assets/_pathlessLayout-WZkezfN7.js +0 -2
  159. package/dist/web-dist/assets/_queryId-CEJb62Vl.js +0 -1
  160. package/dist/web-dist/assets/_table-6SZEx92j.js +0 -1
  161. package/dist/web-dist/assets/_table-CwyP_2EP.js +0 -1
  162. package/dist/web-dist/assets/bundle-mjs-CZwf2xtr.js +0 -1
  163. package/dist/web-dist/assets/chat-sidebar-DwzCElBd.js +0 -132
  164. package/dist/web-dist/assets/connect-l3LjAClZ.js +0 -1
  165. package/dist/web-dist/assets/constants-CKAehpPm.js +0 -12
  166. package/dist/web-dist/assets/cssMode-G6latsS7.js +0 -1
  167. package/dist/web-dist/assets/database.store-BuqVJMY6.js +0 -57
  168. package/dist/web-dist/assets/dist-Bz0qAN0x.js +0 -2
  169. package/dist/web-dist/assets/dist-Cf0L32Jd.js +0 -1
  170. package/dist/web-dist/assets/editor-1FQrmyyI.css +0 -1
  171. package/dist/web-dist/assets/editor.api-BTIrAcm5.js +0 -865
  172. package/dist/web-dist/assets/format-cell-value-CgUtYv8B.js +0 -1
  173. package/dist/web-dist/assets/highlighted-body-OFNGDK62-t8UIAZOZ.js +0 -1
  174. package/dist/web-dist/assets/icons-DxFtdMXW.js +0 -1
  175. package/dist/web-dist/assets/index-QVi4Lb9U.css +0 -2
  176. package/dist/web-dist/assets/index-WFVurGCI.js +0 -34
  177. package/dist/web-dist/assets/indexes-C3Qddb5L.js +0 -1
  178. package/dist/web-dist/assets/mermaid-GHXKKRXX-D35eppUc.js +0 -1
  179. package/dist/web-dist/assets/middleware-CXk7SlTF.js +0 -1
  180. package/dist/web-dist/assets/module-D_kjbMCc.js +0 -2
  181. package/dist/web-dist/assets/monaco-theme-BnSsSzUH.css +0 -1
  182. package/dist/web-dist/assets/monaco-theme-C2k_taVU.js +0 -64
  183. package/dist/web-dist/assets/preload-helper-DF7hIgef.js +0 -1
  184. package/dist/web-dist/assets/query-runner-f473QQSD.js +0 -17
  185. package/dist/web-dist/assets/radix-ui-CxCv--D1.js +0 -51
  186. package/dist/web-dist/assets/react-DEQ0BgTL.js +0 -1
  187. package/dist/web-dist/assets/react-dom-ITw3Lqwx.js +0 -9
  188. package/dist/web-dist/assets/rolldown-runtime-fzu9RN21.js +0 -1
  189. package/dist/web-dist/assets/runner-NsYjzIZs.js +0 -1
  190. package/dist/web-dist/assets/schema-CE1yGygf.js +0 -1
  191. package/dist/web-dist/assets/schema-rxLBue8Q.js +0 -1
  192. package/dist/web-dist/assets/spinner-CNnB5r0X.js +0 -1
  193. package/dist/web-dist/assets/table-C8WK3uAc.js +0 -1
  194. package/dist/web-dist/assets/tables-D98Kbmcb.js +0 -16
  195. package/dist/web-dist/assets/tanstack-RwHFfmqj.js +0 -8
  196. package/dist/web-dist/assets/use-database-engine-DZZj7-4J.js +0 -1
  197. package/dist/web-dist/assets/utils-EJLOIroS.js +0 -1
  198. package/dist/web-dist/assets/visualizer-CgYlDJ_-.js +0 -1
  199. package/dist/web-dist/assets/vscode-wuSgCuZI.js +0 -1
@@ -0,0 +1,3 @@
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.2.0"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6b264977-ac7c-4903-a6ab-b0679fde229d",e._sentryDebugIdIdentifier="sentry-dbid-6b264977-ac7c-4903-a6ab-b0679fde229d")}catch{}})();var w="u">typeof window?window:void 0,_e="u">typeof globalThis?globalThis:w,ve=_e?.navigator,O=_e?.document,K=_e?.location,yi=_e?.fetch,Dr=_e?.XMLHttpRequest&&"withCredentials"in new _e.XMLHttpRequest?_e.XMLHttpRequest:void 0,hn=_e?.AbortController,Oc=_e?.CompressionStream,ye=ve?.userAgent,Wt=typeof globalThis<"u"?globalThis:w;Wt&&typeof self>"u"&&(Wt.self=Wt),Wt&&typeof File>"u"&&(Wt.File=function(){});var R=w??{},vn="0.10.2",Je={DEBUG:!1,LIB_VERSION:vn,LIB_NAME:"browser-common",JS_SDK_VERSION:vn},je=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),rr=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),Cc=["$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"],Tc=["token"];function T(e,t){return e.indexOf(t)!==-1}var Nt=function(e){return e.trim()},nr=function(e){return e.replace(/^\$/,"")};function Zo(e){var t;const i=[];return(t=JSON.stringify(e,function(s,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(r))return"[Circular]";i.push(r)}return r}}))!==null&&t!==void 0?t:"null"}var ea=Object.prototype,Nr=ea.hasOwnProperty,hs=ea.toString,I=Array.isArray||function(e){return hs.call(e)==="[object Array]"},ne=e=>typeof e=="function",D=e=>e===Object(e)&&!I(e),Ee=e=>{if(D(e)){for(const t in e)if(Nr.call(e,t))return!1;return!0}return!1},x=e=>e===void 0,N=e=>hs.call(e)=="[object String]",ai=e=>N(e)&&e.trim().length===0,se=e=>e===null,L=e=>x(e)||se(e),oe=e=>hs.call(e)=="[object Number]"&&e==e,Be=e=>oe(e)&&e>0,be=e=>hs.call(e)==="[object Boolean]",Ic=e=>T(Cc,e),Fc=e=>T(Tc,e);function ta(e){return e===null||typeof e!="object"}function Wi(e,t){return{}.toString.call(e)===`[object ${t}]`}function Vt(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ia(e,Error)}}function jr(e){return"u">typeof Event&&ia(e,Event)}function ia(e,t){try{return e instanceof t}catch{return!1}}var Rc=[!0,"true",1,"1","yes"],ys=e=>T(Rc,e),Mc=[!1,"false",0,"0","no"];function pn(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(c){i(c);return}a.done?t(l):Promise.resolve(l).then(s,r)}function Q(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(l){pn(n,s,r,o,a,"next",l)}function a(l){pn(n,s,r,o,a,"throw",l)}o(void 0)})}}var Lc=["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","pinterestbot","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"],Pi=new Map,fn=function(e,t=[]){if(!e)return!1;const i=(function(o,a){let l="";for(let c=0;a.length>c;c++){const u=a[c];l+=u.length+":"+u}return o.length+":"+o+"|"+a.length+":"+l})(e,t),s=Pi.get(i);if(s!==void 0)return s;const r=e.toLowerCase(),n=Lc.concat(t).some(o=>r.indexOf(o.toLowerCase())!==-1);return 256>Pi.size||Pi.clear(),Pi.set(i,n),n};function qe(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),oe(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),qe(r??i,t,i,s))}var Dc=class{constructor(e){this.C={},this.I=e.I,this.R=qe(e.bucketSize,0,100,e.$),this.A=qe(e.refillRate,0,this.R,e.$),this.O=qe(e.refillInterval,0,864e5,e.$)}F(e,t){const i=Math.floor((t-e.lastAccess)/this.O);i>0&&(e.tokens=Math.min(e.tokens+i*this.A,this.R),e.lastAccess=e.lastAccess+i*this.O)}consumeRateLimit(e){var t;const i=Date.now(),s=String(e);let r=this.C[s];return r?this.F(r,i):(r={tokens:this.R,lastAccess:i},this.C[s]=r),r.tokens===0||(r.tokens--,r.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),r.tokens===0)}stop(){this.C={}}},jt="Mobile",bi="Android",Gi="Tablet",sa="Android Tablet",ra="iPad",na="Apple Watch",Di="Safari",vs="BlackBerry",oa="Samsung Internet",Ni="Chrome",aa="Chrome iOS",la="Internet Explorer",ca="Internet Explorer Mobile",ua="Opera",da="Microsoft Edge",ji="Firefox",ha="Firefox iOS",Ji="Nintendo",Yi="PlayStation",ps="Xbox",va="Android Mobile",pa="Mobile Safari",bs="Windows",fa="Windows Phone",gn="Nokia",or="Ouya",Nc="Generic "+jt.toLowerCase(),ga="Generic "+Gi.toLowerCase(),ar="Konqueror",_a="Oculus Browser",ma="Vivaldi",ya="Yandex",ba="Whale",wa="DuckDuckGo",xa="Pale Moon",$a="Waterfox",lr="Brave",Ea="Claude",ka="Codex",Sa="ChatGPT",Pa="Google Search App",ws=new RegExp("Version/(\\d+(\\.\\d+)?)"),xs=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),jc=new RegExp(ps,"i"),qc=new RegExp("PlayStation \\w+","i"),Uc=new RegExp("Nintendo \\w+","i"),qr=new RegExp("BlackBerry|PlayBook|BB10","i"),Hc={"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"},Aa=function(e,t,i,s){return t=t||"",(function(r){return r?.brave?lr:null})(i)||(s?.detectGoogleSearchApp&&T(e,"GSA/")?Pa:T(e," OPR/")&&T(e,"Mini")?"Opera Mini":T(e," OPR/")?ua:qr.test(e)?vs:T(e,"IEMobile")||T(e,"WPDesktop")?ca:T(e,"OculusBrowser")?_a:T(e,"SamsungBrowser")?oa:T(e,"Edge")||T(e,"Edg/")?da:T(e,"Vivaldi/")?ma:T(e,"YaBrowser/")?ya:T(e,"Whale/")?ba:T(e,"DuckDuckGo/")||T(e,"Ddg/")?wa:T(e,"Claude/")?Ea:T(e,"Codex/")?ka:T(e,"ChatGPT/")?Sa:T(e,"FBIOS")?"Facebook Mobile":T(e,"UCWEB")||T(e,"UCBrowser")?"UC Browser":T(e,"CriOS")?aa:T(e,"CrMo")||T(e,Ni)?Ni:T(e,bi)&&T(e,Di)?va:T(e,"FxiOS")?ha:T(e.toLowerCase(),ar.toLowerCase())?ar:T(e,"Brave/")?lr:((r,n)=>n&&T(n,"Apple")||(function(o){return T(o,Di)&&!T(o,Ni)&&!T(o,bi)})(r))(e,t)?T(e,jt)?pa:Di:T(e,"PaleMoon/")?xa:T(e,"Waterfox/")?$a:T(e,ji)?ji:T(e,"MSIE")||T(e,"Trident/")?la:T(e,"Gecko")?ji:"")},Bc={[ca]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[da]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Ni]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[aa]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Di]:[ws],[pa]:[ws],[ua]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ji]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[ha]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[ar]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[vs]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),ws],[va]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[oa]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[_a]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[ma]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[ya]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[ba]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[lr]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ea]:[xs],[ka]:[xs],[Sa]:[xs],[wa]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[xa]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[$a]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Pa]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[la]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},zc=function(e,t,i,s){const r=Aa(e,t,i,s),n=Bc[r];if(x(n))return null;for(let o=0;n.length>o;o++){const a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},_n=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[ps,e&&e[1]||""]],[new RegExp(Ji,"i"),[Ji,""]],[new RegExp(Yi,"i"),[Yi,""]],[qr,[vs,""]],[new RegExp(bs,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[fa,""];if(new RegExp(jt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let s=Hc[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[bs,s]}return[bs,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=x(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[bi,[e[2],e[3],e[4]||"0"].join(".")]:[bi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const 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/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Oa=function(e){for(let t=0;_n.length>t;t++){const[i,s]=_n[t],r=i.exec(e),n=r&&(ne(s)?s(r,e):s);if(n)return n}return["",""]},Ca=function(e){return Uc.test(e)?Ji:qc.test(e)?Yi:jc.test(e)?ps:new RegExp(or,"i").test(e)?or:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?fa:/iPad/.test(e)?ra:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?na:qr.test(e)?vs:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(gn,"i").test(e)?gn:/(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(jt).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)?bi:sa:new RegExp("(pda|Mobile)","i").test(e)?Nc:new RegExp(Gi,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?ga:""},Vc=function(e,t){var i;const s=Ca(e);return s===ra||s===sa||s==="Kobo"||s==="Kindle Fire"||s===ga?Gi:s===Ji||s===ps||s===Yi||s===or?"Console":s===na?"Wearable":s?jt:t?.userAgentDataPlatform==="Android"&&((i=t?.maxTouchPoints)!==null&&i!==void 0?i:0)>0?600>Math.min((r=t?.screenWidth)!==null&&r!==void 0?r:0,(n=t?.screenHeight)!==null&&n!==void 0?n:0)/((o=t?.devicePixelRatio)!==null&&o!==void 0?o:1)?jt:Gi:"Desktop";var r,n,o},$s=/\bFBAV\/(\d+(?:\.\d+)*)/i,mn=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",$s],[/\bFBAN\/EMA\b/i,"Facebook Lite",$s],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",$s],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],cr="[Truncated]",ki="[Unserializable]";function Rt(e){let t="";for(let i=0;e.length>i;i++){const s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"�";else{const r=e.charCodeAt(i+1);56320>r||r>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}function Ta(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch{i=[]}for(const s of i){let r;try{r=t[s]}catch{r=ki}Object.defineProperty(e,s,{value:r,enumerable:!0,writable:!0,configurable:!0})}return e}var Es=3e5,Ia=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,Es);if(!t)return this.ts=i,void(this.es=i+s);this.es=Math.max(this.es,Math.min(i+s,this.ts+Es))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(Es,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}},Wc=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function yn(e,t){return typeof(i=e)=="string"&&Wc.test(i)?e:t();var i}function Fa(e,t){const i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return i}function lt(e){return e&&e.split("#")[0]}function bn(e){try{return e()}catch{return}}function Ra(e,t){const i=setTimeout(e,t);return i!=null&&i.unref&&i?.unref(),i}function wn(e,t,i){return Ma.apply(this,arguments)}function Ma(){return(Ma=Q(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((r,n)=>{s=Ra(()=>{try{i?.(),r()}catch(o){n(o)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}function li(e){return li=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},li(e)}function Gc(e,t,i){return(t=(function(s){var r=(function(n){if(li(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var a=o.call(n,"string");if(li(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)})(s);return li(r)=="symbol"?r:r+""})(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function xn(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),i.push.apply(i,s)}return i}function p(e){for(var t=1;arguments.length>t;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?xn(Object(i),!0).forEach(function(s){Gc(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):xn(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var Gt,$n,En,wt;function Jc(e){var t;const i=globalThis._posthogChunkIds,s=globalThis._debugIds;if(!i&&!s)return;const r=i?Object.keys(i):[],n=s?Object.keys(s):[];if(wt&&kn(i,r,$n)&&kn(s,n,En))return wt;$n=i?p({},i):void 0,En=s?p({},s):void 0,wt={},(t=Gt)!==null&&t!==void 0||(Gt={});const o=(a,l)=>{for(const u of a){const h=l[u];if(!h)continue;const d=Gt?.[u];if(d){wt[d]=h;continue}const v=e(u);for(let f=v.length-1;f>=0;f--){var c;const m=(c=v[f])===null||c===void 0?void 0:c.filename;if(m){wt[m]=h,Gt[u]=m;break}}}};return s&&o(n,s),i&&o(r,i),wt}function kn(e,t,i){return e&&i?t.length===Object.keys(i).length&&t.every(s=>e[s]===i[s]):e===i}var Yc=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){const i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return Q(function*(){for(const i of e)i.stacktrace&&i.stacktrace.frames&&I(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||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,r;if(e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return p(p({},e),{},{cause:s,stack:r,errors:(i=e.errors)===null||i===void 0?void 0:i.map(n=>this.parseStacktrace(n,t))})}applyChunkIds(e,t){return e.map(i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i))}applyCoercers(e,t){for(const i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Q(function*(){let i=e;for(const s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){const i=[],s=(r,n,o)=>{var a;const l=i.length,c=n===void 0?p(p({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:r.synthetic,exception_id:l}):{type:"chained",source:o,synthetic:r.synthetic,exception_id:l,parent_id:n},u={type:r.type,value:r.value,mechanism:c};r.stack&&(u.stacktrace={type:"raw",frames:r.stack}),i.push(u),r.cause&&s(r.cause,l,"cause");for(const h of(a=r.errors)!==null&&a!==void 0?a:[])s(h,l,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:Jc(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(Vt(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;const r=(t=Object.getOwnPropertyDescriptor(i,"constructor"))===null||t===void 0?void 0:t.value;if(typeof r=="function"&&r.name==="AggregateError"){const n=e.errors;return I(n)?n:void 0}i=Object.getPrototypeOf(i)}}}catch{}}buildCoercingContext(e,t,i=0){let s=0,r=0,n=!1;const o=new Set,a=[],l={},c=(d,v,f=0)=>{const m=u(v,f),g=m.apply;if(m.apply=$=>{a.push(d);try{return g($)}finally{a.pop()}},f>4||f>0&&a.indexOf(d)!==-1)return this.coerceFallback(m);const y=typeof d=="object"&&d!==null||typeof d=="function";if(f===0&&s>=50||y&&o.has(d))return;y&&o.add(d),f===0&&s++;const _=this.getAggregateErrors(d);let b,E;n||(n=!!_);try{if(b=this.applyCoercers(d,m),!b)throw l}catch($){if($===l)return void(f===0&&s--);if(!n)throw $;b=this.coerceFallback(m)}if(!_||s>=50)return b;try{E=_.length}catch{return b}if(!Number.isInteger(E)||0>E||E>4294967295)return b;const k=[];for(let $=0;50>s&&1e3>r&&E>$;$++){let A;r++;try{A=m.next(_[$])}catch{s++,A=this.coerceFallback(u(v+1))}A&&k.push(A)}return p(p({},b),{},{errors:k})},u=(d,v=0)=>p(p({},t),{},{syntheticException:d==0?t.syntheticException:void 0,mechanism:d==0?e:{},apply(f){const m=c(f,d,v+1);if(!m)throw l;return m},next:f=>c(f,d+1)}),h=u(i);return p(p({},h),{},{apply:d=>{var v;return(v=c(d,i))!==null&&v!==void 0?v:this.coerceFallback(h)}})}},Kc=/^([a-z][a-z0-9.+-]+):/i,Xc=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function Qc(e){if(!e||e==="<anonymous>")return!1;const t=Kc.exec(e);return!t||Xc.includes(t[1].toLowerCase())}function ur(e,t,i,s,r){const n={platform:e,filename:t,function:i==="<anonymous>"?"?":i,in_app:Qc(t)};return x(s)||(n.lineno=s),x(r)||(n.colno=r),n}var La=(e,t)=>{const i=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return i||s?[e.indexOf("@")!==-1?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Zc=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,eu=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tu=/\((\S*)(?::(\d+))(?::(\d+))\)/,iu=(e,t)=>{const i=Zc.exec(e);if(i){const[,r,n,o]=i;return ur(t,r,"?",+n,+o)}const s=eu.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){const o=tu.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}const[r,n]=La(s[1]||"?",s[2]);return ur(t,n,r,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},su=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ru=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,nu=(e,t)=>{const i=su.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const n=ru.exec(i[3]);n&&(i[1]=i[1]||"eval",i[3]=n[1],i[4]=n[2],i[5]="")}let s=i[3],r=i[1]||"?";return[r,s]=La(r,s),ur(t,s,r,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Sn=/\(error: (.*)\)/;function Ur(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function ou(e){for(let t=1;10>=t;t++){const i=e.length-2*t;if(0>i)break;let s=!0;for(let r=0;t>r;r++)if(!Ur(e[i+r],e[i+t+r])){s=!1;break}if(s){for(let r=0;t>r;r++)e[i+r]=e[i+t+r];return e.length=i+t,{start:i,length:t}}}}function au(e,t){const i=t.start+t.length,s=Na(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}function Da(e,t){let i=t.start;for(;i>0&&Ur(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function Na(e,t){const i=t.start+t.length;let s=i;for(;e.length>s&&Ur(e[s],e[s-t.length]);)s++;return s-i}function lu(e,t){const i=t[0];let s=e.length-(i?Da(e,i):0);for(const r of t)s-=Na(e,r);return s}function cu(e,t,i){for(let s=0;e.length>s;s++){const r=e[(t+s)%e.length],n=e[(i+s)%e.length];if(r!==n)return n>r}return!1}var uu=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const i=N(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){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Wi(e,"DOMException")}isDOMError(e){return Wi(e,"DOMError")}},du=class{match(e){return Vt(e)}coerce(e,t){var i;const s=this.getStack(e),r=s===void 0?(i=t.syntheticException)===null||i===void 0?void 0:i.stack:void 0,n=!!r;return{type:this.getType(e),value:this.getMessage(e,t),stack:s??r,cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const i=e.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){try{const t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;const i=e.stack;return typeof i=="string"&&i.length>0?i:void 0}catch{return}}},hu=class{match(e){return!!Wi(e,"ErrorEvent")&&(e.error!=null||this.hr(e))}coerce(e,t){var i;if(e.error!=null)return t.apply(e.error);const s=t.apply(e.message);return p(p({},s),{},{stack:(i=this.vr(e))!==null&&i!==void 0?i:s.stack,synthetic:!0})}hr(e){return N(e.message)&&e.message.length>0}vr(e){var t,i;const s=e,r=(t=s.lineno)!==null&&t!==void 0?t:0,n=(i=s.colno)!==null&&i!==void 0?i:0;if(N(s.filename)&&s.filename.length!==0&&r!==0)return`Error
2
+ at ${s.filename}:${r}:${n}`}},vu=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,pu=class{match(e){return typeof e=="string"}coerce(e,t){var i;const[s,r]=this.getInfos(e);return{type:s??"Error",value:r??e,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e;const s=e.match(vu);return s&&(t=s[1],i=s[2]),[t,i]}},fu=["fatal","error","warning","log","info","debug"];function ja(e,t=40){const i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let s=i.length;s>0;s--){const r=i.slice(0,s).join(", ");if(t>=r.length)return s===i.length?r:r.length>t?`${r.slice(0,t)}...`:r}return""}var gu=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s;const r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(i=this.getStack(e))!==null&&i!==void 0?i:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(jr(e))return e.constructor.name;const t="name"in e?e.name:void 0;return N(t)&&!ai(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let i=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(i+=` with message: '${e.message}'`),i}if("message"in e&&typeof e.message=="string")return e.message;const t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${ja(e)}`}isSeverityLevel(e){return N(e)&&!ai(e)&&fu.indexOf(e)>=0}getStack(e){try{return N(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:N(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const i=e[t];if(Vt(i))return i}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},_u=class{match(e){return jr(e)}coerce(e,t){var i;const s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${ja(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},mu=class{match(e){return ta(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},yu=class{match(e){return Wi(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!jr(e))return!1;try{const t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var i;const s=this.getUnhandledRejectionReason(e);return ta(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}:t.apply(s)}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}},Ki="$message",Xi="$timestamp",bu=new Set([Ki,Xi]),ks={enabled:!0,max_bytes:32768};function Qi(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:ks.enabled,max_bytes:xu(e.max_bytes,ks.max_bytes)}:p({},ks)}var wu=class{constructor(e){this.ns=[],this.ss=0,this.Ar=Qi(e)}setConfig(e){this.Ar=Qi(e),this.rs()}add(e){const t=(function(s){let r;try{r=Zo(s)}catch{return}try{const n=JSON.parse(r);if(!D(n))return;const o=n,a=o[Ki],l=o[Xi];return!N(a)||a.trim().length===0||!N(l)&&!oe(l)?void 0:{step:o,json:r}}catch{return}})(e);if(!t)return;const i=(function(s){if("u">typeof TextEncoder)return new TextEncoder().encode(s).length;const r=encodeURIComponent(s);let n=0;for(let o=0;r.length>o;o++)r[o]==="%"?(n+=1,o+=2):n+=1;return n})(t.json);i>this.Ar.max_bytes||(this.ns.push({step:t.step,bytes:i}),this.ss+=i,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Ar.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function xu(e,t){if(!oe(e)||e===1/0||e===-1/0)return t;const i=Math.floor(e);return 0>i?t:i}var Pn=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function An(e){return typeof e=="string"||e}function On(e){return typeof e=="string"?e:void 0}var $u=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],qa="NativeGzipValidationError",dr=e=>e.length>=2&&e[0]===31&&e[1]===139,Cn=(e,t)=>e===rr.GZipJS||t===rr.GZipJS||t==="gzip",Tn=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",Jt,Ai=e=>{throw Fa(qa,`Native gzip produced invalid output: ${e}`)},Eu=(In=Q(function*(e,t){18>e.size&&Ai("too-short");const i=new Uint8Array(yield e.slice(0,10).arrayBuffer());dr(i)&&i[2]===8||Ai("invalid-header");const s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(n=>{const o=(()=>{if(Jt)return Jt;Jt=[];for(let l=0;256>l;l++){let c=l;for(let u=0;8>u;u++)c=1&c?3988292384^c>>>1:c>>>1;Jt[l]=c>>>0}return Jt})();let a=4294967295;for(let l=0;n.length>l;l++)a=o[255&(a^n[l])]^a>>>8;return(4294967295^a)>>>0})(t)&&Ai("invalid-crc");const r=t.length>>>0;s.getUint32(4,!0)!==r&&Ai("invalid-size")}),function(e,t){return In.apply(this,arguments)}),In;function hr(){return hr=Q(function*(e,t=!0,i){try{const r=new TextEncoder().encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch((s=Q(function*(u){try{yield o.abort(u)}catch{}throw u}),function(u){return s.apply(this,arguments)})),l=new Response(n.readable).blob(),[c]=yield Promise.all([l,a]);return yield Eu(c,r),c}catch(r){if(i?.rethrow)throw r;return t&&console.error("Failed to gzip compress data",r),null}var s}),hr.apply(this,arguments)}function Ua(e,t){if(e==null)return{};var i,s,r=(function(o,a){if(o==null)return{};var l={};for(var c in o)if({}.hasOwnProperty.call(o,c)){if(a.includes(c))continue;l[c]=o[c]}return l})(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;n.length>s;s++)t.includes(i=n[s])||{}.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}var ge="[redacted]",ku=/^[A-Za-z0-9+/\n\r]+=*$/,Su=/^[A-Za-z0-9_-]+={0,2}$/,Pu=/[-_]/,Au=/^data:[^,\s]*;base64,/i,Ou=/^[A-Za-z0-9+/_-]+={0,2}$/,Cu=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Tu=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,Ha=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,Iu=/[\s<>"]/,Ba=new RegExp(Ha.source,"i"),za=/[a-z][a-z0-9+.-]{0,63}:\/\//i,Fu=new RegExp(`^${za.source}`,"i"),Ru=new RegExp(za.source,"gi"),Mu=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,Lu=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,Du=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,Nu=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,ju=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,qu=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,Uu=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Hu=/\b\d(?:[ ./-]?\d){12,}\b/g,Fn=/\d+/g,Bu=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,zu=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function vr(e){return(function(t){return Tu.test(t)})(e)||Mu.test(e)||Lu.test(e)}function Ss(e){return e.split("&",129).length>128}function Vu(e,t,i){return vr(e)||t.includes(";")&&(function(s){return s.split(";").some(r=>vr(r.split("=",1)[0]))})(t)?ge:Ba.test(t)?i?Hr(t,{allowNestedUrls:!1,stripPunctuation:!0}):ge:t}function Va(e,t){const i=new URLSearchParams;let s=!1,r=!1;for(const[n,o]of new URLSearchParams(e)){const a=Zi(n),l=Zi(o);s||(s=a!==n||l!==o);const c=Vu(a,l,t);s||(s=c!==l),r=vr(a)||c!==l,i.append(a,c)}return{changed:s,lastFieldSensitive:r,serialized:i.toString()}}function Rn(e,t){if(!e.includes("="))return{value:Wu(e,t),lastFieldSensitive:!1};const i=Va(e,t);return{value:i.changed?i.serialized:e,lastFieldSensitive:i.lastFieldSensitive}}function Wu(e,t){return t?Hr(e,{allowNestedUrls:!1,stripPunctuation:!0}):Ba.test(e)?ge:e}function Gu(e,t,i){return e==="#"?!t.fragment&&(t.fragment=!0):e==="?"&&(t.fragment?i!=="="&&!t.fragmentQuery&&(t.fragmentQuery=!0):!t.query&&(t.query=!0))}function Ps(e,t){var i;if(e.length>8192&&Fu.test(e))return ge;const{address:s,suffix:r}=t.stripPunctuation?(function(g){let y=g.length;for(;y>0&&".,;:!?)]}'".includes(g[y-1]);)y--;return{address:g.slice(0,y),suffix:g.slice(y)}})(e):{address:e,suffix:""};let n;try{n=new URL(s)}catch{return ge+r}const o=n.search.slice(1),a=n.hash!=="",l=(function(g){const y=g.slice(1),_=y.indexOf("?");return 0>_?{head:y,tail:null}:{head:y.slice(0,_),tail:y.slice(_+1)}})(n.hash);if(Ss(o)||Ss(l.head)||Ss((i=l.tail)!==null&&i!==void 0?i:""))return ge+r;let c=!1;(n.username||n.password)&&(n.username=ge,n.password="",c=!0);const u=Va(o,t.allowNestedUrls);u.changed&&(n.search=u.serialized,c=!0);const h=Rn(l.head,t.allowNestedUrls),d=l.tail===null?null:(v=l.tail,h.lastFieldSensitive?{value:v===""?"":ge,lastFieldSensitive:!0}:Rn(v,t.allowNestedUrls));var v;const f=d===null?h.value:`${h.value}?${d.value}`;f!==n.hash.slice(1)&&(n.hash=f,c=!0);const m=a?d??h:u;return(c?Zi(n.toString()):s)+(m.lastFieldSensitive?"":r)}function Hr(e,t){return e.replace(Ha,i=>(function(s,r){const n=(function(l){if(!l.includes("://"))return[];const c=[...l.matchAll(Ru)].map(m=>m.index),u=[],h={query:!1,fragment:!1,fragmentQuery:!1};let d=0,v=!1,f="";for(let m=0;l.length>m&&c.length>d;m++){c[d]===m&&(m>0&&f!=="="&&u.push(m),d++);const g=l[m];Gu(g,h,f)?(f=g,v=!0):v&&"=&".includes(g)&&(f=g)}return u})(s);if(n.length===0)return Ps(s,r);let o="",a=0;for(const l of n)o+=Ps(s.slice(a,l),p(p({},r),{},{stripPunctuation:!1})),a=l;return o+Ps(s.slice(a),r)})(i,p(p({},t),{},{stripPunctuation:t.stripPunctuation&&i.length!==e.length})))}function Zi(e){return e.replace(Cu,ge)}function Wa(e,t){return(function(i){return i.length>=10240&&(ku.test(i)||(function(s){const r=Au.exec(s);if(!r)return!1;let n;try{n=decodeURIComponent(s.slice(r[0].length))}catch{return!1}return Ou.test(n.replace(/[\r\n]/g,""))})(i)||Pu.test(i)&&Su.test(i))})(e)?"[binary data redacted - not supported by PostHog MCP analytics]":(function(i,s,r){const n=4*r.maxStringLength;if(i.length>n){const o=s(i.slice(0,(function(a,l){let c=l;for(;c>0&&!Iu.test(a[c-1]);)c--;return c})(i,n)));if(o.length>=2*r.maxStringLength)return o+r.truncationSuffix}return s(i)})(e,i=>(function(s){return Hr(s,{allowNestedUrls:!0,stripPunctuation:!0})})((function(s){let r=s.replace(Du," ");return r=r.replace(Nu,ge),r=r.replace(ju,ge),r=r.replace(qu,`$1${ge}`),r=r.replace(Hu,Yu),r=r.replace(Uu,ge),r=r.replace(Bu,`$1${ge}`),r=r.replace(zu,`$1${ge}`),r})(Zi(i))),t)}function Ju(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let r=e.charCodeAt(s)-48;if(0>r||r>9)return!1;i&&(r*=2,r>9&&(r-=9)),t+=r,i=!i}return t%10==0}function Yu(e){const t=[];for(let n=Fn.exec(e);n!==null;n=Fn.exec(e))t.push({digits:n[0],start:n.index,end:n.index+n[0].length});let i="",s=0,r=0;for(;t.length>r;){let n="",o=-1;for(let a=r;t.length>a&&(n+=t[a].digits,19>=n.length);a++)n.length>=13&&Ju(n)&&(o=a);0>o?r++:(i+=e.slice(s,t[r].start)+ge,s=t[o].end,r=o+1)}return i+e.slice(s)}var Ku={}.propertyIsEnumerable;function es(e,t){try{return Ga(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Br(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:cr};if(i.remainingNodes--,be(e))return{boolValue:e};if(typeof e=="bigint")return(function(r,n){const o=r.toString(),a=BigInt("9223372036854775808");return r>=a||-a>r?(n?.debug(`Attribute ${o} is outside the int64 range; encoding it as a string`),{stringValue:o}):{intValue:o}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const r=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t?.debug(`Attribute ${r} is outside the int64 range; encoding it as a string`),{stringValue:r}):{intValue:r}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:Rt(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:cr};if(e instanceof Date){const r=e.getTime(),n=Number.isFinite(r)?e.toISOString():String(e);return{stringValue:typeof n=="string"?Rt(n):String(n)}}i.ancestors.add(e);try{try{const r=e.toJSON;if(typeof r=="function")return Br(r.call(e),t,i,s+1)}catch{}return I(e)?{arrayValue:{values:Xu(e,t,i,s+1)}}:{kvlistValue:{values:Ga(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:Rt(String(e))}}function Xu(e,t,i,s){const r=[],n=Math.min(e.length,1e3);let o=0;for(;n>o&&i.remainingNodes>0;o++)try{const a=o in e?e[o]:void 0;if(L(a))continue;r.push(Br(a,t,i,s))}catch{r.push({stringValue:ki})}return e.length>o&&r.push({stringValue:cr}),r}function Ga(e,t,i,s){const r=[];for(const n in e)if(Ku.call(e,n)){if(!n){t?.debug("Dropping an attribute with an empty key");continue}if(r.length>=1e3||0>=i.remainingNodes){t?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[n];if(se(o)||x(o))continue;r.push({key:Rt(n),value:Br(o,t,i,s)})}catch{r.push({key:Rt(n),value:{stringValue:ki}})}}return r}function Ja(e,t,i){return p(p(p(p({},Ta({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}var Qu=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Ya(e,t){const i=Ta({},e),s={};for(const r of Qu)({}).hasOwnProperty.call(i,r)&&(s[r]=i[r],delete i[r]);return[...es(i,t),...es(s,t)]}var Mn={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},Ka={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}},Zu=Ka.info;function ed(e){try{return Rt(String(e))}catch{return ki}}function td(e,t,i,s){const r=e.level||"info",{text:n,number:o}=Ka[r]||Zu,a=(function(d=Date.now()){return String(d)+"000000"})(oe(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),L(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),L(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);const c=p({},l),u=e.attributes;if(u){let d=[];try{d=Object.keys(u)}catch{d=[]}for(const v of d){let f;try{f=u[v]}catch{f=ki}Object.defineProperty(c,v,{value:f,enumerable:!0,writable:!0,configurable:!0})}}const h={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:ed(e.body)},attributes:es(c,i)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),x(e.trace_flags)||(h.flags=e.trace_flags),h}function Xa(e,t,i){return Ja(e,t,i)}function Qa(e,t,i,s){return{resourceLogs:[{resource:{attributes:Ya(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var Za=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.cs}arm(e){this.clear(),this.us=Date.now()+e,this.cs=Ra(()=>{this.cs=void 0,this.ls()},e)}armNoEarlierThan(e){this.cs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function el(){return .75+.5*Math.random()}function tl(e,t,i,s){const r=Math.min(Math.max(0,t-1),6),n=e*Math.pow(2,r);return Math.round((s===void 0?n:Math.min(n,Math.max(s,e)))*i)}var id=class{constructor(e,t,i,s,r,n=()=>Promise.resolve(),o){var a;this._instance=e,this.Ar=t,this.$=i,this.hs=s,this.ds=r,this.vs=n,this.fs=o,this.ps=new Za(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Ia,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((a=t.maxQueueSize)!==null&&a!==void 0?a:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(je.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Ar.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var i;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const s=this.Os(e);if(s===null)return;if(!s.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:td(s,(i=t?.context)!==null&&i!==void 0?i:this.hs(),this.$,t?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const t=this.Ar.beforeSend;if(!t)return e;const i=I(t)?t:[t];let s=e;for(const r of i)try{const n=r(s);if(!n)return this.$.info("Log was rejected in beforeSend function"),null;s=n}catch(n){return this.$.error("Error in beforeSend function for log:",n),null}return s}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=!0),!1)}flush(){var e=this;return Q(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Q(function*(){var t;e.ps.clear();let i=(t=e._instance.getPersistedProperty(je.LogsQueue))!==null&&t!==void 0?t:[];if(i.length===0)return;const s=i.length;let r=0;for(;i.length>0&&s>r;){var n,o;const a=e._s;e.bs=0;const l=Math.min(i.length,e.Es),c=i.slice(0,l),u=Qa(c.map(d=>d.record),e.qs(),(n=e.fs)!==null&&n!==void 0?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()),h=yield e._instance.js(u);if(e._s!==a)return;if(h.kind==="too-large"&&c.length>1)e.Es=Math.max(1,Math.floor(c.length/2)),e.$.warn(`Logs batch of size ${c.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(h),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),h.kind==="retry-later"||(h.kind==="too-large"?e.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):h.kind==="ok"&&e.Ar.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Ar.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(c.length),i=(o=e._instance.getPersistedProperty(je.LogsQueue))!==null&&o!==void 0?o:[],r+=c.length,h.kind==="fatal"))throw h.error}})()}Bs(e){var t=this;return Q(function*(){var i;const s=Math.max(0,e-t.bs),r=(i=t._instance.getPersistedProperty(je.LogsQueue))!==null&&i!==void 0?i:[];t._instance.setPersistedProperty(je.LogsQueue,r.slice(s)),yield t.vs()})()}qs(){return Xa(this.Ar,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const i=(t=this._instance.getPersistedProperty(je.LogsQueue))!==null&&t!==void 0?t:[];this.Is>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(je.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(tl(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(je.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Q(function*(){t.ps.clear();const i=t.flush().catch(()=>{});e!==void 0?yield wn(i,e):yield i})()}flushWithTimeout(e){var t=this;return Q(function*(){const i=t.flush();yield wn(i,e,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=el(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}},sd=/^[0-9a-f]+$/;function Ln(e,t,i){return typeof e=="string"&&e.length===t&&e!==i&&sd.test(e)}var rd=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/,nd="00",As=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function pr(e){return String(e)+"000000"}function Dn(e,t,i,s){let r="";return s&&(r=Object.keys(s).sort().map(n=>`${JSON.stringify(n)}:${JSON.stringify(s[n])}`).join(",")),`${e}\0${t}\0${i??""}\0${r}`}var od=class{constructor(e,t,i){this._instance=e,this.Ar=t,this.$=i,this.Hs=new Map,this.ps=new Za(()=>this.flush().catch(s=>{this.$.error("Metrics flush failed:",s)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Ia,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,i){this.Qs({name:e,type:"count",value:t,unit:i?.unit,attributes:i?.attributes})}gauge(e,t,i){this.Qs({name:e,type:"gauge",value:t,unit:i?.unit,attributes:i?.attributes})}histogram(e,t,i){this.Qs({name:e,type:"histogram",value:t,unit:i?.unit,attributes:i?.attributes})}flush(){var e=this;const t=this.ys,i=(function(){var s=Q(function*(){t&&(yield t.catch(()=>{})),yield e.Zs()});return function(){return s.apply(this,arguments)}})()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(this.Hs.size===0)return null;const e=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.$.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.$.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?p({},t.attributes):void 0,s=Dn(t.type,t.name,t.unit,i)}catch(a){this.$.warn(`Dropping metric '${t.name}': attributes could not be serialized`,a);return}let r=this.Hs.get(s);if(!r){if(!this.Ks())return;r={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this.Hs.set(s,r)}const n=this.Ws.get(t.name);n===void 0?this.Ws.set(t.name,t.type):n===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${n}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,t.value);const o=this.Ys();o&&(r.exemplar=p(p({},o),{},{value:t.value,timeMs:Date.now()})),this.Fs()}Ys(){try{var e,t;const i=(function(s){const r=(function(o){if(typeof o!="string")return;const a=rd.exec(o.trim());if(!a)return;const[,l,c,u,h,d]=a;return l==="ff"||l==="00"&&d||!(function(v){return Ln(v,32,"00000000000000000000000000000000")})(c)||!(function(v){return Ln(v,16,"0000000000000000")})(u)?void 0:{version:l,traceId:c,spanId:u,flags:h}})(s);return r&&{traceId:r.traceId,spanId:r.spanId,flags:(n=r.flags,1&parseInt(n,16)?"01":nd)};var n})((e=(t=this._instance).getActiveSpan)===null||e===void 0||(e=e.call(t))===null||e===void 0?void 0:e.traceparent());if(i&&i.flags==="01")return{traceId:i.traceId,spanId:i.spanId}}catch{}}Ks(){return this.Ar.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Ar.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case"count":var i;e.total=((i=e.total)!==null&&i!==void 0?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(As.length+1).fill(0)});const s=e.hist;s.count+=1,s.sum+=t,s.min=Math.min(s.min,t),s.max=Math.max(s.max,t),s.bucketCounts[(function(r,n){for(let o=0;n.length>o;o++)if(n[o]>=r)return o;return n.length})(t,As)]+=1;break}}}Os(e){const t=this.Ar.beforeSend;if(!t)return e;const i=I(t)?t:[t];let s=e;for(const r of i)try{const n=r(s);if(!n)return this.$.info("Metric was rejected in beforeSend function"),null;s=n}catch(n){return this.$.error("Error in beforeSend function for metric:",n),null}return s}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(tl(this.Ar.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var e=this;return Q(function*(){if(e.ps.clear(),e.Hs.size===0)return;const t=e.Hs;e.Hs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const i=e.Gs,s=yield e._instance.po(e.Js(t));if(i===e.Gs)switch(e.ws.record(s),s.kind==="retry-later"?(e.ks++,e.Ss=el()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.zs()),s.kind){case"ok":return;case"retry-later":e.mo(t),e.ps.armNoEarlierThan(e.zs());return;case"too-large":e.$.warn("Metrics batch exceeded the server size limit and was dropped");return;case"fatal":e.$.error("Failed to send metrics batch:",s.error);return}})()}Js(e){return t=this.yo(e),i=(function(n,o,a){return Ja(n,o,a)})(this.Ar,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Ya(i)},scopeMetrics:[{scope:{name:s,version:r},metrics:t}]}]};var t,i,s,r}yo(e){const t=pr(Date.now()),i=new Map;for(const o of e.values()){var s;const a=Dn(o.type,o.name,o.unit,void 0);let l=i.get(a);l||(l=p({name:o.name},o.unit&&{unit:o.unit}),o.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:o.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},i.set(a,l));const c=es((s=o.attributes)!==null&&s!==void 0?s:{},this.$),u=pr(o.windowStartMs),h=ad(o.exemplar);if(o.type==="count"){var r;const d=p({attributes:c,startTimeUnixNano:u,timeUnixNano:t,asDouble:(r=o.total)!==null&&r!==void 0?r:0},h);l.sum.dataPoints.push(d)}else if(o.type==="gauge"){var n;const d=p({attributes:c,timeUnixNano:t,asDouble:(n=o.last)!==null&&n!==void 0?n:0},h);l.gauge.dataPoints.push(d)}else if(o.hist){const d=p({attributes:c,startTimeUnixNano:u,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:As},h);l.histogram.dataPoints.push(d)}}return Array.from(i.values())}mo(e){for(const[r,n]of e){var t;const o=this.Hs.get(r);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.exemplar=(t=o.exemplar)!==null&&t!==void 0?t:n.exemplar,o.type){case"count":var i,s;o.total=((i=o.total)!==null&&i!==void 0?i:0)+((s=n.total)!==null&&s!==void 0?s:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(let a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.Ks()&&this.Hs.set(r,n)}}};function ad(e){return e?{exemplars:[{filteredAttributes:[],timeUnixNano:pr(e.timeMs),asDouble:e.value,traceId:e.traceId,spanId:e.spanId}]}:{}}var il=(e,{debugEnabled:t}={})=>{const i={N(s,...r){let n;try{n=typeof window>"u"?void 0:window}catch{return}n&&(Je.DEBUG||n.POSTHOG_DEBUG||t)&&!x(n.console)&&n.console&&("__rrweb_original__"in n.console[s]?n.console[s].__rrweb_original__:n.console[s])(e,...r)},debug(...s){i.N("debug",...s)},info(...s){i.N("log",...s)},warn(...s){i.N("warn",...s)},error(...s){i.N("error",...s)},critical(...s){console.error(e,...s)},uninitializedWarning(s){i.error(`You must initialize PostHog before calling ${s}`)},createLogger:(s,r)=>il(`${e} ${s}`,r)};return i},S=il("[PostHog.js]"),te=S.createLogger,ld=te("[ExternalScriptsLoader]"),ts=e=>{const t=O?.querySelectorAll("script");if(t){for(let i=0;t.length>i;i++)if(t[i].src===e||t[i].getAttribute("src")===e)return t[i]}},pt=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return ld.warn(`${t} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=ts(t);if(s){if(s.__posthog_loading_callback_fired)return i();const n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",o=>{s.__posthog_loading_callback_fired=!0,i(void 0,o)}),void s.addEventListener("error",o=>{s.__posthog_loading_error=o,i(o)}))}const r=()=>{if(!O)return i("document not found");if(ts(t))return pt(e,t,i);let n=O.createElement("script");if(n.type="text/javascript",n.crossOrigin="anonymous",n.src=t,n.onload=a=>{n.__posthog_loading_callback_fired=!0,i(void 0,a)},n.onerror=a=>{n.__posthog_loading_error=a,i(a)},e.config.prepare_external_dependency_script&&(n=e.config.prepare_external_dependency_script(n)),!n)return i("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")O.head.appendChild(n);else{const a=O.querySelectorAll("body > script");var o;a.length>0?(o=a[0].parentNode)===null||o===void 0||o.insertBefore(n,a[0]):O.body.appendChild(n)}};O?.body?r():O?.addEventListener("DOMContentLoaded",r)},Os={},Nn=(e,t)=>{let i=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(i=`${i}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",i)};R.__PosthogExtensions__=R.__PosthogExtensions__||{},R.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if(t==="remote-config"){const r=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);pt(e,r,i);return}const s=e.config.strict_script_versioning;if(s){const r=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),n=Os[r];if(s==="fallback"&&n){if(ts(n))return void pt(e,n,i);delete Os[r]}pt(e,r,s==="fallback"?(o,a)=>{if(o)if(typeof o=="string")i(o);else{var l;const c=Nn(e,t);Os[r]=c;const u=ts(r);u==null||(l=u.parentNode)===null||l===void 0||l.removeChild(u),pt(e,c,i)}else i(void 0,a)}:i);return}pt(e,Nn(e,t),i)},R.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{const s=e.requestRouter.endpointFor("api",t);pt(e,s,i)},Je.DEBUG=!1,Je.LIB_VERSION="1.444.0",Je.LIB_NAME="web";var $e=Je,fr="$early_access_features",Ve="$active_feature_flags",_t="$feature_flag_details",wi="$feature_flag_errors",ot="$feature_flag_evaluated_at",mt="$feature_flag_request_id",ci="$minimal_flag_called_events",Re="$enabled_feature_flags",st="$stored_group_properties",rt="$stored_person_properties",We="$flag_call_reported",si="$flag_call_reported_session_id",nt="$feature_flag_payloads",Ne="$override_feature_flags",ft="$override_feature_flag_payloads",Mt="visibilitychange",sl="$autocapture_disabled_server_side",ri="$surveys",is="$surveys_loaded_at",zr="PostHog loadExternalDependency extension not found.",gr="$surveys_activated",qi="$surveys_activated_session",Ui="$surveys_activated_timestamps",cd="$people_distinct_id",Te="distinct_id",Vr="$device_id",Cs="$device_model",ss="__alias",ud="__cmpns",jn="$fbc",Lt="$fbc_persistence",qn="$fbp",ui="$fbp_persistence",_r="__timers",mr="$heatmaps_enabled_server_side",yr="$exception_capture_enabled_server_side",rl="$error_tracking_suppression_rules",br="$error_tracking_capture_extension_exceptions",wr="$web_vitals_enabled_server_side",Wr="$dead_clicks_enabled_server_side",Gr="$product_tours_enabled_server_side",nl="$logs_capture_enabled_server_side",ol="$web_vitals_allowed_metrics",di="$session_recording_remote_config",dd="$session_recording_enabled_server_side",hd="$replay_sample_rate",vd="$replay_override_sampling",pd="$replay_override_linked_flag",fd="$replay_override_url_trigger",gd="$replay_override_event_trigger",Ct="$sesid",al="$session_is_sampled",_d="$session_past_minimum_duration",md="$session_recording_url_trigger_activated_session",yd="$session_recording_event_trigger_activated_session",bd="$debug_first_full_snapshot_timestamp",wd="$sess_rec_flush_size",ll="$groups",xr="ph_product_tours",xd="$product_tours_activated",$d="$product_tours_activated_session",Ed="$conversations_widget_session_id",kd="$conversations_ticket_id",Sd="$conversations_widget_state",Pd="$conversations_user_traits",fe="$user_state",$r="$client_session_props",Ad="$capture_rate_limit",cl="$initial_campaign_params",ul="$initial_referrer_info",Tt="$initial_person_info",Jr="$epp",Ts="$posthog_cookieless",dl="$cookieless_mode",hl="$sdk_debug_extensions_init_method",vl="$sdk_debug_extensions_init_time_ms",Yr="$sdk_debug_recording_script_not_loaded",Kr="$sdk_debug_replay_stale_config",pl="$sdk_debug_replay_event_trigger_status",fl="$sdk_debug_replay_linked_flag_trigger_status",gl="$sdk_debug_replay_matched_recording_trigger_groups",_l="$sdk_debug_replay_pending_trigger_conditions",ml="$sdk_debug_replay_remote_trigger_matching_config",yl="$sdk_debug_replay_trigger_groups_count",bl="$sdk_debug_replay_url_trigger_status",Od="$session_recording_start_reason",Ge="anonymous",Hi="identified",wl="identified_only",rs="beforeunload",Xr="$pageview",Un="$pageleave",xl="$identify",Hn="$groupidentify";function It(e,t){I(e)&&e.forEach(t)}function J(e,t){if(!L(e))if(I(e))e.forEach(t);else if((i=>i instanceof FormData)(e))e.forEach((i,s)=>t(i,s));else for(const i in e)Nr.call(e,i)&&t(e[i],i)}var ee=function(e,...t){for(const i of t)for(const s in i)i[s]!==void 0&&(e[s]=i[s]);return e};function Bi(e){const t=Object.keys(e);let i=t.length;const s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}var Cd=function(e){return function(...t){try{return e.apply(this,t)}catch(i){S.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),S.critical(i)}}},Qr=function(e){const t={};return J(e,function(i,s){(N(i)&&i.length>0||oe(i))&&(t[s]=i)}),t};function $l(e){const t=p({},e);for(const i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch{}return t}var Td=["herokuapp.com","vercel.app","netlify.app"];function Id(e){const t=e?.hostname;if(!N(t))return!1;const i=t.split(".").slice(-2).join(".");for(const s of Td)if(i===s)return!1;return!0}function z(e,t,i,s){const{capture:r=!1,passive:n=!0}=s??{};e?.addEventListener(t,i,{capture:r,passive:n})}function Er(e){return e.name==="ph_toolbar_internal"}var hi=e=>{if(O){try{const t=e+"=",i=O.cookie.split(";").filter(s=>s.length);for(let s=0;i.length>s;s++){let r=i[s];for(;r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}},Fd=class kr{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(r)||0>t||0>i||0>s||0>r||t>0xffffffffffff||i>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");const 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/256,n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new kr(n)}toString(){let t="";for(let 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 kr(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let i=0;16>i;i++){const s=this.bytes[i]-t.bytes[i];if(s!==0)return Math.sign(s)}return 0}},Rd=class{generate(){const e=this.generateOrAbort();if(!x(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(x(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return oe(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.It();else{if(this.Ct>=e+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return Fd.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new Md}},Bn=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e},zn,Md=class{nextUint32(){var e;return this.Rt.length>this.$t||(((e=zn)!==null&&e!==void 0?e:zn="u">typeof window&&!x(window.crypto)&&crypto.getRandomValues?t=>{try{return crypto.getRandomValues(t)}catch{return Bn(t)}}:Bn)(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},Vn,Me=()=>Ld().toString(),Ld=()=>(Vn||(Vn=new Rd)).generate(),Yt="",Dd=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,xt=null,Z={Et(){if(!se(xt))return xt;if(xt=!1,O)try{const e=`__ph_cookie_support_${Me()}`;Z.At(e,"xyz"),xt=hi(e)==='"xyz"',Z.Pt(e)}catch{xt=!1}return xt},Ft(e){S.error("cookieStore error: "+e)},Ot:hi,Lt(e){let t;try{t=JSON.parse(Z.Ot(e))||{}}catch{}return t},At(e,t,i,s,r){if(!O)return!1;try{let n="",o="";const a=(function(c,u){if(u){let h=(function(d,v=O){if(Yt)return Yt;if(!v||["localhost","127.0.0.1"].includes(d))return"";const f=d.split(".");let m=Math.min(f.length,8);const g="dmn_chk_"+Me();for(;!Yt&&m--;){const y=f.slice(m).join("."),_=g+"=1;domain=."+y+";path=/";v.cookie=_+";max-age=3",v.cookie.includes(g)&&(v.cookie=_+";max-age=0",Yt=y)}return Yt})(c);if(!h){const d=(v=>{const f=v.match(Dd);return f?f[0]:""})(c);d!==h&&S.info("Warning: cookie subdomain discovery mismatch",d,h),h=d}return h?"; domain=."+h:""}return""})(O.location.hostname,s);if(i){const c=new Date;c.setTime(c.getTime()+864e5*i),n="; expires="+c.toUTCString()}r&&(o="; secure");const l=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&S.warn("cookieStore warning: large cookie, len="+l.length),O.cookie=l,!0}catch{return!1}},Pt(e,t){if(O?.cookie&&(!t||!se(hi(e))))try{Z.At(e,"",-1,t)}catch{return}}},Is=null,H={Et(){if(!se(Is))return Is;let e=!0;if(x(w))e=!1;else try{const t="__mplssupport__";H.At(t,"xyz"),H.Ot(t)!=='"xyz"'&&(e=!1),H.Pt(t)}catch{e=!1}return e||S.error("localStorage unsupported; falling back to cookie store"),Is=e,e},Ft(e){S.error("localStorage error: "+e)},Ot(e){try{return w?.localStorage.getItem(e)}catch(t){H.Ft(t)}return null},Lt(e){try{return JSON.parse(H.Ot(e))||{}}catch{}return null},At(e,t){try{return w?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(i){H.Ft(i)}return!1},Pt(e){try{w?.localStorage.removeItem(e)}catch(t){H.Ft(t)}}},Fs=[rt,Ve,Re,_t,nt,mt,ot,wi,We],gt=[Vr,Te,Ct,al,Jr,Tt,Lt,fe],vi=e=>e+"_cpm",Nd=["__proto__","constructor","prototype"],Rs=e=>{if(!D(e))return{};const t={};return Object.keys(e).forEach(i=>{Nd.indexOf(i)===-1&&(t[i]=e[i])}),t},Ms=(e,t=[])=>{const i={};return[...gt,...t].forEach(s=>{const r=e[s];x(r)||se(r)||r===""||(i[s]=r)}),i},El=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){const r=e.charCodeAt(s);t=33*t^r,i=Math.imul(i^r,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},Wn=(e,t)=>({p:t,f:El(JSON.stringify(e))}),Gn=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const i=Z.Lt(vi(e)),s=i?.f===El(t)&&I(i.p);return{properties:s?i.p:[],isValid:s}}catch{return{properties:[],isValid:!1}}},Ls=(e,t)=>t+"|"+(Z.Ot(vi(e))||""),$t={},Sr={Et:()=>!0,Ft(e){S.error("memoryStorage error: "+e)},Ot:e=>e in $t?$t[e]:null,Lt:e=>e in $t?$t[e]:null,At:(e,t)=>($t[e]=t,!0),Pt(e){delete $t[e]}},ut=null,X={Et(){if(!se(ut))return ut;if(ut=!0,x(w))ut=!1;else try{const e="__support__";X.At(e,"xyz"),X.Ot(e)!=='"xyz"'&&(ut=!1),X.Pt(e)}catch{ut=!1}return ut},Ft(e){S.error("sessionStorage error: ",e)},Ot(e){try{return w?.sessionStorage.getItem(e)}catch(t){X.Ft(t)}return null},Lt(e){try{return JSON.parse(X.Ot(e))||null}catch{}return null},At(e,t){try{return w?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(i){X.Ft(i)}return!1},Pt(e){try{w?.sessionStorage.removeItem(e)}catch(t){X.Ft(t)}}},jd=class{constructor(e){this._instance=e}get Ar(){return this._instance.config}get consent(){return this.Sl()?0:this.xl}isOptedOut(){return this.Ar.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Ar.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ar.opt_out_capturing_by_default}optInOut(e){this.$l.At(this.Cl,e?1:0,this.Ar.cookie_expiration,this.Ar.cross_subdomain_cookie,this.Ar.secure_cookie)}reset(){this.$l.Pt(this.Cl,this.Ar.cross_subdomain_cookie)}get Cl(){const{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 xl(){const e=this.$l.Ot(this.Cl);return ys(e)?1:T(Mc,e)?0:-1}get $l(){const e=this.Ar.opt_out_capturing_persistence_type,t=e==="localStorage"?H:Z,i=t.Et()?t:Sr;if(!this.Tl||this.Tl!==i){this.Tl=i;const s=e==="localStorage"?Z:H;s.Ot(this.Cl)&&(this.Tl.Ot(this.Cl)||this.optInOut(ys(s.Ot(this.Cl))),s.Pt(this.Cl,this.Ar.cross_subdomain_cookie))}return this.Tl}Sl(){return!!this.Ar.respect_dnt&&[ve?.doNotTrack,ve?.msDoNotTrack,R.doNotTrack,ve?.globalPrivacyControl].some(e=>ys(e))}};function kl(e,t){var i;const s=e==null||(i=e.config)===null||i===void 0?void 0:i.get_current_url;if(!ne(s))return t;try{const r=s(t);return N(r)&&r?r:t}catch(r){return S.error("Error in get_current_url, falling back to window.location.href",r),t}}function Jn(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function Ie(e){return!!e&&e.nodeType===1}function ae(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Sl(e){return!!e&&e.nodeType===3}function ns(e){return!!e&&e.nodeType===11&&Ie(e.host)}function Zr(e){return e?Nt(e).split(/\s+/):[]}function Yn(e,t){const i=(function(s){var r;const n=typeof window>"u"?void 0:window,o=n==null||(r=n.location)===null||r===void 0?void 0:r.href;return x(o)?void 0:kl(s,o)})(t);return!!(i&&e&&e.some(s=>i.match(s)))}function yt(e){let 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 Zr(t)}function Pl(e){return L(e)?null:Nt(e).split(/(\s+)/).filter(t=>Dt(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function xi(e){let t="";return at(e)&&!qt(e)&&e.childNodes&&e.childNodes.length&&J(e.childNodes,function(i){var s;Sl(i)&&i.textContent&&(t+=(s=Pl(i.textContent))!==null&&s!==void 0?s:"")}),Nt(t)}function pi(e){var t;return x(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var en=["a","button","form","input","select","textarea","label"];function ni(e,t){const i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch{return!1}}function Pr(e,t){if(x(t))return!0;for(const i of e)if(t.some(s=>ni(i,s)))return!0;return!1}function Al(e){const t=e.parentNode;return!(!t||!Ie(t))&&t}var Oi=[".ph-no-autocapture","[data-ph-no-autocapture]"],Ol=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],tn=[...Ol,"+","-","−","–"],Kn=tn.length+10,qd=["button","a","input","select","textarea","label"],Ud=["button","link","tab","menuitem","option"],Xn=(e,t)=>/[a-z0-9]/i.test(t)?T(tn,t)?new RegExp(`\\b${t}\\b`).test(e):e.includes(t):e===t,Hd=e=>T(qd,e.tagName.toLowerCase())||T(Ud,(e.getAttribute("role")||"").toLowerCase());function Ds(e){let t="",i="";const s=o=>{Ie(o)&&at(o)&&!qt(o)&&(t+=` ${xi(o)}`,i=i||o.getAttribute("aria-label")||"",J(o.childNodes,s))};s(e),t=Nt(t.replace(/\s+/g," "));const r=(Dt(t)?t:"").toLowerCase(),n=e.getAttribute("aria-label")||(r?"":i);return{safeText:r,ariaLabel:Nt(n).toLowerCase()}}var Qn=[".ph-no-rageclick",".ph-no-capture"],Bd=["","text","search","email","password","url","tel","number"];function Cl(e,t){if(!(!(typeof window>"u")&&window)||sn(e))return!1;let i,s,r;var n,o;if(be(t)?(i=!!t&&Qn,s=void 0,r=!1):(i=(n=t?.css_selector_ignorelist)!==null&&n!==void 0?n:Qn,s=t?.content_ignorelist,r=(o=t?.ignore_text_selection)!==null&&o!==void 0&&o),i===!1||r&&(function(l){return!(!l||!Ie(l))&&(!!ae(l,"textarea")||(ae(l,"input")?T(Bd,(l.getAttribute("type")||"").toLowerCase()):(function(c){var u;if(c.isContentEditable)return!0;const h=(u=c.getAttribute)===null||u===void 0?void 0:u.call(c,"contenteditable");return h==="true"||h===""})(l)))})(e))return!1;const{targetElementList:a}=Tl(e,!1);return!(s&&(function(l,{safeText:c,ariaLabel:u}){let h;if(l===!0)h=Ol;else{if(!I(l))return!1;if(l.length>Kn)return S.error(`[PostHog] content_ignorelist array cannot exceed ${Kn} items. Use css_selector_ignorelist for more complex matching.`),!1;h=l.map(d=>d.toLowerCase())}return h.some(d=>Xn(c,d)||Xn(u,d))})(s,(function(l,c){for(const h of c)if(Hd(h))return Ds(h);for(const h of c){try{var u;if(((u=window)===null||u===void 0?void 0:u.getComputedStyle(h).getPropertyValue("cursor"))!=="pointer")break}catch{break}const d=Ds(h);if(d.safeText||d.ariaLabel)return d}return Ds(l)})(e,a))||Pr(a,i))}var sn=e=>!e||ae(e,"html")||!Ie(e),Tl=(e,t)=>{const i=typeof window>"u"?void 0:window;if(!i||sn(e))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const r=[e];let n=e;for(;n.parentNode&&!ae(n,"body");){if(ns(n.parentNode)){r.push(n.parentNode.host),n=n.parentNode.host;continue}const o=Al(n);if(!o)break;if(t||en.indexOf(o.tagName.toLowerCase())>-1)s=!0;else try{const a=i.getComputedStyle(o);a&&a.getPropertyValue("cursor")==="pointer"&&(s=!0)}catch{}r.push(o),n=o}return{parentIsUsefulElement:s,targetElementList:r}};function at(e){const t=new Set;let i=0;for(let n=e;n.parentNode&&!ae(n,"body");n=n.parentNode){if(i++>=1e3||t.has(n))return!1;t.add(n);const o=yt(n);if(T(o,"ph-sensitive")||T(o,"ph-no-capture"))return!1}if(T(yt(e),"ph-include"))return!0;const s=e.type||"";if(N(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const r=e.name||e.id||"";return!N(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function qt(e){return!!(ae(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ae(e,"select")||ae(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Zn=new RegExp("^(?:(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}))$"),eo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,zd=[16,15,14,13],Vd=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),to=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),io=/[0-9A-Za-z_]/;function Wd(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let r=e.charCodeAt(s)-48;i&&(r*=2,r>9&&(r-=9)),t+=r,i=!i}return t%10==0}function Dt(e,t=!0){return!(L(e)||N(e)&&(e=Nt(e),(t?Zn.test((e||"").replace(/[- ]/g,"")):(function(i){let s;for(eo.lastIndex=0;s=eo.exec(i);){const r=s[2];if(!r)continue;const n=r.replace(/[- ]/g,"");for(let o=0;n.length>o;o++)for(const a of zd){const l=o+a;if(n.length>=l){const c=n.slice(o,l);if(Zn.test(c)&&Wd(c))return!0}}}return!1})(e))||(t?Vd.test(e):(function(i){let s;for(to.lastIndex=0;s=to.exec(i);){const r=s[1],n=s[3];if(!(r&&n&&io.test(r)&&io.test(n)))return!0}return!1})(e))))}function so(e){let t=xi(e);return t=`${t} ${Il(e)}`.trim(),Dt(t)?t:""}function Il(e){let t="";return e&&e.childNodes&&e.childNodes.length&&J(e.childNodes,function(i){var s;if(i&&((s=i.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{const r=xi(i);t=`${t} ${r}`.trim(),i.childNodes&&i.childNodes.length&&(t=`${t} ${Il(i)}`.trim())}catch(r){S.error("[AutoCapture]",r)}}),t}function ro(e){return e.replace(/"|\\"/g,'\\"')}function Gd(e){const t=e.attr__class;if(t)return I(t)?t:Zr(t)}var Ci=te("[Dead Clicks]"),Jd=()=>!0,Yd=e=>{var t;const i=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(Wr)),s=e.instance.config.capture_dead_clicks;return be(s)?s:!!D(s)||i},no=class{get lazyLoadedDeadClicksAutocapture(){return this.Il}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Wr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ml(()=>{this.El()}):this.stop()}Ml(e){var t,i,s;!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this.instance,"dead-clicks-autocapture",r=>{r?Ci.error("failed to load script",r):e()})}El(){var e;if(O){if(!this.Il&&(!((e=R.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=D(this.instance.config.capture_dead_clicks)?p({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Il=R.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Il.start(O),Ci.info("starting...")}}else Ci.error("`document` not found. Cannot start.")}stop(){this.Il&&(this.Il.stop(),this.Il=void 0,Ci.info("stopping..."))}},Kt=te("[SegmentIntegration]");function oo(e,t,i=!0){const s=e.config.segment;if(!s)return t();const{analytics:r,filterProperties:n}=(a=>ne(a.register))(o=s)?{analytics:o}:o;var o;(function(a,l,c,u){const h=v=>{const f=()=>v.anonymousId()||Me();a.config.get_device_id=f,u&&v.id()&&(a.register({distinct_id:v.id(),$device_id:f()}),a.persistence.set_property(fe,Hi)),c(u?void 0:v.anonymousId()||void 0)},d=l.user();"then"in d&&ne(d.then)?d.then(h):h(d)})(e,r,a=>{r.register(((l,c,{filterProperties:u}={})=>{typeof Promise<"u"&&Promise.resolve||Kt.warn("This browser does not have Promise support, and can not use the segment integration");const h=(d,v)=>{if(!v)return d;const f=!!c&&d.event.anonymousId===c&&!d.event.userId;f||d.event.userId||d.event.anonymousId===l.get_distinct_id()||(Kt.info("No userId set, resetting PostHog"),l.reset()),f||(c=void 0),d.event.userId&&d.event.userId!==l.get_distinct_id()&&(Kt.info("UserId set, identifying with PostHog"),l.identify(d.event.userId));let m=l.calculateEventProperties(v,d.event.properties);if(!L(u)){const g=d.event.properties||{},y={};for(const b of Object.keys(m))Nr.call(g,b)||(y[b]=m[b]);const _=((b,E)=>{const k=I(b)?b:[b];let $=p({},E);for(const A of k)try{if($=A($),L($))return null}catch(P){return Kt.error("Error in Segment filterProperties:",P),null}return $})(u,y);if(L(_))return d;m=_}return d.event.properties=Object.assign({},m,d.event.properties),d};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(d){return h(d,d.event.event)},page(d){return h(d,Xr)},identify(d){return h(d,xl)},screen(d){return h(d,"$screen")}}})(e,a,{filterProperties:n})).then(()=>{t()},l=>{Kt.error("Failed to register the Segment integration",l),t()})},i)}var Fl="posthog-js";function Rl(e,{organization:t,projectId:i,prefix:s,severityAllowList:r=["error"],sendExceptionsToPostHog:n=!0}={}){return o=>{var a,l,c,u,h;if(r!=="*"&&!r.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const d=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const v=((a=o.exception)===null||a===void 0?void 0:a.values)||[],f=v.map(y=>p(p({},y),{},{stacktrace:y.stacktrace?p(p({},y.stacktrace),{},{type:"raw",frames:(y.stacktrace.frames||[]).map(_=>p(p({},_),{},{platform:"web:javascript"}))}):void 0})),m={$exception_message:((l=v[0])===null||l===void 0?void 0:l.value)||o.message,$exception_type:(c=v[0])===null||c===void 0?void 0:c.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((u=v[0])===null||u===void 0?void 0:u.value)||o.message,$sentry_exception_type:(h=v[0])===null||h===void 0?void 0:h.type,$sentry_tags:o.tags};var g;return t&&i&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),n&&((g=e.exceptions)===null||g===void 0||g.sendExceptionEvent(m)),o}}var Kd=class{constructor(e,t,i,s,r,n){this.name=Fl,this.setupOnce=function(o){o(Rl(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:n==null||n}))}}},ao=class{constructor(e){this.Pl=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(S.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.Rl=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Al()}Al(){var e;this.Fl=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Pl)}destroy(){var e;(e=this.Fl)===null||e===void 0||e.call(this),this.Fl=void 0}doPageView(e,t){var i;const s=this.Ol(e,t);return this.Rl={pathname:(i=w?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Ol(e,(t=this.Rl)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Rl)===null||e===void 0?void 0:e.pageViewId}}Ol(e,t){const i=this.Rl;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=r;if(!(x(n)||x(o)||x(a)||x(l)||x(c)||x(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);const h=n>1?qe(o/n,0,1,S):1,d=n>1?qe(a/n,0,1,S):1,v=l>1?qe(c/l,0,1,S):1,f=l>1?qe(u/l,0,1,S):1;s=ee(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},Xt=["flags","surveys"],Xd={[cd]:{exposure:"hidden"},[ss]:{exposure:"hidden"},[ud]:{exposure:"hidden"},[_r]:{exposure:"hidden"},[Lt]:{exposure:"hidden"},[ui]:{exposure:"hidden"},[sl]:{exposure:"event"},[mr]:{exposure:"hidden"},[nl]:{exposure:"hidden"},[yr]:{exposure:"event"},[rl]:{exposure:"hidden"},[br]:{exposure:"event"},[wr]:{exposure:"event"},[Wr]:{exposure:"event"},[Gr]:{exposure:"hidden"},[ol]:{exposure:"event"},[di]:{exposure:"hidden"},[dd]:{exposure:"hidden"},[Ct]:{exposure:"hidden"},[al]:{exposure:"event"},[hd]:{exposure:"event",shouldSkipFromEventProperties:e=>se(e)},[_d]:{exposure:"event"},[md]:{exposure:"event"},[yd]:{exposure:"event"},[bd]:{exposure:"event"},[wd]:{exposure:"hidden"},[Re]:{exposure:"hidden",storageGroup:"flags"},[Ve]:{exposure:"hidden",storageGroup:"flags"},[fr]:{exposure:"hidden"},[_t]:{exposure:"hidden",storageGroup:"flags"},[nt]:{exposure:"hidden",storageGroup:"flags"},[mt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ci]:{exposure:"hidden",storageGroup:"flags"},[Ne]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[st]:{exposure:"hidden"},[ri]:{exposure:"hidden",storageGroup:"surveys"},[is]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[gr]:{exposure:"event"},[qi]:{exposure:"hidden"},[Ui]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[xd]:{exposure:"hidden"},[$d]:{exposure:"hidden"},[Ed]:{exposure:"event"},[kd]:{exposure:"event"},[Sd]:{exposure:"event"},[Pd]:{exposure:"event"},[We]:{exposure:"hidden"},[si]:{exposure:"hidden"},[ll]:{exposure:"event"},[wi]:{exposure:"hidden"},[ot]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[fe]:{exposure:"hidden"},[$r]:{exposure:"hidden"},[Ad]:{exposure:"hidden"},[cl]:{exposure:"hidden"},[ul]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[Jr]:{exposure:"hidden"},[vd]:{exposure:"event"},[pd]:{exposure:"event"},[fd]:{exposure:"event"},[gd]:{exposure:"event"},[hl]:{exposure:"event"},[vl]:{exposure:"event"},[Yr]:{exposure:"hidden"},[Kr]:{exposure:"hidden"},[pl]:{exposure:"hidden"},[fl]:{exposure:"hidden"},[gl]:{exposure:"hidden"},[_l]:{exposure:"hidden"},[ml]:{exposure:"hidden"},[yl]:{exposure:"hidden"},[bl]:{exposure:"hidden"},[Od]:{exposure:"event"}},Qd=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],de=e=>{const t=Xd[e];if(t)return t;for(const[i,s]of Qd)if(e.indexOf(i)===0)return s};function Ml(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}var Ye=e=>{const t=typeof document>"u"?void 0:document,i=t?.createElement("a");return x(i)?null:(i.href=e,i)},Ll=()=>{try{return"u">typeof window&&window.navigator.onLine!==!1}catch{return!1}},Dl=(e,t)=>e>=t&&Ll(),Nl=(e,t,i,s)=>{if(e===0){if(Ll()){const r=t+1;return r===i&&s(),r}return t}return 0},Ft=(e,t)=>{try{let i;return JSON.stringify(e,(s,r)=>{var n;return Vt(r)?((n=i)!==null&&n!==void 0||(i=new WeakMap),i.has(r)||i.set(r,$l(r)),i.get(r)):typeof r=="bigint"?r.toString():r},t)}catch{return Zo(e)}},Ut=function(e,t){const i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let r=0;i.length>r;r++){const n=i[r].split(/=(.*)/);if(n[0]===t){s=n;break}}if(!I(s)||2>s.length)return"";{let r=s[1].replace(/\+/g," ");try{r=decodeURIComponent(r)}catch{S.error("Skipping decoding for malformed query param: "+r)}return r}},$i=function(e,t,i){if(!e||!t||!t.length)return e;const s=e.split(/#(.*)/),r=s[1],n=(s[0]||"").split(/\?(.*)/),o=n[1],a=n[0],l=(o||"").split("&"),c=[];for(let h=0;l.length>h;h++){const d=l[h].split("?");let v=0;for(;d.length>v&&!t.includes(d[v].split("=")[0]);)v++;c.push(d.length>v?d.slice(0,v).concat(d[v].split("=")[0]+"="+i).join("?"):l[h])}let u=a;return o!=null&&(u+="?"+c.join("&")),r!=null&&(u+="#"+r),u},os=function(e,t){const i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Ht=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Zd=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ht],Ei="<masked>",eh=["li_fat_id"];function jl(e,t,i){if(!O)return{};const s=t?[...Ht,...i||[]]:[],r=ql($i(O.URL,s,Ei),e),n=(function(){const o={};return J(eh,function(a){const l=hi(a);o[a]=l||null}),o})();return ee(n,r)}function ql(e,t){const i=Zd.concat(t||[]),s={};return J(i,function(r){const n=Ut(e,r);s[r]=n||null}),s}function Ul(e){const t=(function(r){return r?r.search("https?://(.*)google.([^/?]*)")===0?"google":r.search("https?://(.*)bing.com")===0?"bing":r.search("https?://(.*)yahoo.com")===0?"yahoo":r.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),i=t!="yahoo"?"q":"p",s={};if(!se(t)){s.$search_engine=t;const r=O?Ut(O.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function Hl(){return navigator.language||navigator.userLanguage}function th(){const e=Hl();return typeof e=="string"?e.split("-")[0]:void 0}var as="$direct";function Bl(){return O?.referrer||as}function zl(e,t,i=!1){const s=e?[...Ht,...t||[]]:[],r=i?lt(K?.href):K?.href,n=r?.substring(0,1e3);return{r:Bl().substring(0,1e3),u:n?$i(n,s,Ei):void 0}}function Vl(e,t=!1){var i;const{r:s,u:r}=e,n=t?lt(r):r,o={$referrer:s,$referring_domain:s==null?void 0:s==as?as:(i=Ye(s))===null||i===void 0?void 0:i.host};if(n){o.$current_url=n;const a=Ye(n);o.$host=a?.host,o.$pathname=a?.pathname;const l=ql(n);ee(o,l)}if(s){const a=Ul(s);ee(o,a)}return o}function ih(){try{return new Date().getTimezoneOffset()}catch{return}}var sh={flags:ot,surveys:is},rh=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ti=e=>`${e}_cookie_identity_change_pending`,Ii=e=>{let t="",i=0;for(const s of e){const r=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+r>1e3)break;t+=s,i+=r}return t},le="main",ze=[Re,Ve,_t,nt,mt,ot,ci,rt],Ns=e=>ze.indexOf(e)!==-1,Wl=[Lt,ui],lo=e=>Wl.indexOf(e)!==-1,et=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Et=e=>{if(!e)return{};const t=JSON.parse(e);return D(t)?t:{}},co=(e,t)=>{J(e,(i,s)=>{const r=de(s);r&&r.exposure!=="event"||{}.hasOwnProperty.call(t,s)||delete e[s]})},js=class{constructor(e,t,i=!0,s=!e.cookieless_mode){if(this.Dl={},this.Ll=!1,this.Nl=!1,this.ql=!1,this.jl=!1,this.Bl=!1,this.zl=new Map,this.Hl=!1,this.Ul=!1,this.Wl=!1,this.Vl=new Set,this.Gl=new Set,this.Ar=e,this.Ql=i,this.props={},this.Zl=void 0,this.Jl=(r=>{let n="";return r.token&&(n=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+n+"_posthog"})(e),this.hi=e.disable_persistence||!!t,this.$l=this.Kl(e),this.ql=this.Xl(e),this.load(s),this.Yl(),e.debug&&S.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,t),this.save(),w){const r=()=>this.flush();z(w,"beforeunload",r,{capture:!1}),z(w,"pagehide",r,{capture:!1}),this.tu=n=>{if(this.Ll&&(!n.storageArea||n.storageArea===w?.localStorage)&&n.key)if(n.key!==this.Jl){if(this.ql){const o=Xt.find(a=>n.key===this.eu(a));o&&this.iu(n.key,o)}}else this.iu(n.key,le)},z(w,"storage",this.tu)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,i])=>{const s=this.zl.get(t);if(!Ns(t)||s===!0)return;if(i===!0)return void this.nu(t,!0);const r=new Set(s||[]);i.forEach(n=>r.add(n)),r.size&&this.nu(t,r)})}onCrossTabFeatureFlagChange(e){return this.Gl.add(e),()=>this.Gl.delete(e)}destroy(){this.tu&&w&&(w.removeEventListener("storage",this.tu),this.tu=void 0),this.Gl.clear()}iu(e,t,i=!0){if(this.hi)return!1;let s,r;try{if(r=H.Ot(e),se(r)){const a=this.su(t);return a.storageValue=null,t!==le&&(a.persisted=!1),!1}s=Et(r)}catch{return!1}const n=t===le?s:H.Lt(this.Jl);if(n&&this.ru(n))return!1;const o=this.ou(s,t,i);return t===le&&this.ql&&!et(this.au().main,s)||this.lu(s,t,!0,r),o}ru(e){const t=this.props[Te],i=e[Te];return!x(t)&&!x(i)&&t!==i}lu(e,t,i,s){const r=this.su(t);r.storageValue=s,t!==le&&(r.persisted=i);try{r.fingerprint=this.uu(e,t)}catch{r.fingerprint=void 0}}ou(e,t,i){let s=!1;return ze.forEach(r=>{var n;const o=(n=de(r))===null||n===void 0?void 0:n.storageGroup;if(t===le&&this.ql&&o||t!==le&&o!==t)return;const a=r in e,l=this.cu(r,a?e[r]:void 0),c=this.zl.has(r)?r in this.props:a;c===r in this.props&&et(l,this.props[r])||(c?this.hu(r,l,!1):this.du(r,!1),s=!0)}),s&&i&&this.Gl.forEach(r=>r()),s}vu(){if(!this.Ll)return!1;try{this.Wl=!1;const e=H.Ot(this.Jl),t=this.su(le);let i,s=!1,r=!1;if(e!==t.storageValue)if(se(e))t.storageValue=null;else{if(i=Et(e),this.Wl=!this.Ul&&this.ru(i),this.Wl)return!1;r=this.ou(i,le,!1),!this.ql||et(this.au().main,i)?this.lu(i,le,!0,e):t.storageValue=e,s=!0}return this.ql&&Xt.forEach(n=>{const o=H.Ot(this.eu(n)),a=this.su(n),l=i||{},c=s&&ze.some(h=>{var d;return((d=de(h))===null||d===void 0?void 0:d.storageGroup)===n&&h in l});if(o===a.storageValue&&!c)return;if(se(o))return a.storageValue=null,a.persisted=!1,void(c&&(r=this.ou(l,n,!1)||r));const u=Et(o);r=this.ou(u,n,!1)||r,this.lu(u,n,!0,o)}),r}catch{return!1}}nu(e,t){this.zl.set(e,t);const i=de(e);i!=null&&i.volatile||(this.su((this.ql?i?.storageGroup:void 0)||le).fingerprint=void 0,this.fu(e))}pu(){ze.forEach(e=>this.zl.set(e,!0))}Yl(){if(this.Ll)try{const e=H.Ot(this.Jl),t=Et(e);this.su(le).storageValue=e,ze.forEach(i=>{var s;const r=this.ql?(s=de(i))===null||s===void 0?void 0:s.storageGroup:void 0,n=r?H.Ot(this.eu(r)):null;if(r){const a=this.su(r);a.storageValue=n,a.persisted=!se(n)}const o=r&&!se(n)?Et(n):t;i in this.props?this.gu(i,o[i],this.props[i]):i in o&&this.nu(i,!0)})}catch{}}cu(e,t){const i=this.zl.get(e);if(!i)return t;if(i===!0)return this.props[e];if(e==="$active_feature_flags"){const n=new Set(I(t)?t:[]),o=new Set(I(this.props[e])?this.props[e]:[]);return i.forEach(a=>o.has(a)?n.add(a):n.delete(a)),Array.from(n)}const s=D(t)?p({},t):{},r=D(this.props[e])?this.props[e]:{};return i.forEach(n=>{n in r?s[n]=r[n]:delete s[n]}),s}gu(e,t,i){if(!Ns(e))return;const s=this.zl.get(e);if(s===!0)return;let r=t;if(this.Ll)try{var n;const a=this.ql?(n=de(e))===null||n===void 0?void 0:n.storageGroup:void 0,l=a?this.eu(a):this.Jl;r=Et(H.Ot(l))[e]}catch{}const o=new Set(s||[]);if(e==="$active_feature_flags"){if(!x(t)&&!I(t)||!x(r)&&!I(r)||!I(i))return void this.nu(e,!0);const a=new Set(t||[]),l=new Set(r||[]),c=new Set(i);new Set([...a,...c]).forEach(u=>{a.has(u)!==c.has(u)&&o.add(u)}),o.forEach(u=>{l.has(u)===c.has(u)&&o.delete(u)})}else{if(!D(i))return void(et(r,i)?this.zl.delete(e):this.nu(e,!0));{if(!x(t)&&!D(t)||x(t)&&Ee(i)&&x(r))return void this.nu(e,!0);const a=D(t)?t:{},l=D(r)?r:{};new Set([...Object.keys(a),...Object.keys(i)]).forEach(c=>{c in a==c in i&&et(a[c],i[c])||o.add(c)}),o.forEach(c=>{c in l==c in i&&et(l[c],i[c])&&o.delete(c)})}}o.size?this.nu(e,o):this.zl.delete(e)}mu(){var e;const t=(e=this.Ar)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return oe(t)&&t>0?t:0}yu(e){if(this.Ar.cookieWinsOnConflict&&this.Ar.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=Ms(e,this.Ar.cookie_persisted_properties||[]),i=Wn(t,this.Ar.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=Z.Ot(this.Jl)||void 0;r&&Ls(this.Jl,r)===s&&(this.bu=s,this._u=r)}catch{}else try{const t=Z.Ot(this.Jl)||void 0;this.bu=t?Ls(this.Jl,t):void 0,this._u=t}catch{}}syncCookieProperties(){return this.wu(this.Ar)}wu(e,t=!1){if(this.hi&&!t||this.Bl||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let i;try{i=Z.Ot(this.Jl)||void 0}catch{}if(!i||i===this._u)return!1;const s=Ls(this.Jl,i);let r;try{r=Rs(JSON.parse(i))}catch{return!1}if((Z.Ot(this.Jl)||void 0)!==i)return!1;this.bu=s,this._u=i;const n=Gn(this.Jl,i),o=[...gt,...n.properties],a={};if(Object.keys(r).forEach(m=>{const g=r[m];(x(g)||se(g)||g===""||m==="$user_state"&&g!=="anonymous"&&g!=="identified")&&(a[m]=!0,delete r[m])}),Ee(r))return!1;const l="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",c=this.props,u=c[Te],h=c[fe],d=ee({},c);[...gt,...e.cookie_persisted_properties||[]].forEach(m=>{if(o.indexOf(m)!==-1&&!(m in r)&&!a[m]&&(l||m!=="distinct_id"&&m!=="$user_state")){const g=d[m];(n.isValid||gt.indexOf(m)===-1||g!==!1&&g!==0)&&delete d[m]}}),this.props=ee(d,r),ze.forEach(m=>{const g=m in this.props;m in c===g&&et(c[m],this.props[m])||(g?this.gu(m,c[m],this.props[m]):this.nu(m,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this.hu(fe,Ge);const v=this.props[Te],f=this.props[fe];return!l||v===u&&f===h||(this.Ul=!0,this.jl=!0,X.At(Ti(this.Jl),!0),this.du(rt),this.du(Ve),this.du(Re),this.du(_t),this.du(nt),this.du(mt),this.du(ot),this.du(wi),this.du(We),f!=="anonymous"||h!=="identified"&&r.$user_state!=="anonymous"&&(x(u)||v===u)||(co(this.props,r),this.du(st)),f==="identified"?this.props.$user_id=v:delete this.props.$user_id,this.du(ss)),!0}consumeCookieIdentityChange(){const e=Ti(this.Jl),t=this.jl||!!X.Ot(e);return this.jl=!1,t&&X.Pt(e),t}ku(e=!1){return!(this.Bl||this.hi&&!e||!this.Ar.cookieWinsOnConflict||this.Ar.persistence.toLowerCase()!=="localstorage+cookie"||(this.Bl=!0,0))}Su(){this.Bl&&(x(this.xu)||(clearTimeout(this.xu),this.xu=void 0),delete this.Dl[le],this.$u(!0))}Cu(e=!0){if(this.Bl)try{e?this.Su():x(this.xu)||(clearTimeout(this.xu),this.xu=void 0)}finally{this.Bl=!1}}isDisabled(){return!!this.hi}Kl(e){rh.indexOf(e.persistence.toLowerCase())===-1&&(S.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((o=[],a=!1,l=()=>!1)=>{const c=[...gt,...o];return p(p({},H),{},{Tu(u){return[Z.Ot(u),Z.Ot(vi(u)),H.Ot(u)].join("\0")},Lt(u){try{let d,v={};try{d=Z.Ot(u)||void 0,v=d?Rs(JSON.parse(d)):{}}catch{}const f=JSON.parse(H.Ot(u)||"{}");let m;if(a){const g=Gn(u,d),y=[...gt,...g.properties],_={};Object.keys(v).forEach(E=>{const k=v[E];se(k)||k===""||E==="$user_state"&&k!=="anonymous"&&k!=="identified"||(_[E]=k)});const b="distinct_id"in _||_.$user_state==="anonymous"||_.$user_state==="identified";if(Object.keys(_).length>0){var h;const E=f[Te],k=(h=f.$user_state)!==null&&h!==void 0?h:Ge;c.forEach($=>{if(y.indexOf($)!==-1&&!($ in v)&&(b||$!=="distinct_id"&&$!=="$user_state")){const A=f[$];(g.isValid||gt.indexOf($)===-1||A!==!1&&A!==0)&&delete f[$]}}),!b||"$user_state"in v||"$user_state"in f||(f[fe]=Ge),!b||("distinct_id"in _?_[Te]:f[Te])===E&&("$user_state"in _?_[fe]:f[fe])===k||(Fs.forEach($=>delete f[$]),_.$user_state==="identified"&&"distinct_id"in _?f.$user_id=_[Te]:delete f.$user_id,_.$user_state!=="identified"&&(delete f[ll],delete f[st]),delete f.__alias)}m=ee(f,_)}else m=ee(v,f);return l()||H.At(u,m),m}catch{}return null},At(u,h,d,v,f,m){const g=H.At(u,h,void 0,void 0,m);try{const y=Ms(h,o);if(Object.keys(y).length){if(a){const _=vi(u),b=Wn(y,o);if(Z.At(_,b,d,v,f,m),Z.Ot(_)!==JSON.stringify(b)){Z.Pt(_,v);const E=Ms(h);return Z.At(u,E,d,v,f,m),g}}Z.At(u,y,d,v,f,m)}}catch(y){H.Ft(y)}return g},Pt(u,h){try{w?.localStorage.removeItem(u),Z.Pt(u,h),Z.Pt(vi(u),h)}catch(d){H.Ft(d)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this.hi);let i,s=!1,r=!1;const n=e.persistence.toLowerCase();return n==="localstorage"&&H.Et()?(i=H,r=!0):n==="localstorage+cookie"&&t.Et()?(i=t,r=!0,s=!0):n==="sessionstorage"&&X.Et()?i=X:n==="memory"?i=Sr:n==="cookie"&&Z.Et()?(i=Z,s=!0):t.Et()?(i=t,r=!0,s=!0):Z.Et()?(i=Z,s=!0):i=Sr,this.Ll=r,this.Nl=s,i}eu(e){return`${this.Jl}__${e}`}Xl(e){return this.Ll&&!!e.split_storage}properties(){const e={};return J(this.props,(t,i)=>{const s=de(i);if(!s||s.exposure==="event"){var r;if(!(s==null||(r=s.shouldSkipFromEventProperties)===null||r===void 0)&&r.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this.hi&&!e)return;const t=this.Ar.cookieWinsOnConflict&&this.Ar.persistence.toLowerCase()==="localstorage+cookie",i=t?H.Lt(this.Jl):null;let s={};if(t)try{s=Rs(Z.Lt(this.Jl)),J(s,(a,l)=>{(x(a)||se(a)||a==="")&&delete s[l]})}catch{}const r=this.$l.Lt(this.Jl);if(r&&(this.props=ee({},r)),this.ql&&this.Iu(),t&&r){var n,o;const a=i?.[Te],l=(n=i?.$user_state)!==null&&n!==void 0?n:Ge,c=r[Te],u=(o=r.$user_state)!==null&&o!==void 0?o:Ge;if(c!==a||u!==l){this.jl=!0,this.hi||X.At(Ti(this.Jl),!0);const h=ee({},this.props);Fs.forEach(v=>delete h[v]),u!=="anonymous"||l!=="identified"&&s.$user_state!=="anonymous"&&(x(a)||c===a)||(co(h,s),delete h[st]),this.props=h;const d=new Set;Fs.forEach(v=>{var f;const m=(f=de(v))===null||f===void 0?void 0:f.storageGroup;m&&d.add(m)}),d.forEach(v=>{if(this.hi)return;const f={};J(this.props,(m,g)=>{var y;((y=de(g))===null||y===void 0?void 0:y.storageGroup)===v&&(f[g]=m)}),Ee(f)?(H.Pt(this.eu(v)),this.Dl[v]={}):H.At(this.eu(v),f)&&(this.Dl[v]={persisted:!0,fingerprint:this.uu(f,v)})})}}X.Ot(Ti(this.Jl))&&(this.jl=!0)}Iu(){for(const e of Xt){const t=H.Lt(this.eu(e));if(t&&!Ee(t)){const i=this.su(e);i.persisted=!0,this.Mu(e)||(i.fingerprint=this.uu(t,e)),this.Eu(e,t)||ee(this.props,t)}}}Mu(e){return Object.keys(this.props).some(t=>{var i;return((i=de(t))===null||i===void 0?void 0:i.storageGroup)===e})}Eu(e,t){const i=sh[e];if(!i)return!1;const s=t[i],r=this.props[i];return oe(s)&&oe(r)&&r>s}refreshKey(e){this.Pu([e])}Pu(e){if(this.hi)return;let t,i=!1;const s=()=>(i||(t=this.$l.Lt(this.Jl),i=!0),t);e.forEach(r=>{var n;if(this.Vl.has(r))return;const o=this.ql?(n=de(r))===null||n===void 0?void 0:n.storageGroup:void 0,a=o?H.Lt(this.eu(o)):s();if(a&&r in a)this.hu(r,a[r],!1);else{if(o){const l=s();if(l&&r in l)return void this.hu(r,l[r],!1)}this.du(r,!1)}})}refreshMetaIdentifiers(){if(this.hi)return;const e=this.Ru();(x(e)||e!==this.Au)&&(this.Pu(Wl),this.Fu(e))}Fu(e=this.Ru()){this.Au=this.Vl.size===0?e:void 0}Ru(){const e=this.$l.Tu?this.$l.Tu(this.Jl):this.$l.Ot(this.Jl);return N(e)?e:void 0}save(){if(this.hi)return;const e=this.mu();e>0?x(this.xu)&&(this.xu=setTimeout(()=>{this.xu=void 0,this.$u()},e)):this.$u()}flush(){x(this.xu)||(clearTimeout(this.xu),this.xu=void 0,this.$u())}$u(e=!1){if(this.hi||this.Bl&&!e)return;e||(this.syncCookieProperties(),this.Ar.cookieWinsOnConflict&&this.Ar.persistence.toLowerCase()==="localstorage+cookie"||this.refreshMetaIdentifiers());const t=!e&&!this.Hl;t||(this.Wl=!1);const i=!!t&&this.vu();if(this.Wl)return void(this.Ar.debug&&S.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.ql)return this.Ou(),void(i&&this.Gl.forEach(r=>r()));const s=this.Du(this.$l,this.Jl,this.props,le);s==="written"&&this.yu(this.props),s!=="failed"&&(this.zl.clear(),this.Ul=!1,this.Vl.clear()),s==="written"&&this.Fu(),i&&this.Gl.forEach(r=>r())}Ou(){const{main:e,groups:t}=this.au(),i=this.Du(this.$l,this.Jl,e,le);i==="written"&&this.yu(e),i!=="failed"&&(this.Ul=!1,this.Vl.clear(),ze.forEach(r=>{var n;(n=de(r))!==null&&n!==void 0&&n.storageGroup||this.zl.delete(r)})),i==="written"&&this.Fu();for(const r of Xt){var s;const n=t[r];if(Ee(n)&&!(!((s=this.Dl[r])===null||s===void 0)&&s.persisted)){ze.forEach(a=>{var l;((l=de(a))===null||l===void 0?void 0:l.storageGroup)===r&&this.zl.delete(a)});continue}const o=this.Du(H,this.eu(r),n,r);o!=="failed"&&ze.forEach(a=>{const l=de(a);l?.storageGroup!==r||o!=="written"&&l.volatile||this.zl.delete(a)})}}au(){const e={},t={flags:{},surveys:{}};return J(this.props,(i,s)=>{var r;const n=(r=de(s))===null||r===void 0?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}uu(e,t){if(t===le)return JSON.stringify(e)+"|"+this.Lu+"|"+this.Nu+"|"+this.qu;const i={};return J(e,(s,r)=>{var n;i[r]=!((n=de(r))===null||n===void 0)&&n.volatile?"__volatile__":s}),JSON.stringify(i)}Du(e,t,i,s){const r=this.su(s);if(s!==le&&!r.dirty&&!x(r.fingerprint))return"skipped";let n;try{if(n=this.uu(i,s),n===r.fingerprint)return r.dirty=!1,"skipped"}catch{n=void 0}return e.At(t,i,this.Lu,this.Nu,this.qu,this.Ar.debug)?(r.dirty=!1,s!==le&&(r.persisted=!0),x(n)||(r.fingerprint=n),this.Ll&&(r.storageValue=H.Ot(t)),"written"):(this.Ar.debug&&S.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.pu(),x(this.xu)||(clearTimeout(this.xu),this.xu=void 0),this.$l.Pt(this.Jl,!1),this.$l.Pt(this.Jl,!0),!e&&this.Ql)for(const t of Xt)H.Pt(this.eu(t));e?delete this.Dl[le]:this.Dl={},this.bu=void 0,this._u=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(D(e)){this.syncCookieProperties(),x(t)&&(t="None"),this.Lu=x(i)?this.ju:i;let s=!1;if(J(e,(r,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.hu(n,r),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(D(e)){this.syncCookieProperties(),this.Lu=x(t)?this.ju:t;let i=!1;if(J(e,(s,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==s||D(s)||I(s))&&(this.hu(r,s),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let i=!1;for(const s of t)s in this.props&&(this.du(s),i=!0);i&&this.save()}update_campaign_params(){const e=O?.URL;if(e===this.Zl)return;const t=jl(this.Ar.custom_campaign_params,this.Ar.mask_personal_data_properties,this.Ar.custom_personal_data_properties),i=!Ee(Qr(t));return i&&this.register(t),this.Zl=e,i?t:void 0}update_search_keyword(){this.register((function(){const e=O?.referrer;return e?Ul(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:Bl(),$referring_domain:O?.referrer&&((e=Ye(O.referrer))===null||e===void 0?void 0:e.host)||as},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=zl(this.Ar.mask_personal_data_properties,this.Ar.custom_personal_data_properties,this.Ar.disable_capture_url_hashes);this.register_once({[Tt]:this.Nl?{r:Ii(e.r),u:e.u?Ii(e.u):void 0}:e},void 0)}get_initial_props(){const e={};J([ul,cl],i=>{const s=this.props[i];s&&J(s,function(r,n){e["$initial_"+nr(n)]=r})});const t=this.props[Tt];if(t){const i=(function(s,r=!1){const n=Vl(s,r),o={};return J(n,function(a,l){o[`$initial_${nr(l)}`]=a}),o})(t,this.Ar.disable_capture_url_hashes);ee(e,i)}return e}safe_merge(e){return J(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){const s=e.persistence!==t.persistence,r=!((v,f)=>{if(v.length!==f.length)return!1;const m=[...v].sort(),g=[...f].sort();return m.every((y,_)=>y===g[_])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=s||r,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this.hi&&!a;a||this.wu(t,l),this.Ar=e,!a&&(s||r||o)&&(this.bu=void 0,this._u=void 0,this.wu(p(p({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const c=n||o?this.Kl(e):this.$l;this.Bu();const u=this.Xl(e),h=n||u!==this.ql,d=!a&&(h||e.cross_subdomain_cookie!==this.Nu||e.secure_cookie!==this.qu)&&this.ku(l);this.Hl=h;try{if(this.ju=this.Lu=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),h){const v=this.props;this.clear(),this.$l=c,this.ql=u,this.props=v,this.save()}else o&&(this.$l=c,a||(delete this.Dl[le],this.$u()))}finally{this.Hl=!1,d&&this.Cu()}}Bu(){const e=this.props[Tt];if(!this.Nl||!D(e)||typeof e.r!="string")return;const t=Ii(e.r),i=typeof e.u=="string"?Ii(e.u):e.u;t===e.r&&i===e.u||this.hu(Tt,p(p({},e),{},{r:t,u:i}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Nu&&(this.Nu=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.qu&&(this.qu=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const i=this.props.__timers||{};i[e]=t,this.hu(_r,i),this.save()}remove_event_timer(e){const t=this.props.__timers||{},i=t[e];return x(i)||(delete t[e],this.hu(_r,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.hu(e,t),this.save()}hu(e,t,i=!0){var s;const r=this.props[e];this.props[e]=t,i&&(e!=="distinct_id"&&e!=="$user_state"||r===t||(this.Ul=!0),lo(e)&&!et(r,t)&&this.Vl.add(e),this.gu(e,r,t),(s=de(e))!==null&&s!==void 0&&s.volatile||this.fu(e))}du(e,t=!0){delete this.props[e],t&&(Ns(e)&&this.nu(e,!0),lo(e)&&this.Vl.add(e),this.fu(e))}fu(e){var t;const i=(t=de(e))===null||t===void 0?void 0:t.storageGroup;i&&(this.su(i).dirty=!0)}su(e){return this.Dl[e]||(this.Dl[e]={})}},Pe={GZipJS:"gzip-js",Base64:"base64"},Qt={Activation:"events",Cancellation:"cancelEvents"},qs={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Se={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Us={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"},Ar={Popover:"popover",Inline:"inline"};function Fi(e){let t=!0;return{dispose(){if(t){t=!1;const i=e();i&&ne(i.then)&&i.then(void 0,()=>{})}}}}var nh={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"},uo={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"},ho=te("[RateLimiter]"),oh=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(s=>{ho.info(`${s||"events"} is quota limited.`),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){ho.warn(`could not rate limit - continuing. Error: "${s?.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||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;const{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=new Date().getTime(),a=(t=(i=this.instance.persistence)===null||i===void 0?void 0:i.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:r,last:o};a.tokens+=Math.max(0,o-a.last)/1e3*n,a.last=Math.max(a.last,o),a.tokens>r&&(a.tokens=r);const l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const c=(oe(a.dropped)?a.dropped:0)+1;a.dropped=c,!this.lastEventRateLimited&&this.zu(c)&&(a.dropped=0)}return this.lastEventRateLimited=l,(s=this.instance.persistence)===null||s===void 0||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Hu(e){const t=this.instance.config.property_denylist;return!I(t)||!t.includes(e)}Uu(){var e;if(this.Hu("$current_url")&&this.Hu("$pathname")&&K?.pathname)return`${(e=K.origin)!==null&&e!==void 0?e:""}${K.pathname}`}zu(e){var t,i;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,n=this.Uu(),o=this.Hu("$session_id")?(t=(i=this.instance).get_session_id)===null||t===void 0?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,n?`triggered on ${n}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${r} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},tt=te("[RemoteConfig]"),Gl=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=R._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Wu(e){var t,i,s;!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Vu(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return tt.info("Using preloaded remote config",this.remoteConfig),void this.Gu(this.remoteConfig);if(this._instance.Qu())return void tt.warn("Remote config is disabled. Falling back to local config.");this.Wu(e=>{if(!e)return tt.info("No config found after loading remote JS config. Falling back to JSON."),void this.Vu(t=>{this.Gu(t.json,t)});this.Gu(e)})}catch(e){tt.error("Error loading remote config",e),this.Gu()}}Gu(e,t){!e&&t&&(t.statusCode===0?t.error||tt.warn("Failed to fetch remote config from PostHog."):tt.error("Failed to fetch remote config from PostHog."));try{this._instance.Gu(e?{ok:!0,config:e}:{ok:!1})}catch(s){tt.error("Error applying remote config",s)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;(i=this._instance.featureFlags)===null||i===void 0||i.ensureFlagsLoaded()}catch(s){tt.error("Error loading feature flags",s)}}},Ae=Uint8Array,we=Uint16Array,Bt=Uint32Array,rn=new Ae([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]),nn=new Ae([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]),vo=new Ae([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jl=function(e,t){for(var i=new we(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new Bt(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},Yl=Jl(rn,2),Or=Yl[1];Yl[0][28]=258,Or[258]=28;for(var po=Jl(nn,0)[1],Cr=new we(32768),re=0;32768>re;++re){var kt=(43690&re)>>>1|(21845&re)<<1;Cr[re]=((65280&(kt=(61680&(kt=(52428&kt)>>>2|(13107&kt)<<2))>>>4|(3855&kt)<<4))>>>8|(255&kt)<<8)>>>1}var fi=function(e,t,i){for(var s=e.length,r=0,n=new we(t);s>r;++r)++n[e[r]-1];var o,a=new we(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new we(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var c=r<<4|e[r],u=t-e[r],h=a[e[r]-1]++<<u,d=h|(1<<u)-1;d>=h;++h)o[Cr[h]>>>l]=c}else for(o=new we(s),r=0;s>r;++r)o[r]=Cr[a[e[r]-1]++]>>>15-e[r];return o},bt=new Ae(288);for(re=0;144>re;++re)bt[re]=8;for(re=144;256>re;++re)bt[re]=9;for(re=256;280>re;++re)bt[re]=7;for(re=280;288>re;++re)bt[re]=8;var ls=new Ae(32);for(re=0;32>re;++re)ls[re]=5;var ah=fi(bt,9,0),lh=fi(ls,5,0),Kl=function(e){return(e/8|0)+(7&e&&1)},Xl=function(e,t,i){(t==null||0>t)&&(t=0),(i==null||i>e.length)&&(i=e.length);var s=new(e instanceof we?we:e instanceof Bt?Bt:Ae)(i-t);return s.set(e.subarray(t,i)),s},Ue=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Zt=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Hs=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new Ae(0),0];if(r==1){var o=new Ae(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(k,$){return k.f-$.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=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:a.f+l.f,l:a,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var v=new we(d+1),f=Tr(i[u-1],v,0);if(f>t){s=0;var m=0,g=f-t,y=1<<g;for(n.sort(function(k,$){return v[$.s]-v[k.s]||k.f-$.f});r>s;++s){var _=n[s].s;if(t>=v[_])break;m+=y-(1<<f-v[_]),v[_]=t}for(m>>>=g;m>0;){var b=n[s].s;t>v[b]?m-=1<<t-v[b]++-1:++s}for(;s>=0&&m;--s){var E=n[s].s;v[E]==t&&(--v[E],++m)}f=t}return[new Ae(v),f]},Tr=function(e,t,i){return e.s==-1?Math.max(Tr(e.l,t,i+1),Tr(e.r,t,i+1)):t[e.s]=i},fo=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new we(++t),s=0,r=e[0],n=1,o=function(l){i[s++]=l},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},ei=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},zi=function(e,t,i){var s=i.length,r=Kl(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},go=function(e,t,i,s,r,n,o,a,l,c,u){Ue(t,u++,i),++r[256];for(var h=Hs(r,15),d=h[0],v=h[1],f=Hs(n,15),m=f[0],g=f[1],y=fo(d),_=y[0],b=y[1],E=fo(m),k=E[0],$=E[1],A=new we(19),P=0;_.length>P;++P)A[31&_[P]]++;for(P=0;k.length>P;++P)A[31&k[P]]++;for(var M=Hs(A,7),B=M[0],V=M[1],F=19;F>4&&!B[vo[F-1]];--F);var W,C,j,U,Y=c+5<<3,q=ei(r,bt)+ei(n,ls)+o,ie=ei(r,d)+ei(n,m)+o+14+3*F+ei(A,B)+(2*A[16]+3*A[17]+7*A[18]);if(q>=Y&&ie>=Y)return zi(t,u,e.subarray(l,l+c));if(Ue(t,u,1+(q>ie)),u+=2,q>ie){W=fi(d,v,0),C=d,j=fi(m,g,0),U=m;var he=fi(B,V,0);for(Ue(t,u,b-257),Ue(t,u+5,$-1),Ue(t,u+10,F-4),u+=14,P=0;F>P;++P)Ue(t,u+3*P,B[vo[P]]);u+=3*F;for(var ce=[_,k],pe=0;2>pe;++pe){var ke=ce[pe];for(P=0;ke.length>P;++P)Ue(t,u,he[ue=31&ke[P]]),u+=B[ue],ue>15&&(Ue(t,u,ke[P]>>>5&127),u+=ke[P]>>>12)}}else W=ah,C=bt,j=lh,U=ls;for(P=0;a>P;++P)if(s[P]>255){var ue;Zt(t,u,W[257+(ue=s[P]>>>18&31)]),u+=C[ue+257],ue>7&&(Ue(t,u,s[P]>>>23&31),u+=rn[ue]);var Oe=31&s[P];Zt(t,u,j[Oe]),u+=U[Oe],Oe>3&&(Zt(t,u,s[P]>>>5&8191),u+=nn[Oe])}else Zt(t,u,W[s[P]]),u+=C[s[P]];return Zt(t,u,W[256]),u+C[256]},ch=new Bt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),uh=new Ae(0),dh=(function(){for(var e=new Bt(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e})(),Bs=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function hh(e,t){t===void 0&&(t={});var i=(function(){var d=4294967295;return{p(v){for(var f=d,m=0;v.length>m;++m)f=dh[255&f^v[m]]^f>>>8;d=f},d(){return 4294967295^d}}})(),s=e.length;i.p(e);var r,n,o,a,l,c,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,(function(d,v,f,m,g,y){var _=d.length,b=new Ae(m+_+5*(1+Math.floor(_/7e3))+g),E=b.subarray(m,b.length-g),k=0;if(!v||8>_)for(var $=0;_>=$;$+=65535){var A=$+65535;_>A?k=zi(E,k,d.subarray($,A)):(E[$]=y,k=zi(E,k,d.subarray($,_)))}else{for(var P=ch[v-1],M=P>>>13,B=8191&P,V=(1<<f)-1,F=new we(32768),W=new we(V+1),C=Math.ceil(f/3),j=2*C,U=function(ms){return(d[ms]^d[ms+1]<<C^d[ms+2]<<j)&V},Y=new Bt(25e3),q=new we(288),ie=new we(32),he=0,ce=0,pe=($=0,0),ke=0,ue=0;_>$;++$){var Oe=U($),Ke=32767&$,Xe=W[Oe];if(F[Ke]=Xe,W[Oe]=Ke,$>=ke){var ct=_-$;if((he>7e3||pe>24576)&&ct>423){k=go(d,E,0,Y,q,ie,ce,pe,ue,$-ue,k),pe=he=ce=0,ue=$;for(var xe=0;286>xe;++xe)q[xe]=0;for(xe=0;30>xe;++xe)ie[xe]=0}var Le=2,Si=0,Ec=B,Qe=Ke-Xe&32767;if(ct>2&&Oe==U($-Qe))for(var kc=Math.min(M,ct)-1,Sc=Math.min(32767,$),Pc=Math.min(258,ct);Sc>=Qe&&--Ec&&Ke!=Xe;){if(d[$+Le]==d[$+Le-Qe]){for(var Ze=0;Pc>Ze&&d[$+Ze]==d[$+Ze-Qe];++Ze);if(Ze>Le){if(Le=Ze,Si=Qe,Ze>kc)break;var Ac=Math.min(Qe,Ze-2),ln=0;for(xe=0;Ac>xe;++xe){var _s=$-Qe+xe+32768&32767,cn=_s-F[_s]+32768&32767;cn>ln&&(ln=cn,Xe=_s)}}}Qe+=(Ke=Xe)-(Xe=F[Ke])+32768&32767}if(Si){Y[pe++]=268435456|Or[Le]<<18|po[Si];var un=31&Or[Le],dn=31&po[Si];ce+=rn[un]+nn[dn],++q[257+un],++ie[dn],ke=$+Le,++he}else Y[pe++]=d[$],++q[d[$]]}}k=go(d,E,y,Y,q,ie,ce,pe,ue,$-ue,k),y||(k=zi(E,k,uh))}return Xl(b,0,m+Kl(k)+g)})(n=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!c)),h=u.length;return(function(d,v){var f=v.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>v.level?4:v.level==9?2:0,d[9]=3,v.mtime!=0&&Bs(d,4,Math.floor(new Date(v.mtime||Date.now())/1e3)),f){d[3]=8;for(var m=0;f.length>=m;++m)d[m+10]=f.charCodeAt(m)}})(u,t),Bs(u,h-8,i.d()),Bs(u,h-4,s),u}var vh=!!Dr||!!yi,Ql=new WeakMap,Zl="text/plain",zs=0,Vi=!1,ec=(e,t)=>{const[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;const o=n.split("&").filter(a=>a.split("=")[0]!==t).join("&");return`${r}${o?`?${o}`:""}${s?`#${s}`:""}`},fs=(e,t,i=!0)=>{var s;const[r,n]=e.split("?"),o=p({},t),a=(s=n?.split("&").map(c=>{var u;const[h,d]=c.split("="),v=i&&(u=o[h])!==null&&u!==void 0?u:d;return delete o[h],`${h}=${v}`}))!==null&&s!==void 0?s:[],l=(function(c,u="&"){let h,d;const v=[];return J(c,function(f,m){x(f)||x(m)||m==="undefined"||(h=encodeURIComponent((g=>g instanceof File)(f)?f.name:f.toString()),d=encodeURIComponent(m),v[v.length]=d+"="+h)}),v.join(u)})(o);return l&&a.push(l),a.length>0?`${r}?${a.join("&")}`:r},Vs=e=>{if(e.lr)return e.lr;const{data:t,compression:i}=e;if(!t)return;if(i===Pe.GZipJS){const r=hh((function(n){var o=n.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(n);for(var a=new Ae(n.length+(n.length>>>1)),l=0,c=function(v){a[l++]=v},u=0;o>u;++u){if(l+5>a.length){var h=new Ae(l+8+(o-u<<1));h.set(a),a=h}var d=n.charCodeAt(u);128>d?c(d):2048>d?(c(192|d>>>6),c(128|63&d)):d>55295&&57344>d?(c(240|(d=65536+(1047552&d)|1023&n.charCodeAt(++u))>>>18),c(128|d>>>12&63),c(128|d>>>6&63),c(128|63&d)):(c(224|d>>>12),c(128|d>>>6&63),c(128|63&d))}return Xl(a,0,l)})(Ft(t)),{mtime:0});return{contentType:Zl,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Pe.Base64){const r=(n=>"data="+encodeURIComponent(typeof n=="string"?n:Ft(n)))((function(n){return n&&btoa(encodeURIComponent(n).replace(/%([0-9A-F]{2})/g,(o,a)=>String.fromCharCode(parseInt(a,16))))})(Ft(t)));return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const s=Ft(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},tc=e=>{const t=()=>e.transport==="sendBeacon"?{url:fs(e.url,{compression:Pe.Base64}),encodedBody:Vs(p(p({},e),{},{compression:Pe.Base64,lr:void 0}))}:{url:ec(e.url,"compression"),encodedBody:Vs(p(p({},e),{},{compression:void 0,lr:void 0}))};let i;try{i=Vs(e)}catch(r){if(Cn(e.compression,Ut(e.url,"compression")))return S.error("Failed to gzip request body, sending uncompressed payload",r),t();throw r}return i&&Cn(e.compression,Ut(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?dr(new Uint8Array(s)):ArrayBuffer.isView(s)&&dr(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Vi=!0,t()):{url:e.url,encodedBody:i};var s},ic=e=>{try{return tc(e)}catch(i){var t;S.error(i),(t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:i});return}},ph=(function(){var e=Q(function*(t){const i=yield(function(r){return hr.apply(this,arguments)})(Ft(t.data),$e.DEBUG,{rethrow:!0});if(!i)return t;const s=yield i.arrayBuffer();return p(p({},t),{},{lr:{contentType:Zl,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}})(),fh=/Failed to fetch|NetworkError|Load failed/i,sc=e=>e?.name==="TypeError"&&fh.test(e?.message||""),rc=e=>{try{const t=(function(i,s=Date.now(),r=3e5){if(typeof i!="string"||!i)return;const n=i.trim(),o=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(",")).trim():n;if(/^\d+$/.test(o)){const c=1e3*Math.min(Number(o),r/1e3);return c>0?c:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(o))return;const a=/^\w{3} \w{3} /.test(o)?o+" GMT":o,l=Date.parse(a)-s;return Number.isFinite(l)&&l>0?Math.min(l,r):void 0})(e());return x(t)?void 0:Math.min(t,3e4)}catch{return}},nc=e=>{const t=ic(e);if(!t)return;const i=new Dr;Ql.set(i,!0);const{url:s,encodedBody:r}=t;i.open(e.method||"GET",s,!0);const{contentType:n,body:o}=r??{};J(e.headers,function(a,l){i.setRequestHeader(l,a)}),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(i.readyState===4){var a;const l={statusCode:i.status,text:i.responseText};if(i.status===200)try{l.json=JSON.parse(i.responseText)}catch{}(a=e.callback)===null||a===void 0||a.call(e,l,rc(()=>i.getResponseHeader("Retry-After")))}},i.send(o)},oc=e=>{const t=ic(e);if(!t)return;const{url:i,encodedBody:s}=t,{contentType:r,body:n,estimatedSize:o}=s??{},a=new Headers;J(e.headers,function(f,m){a.append(m,f)}),r&&a.append("Content-Type",r);let l=null,c=!1;if(hn){const f=new hn;l={signal:f.signal,timeout:setTimeout(()=>{c=!0;try{f.abort(Fa("AbortError","PostHog request timed out"+((m=e.timeout)?` after ${m}ms`:"")))}catch(g){h(g)}var m},e.timeout)}}let u=!1;const h=f=>{var m;u||(u=!0,c&&f?.name==="AbortError"||sc(f)?S.warn(f):S.error(f),(m=e.callback)===null||m===void 0||m.call(e,{statusCode:0,error:f}))};let d=0;const v=()=>{zs-=d,d=0,l&&clearTimeout(l.timeout)};try{const f=p({method:e?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:n,signal:l?.signal},e.fetchOptions),m=o??(x(n)?0:void 0);f.keepalive=f.method==="POST"&&!e.kl&&f.keepalive!==!1&&f.body===n&&!x(m)&&m>=0&&52428.8>zs+m,f.keepalive&&(d=m,zs+=d),yi(i,f).then(g=>g.text().then(y=>{var _;if(u)return;const b={statusCode:g.status,text:y};if(g.status===200)try{b.json=JSON.parse(y)}catch(E){S.error(E)}u=!0,v(),(_=e.callback)===null||_===void 0||_.call(e,b,rc(()=>g.headers.get("Retry-After")))})).catch(g=>{v(),h(g)}).finally(v)}catch(f){v(),h(f)}},Ir=e=>{try{var t;const{url:i,encodedBody:s}=tc(e),{contentType:r,body:n,estimatedSize:o}=s??{};if(!n)return;const a=n instanceof Blob?n:new Blob([n],{type:r});if(ve.sendBeacon(i,a))return;const l=I(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(I(l)&&l.length>1&&(o??0)>16384){const c=Math.ceil(l.length/2),u=h=>I(e.data)?h:p(p({},e.data),{},{batch:h});Ir(p(p({},e),{},{data:u(l.slice(0,c))})),Ir(p(p({},e),{},{data:u(l.slice(c))}));return}S.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${yi?"fetch":"XHR"}`),yi?oc(p(p({},e),{},{kl:!0})):nc(e)}catch(i){S.warn("Beacon send failed",i)}},_o=(e,t,i,s)=>{const r=s==="query"?t==="POST"?"sent_at":"_":void 0;return fs(i===Pe.GZipJS?ec(e,"compression"):e,p(p({},r?{[r]:Date.now().toString()}:{}),i===Pe.GZipJS?{}:{compression:i}))},gh=(()=>{const e=[];return yi&&e.push({transport:"fetch",method:oc}),Dr&&e.push({transport:"XHR",method:nc}),ve!=null&&ve.sendBeacon&&e.push({transport:"sendBeacon",method:Ir}),e})(),ac=!vh&&ye?.indexOf("MSIE")===-1&&ye?.indexOf("Mozilla")===-1;function lc(e,t,i){var s,r,n;i&&(t=p(p({},t),{},{callback:o=>i(o)})),e.__loaded?ac?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((r=t.callback)===null||r===void 0||r.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=p(p({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(s=e.compression)!==null&&s!==void 0?s:t.compressionFallback:t.compression,(x(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((o,a)=>{var l,c,u;const h=p(p({},o),{},{callback:a??(g=>{var y;return(y=o.callback)===null||y===void 0?void 0:y.call(o,g)})});h.timeout=h.timeout||6e4;const d=(l=h.transport)!==null&&l!==void 0?l:"fetch";d==="sendBeacon"&&x(h.compression)&&h.data&&(h.compression=Pe.Base64),h.method==="POST"&&h.data&&(h.timestampMode==="capture-body"?h.data=(g=>{var y,_;const b=(I(g)?g:[g]).map(k=>p(p({},k),k.timestamp instanceof Date&&!isNaN(k.timestamp.getTime())?{timestamp:k.timestamp.toISOString()}:{})),E=b[0];return{api_key:(y=E==null||(_=E.properties)===null||_===void 0?void 0:_.token)!==null&&y!==void 0?y:E?.token,batch:b,sent_at:new Date().toISOString()}})(h.data):h.timestampMode==="body"&&(h.data=((g,y=new Date().toISOString())=>I(g)?g.map(_=>p(p({},_),{},{sent_at:y})):p(p({},g),{},{sent_at:y}))(h.data))),h.url=_o(h.url,h.method,h.compression,h.timestampMode);const v=gh.filter(g=>!h.disableTransport||!g.transport||!h.disableTransport.includes(g.transport)),f=(c=(u=(function(g,y){for(let _=0;g.length>_;_++)if(y(g[_]))return g[_]})(v,g=>g.transport===d))===null||u===void 0?void 0:u.method)!==null&&c!==void 0?c:v[0].method;if(!f)throw new Error("No available transport method");const m=g=>{try{f(g)}catch(_){var y;sc(_)?S.warn(_):S.error(_),(y=h.callback)===null||y===void 0||y.call(h,{statusCode:0,error:_})}};d!=="sendBeacon"&&!h.preferSyncCompression&&h.data&&h.compression===Pe.GZipJS&&Oc&&typeof Promise<"u"&&!Vi?ph(h).then(g=>{m(g)}).catch(g=>{if(Tn(g))return Vi=!0,void m(p(p({},h),{},{compression:void 0,url:_o(o.url,o.method,void 0,o.timestampMode)}));(y=>{if(!y||typeof y!="object")return!1;const _="name"in y?String(y.name):"";return Tn(y)||_===qa})(g)&&(Vi=!0),m(h)}):m(h)})(t,(o,a)=>{var l,c,u;e.rateLimiter.checkForLimiting(o),400>o.statusCode||(l=(c=e.config).on_request_error)===null||l===void 0||l.call(c,o),i?i(o,a):(u=t.callback)===null||u===void 0||u.call(t,o)})):t.fireCallbackOnDrop&&((n=t.callback)===null||n===void 0||n.call(t,{statusCode:0}))}var _h=class{constructor(e,t){this.Zu=!0,this.Ju=[],this.Ku=qe(t?.flush_interval_ms||3e3,250,5e3,S.createLogger("flush interval"),3e3),this.Xu=e}enqueue(e){this.Ju.push(e),this.Yu||this.tc()}unload(){this.ec();const e=this.Ju.length>0?this.nc():{},t=Object.values(e);[...t.filter(i=>i.url.indexOf("/e")===0),...t.filter(i=>i.url.indexOf("/e")!==0)].map(i=>{this.sc(p(p({},i),{},{callback:void 0}),"sendBeacon")})}enable(){this.Zu=!1,this.tc()}tc(){this.Zu||(this.Yu=setTimeout(()=>{this.ec(),this.rc()},this.Ku))}rc(){if(this.Ju.length>0){const e=this.nc();for(const t in e)this.sc(e[t])}}sc(e,t){try{this.Xu(e,t)}catch(i){S.error(i)}}ec(){clearTimeout(this.Yu),this.Yu=void 0}nc(){const e={},t={};J(this.Ju,i=>{var s;const r=i,n=((r?r.batchKey:null)||r.url)+(r.batchGroup?`:${r.batchGroup}`:"");x(e[n])&&(e[n]=p(p({},r),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),t[n]=[]),(s=e[n].data)===null||s===void 0||s.push(r.data),r.callback&&t[n].push(r.callback)});for(const i in t){const s=t[i];s.length&&(e[i].callback=r=>{for(const n of s)n(r)})}return this.Ju=[],e}},mh=["retriesPerformedSoFar"],yh=class{constructor(e){this._instance=e,this.oc=!1,this.ac=3e3,this.Ju=[],this.Ju=[],this.lc=!0,this.resume()}resume(){if(!x(w)&&"onLine"in w.navigator){if(this.lc=w.navigator.onLine,this.uc)return;this.uc=()=>{this.lc=!0,this.rc()},this.cc=()=>{this.lc=!1},z(w,"online",this.uc),z(w,"offline",this.cc)}}get length(){return this.Ju.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,s=Ua(e,mh);Be(i)&&(s.url=fs(s.url,{retry_count:i})),lc(this._instance,t?p(p({},s),{},{transport:t}):s,(r,n)=>{var o;if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(i??0))return void this.Ls(p({retriesPerformedSoFar:i},s),n);r.statusCode===0&&S.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${i??0} retries.`)}(o=s.callback)===null||o===void 0||o.call(s,r)})}Ls(e,t){const i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;const s=Math.max((function(o){const a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)})(i),t??0),r=Date.now()+s;this.Ju.push({retryAt:r,requestOptions:e});let n=`Enqueued failed request for retry in ${s}`;navigator.onLine||(n+=" (Browser is offline)"),S.warn(n),this.oc||(this.oc=!0,this.hc())}hc(){if(this.dc&&clearTimeout(this.dc),this.Ju.length===0)return this.oc=!1,void(this.dc=void 0);this.dc=setTimeout(()=>{this.lc&&this.Ju.length>0&&this.rc(),this.hc()},this.ac)}rc(){const e=Date.now(),t=[],i=this.Ju.filter(s=>e>s.retryAt||(t.push(s),!1));if(this.Ju=t,i.length>0)for(const{requestOptions:s}of i)this.retriableRequest(s)}unload(){this.dc&&(clearTimeout(this.dc),this.dc=void 0),this.oc=!1,x(w)||(this.uc&&(w.removeEventListener("online",this.uc),this.uc=void 0),this.cc&&(w.removeEventListener("offline",this.cc),this.cc=void 0));for(const{requestOptions:e}of this.Ju)try{this._instance._send_request(p(p({},e),{},{callback:I(e.data)?void 0:e.callback,transport:"sendBeacon"}))}catch(t){S.error(t)}this.Ju=[]}},bh=class{constructor(e){this._instance=e,this.vc=()=>{var t,i,s,r;this.fc||(this.fc={});const n=this.scrollElement(),o=this.scrollY(),a=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=o+(n?.clientHeight||0),c=n?.scrollHeight||0;this.fc.lastScrollY=Math.ceil(o),this.fc.maxScrollY=Math.max(o,(t=this.fc.maxScrollY)!==null&&t!==void 0?t:0),this.fc.maxScrollHeight=Math.max(a,(i=this.fc.maxScrollHeight)!==null&&i!==void 0?i:0),this.fc.lastContentY=l,this.fc.maxContentY=Math.max(l,(s=this.fc.maxContentY)!==null&&s!==void 0?s:0),this.fc.maxContentHeight=Math.max(c,(r=this.fc.maxContentHeight)!==null&&r!==void 0?r:0)}}get gc(){return this._instance.config.scroll_root_selector}getContext(){return this.fc}resetContext(){const e=this.fc;return this.fc=void 0,setTimeout(this.vc,0),e}startMeasuringScrollPosition(){z(w,"scroll",this.vc,{capture:!0}),z(w,"scrollend",this.vc,{capture:!0}),z(w,"resize",this.vc)}scrollElement(){if(this.gc){const i=I(this.gc)?this.gc:[this.gc];for(const s of i){var e;const r=w==null||(e=w.document)===null||e===void 0?void 0:e.querySelector(s);if(r)return r}return}var t;return w==null||(t=w.document)===null||t===void 0?void 0:t.documentElement}mc(e){var t,i;const s=e==="y"?"scrollTop":"scrollLeft";if(this.gc){const r=this.scrollElement();return r&&r[s]||0}return w?e==="y"?w.scrollY||w.pageYOffset||((t=w.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:w.scrollX||w.pageXOffset||((i=w.document)===null||i===void 0||(i=i.documentElement)===null||i===void 0?void 0:i.scrollLeft)||0:0}scrollY(){return this.mc("y")}scrollX(){return this.mc("x")}},wh=e=>zl(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes),mo=class{constructor(e,t,i,s){this.qe=r=>{const n=this.yc();if(n&&n.sessionId===r)return;const o={sessionId:r,props:this.bc(this._instance)};this._c.register({[$r]:o})},this._instance=e,this.wc=t,this._c=i,this.bc=s||wh,this.wc.onSessionId(this.qe)}yc(){return this._c.props[$r]}getSetOnceProps(){var e;const t=(e=this.yc())===null||e===void 0?void 0:e.props;return t?"r"in t?Vl(t,this._instance.config.disable_capture_url_hashes):{$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(){const e={};return J(Qr(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e[`$session_entry_${nr(i)}`]=t}),e}},cs=class{on(e,t){return this.bo[e]||(this.bo[e]=[]),this.bo[e].push(t),()=>{this.bo[e]=this.bo[e].filter(i=>i!==t)}}emit(e,t){for(const i of this.bo[e]||[])i(t);for(const i of this.bo["*"]||[])i(e,t)}constructor(){this.bo={}}},St=te("[SessionId]"),yo=864e5,bo=class{on(e,t){return this.kc.on(e,t)}constructor(e,t,i){var s;if(this.Sc=null,this.xc=null,this.$c=[],this.Cc=void 0,this.Tc=!1,this.kc=new cs,this.Ic=(n,o)=>!(!Be(n)||!Be(o))&&Math.abs(n-o)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ar=e.config,this._c=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Mc=void 0,this._sessionActivityTimestamp=null,this.Ec=t||Me,this.Pc=i||Me;const r=this.Ar.persistence_name||this.Ar.token;if(this._sessionTimeoutMs=1e3*qe(this.Ar.session_idle_timeout_seconds||1800,60,36e3,St.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Rc(),this.Ac="ph_"+r+"_window_id",this.Fc="ph_"+r+"_primary_window_exists",this.Oc()){const n=X.Lt(this.Ac),o=X.Lt(this.Fc);n&&!o?this.je=n:X.Pt(this.Ac),X.At(this.Fc,!0)}(s=this.Ar.bootstrap)!==null&&s!==void 0&&s.sessionID&&this.setBootstrapSessionId(this.Ar.bootstrap.sessionID),this.Dc()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return x(this.$c)&&(this.$c=[]),this.$c.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.$c=this.$c.filter(t=>t!==e)}}Oc(){return this.Ar.persistence!=="memory"&&!this._c.hi&&X.Et()}Lc(e){e!==this.je&&(this.je=e,this.Oc()&&X.At(this.Ac,e))}Nc(){return this.je?this.je:this.Oc()?X.Lt(this.Ac):null}qc(e){const t=this.Sc;return!se(t)&&!se(e)&&5e3>Math.abs(e-t)}jc(e,t,i){const s=t!==this._sessionActivityTimestamp,r=!(e!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Xt=e,r&&!s||r&&this.qc(t)||(this.Sc=t,this._c.register({[Ct]:[t,e,i]}))}Bc(){var e;const t=(e=this.Ar)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Be(t)&&t>0}zc(){this.Bc()?this._c.refreshKey(Ct):(this._c.flush(),this._c.load())}Hc(){var e;if(se(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Sc)return;this.zc();const[,t,i]=this.Uc();t===this.Xt&&i===this._sessionStartTimestamp&&(this.Sc=this._sessionActivityTimestamp,this._c.register({[Ct]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this._c.flush())}Wc(){const[e]=this.Uc(),t=Be(e)?e:0,i=Be(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}Vc(e){return this.zc(),this.Ic(e,this.Wc())}Uc(){const e=this._c.props[Ct];return I(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Sc=null,this.Mc=void 0,clearTimeout(this.Gc),this.Gc=void 0,this.jc(null,null,null)}setBootstrapSessionId(e,t=!1){const i=((s,r=new Date().getTime())=>{try{const n=(o=>{const a=o.replace(/-/g,"");if(a.length!==32)throw new Error("Not a valid UUID");if(a[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(a.substring(0,12),16)})(s);return n>r+6e4?void St.error("Bootstrap sessionID cannot be in the future"):n}catch(n){St.error("Invalid sessionID in bootstrap",n);return}})(e);return!x(i)&&(t?this.Mc={sessionId:e,sessionStartTimestamp:i}:this.jc(e,new Date().getTime(),i),!0)}destroy(){this.Tc=!0,this.Hc(),clearTimeout(this.Gc),this.Gc=void 0,this.Cc&&w&&(w.removeEventListener(rs,this.Cc,{capture:!1}),this.Cc=void 0),this.$c=[]}Dc(){this.Cc=()=>{this.Hc(),this.Oc()&&X.Pt(this.Fc)},z(w,rs,this.Cc,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if(this.Ar.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=t||new Date().getTime(),r=this.Xt;if(i)this.xc=s;else if(se(this.xc)||this.xc>s||s-this.xc>=1e3){var n,o;(n=(o=this._c).syncCookieProperties)===null||n===void 0||n.call(o),this.xc=s}let[,a,l]=this.Uc();const c=!x(r)&&a!==r,u=this.Wc();let h=this.Nc();const d=this.Mc,v=!!d&&(d.sessionStartTimestamp>s+6e4||s-d.sessionStartTimestamp>yo),f=d?v:Be(l)&&Math.abs(s-l)>yo;let m=!1,g=c,y=!a||!!d;const _=a;let b=!y&&!e&&this.Ic(s,u);if(b&&(b=this.Vc(s),b||St.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Uc(),b||(y=!a||!!d)),y||b||f){g=!1;const A=d&&!v;a=A?d.sessionId:this.Ec(),h=this.Pc(),St.info("new session ID assigned",{sessionId:a,windowId:h,bootstrapped:!!A,changeReason:{noSessionId:y,activityTimeout:b,sessionPastMaximumLength:f}}),l=A?d.sessionStartTimestamp:s,this.Mc=void 0,m=!0}else h||(h=this.Pc(),m=!0),g=g||a!==_,g&&(St.info("adopted cross-tab session id",{sessionId:a,windowId:h}),m=!0);const E=Be(u)&&e&&!f?u:s,k=Be(l)?l:new Date().getTime();this.Lc(h),this.jc(a,E,k),e||this.Rc();const $={noSessionId:y,activityTimeout:b,sessionPastMaximumLength:f,crossTabAdoption:g};return m&&this.$c.forEach(A=>A(a,h,$)),{sessionId:a,windowId:h,sessionStartTimestamp:k,changeReason:m?$:void 0,lastActivityTimestamp:u}}Rc(){this.Tc||(clearTimeout(this.Gc),this.Gc=setTimeout(()=>{if(!this.Tc)if(this.Vc(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.kc.emit("forcedIdleReset",{idleSessionId:e})}else this.Rc()},1.1*this.sessionTimeoutMs))}},wo=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),cc=function(e,t){if(!e)return!1;const i=e.userAgent;if(i&&fn(i,t))return!0;try{const s=e?.userAgentData;if(s?.brands&&s.brands.some(r=>fn(r?.brand,t)))return!0}catch{}return!!e.webdriver};function uc(){return(uc=Q(function*(){const e=ve?.userAgentData;if(e?.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),i=t?.model;return N(i)&&i.length>0?i:void 0}catch(t){S.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t);return}})).apply(this,arguments)}function xh(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function dc(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}var us=(e,t)=>{if(!(i=>{try{new RegExp(i)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Ri=e=>e.toLowerCase(),hc={exact:(e,t)=>t.some(i=>e.some(s=>i===s)),is_not:(e,t)=>t.every(i=>e.every(s=>i!==s)),regex:(e,t)=>t.some(i=>e.some(s=>us(i,s))),not_regex:(e,t)=>t.every(i=>e.every(s=>!us(i,s))),icontains:(e,t)=>t.map(Ri).some(i=>e.map(Ri).some(s=>i.includes(s))),not_icontains:(e,t)=>t.map(Ri).every(i=>e.map(Ri).every(s=>!i.includes(s))),gt:(e,t)=>t.some(i=>{const s=parseFloat(i);return!isNaN(s)&&e.some(r=>s>parseFloat(r))}),lt:(e,t)=>t.some(i=>{const s=parseFloat(i);return!isNaN(s)&&e.some(r=>s<parseFloat(r))})};function vc(e,t){return!e||Object.entries(e).every(([i,s])=>{const r=t?.[i];if(r==null)return!1;const n=hc[s.operator];return!!n&&n(s.values.map(String),[String(r)])})}function Ws(e,t,i){return Ft({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var Fr="custom",xo="i.posthog.com",$h=/^\/static\//,Eh=["/s/","/e/","/i/"],kh=class{constructor(e){this.Qc={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${xo}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Qc[this.apiHost]||(this.Qc[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":Fr),this.Qc[this.apiHost]}Zc(e){if(!$h.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}Jc(e){const t=Ye(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}Kc(e,t,i){if(e==="ui")return i;let s=i;const r=this.instance.config.rewriteRequestPath;if(r){var n;const o=((n=Ye(i))===null||n===void 0?void 0:n.href)||i;s=r(new URL(o)).toString()}if(r&&e==="api"&&Eh.some(o=>t.indexOf(o)===0)){const o=this.Jc(s);if(o){const a=this.apiHost;let l=this.Xc;l?.apiHost===a&&l.rewriteRequestPath===r||(l={apiHost:a,rewriteRequestPath:r,urls:new Set},this.Xc=l),l.urls.add(o)}}return s}isIngestionEndpoint(e){const t=this.Xc,i=this.Jc(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.Kc(e,t,this.uiHost+t);if(e==="flags")return this.Kc(e,t,this.flagsApiHost+t);if(e==="assets"){const s=this.Zc(t);if(s)return this.Kc(e,t,`${s}${t}`)}if(this.region===Fr)return this.Kc(e,t,this.apiHost+t);const i=xo+t;switch(e){case"assets":return this.Kc(e,t,`https://${this.region}-assets.${i}`);case"api":return this.Kc(e,t,`https://${this.region}.${i}`)}}},G=te("[Surveys]"),pc=e=>{try{const t=(i=>((s,r)=>`seenSurvey_${(function(n){return n.current_iteration&&n.current_iteration>0?`${n.id}_${n.current_iteration}`:n.id})(r)}`)(0,i))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){G.error("Failed to persist survey seen state",t)}},Sh=[qs.Popover,qs.Widget,qs.API],Ph={ignoreConditions:!1,ignoreDelay:!1,displayType:Ar.Popover},Ah=te("[PostHog ExternalIntegrations]"),Oh={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Ch=class{constructor(e){this._instance=e}Ml(e,t){var i,s;(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,e,r=>{if(r)return Ah.error("failed to load script",r);t()})}startIfEnabledOrStop(){var e;for(const[r,n]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,i,s;n&&!((t=R.__PosthogExtensions__)!==null&&t!==void 0&&(t=t.integrations)!==null&&t!==void 0&&t[r])&&this.Ml(Oh[r],()=>{var o;(o=R.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[r])===null||o===void 0||o.start(this._instance)}),!n&&(i=R.__PosthogExtensions__)!==null&&i!==void 0&&(i=i.integrations)!==null&&i!==void 0&&i[r]&&((s=R.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0||(s=s[r])===null||s===void 0||s.stop())}}},fc=class{constructor(e){this.disabled=e===!1;const t=D(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;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.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}},Rr=()=>typeof window>"u"?void 0:window,ti=()=>typeof document>"u"?void 0:document,Gs="$copy_autocapture",Th=["password","hidden","file","checkbox","button","submit","reset","image"],Mi=te("[AutoCapture]");function Js(e,t){return t.length>e?t.slice(0,e)+"...":t}function Ih(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Ie(t));return t}function Fh(e,{e:t,maskAllElementAttributes:i,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:n,disableCaptureUrlHashes:o}){var a,l;if(!Ie(e))return{props:{}};const c=[e],u=new Set([e]);let h=e;for(;h.parentNode&&!ae(h,"body")&&1e3>c.length;){if(ns(h.parentNode)){const $=h.parentNode.host;if(u.has($))break;u.add($),c.push($),h=$;continue}if(!Ie(h.parentNode)||u.has(h.parentNode))break;u.add(h.parentNode),c.push(h.parentNode),h=h.parentNode}const d=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?c.findIndex($=>ae($,"button")||ae($,"a")):-1;d>0&&(s=s||c.slice(0,d+1).some($=>!at($)||qt($)));const v=[],f={};let m,g=!1,y=!1;if(J(c,$=>{const A=at($);if(ae($,"a")&&!i&&!r?.includes("href")){const P=$.getAttribute("href");g=!!(A&&P&&Dt(P))&&(o?lt(P):P)}T(yt($),"ph-no-capture")&&(y=!0),v.push((function(P,M,B,V,F=!1){const W=P.tagName.toLowerCase(),C={tag_name:W};en.indexOf(W)>-1&&!B&&(C.$el_text=W.toLowerCase()==="a"||W.toLowerCase()==="button"?Js(1024,so(P)):Js(1024,xi(P)));const j=yt(P);M||V!=null&&V.includes("class")||0>=j.length||(C.classes=j.filter(function(ie){return ie!==""})),J(P.attributes,function(ie){var he;if((!qt(P)||["name","id","class","aria-label"].indexOf(ie.name)!==-1)&&!V?.includes(ie.name)&&!M&&Dt(ie.value)&&(!N(he=ie.name)||he.substring(0,10)!=="_ngcontent"&&he.substring(0,7)!=="_nghost")){let ce=ie.value;ie.name==="class"&&(ce=Zr(ce).join(" ")),C["attr__"+ie.name]=Js(1024,ie.name==="href"&&F?lt(ce):ce)}});let U=1,Y=1,q=P;for(;q=Ih(q);)U++,q.tagName===P.tagName&&Y++;return C.nth_child=U,C.nth_of_type=Y,C})($,i,s,r,o)),J((function(P){if(!at(P))return{};const M={};return J(P.attributes,function(B){if(B.name&&B.name.indexOf("data-ph-capture-attribute")===0){const V=B.name.replace("data-ph-capture-attribute-",""),F=B.value;V&&F&&Dt(F)&&(M[V]=F)}}),M})($),(P,M)=>{({}).hasOwnProperty.call(f,M)||(f[M]=P)})}),y)return{props:{},explicitNoCapture:y};if(d>0&&(e=c[d],v.splice(0,d)),s||(v[0].$el_text=ae(e,"a")||ae(e,"button")?so(e):xi(e)),g){var _,b;v[0].attr__href=g;const $=(_=Ye(g))===null||_===void 0?void 0:_.host,A=(b=Rr())===null||b===void 0||(b=b.location)===null||b===void 0?void 0:b.host;$&&A&&$!==A&&(m=g)}return{props:ee((k=t.type,{$event_type:k,$ce_version:1}),n?{}:{$elements:v},{$elements_chain:(E=v,I(E)?(function($){return $.map(A=>{var P,M;let B="";if(A.tag_name&&(B+=A.tag_name),A.attr_class){A.attr_class.sort();for(const W of A.attr_class)B+=`.${W.replace(/"/g,"")}`}const V=p(p(p(p({},A.text?{text:A.text}:{}),{},{"nth-child":(P=A.nth_child)!==null&&P!==void 0?P:0,"nth-of-type":(M=A.nth_of_type)!==null&&M!==void 0?M:0},A.href?{href:A.href}:{}),A.attr_id?{attr_id:A.attr_id}:{}),A.attributes),F={};return Bi(V).sort(([W],[C])=>(function(j,U){return U>j?-1:j>U?1:0})(W,C)).forEach(([W,C])=>F[ro(W.toString())]=ro(C.toString())),B+=":",B+=Bi(F).map(([W,C])=>`${W}="${C}"`).join(""),B}).join(";")})((function($){return $.map(A=>{var P,M;const B={text:(P=A.$el_text)===null||P===void 0?void 0:P.slice(0,400),tag_name:A.tag_name,href:(M=A.attr__href)===null||M===void 0?void 0:M.slice(0,2048),attr_class:Gd(A),attr_id:A.attr__id,nth_child:A.nth_child,nth_of_type:A.nth_of_type,attributes:{}};return Bi(A).filter(([V])=>V.indexOf("attr__")===0).forEach(([V,F])=>B.attributes[V]=F),B})})(E)):"")},!((a=v[0])===null||a===void 0)&&a.$el_text?{$el_text:(l=v[0])===null||l===void 0?void 0:l.$el_text}:{},m&&t.type==="click"?{$external_click_url:m}:{},f),target:e};var E,k}var gc="autocapture",Rh=class{el(){this.il=void 0,clearTimeout(this.nl),this.nl=void 0}sl(e){var t;if(!at(e))return!0;const i=(t=this.rl().css_selector_ignorelist)!==null&&t!==void 0?t:Oi,s=new Set;let r=e;for(;r;){if(s.size>=1e3||s.has(r))return!0;s.add(r);const n=r,o=yt(n);if(T(o,"ph-no-capture")||T(o,"ph-sensitive")||qt(n)||i.some(l=>ni(n,l)))return!0;const a=r.parentNode;r=ns(a)?a.host:a&&Ie(a)?a:null}return!1}ol(e){if(!this.isEnabled||e.type==="pointercancel")return void this.el();if(e.type==="pointerdown"){var t;this.el();const s=pi(e);e.isPrimary&&e.button===0&&!e.ctrlKey&&s&&Ie(s)&&(this.il={target:s,excluded:this.sl(s),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.xa)===null||t===void 0?void 0:t.distinctId});return}const i=this.il;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this.el():e.type==="pointerup"&&(i.released=!0,this.nl=setTimeout(()=>this.el(),0)))}al(e){var t;const i=this.il;this.el();const s=pi(e);if(i?.released&&i.target.isConnected&&i.distinctId===((t=this.xa)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&s&&(ae(s,"html")||ae(s,"body"))){var r,n,o;if(i.excluded)return null;const a=(r=this.rl().css_selector_ignorelist)!==null&&r!==void 0?r:Oi;return[s,(n=ti())===null||n===void 0?void 0:n.documentElement,(o=ti())===null||o===void 0?void 0:o.body].some(l=>{if(!l)return!1;const c=yt(l);return T(c,"ph-no-capture")||T(c,"ph-sensitive")||!at(l)||qt(l)||a.some(u=>ni(l,u))})?null:i.target}}constructor(e){this.Ta=e,this.name=gc,this.ll=!1,this.ul=null,this.cl=!1,this.hl=new Map,this.dl=!1,this.Ar={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Ci=!1,this.Ta.refresh(this.Ar),this.rageclicks=new fc(this.Ar.rageclick),this.vl=null}setup(e){this.fl(),this.xa=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Ci?t.dispose():(this.qa=t,this.startIfEnabled())}dispose(){var e;this.Ci||(this.Ci=!0,this.xa=void 0,(e=this.qa)===null||e===void 0||e.dispose(),this.qa=void 0,this.hl.clear(),this.vl=null,this.pl())}rl(){return this.Ta.refresh(this.Ar),this.Ar}fl(){var e,t;return this.rl(),this.Ar.url_allowlist=(e=this.Ar.url_allowlist)===null||e===void 0?void 0:e.map(i=>new RegExp(i)),this.Ar.url_ignorelist=(t=this.Ar.url_ignorelist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),this.Ar}gl(){const e=Rr(),t=ti();if(!this.isBrowserSupported())return void Mi.info("Disabling Automatic Event Collection because this browser is not supported");if(!e||!t)return;this.ml=e,this.yl=t;const i=this.bl=s=>{s=s||e?.event;try{if(s.type==="blur")return void this.el();if(s.type.indexOf("pointer")===0)return void this.ol(s);const r=s.type==="click"?this.al(s):void 0;if(se(r))return;this._l(s,"$autocapture",r)}catch(r){Mi.error("Failed to capture event",r)}};if(z(e,"blur",i),z(t,"submit",i,{capture:!0}),z(t,"change",i,{capture:!0}),z(t,"click",i,{capture:!0}),J(["pointerdown","pointermove","pointerup","pointercancel"],s=>{z(t,s,i,{capture:!0})}),this.rl().capture_copied_text){const s=this.wl=r=>{r=r||e?.event;try{this._l(r,Gs)}catch(n){Mi.error("Failed to capture clipboard event",n)}};z(t,"copy",s,{capture:!0}),z(t,"cut",s,{capture:!0}),z(t,"paste",s,{capture:!0})}}pl(){const e=this.ml,t=this.yl;this.el(),this.bl&&(e?.removeEventListener("blur",this.bl),J(["pointerdown","pointermove","pointerup","pointercancel"],i=>{t?.removeEventListener(i,this.bl,!0)}),t?.removeEventListener("submit",this.bl,!0),t?.removeEventListener("change",this.bl,!0),t?.removeEventListener("click",this.bl,!0),this.bl=void 0),this.wl&&(t?.removeEventListener("copy",this.wl,!0),t?.removeEventListener("cut",this.wl,!0),t?.removeEventListener("paste",this.wl,!0),this.wl=void 0),this.ml=void 0,this.yl=void 0,this.ll=!1}startIfEnabled(){this.isEnabled||this.el(),!this.Ci&&this.xa&&this.isEnabled&&!this.ll&&(this.gl(),this.ll=!0)}onRemoteConfig(e){if(this.Ci)return;if(this.cl=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.dl=t.elementsChainAsString);const i=t.autocapture_opt_out;var s;be(i)&&((s=this.xa)===null||s===void 0||s.kv.set("$autocapture_disabled_server_side",i),this.ul=i),this.startIfEnabled()}setElementSelectors(e,t=this){if(this.Ci)return;e.size?this.hl.set(t,new Set(e)):this.hl.delete(t);const i=new Set;this.hl.forEach(s=>{s.forEach(r=>i.add(r))}),this.vl=i}getElementSelectors(e,t){var i;const s=[];return(i=this.vl)===null||i===void 0||i.forEach(r=>{var n;((n=ti())===null||n===void 0?void 0:n.querySelectorAll(r))?.forEach(o=>{e!==o&&t!==o||T(s,r)||s.push(r)})}),s}get isEnabled(){var e,t;if(this.Ci)return!1;const i=(e=this.xa)===null||e===void 0?void 0:e.kv.get(sl),s=this.ul,r=this.rl();if(!r.remoteRequestsDisabled&&!this.cl)return!1;const n=r.remoteRequestsDisabled&&!this.cl;if(se(s)&&!be(i)&&!n)return!1;const o=(t=this.ul)!==null&&t!==void 0?t:!!i;return!!r.enabled&&!o}_l(e,t="$autocapture",i){if(!this.isEnabled)return void this.el();let s=i||pi(e);Sl(s)&&(s=s.parentNode||null);const r=this.fl();var n;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&r.rageclick&&(n=this.rageclicks)!==null&&n!==void 0&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Cl(s,r.rageclick)&&this._l(e,"$rageclick",i);const o=t===Gs,a=o?p(p({},r),{},{dom_event_allowlist:void 0}):r;if(s&&(function(d,v,f,m,g,y){var _;const b=typeof window>"u"?void 0:window;if(!b||sn(d)||f?.url_allowlist&&!Yn(f.url_allowlist,y)||f?.url_ignorelist&&Yn(f.url_ignorelist,y))return!1;if(f?.dom_event_allowlist){const A=f.dom_event_allowlist;if(A&&!A.some(P=>v.type===P))return!1}const{parentIsUsefulElement:E,targetElementList:k}=Tl(d,m);if(!(function(A,P){const M=P?.element_allowlist;if(x(M))return!0;for(const B of A)if(M.some(V=>B.tagName.toLowerCase()===V))return!0;return!1})(k,f)||!Pr(k,f?.css_selector_allowlist)||Pr(k,(_=f?.css_selector_ignorelist)!==null&&_!==void 0?_:Oi))return!1;try{const A=b.getComputedStyle(d);if(A&&A.getPropertyValue("cursor")==="pointer"&&v.type==="click")return!0}catch{}const $=d.tagName.toLowerCase();switch($){case"html":return!1;case"form":return(g||["submit"]).indexOf(v.type)>=0;case"input":case"select":case"textarea":return(g||["change","click"]).indexOf(v.type)>=0;default:return E?(g||["click"]).indexOf(v.type)>=0:(g||["click"]).indexOf(v.type)>=0&&(en.indexOf($)>-1||d.getAttribute("contenteditable")==="true")}})(s,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var l;const{props:d,explicitNoCapture:v,target:f}=Fh(s,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.dl,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(v)return!1;const m=this.getElementSelectors(s,f);if(m&&m.length>0&&(d.$element_selectors=m),t===Gs){const g=e.type||"clipboard";if(g!=="paste"){var c,u;const y=(c=Rr())===null||c===void 0||(c=c.getSelection())===null||c===void 0?void 0:c.toString(),_=Pl(y);if(!_)return!1;d.$selected_content=_,d.$clipboard_text_length=(u=y?.length)!==null&&u!==void 0?u:0}d.$copy_type=g}if(t==="$autocapture"&&e.type==="change"&&r.capture_value_css_selector_allowlist&&!r.maskAllText&&(ae(h=s,"input")?!T(Th,h.type):ae(h,"textarea")||ae(h,"select")&&!h.multiple)&&(function(g,y){var _;if(!at(g))return!1;const b=(_=y.css_selector_ignorelist)!==null&&_!==void 0?_:Oi,E=new Set;let k=g;for(ae(g,"select")&&(k=g.options[g.selectedIndex]||g);k;){const $=k,A=yt($);if(E.size>=1e3||E.has(k)||T(A,"ph-sensitive")||T(A,"ph-no-capture")||b.some(M=>ni($,M)))return!1;E.add(k);const P=k.assignedSlot||k.parentNode;k=ns(P)?P.host:P&&Ie(P)?P:null}return!0})(s,r)&&!s.querySelector(".ph-no-capture, .ph-sensitive")){const g=r.capture_value_css_selector_allowlist;let y=!1;try{y=ne(g)?!!g(s):I(g)&&g.some(_=>ni(s,_))}catch(_){Mi.error("capture_value_css_selector_allowlist threw",_)}y&&(d.$input_value=s.value)}return(l=this.xa)===null||l===void 0||l.capture(t,d),!0}var h}isBrowserSupported(){var e;return ne((e=ti())===null||e===void 0?void 0:e.querySelectorAll)}},_c="featureFlags",mc="logs",Mh=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if(typeof e=="string")return t?.get_property(e);const i={};for(const s of e){const r=t?.get_property(s);x(r)||(i[s]=r)}return i}set(e,t){var i;(i=this._instance.persistence)===null||i===void 0||i.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}},Lh=class{constructor(e){this.instance=e,this.$=S,this.kv=new Mh(e),this.onSession=t=>Fi(this.instance.onSessionId(i=>{try{t(i)}catch(s){this.$.error("Browser extension session listener failed",s)}})),this.onEvent=t=>Fi(this.instance._addCaptureHook((i,s)=>{if(s)try{t({event:i,properties:s.properties})}catch(r){this.$.error("Browser extension event listener failed",r)}})),this.onRemoteConfig=t=>{const i=r=>{try{t(r)}catch(n){this.$.error("Browser extension remote config listener failed",n)}},s=this.instance.ur.on("extensionsRemoteConfig",i);return this.instance.cr&&i(this.instance.cr),Fi(s)}}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(Vr);return typeof e=="string"?e:void 0}get library(){return{name:$e.LIB_NAME,version:$e.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s,r;const n=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=n?.sessionId)!==null&&t!==void 0?t:"",windowId:(i=n?.windowId)!==null&&i!==void 0?i:"",sessionStartTimestamp:(s=n?.sessionStartTimestamp)!==null&&s!==void 0?s:0,lastActivityTimestamp:(r=n?.lastActivityTimestamp)!==null&&r!==void 0?r:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return ne(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(e){let t;switch(e){case _c:case"featureFlagsCommon":t=this.instance.featureFlags;break;case mc:t=this.instance.logs;break;case"surveys":t=this.instance.surveys;break;case gc:t=this.instance.autocapture}return t}capture(e,t,i){if(!i)return void this.instance.capture(e,t);const s=p({timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce},i.delivery==="unload"?{transport:"sendBeacon",send_instantly:!0}:{});this.instance.capture(e,t,s)}registerDynamicEventProperties(e){return Fi(this.instance.dr(e))}sendRequest(e){var t=this;return Q(function*(i,s={}){var r;const n=(r=s.target)!==null&&r!==void 0?r:"api",o=s.query?fs(i,s.query):i,a=t.instance.requestRouter.endpointFor(n,o),l={method:s.method,url:a,data:s.body,headers:s.headers,timeout:s.timeoutMs,fireCallbackOnDrop:!0,transport:s.transport,compression:s.compression,compressionFallback:s.target==="flags"&&s.compression==="best-available"?rr.Base64:void 0,timestampMode:s.sentAt};return n==="api"&&i==="/i/v1/logs"&&(l.batchKey="logs"),s.transport==="sendBeacon"?(t.instance._send_request(l),{statusCode:202}):new Promise(c=>{l.callback=c,t.instance._send_request(l)})}).apply(this,arguments)}},gi={},Ys=0,_i=()=>{},$o='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Pt="Surveys module not available",Eo="sanitize_properties is deprecated. Use before_send instead",yc="Invalid value for property_denylist config: ",Dh=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],Nh=["$feature_flag_called","$$heatmap","$snapshot"],ko=e=>e.charAt(0)==="$"&&!T(Nh,e),jh=/^[A-Za-z0-9_-]{1,400}$/,So=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Po=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,qh=["token","distinct_id",dl],oi="posthog",Uh=[...wo].sort()[wo.length-1],Hh=e=>{const t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},Ks=e=>{var t;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Id(O?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:_i,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_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:K&&N(K?.search)&&K.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,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(w==null||(t=w.location)===null||t===void 0?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,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(i){S.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:wl,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:_i},(i=>({rageclick:i&&i>="2026-05-30"?{content_ignorelist:tn,ignore_text_selection:!0}:!i||"2025-11-30">i||{content_ignorelist:!0},capture_pageview:!i||"2025-05-24">i||"history_change",session_recording:Hh(i),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,persistence_save_debounce_ms:i&&i>="2026-05-30"?250:0,split_storage:!(!i||"2026-05-30">i),detect_google_search_app:!(!i||"2026-05-30">i),disable_capture_url_hashes:!(!i||"2026-06-25">i),cookieWinsOnConflict:!(!i||i==="unset"||"2026-08-29">i)}))(e))},Bh=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],Ao=e=>{const t={};for(const[r,n]of Bh)x(e[r])||(t[n]=e[r]);const i=ee({},t,e),s=e.__preview_external_dependency_versioned_paths;return x(s)||(x(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),N(s)&&x(e.asset_host)&&(i.asset_host=s)),I(e.property_blacklist)&&(x(e.property_denylist)?i.property_denylist=e.property_blacklist:I(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:S.error(yc+e.property_denylist)),i},zh=class{constructor(){this.__forceAllowLocalhost=!1}get Yc(){return this.__forceAllowLocalhost}set Yc(e){S.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},mi=class it{th(t){if(!t)return;const i=this.eh.indexOf(t);i!==-1&&this.eh.splice(i,1)}ih(t,i){var s;return this.th(t),this.eh.push(i),(s=i.initialize)===null||s===void 0||s.call(i),i}nh(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}sh(){if(this.rh||this.config.reuseAnonymousId||this.config.segment||this.nh())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.oh)return;let i,s,r;t?(i=`persistence is set to '${this.config.persistence}'`,s=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",r="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",s="on every page load",r="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.rh=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${s}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${r}`)}ah(){const t=this.persistence;if(!t||this.uh)return;if(this.nh())return void(this.config.cookieless_mode==="on_reject"&&this.get_distinct_id()!=="$posthog_cookieless"&&(this.hh(),this.dh()));if(this.get_distinct_id()!=="$posthog_cookieless")return;this.fh()||t.load(!0);const i=this.get_distinct_id();if(!i||i==="$posthog_cookieless"){const s=this.config.get_device_id(Me());this.register({distinct_id:s,$device_id:s}),t.set_property(fe,Ge)}this.hh()}get decideEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.ph=!1,this.gh=!1,this.webPerformance=new zh,this.mh=!1,this.version=$e.LIB_VERSION,this.yh=new Set,this.bh="",this.ur=new cs,this.eh=[],this._h=[],this.wh=!1,this.oh=!1,this.rh=!1,this.uh=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ks(),this.SentryIntegration=Kd,this.sentryIntegration=s=>(function(r,n){const o=Rl(r,n);return{name:Fl,processEvent:a=>o(a)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kh=!1,this.Sh=null,this.xh=null,this.$h=null,this.scrollManager=new bh(this),this.pageViewManager=new ao(this),this.rateLimiter=new oh(this),this.requestRouter=new kh(this),this.consent=new jd(this),this.externalIntegrations=new Ch(this);const i=(t=it.__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.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(s,r,n)=>{const o=N(s)?{[s]:r}:s;this.setPersonProperties(o),n?.({})},set_once:(s,r,n)=>{const o=N(s)?{[s]:r}:s;this.setPersonProperties(void 0,o),n?.({})}},this.on("eventCaptured",s=>S.info(`send "${s?.event}"`,s))}init(t,i,s){if(s&&s!==oi){var r;const n=(r=gi[s])!==null&&r!==void 0?r:new it;return n._init(t,i,s),gi[s]=n,gi[oi][s]=n,n}return this._init(t,i,s)}_init(t,i={},s){var r,n,o;const a=N(t)?t.trim():"";if(!a)return S.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==((l=this.config)===null||l===void 0?void 0:l.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ks(i.defaults),i.debug=this.Ch(i.debug),this.Th=i,this.Ih=[],i.person_profiles?this.xh=i.person_profiles:i.process_person&&(this.xh=i.process_person);const c=Ks(i.defaults),u=Ao(i),h=ee({},c,u,{name:s,token:a});D(c.rageclick)&&D(u.rageclick)&&(h.rageclick=ee({},c.rageclick,u.rageclick)),D(c.session_recording)&&D(u.session_recording)&&(h.session_recording=ee({},c.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&S.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Pe.GZipJS;const d=this.fh(),v=!this.nh();if(this.persistence=new js(this.config,d,!0,v),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new js(p(p({},this.config),{},{persistence:"sessionStorage"}),d,!1,v),this.bh="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!d&&X.Et()){const _=X.Lt(this.bh);I(_)&&_.forEach(b=>{N(b)&&this.yh.add(b)})}else X.Pt(this.bh);const f=p({},this.persistence.props),m=p({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Mh=new _h((_,b)=>this.Eh(_,b),this.config.request_queue_config),this.Ph=new yh(this),this.__request_queue=[];const g=this.nh();g||(this.sessionManager=new bo(this),this.sessionPropsManager=new mo(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((_,b,E)=>{(E!=null&&E.activityTimeout||E!=null&&E.sessionPastMaximumLength||E!=null&&E.crossTabAdoption)&&this.Rh()})),this.Ah(),this.config.__preview_deferred_init_extensions?(S.info("Deferring extension initialization to improve startup performance"),this.Fh=setTimeout(()=>{this.Fh=void 0,this.Oh(g)},0)):(S.info("Initializing extensions synchronously"),this.Oh(g)),$e.DEBUG=$e.DEBUG||this.config.debug,$e.DEBUG&&S.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:f,s:m}),this.config.identity_distinct_id&&!((r=i.bootstrap)!==null&&r!==void 0&&r.distinctID)&&(i.bootstrap=p(p({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const y=(n=i.bootstrap)===null||n===void 0?void 0:n.distinctID;if(this.oh=!!y&&!ai(y),(o=i.bootstrap)===null||o===void 0?void 0:o.distinctID){const _=i.bootstrap.distinctID,b=this.get_distinct_id(),E=this.persistence.get_property(fe);if(i.bootstrap.isIdentifiedID&&b!=null&&b!==_&&E==="anonymous")this.identify(_);else if(i.bootstrap.isIdentifiedID&&b!=null&&b!==_&&E==="identified")S.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{const k=this.config.get_device_id(Me()),$=i.bootstrap.isIdentifiedID?k:_;this.persistence.set_property(fe,i.bootstrap.isIdentifiedID?Hi:Ge),this.register({distinct_id:_,$device_id:$})}}if(g)this.register_once({distinct_id:Ts,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(Me());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(fe,Ge)}return z(w,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),z(w,"pageshow",_=>{if(this.ph=!1,!this.gh){var b;if(_.persisted&&this.persistence){const E=this.persistence.get_property(Te),k=this.persistence.get_property(fe);this.persistence.load(),this.Dh()||E===this.persistence.get_property("distinct_id")&&k===this.persistence.get_property("$user_state")||this.Lh()}(b=this.Ph)===null||b===void 0||b.resume()}}),i.segment?oo(this,()=>this.Nh()):this.Nh(),ne(this.config._onCapture)&&this.config._onCapture!==_i&&(S.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&S.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return uc.apply(this,arguments)})().then(_=>{_&&this.register({[Cs]:_})}).catch(_i),this}qh(t){const i=t;return N(i.name)&&ne(i.setup)}jh(t,i){var s=this;this.qh(t)?i.push(Q(function*(){try{yield t.setup(s.Bh())}catch(n){S.error(`Failed to set up extension "${t.name}"`,n);try{var r;yield(r=t.dispose)===null||r===void 0?void 0:r.call(t)}catch(o){S.error(`Failed to dispose extension "${t.name}"`,o)}}})):this.eh.push(t)}Ah(){var t,i,s,r=this;const n=(t=(i=this.config.__extensionClasses)===null||i===void 0?void 0:i.featureFlags)!==null&&t!==void 0?t:(s=it.__defaultExtensionClasses)===null||s===void 0?void 0:s.featureFlags;var o,a,l;if(n)if(this.featureFlags&&this.featureFlags instanceof n||((o=this.zh)===null||o===void 0||o.call(this),this.zh=void 0,this.featureFlags=new n(this)),ne(this.featureFlags.onReloading)&&ne(this.featureFlags.setup)){if(!this.zh){this.zh=this.featureFlags.onReloading(()=>{this.ur.emit("featureFlagsReloading",!0)});const c=this.featureFlags;Q(function*(){try{yield c.setup(r.Bh())}catch(u){S.error("Failed to set up feature flags",u);const h=r.zh;r.zh=void 0;try{h?.()}catch(d){S.error("Failed to unsubscribe feature flag reloading",d)}try{yield c.dispose()}catch(d){S.error("Failed to dispose feature flags",d)}}})()}}else(a=(l=this.featureFlags).initialize)===null||a===void 0||a.call(l)}Oh(t){const i=performance.now(),s=p(p({},it.__defaultExtensionClasses),this.config.__extensionClasses),r=[];var n,o,a,l,c,u,h,d;s.exceptions&&this.eh.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new s.exceptions(this)),s.historyAutocapture&&this.eh.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.eh.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.eh.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this.eh.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||r.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.jh(this.autocapture=new s.autocapture(this),r),s.surveys&&this.jh(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new s.surveys(this),r),s.logs&&this.jh(this.logs=(a=this.logs)!==null&&a!==void 0?a:new s.logs(this),r),s.metrics&&this.eh.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new s.metrics(this)),s.conversations&&this.eh.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new s.conversations(this)),s.productTours&&this.eh.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.eh.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.eh.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.eh.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.eh.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,Yd)),s.toolbar&&this.eh.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new s.toolbar(this)),s.experiments&&this.eh.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new s.experiments(this)),s.webMCP&&this.eh.push(this.webMCP=(d=this.webMCP)!==null&&d!==void 0?d:new s.webMCP(this)),this.eh.forEach(v=>{v.initialize&&r.push(()=>{var f;(f=v.initialize)===null||f===void 0||f.call(v)})}),r.push(()=>{if(this.Hh){const v=this.Hh;this.Hh=void 0,this.eh.forEach(f=>{var m;return(m=f.onRemoteConfig)===null||m===void 0?void 0:m.call(f,v)})}}),this.Uh(r,i)}Uh(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void(this.Fh=setTimeout(()=>{this.Fh=void 0,this.Uh(t,i)},0));const r=t.shift();if(r)try{r()}catch(n){S.error("Error initializing extension:",n)}}const s=Math.round(performance.now()-i);this.register_for_session({[hl]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[vl]:s}),this.config.__preview_deferred_init_extensions&&S.info(`PostHog extensions initialized (${s}ms)`)}Gu(t){if(!O||!O.body)return S.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Gu(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Hh=t),this.cr=t,this.compression=void 0,t.ok){var i;const s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=T(s.supportedCompression,Pe.GZipJS)?Pe.GZipJS:T(s.supportedCompression,Pe.Base64)?Pe.Base64:void 0),(i=s.analytics)!==null&&i!==void 0&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.xh?this.xh:wl}),this.ur.emit("extensionsRemoteConfig",t),this.eh.forEach(s=>{var r;return(r=s.onRemoteConfig)===null||r===void 0?void 0:r.call(s,t)})}Nh(){try{this.config.loaded(this)}catch(t){S.critical("`loaded` function failed",t)}if(this.Wh(),this.config.internal_or_test_user_hostname&&K?.hostname){const t=K.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.nh())&&this.Vh()},1),this.Gh=new Gl(this),this.Gh.load()}Wh(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Mh)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&It(this.__request_queue,t=>this.Eh(t)),this.__request_queue=[],this.Wh()}_handle_unload(){var t,i,s,r,n,o;this.ph=!0,(t=this.surveys)===null||t===void 0||(i=t.handlePageUnload)===null||i===void 0||i.call(t),(s=this.metrics)===null||s===void 0||s.flush("sendBeacon"),this.config.request_batching?(this.Qh()&&this.capture(Un),(r=this.logs)===null||r===void 0||r.flushLogs("sendBeacon"),(n=this.Mh)===null||n===void 0||n.unload(),(o=this.Ph)===null||o===void 0||o.unload()):this.Qh()&&this.capture(Un,null,{transport:"sendBeacon"})}_send_request(t){lc(this,t)}Eh(t,i){this.Ph?this.Ph.retriableRequest(t,i):this._send_request(i?p(p({},t),{},{transport:i}):t)}_execute_array(t){Ys++;try{let i;const s=[],r=[],n=[];It(t,a=>{if(a)if(i=a[0],I(i))n.push(a);else if(ne(a))try{a.call(this)}catch(l){S.error("Error executing queued PostHog call",a,l)}else I(a)&&i==="alias"?s.push(a):I(a)&&i.indexOf("capture")!==-1&&ne(this[i])?n.push(a):r.push(a)});const o=function(a,l){It(a,function(c){try{if(I(c[0])){let u=l;J(c,function(h){u=u[h[0]].apply(u,h.slice(1))})}else l[c[0]].apply(l,c.slice(1))}catch(u){S.error("Error executing queued PostHog call",c,u)}})};o(s,this),o(r,this),o(n,this)}finally{Ys--}}push(t){if(Ys>0&&I(t)&&N(t[0])){const i=it.prototype[t[0]];ne(i)&&i.apply(this,t.slice(1));return}this._execute_array([t])}get Zh(){return{property:jn,persistenceKey:Lt,cookieName:"_fbc",pattern:So,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[Lt]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Lt)}}}get Jh(){return{property:qn,persistenceKey:ui,cookieName:"_fbp",pattern:Po,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[ui]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(ui)}}}Kh(t){var i;const s=(i=this.persistence)===null||i===void 0?void 0:i.get_property(t.persistenceKey);return N(s)&&t.pattern.test(s)?{value:s,delivered:!1}:D(s)&&N(s.value)&&t.pattern.test(s.value)?{value:s.value,delivered:s.delivered===!0}:void 0}Xh(t,i,s){return i===s?.value?{value:i,pending:!s.delivered}:(t.register(i,!1),{value:i,pending:!0})}Yh(t){if(!this.config.save_campaign_params||this.nh())return;const i=hi(t.cookieName);return N(i)&&t.pattern.test(i)?i:void 0}td(t,i,s,r){if(!this.persistence)return;const n=this.Zh;this.persistence.refreshMetaIdentifiers();const o=this.Kh(n);if(r)return void n.unregister();if(s)return N(i)&&So.test(i)?this.Xh(n,i,o):void n.unregister();const a=N(t)&&jh.test(t)?t:void 0,l=this.Yh(n);return l&&((c,u,h)=>{const d=c.split(".");if(u)return d[3]===u;if(!h)return!0;const v=h.value.split(".");return d[3]===v[3]||Number(d[2])>Number(v[2])})(l,a,o)?this.Xh(n,l,o):a?o?.value.split(".")[3]===a?{value:o.value,pending:!o.delivered}:this.Xh(n,`fb.1.${Date.now()}.${a}`,o):o?{value:o.value,pending:!o.delivered}:void 0}ed(t,i,s){if(!this.persistence)return;const r=this.Jh;this.persistence.refreshMetaIdentifiers();const n=this.Kh(r);if(s)return void r.unregister();if(i)return N(t)&&Po.test(t)?this.Xh(r,t,n):void r.unregister();const o=this.Yh(r);return o?this.Xh(r,o,n):n?{value:n.value,pending:!n.delivered}:void 0}nd(t,i){if(!this.persistence)return;this.persistence.refreshMetaIdentifiers();const s=this.Kh(t);s?.value!==i||s.delivered||t.register(i,!0)}capture(t,i,s){var r,n;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Mh))return void S.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void S.info(`Event "${t}" was not captured because capturing is disabled (opted out or consent pending).`);if(x(t)||!N(t))return void S.error("No event name provided to posthog.capture");if(this.ah(),t==="$snapshot"&&this.nh())return;const o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return void S.info(`Event "${t}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const a=s?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void S.critical("This capture call is ignored due to client rate limiting.");let l;i!=null&&i.$current_url&&!N(i?.$current_url)&&(S.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"||s!=null&&s.sd||S.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&&(l=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();const c=new Date,u=s?.timestamp||c,h=yn(s?.uuid,Me);let d={uuid:h,event:t,properties:this.calculateEventProperties(t,i||{},u,h)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),a&&(d.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const v=t==="$feature_flag_called"&&d.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;s!=null&&s.$set&&!v&&(d.$set=s?.$set);const f=D(i?.$set)?i.$set:void 0,m=I(i?.$unset)?i.$unset:[],g=s?.$unset||[],y=C=>{var j;const U=!!s?.$set&&C in s.$set;return{hasProvided:U||!!f&&C in f,provided:U?s==null||(j=s.$set)===null||j===void 0?void 0:j[C]:f?.[C],unset:m.indexOf(C)!==-1||g.indexOf(C)!==-1}},_=y(jn),b=y(qn),E=[{channel:this.Zh,hasProvided:_.hasProvided,update:this.td(l?.fbclid,_.provided,_.hasProvided,_.unset)},{channel:this.Jh,hasProvided:b.hasProvided,update:this.ed(b.provided,b.hasProvided,b.unset)}];for(const{channel:C,hasProvided:j,update:U}of E)U&&d.properties.$process_person_profile===!0&&U.pending&&!j&&!v&&(d.$set=p({[C.property]:U.value},d.$set));const k=s?.$unset;k&&(d.$unset=k);const $=v?void 0:this.rd(s?.$set_once,t!==Hn,t===xl);if($&&(d.$set_once=$),s!=null&&s._noTruncate||(A=this.config.properties_string_max_length,d=(function(C,j){const U=new Set;return(function Y(q,ie){if(q!==Object(q))return j?j(q):q;if(U.has(q))return;let he;if(U.add(q),I(q))he=[],It(q,ce=>{he.push(Y(ce))});else{const ce={};J(Vt(q)?$l(q):q,(pe,ke)=>{U.has(pe)||(ce[ke]=Y(pe,ke))}),he=ce}return he})(C)})(d,C=>N(C)?C.slice(0,A):C)),d.timestamp=u,x(s?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=c),v&&(d.properties=((C,j=[])=>{const U={},Y=q=>{C[q]!==void 0&&(U[q]=C[q])};return $u.forEach(Y),j.forEach(Y),U})(d.properties,qh)),t===Se.DISMISSED||t===Se.SENT){const C=i?.[Us.SURVEY_ID],j=i?.[Us.SURVEY_ITERATION];pc({id:C,current_iteration:j}),d.$set=p(p({},d.$set),{},{[xh({id:C,current_iteration:j},t===Se.SENT?"responded":"dismissed")]:!0})}else t===Se.SHOWN&&(d.$set=p(p({},d.$set),{},{[Us.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var A;if(t===nh.SHOWN){const C=i?.[uo.TOUR_TYPE];C&&(d.$set=p(p({},d.$set),{},{[`${uo.TOUR_LAST_SEEN_DATE}/${C}`]:new Date().toISOString()}))}const P=p(p({},d.properties.$set),d.$set);if(Ee(P)||this.setPersonPropertiesForFlags(P),!L(this.config.before_send)){const C=this.Os(d);if(!C)return;d=C,d.uuid=yn(d.uuid,Me)}this.sessionRecording&&!this.wh&&ko(t)&&(this.wh=!0,setTimeout(()=>this.wh=!1,3e4));const M=E.filter(({channel:C,update:j})=>{var U,Y,q;const ie=(U=(Y=d.$set)===null||Y===void 0?void 0:Y[C.property])!==null&&U!==void 0?U:D((q=d.properties)===null||q===void 0?void 0:q.$set)?d.properties.$set[C.property]:void 0;return j?.pending&&ie===j.value});this.ur.emit("eventCaptured",d);const B=(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),V=s?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(B),F=p(p(p({method:"POST",url:B,data:d,compression:"best-available",preferSyncCompression:s?.send_instantly,timestampMode:V?"body":"capture-body",batchKey:s?._batchKey},V&&(!((n=d.properties)===null||n===void 0)&&n.$session_id)?{batchGroup:d.properties.$session_id+(d.properties.$window_id?`-${d.properties.$window_id}`:"")}:{}),s?.transport?{transport:s.transport}:{}),M.length?{fireCallbackOnDrop:!0,callback:C=>{if(C.statusCode>=200&&300>C.statusCode)for(const{channel:j,update:U}of M)this.nd(j,U.value)}}:{});if(!this.config.request_batching||s&&!s?._batchKey||s?.send_instantly){var W;let C;!F.transport&&!F.callback&&Ee((W=this.config.request_headers)!==null&&W!==void 0?W:{})&&this.ph&&(C="sendBeacon"),this.Eh(F,C)}else this.Mh.enqueue(F);return d}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return(i=this.od)===null||i===void 0?void 0:i.getExtension(t)}Bh(){var t;return(t=this.od)!==null&&t!==void 0?t:this.od=new Lh(this)}dr(t){this._h.push(t);let i=!0;return()=>{if(!i)return;i=!1;const s=this._h.indexOf(t);s!==-1&&this._h.splice(s,1)}}Dh(t=!0){var i;return!!(!((i=this.persistence)===null||i===void 0)&&i.consumeCookieIdentityChange())&&(this.Lh(t),!0)}Lh(t=!0){var i,s,r;this.$h=null,((i=this.persistence)===null||i===void 0?void 0:i.get_property("$user_state"))==="anonymous"&&((r=this.sessionPersistence)===null||r===void 0||r.clear(),this.yh.clear(),this.ad()),(s=this.featureFlags)===null||s===void 0||s.reset(),t&&this.reloadFeatureFlags()}calculateEventProperties(t,i,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return i;this.ah(),this.persistence.syncCookieProperties(),this.Dh();const o=n?void 0:this.persistence.remove_event_timer(t);let a=p({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults==="latest"?Uh:this.config.defaults,this.nh()&&(a[dl]=!0),t==="$snapshot"){const _=p(p({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=_.distinct_id,(!N(a.distinct_id)&&!oe(a.distinct_id)||ai(a.distinct_id))&&S.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const l=(function(_,b,E,k=!1){var $,A,P,M;if(!ye)return{};const B=_?[...Ht,...b||[]]:[],[V,F]=Oa(ye),[W,C]=(function(ue){for(let Oe=0;mn.length>Oe;Oe++){const[Ke,Xe,ct]=mn[Oe],xe=ue.match(Ke);if(xe){const Le=ct&&ue.match(ct)||xe;return[Xe,Le?.[1]||""]}}return["",""]})(ye),j=(function(){const ue="u">typeof navigator?navigator:void 0;return ue?.brave?{brave:!0}:{}})(),U={};x(E)||(U.detectGoogleSearchApp=E);const Y={},q=($=navigator)===null||$===void 0||($=$.userAgentData)===null||$===void 0?void 0:$.platform,ie=(A=navigator)===null||A===void 0?void 0:A.maxTouchPoints,he=w==null||(P=w.screen)===null||P===void 0?void 0:P.width,ce=w==null||(M=w.screen)===null||M===void 0?void 0:M.height,pe=w?.devicePixelRatio;x(q)||(Y.userAgentDataPlatform=q),x(ie)||(Y.maxTouchPoints=ie),x(he)||(Y.screenWidth=he),x(ce)||(Y.screenHeight=ce),x(pe)||(Y.devicePixelRatio=pe);const ke=ee(Qr({$os:V,$os_version:F,$browser:Aa(ye,navigator.vendor,j,U),$webview_app:W,$webview_app_version:C,$device:Ca(ye),$device_type:Vc(ye,Y),$timezone:Ml(),$timezone_offset:ih()}),{$current_url:$i(k?lt(K?.href):K?.href,B,Ei),$host:K?.host,$pathname:K?.pathname,$raw_user_agent:ye.length>1e3?ye.substring(0,997)+"...":ye,$browser_version:zc(ye,navigator.vendor,j,U),$browser_language:Hl(),$browser_language_prefix:th(),$screen_height:w?.screen.height,$screen_width:w?.screen.width,$viewport_height:w?.innerHeight,$viewport_width:w?.innerWidth,$lib:Je.LIB_NAME,$lib_version:Je.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Je.SDK_DIST_CHANNEL&&(ke.$sdk_dist_channel=Je.SDK_DIST_CHANNEL),ke})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:_,windowId:b}=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime(),!0);a.$session_id=_,a.$window_id=b}this.sessionPropsManager&&ee(a,this.sessionPropsManager.getSessionProps());try{var c;if(this.sessionRecording){const _=this.sessionRecording.sdkDebugProperties,b=!this.wh&&ko(t);for(const E in _)(b||T(Dh,E))&&(a[E]=_[E])}a.$sdk_debug_retry_queue_size=(c=this.Ph)===null||c===void 0?void 0:c.length}catch(_){a.$sdk_debug_error_capturing_properties=String(_)}let u;if(this.requestRouter.region===Fr&&(a.$lib_custom_api_host=this.config.api_host),u=t!=="$pageview"||n?t!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),a=ee(a,u),t==="$pageview"&&O&&(a.title=O.title),!x(o)){const _=s.getTime()-o;a.$duration=parseFloat((_/1e3).toFixed(3))}ye&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const h=this.persistence.properties(),d=this.sessionPersistence.properties(),v=a.$groups,f=h.$groups;D(v)&&!Ee(v)&&(a.$groups=p(p({},D(f)?f:{}),v)),J(["$referrer","$referring_domain"],_=>{_ in h&&delete d[_]});const m={};if(this._h.length>0)for(const _ of this._h.slice())try{ee(m,_())}catch(b){S.error("Failed to produce browser extension event properties",b)}a=ee({},l,h,d,p(p({},m),a)),a.$is_identified=this._isIdentified(),I(this.config.property_denylist)?J(this.config.property_denylist,function(_){delete a[_]}):S.error(yc+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const g=this.config.sanitize_properties;g&&(S.error(Eo),a=g(a,t));const y=this.ld();return a.$process_person_profile=y,y&&!n&&this.ud("_calculate_event_properties"),a}rd(t,i=!0,s=!1){var r;if(!this.persistence||!this.ld()||this.mh&&!s)return t;const n=this.persistence.get_initial_props(),o=(r=this.sessionPropsManager)===null||r===void 0?void 0:r.getSetOnceProps();let a=ee({},n,o||{},t||{});const l=this.config.sanitize_properties;return l&&(S.error(Eo),a=l(a,"$set_once")),i&&(this.mh=!0),Ee(a)?void 0:a}register(t,i){var s;(s=this.persistence)===null||s===void 0||s.register(t,i)}register_once(t,i,s){var r;(r=this.persistence)===null||r===void 0||r.register_once(t,i,s)}register_for_session(t){var i,s;(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.Dh(),(s=this.sessionPersistence)===null||s===void 0||s.register(t),Object.keys(t).forEach(r=>this.yh.add(r)),this.ad()}unregister(t){var i;(i=this.persistence)===null||i===void 0||i.unregister(t)}unregister_for_session(t){var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t),this.yh.delete(t),this.ad()}hd(t,i){this.register({[t]:i})}Rh(){this.yh.forEach(t=>{var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t)}),this.yh.clear(),this.ad()}ad(){var t;if(!this.bh)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.hi||!X.Et())return void X.Pt(this.bh);const i=[];this.yh.forEach(s=>i.push(s)),i.length>0?X.At(this.bh,i):X.Pt(this.bh)}getFeatureFlag(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,i){var s,r;return(s=(r=this.featureFlags)===null||r===void 0?void 0:r.isFeatureEnabled(t,i))!==null&&s!==void 0?s:i?.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,i,s){var r;(r=this.featureFlags)===null||r===void 0||r.updateFlags(t,i,s)}updateEarlyAccessFeatureEnrollment(t,i,s){var r;(r=this.featureFlags)===null||r===void 0||r.updateEarlyAccessFeatureEnrollment(t,i,s)}getEarlyAccessFeatures(t,i=!1,s){var r;return(r=this.featureFlags)===null||r===void 0?void 0:r.getEarlyAccessFeatures(t,i,s)}on(t,i){return this.ur.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:Pt}),()=>{})}onSessionId(t){var i,s;return(i=(s=this.sessionManager)===null||s===void 0?void 0:s.onSessionId(t))!==null&&i!==void 0?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Pt})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Pt})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:Pt}),()=>{})}renderSurvey(t,i){var s;(s=this.surveys)===null||s===void 0||s.renderSurvey(t,i)}displaySurvey(t,i=Ph){var s;(s=this.surveys)===null||s===void 0||s.displaySurvey(t,i)}cancelPendingSurvey(t){var i;(i=this.surveys)===null||i===void 0||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,s;return(i=(s=this.surveys)===null||s===void 0?void 0:s.canRenderSurvey(t))!==null&&i!==void 0?i:{visible:!1,disabledReason:Pt}}canRenderSurveyAsync(t,i=!1){var s,r;return(s=(r=this.surveys)===null||r===void 0?void 0:r.canRenderSurveyAsync(t,i))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Pt})}dd(t){return!t||ai(t)?(S.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(S.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())||(S.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,s){if(!this.__loaded||!this.persistence)return S.uninitializedWarning("posthog.identify");if(oe(t)&&(t=t.toString(),S.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.dd(t)||!this.ud("posthog.identify"))return;this.ah();const r=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,o=this.Dh(!1),a=this.persistence.ku();let l=!1;try{const u=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property("__alias")&&(this.unregister(ss),this.register({distinct_id:t}));const h=(this.persistence.get_property("$user_state")||"anonymous")===Ge,d=t!==u,v=!d&&h;if(d&&h){var c;const f=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:u};this.persistence.set_property(fe,Hi),this.setPersonPropertiesForFlags({$set:i||{},$set_once:s||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Su(),this.capture("$identify",f,{$set:i||{},$set_once:s||{}})&&(this.$h=Ws(t,i,s)),(c=this.featureFlags)===null||c===void 0||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:u)}else if(v){this.persistence.set_property(fe,Hi);const f=i||{},m=s||{};this.setPersonPropertiesForFlags({$set:f,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.Su(),this.capture("$set",{$set:f,$set_once:m})&&(this.$h=Ws(t,i,s))}else(i||s)&&this.setPersonProperties(i,s);d||n||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(We)):v&&(i||s)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.Cu(l)}}setPersonProperties(t,i){if(!t&&!i||!this.ud("posthog.setPersonProperties"))return;const s=Ws(this.get_distinct_id(),t,i);this.$h!==s?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.$h=s)):S.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;const s=(I(t)?t:[t]).filter(r=>N(r)&&r.length>0);s.length!==0&&this.ud("posthog.unsetPersonProperties")&&((i=this.featureFlags)===null||i===void 0||i.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.$h=null)}group(t,i,s){var r;if(!t||!i)return void S.error("posthog.group requires a group type and group key");(r=this.persistence)===null||r===void 0||r.syncCookieProperties(),this.Dh();const n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p(p({},n),{},{[t]:i})}),(o||s)&&this.ld()){const a={$group_type:t,$group_key:i};s&&(a.$group_set=s),this.capture(Hn,a)}s&&this.setGroupPropertiesForFlags({[t]:s}),o&&!s&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var s;(s=this.featureFlags)===null||s===void 0||s.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;(i=this.featureFlags)===null||i===void 0||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var s;this.ud("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)===null||s===void 0||s.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;(i=this.featureFlags)===null||i===void 0||i.resetGroupPropertiesForFlags(t)}reset(t){const i=be(t)?t:t?.resetDeviceID,s=be(t)||t==null?void 0:t.bootstrap;this.vd(i,!1,s)}vd(t,i=!1,s){var r,n,o,a,l,c;if(S.info("reset"),!this.__loaded)return S.uninitializedWarning("posthog.reset");const u=s?.sessionID;this.config.bootstrap=s||((r=this.Th)===null||r===void 0?void 0:r.bootstrap)||{},(n=this.featureFlags)===null||n===void 0||(o=n.updateConfig)===null||o===void 0||o.call(n,this.config,this.Qu());const h=this.get_property(Vr),d=this.get_property(Cs),v=this.get_property(di);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const f=this.is_capturing();i||this.consent.reset(),i||!f||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const m=(l=this.persistence)===null||l===void 0||(c=l.ku)===null||c===void 0?void 0:c.call(l),g=this.uh;this.uh=g||i;let y=!1;try{var _,b,E,k,$,A,P,M,B,V,F,W,C;if((_=this.persistence)===null||_===void 0||_.clear(),(b=this.sessionPersistence)===null||b===void 0||b.clear(),this.yh.clear(),this.ad(),x(v)||(V=this.persistence)===null||V===void 0||V.register({$session_recording_remote_config:v}),(E=this.surveys)===null||E===void 0||E.reset(),(k=this.featureFlags)===null||k===void 0||k.reset(),($=this.conversations)===null||$===void 0||$.reset(),(A=this.logs)===null||A===void 0||A.reset(),(P=this.metrics)===null||P===void 0||P.reset(),(M=this.persistence)===null||M===void 0||M.set_property("$user_state","anonymous"),(B=this.sessionManager)===null||B===void 0||B.resetSessionId(),this.$h=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Ts,$device_id:null},"");else{const q=this.config.get_device_id(Me());this.register_once({distinct_id:q,$device_id:t?q:h},""),t||x(d)||this.register({[Cs]:d})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),s&&(s.distinctID&&!this.nh()&&((C=this.persistence)===null||C===void 0||C.set_property("$user_state",s.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.distinctID})),(F=this.featureFlags)===null||F===void 0||F.initialize(),!L(u)&&!(!((W=this.sessionManager)===null||W===void 0)&&W.setBootstrapSessionId(u,!0)))){const q=p({},s);delete q.sessionID,this.config.bootstrap=q}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,y=!0}finally{var j,U;this.uh=g,m&&((j=this.persistence)===null||j===void 0||(U=j.Cu)===null||U===void 0||U.call(j,y))}var Y;this.cr&&((Y=this.conversations)===null||Y===void 0||Y.onRemoteConfig(this.cr)),this.reloadFeatureFlags()}shutdown(t){var i=this;return Q(function*(){if(!i.__loaded)return void S.uninitializedWarning("posthog.shutdown");i.gh=!0,clearTimeout(i.Fh),i.Fh=void 0;const s=i.zh;i.zh=void 0;for(const r of[()=>{var n;return(n=i.sessionRecording)===null||n===void 0?void 0:n.dispose()},()=>{var n;return(n=i.logs)===null||n===void 0?void 0:n.flushLogs("sendBeacon")},()=>{var n;return(n=i.metrics)===null||n===void 0?void 0:n.flush("sendBeacon")},()=>{var n;return(n=i.metrics)===null||n===void 0?void 0:n.dispose()},()=>{var n;return(n=i.logs)===null||n===void 0?void 0:n.dispose()},()=>{var n;return(n=i.surveys)===null||n===void 0?void 0:n.dispose()},()=>{var n;return(n=i.autocapture)===null||n===void 0?void 0:n.dispose()},()=>s?.(),()=>{var n;return(n=i.Mh)===null||n===void 0?void 0:n.unload()},()=>{var n;return(n=i.Ph)===null||n===void 0?void 0:n.unload()},()=>{var n;return(n=i.featureFlags)===null||n===void 0?void 0:n.destroy()},()=>{var n;return(n=i.persistence)===null||n===void 0?void 0:n.destroy()},()=>{var n;return(n=i.sessionPersistence)===null||n===void 0?void 0:n.destroy()}])try{const n=r();n&&ne(n.then)&&n.then(void 0,o=>{S.error("Error during shutdown",o)})}catch(n){S.error("Error during shutdown",n)}})()}setIdentity(t,i){var s;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),(s=this.conversations)===null||s===void 0||s.fd()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.pd()}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||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:i,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let r=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if(t?.withTimestamp&&s){var n;const o=(n=t.timestampLookBack)!==null&&n!==void 0?n:10;if(!s)return r;r+=`?t=${Math.max(Math.floor((new Date().getTime()-s)/1e3)-o,0)}`}return r}alias(t,i){return t===this.get_property("$people_distinct_id")?(S.critical("Attempting to create alias for existing People user - aborting."),-2):this.ud("posthog.alias")?(x(i)&&(i=this.get_distinct_id()),t!==i?(this.hd(ss,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(S.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=p({},this.config);if(D(t)){var s,r,n,o,a,l,c,u,h,d,v,f,m,g;ee(this.config,Ao(t));const k=this.fh();if(this.persistence){const A=this.config.persistence==="sessionStorage"||this.config.persistence==="memory";var y,_;if(A&&this.sessionPersistence!==this.persistence&&((y=this.sessionPersistence)===null||y===void 0||y.remove(),(_=this.sessionPersistence)===null||_===void 0||_.destroy()),this.persistence.update_config(this.config,i,k),A)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new js(p(p({},this.config),{},{persistence:"sessionStorage"}),k,!1);else{var b;(b=this.sessionPersistence)===null||b===void 0||b.update_config(p(p({},this.config),{},{persistence:"sessionStorage"}),p(p({},i),{},{persistence:"sessionStorage"}),k)}}const $=this.Ch(this.config.debug);var E;be($)&&(this.config.debug=$),be(this.config.debug)&&(this.config.debug?($e.DEBUG=!0,H.Et()&&H.At("ph_debug",!0),S.info("set_config",{config:t,oldConfig:i,newConfig:p({},this.config)})):($e.DEBUG=!1,H.Et()&&H.Pt("ph_debug"))),(s=this.featureFlags)===null||s===void 0||(r=s.updateConfig)===null||r===void 0||r.call(s,this.config,this.Qu()),(n=this.exceptionObserver)===null||n===void 0||n.onConfigChange(),(o=this.exceptions)===null||o===void 0||o.onConfigChange(),(a=this.metrics)===null||a===void 0||a.onConfigChange(),(l=this.webMCP)===null||l===void 0||l.startIfEnabled(),(c=this.sessionRecording)===null||c===void 0||c.startIfEnabledOrStop(),(u=this.tracingHeaders)===null||u===void 0||u.startIfEnabledOrStop(),(h=this.autocapture)===null||h===void 0||h.startIfEnabled(),(d=this.heatmaps)===null||d===void 0||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((E=this.historyAutocapture)===null||E===void 0||E.startIfEnabledOrStop()),(v=this.exceptionObserver)===null||v===void 0||v.startIfEnabledOrStop(),(f=this.deadClicksAutocapture)===null||f===void 0||f.startIfEnabledOrStop(),(m=this.surveys)===null||m===void 0||m.loadIfEnabled(),this.hh(),(g=this.externalIntegrations)===null||g===void 0||g.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&oo(this,_i,!1)}}_overrideSDKInfo(t,i){$e.LIB_NAME=t,$e.LIB_VERSION=i}startSessionRecording(t){const i=t===!0,s={sampling:i||!!t?.sampling,linked_flag:i||!!t?.linked_flag,url_trigger:i||!!t?.url_trigger,event_trigger:i||!!t?.event_trigger};var r,n,o,a,l;Object.values(s).some(Boolean)&&((r=this.sessionManager)===null||r===void 0||r.checkAndGetSessionAndWindowId(),s.sampling&&((n=this.sessionRecording)===null||n===void 0||n.overrideSampling()),s.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),s.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),s.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.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===void 0)&&t.started)}captureException(t,i){try{if(!this.exceptions)return;const s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(p(p({},s),i))}catch{return}}addExceptionStep(t,i){var s;(s=this.exceptions)===null||s===void 0||s.addExceptionStep(t,i)}captureLog(t){var i;(i=this.logs)===null||i===void 0||i.captureLog(t)}get logger(){var t,i;return(t=(i=this.logs)===null||i===void 0?void 0:i.logger)!==null&&t!==void 0?t:it.gd}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,s;return(i=(s=this.toolbar)===null||s===void 0?void 0:s.loadToolbar(t))!==null&&i!==void 0&&i}get_property(t){var i;return(i=this.persistence)===null||i===void 0?void 0:i.props[t]}getSessionProperty(t){var i;return(i=this.sessionPersistence)===null||i===void 0?void 0:i.props[t]}toString(){var t;let i=(t=this.config.name)!==null&&t!==void 0?t:oi;return i!==oi&&(i="posthog."+i),i}_isIdentified(){var t,i;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((i=this.sessionPersistence)===null||i===void 0?void 0:i.get_property("$user_state"))==="identified"}ld(){var t,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ee(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((i=this.persistence)===null||i===void 0||(i=i.props)===null||i===void 0)&&i.$epp))}Qh(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.ld()||this.ud("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ud("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ud(t){return this.config.person_profiles==="never"?(S.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.sh(),this.hd(Jr,!0),!0)}fh(){if(this.config.cookieless_mode==="always")return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}hh(){var t,i;const s=this.fh();var r,n,o;return this.is_capturing()||(r=this.logs)===null||r===void 0||r.md(),((t=this.persistence)===null||t===void 0?void 0:t.hi)!==s&&((n=this.persistence)===null||n===void 0||n.set_disabled(s)),((i=this.sessionPersistence)===null||i===void 0?void 0:i.hi)!==s&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(s)),this.ad(),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!=="always"){if(this.nh()){var s,r,n,o,a,l;(s=this.sessionRecording)===null||s===void 0||s.dispose({discardBufferedEvents:!0}),this.vd(!0,!0),(r=this.sessionManager)===null||r===void 0||r.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=new bo(this),this.pageViewManager=new ao(this),this.persistence&&(this.sessionPropsManager=new mo(this,this.sessionManager,this.persistence));const f=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(l=it.__defaultExtensionClasses)===null||l===void 0?void 0:l.sessionRecording;var c,u;f&&(this.sessionRecording=this.ih(this.sessionRecording,new f(this)),this.cr&&((c=this.sessionRecording)===null||c===void 0||(u=c.onRemoteConfig)===null||u===void 0||u.call(c,this.cr)))}var h,d,v;this.consent.optInOut(!0),this.hh(),this.Wh(),(i=this.sessionRecording)===null||i===void 0||i.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((h=this.surveys)===null||h===void 0||h.loadIfEnabled(),(d=this.conversations)===null||d===void 0||d.loadIfEnabled()),(x(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((v=t?.captureEventName)!==null&&v!==void 0?v:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Vh()}else S.warn($o)}opt_out_capturing(){this.config.cookieless_mode!=="always"?(this.consent.optInOut(!1),this.hh(),this.config.cookieless_mode==="on_reject"&&this.dh()):S.warn($o)}dh(){var t,i;const s=this.sessionRecording;s?.dispose({discardBufferedEvents:!0}),this.get_distinct_id()!=="$posthog_cookieless"&&this.vd(!0,!0),this.register({distinct_id:Ts,$device_id:null}),this.th(s),this.sessionRecording=void 0,(t=this.sessionManager)===null||t===void 0||t.destroy(),(i=this.pageViewManager)===null||i===void 0||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Vh(),this.Wh()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return!this.uh&&(this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this.hh()}_is_bot(){return ve?cc(ve,this.config.custom_blocked_useragents):void 0}Vh(){O&&(O.visibilityState==="visible"?this.kh||(this.kh=!0,this.capture(Xr,{title:O.title},{send_instantly:!0}),this.Sh&&(O.removeEventListener(Mt,this.Sh),this.Sh=null)):this.Sh||(this.Sh=this.Vh.bind(this),z(O,Mt,this.Sh)))}debug(t){t===!1?(w?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(w?.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}))}Qu(){const t=this.Th||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(S.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(i,s,r,n,o){const a=s in i&&!L(i[s]),l=r in i&&!L(i[r]);return a?i[s]:!!l&&(o&&o.warn(`Config field '${r}' is deprecated. Please use '${s}' instead. The old field will be removed in a future major version.`),i[r])})(t,"advanced_disable_flags","advanced_disable_decide",0,S)}Os(t){var i;if(L(this.config.before_send))return t;const s=Object.keys((i=t.properties)!==null&&i!==void 0?i:{}).filter(Fc),r=I(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const o of r)try{if(n=o(n),L(n)){const a=`Event '${t.event}' was rejected in beforeSend function`;return Ic(t.event)?S.warn(`${a}. This can cause unexpected behavior.`):S.info(a),null}n.properties&&!Ee(n.properties)||S.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return S.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(const o of s)if(n.properties&&L(n.properties[o]))return S.warn(`Event '${t.event}' had its '${o}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var t;return(t=this.pageViewManager.Rl)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(s)})}Ch(t){const i=be(t)&&!t,s=H.Et()&&H.Ot("ph_debug")==="true";return!i&&(!!s||t)}};mi.__defaultExtensionClasses={},mi.gd=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=Cd(e.prototype[t[i]])})(mi,["identify"]);var Vh=["[data-ph-capture-value]"],Wh=class{constructor(e){this._instance=e}refresh(e){var t;const i=this._instance.config,s=D(i.autocapture)?i.autocapture:void 0;e.enabled=!!i.autocapture,e.rageclick=i.rageclick,e.maskAllElementAttributes=i.mask_all_element_attributes,e.maskAllText=i.mask_all_text,e.disableCaptureUrlHashes=i.disable_capture_url_hashes,e.getCurrentUrl=i.get_current_url,e.remoteRequestsDisabled=this._instance.Qu(),e.url_allowlist=s?.url_allowlist,e.url_ignorelist=s?.url_ignorelist,e.dom_event_allowlist=s?.dom_event_allowlist,e.element_allowlist=s?.element_allowlist,e.css_selector_allowlist=s?.css_selector_allowlist,e.css_selector_ignorelist=s?.css_selector_ignorelist,e.element_attribute_ignorelist=s?.element_attribute_ignorelist,e.capture_copied_text=s?.capture_copied_text,e.capture_value_css_selector_allowlist=(t=s?.capture_value_css_selector_allowlist)!==null&&t!==void 0?t:Vh}},ii=te("[ExceptionAutocapture]"),Oo=()=>{},Co=e=>{var t;if(ne(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function zt(e,t,i){try{if(!(t in e))return Oo;const s={next:e[t]},r=i(function(...n){return s.next.apply(this,n)});return ne(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=s.next);let n=e[t],o=Co(n);for(;o;){if(o.next===r)return void(o.next=s.next);n=o.next,o=Co(n)}}}catch{return Oo}}var Gh=te("[TracingHeaders]"),dt=te("[Web Vitals]"),To=9e5,Io=["CLS","FCP","INP","LCP"],Jh=["INP","LCP"],Yh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Xs="disabled",Fo="lazy_loading",He=te("[SessionRecording]"),Kh=[Yr,Kr,pl,fl,gl,_l,ml,yl,bl],Xh=te("[Heatmaps]");function Qs(e){return D(e)&&"clientX"in e&&"clientY"in e&&oe(e.clientX)&&oe(e.clientY)}var Li=te("[Product Tours]"),Zs=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Gr))},Qh=["$set_once","$set"],De=te("[SiteApps]"),Ro="Error while initializing PostHog app with config id ";function At(e,t,i){if(L(e))return!1;switch(i){case"exact":return e===t;case"contains":{const s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var Zh=class{constructor(e){this.Ai=e,this._o=new Set,this.wo=new Set,this.ko=new cs,this.So=(t,i)=>this.xo(t,i)&&this.$o(t,i)&&this.Co(t,i)&&this.To(t,i),this.xo=(t,i)=>!i?.event||t?.event===i?.event}init(){var e,t;x((e=this.Ai)===null||e===void 0?void 0:e.subscribeCapture)||(this.Io=(t=this.Ai)===null||t===void 0?void 0:t.subscribeCapture((i,s)=>{this.on(i,s)}))}dispose(){var e,t,i;(e=this.Io)===null||e===void 0||e.call(this),this.Io=void 0,(t=this.Ai)===null||t===void 0||(i=t.setElementSelectors)===null||i===void 0||i.call(t,new Set,this),this.ko=new cs}register(e){var t,i;if(!x((t=this.Ai)===null||t===void 0?void 0:t.subscribeCapture)&&(e.forEach(s=>{var r;this._o.add(s),(r=s.steps)===null||r===void 0||r.forEach(n=>{this.wo.add(n?.event||"")})}),(i=this.Ai)===null||i===void 0?void 0:i.setElementSelectors)){const s=new Set;this._o.forEach(r=>{var n;(n=r.steps)===null||n===void 0||n.forEach(o=>{o!=null&&o.selector&&s.add(o.selector)})}),this.Ai.setElementSelectors(s,this)}}replace(e){this._o.clear(),this.wo.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.wo.has(e)||this.wo.has(t.event))&&this._o.forEach(i=>{this.Mo(t,i)&&this.ko.emit("actionCaptured",i.name)})}Eo(e){this.onAction("actionCaptured",t=>e(t))}Mo(e,t){if(t?.steps==null)return!1;for(const i of t.steps)if(this.So(e,i))return!0;return!1}onAction(e,t){return this.ko.on(e,t)}$o(e,t){if(t?.url){var i;let n=e==null||(i=e.properties)===null||i===void 0?void 0:i.$current_url;if(!e?.properties||!("$current_url"in e.properties))try{var s,r;n=(s=this.Ai)===null||s===void 0||(r=s.getActionUrl)===null||r===void 0?void 0:r.call(s)}catch{return!1}if(!n||typeof n!="string"||!At(n,t.url,t.url_matching||"contains"))return!1}return!0}Co(e,t){return!!this.Po(e,t)&&!!this.Ro(e,t)&&!!this.Ao(e,t)}Po(e,t){var i;if(!t?.href)return!0;const s=this.Fo(e);if(s.length>0)return s.some(n=>At(n.href,t.href,t.href_matching||"exact"));const r=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!r&&At((function(n){const o=n.match(/(?::|")href="(.*?)"/);return o?o[1]:""})(r),t.href,t.href_matching||"exact")}Ro(e,t){var i;if(!t?.text)return!0;const s=this.Fo(e);if(s.length>0)return s.some(l=>At(l.text,t.text,t.text_matching||"exact")||At(l.$el_text,t.text,t.text_matching||"exact"));const r=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!r&&(n=(function(l){const c=[],u=/(?::|")text="(.*?)"/g;let h;for(;!L(h=u.exec(l));)c.includes(h[1])||c.push(h[1]);return c})(r),o=t.text,a=t.text_matching||"exact",n.some(l=>At(l,o,a)));var n,o,a}Ao(e,t){var i,s;if(!t?.selector)return!0;const r=e==null||(i=e.properties)===null||i===void 0?void 0:i.$element_selectors;if(r?.includes(t.selector))return!0;const n=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch{}return!1}Fo(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e?.properties.$elements}To(e,t){return!t?.properties||t.properties.length===0||vc(t.properties.reduce((i,s)=>{const r=I(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:r,operator:s.operator||"exact"},i},{}),e?.properties)}},ev=class{constructor(e,t){this.Oo=t,this.Do=[],this.Ai=e,this.Lo=new Map,this.No=new Map,this.qo=new Map}jo(){var e,t;this.Bo=(e=(t=this.Ai).subscribeSession)===null||e===void 0?void 0:e.call(t,i=>this.zo(i))}Ho(e){return!1}Uo(){return null}Wo(e){}Vo(){}Go(e,t){return!!e&&vc(e.propertyFilters,t?.properties)}Qo(e,t){const i=new Map;return e.forEach(s=>{var r;(r=s.conditions)===null||r===void 0||(r=r[t])===null||r===void 0||(r=r.values)===null||r===void 0||r.forEach(n=>{if(n?.name){const o=i.get(n.name)||[];o.push(s.id),i.set(n.name,o)}})}),i}Zo(e,t,i){const s=(i===Qt.Activation?this.Lo:this.No).get(e);let r=[];return this.Jo(n=>{r=n.filter(o=>s?.includes(o.id))}),r.filter(n=>{var o;const a=(o=n.conditions)===null||o===void 0||(o=o[i])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(l=>l.name===e);return this.Go(a,t)})}register(e){this.Ko(e,!1)}replace(e){this.Ko(e,!0)}Ko(e,t){x(this.Ai.subscribeCapture)||(this.Xo(e,t),this.Yo(e,t))}Yo(e,t){const i=e.filter(n=>{var o;return(o=n.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var s;if(t&&this.qo.clear(),i.length===0)return void(t&&((s=this.ta)===null||s===void 0||s.replace([])));this.ta||(this.ta=new Zh(this.Ai),this.ta.init(),this.ta.Eo(n=>this.onAction(n)));const r=[];i.forEach(n=>{var o;(o=n.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEach(a=>{if(r.push(a),a.name){var l;const c=(l=this.qo.get(a.name))!==null&&l!==void 0?l:[];c.includes(n.id)||c.push(n.id),this.qo.set(a.name,c)}})}),t?this.ta.replace(r):this.ta.register(r)}ea(e,t){t.forEach((i,s)=>{var r;const n=(r=e.get(s))!==null&&r!==void 0?r:[];i.forEach(o=>{n.includes(o)||n.push(o)}),e.set(s,n)})}Xo(e,t){var i,s,r;const n=e.filter(c=>{var u,h;return((u=c.conditions)===null||u===void 0?void 0:u.events)&&((h=c.conditions)===null||h===void 0||(h=h.events)===null||h===void 0||(h=h.values)===null||h===void 0?void 0:h.length)>0}),o=e.filter(c=>{var u,h;return((u=c.conditions)===null||u===void 0?void 0:u.cancelEvents)&&((h=c.conditions)===null||h===void 0||(h=h.cancelEvents)===null||h===void 0||(h=h.values)===null||h===void 0?void 0:h.length)>0}),a=this.Qo(e,Qt.Activation),l=this.Qo(e,Qt.Cancellation);t?(this.Lo=a,this.No=l):(this.ea(this.Lo,a),this.ea(this.No,l)),(n.length!==0||o.length!==0||e.some(c=>{var u;return(u=c.conditions)===null||u===void 0||(u=u.actions)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length}))&&((i=this.Io)!==null&&i!==void 0||(this.Io=(s=(r=this.Ai).subscribeCapture)===null||s===void 0?void 0:s.call(r,(c,u)=>{this.onEvent(c,u)})))}onEvent(e,t){var i,s;const r=this.ia(),n=(t==null||(i=t.properties)===null||i===void 0?void 0:i.$survey_id)||(t==null||(s=t.properties)===null||s===void 0?void 0:s.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){const a=this.na(e,n,t);if(a==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:n}),void this.sa([n]);if(a==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),this.ra(n),void this.oa([n])}if(this.No.has(e)){const a=this.Zo(e,t,Qt.Cancellation);a.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(l=>l.id)}),this.sa(a.map(l=>l.id)),a.forEach(l=>this.aa(l.id)))}if(!this.Lo.has(e))return;r.info("event name matched",{event:e,eventPayload:t,items:this.Lo.get(e)});const o=this.Zo(e,t,Qt.Activation);this.la(o.map(a=>a.id))}onAction(e){this.qo.has(e)&&this.la(this.qo.get(e)||[])}la(e){if(e.length===0)return;const t=!!this.Ai.getSessionId(),i=[];for(const s of e)t&&this.Ho(s)?this.ra(s)&&this.ua(s):i.push(s);i.length>0&&(this.Do=[...new Set([...this.Do,...i])]),this.ia().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.ca()}ra(e){this.Do=this.Do.filter(i=>i!==e);const t=this.ha();return!t.includes(e)&&(this.da([...t,e]),this.va(),!0)}sa(e){const t=new Set(e);this.Do=this.Do.filter(r=>!t.has(r));const i=this.fa(),s=i.filter(r=>!t.has(r));s.length!==i.length&&(this.da(s),s.length===0&&this.pa()),this.oa(e),this.ca()}ca(){try{var e;(e=this.Oo)===null||e===void 0||e.call(this)}catch(t){this.ia().error("Error while handling activated items change",t)}}ga(){const e=this.Uo();if(!e)return{};const t=this.Ai.getProperty(e);return t&&typeof t=="object"?t:{}}ua(e){if(!this.Uo())return;const t=this.ga();this.Wo(p(p({},t),{},{[e]:Date.now()}))}oa(e){if(!this.Uo())return;const t=this.ga(),i={};let s=!1;for(const[r,n]of Object.entries(t))e.includes(r)?s=!0:i[r]=n;s&&(Ee(i)?this.Vo():this.Wo(i))}ma(){this.Uo()&&this.Vo()}getActivationTimestamp(e){if(!this.ha().includes(e))return;const t=this.ga()[e];return oe(t)?t:void 0}fa(){const e=this.ya();return this.Ai.getProperty(e)||[]}ha(){const e=this.fa();if(e.length===0)return[];const t=this.Ai.getProperty(this.ba()),i=this.Ai.getSessionId();return i&&t===i?e:[]}va(){const e=this.Ai.getSessionId();e&&this._a(e)}pa(){this.wa()}zo(e){const t=this.Ai.getProperty(this.ba());if(t&&t!==e){const i=this.fa(),s=this.ga();i.length>0&&(this.da([]),i.filter(r=>oe(s[r])).forEach(r=>this.aa(r))),this.pa(),this.ma(),i.length>0&&this.ca()}}getActivatedIds(){return[...new Set([...this.ha(),...this.Do])].filter(e=>!this.ka(e))}dispose(){var e,t,i;(e=this.Bo)===null||e===void 0||e.call(this),this.Bo=void 0,(t=this.Io)===null||t===void 0||t.call(this),this.Io=void 0,(i=this.ta)===null||i===void 0||i.dispose(),this.ta=void 0}reset(){this.Do=[],this.fa().length>0&&this.da([]),this.pa(),this.ma(),this.ca()}getEventToItemsMap(){return this.Lo}Sa(){return this.ta}},tv=class extends ev{constructor(e,t,i,s){var r;super({subscribeCapture(n){const o=e.onEvent(a=>n(a.event,a));return()=>o.dispose()},subscribeSession(n){const o=e.onSession(n);return()=>o.dispose()},getSessionId(){var n;return(n=e.session)===null||n===void 0?void 0:n.sessionId},getProperty:n=>e.kv.get(n),getActionUrl:i?.getActionUrl,setElementSelectors:(r=i?.setElementSelectors)!==null&&r!==void 0?r:(n,o)=>{var a;return(a=e.getExtension("autocapture"))===null||a===void 0?void 0:a.setElementSelectors(n,o)}},s),this.xa=e,this.$a=t,this.jo()}ya(){return gr}ba(){return qi}Uo(){return Ui}Wo(e){this.xa.kv.set({[Ui]:e})}Vo(){this.xa.kv.remove(Ui)}Ho(e){var t;let i;this.Jo(r=>{i=r.find(n=>n.id===e)});const s=i==null||(t=i.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return oe(s)&&s>0}Ca(){return Se.SHOWN}Jo(e){this.$a.getSurveys(e)}aa(e){this.$a.cancelPendingSurvey(e)}ia(){return G}da(e){this.xa.kv.set({[gr]:e})}_a(e){this.xa.kv.set({[qi]:e})}wa(){this.xa.kv.remove(qi)}ka(){return!1}na(e,t,i){var s;if(e===Se.SENT&&(i==null||(s=i.properties)===null||s===void 0?void 0:s.$survey_completed)===!1)return"ignore";let r;return this.Jo(n=>{r=n.find(o=>o.id===t)}),!r||(function(n){var o;return dc(n)&&!!(!((o=n.conditions)===null||o===void 0||(o=o.events)===null||o===void 0)&&o.repeatedActivation)||n.schedule==="always"})(r)?e===Se.SHOWN?"consume":"ignore":e===Se.SHOWN?"persist":e===Se.DISMISSED||e===Se.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},on=(e,t)=>e?.then?e.then(t):t(e),Ot="SDK is not enabled or survey functionality is not yet loaded",Mo="Disabled. Not loading surveys.",iv=class{constructor(e){this.Ta=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ia=!1,this.Ma=!1,this.Ea=[],this.Pa=[],this.Ra=null,this.Aa=null,this.Ci=!1,this.Fa=new Set,this.onRemoteConfig=t=>{if(this.Ci||this.Ar.disableSurveys)return;if(!t.ok)return this.Ma=!0,this.Oa({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),G.warn("Remote config unavailable. Not loading surveys.");const i=t.config.surveys;if(L(i))return G.warn("Flags not loaded yet. Not loading surveys.");this.Da=be(i)?i:i.length>0,G.info(`flags response received, isSurveysEnabled: ${this.Da}`),this.loadIfEnabled()},this.Oa=t=>{this.Pa.slice().forEach(i=>this.La(i,t))}}setup(e){if(!this.Ci)return this.Na=e,on(e.kv.initialize(),()=>{if(this.Na!==e||this.Ci)return;this.Na=void 0,this.xa=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.Ci?t.dispose():(this.qa=t,this.loadIfEnabled())})}dispose(){var e,t,i,s,r;this.Ci||(this.Ci=!0,this.Na=void 0,this.xa=void 0,(e=this.qa)===null||e===void 0||e.dispose(),this.qa=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(i=this._surveyManager)===null||i===void 0||(s=i.dispose)===null||s===void 0||s.call(i),this._surveyManager=null,this.Ea=[],this.Pa.forEach(n=>{n.active=!1}),this.Pa=[],(r=this.ja)===null||r===void 0||r.call(this),this.ja=void 0,this.Ra=null,this.Fa.forEach(n=>clearTimeout(n)),this.Fa.clear())}get Ar(){return this.Ta.get()}getRenderContext(){if(!this.xa)return;const e=this;return{client:this.xa,get config(){return e.Ar},surveys:e}}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var i;(i=this._surveyEventReceiver)===null||i===void 0||i.reset(),localStorage.removeItem("lastSeenSurveyDate");const s=[];for(let r=0;r<localStorage.length;r++){const n=localStorage.key(r);(n!=null&&n.startsWith("seenSurvey_")||n!=null&&n.startsWith("inProgressSurvey_"))&&s.push(n)}s.forEach(r=>localStorage.removeItem(r))}catch{}this.Oa()}loadIfEnabled(){if(this.Ci||!this.xa)return;const e=this.Ar;if(this._surveyManager)return;if(this.Ia)return void G.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void G.info(Mo);if(e.cookielessMode&&this.xa.isOptedOut)return void G.info("Not loading surveys in cookieless mode without consent.");const t=this.Ta.getExtensions();if(!t)return void this.Ba("PostHog Extensions not found.");if(x(this.Da)&&!e.advancedEnableSurveys)return;const i=this.Da||e.advancedEnableSurveys;this.Ia=!0,this.Ma=!1;try{const s=t.generateSurveys;if(s)return this.za(s,i),void(this.Ia=!1);const r=t.loadExternalDependency;if(!r)return this.Ba(zr),void(this.Ia=!1);r(n=>{try{if(this.Ci)return;const o=this.Ta.getExtensions();n||!o?.generateSurveys?this.Ba("Could not load surveys script",n):this.za(o.generateSurveys,i)}finally{this.Ia=!1}})}catch(s){throw this.Ia=!1,this.Ba("Error initializing surveys",s),s}}za(e,t){var i;if(this.Ci)return;this._surveyManager=e(t),this._surveyEventReceiver=this.Ha(this.xa,this.Oa);const s=(i=this.xa)===null||i===void 0?void 0:i.kv.get(ri);s&&this.Ua(s),G.info("Surveys loaded successfully"),this.Wa(),this.Oa(),this.Va({isLoaded:!0})}Ha(e,t){return new tv(e,this,void 0,t)}Ba(e,t){this.Ma=!0,G.error(e,t),this.Oa({isLoaded:!1,error:e}),this.Va({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Ea.push(e),this._surveyManager&&this.Va({isLoaded:!0}),()=>{this.Ea=this.Ea.filter(t=>t!==e)}}getSurveys(e,t=!1){if(this.Ci)return;const i=this.xa;if(!i)return e([],{isLoaded:!1,error:Ot});if(this.Ar.disableSurveys)return G.info(Mo),e([]);const s=i.kv.get(ri);if(s&&!t)return e(s,{isLoaded:!0}),void(this.Ga()&&this.getSurveys(()=>{},!0));if(this.Ra)return void this.Ra.then(({surveys:o,context:a})=>{this.Ci||e(o,a)}).catch(o=>G.error("Error in survey callback",o));const r=i.sendRequest("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Ar.requestTimeoutMs}).then(o=>{try{return this.Qa(i,o)}catch(a){return G.error("Error processing surveys response",a),this.Qa(i,{statusCode:0,error:a})}},o=>this.Qa(i,{statusCode:0,error:o}));this.Ra=r;const n=()=>{this.Ra===r&&(this.Ra=null)};r.then(o=>{n(),this.Ci||(this.Oa(o.context),e(o.surveys,o.context))},n).catch(o=>G.error("Error in survey callback",o))}Qa(e,t){if(this.Ci)return{surveys:[],context:{isLoaded:!1,error:Ot}};const i=t.statusCode;if(i!==200||!t.json){const r=`Surveys API could not be loaded, status: ${i}`;return i!==0?G.error(r):t.error||G.warn(r),this.Aa=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Aa=null;const s=t.json.surveys||[];return e.kv.set({[ri]:s,[is]:Date.now()}),this.Ua(s),{surveys:s,context:{isLoaded:!0}}}Ua(e){const t=e.filter(i=>(function(s){return!(!s.start_date||s.end_date)})(i)&&(dc(i)||(function(s){var r;return!!(!((r=s.conditions)===null||r===void 0||(r=r.actions)===null||r===void 0||(r=r.values)===null||r===void 0)&&r.length)})(i)));this.Za(t)}Za(e){var t;(t=this._surveyEventReceiver)===null||t===void 0||t.replace(e)}Ga(){return this.Ja()&&!this.Ra&&!this.Ka()}Ja(){var e;const t=(e=this.xa)===null||e===void 0?void 0:e.kv.get(is);return oe(t)&&Date.now()-t>3e5}Ka(){return oe(this.Aa)&&3e5>Date.now()-this.Aa}markSurveyAsSeen(e,t){var i;const s={id:e,current_iteration:(i=t?.iteration)!==null&&i!==void 0?i:null};pc(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Oa()}Va(e){for(const t of this.Ea){if(this.Ci)return;try{e.isLoaded?this.getSurveys(t):t([],e)}catch(i){G.error("Error in survey callback",i)}}}getActiveMatchingSurveys(e,t=!1){if(!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);G.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t;if(this.Ci)return()=>{};const i={callback:e,active:!0,revision:0};this.Pa.push(i),this.Wa();const s=(t=this.xa)===null||t===void 0?void 0:t.kv.get(ri);return this.Ar.disableSurveys||!this._surveyManager&&this.Ma&&!this.Ia||!s&&!L(this.Aa)&&!this.Ra?this.La(i,{isLoaded:!1}):this._surveyManager&&this.La(i),()=>{var r;i.active=!1,this.Pa=this.Pa.filter(n=>n!==i),this.Pa.length===0&&((r=this.ja)===null||r===void 0||r.call(this),this.ja=void 0)}}Wa(){var e,t,i;this._surveyManager&&this.Pa.length>0&&((e=this.ja)!==null&&e!==void 0||(this.ja=(t=(i=this.Ta).onMatchingConditionsChanged)===null||t===void 0?void 0:t.call(i,this.Oa)))}La(e,t){if(this.Ci||!e.active)return;const i=++e.revision,s=r=>{if(!this.Ci&&e.active&&i===e.revision)try{const n=t??{isLoaded:!0},o=JSON.stringify([r,n]);if(o===e.lastResult)return;e.lastResult=o,e.callback(r,n)}catch(n){G.error("Error in active matching surveys callback",n)}};try{t&&!t.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(r){G.error("Error in active matching surveys callback",r)}}Xa(e){let t=null;return this.getSurveys(i=>{var s;t=(s=i.find(r=>r.id===e))!==null&&s!==void 0?s:null}),t}Ya(e){if(L(this._surveyManager))return{eligible:!1,reason:Ot};const t=typeof e=="string"?this.Xa(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}tl(e){var t;if(!(!((t=this.xa)===null||t===void 0)&&t.canCapture))return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(L(this._surveyManager))return{eligible:!1,reason:Ot};const i=typeof e=="string"?this.Xa(e):e;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(L(this._surveyManager))return G.warn("init was not called"),{visible:!1,disabledReason:Ot};const t=this.tl(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return L(this._surveyManager)?(G.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ot})):new Promise(i=>{this.getSurveys(s=>{var r;const n=(r=s.find(o=>o.id===e))!==null&&r!==void 0?r:null;if(n){const o=this.tl(n);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s,r,n;if(!(!((s=this.xa)===null||s===void 0)&&s.canCapture))return;if(L(this._surveyManager))return void G.warn("init was not called");const o=typeof e=="string"?this.Xa(e):e;if(!o?.id)return void G.warn("Survey not found");if(!Sh.includes(o.type))return void G.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const a=(r=typeof document>"u"?void 0:document)===null||r===void 0?void 0:r.querySelector(t);if(a){if(!((n=o.appearance)===null||n===void 0)&&n.surveyPopupDelaySeconds){G.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const l=setTimeout(()=>{var c,u,h;this.Fa.delete(l),!this.Ci&&(c=this.xa)!==null&&c!==void 0&&c.canCapture&&(G.info(`Rendering survey ${o.id} with delay of ${(u=o.appearance)===null||u===void 0?void 0:u.surveyPopupDelaySeconds} seconds`),(h=this._surveyManager)===null||h===void 0||h.renderSurvey(o,a,i),G.info(`Survey ${o.id} rendered`))},1e3*o.appearance.surveyPopupDelaySeconds);this.Fa.add(l);return}this._surveyManager.renderSurvey(o,a,i)}else G.warn("Survey element not found")}displaySurvey(e,t){var i,s;if(!(!((i=this.xa)===null||i===void 0)&&i.canCapture))return;if(L(this._surveyManager))return void G.warn("init was not called");const r=this.Xa(e);if(!r)return void G.warn("Survey not found");let n=r;if((s=r.appearance)!==null&&s!==void 0&&s.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=p(p({},r),{},{appearance:p(p({},r.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==Ar.Popover&&t.initialResponses&&G.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const o=this.Ya(r);if(!o.eligible)return void G.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==Ar.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){L(this._surveyManager)?G.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}},sv=class{constructor(e){this._instance=e}get(){var e,t,i,s;const r=(e=this._instance)===null||e===void 0?void 0:e.config;return{disableSurveys:!!r?.disable_surveys,cookielessMode:!!r?.cookieless_mode,advancedEnableSurveys:!!r?.advanced_enable_surveys,requestTimeoutMs:(t=r?.surveys_request_timeout_ms)!==null&&t!==void 0?t:1e4,prefillFromUrl:!!(!(r==null||(i=r.surveys)===null||i===void 0)&&i.prefillFromUrl),automaticDisplay:!r?.disable_surveys_automatic_display,featureFlagEvaluation:!r?.advanced_disable_feature_flags,overrideLanguage:r?.override_display_language,prepareStylesheet:r?.prepare_external_dependency_stylesheet,get_current_url:r?.get_current_url,uiHost:(s=this._instance)===null||s===void 0||(s=s.requestRouter)===null||s===void 0?void 0:s.endpointFor("ui","")}}getExtensions(){const e=R?.__PosthogExtensions__;if(!e||!this._instance)return;const t=this._instance,{generateSurveys:i,loadExternalDependency:s}=e;return{generateSurveys:i?r=>i(t,r):void 0,loadExternalDependency:s?r=>s(t,"surveys",r):void 0}}onMatchingConditionsChanged(e){var t,i;const s=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook(a=>{a!=="$pageview"&&a!==Se.SHOWN&&a!==Se.DISMISSED&&a!==Se.SENT||e()}),r=()=>e();z(w,"PHSurveyShown",r);let n=!1;const o=(i=this._instance)===null||i===void 0?void 0:i.onFeatureFlags(()=>{n&&e()});return n=!0,()=>{n=!1,s?.(),o?.(),w?.removeEventListener("PHSurveyShown",r)}}},rv=w?.location?os(w.location.hash,"__posthog")||os(location.hash,"state"):null,Lo="_postHogToolbarParams",Do=te("[Toolbar]"),No=te("[FeatureFlags]"),ht=te("[FeatureFlags]",{debugEnabled:!0}),er=`" failed. Feature flags didn't load in time.`,nv=[502,504],jo=["click","keydown","wheel","touchstart","pointerdown"],qo="connection_error",Uo=e=>{const t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},Ho=e=>{const t={};for(const[i,s]of Bi(e||{}))s&&(t[i]=s);return t},ov=class{constructor(e){this.name="featureFlags",this.yd=!1,this.featureFlagEventHandlers=[],this.$=No,this.bd={},this._d={},this.wd=[],this.kd=new Set,this.Sd=new Set,this.xd=!1,this.$d=!1,this.Cd=0,this.Td=!1,this.Id=!1,this.Md=!1,this.Ed=!1,this.Pd=!1,this.Rd=0,this.Ad=!1,this.rn=()=>{const t=this.Fd();this.Rd=0,t&&this.reloadFeatureFlags()},this.Od=()=>{var t,i;const s=this.Dd,r=(t=this.Ld)!==null&&t!==void 0?t:s;x(s)||x(r)||this.Ar.remoteRequestsDisabled||!this.Nd||this.Nd.visibilityState==="hidden"||Date.now()-((i=this.qd)!==null&&i!==void 0?i:0)<r||(this.Ld=this.Ad||!this.Ar.idleRefreshBackoff?s:Math.min(2*r,36e5),this.Ad=!1,this.reloadFeatureFlags(),this.jd())},this.Bd=()=>{this.Ad&&this.Ld===this.Dd||this.zd()},this.sn=()=>{var t;((t=this.Nd)===null||t===void 0?void 0:t.visibilityState)==="visible"&&this.zd()},this.Ta=e}get Hd(){}Ud(){this.xa&&this.Wd()}setup(e){try{this.Vd=typeof window>"u"?void 0:window,this.Nd=typeof document>"u"?void 0:document}catch{this.Vd=void 0,this.Nd=void 0}return this.Na=e,this.$=e.logger.createLogger("[FeatureFlags]"),on(e.kv.initialize(),()=>{this.Na===e&&(this.Na=void 0,this.xa=e,this.Gd(e))})}Gd(e){var t;if(this.xa===e)return this.Vd&&z(this.Vd,"online",this.rn),this.Wd(),this.Qd=e.registerDynamicEventProperties(()=>this.Zd()?this.bd:this._d),this.Jd=(t=this.Hd)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Kd(),this.Xd(),this.Yd()}),this.Xd(),this.initialize()}zd(){this.Ad=!0,this.Ld=this.Dd,this.Od()}Wd(){var e;const t=this.Ar.refreshIntervalMs,i=!this.Ar.remoteRequestsDisabled&&this.Nd&&!x(t)&&t>0?t:void 0;this.Ar.idleRefreshBackoff||(this.Ld=i),i!==this.Dd&&(this.tv(),x(i)||(this.Dd=i,this.Ld=i,this.jd(),(e=this.Nd)!==null&&e!==void 0&&e.addEventListener&&(z(this.Nd,Mt,this.sn),It(jo,s=>{z(this.Nd,s,this.Bd,{capture:!0})}))))}jd(){x(this.Dd)||(x(this.ev)||clearInterval(this.ev),this.qd=Date.now(),this.ev=setInterval(this.Od,this.Dd))}tv(){var e,t;x(this.ev)||(clearInterval(this.ev),this.ev=void 0,(e=this.Nd)===null||e===void 0||(t=e.removeEventListener)===null||t===void 0||t.call(e,"visibilitychange",this.sn),It(jo,i=>{var s,r;(s=this.Nd)===null||s===void 0||(r=s.removeEventListener)===null||r===void 0||r.call(s,i,this.Bd,{capture:!0})})),this.Dd=void 0,this.Ld=void 0,this.Ad=!1,this.qd=void 0}destroy(){this.iv()}dispose(){this.iv()}iv(){var e,t,i;this.tv(),this.Cd++,this.Id=!1,this.Na=void 0,this.nv(this.kd,"cancelled"),this.nv(this.Sd,"cancelled"),this.xa&&(this.sv(),(e=this.Qd)===null||e===void 0||e.dispose(),this.Qd=void 0,(t=this.Jd)===null||t===void 0||t.call(this),this.Jd=void 0,this.wd=[],(i=this.Vd)===null||i===void 0||i.removeEventListener("online",this.rn),this.xa=void 0)}get Ar(){return this.Ta.get()}rv(e){var t;return this.ov&&e in this.ov?this.ov[e]:(t=this.xa)===null||t===void 0?void 0:t.kv.get(e)}Kd(){return!!this.ov&&(this.ov=void 0,!0)}av(){var e;return!x((e=this.xa)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Kd()}At(e){this.lv(()=>{var t;return(t=this.xa)===null||t===void 0?void 0:t.kv.set(e)})}uv(e,t,i){if(!this.Hd||!e.$enabled_feature_flags)return;const s=this.rv("$enabled_feature_flags")||{},r=e.$enabled_feature_flags||{},n=t.flags||t.featureFlags,o=t.flags?Object.entries(t.flags).filter(([,g])=>!g?.failed).map(([g])=>g):[],a=!!t.errorsWhileComputingFlags&&!!t.flags,l=a?o:i&&!I(n)?Object.keys(n||{}):Array.from(new Set([...Object.keys(s),...Object.keys(r)])),c=this.rv("$feature_flag_payloads")||{},u=e.$feature_flag_payloads||{},h=a||i?l:Array.from(new Set([...Object.keys(c),...Object.keys(u)])),d=!a&&!i,v=!!d||l,f=!!d||h,m={[Ve]:v,[Re]:v,[nt]:f};e.$feature_flag_details&&(m[_t]=v);for(const g of[mt,ot,ci])x(e[g])||(m[g]=!0);this.Hd.markCrossTabFeatureFlagChanges(m)}Pt(e){this.lv(()=>{var t;return(t=this.xa)===null||t===void 0?void 0:t.kv.remove(e)})}lv(e){try{e()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}Xd(){const e={};for(const s of[Ve,nt,mt,Ne]){const r=this.rv(s);x(r)||(e[s]=r)}this.bd=e;const t=p({},e),i=this.rv(Re);if(i)for(const[s,r]of Object.entries(i))t[`$feature/${s}`]=r;this._d=t}Zd(){const e=this.Ar.cacheTtlMs;if(!e||0>=e)return!1;const t=this.rv(ot);return typeof t!="number"||Date.now()-t>e}hv(){return!!this.Zd()&&(this.Pd||this.$d||(this.Pd=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}dv(){const e=this.Ar.evaluationContexts;return e?.length?e.filter(t=>{const i=t&&typeof t=="string"&&t.trim().length>0;return i||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}vv(){const e=this.Ar.flagKeys;if(!x(e))return e.filter(t=>{const i=t&&typeof t=="string"&&t.trim().length>0;return i||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var e,t;const i=this.Ar,s=(e=(t=i.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(s).length){var r,n;const o=(r=(n=i.bootstrap)===null||n===void 0?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},a=Object.keys(s).filter(c=>!x(s[c])).reduce((c,u)=>(c[u]=s[u],c),{}),l=Object.keys(o).filter(c=>a[c]).reduce((c,u)=>(c[u]=o[u],c),{});return this.fv({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,i){var s,r;const n=i?.merge&&(s=this.rv("$enabled_feature_flags"))!==null&&s!==void 0?s:{},o=i?.merge&&(r=this.rv("$feature_flag_payloads"))!==null&&r!==void 0?r:{},a=p(p({},n),e),l=p(p({},o),t),c={};for(const[u,h]of Object.entries(a))c[u]={key:u,enabled:An(h),variant:On(h),reason:void 0,metadata:x(l?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:l[u]}};this.fv({flags:c})}get hasLoadedFlags(){return this.xd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.rv(_t),t=this.rv(Ne),i=this.rv(ft);if(!i&&!t)return e||{};const s=ee({},e||{}),r=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(const a of r){var n,o;const l=s[a],c=t?.[a],u=x(c)?(n=l?.enabled)!==null&&n!==void 0&&n:!!c,h=x(c)?l?.variant:typeof c=="string"?c:void 0,d=i?.[a],v=p(p({},l),{},{enabled:u,variant:u?h??l?.variant:void 0});u!==l?.enabled&&(v.original_enabled=l?.enabled),h!==l?.variant&&(v.original_variant=l?.variant),d&&(v.metadata=p(p({},l?.metadata),{},{payload:d,original_payload:l==null||(o=l.metadata)===null||o===void 0?void 0:o.payload})),s[a]=v}return this.yd||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.yd=!0),s}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{const s=e[i];return{key:i,enabled:An(s),variant:On(s),payload:Pn(t[i])}})}getFlagVariants(){const e=this.rv(Re),t=this.rv(Ne);if(!t)return e||{};const i=ee({},e||{}),s=Object.keys(t);for(let r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.yd||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.yd=!0),i}getFlagPayloads(){const e=this.rv(nt),t=this.rv(ft);if(!t)return e||{};const i=ee({},e||{}),s=Object.keys(t);for(let r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.yd||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.yd=!0),i}reloadFeatureFlags(){this.Td||this.Ar.featureFlagsDisabled||this.Fd()||(this.Md&&this.$.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.$d&&(this.Id=!0),this.pv||(this.wd.slice().forEach(e=>{try{e()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.pv=setTimeout(()=>{this.gv()},5)))}reloadFeatureFlagsAsync(){return!this.xa||this.Td||this.Ar.featureFlagsDisabled||this.Ar.remoteRequestsDisabled||this.Fd()?Promise.resolve({status:"skipped"}):new Promise(e=>{this.kd.add(e),this.reloadFeatureFlags()})}nv(e,t){e.forEach(i=>i({status:t})),e.clear()}sv(){clearTimeout(this.pv),this.pv=void 0}onReloading(e){return this.wd.push(e),()=>{this.wd=this.wd.filter(t=>t!==e)}}ensureFlagsLoaded(){this.xd||this.$d||this.pv||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Td=e}resetFlagCallReported(){this.Pt(We)}gv(e){var t;this.sv();const i=this.xa;if(!i||this.Ar.remoteRequestsDisabled||this.Fd())return void this.nv(this.kd,"skipped");if(this.$d)return void(this.Id=!0);const s={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:p(p(p({},i.initialPersonProperties),this.rv("$stored_person_properties")||{}),{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.rv(st),timezone:Ml()};x(i.deviceId)||(s.$device_id=i.deviceId),(e!=null&&e.disableFlags||this.Ar.featureFlagsDisabled)&&(s.disable_flags=!0);const r=this.dv();r.length&&(s.evaluation_contexts=r);const n=this.vv();x(n)||(s.flag_keys=n);const o=this.Ar.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.Cd,c=this.kd;this.kd=new Set,this.Sd=c,this.$d=!0;const u=()=>{this.Id&&(this.Id=!1,this.gv())},h=g=>{var y,_;const b=(y=g.json)!==null&&y!==void 0?y:{},E=g.statusCode!==200;if(this.$d=!1,l!==this.Cd)return void u();if(this.mv(g.statusCode),E||this.Id||(this.$anon_distinct_id=void 0),s.disable_flags&&!this.Id)return void this.nv(c,"skipped");this.Ed=!E;const k=[];g.error?k.push(g.error instanceof Error&&g.error.name==="AbortError"?"timeout":g.error instanceof Error?qo:"unknown_error"):g.statusCode!==200&&k.push(`api_error_${g.statusCode}`),b.errorsWhileComputingFlags&&k.push("errors_while_computing_flags");const $=!!(!((_=b.quotaLimited)===null||_===void 0)&&_.includes("feature_flags"));$&&k.push("quota_limited"),this.At({[wi]:k}),$?this.$.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.fv(b,E,{partialResponse:o}),this.nv(c,s.disable_flags?"skipped":k.length||!b.flags&&!b.featureFlags?"error":"loaded"),u()},d=g=>{this.$d=!1,l===this.Cd&&(this.At({[wi]:[qo]}),this.$.error("Feature flag request failed",g),this.av()&&this.Yd(!0),this.nv(c,"error")),u()};let v=(t=this.Ar.requestMaxRetries)!==null&&t!==void 0?t:1;const f=()=>v>0&&l===this.Cd,m=()=>{if(l!==this.Cd||!this.xa||this.Ar.remoteRequestsDisabled)return this.$d=!1,this.nv(c,"skipped"),void u();try{i.sendRequest(a,{target:"flags",method:"POST",body:s,compression:this.Ar.compression,sentAt:"body",timeoutMs:this.Ar.requestTimeoutMs}).then(g=>{if((y=>nv.includes(y.statusCode)||(_=>_.statusCode===0&&_.error instanceof Error&&_.error.name==="AbortError")(y))(g)&&f())return v--,void setTimeout(m,500);h(g)}).catch(d)}catch(g){d(g)}};m()}Fd(){return Dl(this.Rd,3)}mv(e){this.Rd=Nl(e,this.Rd,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var i;if(t.fresh&&!this.Ed)return;if(!(this.xd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+er);if(this.hv())return;const s=this.getFeatureFlagResult(e,t);return(i=s?.variant)!==null&&i!==void 0?i:s?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.Ed)return;if(!(this.xd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+er);if(this.hv())return;const i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this.rv("$feature_flag_request_id")||void 0,l=this.rv("$feature_flag_evaluated_at")||void 0;let c,u=this.rv("$flag_call_reported")||{};if(this.Ar.deduplicateCallsPerSession){var h;const V=(h=this.xa)===null||h===void 0||(h=h.session)===null||h===void 0?void 0:h.sessionId,F=this.rv(si);V&&V!==F&&(u={},c=V)}if(!t.send_event&&"send_event"in t)c&&this.At({[We]:u,[si]:c});else{var d,v;const V=(d=this.xa)===null||d===void 0?void 0:d.canCapture;if(!V&&Object.keys(u).length>0&&(u={},this.At({[We]:u})),V&&!(!((v=u[e])===null||v===void 0)&&v.includes(o))){var f,m,g,y,_,b,E,k,$,A,P,M,B;I(u[e])?u[e].push(o):u[e]=[o],this.At(p({[We]:u},c?{[si]:c}:{}));const F=this.getFeatureFlagDetails(e),W=[...(f=this.rv("$feature_flag_errors"))!==null&&f!==void 0?f:[]];x(r)&&W.push("flag_missing");const C={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(m=(g=this.Ar.bootstrap)===null||g===void 0||(g=g.featureFlags)===null||g===void 0?void 0:g[e])!==null&&m!==void 0?m:null,$feature_flag_bootstrapped_payload:(y=(_=this.Ar.bootstrap)===null||_===void 0||(_=_.featureFlagPayloads)===null||_===void 0?void 0:_[e])!==null&&y!==void 0?y:null,$used_bootstrap_value:!this.Ed};x(F==null||(b=F.metadata)===null||b===void 0?void 0:b.has_experiment)||(C.$feature_flag_has_experiment=F.metadata.has_experiment),x(F==null||(E=F.metadata)===null||E===void 0?void 0:E.version)||(C.$feature_flag_version=F.metadata.version);const j=(k=F==null||($=F.reason)===null||$===void 0?void 0:$.description)!==null&&k!==void 0?k:F==null||(A=F.reason)===null||A===void 0?void 0:A.code;j&&(C.$feature_flag_reason=j),F!=null&&(P=F.metadata)!==null&&P!==void 0&&P.id&&(C.$feature_flag_id=F.metadata.id),x(F?.original_variant)&&x(F?.original_enabled)||(C.$feature_flag_original_response=x(F.original_variant)?F.original_enabled:F.original_variant),F!=null&&(M=F.metadata)!==null&&M!==void 0&&M.original_payload&&(C.$feature_flag_original_payload=F==null||(B=F.metadata)===null||B===void 0?void 0:B.original_payload),W.length&&(C.$feature_flag_error=W.join(",")),this.yv(C)}else c&&this.At({[We]:u,[si]:c})}return s?{key:e,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:Pn(n)}:void 0}yv(e){try{var t;(t=this.xa)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(i){this.$.error("Failed to capture feature flag call",i)}}getRemoteConfigPayload(e,t){this.bv(e,t)}bv(e,t){var i=this;return Q(function*(){const s=i.xa;if(!s)return;const r={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},n=i.dv();n.length&&(r.evaluation_contexts=n);const o=i.vv();let a;x(o)||(r.flag_keys=o);try{var l;const c=(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:i.Ar.compression,sentAt:"body",timeoutMs:i.Ar.requestTimeoutMs})).json)===null||l===void 0?void 0:l.featureFlagPayloads;a=c?.[e]||void 0}catch(c){i.$.error("Remote config feature flag request failed",c);return}try{t(a)}catch(c){i.$.error("Remote config feature flag callback failed",c)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.Ed)return t.defaultValue;if(!(this.xd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+er),t.defaultValue;const i=this.getFeatureFlag(e,t);return x(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this.fv(e,t,i)}fv(e,t,i){if(!this.xa)return;this.xd=!0;const s=((r,n={},o={},a={},l,c=No)=>{const u=((b,E)=>{const k=b.flags;if(k){const $=Object.fromEntries(Object.keys(k).map(P=>{var M;return[P,(M=k[P].variant)!==null&&M!==void 0?M:k[P].enabled]})),A=Object.fromEntries(Object.keys(k).filter(P=>k[P].enabled).filter(P=>{var M;return!x((M=k[P].metadata)===null||M===void 0?void 0:M.payload)}).map(P=>{var M;return[P,(M=k[P].metadata)===null||M===void 0?void 0:M.payload]}));return p(p({},b),{},{featureFlags:$,featureFlagPayloads:A})}return b.featureFlags&&E.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),b})(r,c),h=u.flags,d=u.featureFlags,v=u.featureFlagPayloads;if(!d)return;const f=r.requestId,m=r.evaluatedAt;if(I(d)){c.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const b={};if(d)for(let E=0;d.length>E;E++)b[d[E]]=!0;return{[Ve]:d,[Re]:b,[ci]:!1}}let g=d,y=v,_=h;if(l?.partialResponse){const b=Object.keys(g),E=y||{};g=p(p({},n),g),y=p(p({},o),E),b.forEach(k=>{k in E||y==null||delete y[k]}),_=p(p({},a),_)}else if(r.errorsWhileComputingFlags)if(h){const b=new Set(Object.keys(h).filter(k=>{var $;return!(!(($=h[k])===null||$===void 0)&&$.failed)}));g=p(p({},n),Object.fromEntries(Object.entries(g).filter(([k])=>b.has(k))));const E=Object.fromEntries(Object.entries(y||{}).filter(([k])=>b.has(k)));y=p(p({},o),E),b.forEach(k=>{k in E||y==null||delete y[k]}),_=p(p({},a),Object.fromEntries(Object.entries(_||{}).filter(([k])=>b.has(k))))}else g=p(p({},n),g),y=p(p({},o),y),_=p(p({},a),_);return p(p({[Ve]:Object.keys(Ho(g)),[Re]:g||{},[nt]:y||{},[_t]:_||{},[ci]:r.minimalFlagCalledEvents===!0},f?{[mt]:f}:{}),m?{[ot]:m}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(s)if(i?.persist===!1){const r=!x(this.xa.kv.get(Re));this.ov=s,r||this.At(s)}else this.Kd(),this.uv(s,e,!!i?.partialResponse),this.At(s);else t&&this.av();t||(this.Pd=!1),this.Yd(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this._v(e)}_v(e){if(this.xa){if(e===!1)return this.Pt([Ne,ft]),this.Yd(),void ht.info("All overrides cleared");if(I(e))return this.At({[Ne]:Uo(e)}),this.Yd(),void ht.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const i=e;this.yd=!!((t=i.suppressWarning)!==null&&t!==void 0&&t);const s={},r=i.flags,n=i.payloads;r&&(s[Ne]=I(r)?Uo(r):r),n&&(s[ft]=n),Object.keys(s).length&&this.At(s),r===!1&&n===!1?this.Pt([Ne,ft]):r===!1?this.Pt(Ne):n===!1&&this.Pt(ft),this.Yd(),r===!1?ht.info("Flag overrides cleared"):r&&ht.info("Flag overrides set",{flags:r}),n===!1?ht.info("Payload overrides cleared"):n&&ht.info("Payload overrides set",{payloads:n});return}if(e&&typeof e=="object")return this.At({[Ne]:e}),this.Yd(),void ht.info("Flag overrides set",{flags:e});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.xd){const{flags:t,flagVariants:i}=this.wv();try{e(t,i)}catch(s){this.$.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;const r=(this.rv("$early_access_features")||[]).find(c=>c.flagKey===e),n={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(o.$early_access_feature_name=r.name),i&&(o.$feature_enrollment_stage=i);const a=p(p({},this.getFlagVariants()),{},{[e]:t});(s=this.Hd)===null||s===void 0||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(n)}),this.At({[Ve]:Object.keys(Ho(a)),[Re]:a,[rt]:p(p({},this.rv("$stored_person_properties")||{}),n)}),this.Yd();try{var l;(l=this.xa)===null||l===void 0||l.capture("$feature_enrollment_update",o)}catch(c){this.$.error("Failed to capture early access feature enrollment",c)}}getEarlyAccessFeatures(e,t=!1,i){const s=this.rv(fr);!s||t?this.Sv(e,i):e(s)}Sv(e,t){var i=this;return Q(function*(){const s=i.xa;if(!s)return;const r=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"";let n;try{const o=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${r}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;n=o.json.earlyAccessFeatures,i.At({[fr]:n})}catch(o){i.$.error("Early access feature request failed",o);return}try{e(n)}catch(o){i.$.error("Early access feature callback failed",o)}})()}wv(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,s)=>(i[s]=t[s],i),{})}}Yd(e){this.Xd();const{flags:t,flagVariants:i}=this.wv(),s=this.Md;this.Md=!0,this.featureFlagEventHandlers.forEach(r=>{try{r(t,i,{errorsLoading:e})}catch(n){this.$.error("Error while running feature flags callback",n)}}),this.Md=s}setPersonPropertiesForFlags(e,t=!0){this.xv(e,t)}xv(e,t=!0){const i=this.rv("$stored_person_properties")||{},s=e?.$set||(e?.$set_once?{}:e),r=e?.$set_once,n={};if(r)for(const o in r)({}).hasOwnProperty.call(r,o)&&(o in i||(n[o]=r[o]));this.At({[rt]:p(p(p({},i),n),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const i=p({},this.rv("$stored_person_properties")||{});e.forEach(s=>{delete i[s]}),this.At({[rt]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Pt(rt),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const i=this.rv("$stored_group_properties")||{},s=p({},i);for(const r of Object.keys(e))s[r]=p(p({},i[r]),e[r]);this.At({[st]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.rv("$stored_group_properties")||{};this.At({[st]:p(p({},t),{},{[e]:{}})})}else this.Pt(st)}reset(){this.Cd++,this.nv(this.kd,"cancelled"),this.nv(this.Sd,"cancelled"),this.Id=!1,this.bd={},this._d={},this.ov=void 0,this.xd=!1,this.Td=!1,this.Ed=!1,this.$anon_distinct_id=void 0,this.sv(),this.yd=!1,this.Rd=0}},Bo=te("[FeatureFlags]"),av=class{constructor(e,t=!1){this.$v=!1,this.update(e,t)}update(e,t){this.Cv=((i,s)=>{var r,n,o,a,l,c,u,h;return{bootstrap:{featureFlags:(r=(n=i.bootstrap)===null||n===void 0?void 0:n.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(o=(a=i.bootstrap)===null||a===void 0?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:s,featureFlagsDisabled:!!i.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!i.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!i.advanced_feature_flags_dedup_per_session,cacheTtlMs:i.feature_flag_cache_ttl_ms,refreshIntervalMs:(l=i.remote_config_refresh_interval_ms)!==null&&l!==void 0?l:3e5,idleRefreshBackoff:x(i.remote_config_refresh_interval_ms),requestTimeoutMs:i.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(c=i.feature_flag_request_max_retries)!==null&&c!==void 0?c:1),compression:i.disable_compression?void 0:"best-available",evaluationContexts:(u=(h=i.evaluation_contexts)!==null&&h!==void 0?h:i.evaluation_environments)!==null&&u!==void 0?u:[],flagKeys:I(i.flag_keys)?i.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.$v||(Bo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.$v=!0),x(e.flag_keys)||I(e.flag_keys)||Bo.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Cv}},zo=e=>Vt(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),Fe=te("[Error tracking]"),Mr="webkit-masked-url:",lv=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],cv=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Mr],uv=["__firefox__","__gCrWeb"],Vo="Refusing to render web experiment since the viewer is a likely bot",dv={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>us(t,e),not_regex:(e,t)=>!us(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Ce=te("[Conversations]"),vt="Conversations not available yet.";function Wo(e,t){var i,s,r,n,o,a,l;const c=(i=e?.flushIntervalMs)!==null&&i!==void 0?i:3e3,u=(s=e?.maxBufferSize)!==null&&s!==void 0?s:100,h=t?.consoleCapture?void 0:(r=e?.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,d=x(h)?Math.max(u,2048):Math.max(u,h),v=p(p({},(function(){let f="",m="";try{var g;const y="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,_=y==null||(g=y.navigator)===null||g===void 0?void 0:g.userAgent;_&&([f,m]=Oa(_))}catch{}return(function(y,_){const b=(function(E){if(E)return{}.hasOwnProperty.call(Mn,E)?Mn[E]:E})(y);return p(p({},b?{"os.name":b}:{}),_?{"os.version":_}:{})})(f,m)})()),e?.resourceAttributes);return{serviceName:(n=(o=v?.["service.name"])!==null&&o!==void 0?o:e?.serviceName)!==null&&n!==void 0?n:t?.serviceNameDefault,serviceVersion:(a=v?.["service.version"])!==null&&a!==void 0?a:e?.serviceVersion,environment:(l=v?.["deployment.environment"])!==null&&l!==void 0?l:e?.environment,resourceAttributes:v,beforeSend:e?.beforeSend,flushIntervalMs:c,maxBufferSize:u,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var hv=["debug","log","warn","error","info"],vv=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},Go="console",bc="__posthogHandledLogsRequestError",tr=(e,t)=>{const i=e instanceof Error?e:new Error(t);return i[bc]=!0,i},Jo=e=>!!e&&typeof e=="object"&&e[bc]===!0,pv=class{get Tv(){return p(p({},this.$),{},{error:(...e)=>{e.some(Jo)||this.$.error(...e)}})}constructor(e,t){var i;this.Ta=e,this.Iv=t,this.name="logs",this.Mv=!1,this.Ev=!1,this.Pv=!1,this.$=te("[logs]"),this.Ju=[],this.Rv=[],this.Rd=0,this.Av=!1,this.Ci=!1,this.Fv=[],this.Ov=[],this.Dv=!1,this.Lv=!1,this.Nv=!1,this.qv=()=>{var s,r;this.Ci||(this.Rd=0,(s=this.jv)===null||s===void 0||s.onReconnect(),(r=this.Bv)===null||r===void 0||r.onReconnect())},this.Mv=!!(!((i=e.get())===null||i===void 0)&&i.captureConsoleLogs)}get zv(){return!0}Hv(){}Uv(){if(!this.Nv){try{this.Vd=typeof window>"u"?void 0:window}catch{this.Vd=void 0}this.Vd&&(z(this.Vd,"online",this.qv),this.Nv=!0)}}Wv(e,t,i,s){this.Uv();const r=Wo(this.Ta.get(),i);return[new id(this.Vv(e,t),r,this.Tv,()=>this.Iv(),n=>n(),void 0,s),r]}Gv(){const e=this.Ta.get();var t;return this.jv&&this.Qv===e||((t=this.jv)===null||t===void 0||t.reset(),this.Qv=e,[this.jv,this.Zv]=this.Wv(()=>this.Ju,i=>{this.Ju=i})),this.jv}Jv(){const e=this.Ta.get();var t;return this.Bv&&this.Kv===e||((t=this.Bv)===null||t===void 0||t.reset(),this.Kv=e,[this.Bv,this.Xv]=this.Wv(()=>this.Rv,i=>{this.Rv=i},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Go)),this.Bv}setup(e){if(!this.Ci&&!this.Av)return this.Av=!0,this.xa=e,this.$=e.logger.createLogger("[logs]"),on(e.kv.initialize(),()=>{this.Ci||this.Gd(e)})}Gd(e){var t;this.Uv(),(t=this.Ta.get())!==null&&t!==void 0&&t.captureConsoleLogs&&(this.Mv=!0),(this.Mv||this.Ta.remoteConfigWillArrive&&e.kv.get(this.Ta.captureHintKey))&&this.Yv();let i=!1;const s=e.onRemoteConfig(r=>{var n;i=r.ok&&((n=r.config.logs)===null||n===void 0?void 0:n.captureConsoleLogs)===!0,this.onRemoteConfig(r)});this.Ci?s.dispose():(this.qa=s,i||this.loadIfEnabled())}dispose(){var e,t,i,s,r,n,o;this.Ci||(this.Ci=!0,this.tf(),(e=this.qa)===null||e===void 0||e.dispose(),this.qa=void 0,this.xa=void 0,this.Pv=!1,(t=this.Vd)===null||t===void 0||t.removeEventListener("online",this.qv),(i=this.ef)===null||i===void 0||i.call(this),this.ef=void 0,(s=this.jv)===null||s===void 0||s.clearQueue(),(r=this.Bv)===null||r===void 0||r.clearQueue(),(n=this.jv)===null||n===void 0||n.reset(),(o=this.Bv)===null||o===void 0||o.reset())}onRemoteConfig(e){var t,i;if(this.Ci)return;const s=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;L(s)?this.if():((i=this.xa)===null||i===void 0||i.kv.set(this.Ta.captureHintKey,!!s),s?(this.Mv=!0,this.Ev||this.Yv(),this.loadIfEnabled()):this.if())}reset(){var e,t,i,s;this.tf(),(e=this.jv)===null||e===void 0||e.clearQueue(),this.Ju=[],(t=this.jv)===null||t===void 0||t.reset(),(i=this.Bv)===null||i===void 0||i.clearQueue(),this.Rv=[],(s=this.Bv)===null||s===void 0||s.reset(),this.Rd=0}captureLog(e){!this.Ci&&this.xa&&this.Gv().captureLog(e)}captureConsoleLog(e){!this.Ci&&this.xa&&this.Jv().captureLog(e)}captureBufferedConsoleLog(e,t,i){!this.Ci&&this.xa&&this.Jv().captureLog(e,{context:t,occurredAtMs:i})}md(){var e;this.tf(),(e=this.Bv)===null||e===void 0||e.clearQueue(),this.Rv=[]}if(){this.Mv||this.tf()}Yv(){var e;if(this.Dv||!(!((e=this.Vd)===null||e===void 0)&&e.console))return;const t=Wo(this.Ta.get()).maxBufferSize;let i=!0;this.Ov.push(()=>{i=!1});for(const s of hv){let r;try{r=vv(this.Vd.console[s])}catch{continue}r&&this.Ov.push(zt(this.Vd.console,s,n=>{const o=(...a)=>{try{i&&this.nf(s,a,t)}catch{}return n.apply(this.Vd.console,a)};return o.__rrweb_original__=r,o}))}this.Dv=!0,this.sf=setTimeout(()=>{this.tf()},3e4)}nf(e,t,i){var s;if(this.Dv&&!this.Lv&&t.length!==0)if(!((s=this.xa)===null||s===void 0)&&s.canCapture){if(i>this.Fv.length){this.Lv=!0;try{this.Fv.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Iv()})}finally{this.Lv=!1}}}else this.tf()}tf(){if(this.Fv=[],this.Dv){this.Dv=!1,this.sf&&(clearTimeout(this.sf),this.sf=void 0);for(const e of this.Ov)e();this.Ov=[]}}rf(){const e=this.Fv;return this.tf(),e}get logger(){return this.af||(this.af={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.af}flushLogs(e){this.xa&&(e?this.lf(e):(this.jv&&this.jv.flush().catch(t=>this.uf(t)),this.Bv&&this.Bv.flush().catch(t=>this.uf(t))))}flush(){var e=this;return Q(function*(){var t,i;const s=(t=e.jv)===null||t===void 0?void 0:t.flush().catch(n=>e.uf(n)),r=(i=e.Bv)===null||i===void 0?void 0:i.flush().catch(n=>e.uf(n));yield s,yield r})()}uf(e){Jo(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.Ci||!this.Mv||this.Ev||this.Pv)return;const e=this.Hv();if(e){this.Pv=!0;try{e((t,i)=>{if(this.Pv=!1,!this.Ci&&this.Mv)if(t||!i)this.$.error("Could not load logs script",t),this.tf();else{const s=this.rf();this.ef=i.initialize(this.xa),this.Ev=!0,s.length>0&&i.replay(this.xa,s)}})}catch(t){throw this.Pv=!1,t}}else this.tf()}Vv(e,t){const i=this.xa;return{get isDisabled(){return!1},get optedOut(){return!i.canCapture},getPersistedProperty:s=>s===je.LogsQueue?e():void 0,setPersistedProperty(s,r){s===je.LogsQueue&&t(r??[])},js:s=>this.js(s),getLibraryId:()=>i.library.name,getLibraryVersion:()=>i.library.version}}js(e){return new Promise(t=>{if(Dl(this.Rd,3))return void t({kind:"fatal",error:tr(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const s=o=>{i||(i=!0,clearTimeout(r),t(o))},r=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:tr(void 0,"logs request timed out")})},9e4),n=this.zv;this.xa.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.xa.projectToken},body:e,compression:"best-available",timeoutMs:6e4}).then(o=>{var a;const l=o.statusCode;this.cf(l,n),l>=200&&300>l?s({kind:"ok"}):l===413?s({kind:"too-large"}):l!==0&&l!==408&&l!==429&&500>l?s({kind:"fatal",error:new Error(`logs request failed with status ${l}`)}):l===0?(o.error||this.$.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:tr(o.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:(a=o.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${l}`)})},o=>{s({kind:"retry-later",error:o})})})}cf(e,t){(e!==0||t)&&(this.Rd=Nl(e,this.Rd,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}lf(e){this.Ju.length>0&&this.hf(e,this.Ju,this.Zv,this.xa.library.name,t=>{this.Ju=t}),this.Rv.length>0&&this.hf(e,this.Rv,this.Xv,Go,t=>{this.Rv=t})}hf(e,t,i,s,r){if(t.length===0)return;const n=t.map(a=>a.record);r([]);const o=Qa(n,Xa(i,this.xa.library.name,this.xa.library.version),s,this.xa.library.version);this.xa.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.xa.projectToken},body:o,compression:"best-available",transport:e,timeoutMs:6e4}).catch(a=>this.uf(a))}},ds=te("[NetworkMetrics]"),an=()=>{var e;return!(w==null||(e=w.performance)===null||e===void 0)&&e.now?w.performance.now():Date.now()},fv={"http:":80,"https:":443},gv=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),wc=(e,t)=>{var i;const s=String(t);return{method:String(e).toUpperCase(),url:((i=Ye(s))===null||i===void 0?void 0:i.href)||s}},Lr=(e,t,i,s,r,n,o=!1)=>{try{var a,l;const c=r();if(!c)return;const u=i||void 0,h=an()-s,d=Ye(t.url);if(d&&d.protocol!=="http:"&&d.protocol!=="https:")return;const v={url:d?.href||t.url,method:t.method},f=ne(c.name)?c.name(v):N(c.name)?c.name:"http.client.request.duration";if(!f)return;const m=o&&!u?void 0:((y,_)=>y?400>y?void 0:String(y):_?.name||"_OTHER")(u,n),g=p(p(p(p(p({},(y=>{const _=gv.has(y)?y:"_OTHER";return p({"http.request.method":_},_==="_OTHER"&&y!==_?{"http.request.method_original":y}:{})})(v.method)),d?(y=>{return{"server.address":y.hostname.startsWith("[")&&y.hostname.endsWith("]")?y.hostname.slice(1,-1):y.hostname,"server.port":Number(y.port)||fv[y.protocol],"url.scheme":y.protocol.slice(0,-1),"url.template":(_=y.pathname,_.split("/").map(b=>(E=>/^\d+$/.test(E)||E.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(E))(b)?":id":b).join("/"))};var _})(d):{}),u?{"http.response.status_code":u}:{}),m?{"error.type":m}:{}),(a=c.attributes)===null||a===void 0?void 0:a.call(c,v,{status:u,durationMs:h}));(l=e.metrics)===null||l===void 0||l.histogram(f,h,{unit:"ms",attributes:g})}catch(c){ds.error("Failed to record network metric",c)}},xc=()=>{},_v=(e,t)=>ne(w?.fetch)?zt(w,"fetch",i=>function(...s){const r=an(),n=i.apply(this,s);if(!t())return n;try{var o,a,l;const[c,u]=s,h=wc((o=(a=u?.method)!==null&&a!==void 0?a:c?.method)!==null&&o!==void 0?o:"GET",(l=c?.url)!==null&&l!==void 0?l:c);return n.then(d=>(Lr(e,h,d?.status,r,t,void 0,!0),d),d=>{throw Lr(e,h,void 0,r,t,d),d})}catch(c){return ds.error("Failed to observe fetch",c),n}}):xc,mv=(e,t)=>{var i;const s=w==null||(i=w.XMLHttpRequest)===null||i===void 0?void 0:i.prototype;if(!s)return xc;const r=new WeakMap,n=zt(s,"open",a=>function(...l){try{Ql.has(this)||r.set(this,wc(l[0],l[1]))}catch(c){ds.error("Failed to observe XHR open",c)}return a.apply(this,l)}),o=zt(s,"send",a=>function(...l){let c;try{const u=r.get(this);if(u&&t()){const h=an();c=()=>{this.removeEventListener("loadend",c),Lr(e,u,this.status,h,t)},z(this,"loadend",c)}}catch(u){ds.error("Failed to observe XHR send",u)}try{return a.apply(this,l)}catch(u){throw c&&this.removeEventListener("loadend",c),u}});return()=>{n(),o()}},Yo=new WeakMap,yv=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),bv={maxStringLength:2048,truncationSuffix:"..."},wv={maxStringLength:2048,truncationSuffix:"..."};function Ko(e){if(e)return e===!0?{intent:!0,model:!0}:{intent:e.intent!==!1,model:e.model!==!1}}function ir(e,t){return{}.hasOwnProperty.call(e,t)}function sr(e,t){const i=Object.create(e);return t&&Object.defineProperty(i,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:t}),i}function Xo(e,t,i=!1){if(!N(e))return;const s=e.trim();return s?(i?Wa(s,bv):s).slice(0,t):void 0}function Qo(e){try{return D(e)&&e.isError===!0}catch{return!1}}function $c(e){return Wa(e||"Unknown error",wv).slice(0,2048)}function xv(e,t){try{return $c(t?(function(i){try{return!D(i)||!I(i.content)?void 0:i.content.filter(s=>D(s)&&s.type==="text"&&N(s.text)).map(s=>s.text).join(" ").trim()||void 0}catch{return}})(e):D(e)&&N(e.message)?e.message:N(e)?e:String(e))}catch{return"Unknown error"}}function $v(e,t,i){return t.errorResult?[{type:"Error",value:i,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:e.buildProperties(t.error,{handled:!0}).$exception_list.map(s=>p(p({},s),{},{value:$c(s.value)}))}function Ev(e,t){if(t)return"Error";try{if(!D(e))return"Error";let i=N(e.name)?e.name.trim():"";const s=e.constructor;return i&&i!=="Error"||!ne(s)||s.name==="Error"||(i=s.name),(i||"Error").slice(0,256)}catch{return"Error"}}function kv(e,t){return{message:xv(e,t),type:Ev(e,t)}}var gs={featureFlags:class extends ov{constructor(e){const t=new av(e.config,e.Qu());super(t),this.name=_c,this._instance=e,this.df=t}get Hd(){return this._instance.persistence}updateConfig(e,t){this.df.update(e,t),this.Ud()}}},Sv={sessionRecording:class{get Ar(){return this._instance.config}get _c(){return this._instance.persistence}get started(){var e;return!!(!((e=this.vf)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.ff==="awaiting_config"||this.ff==="missing_config"?this.ff:(e=(t=this.vf)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.ff}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.ff=Xs,this.pf=void 0,this.gf=!1,this.Je=(()=>{var t,i;if(!O?.visibilityState||O.visibilityState==="visible")return!0;const s=w==null||(t=w.performance)===null||t===void 0||(i=t.getEntriesByType)===null||i===void 0?void 0:i.call(t,"visibility-state");return!s?.length||s.some(r=>r.name==="visible")})(),this.sn=()=>{var t,i;O?.visibilityState==="visible"&&(this.Je=!0,(t=this.vf)===null||t===void 0||(i=t.setDocumentWasEverVisible)===null||i===void 0||i.call(t,!0))},!this._instance.sessionManager)throw He.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Ar.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');O!=null&&O.addEventListener&&z(O,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.gf=!0,O==null||(t=O.removeEventListener)===null||t===void 0||t.call(O,"visibilitychange",this.sn),e?this.mf(!0):this.stopRecording()}get yf(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),i=!this.Ar.disable_session_recording,s=this.Ar.disable_session_recording||this._instance.consent.isOptedOut();return w&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(this.gf||this.yf&&(!((t=this.vf)===null||t===void 0)&&t.isStarted))return;const i=!x(Object.assign)&&!x(Array.from);this.yf&&i?(this.bf(e),He.info("starting")):(this.ff=Xs,this.stopRecording())}bf(e){var t,i;if(this.yf)if(this.ff!=="awaiting_config"&&this.ff!=="missing_config"&&(this.ff=Fo),(R==null||(t=R.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((i=R.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording))this._f(e);else{var s,r;const n=this._instance.sessionManager;(s=R.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this._instance,this.wf,o=>{if(!this.gf&&this.yf&&this._instance.sessionManager===n)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),He.error("could not load recorder",o)):void this._f(e);this.ff="disabled"})}}stopRecording(){var e,t;(e=this.pf)===null||e===void 0||e.call(this),this.pf=void 0,(t=this.vf)===null||t===void 0||t.stop()}mf(e=!1){var t,i;(t=this.pf)===null||t===void 0||t.call(this),this.pf=void 0,(i=this.vf)===null||i===void 0||i.discard({discardProducerEvents:e})}kf(){var e,t;(e=this._c)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this._c)===null||t===void 0||t.unregister("$replay_sample_rate")}Sf(e,t){if(L(e))return null;const i=oe(e)?e:parseFloat(e);return typeof(s=i)!="number"||!Number.isFinite(s)||0>s||s>1?(He.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}xf(e){if(this._c){var t,i;const s=this._c,r=()=>{var n;const o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.Sf((n=this.Ar.session_recording)===null||n===void 0?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.Sf(o?.sampleRate,"remote config sampleRate"),c=a??l;L(c)&&this.kf();const u=o?.minimumDurationMilliseconds;s.register({[di]:p(p({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:p({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:x(u)?null:u,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};r(),(t=this.pf)===null||t===void 0||t.call(this),this.pf=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.onSessionId(r)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;t&&"sessionRecording"in t?t.sessionRecording===!1?(this.xf(t),this.mf()):(this.xf(t),this.startIfEnabledOrStop()):(this.ff==="awaiting_config"&&(this.ff="missing_config",this._instance.register_for_session({[Kr]:!0}),He.warn("config refresh failed, recording will not start until page reload")),this.startIfEnabledOrStop())}log(e,t="log"){var i;!((i=this.vf)===null||i===void 0)&&i.log?this.vf.log(e,t):He.warn("log called before recorder was ready")}get wf(){var e,t;const i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(di);return(i==null||(t=i.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}$f(){const e=this._instance.get_property(di);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(i){return He.warn("persisted remote config for session recording is invalid and will be ignored",i),!1}return!L(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}_f(e){var t,i,s;if(!this.gf&&this.yf&&this._instance.sessionManager){if(!(!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return He.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Yr]:!0});var r;if(this.vf||(this.vf=(r=R.__PosthogExtensions__)===null||r===void 0?void 0:r.initSessionRecording(this._instance,this.Je),this.vf._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.$f()){if(this.ff==="missing_config"||this.ff==="awaiting_config")return;this.ff="awaiting_config",He.info("persisted remote config is stale, requesting fresh config before starting"),new Gl(this._instance).load();return}this.ff=Fo,(i=(s=this.vf).setDocumentWasEverVisible)===null||i===void 0||i.call(s,this.Je),this.vf.start(e)}else this.ff=Xs}onRRwebEmit(e){var t,i;(t=this.vf)===null||t===void 0||(i=t.onRRwebEmit)===null||i===void 0||i.call(t,e)}overrideLinkedFlag(){var e,t;this.vf||(t=this._c)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.vf)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.vf||(t=this._c)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.vf)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,i;this.vf||(i=this._c)===null||i===void 0||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.vf)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;const t={};for(const s of Kh){var i;const r=(i=this._instance.sessionPersistence)===null||i===void 0?void 0:i.get_property(s);x(r)||(t[s]=r)}return p(p({},t),((e=this.vf)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var i;return!!(!((i=this.vf)===null||i===void 0)&&i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.vf)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},Pv={autocapture:class extends Rh{constructor(e){super(new Wh(e)),this.instance=e}},historyAutocapture:class{constructor(e){this.Cf=!1,this._instance=e,this.Tf=this.If()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.Mf();return!!(e.path||e.search||this.Ef(e))}startIfEnabled(){this.isEnabled&&(S.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Tf=this.If(),this.startIfEnabled()}stop(){this.Pf&&this.Pf(),this.Pf=void 0,this.Rf&&this.Rf(),this.Rf=void 0,S.info("History API monitoring stopped")}monitorHistoryChanges(){w&&w.history&&(this.Af("pushState"),this.Af("replaceState"),this.Ff(),this.Ef()&&this.Of())}Af(e){var t;if(!w||!((t=w.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const i=this;zt(w.history,e,s=>function(r,n,o){var a;i.Df(o)&&i.Lf(),s.call(this,r,n,o),i.Nf(e,!i.Cf&&(w==null||(a=w.event)===null||a===void 0?void 0:a.type)!=="popstate")})}If(){const e=w?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}Mf(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:D(e)?e:{}}Ef(e=this.Mf()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}qf(e){const t=this.Mf(),i=this.Tf;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this.Ef(t)&&e.hash!==i.hash))}Nf(e,t=!1){try{t||this.Lf();const i=this.If();if(!i)return;if(this.qf(i)){const s=()=>this._instance.capture(Xr,{navigation_type:e});t?(this.jf=s,Promise.resolve().then(()=>this.Lf())):s()}this.Tf=i}catch(i){S.error(`Error capturing ${e} pageview`,i)}}Df(e){var t,i;return!(L(e)||!w)&&((t=Ye(String(e)))===null||t===void 0?void 0:t.href)!==((i=w.location)===null||i===void 0?void 0:i.href)}Lf(){const e=this.jf;if(e){this.jf=void 0,this.Cf=!0;try{e()}catch(t){S.error("Error capturing deferred pageview",t)}finally{this.Cf=!1}this.Tf=this.If()}}Ff(){if(this.Pf)return;const e=()=>{this.Nf("popstate")};z(w,"popstate",e),this.Pf=()=>{w&&w.removeEventListener("popstate",e)}}Of(){if(this.Rf)return;const e=()=>{this.Nf("hashchange")};z(w,"hashchange",e),this.Rf=()=>{w&&w.removeEventListener("hashchange",e)}}},heatmaps:class{get Ar(){return this.instance.config}constructor(e){var t;this.Bf=!1,this.ll=!1,this.zf=null,this.instance=e,this.Bf=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[mr]),this.rageclicks=new fc(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return D(this.Ar.capture_heatmaps)&&this.Ar.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ar.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return L(this.Ar.capture_heatmaps)?L(this.Ar.enable_heatmaps)?this.Bf:this.Ar.enable_heatmaps:this.Ar.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ll)return;Xh.info("starting..."),this.Hf(),this.sn()}else{var e;clearInterval((e=this.zf)!==null&&e!==void 0?e:void 0),this.Uf(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[mr]:i}),this.Bf=i,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}Wf(e){Qs(e.originalEvent)&&this.Er(e.originalEvent,"deadclick")}sn(){this.zf&&clearInterval(this.zf),this.zf=O?.visibilityState==="visible"?setInterval(this.rc.bind(this),this.flushIntervalMilliseconds):null}Hf(){w&&O&&(this.Vf=this.rc.bind(this),z(w,rs,this.Vf),this.Gf=e=>this.Er(e||w?.event),z(O,"click",this.Gf,{capture:!0}),this.Qf=e=>this.Zf(e||w?.event),z(O,"mousemove",this.Qf,{capture:!0}),this.Jf=new no(this.instance,Jd,this.Wf.bind(this)),this.Jf.startIfEnabledOrStop(),this.Kf=this.sn.bind(this),z(O,Mt,this.Kf),this.ll=!0)}Uf(){var e;w&&O&&(this.Vf&&w.removeEventListener(rs,this.Vf),this.Gf&&O.removeEventListener("click",this.Gf,{capture:!0}),this.Qf&&O.removeEventListener("mousemove",this.Qf,{capture:!0}),this.Kf&&O.removeEventListener(Mt,this.Kf),clearTimeout(this.Xf),(e=this.Jf)===null||e===void 0||e.stop(),this.ll=!1)}Yf(e,t){const i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(o,a,l){let c=o;for(;c&&Ie(c)&&!ae(c,"body");){if(c===l)return!1;let v;try{var u,h,d;v=(u=(h=(d=c.ownerDocument)===null||d===void 0?void 0:d.defaultView)!==null&&h!==void 0?h:w)===null||u===void 0?void 0:u.getComputedStyle(c).position}catch{return!1}if(T(a,v))return!0;c=Al(c)}return!1})(pi(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}Er(e,t="click"){var i;if(Jn(e.target)||!Qs(e))return;const s=this.Yf(e,t);(i=this.rageclicks)!==null&&i!==void 0&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Cl(pi(e),this.instance.config.rageclick)&&this.Qs(p(p({},s),{},{type:"rageclick"})),this.Qs(s)}Zf(e){!Jn(e.target)&&Qs(e)&&(clearTimeout(this.Xf),this.Xf=setTimeout(()=>{this.Qs(this.Yf(e,"mousemove"))},500))}Qs(e){if(!w)return;const t=this.Ar.disable_capture_url_hashes?lt(w.location.href):w.location.href,i=this.Ar.custom_personal_data_properties,s=this.Ar.mask_personal_data_properties?[...Ht,...i||[]]:[],r=$i(t,s,Ei);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}rc(){this.Rt&&!Ee(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:no,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.Bf=!1,this.ll=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.tp=(i=!1)=>{clearTimeout(this.ep),this.ep=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",p({$current_url:this.Rt.url},this.Rt.metrics.reduce((s,r)=>p(p({},s),{},{[`$web_vitals_${r.name}_event`]:p({},r),[`$web_vitals_${r.name}_value`]:r.value}),{})),i?{transport:"sendBeacon",send_instantly:!0}:void 0),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.np=i=>{var s;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},L(i?.name)||L(i?.value))return void dt.error("Invalid metric received",i);const r=typeof i.navigationURL=="string"?i.navigationURL:void 0,n=this.sp(r);if(x(n))return;const o=oe(i.navigationId)||typeof i.navigationId=="string"?`navigation:${i.navigationId}`:`url:${n}`;if(this.rp&&i.value>=this.rp)return void dt.error("Ignoring metric with value >= "+this.rp,i);this.Rt.navigationKey!==o&&(this.tp(),this.ep=setTimeout(this.tp,this.flushToCaptureTimeoutMs)),x(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=n),this.Rt.firstMetricTimestamp=x(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(s=this._instance.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0),l=p(p(p({},i),r?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete l.entries,D(i.attribution)&&this.attributionMetrics.indexOf(i.name)>-1){const c={};for(const u of Yh){const h=u==="url"&&typeof i.attribution[u]=="string"?this.sp(i.attribution[u]):i.attribution[u];x(h)||(c[u]=h)}l.attribution=c}else delete l.attribution;x(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.Rt.metrics.push(l),this.Rt.metrics.length===this.allowedMetrics.length&&this.tp()},this.op=()=>{if(this.ll)return;let i,s,r,n,o=!1;const a=R.__PosthogExtensions__,l=a?.postHogWebVitalsCallbacksByFlavor,c=l?.[this.ap]||(this.ap==="web-vitals"&&x(l)?a?.postHogWebVitalsCallbacks:void 0);if(!x(c)){const v=c.withoutAttribution,f=this.attributionMetrics;o=!x(v),i=f.indexOf("LCP")>-1?c.onLCP:v?.onLCP||c.onLCP,s=f.indexOf("CLS")>-1?c.onCLS:v?.onCLS||c.onCLS,r=f.indexOf("FCP")>-1?c.onFCP:v?.onFCP||c.onFCP,n=f.indexOf("INP")>-1?c.onINP:v?.onINP||c.onINP}if(!(i&&s&&r&&n))return void dt.error("web vitals callbacks not loaded - not starting");const u={reportSoftNavs:this.useSoftNavs},h=o&&this.attributionMetrics.indexOf("INP")>-1?p(p({},u),{},{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&i(this.np.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&s(this.np.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&r(this.np.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&n(this.np.bind(this),h);const d=w?.document;z(d,Mt,()=>{d?.visibilityState==="hidden"&&this.tp(!0)}),z(w,"pagehide",()=>this.tp(!0)),this.ll=!0},this.Bf=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[wr]),this.startIfEnabled()}get lp(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const i=D(this.lp)?(e=this.lp)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return L(i)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||Io:i}get flushToCaptureTimeoutMs(){return(D(this.lp)?this.lp.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=D(this.lp)?this.lp.web_vitals_attribution:void 0;return be(e)?e?Io:[]:I(e)?e:Jh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=D(this.lp)?this.lp.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get rp(){const e=D(this.lp)&&oe(this.lp.__web_vitals_max_value)?this.lp.__web_vitals_max_value:To;return e>0&&6e4>=e?To:e}get isEnabled(){const e=K?.protocol;if(e!=="http:"&&e!=="https:")return dt.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=D(this.lp)?this.lp.web_vitals:be(this.lp)?this.lp:void 0;return be(t)?t:this.Bf}startIfEnabled(){this.isEnabled&&!this.ll&&(dt.info("enabled, starting..."),this.Ml(this.op))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const i=D(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=D(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[wr]:i}),this._instance.persistence.register({[ol]:s})),this.Bf=i,this.startIfEnabled()}get ap(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ml(e){var t;const i=R.__PosthogExtensions__,s=this.ap,r=i?.postHogWebVitalsCallbacksByFlavor;r?.[s]||s==="web-vitals"&&x(r)&&i?.postHogWebVitalsCallbacks?e():i==null||(t=i.loadExternalDependency)===null||t===void 0||t.call(i,this._instance,s,n=>{n?dt.error("failed to load script",n):e()})}sp(e){const t=e||w?.location.href;if(!t)return void dt.error("Could not determine current URL");const i=this._instance.config.disable_capture_url_hashes?lt(t):t,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Ht,...s||[]]:[];return $i(i,r,Ei)}}},Av={exceptionObserver:class{constructor(e){var t;this.op=()=>{var i;if(!w||!this.isEnabled||!(!((i=R.__PosthogExtensions__)===null||i===void 0)&&i.errorWrappingFunctions))return;const s=R.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=R.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=R.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.up&&this.Ar.capture_unhandled_errors&&(this.up=s(this.captureException.bind(this))),!this.cp&&this.Ar.capture_unhandled_rejections&&(this.cp=r(this.captureException.bind(this))),!this.hp&&this.Ar.capture_console_errors&&(this.hp=n(this.captureException.bind(this)))}catch(o){ii.error("failed to start",o),this.dp()}},this._instance=e,this.vp=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[yr]),this.wt=new Dc(p(p({},(function(i={}){var s,r,n,o;return{refillRate:(s=(r=i.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:i.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:1,bucketSize:(n=(o=i.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:i.__exceptionRateLimiterBucketSize)!==null&&n!==void 0?n:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:ii})),this.Ar=this.fp(),this.startIfEnabledOrStop()}fp(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return D(e)?t=p(p({},t),e):(x(e)?this.vp:e)&&(t=p(p({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Ar.capture_console_errors||this.Ar.capture_unhandled_errors||this.Ar.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ii.info("enabled"),this.dp(),this.Ml(this.op)):this.dp()}Ml(e){var t,i,s;!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"exception-autocapture",r=>{if(r)return ii.error("failed to load script",r);e()})}dp(){var e,t,i;(e=this.up)===null||e===void 0||e.call(this),this.up=void 0,(t=this.cp)===null||t===void 0||t.call(this),this.cp=void 0,(i=this.hp)===null||i===void 0||i.call(this),this.hp=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.vp=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[yr]:this.vp}),this.Ar=this.fp(),this.startIfEnabledOrStop())}onConfigChange(){this.Ar=this.fp()}captureException(e){try{var t,i,s;const r=(t=e==null||(i=e.$exception_list)===null||i===void 0||(i=i[0])===null||i===void 0?void 0:i.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(r))return void ii.info("Skipping exception capture because of client rate limiting.",{exception:r});(s=this._instance.exceptions)===null||s===void 0||s.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,i;this.pp=[],this.gp=new Yc([new uu,new yu,new hu,new du,new _u,new gu,new pu,new mu],(function(s,...r){return(n,o=0)=>{const a=[],l=n.split(`
3
+ `),c=Math.min(l.length,o+1e3),u=[];for(let v=o;c>v;v++){const f=l[v];if(f.length>1024)continue;const m=Sn.test(f)?f.replace(Sn,"$1"):f;if(!m.match(/\S*Error: /)){for(const g of r){const y=g(m,s);if(y){a.push(y);const _=ou(a);if(_){for(let b=u.length-1;b>=0;b--){const E=u[b];if(_.start>=E.start+E.length)break;u.pop()}u.push(_)}break}}if(lu(a,u)>=50)break}}const h=[...u].sort((v,f)=>f.start-v.start),d=h[h.length-1];if(d){const v=Da(a,d);a.splice(d.start-v,v);for(const f of h)f.start-=v}for(const v of h)au(a,v);return u.some(v=>v.start===0&&a.length===v.length)&&(function(v){const f=v.map(g=>`${g.function}|${g.filename}|${g.lineno}|${g.colno}|${g.module}`);let m=0;for(let g=1;f.length>g;g++)cu(f,g,m)&&(m=g);v.push(...v.splice(0,m))})(a),(function(v){if(!v.length)return[];const f=Array.from(v);return f.reverse(),f.slice(0,50).map(m=>{return p(p({},m),{},{filename:m.filename||(g=f,g[g.length-1]||{}).filename,function:m.function||"?"});var g})})(a)}})("web:javascript",iu,nu)),this._instance=e,this.pp=(t=(i=this._instance.persistence)===null||i===void 0?void 0:i.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.mp=Qi(this.yp()),this.bp=new wu(this.mp)}onConfigChange(){this.mp=Qi(this.yp()),this.bp.setConfig(this.mp)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;const r=e.config;if(!("errorTracking"in r))return;const n=(t=(i=r.errorTracking)===null||i===void 0?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],o=(s=r.errorTracking)===null||s===void 0?void 0:s.captureExtensionExceptions;this.pp=n,this._instance.persistence&&this._instance.persistence.register({[rl]:this.pp,[br]:o})}get _p(){var e;const t=!!this._instance.get_property(br),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.gp.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.mp.enabled)try{if(!N(e)||e.trim().length===0)return void Fe.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:s}=(function(r){if(!r)return{sanitizedProperties:{},droppedKeys:[]};const n=[];return{sanitizedProperties:Object.keys(r).reduce((o,a)=>bu.has(a)?(n.push(a),o):(o[a]=r[a],o),{}),droppedKeys:n}})(this.wp(t));s.length>0&&Fe.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.bp.add(p({[Ki]:e,[Xi]:new Date().toISOString()},i))}catch(i){Fe.error("Failed to add exception step. Ignoring breadcrumb.",i)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.kp(t)){if(this.Sp(t))return this.xp("Exception dropped: matched a suppression rule"),void Fe.info("Skipping exception capture because a suppression rule matched");if(!this._p&&this.$p(t))return this.xp("Exception dropped: thrown by a browser extension"),void Fe.info("Skipping exception capture because it was thrown by an extension");if(!this._p&&this.Cp(t))return this.xp("Exception dropped: thrown by an injected browser script"),void Fe.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Tp(t))return this.xp("Exception dropped: thrown by the PostHog SDK"),void Fe.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.mp.enabled&&L(e.$exception_steps)?this.Ip(e):e,s=(function(){if("u">typeof process){var r;const o=(r={}.POSTHOG_RELEASE_ID)===null||r===void 0?void 0:r.trim();if(o)return o}const n=globalThis._posthogReleaseId;return typeof n=="string"&&n.length>0?n:void 0})();s&&(i.$release_id=s);try{const r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",sd:!0});return r&&this.bp.clear(),r}catch(r){zo(r)||Fe.error("Failed to capture exception event. Dropping this exception.",r),this.bp.clear();return}}catch(t){zo(t)||Fe.error("Failed to process exception event. Ignoring this exception.",t);return}}Ip(e){try{const t=this.bp.getAttachable();return t.length===0?e:p(p({},e),{},{$exception_steps:t})}catch(t){return Fe.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}xp(e){this.mp.enabled&&this.bp.add({[Ki]:e,[Xi]:new Date().toISOString()})}wp(e){return D(e)?p({},e):{}}yp(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}Sp(e){if(e.length===0)return!1;try{const t=e.reduce((i,{type:s,value:r})=>(N(s)&&s.length>0&&i.$exception_types.push(s),N(r)&&r.length>0&&i.$exception_values.push(r),i),{$exception_types:[],$exception_values:[]});return this.pp.some(i=>{const s=i.values.map(r=>{const n=hc[r.operator],o=t[r.key];if(!n||!o)return!1;const a=I(r.value)?r.value:[r.value];return a.length>0&&n(a,o)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}catch(t){return Fe.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}$p(e){const t=e.flatMap(s=>{var r,n;return(r=(n=s.stacktrace)===null||n===void 0?void 0:n.frames)!==null&&r!==void 0?r:[]}),i=t.filter(({filename:s})=>!!s&&cv.some(r=>s.startsWith(r)));return i.length!==0&&(!i.every(({filename:s})=>!!s&&s.startsWith(Mr))||e.some(({type:s,value:r})=>s==="NoResponse"||N(r)&&lv.some(({value:n,exact:o})=>o?r===n:r.includes(n)))&&!t.some(({in_app:s,filename:r})=>s&&!r?.startsWith(Mr)))}Cp(e){return e.some(({value:t})=>N(t)&&uv.some(i=>t.includes(i)))}Tp(e){if(e.length>0){var t,i,s,r;const n=(t=(i=e[0].stacktrace)===null||i===void 0?void 0:i.frames)!==null&&t!==void 0?t:[],o=n[n.length-1];return(s=o==null||(r=o.filename)===null||r===void 0?void 0:r.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}kp(e){return!L(e)&&I(e)}}},Ov=p({productTours:class{get _c(){return this._instance.persistence}constructor(e){this.Mp=null,this.Ep=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var i,s;if(this._c&&this._c.register({[Gr]:!!t.productTours}),!Zs(this._instance))return!this.Mp&&L((i=this._c)===null||i===void 0?void 0:i.props.ph_product_tours)||Li.info("product tours disabled; stopping and clearing cached tours"),(s=this.Mp)===null||s===void 0||s.stop(),this.Mp=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Mp&&Zs(this._instance)&&this.Ml(()=>this.Pp())}Ml(e){var t,i,s;!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"product-tours",r=>{r?Li.error("Could not load product tours script",r):e()})}Pp(){var e;!this.Mp&&(e=R.__PosthogExtensions__)!==null&&e!==void 0&&e.generateProductTours&&(this.Mp=R.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(I(this.Ep)&&!t)return void e(this.Ep,{isLoaded:!0});const i=this._c;if(i){const s=i.props[xr];if(I(s)&&!t)return this.Ep=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:s=>{if(!Zs(this._instance))return void e([],{isLoaded:!0});const r=s.statusCode;if(r!==200||!s.json){const o=`Product Tours API could not be loaded, status: ${r}`;r===0?s.error||Li.warn(o):Li.error(o),e([],{isLoaded:!1,error:o});return}const n=I(s.json.product_tours)?s.json.product_tours:[];this.Ep=n,i&&i.register({[xr]:n}),e(n,{isLoaded:!0})}})}getActiveProductTours(e){L(this.Mp)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mp.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Mp)===null||t===void 0||t.showTourById(e)}previewTour(e){this.Mp?this.Mp.previewTour(e):this.Ml(()=>{var t;this.Pp(),(t=this.Mp)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.Mp)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Mp)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.Mp)===null||e===void 0||e.previousStep()}clearCache(){var e;this.Ep=null,(e=this._c)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.Mp)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.Mp)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Mp)===null||t===void 0||t.cancelPendingTour(e)}}},gs),Cv={siteApps:class{constructor(e){this._instance=e,this.Rp=0,this.Ap=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Fp(e,t){if(!t)return;const i=this.globalsForEvent(t);this.Ap.push(i),this.Ap.length>1e3&&(this.Ap=this.Ap.slice(10))}get siteAppLoaders(){var e;return(e=R._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.Fp.bind(this));this.Op=()=>{e(),this.Ap=[],this.Op=void 0}}}globalsForEvent(e){var t,i,s,r,n,o,a;if(!e)throw new Error("Event payload is required");const l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(const[v,f]of Object.entries(u))l[v]={id:c[v],type:v,properties:f};const{$set_once:h,$set:d}=e;return{event:p(p({},Ua(e,Qh)),{},{properties:p(p(p({},e.properties),d?{$set:p(p({},(t=(i=e.properties)===null||i===void 0?void 0:i.$set)!==null&&t!==void 0?t:{}),d)}:{}),h?{$set_once:p(p({},(s=(r=e.properties)===null||r===void 0?void 0:r.$set_once)!==null&&s!==void 0?s:{}),h)}:{}),elements_chain:(n=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Dp(e){var t;const i=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return i==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(De.error("prepare_external_dependency_stylesheet returned null"),null):i==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(De.error("prepare_external_dependency_script returned null"),null):e}Lp(){var e,t,i,s,r,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const l=O?.defaultView,c=l==null||(e=l.Node)===null||e===void 0?void 0:e.prototype;if(!l||!c)return()=>{};if(this.Rp++,this.Np)return this.qp();const u=[],h=this,d=new WeakSet,v=(g,y,_)=>{if(!g?.[y])return;const b=g[y];g[y]=_(b),u.push(()=>{g[y]=b})},f=g=>{if(d.has(g))return g;const y=h.Dp(g);return y&&d.add(y),y},m=g=>g.map(y=>typeof y=="string"?y:f(y)).filter(y=>!se(y));return v(c,"appendChild",g=>function(y){const _=f(y);return _?g.call(this,_):y}),v(c,"insertBefore",g=>function(y,_){const b=f(y);return b?g.call(this,b,_):y}),v(c,"replaceChild",g=>function(y,_){const b=f(y);return b?g.call(this,b,_):_}),[(t=l.Element)===null||t===void 0?void 0:t.prototype,(i=l.Document)===null||i===void 0?void 0:i.prototype,(s=l.DocumentFragment)===null||s===void 0?void 0:s.prototype].forEach(g=>{v(g,"append",y=>function(..._){return y.apply(this,m(_))}),v(g,"prepend",y=>function(..._){return y.apply(this,m(_))})}),[(r=l.Element)===null||r===void 0?void 0:r.prototype,(n=l.CharacterData)===null||n===void 0?void 0:n.prototype,(o=l.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(g=>{v(g,"before",y=>function(..._){return y.apply(this,m(_))}),v(g,"after",y=>function(..._){return y.apply(this,m(_))}),v(g,"replaceWith",y=>function(..._){const b=m(_);return _.length&&!b.length?void 0:y.apply(this,b)})}),v((a=l.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",g=>function(y,_){const b=f(_);return b?g.call(this,y,b):null}),this.Np=()=>{u.forEach(g=>g()),this.Np=void 0},this.qp()}qp(){let e=!1;return()=>{var t;e||(e=!0,this.Rp--,this.Rp===0&&((t=this.Np)===null||t===void 0||t.call(this)))}}jp(e,t=!0){const i=this.Lp();try{const s=e(i);return t&&i(),s}catch(s){throw i(),s}}setupSiteApp(e){const t=this.apps[e.id],i=()=>{var n;!t.errored&&this.Ap.length&&(De.info(`Processing ${this.Ap.length} events for site app with id ${e.id}`),this.Ap.forEach(o=>this.jp(()=>{var a;return(a=t.processEvent)===null||a===void 0?void 0:a.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((n=this.Op)===null||n===void 0||n.call(this))};let s=!1;const r=n=>{t.errored=!n,t.loaded=!0,De.info(`Site app with id ${e.id} ${n?"loaded":"errored"}`),s&&i()};try{const{processEvent:n}=this.jp(o=>e.init({posthog:this._instance,callback(a){o(),r(a)}}),!1);n&&(t.processEvent=n),s=!0}catch(n){De.error(Ro+e.id,n),r(!1)}if(s&&t.loaded)try{i()}catch(n){De.error(`Error while processing buffered events PostHog app with config id ${e.id}`,n),t.errored=!0}}Bp(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}zp(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const i of Object.values(this.apps))try{this.jp(()=>{var s;return(s=i.processEvent)===null||s===void 0?void 0:s.call(i,t)})}catch(s){De.error(`Error while processing event ${e.event} for site app ${i.id}`,s)}}onRemoteConfig(e){var t,i,s;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.Bp(),void this._instance.on("eventCaptured",a=>this.zp(a))):void De.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.Op)===null||i===void 0||i.call(this),!e.ok)return;const r=e.config;if(!((s=r.siteApps)===null||s===void 0)&&s.length)if(this.isEnabled)for(const{id:a,url:l}of r.siteApps){var n,o;R[`__$$ph_site_app_${a}`]=this._instance,(n=R.__PosthogExtensions__)===null||n===void 0||(o=n.loadSiteApp)===null||o===void 0||o.call(n,this._instance,l,c=>{if(c)return De.error(Ro+a,c)})}else De.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Tv={tracingHeaders:class{constructor(e){this._instance=e,this.Hp=void 0,this.Up=void 0,this.Wp=void 0,this.op=()=>{const t=this.Vp();var i,s;t?(x(this.Hp)&&(this.Hp=(i=R.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),x(this.Up)&&(this.Up=(s=R.__PosthogExtensions__)===null||s===void 0||(s=s.tracingHeadersPatchFns)===null||s===void 0?void 0:s._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.dp()}}initialize(){this.startIfEnabledOrStop()}Ml(e){var t,i,s;!((t=R.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(i=R.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"tracing-headers",r=>{if(r)return Gh.error("failed to load script",r);e()})}Gp(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Vp(){const e=this.Gp();return I(e)?(I(this.Wp)?this.Wp.splice(0,this.Wp.length,...e):this.Wp=[...e],e.length>0?this.Wp:void 0):(I(this.Wp)&&this.Wp.splice(0),this.Wp=e||void 0,this.Wp)}dp(){var e,t;(e=this.Hp)===null||e===void 0||e.call(this),(t=this.Up)===null||t===void 0||t.call(this),this.Hp=void 0,this.Up=void 0}startIfEnabledOrStop(){this.Vp()?this.Ml(this.op):this.dp()}}},Iv=p({surveys:class extends iv{constructor(e){super(new sv(e))}}},gs),Fv={toolbar:class{constructor(e){this.instance=e}Qp(e){R.ph_toolbar_state=e}Zp(){var e;return(e=R.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,i=void 0){var s,r;if(Er(this.instance.config)||!w||!O)return!1;e=(s=e)!==null&&s!==void 0?s:w.location,i=(r=i)!==null&&r!==void 0?r:w.history;try{if(!t){try{w.localStorage.setItem("test","test"),w.localStorage.removeItem("test")}catch{return!1}t=w?.localStorage}const n=rv||os(e.hash,"__posthog")||os(e.hash,"state");let o;const a=n?bn(()=>JSON.parse(atob(decodeURIComponent(n))))||bn(()=>JSON.parse(decodeURIComponent(n))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(Lo)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}Jp(e){const t=R.ph_load_toolbar||R.ph_load_editor;!L(t)&&ne(t)?t(e,this.instance):Do.warn("No toolbar load function found")}loadToolbar(e){const t=!!O?.getElementById("__POSTHOG_TOOLBAR__");if(!w||t)return!1;const i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=p(p({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(w.localStorage.setItem(Lo,JSON.stringify(p(p({},s),{},{source:void 0}))),this.Zp()===2)this.Jp(s);else if(this.Zp()===0){var r,n;this.Qp(1),(r=R.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"toolbar",o=>{if(o)return Do.error("[Toolbar] Failed to load",o),void this.Qp(0);this.Qp(2),this.Jp(s)}),z(w,"turbolinks:load",()=>{this.Qp(0),this.loadToolbar(s)})}return!0}Kp(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},Rv=p({experiments:class me{get Ar(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(s=>{me.Xp("retrieved web experiments from the server"),this.Yp=new Map,s.forEach(r=>{if(r.feature_flag_key){var n;this.Yp&&(me.Xp("setting flag key ",r.feature_flag_key," to web experiment ",r),(n=this.Yp)===null||n===void 0||n.set(r.feature_flag_key,r));const o=this._instance.getFeatureFlag(r.feature_flag_key);N(o)&&r.variants[o]&&this.tg(r.name,o,r.variants[o].transforms)}else if(r.variants)for(const o in r.variants){const a=r.variants[o];me.eg(a,this._instance)&&this.tg(r.name,o,a.transforms)}})},i)},this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}initialize(){}onFeatureFlags(t){if(this._is_bot())me.Xp(Vo);else if(!this.Ar.disable_web_experiments){if(L(this.Yp))return this.Yp=new Map,this.loadIfEnabled(),void this.previewWebExperiment();me.Xp("applying feature flags",t),t.forEach(i=>{var s;if(this.Yp&&(!((s=this.Yp)===null||s===void 0)&&s.has(i))){var r;const n=this._instance.getFeatureFlag(i),o=(r=this.Yp)===null||r===void 0?void 0:r.get(i);n&&o!=null&&o.variants[n]&&this.tg(o.name,n,o.variants[n].transforms)}})}}previewWebExperiment(){const t=me.getWindowLocation();if(t?.search){const i=Ut(t?.search,"__experiment_id"),s=Ut(t?.search,"__experiment_variant");i&&s&&(me.Xp(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(r=>{this.ig(parseInt(i),s,r)},!1,!0))}}loadIfEnabled(){this.Ar.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,s){if(this.Ar.disable_web_experiments&&!s)return t([]);const r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Ar.token}`),method:"GET",timestampMode:"query",callback:n=>t(n.statusCode===200&&n.json&&n.json.experiments||[])})}ig(t,i,s){const r=s.filter(n=>n.id===t);r&&r.length>0&&(me.Xp(`Previewing web experiment [${r[0].name}] with variant [${i}]`),this.tg(r[0].name,i,r[0].variants[i].transforms))}static eg(t,i){return!L(t.conditions)&&me.ng(t,i)&&me.sg(t)}static ng(t,i){var s;if(L(t.conditions)||L((s=t.conditions)===null||s===void 0?void 0:s.url))return!0;const r=me.getWindowLocation();if(r){var n,o,a;const l=kl(i,r.href);return!(!((n=t.conditions)===null||n===void 0)&&n.url)||dv[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,l)}return!1}static getWindowLocation(){return w?.location}static sg(t){var i;if(L(t.conditions)||L((i=t.conditions)===null||i===void 0?void 0:i.utm))return!0;const s=jl();if(s.utm_source){var r,n,o,a,l,c,u,h;const d=!(!((r=t.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0)&&r.utm_campaign)||((n=t.conditions)===null||n===void 0||(n=n.utm)===null||n===void 0?void 0:n.utm_campaign)==s.utm_campaign,v=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==s.utm_source,f=!(!((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_medium)||((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0?void 0:c.utm_medium)==s.utm_medium,m=!(!((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0)&&u.utm_term)||((h=t.conditions)===null||h===void 0||(h=h.utm)===null||h===void 0?void 0:h.utm_term)==s.utm_term;return d&&f&&m&&v}return!1}static Xp(t,...i){S.info(`[WebExperiments] ${t}`,i)}tg(t,i,s){this._is_bot()?me.Xp(Vo):i!=="control"?s.forEach(r=>{if(r.selector){var n;me.Xp(`applying transform of variant ${i} for experiment ${t} `,r),((n=document)===null||n===void 0?void 0:n.querySelectorAll(r.selector))?.forEach(o=>{const a=o;r.html&&(a.innerHTML=r.html),r.css&&a.setAttribute("style",r.css)})}}):me.Xp("Control variants leave the page unmodified.")}_is_bot(){return ve&&this._instance?cc(ve,this.Ar.custom_blocked_useragents):void 0}}},gs),Mv={conversations:class{constructor(e){this._instance=e,this.rg=void 0,this._conversationsManager=null,this.og=!1,this.ne=null,this.ag=!1,this.lg=0,this.ug=null,this.cg=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations)return void(this.ug=null);if(this.hg=e.ok,!e.ok)return;const t=e.config.conversations;L(t)?this.ug=null:(be(t)?this.rg=t:(this.rg=t.enabled,this.ne=t),this.rg||(this.ug=null),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.lg++,this.rg=void 0,this.ne=null,this.hg=void 0,this.ag=!1,this.ug=null}loadIfEnabled(){if(this._conversationsManager||this.og||this._instance.config.disable_conversations||Er(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=R?.__PosthogExtensions__;if(e&&!x(this.rg)&&this.rg)if(this.ne&&this.ne.token){this.og=!0;try{const t=e.initConversations;if(t)return this.dg(t),void(this.og=!1);const i=e.loadExternalDependency;if(!i)return void this.vg(zr);const s=this.lg;i(this._instance,"conversations",r=>{if(s!==this.lg)return this.og=!1,void this.loadIfEnabled();r||!e.initConversations?this.vg("Could not load conversations script",r):this.dg(e.initConversations),this.og=!1})}catch(t){this.vg("Error initializing conversations",t),this.og=!1}}else Ce.error("Conversations enabled but missing token in remote config.")}dg(e){if(this.ne){try{this._conversationsManager=e(this.ne,this._instance),this.ag=!1,Ce.info("Conversations loaded successfully")}catch(t){this.vg("Error completing conversations initialization",t);return}this.cg&&this._conversationsManager.setTheme(this.cg),this.fg()}else Ce.error("Cannot complete initialization: remote config is null")}fg(){const e=this.ug;this.ug=null,this._conversationsManager&&e&&(e==="open"?this._conversationsManager.open():this._conversationsManager.close())}vg(e,t){Ce.error(e,t),this._conversationsManager=null,this.og=!1,this.ag=!0}show(){this._conversationsManager?this._conversationsManager.show():Ce.warn("Conversations not loaded yet.")}hide(){this.ug==="open"&&(this.ug=null),this._conversationsManager&&this._conversationsManager.hide()}open(){this._conversationsManager?(this.ug=null,this._conversationsManager.open()):this.ug="open"}close(){this._conversationsManager?(this.ug=null,this._conversationsManager.close()):this.ug="close"}setTheme(e){var t,i;this.cg=p(p(p({},this.cg),e),{},{dark:p(p({},(t=this.cg)===null||t===void 0?void 0:t.dark),e?.dark)}),(i=this._conversationsManager)===null||i===void 0||i.setTheme(e)}isAvailable(){return this.rg===!0&&!se(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Er(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.hg===!1?"remote_config_failed":x(this.rg)?this.hg?"disabled_in_project":"remote_config_pending":this.rg?L(this.ne)||!this.ne.token?"missing_token":R?.__PosthogExtensions__?this.og?"initializing":this.ag?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var s=this;return Q(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(Ce.warn(vt),null)})()}getMessages(e,t){var i=this;return Q(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Ce.warn(vt),null)})()}markAsRead(e){var t=this;return Q(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Ce.warn(vt),null)})()}getTickets(e){var t=this;return Q(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Ce.warn(vt),null)})()}requestRestoreLink(e){var t=this;return Q(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Ce.warn(vt),null)})()}restoreFromToken(e){var t=this;return Q(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Ce.warn(vt),null)})()}restoreFromUrlToken(){var e=this;return Q(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ce.warn(vt),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}fd(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}pd(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},Lv={logs:class extends pv{constructor(e){super({get(){var t;return e==null||(t=e.config)===null||t===void 0?void 0:t.logs},captureHintKey:nl,get remoteConfigWillArrive(){var t,i;return!(!((t=e.Qu)===null||t===void 0)&&t.call(e))||!!(!((i=R._POSTHOG_REMOTE_CONFIG)===null||i===void 0||(i=i[e.config.token])===null||i===void 0)&&i.config)}},()=>(function(t){var i;const s={};if(s.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:r,windowId:n,sessionStartTimestamp:o,lastActivityTimestamp:a}=t.sessionManager.checkAndGetSessionAndWindowId(!0);s.sessionId=r,s.windowId=n,L(o)||(s.sessionStartTimestamp=o),L(a)||(s.lastActivityTimestamp=a)}if(R!=null&&(i=R.location)!==null&&i!==void 0&&i.href&&(s.currentUrl=t.config.disable_capture_url_hashes?lt(R.location.href):R.location.href),t.featureFlags){const r=t.featureFlags.getFlags();r&&r.length>0&&(s.activeFeatureFlags=r)}return s})(e)),this._instance=e,this.name=mc,this.Uv()}get zv(){return this._instance.__loaded}Hv(){const e=te("[logs]"),t=R?.__PosthogExtensions__;if(!t)return void e.error("PostHog Extensions not found.");const i=t.loadExternalDependency;if(i)return s=>{i(this._instance,"logs",r=>{const n=t.logs;s(r,n?.initializeLogs?{initialize:o=>n.initializeLogs(o),replay(o,a){var l;return(l=n.replayConsoleBuffer)===null||l===void 0?void 0:l.call(n,o,a)}}:void 0)})};e.error(zr)}}},Dv={metrics:class{constructor(e){this._instance=e,this.$=te("[metrics]"),this.Ci=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.Ci)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.pg?this.pg=(i=>{let s=!0;const r=()=>s?(a=>{var l;const c=(l=a.config.metrics)===null||l===void 0?void 0:l.network;return c===!0?{}:c||void 0})(i):void 0,n=_v(i,r),o=mv(i,r);return()=>{s=!1,n(),o()}})(this._instance):!t&&this.pg&&(this.pg(),this.pg=void 0)}Gv(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var i;return this.jv&&this.Qv===t||((i=this.jv)===null||i===void 0||i.reset(),this.Qv=t,this.jv=new od(this.Vv(),(function(s){var r,n,o,a,l;const c=s?.resourceAttributes;return{serviceName:(r=c?.["service.name"])!==null&&r!==void 0?r:s?.serviceName,serviceVersion:(n=c?.["service.version"])!==null&&n!==void 0?n:s?.serviceVersion,environment:(o=c?.["deployment.environment"])!==null&&o!==void 0?o:s?.environment,resourceAttributes:c,beforeSend:s?.beforeSend,flushIntervalMs:(a=s?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=s?.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.$)),this.jv}count(e,t=1,i){this.Gv().count(e,t,i)}gauge(e,t,i){this.Gv().gauge(e,t,i)}histogram(e,t,i){this.Gv().histogram(e,t,i)}flush(e){if(!this.jv)return Promise.resolve();if(e){const t=this.jv.drainWindow();return t&&this.po(t,e),Promise.resolve()}return this.jv.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.jv)===null||e===void 0||e.reset()}dispose(){var e,t;this.Ci=!0,(e=this.pg)===null||e===void 0||e.call(this),this.pg=void 0,(t=this.jv)===null||t===void 0||t.reset()}Vv(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},po:i=>t.po(i),getLibraryId:()=>$e.LIB_NAME,getLibraryVersion:()=>$e.LIB_VERSION}}po(e,t){return new Promise(i=>{let s=!1;const r=o=>{s||(s=!0,clearTimeout(n),i(o))},n=setTimeout(()=>r({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(p(p({method:"POST",url:this.gg(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){const a=o.statusCode;if(a>=200&&300>a)r({kind:"ok"});else if(a===413)r({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)r({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var l;r({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error(`metrics request failed with status ${a}`)})}}}))})}gg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Nv={webMCP:class{constructor(e){this._instance=e,this.mg=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.mg)return;const e=O?.modelContext;if(!e||!ne(e.registerTool))return;const t=Yo.get(e);if(t)return t.instances.add(this._instance),void(this.mg=!0);const i={instances:new Set([this._instance])},s=e.registerTool,r=this;zt(e,"registerTool",n=>{const o=n;return function(a,...l){let c=a;try{c=r.yg(a,i)}catch{return o.call(this,a,...l)}return o.call(this,c,...l)}}),e.registerTool!==s&&(Yo.set(e,i),this.mg=!0)}yg(e,t){if(!e||!ne(e.execute))return e;const i=e.execute,s=this,{tool:r,injected:n}=(function(o,a){const l={intent:!1,model:!1},c=o.inputSchema;if(!(function(f){return!!x(f)||D(f)&&Object.keys(f).every(m=>yv.has(m)||m.startsWith("x-"))&&f.additionalProperties!==!0&&!D(f.additionalProperties)&&(!f.type||f.type==="object")&&(!f.properties||D(f.properties))&&(!f.required||I(f.required))})(c))return{tool:sr(o),injected:l};const u=c?.properties||{},h=f=>ir(u,f)||I(c?.required)&&c.required.includes(f);if(l.intent=a.intent&&!h("context"),l.model=a.model&&!h("llm_model"),!l.intent&&!l.model)return{tool:sr(o),injected:l};const d=p({},u),v=I(c?.required)?[...c.required]:[];return l.intent&&(d.context={type:"string",description:`Explain why this tool is called and how it supports the user's goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".`},v.includes("context")||v.push("context")),l.model&&(d.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},v.includes("llm_model")||v.push("llm_model")),{tool:sr(o,p(p({},c),{},{type:c?.type||"object",properties:d,required:v})),injected:l}})(e,(function(o){const a={intent:!1,model:!1};for(const l of o.instances){const c=Ko(l.config.capture_webmcp);a.intent||(a.intent=c?.intent===!0),a.model||(a.model=c?.model===!0)}return a})(t));return Object.defineProperty(r,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const a=new Date,l=(function(v,f){if(!D(v))return{};try{const m=f.intent?Xo(v.context,2048,!0):void 0,g=f.model?Xo(v.llm_model,256):void 0;return p(p({},m&&m!=="{}"?{intent:m}:{}),g&&g.toLowerCase()!=="unknown"?{model:g}:{})}catch{return{}}})(o[0],n),c=(function(v,f){const m=v[0];if(!D(m))return v;try{const g=f.intent&&ir(m,"context"),y=f.model&&ir(m,"llm_model");if(!g&&!y)return v;const _=p({},m);return g&&delete _.context,y&&delete _.llm_model,[_,...v.slice(1)]}catch{return v}})(o,n);let u;try{u=i.apply(this===r?e:this,c)}catch(v){throw s.bg(t,r,a,{error:v,errorResult:!1},l),v}if((h=u)&&typeof h.then=="function")return Promise.resolve(u).then(v=>{const f=Qo(v)?{error:v,errorResult:!0}:void 0;return s.bg(t,r,a,f,l),v},v=>{throw s.bg(t,r,a,{error:v,errorResult:!1},l),v});var h;const d=Qo(u)?{error:u,errorResult:!0}:void 0;return s.bg(t,r,a,d,l),u}}),r}bg(e,t,i,s,r){const n=Date.now()-i.getTime();let o;for(const l of e.instances){var a;const c=Ko(l.config.capture_webmcp);if(c){s&&!o&&(o=kv(s.error,s.errorResult));try{l.capture("$mcp_tool_call",p(p(p({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:t.name,$mcp_resource_name:t.name,$mcp_tool_description:t.description,$mcp_server_name:K?.hostname,$mcp_duration_ms:n,$mcp_is_error:!!s},o?{$mcp_error_type:o.type,$mcp_error_message:o.message}:{}),c.intent&&r.intent?{$mcp_intent:r.intent,$mcp_intent_source:"context_parameter"}:{}),c.model&&r.model?{$mcp_llm_model:r.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:i})}catch{continue}if(s&&o&&l.exceptions&&(!((a=l.exceptionObserver)===null||a===void 0)&&a.isEnabled))try{const u={$exception_list:$v(l.exceptions,s,o.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:t.name,$mcp_resource_name:t.name,$mcp_tool_description:t.description,$mcp_server_name:K?.hostname};l.exceptionObserver.captureException(u)}catch{}}}}}};mi.__defaultExtensionClasses=p({},p(p(p(p(p(p(p(p(p(p(p(p(p(p({},gs),Sv),Pv),Av),Ov),Cv),Iv),Tv),Fv),Rv),Mv),Lv),Dv),Nv));var jv=(function(){$e.SDK_DIST_CHANNEL="npm";const e=gi[oi]=new mi;return(function(){function t(){t.done||(t.done=!0,ac=!1,J(gi,function(i){i._dom_loaded()}))}O?.addEventListener?O.readyState==="complete"?t():z(O,"DOMContentLoaded",t,{capture:!1}):w&&S.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})(),qv=jv;export{qv as default};