@mcp-use/inspector 1.0.0-canary.8 → 1.0.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 (246) hide show
  1. package/dist/cdn/inspector.css +1 -1
  2. package/dist/cdn/inspector.js +81264 -80633
  3. package/dist/client/hooks/useMCPPrompts.d.ts +3 -3
  4. package/dist/client/index.js +13657 -775
  5. package/dist/web/assets/browser-BwHKNEau.js +380 -0
  6. package/dist/web/assets/chunk-BBSBHVGK-D4wCPq_w.js +1 -0
  7. package/dist/web/assets/{chunk-KJ5RBDDO-DJkMH4KI.js → chunk-ECXMLUNG-CSRGaMIB.js} +1 -1
  8. package/dist/web/assets/chunk-JU7W27UC-CMTI_w7A.js +1 -0
  9. package/dist/web/assets/{chunk-QWQYAQCK-CyFuZlX8.js → chunk-QWQYAQCK-BR4V0xsV.js} +1 -1
  10. package/dist/web/assets/{chunk-RPN2XO5I-Boiv0wCv.js → chunk-RPN2XO5I-Cr13Miz-.js} +1 -1
  11. package/dist/web/assets/{chunk-UJPHRNQP-C81GjauI.js → chunk-UJPHRNQP-B14ZPq5a.js} +1 -1
  12. package/dist/web/assets/chunk_array-Bw1lTtex.js +1 -0
  13. package/dist/web/assets/{client-MLH2Q2DK-UzuK4Kji.js → client-2BTCLEUX-BhvJZmo-.js} +3 -3
  14. package/dist/web/assets/client-z1GrRUEs.js +68 -0
  15. package/dist/web/assets/{core-DktjxGrT.js → core-CsUyNVs5.js} +1 -1
  16. package/dist/web/assets/{core-B6Kp8rMh.js → core-GZZnkE26.js} +1 -1
  17. package/dist/web/assets/{display-A5IEINAP-BFwsYEHq.js → display-A5IEINAP-B8BJrcag.js} +2 -2
  18. package/dist/web/assets/{dist-CY62NsuD.js → dist-BZmXa__p.js} +2 -2
  19. package/dist/web/assets/{dist-B_dkmahO.js → dist-DlypDwtn.js} +1 -1
  20. package/dist/web/assets/dist-JsQmV3pO.js +21 -0
  21. package/dist/web/assets/dist-t5Yo0YiG.js +41 -0
  22. package/dist/web/assets/function_calling-kK7um7Ye.js +61 -0
  23. package/dist/web/assets/index-CM9P_1sf.css +2 -0
  24. package/dist/web/assets/index-zlrXpRSB.js +720 -0
  25. package/dist/web/assets/{json-schema-processors-DSIsU0go.js → json-schema-processors-DNSjFPrk.js} +1 -1
  26. package/dist/web/assets/langfuse-U2OEF7K7-BF5JV8uu.js +1 -0
  27. package/dist/web/assets/{llms-ByHaqvCr.js → llms-ByyTYk2T.js} +2 -2
  28. package/dist/web/assets/messages-D4_mH1tk.js +36 -0
  29. package/dist/web/assets/{module-DCsrdi7m.js → module-DbiflUeG.js} +2 -2
  30. package/dist/web/assets/react-C6BFTceN.js +1 -0
  31. package/dist/web/assets/rpc-logger-TPNV75J4-CMVlzCN7.js +1 -0
  32. package/dist/web/assets/{schemas-79owEkeD.js → schemas-BrqAD_Qo.js} +1 -1
  33. package/dist/web/assets/{source-1h9sRCfR.js → source-DeHaVNLZ.js} +1 -1
  34. package/dist/web/assets/stan-r2rUHRuO.js +1 -0
  35. package/dist/web/assets/{stdio-DH6BP75M-C4--HtGN.js → stdio-RWLH66ZO-C753VwJ7.js} +1 -1
  36. package/dist/web/assets/tools-kLe9X8V8.js +2 -0
  37. package/dist/web/index.html +13 -10
  38. package/package.json +8 -17
  39. package/dist/web/assets/browser-DeFVa-Up.js +0 -380
  40. package/dist/web/assets/chunk_array-CT_rI3GZ.js +0 -1
  41. package/dist/web/assets/client-DaI4JaTs.js +0 -68
  42. package/dist/web/assets/dist-Cjn62jmL.js +0 -21
  43. package/dist/web/assets/dist-DWk4vNzA.js +0 -41
  44. package/dist/web/assets/function_calling-BHFkMa4W.js +0 -61
  45. package/dist/web/assets/index-Bd0WP6Xj.js +0 -465
  46. package/dist/web/assets/index-DAB6h2wg.css +0 -2
  47. package/dist/web/assets/langfuse-U2OEF7K7-UPVEn4-O.js +0 -1
  48. package/dist/web/assets/messages-DQuC8BOl.js +0 -1
  49. package/dist/web/assets/react-C-wC1s-h.js +0 -1
  50. package/dist/web/assets/rpc-logger-TPNV75J4-DBofHjaa.js +0 -1
  51. package/dist/web/assets/stan-btJKTWsQ.js +0 -1
  52. package/dist/web/assets/tools-CFpbqXW1.js +0 -2
  53. /package/dist/web/assets/{1c-xAwF9KHw.js → 1c-AGlpZ3Bo.js} +0 -0
  54. /package/dist/web/assets/{abnf-57JF8nOy.js → abnf-CY04oKOo.js} +0 -0
  55. /package/dist/web/assets/{accesslog-C2D2ESC1.js → accesslog-BW-XYbZ-.js} +0 -0
  56. /package/dist/web/assets/{actionscript-BA90Z6ek.js → actionscript-CyrdwIe8.js} +0 -0
  57. /package/dist/web/assets/{ada-BOZemNeY.js → ada-C-TrrrBy.js} +0 -0
  58. /package/dist/web/assets/{angelscript-BPuRd7Au.js → angelscript-CRTYantF.js} +0 -0
  59. /package/dist/web/assets/{apache-CRejwSR0.js → apache-BtWb7jui.js} +0 -0
  60. /package/dist/web/assets/{applescript-DRWfnP7q.js → applescript-B5uiivcX.js} +0 -0
  61. /package/dist/web/assets/{arcade-c4fxT6cy.js → arcade-CKXflcFV.js} +0 -0
  62. /package/dist/web/assets/{arduino-D-GQgoAg.js → arduino-9WdEHP7F.js} +0 -0
  63. /package/dist/web/assets/{armasm-DW6aLB45.js → armasm-B1n3-9gm.js} +0 -0
  64. /package/dist/web/assets/{asciidoc-l4rRUjBn.js → asciidoc-DnpyabXI.js} +0 -0
  65. /package/dist/web/assets/{aspectj-CBoSaF_P.js → aspectj-DHfRYIO6.js} +0 -0
  66. /package/dist/web/assets/{autohotkey-oklQZH_e.js → autohotkey-D4kyAzbx.js} +0 -0
  67. /package/dist/web/assets/{autoit-CCOhikpq.js → autoit-Dkm5j0Id.js} +0 -0
  68. /package/dist/web/assets/{avrasm-DQyyIbM0.js → avrasm-DDWyveTc.js} +0 -0
  69. /package/dist/web/assets/{awk-Bpx3OGwB.js → awk-0C9tJhw5.js} +0 -0
  70. /package/dist/web/assets/{axapta-ConOtNUD.js → axapta-7WyvVgTr.js} +0 -0
  71. /package/dist/web/assets/{bash-CG9dvFVQ.js → bash-BU3h1nvY.js} +0 -0
  72. /package/dist/web/assets/{basic-D55fg9VU.js → basic-cvnVWdBh.js} +0 -0
  73. /package/dist/web/assets/{bnf-BRHfvdnF.js → bnf-DqQP6RvA.js} +0 -0
  74. /package/dist/web/assets/{brainfuck-CvIc7KgZ.js → brainfuck-9Gnm7MFh.js} +0 -0
  75. /package/dist/web/assets/{c-BYqCyjPu.js → c-CR0xII_C.js} +0 -0
  76. /package/dist/web/assets/{c-like-BiZIVjlk.js → c-like-DQRMjEeJ.js} +0 -0
  77. /package/dist/web/assets/{cal-BI45EWE9.js → cal-BupHjSW7.js} +0 -0
  78. /package/dist/web/assets/{capnproto-CT4_QH7U.js → capnproto-BJz3QcqE.js} +0 -0
  79. /package/dist/web/assets/{ceylon-DEhPqbQs.js → ceylon-Cm5BiqjN.js} +0 -0
  80. /package/dist/web/assets/{chunk-3GQAWCBQ-C-9Cm0Np.js → chunk-3GQAWCBQ-ntjTDD_C.js} +0 -0
  81. /package/dist/web/assets/{clean-Dj90Ldo4.js → clean-yd5cdwwQ.js} +0 -0
  82. /package/dist/web/assets/{clojure-nGPdvoWZ.js → clojure-BEy8uY0S.js} +0 -0
  83. /package/dist/web/assets/{clojure-repl-CoLrBnNB.js → clojure-repl-4mYnspW8.js} +0 -0
  84. /package/dist/web/assets/{cmake-Cau5qcoL.js → cmake-D6UxhUeW.js} +0 -0
  85. /package/dist/web/assets/{coffeescript-CRI19SN5.js → coffeescript-BKMS6sen.js} +0 -0
  86. /package/dist/web/assets/{coq-cKQTGfiT.js → coq-ByIcAboL.js} +0 -0
  87. /package/dist/web/assets/{cos-BvDn-C7W.js → cos-WtGXvK46.js} +0 -0
  88. /package/dist/web/assets/{cpp-Cm8w5GBK.js → cpp-7GTPyvMa.js} +0 -0
  89. /package/dist/web/assets/{crmsh-BphFuWfQ.js → crmsh-C5mOafXq.js} +0 -0
  90. /package/dist/web/assets/{crystal-CjeRzStm.js → crystal-CDkEXhx-.js} +0 -0
  91. /package/dist/web/assets/{csharp-BjNNmcwi.js → csharp-BB5evbyJ.js} +0 -0
  92. /package/dist/web/assets/{csp-BDakTyDq.js → csp-C5gCtA0-.js} +0 -0
  93. /package/dist/web/assets/{css-BS5Bw9la.js → css-BxJzVbPg.js} +0 -0
  94. /package/dist/web/assets/{d-iafwvjhA.js → d-pa4_Cp7t.js} +0 -0
  95. /package/dist/web/assets/{dart-CJj6VfDK.js → dart-BX2VLXw3.js} +0 -0
  96. /package/dist/web/assets/{delphi-CiYfdpeB.js → delphi-DdHGjuIZ.js} +0 -0
  97. /package/dist/web/assets/{diff-C0_uVc7j.js → diff-CBEZzUzk.js} +0 -0
  98. /package/dist/web/assets/{django-D2hgH-Q1.js → django-D4YuT7a9.js} +0 -0
  99. /package/dist/web/assets/{dns-Cl4dGnK7.js → dns-r4HMRPCv.js} +0 -0
  100. /package/dist/web/assets/{dockerfile-meWkyaPv.js → dockerfile-ZfcC6nOD.js} +0 -0
  101. /package/dist/web/assets/{dos-AwMP_0oM.js → dos-CIXc_2yf.js} +0 -0
  102. /package/dist/web/assets/{dsconfig-CnDR2ZdU.js → dsconfig-DlugHtUP.js} +0 -0
  103. /package/dist/web/assets/{dts-BzC-HwM_.js → dts-DaEIYGjQ.js} +0 -0
  104. /package/dist/web/assets/{dust-C7Vcl3-X.js → dust-D5BPeLmO.js} +0 -0
  105. /package/dist/web/assets/{ebnf-CL9qQEga.js → ebnf-FDSeI3Uq.js} +0 -0
  106. /package/dist/web/assets/{elixir-CfaDenjY.js → elixir-BW6MO0JC.js} +0 -0
  107. /package/dist/web/assets/{elm-Cy8gaJOl.js → elm-DlEB7oVS.js} +0 -0
  108. /package/dist/web/assets/{erb-C-4IIk8K.js → erb-Cfqar-lN.js} +0 -0
  109. /package/dist/web/assets/{erlang-B1M6fLuV.js → erlang-CAmVwVgE.js} +0 -0
  110. /package/dist/web/assets/{erlang-repl-BejU3MB_.js → erlang-repl-ynjzGTyJ.js} +0 -0
  111. /package/dist/web/assets/{excel-BkfhIrhj.js → excel-B4xDzPh0.js} +0 -0
  112. /package/dist/web/assets/{fix-BVmdZVAA.js → fix-DrIaqPya.js} +0 -0
  113. /package/dist/web/assets/{flix-D0avEvQY.js → flix-C1QBAYX7.js} +0 -0
  114. /package/dist/web/assets/{fortran-DakqiesO.js → fortran-13hn1qLz.js} +0 -0
  115. /package/dist/web/assets/{fsharp-DA54xfXW.js → fsharp-DsthWJmP.js} +0 -0
  116. /package/dist/web/assets/{gams-CXTQKphs.js → gams-CCIHfrc2.js} +0 -0
  117. /package/dist/web/assets/{gauss-CG12HF6_.js → gauss-DPE0fKXo.js} +0 -0
  118. /package/dist/web/assets/{gcode-BCEABt45.js → gcode-Cnu_Eke-.js} +0 -0
  119. /package/dist/web/assets/{gherkin-ZM-mRt_J.js → gherkin-6DphholZ.js} +0 -0
  120. /package/dist/web/assets/{glsl-CsBoWmwk.js → glsl-bxnyXALN.js} +0 -0
  121. /package/dist/web/assets/{gml-BpvmFz5F.js → gml-CNHkNLih.js} +0 -0
  122. /package/dist/web/assets/{go-oa77k3Q1.js → go-CNn2XrbH.js} +0 -0
  123. /package/dist/web/assets/{golo-DnSZZkzZ.js → golo-DiSoln2k.js} +0 -0
  124. /package/dist/web/assets/{gradle-xhSl5jRG.js → gradle-DwRwgn-A.js} +0 -0
  125. /package/dist/web/assets/{groovy-BUGEyqOY.js → groovy-B5vHRPUi.js} +0 -0
  126. /package/dist/web/assets/{haml-Q5moYl6B.js → haml-DyyQV85z.js} +0 -0
  127. /package/dist/web/assets/{handlebars-B8gHazwq.js → handlebars-BAEJweq7.js} +0 -0
  128. /package/dist/web/assets/{haskell-C_nTNVTF.js → haskell-ChxeibtB.js} +0 -0
  129. /package/dist/web/assets/{haxe-DEa-mhEM.js → haxe-Bnvb8PoO.js} +0 -0
  130. /package/dist/web/assets/{hsp-DAtUNrWr.js → hsp-BdBjqG0g.js} +0 -0
  131. /package/dist/web/assets/{htmlbars-IZ5H55KS.js → htmlbars-Dco0ls0x.js} +0 -0
  132. /package/dist/web/assets/{http-BlfIsTrN.js → http-BQrDnbm9.js} +0 -0
  133. /package/dist/web/assets/{hy-BKHwYI3U.js → hy-j_gy-_-v.js} +0 -0
  134. /package/dist/web/assets/{inform7-DBoQipSc.js → inform7-4lpsdkpY.js} +0 -0
  135. /package/dist/web/assets/{ini-rm_5Fj36.js → ini-CyoU_M9N.js} +0 -0
  136. /package/dist/web/assets/{irpf90-R1rxRBNO.js → irpf90-CA5ICZkt.js} +0 -0
  137. /package/dist/web/assets/{isbl-WbUbjWRI.js → isbl-D5MCB9gL.js} +0 -0
  138. /package/dist/web/assets/{java-flBTnDBg.js → java-C_cNvtw0.js} +0 -0
  139. /package/dist/web/assets/{javascript-Bi9wT7IL.js → javascript-Cx9Fh-yC.js} +0 -0
  140. /package/dist/web/assets/{jboss-cli-BVqHepEU.js → jboss-cli-n0a6upZq.js} +0 -0
  141. /package/dist/web/assets/{json-BvAVz8jQ.js → json-pS218i2Y.js} +0 -0
  142. /package/dist/web/assets/{julia-B3zW89kP.js → julia-ByIGgcyj.js} +0 -0
  143. /package/dist/web/assets/{julia-repl-Cpt_AFpB.js → julia-repl-DoKEpX79.js} +0 -0
  144. /package/dist/web/assets/{kotlin-CMZ_9XJI.js → kotlin-D7EVUsdH.js} +0 -0
  145. /package/dist/web/assets/{lasso-DVqtNSau.js → lasso-CfHzza_u.js} +0 -0
  146. /package/dist/web/assets/{latex-CFJv-UA6.js → latex-DEpVEzU4.js} +0 -0
  147. /package/dist/web/assets/{ldif-BS-KKOy0.js → ldif-CztKIlXq.js} +0 -0
  148. /package/dist/web/assets/{leaf--Z87tMVa.js → leaf-BeXHCQvG.js} +0 -0
  149. /package/dist/web/assets/{less-CXBPSZIU.js → less-BYuoMNFC.js} +0 -0
  150. /package/dist/web/assets/{lisp-cVmS95gk.js → lisp-DENj9Gb0.js} +0 -0
  151. /package/dist/web/assets/{livecodeserver-BOOiQrUz.js → livecodeserver-DzZuZBA6.js} +0 -0
  152. /package/dist/web/assets/{livescript-CVxJe7N1.js → livescript-Dcoaf4MP.js} +0 -0
  153. /package/dist/web/assets/{llvm-DQeHJJ2W.js → llvm-B_NkXFs1.js} +0 -0
  154. /package/dist/web/assets/{lsl-Bfxi34aD.js → lsl-sr9xRjsv.js} +0 -0
  155. /package/dist/web/assets/{lua-DXxL7Qnq.js → lua-DOwApfze.js} +0 -0
  156. /package/dist/web/assets/{makefile-B5Fr6EdB.js → makefile-Dnbo7dYF.js} +0 -0
  157. /package/dist/web/assets/{markdown-DTODmQHl.js → markdown-DGgwjJWS.js} +0 -0
  158. /package/dist/web/assets/{mathematica-XsKNpYVI.js → mathematica-DvU9l120.js} +0 -0
  159. /package/dist/web/assets/{matlab-BQHIwHUE.js → matlab-flr6798G.js} +0 -0
  160. /package/dist/web/assets/{maxima-4gc2wOHL.js → maxima-DCd2nSGc.js} +0 -0
  161. /package/dist/web/assets/{mel-tWDc8R_0.js → mel-NmXTNXHL.js} +0 -0
  162. /package/dist/web/assets/{mercury-CMAR8Kmo.js → mercury-PVmYLiQ2.js} +0 -0
  163. /package/dist/web/assets/{mipsasm-CuThUvs6.js → mipsasm-LHYPiOXU.js} +0 -0
  164. /package/dist/web/assets/{mizar-DJiOXbyw.js → mizar-BbJKfTOL.js} +0 -0
  165. /package/dist/web/assets/{mojolicious-BHZ1FyrY.js → mojolicious-Dw8SBiyk.js} +0 -0
  166. /package/dist/web/assets/{monkey-Ckr0R6Af.js → monkey-CYCsHKco.js} +0 -0
  167. /package/dist/web/assets/{moonscript-rPHoYTbB.js → moonscript-BndWJdyg.js} +0 -0
  168. /package/dist/web/assets/{n1ql-CVbFFpfR.js → n1ql-p64i6r1f.js} +0 -0
  169. /package/dist/web/assets/{nginx-piKHOi7C.js → nginx-Clg11n23.js} +0 -0
  170. /package/dist/web/assets/{nim-D2ljN6dK.js → nim-BF6erjkH.js} +0 -0
  171. /package/dist/web/assets/{nix-BE-MXto5.js → nix-aqHU_7Cj.js} +0 -0
  172. /package/dist/web/assets/{node-repl-DywEPp9w.js → node-repl-DuuOln4U.js} +0 -0
  173. /package/dist/web/assets/{nsis-DQnnPyE6.js → nsis-BZNwabo3.js} +0 -0
  174. /package/dist/web/assets/{objectivec-DVFSpwpL.js → objectivec-BD-A2eRS.js} +0 -0
  175. /package/dist/web/assets/{ocaml-B9_ypEp1.js → ocaml-Dtfm3HD8.js} +0 -0
  176. /package/dist/web/assets/{openscad-Cquxty4i.js → openscad-3uP221Jx.js} +0 -0
  177. /package/dist/web/assets/{oxygene-BtOMSMR6.js → oxygene-DBIMAfJO.js} +0 -0
  178. /package/dist/web/assets/{parser3-CWVyPD7l.js → parser3-C9bjRYvd.js} +0 -0
  179. /package/dist/web/assets/{path-BzTN_bR6.js → path-CG3438uq.js} +0 -0
  180. /package/dist/web/assets/{perl-DQMBOVA5.js → perl-Be1CLDbh.js} +0 -0
  181. /package/dist/web/assets/{pf-DhGORkJd.js → pf-BEYn9RX1.js} +0 -0
  182. /package/dist/web/assets/{pgsql-awwi5nDK.js → pgsql-Bp-7Jjz8.js} +0 -0
  183. /package/dist/web/assets/{php-_c_VoeVa.js → php-D8HtobZG.js} +0 -0
  184. /package/dist/web/assets/{php-template-Dsp4D0jE.js → php-template-5wDTa_KR.js} +0 -0
  185. /package/dist/web/assets/{plaintext-7v3vLFp3.js → plaintext-DF3cBN5Y.js} +0 -0
  186. /package/dist/web/assets/{pony-BVahP-cB.js → pony-CA_LuLTd.js} +0 -0
  187. /package/dist/web/assets/{powershell-DDAkbMgT.js → powershell-CfylS3qM.js} +0 -0
  188. /package/dist/web/assets/{preload-helper-XLr9-hSf.js → preload-helper-ckxxtgMM.js} +0 -0
  189. /package/dist/web/assets/{processing-CCja83Ot.js → processing-BOdw1uey.js} +0 -0
  190. /package/dist/web/assets/{profile-BjuA8z3S.js → profile-BMNLdTbz.js} +0 -0
  191. /package/dist/web/assets/{prolog-jJiPeztA.js → prolog-wnuVaQNI.js} +0 -0
  192. /package/dist/web/assets/{properties-DK40DOVd.js → properties-BY2UjzIx.js} +0 -0
  193. /package/dist/web/assets/{protobuf-DJs85Lp7.js → protobuf-W4tuiDUG.js} +0 -0
  194. /package/dist/web/assets/{puppet-BPdGz-Jp.js → puppet-CcAPsi7F.js} +0 -0
  195. /package/dist/web/assets/{purebasic-C8c2xseX.js → purebasic-Cx_iSilj.js} +0 -0
  196. /package/dist/web/assets/{python-B-gHuzXK.js → python-DtGc5unX.js} +0 -0
  197. /package/dist/web/assets/{python-repl-CLJQcHH8.js → python-repl-B1V7zIpU.js} +0 -0
  198. /package/dist/web/assets/{q-VmMkCWpr.js → q-DwgFecwj.js} +0 -0
  199. /package/dist/web/assets/{qml-BkIM5RCI.js → qml-CxtqwNEV.js} +0 -0
  200. /package/dist/web/assets/{r-CHi-Wrw8.js → r-Vyl1b83h.js} +0 -0
  201. /package/dist/web/assets/{reasonml-B05iQ6f2.js → reasonml-D1BWml10.js} +0 -0
  202. /package/dist/web/assets/{rib-DzxrqgFS.js → rib-WKK4Jb_l.js} +0 -0
  203. /package/dist/web/assets/{roboconf-DVxtd4X5.js → roboconf-DD9St8Le.js} +0 -0
  204. /package/dist/web/assets/{routeros-C7PRtmmR.js → routeros-DIyDrw3W.js} +0 -0
  205. /package/dist/web/assets/{rsl-CcIHTLD_.js → rsl-CfigMFVZ.js} +0 -0
  206. /package/dist/web/assets/{ruby-BGhMoiTk.js → ruby-YHScF8rv.js} +0 -0
  207. /package/dist/web/assets/{ruleslanguage-2nOGmUbL.js → ruleslanguage-BYwdQsZF.js} +0 -0
  208. /package/dist/web/assets/{rust-Bn5K3sZf.js → rust-B5YXnMyV.js} +0 -0
  209. /package/dist/web/assets/{sas-BOCzodK2.js → sas-CCTr8w16.js} +0 -0
  210. /package/dist/web/assets/{scala-BRv9Y1Gl.js → scala-Cbxd3VFS.js} +0 -0
  211. /package/dist/web/assets/{scheme-DgxU7T27.js → scheme-BsN3DINT.js} +0 -0
  212. /package/dist/web/assets/{scilab-CDpHNnol.js → scilab-DPKVNXPG.js} +0 -0
  213. /package/dist/web/assets/{scss-_DXiA8XH.js → scss-DbQAKOek.js} +0 -0
  214. /package/dist/web/assets/{shell-JZbpHYqw.js → shell-DWzkAqOf.js} +0 -0
  215. /package/dist/web/assets/{smali-D-pxIQI6.js → smali-BftjeLb5.js} +0 -0
  216. /package/dist/web/assets/{smalltalk-BgHXrgWH.js → smalltalk-CRiQmXNN.js} +0 -0
  217. /package/dist/web/assets/{sml-XMsOdlaX.js → sml-StzcQc9I.js} +0 -0
  218. /package/dist/web/assets/{sqf-BAJmpDEs.js → sqf-DD5HJChz.js} +0 -0
  219. /package/dist/web/assets/{sql-qDDDtU5U.js → sql-DPgh6LFW.js} +0 -0
  220. /package/dist/web/assets/{sql_more-OsRq2zw0.js → sql_more-CtzXbTQc.js} +0 -0
  221. /package/dist/web/assets/{stata-Bk4QaRj1.js → stata-BVbnRiot.js} +0 -0
  222. /package/dist/web/assets/{step21-JBksYMyW.js → step21-Dq-6Zq9y.js} +0 -0
  223. /package/dist/web/assets/{stylus-B2-KoW99.js → stylus-BBnpEkBq.js} +0 -0
  224. /package/dist/web/assets/{subunit-Dms0B4fv.js → subunit-ELCErEkQ.js} +0 -0
  225. /package/dist/web/assets/{swift-BDkC6DWd.js → swift-DaAs7qTh.js} +0 -0
  226. /package/dist/web/assets/{taggerscript-BQuVNykw.js → taggerscript-1FPav-0a.js} +0 -0
  227. /package/dist/web/assets/{tap-Bwup7RHy.js → tap-EToQ4lhN.js} +0 -0
  228. /package/dist/web/assets/{tcl-CbpGYImD.js → tcl-D3o49C6L.js} +0 -0
  229. /package/dist/web/assets/{thrift-B_z8wKcZ.js → thrift-CWhyiqPB.js} +0 -0
  230. /package/dist/web/assets/{tp-BJLBEN3J.js → tp-B6O9yM_7.js} +0 -0
  231. /package/dist/web/assets/{twig-nUEnJWT1.js → twig-CtXlonbL.js} +0 -0
  232. /package/dist/web/assets/{typescript-CrQbuH5h.js → typescript-CCrKHjvE.js} +0 -0
  233. /package/dist/web/assets/{util-BS7JSiXp.js → util-_DavpSWv.js} +0 -0
  234. /package/dist/web/assets/{vala-2XexN6SZ.js → vala-DqTbJvZE.js} +0 -0
  235. /package/dist/web/assets/{vbnet-BAt8krwo.js → vbnet-BIMC8kyn.js} +0 -0
  236. /package/dist/web/assets/{vbscript--ebsjfOw.js → vbscript-CwHfrTEX.js} +0 -0
  237. /package/dist/web/assets/{vbscript-html-yaZI43iV.js → vbscript-html-6BIOjkqb.js} +0 -0
  238. /package/dist/web/assets/{verilog-emU2h0-4.js → verilog-Br3eYmwZ.js} +0 -0
  239. /package/dist/web/assets/{vhdl-CPuOZFR2.js → vhdl-CDlnDphM.js} +0 -0
  240. /package/dist/web/assets/{vim-ZfleAGCY.js → vim-BOZojkV6.js} +0 -0
  241. /package/dist/web/assets/{x86asm-BHTiWqya.js → x86asm-Br9iqCtX.js} +0 -0
  242. /package/dist/web/assets/{xl-MlLWG0U8.js → xl-eSTclZWH.js} +0 -0
  243. /package/dist/web/assets/{xml-CJKMw8W2.js → xml-C775tW_n.js} +0 -0
  244. /package/dist/web/assets/{xquery-B4Yi49S8.js → xquery-DimlVJ6h.js} +0 -0
  245. /package/dist/web/assets/{yaml-5C-oV2Cp.js → yaml-Dnhus5cp.js} +0 -0
  246. /package/dist/web/assets/{zephir-Dig9AotJ.js → zephir-j3mL6he_.js} +0 -0
@@ -1,4 +1,4 @@
1
1
  var e=typeof window<`u`?window:void 0,t=typeof globalThis<`u`?globalThis:e;typeof self>`u`&&(t.self=t),typeof File>`u`&&(t.File=function(){});var n=Array.prototype,r=n.forEach,i=n.indexOf,a=t?.navigator,o=t?.document,s=t?.location,c=t?.fetch,l=t!=null&&t.XMLHttpRequest&&`withCredentials`in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,u=t?.AbortController,d=a?.userAgent,f=e??{},p={DEBUG:!1,LIB_VERSION:`1.351.4`};function m(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){m(a,r,i,o,s,`next`,e)}function s(e){m(a,r,i,o,s,`throw`,e)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},g.apply(null,arguments)}function _(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var v=[`$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`],ee=`amazonbot,amazonproductbot,app.hypefactors.com,applebot,archive.org_bot,awariobot,backlinksextendedbot,baiduspider,bingbot,bingpreview,chrome-lighthouse,dataforseobot,deepscan,duckduckbot,facebookexternal,facebookcatalog,http://yandex.com/bots,hubspot,ia_archiver,leikibot,linkedinbot,meta-externalagent,mj12bot,msnbot,nessus,petalbot,pinterest,prerender,rogerbot,screaming frog,sebot-wa,sitebulb,slackbot,slurp,trendictionbot,turnitin,twitterbot,vercel-screenshot,vercelbot,yahoo! slurp,yandexbot,zoombot,bot.htm,bot.php,(bot;,bot/,crawler,ahrefsbot,ahrefssiteaudit,semrushbot,siteauditbot,splitsignalbot,gptbot,oai-searchbot,chatgpt-user,perplexitybot,better uptime bot,sentryuptimebot,uptimerobot,headlesschrome,cypress,google-hoteladsverifier,adsbot-google,apis-google,duplexweb-google,feedfetcher-google,google favicon,google web preview,google-read-aloud,googlebot,googleother,google-cloudvertexbot,googleweblight,mediapartners-google,storebot-google,google-inspectiontool,bytespider`.split(`,`),y=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return ee.concat(t).some((e=>{var t=e.toLowerCase();return n.indexOf(t)!==-1}))};function b(e,t){return e.indexOf(t)!==-1}var x=function(e){return e.trim()},S=function(e){return e.replace(/^\$/,``)},C=Array.isArray,te=Object.prototype,w=te.hasOwnProperty,ne=te.toString,T=C||function(e){return ne.call(e)===`[object Array]`},E=e=>typeof e==`function`,D=e=>e===Object(e)&&!T(e),O=e=>{if(D(e)){for(var t in e)if(w.call(e,t))return!1;return!0}return!1},k=e=>e===void 0,A=e=>ne.call(e)==`[object String]`,j=e=>A(e)&&e.trim().length===0,M=e=>e===null,N=e=>k(e)||M(e),P=e=>ne.call(e)==`[object Number]`&&e==e,re=e=>P(e)&&e>0,F=e=>ne.call(e)===`[object Boolean]`,ie=e=>e instanceof FormData,I=e=>b(v,e);function ae(e){return typeof e!=`object`||!e}function oe(e,t){return Object.prototype.toString.call(e)===`[object `+t+`]`}function se(e){return!k(Event)&&function(e,t){try{return e instanceof t}catch{return!1}}(e,Event)}var ce=[!0,`true`,1,`1`,`yes`],le=e=>b(ce,e),ue=[!1,`false`,0,`0`,`no`];function L(e,t,n,r,i){return t>n&&(r.warn(`min cannot be greater than max.`),t=n),P(e)?e>n?(r.warn(` cannot be greater than max: `+n+`. Using max value instead.`),n):e<t?(r.warn(` cannot be less than min: `+t+`. Using min value instead.`),t):e:(r.warn(` must be a number. using max or fallback. max: `+n+`, fallback: `+i),L(i||n,t,n,r))}var de=class{constructor(e){this.t={},this.i=e.i,this.o=L(e.bucketSize,0,100,e.h),this.m=L(e.refillRate,0,this.o,e.h),this.$=L(e.refillInterval,0,864e5,e.h)}S(e,t){var n=t-e.lastAccess,r=Math.floor(n/this.$);if(r>0){var i=r*this.m;e.tokens=Math.min(e.tokens+i,this.o),e.lastAccess+=r*this.$}}consumeRateLimit(e){var t,n=Date.now(),r=String(e),i=this.t[r];return i?this.S(i,n):(i={tokens:this.o,lastAccess:n},this.t[r]=i),i.tokens===0||(i.tokens--,i.tokens===0&&((t=this.i)==null||t.call(this,e)),i.tokens===0)}stop(){this.t={}}},R=`Mobile`,fe=`iOS`,pe=`Android`,me=`Tablet`,he=pe+` `+me,ge=`iPad`,_e=`Apple`,ve=_e+` Watch`,ye=`Safari`,be=`BlackBerry`,xe=`Samsung`,Se=xe+`Browser`,Ce=xe+` Internet`,we=`Chrome`,Te=we+` OS`,Ee=we+` `+fe,De=`Internet Explorer`,Oe=De+` `+R,ke=`Opera`,Ae=ke+` Mini`,je=`Edge`,Me=`Microsoft `+je,Ne=`Firefox`,Pe=Ne+` `+fe,Fe=`Nintendo`,Ie=`PlayStation`,Le=`Xbox`,Re=pe+` `+R,ze=R+` `+ye,Be=`Windows`,Ve=Be+` Phone`,He=`Nokia`,Ue=`Ouya`,We=`Generic`,Ge=We+` `+R.toLowerCase(),Ke=We+` `+me.toLowerCase(),qe=`Konqueror`,z=`(\\d+(\\.\\d+)?)`,Je=RegExp(`Version/`+z),Ye=new RegExp(Le,`i`),Xe=RegExp(Ie+` \\w+`,`i`),Ze=RegExp(Fe+` \\w+`,`i`),Qe=RegExp(be+`|PlayBook|BB10`,`i`),$e={"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`},et,tt,nt,rt=(e,t)=>t&&b(t,_e)||function(e){return b(e,ye)&&!b(e,we)&&!b(e,pe)}(e),it=function(e,t){return t||=``,b(e,` OPR/`)&&b(e,`Mini`)?Ae:b(e,` OPR/`)?ke:Qe.test(e)?be:b(e,`IE`+R)||b(e,`WPDesktop`)?Oe:b(e,Se)?Ce:b(e,je)||b(e,`Edg/`)?Me:b(e,`FBIOS`)?`Facebook `+R:b(e,`UCWEB`)||b(e,`UCBrowser`)?`UC Browser`:b(e,`CriOS`)?Ee:b(e,`CrMo`)||b(e,we)?we:b(e,pe)&&b(e,ye)?Re:b(e,`FxiOS`)?Pe:b(e.toLowerCase(),qe.toLowerCase())?qe:rt(e,t)?b(e,R)?ze:ye:b(e,Ne)?Ne:b(e,`MSIE`)||b(e,`Trident/`)?De:b(e,`Gecko`)?Ne:``},at={[Oe]:[RegExp(`rv:`+z)],[Me]:[RegExp(je+`?\\/`+z)],[we]:[RegExp(`(`+we+`|CrMo)\\/`+z)],[Ee]:[RegExp(`CriOS\\/`+z)],"UC Browser":[RegExp(`(UCBrowser|UCWEB)\\/`+z)],[ye]:[Je],[ze]:[Je],[ke]:[RegExp(`(Opera|OPR)\\/`+z)],[Ne]:[RegExp(Ne+`\\/`+z)],[Pe]:[RegExp(`FxiOS\\/`+z)],[qe]:[RegExp(`Konqueror[:/]?`+z,`i`)],[be]:[RegExp(be+` `+z),Je],[Re]:[RegExp(`android\\s`+z,`i`)],[Ce]:[RegExp(Se+`\\/`+z)],[De]:[RegExp(`(rv:|MSIE )`+z)],Mozilla:[RegExp(`rv:`+z)]},ot=function(e,t){var n=at[it(e,t)];if(k(n))return null;for(var r=0;r<n.length;r++){var i=n[r],a=e.match(i);if(a)return parseFloat(a[a.length-2])}return null},st=[[RegExp(Le+`; `+Le+` (.*?)[);]`,`i`),e=>[Le,e&&e[1]||``]],[new RegExp(Fe,`i`),[Fe,``]],[new RegExp(Ie,`i`),[Ie,``]],[Qe,[be,``]],[new RegExp(Be,`i`),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ve,``];if(new RegExp(R).test(t)&&!/IEMobile\b/.test(t))return[Be+` `+R,``];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=$e[n[1]]||``;return/arm/i.test(t)&&(r=`RT`),[Be,r]}return[Be,``]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[fe,[e[3],e[4],e[5]||`0`].join(`.`)]:[fe,``]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t=``;return e&&e.length>=3&&(t=k(e[2])?e[3]:e[2]),[`watchOS`,t]}],[RegExp(`(`+pe+` (\\d+)\\.(\\d+)\\.?(\\d+)?|`+pe+`)`,`i`),e=>e&&e[2]?[pe,[e[2],e[3],e[4]||`0`].join(`.`)]:[pe,``]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=[`Mac OS X`,``];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||`0`].join(`.`)),t}],[/Mac/i,[`Mac OS X`,``]],[/CrOS/,[Te,``]],[/Linux|debian/i,[`Linux`,``]]],ct=function(e){return Ze.test(e)?Fe:Xe.test(e)?Ie:Ye.test(e)?Le:new RegExp(Ue,`i`).test(e)?Ue:RegExp(`(`+Ve+`|WPDesktop)`,`i`).test(e)?Ve:/iPad/.test(e)?ge:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ve:Qe.test(e)?be:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:new RegExp(He,`i`).test(e)?He:/(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(R).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)?pe:he:RegExp(`(pda|`+R+`)`,`i`).test(e)?Ge:new RegExp(me,`i`).test(e)&&!RegExp(me+` pc`,`i`).test(e)?Ke:``},lt=e=>e instanceof Error;function ut(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return nt&&n.length===tt||(tt=n.length,nt=n.reduce(((n,r)=>{et||={};var i=et[r];if(i)n[i[0]]=i[1];else for(var a=e(r),o=a.length-1;o>=0;o--){var s=a[o]?.filename,c=t[r];if(s&&c){n[s]=c,et[r]=[s,c];break}}return n}),{})),nt}}var dt=class{constructor(e,t,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t){t===void 0&&(t={});var n=t&&t.mechanism||{handled:!0,type:`generic`},r=this.buildCoercingContext(n,t,0).apply(e),i=this.buildParsingContext(t),a=this.parseStacktrace(r,i);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:`error`}}modifyFrames(e){var t=this;return h((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&T(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.stacktrace.frames));return e}))()}coerceFallback(e){return{type:`Error`,value:`Unknown error`,stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){var n,r;return e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=``&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),g({},e,{cause:n,stack:r})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return h((function*(){var n=e;for(var r of t.modifiers)n=yield r(n);return n}))()}convertToExceptionList(e,t){var n,r,i={type:e.type,value:e.value,mechanism:{type:t.type??`generic`,handled:(n=t.handled)==null||n,synthetic:(r=e.synthetic)!=null&&r}};e.stack&&(i.stacktrace={type:`raw`,frames:e.stack});var a=[i];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,g({},t,{handled:!0}))),a}buildParsingContext(e){return{chunkIdMap:ut(this.stackParser),skipFirstLines:e.skipFirstLines??1}}buildCoercingContext(e,t,n){n===void 0&&(n=0);var r=(n,r)=>{if(r<=4){var i=this.buildCoercingContext(e,t,r);return this.applyCoercers(n,i)}};return g({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,n),next:e=>r(e,n+1)})}},ft=`?`;function pt(e,t,n,r,i){var a={platform:e,filename:t,function:n===`<anonymous>`?ft:n,in_app:!0};return k(r)||(a.lineno=r),k(i)||(a.colno=i),a}var mt=(e,t)=>{var n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?ft:e.split(`@`)[0],n?`safari-extension:`+t:`safari-web-extension:`+t]:[e,t]},ht=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,gt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,_t=/\((\S*)(?::(\d+))(?::(\d+))\)/,vt=(e,t)=>{var n=ht.exec(e);if(n){var[,r,i,a]=n;return pt(t,r,ft,+i,+a)}var o=gt.exec(e);if(o){if(o[2]&&o[2].indexOf(`eval`)===0){var s=_t.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}var[c,l]=mt(o[1]||ft,o[2]);return pt(t,l,c,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},yt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,bt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,xt=(e,t)=>{var n=yt.exec(e);if(n){if(n[3]&&n[3].indexOf(` > eval`)>-1){var r=bt.exec(n[3]);r&&(n[1]=n[1]||`eval`,n[3]=r[1],n[4]=r[2],n[5]=``)}var i=n[3],a=n[1]||ft;return[a,i]=mt(a,i),pt(t,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},St=/\(error: (.*)\)/,Ct=50;function wt(){return function(e){var t=[...arguments].slice(1);return function(n,r){r===void 0&&(r=0);for(var i=[],a=n.split(`
2
- `),o=r;o<a.length;o++){var s=a[o];if(!(s.length>1024)){var c=St.test(s)?s.replace(St,`$1`):s;if(!c.match(/\S*Error: /)){for(var l of t){var u=l(c,e);if(u){i.push(u);break}}if(i.length>=Ct)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,Ct).map((e=>{return g({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||ft});var n}))}(i)}}(`web:javascript`,vt,xt)}var Tt=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=A(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?`DOMError`:`DOMException`}getValue(e){var t=e.name||(this.isDOMError(e)?`DOMError`:`DOMException`);return e.message?t+`: `+e.message:t}isDOMException(e){return oe(e,`DOMException`)}isDOMError(e){return oe(e,`DOMError`)}},Et=class{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var n=e.message;return n.error&&typeof n.error.message==`string`?String(n.error.message):String(n)}getStack(e){return e.stacktrace||e.stack||void 0}},Dt=class{constructor(){}match(e){return oe(e,`ErrorEvent`)&&e.error!=null}coerce(e,t){return t.apply(e.error)||{type:`ErrorEvent`,value:e.message,stack:t.syntheticException?.stack,synthetic:!0}}},Ot=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,kt=class{match(e){return typeof e==`string`}coerce(e,t){var[n,r]=this.getInfos(e);return{type:n??`Error`,value:r??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){var t=`Error`,n=e,r=e.match(Ot);return r&&(t=r[1],n=r[2]),[t,n]}},At=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function jt(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return`[object has no keys]`;for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(`, `);if(!(i.length>t))return r===n.length||i.length<=t?i:i.slice(0,t)+`...`}return``}var Mt=class{match(e){return typeof e==`object`&&!!e}coerce(e,t){var n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:`error`,synthetic:!0}}getType(e){return se(e)?e.constructor.name:`Error`}getValue(e){if(`name`in e&&typeof e.name==`string`){var t=`'`+e.name+`' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message: '`+e.message+`'`),t}if(`message`in e&&typeof e.message==`string`)return e.message;var n=this.getObjectClassName(e);return(n&&n!==`Object`?`'`+n+`'`:`Object`)+` captured as exception with keys: `+jt(e)}isSeverityLevel(e){return A(e)&&!j(e)&&At.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(lt(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Nt=class{match(e){return se(e)}coerce(e,t){var n=e.constructor.name;return{type:n,value:n+` captured as exception with keys: `+jt(e),stack:t.syntheticException?.stack,synthetic:!0}}},Pt=class{match(e){return ae(e)}coerce(e,t){return{type:`Error`,value:`Primitive value captured as exception: `+String(e),stack:t.syntheticException?.stack,synthetic:!0}}},Ft=class{match(e){return oe(e,`PromiseRejectionEvent`)}coerce(e,t){var n=this.getUnhandledRejectionReason(e);return ae(n)?{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: `+String(n),stack:t.syntheticException?.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){if(ae(e))return e;try{if(`reason`in e)return e.reason;if(`detail`in e&&`reason`in e.detail)return e.detail.reason}catch{}return e}},It=function(t,n){var{debugEnabled:r}=n===void 0?{}:n,i={k:function(n){if(e&&(p.DEBUG||f.POSTHOG_DEBUG||r)&&!k(e.console)&&e.console){for(var i=(`__rrweb_original__`in e.console[n])?e.console[n].__rrweb_original__:e.console[n],a=arguments.length,o=Array(a>1?a-1:0),s=1;s<a;s++)o[s-1]=arguments[s];i(t,...o)}},info:function(){var e=[...arguments];i.k(`log`,...e)},warn:function(){var e=[...arguments];i.k(`warn`,...e)},error:function(){var e=[...arguments];i.k(`error`,...e)},critical:function(){var e=[...arguments];console.error(t,...e)},uninitializedWarning:e=>{i.error(`You must initialize PostHog before calling `+e)},createLogger:(e,n)=>It(t+` `+e,n)};return i},B=It(`[PostHog.js]`),V=B.createLogger,Lt=V(`[ExternalScriptsLoader]`),Rt=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return Lt.warn(t+` was requested but loading of external scripts is disabled.`),n(`Loading of external scripts is disabled`);var r=o?.querySelectorAll(`script`);if(r){for(var i,a=function(){if(r[s].src===t){var e=r[s];return e.__posthog_loading_callback_fired?{v:n()}:(e.addEventListener(`load`,(t=>{e.__posthog_loading_callback_fired=!0,n(void 0,t)})),e.onerror=e=>n(e),{v:void 0})}},s=0;s<r.length;s++)if(i=a())return i.v}var c=()=>{if(!o)return n(`document not found`);var r=o.createElement(`script`);if(r.type=`text/javascript`,r.crossOrigin=`anonymous`,r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)},r.onerror=e=>n(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return n(`prepare_external_dependency_script returned null`);if(e.config.external_scripts_inject_target===`head`)o.head.appendChild(r);else{var i,a=o.querySelectorAll(`body > script`);a.length>0?(i=a[0].parentNode)==null||i.insertBefore(r,a[0]):o.body.appendChild(r)}};o!=null&&o.body?c():o?.addEventListener(`DOMContentLoaded`,c)};f.__PosthogExtensions__=f.__PosthogExtensions__||{},f.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r=`/static/`+t+`.js?v=`+e.version;if(t===`remote-config`&&(r=`/array/`+e.config.token+`/config.js`),t===`toolbar`){var i=3e5;r=r+`&t=`+Math.floor(Date.now()/i)*i}Rt(e,e.requestRouter.endpointFor(`assets`,r),n)},f.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{Rt(e,e.requestRouter.endpointFor(`api`,t),n)};var zt={};function Bt(e,t,n){if(T(e)){if(r&&e.forEach===r)e.forEach(t,n);else if(`length`in e&&e.length===+e.length){for(var i=0,a=e.length;i<a;i++)if(i in e&&t.call(n,e[i],i)===zt)return}}}function H(e,t,n){if(!N(e)){if(T(e))return Bt(e,t,n);if(ie(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===zt)return}else for(var i in e)if(w.call(e,i)&&t.call(n,e[i],i)===zt)return}}var U=function(e){return Bt([...arguments].slice(1),(function(t){for(var n in t)t[n]!==void 0&&(e[n]=t[n])})),e},Vt=function(e){return Bt([...arguments].slice(1),(function(t){Bt(t,(function(t){e.push(t)}))})),e};function Ht(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Ut=function(e){try{return e()}catch{return}},Wt=function(e){return function(){try{var t=[...arguments];return e.apply(this,t)}catch(e){B.critical(`Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.`),B.critical(e)}}},Gt=function(e){var t={};return H(e,(function(e,n){(A(e)&&e.length>0||P(e))&&(t[n]=e)})),t};function Kt(e,t){return n=e,r=e=>A(e)&&!M(t)?e.slice(0,t):e,i=new Set,function e(t,n){return t===Object(t)?i.has(t)?void 0:(i.add(t),T(t)?(a=[],Bt(t,(t=>{a.push(e(t))}))):(a={},H(t,((t,n)=>{i.has(t)||(a[n]=e(t,n))}))),a):r?r(t,n):t;var a}(n);var n,r,i}var qt=[`herokuapp.com`,`vercel.app`,`netlify.app`];function Jt(e){var t=e?.hostname;if(!A(t))return!1;var n=t.split(`.`).slice(-2).join(`.`);for(var r of qt)if(n===r)return!1;return!0}function Yt(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function W(e,t,n,r){var{capture:i=!1,passive:a=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:a})}var Xt=`$people_distinct_id`,Zt=`__alias`,Qt=`__timers`,$t=`$autocapture_disabled_server_side`,en=`$heatmaps_enabled_server_side`,tn=`$exception_capture_enabled_server_side`,nn=`$error_tracking_suppression_rules`,rn=`$error_tracking_capture_extension_exceptions`,an=`$web_vitals_enabled_server_side`,on=`$dead_clicks_enabled_server_side`,sn=`$product_tours_enabled_server_side`,cn=`$web_vitals_allowed_metrics`,ln=`$session_recording_remote_config`,un=`$sesid`,dn=`$session_is_sampled`,fn=`$enabled_feature_flags`,pn=`$early_access_features`,mn=`$feature_flag_details`,hn=`$stored_person_properties`,gn=`$stored_group_properties`,_n=`$surveys`,vn=`$flag_call_reported`,yn=`$feature_flag_errors`,bn=`$user_state`,xn=`$client_session_props`,Sn=`$capture_rate_limit`,Cn=`$initial_campaign_params`,wn=`$initial_referrer_info`,Tn=`$initial_person_info`,En=`$epp`,Dn=`__POSTHOG_TOOLBAR__`,On=`$posthog_cookieless`,kn=[Xt,Zt,`__cmpns`,Qt,`$session_recording_enabled_server_side`,en,un,fn,nn,bn,pn,mn,gn,hn,_n,vn,yn,xn,Sn,Cn,wn,En,Tn,`$conversations_widget_session_id`,`$conversations_ticket_id`,`$conversations_widget_state`,`$conversations_user_traits`];function An(e){return e instanceof Element&&(e.id===Dn||!(e.closest==null||!e.closest(`.toolbar-global-fade-container`)))}function jn(e){return!!e&&e.nodeType===1}function Mn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Nn(e){return!!e&&e.nodeType===3}function Pn(e){return!!e&&e.nodeType===11}function Fn(e){return e?x(e).split(/\s+/):[]}function In(t){var n=e?.location.href;return!!(n&&t&&t.some((e=>n.match(e))))}function Ln(e){var t=``;switch(typeof e.className){case`string`:t=e.className;break;case`object`:t=(e.className&&`baseVal`in e.className?e.className.baseVal:null)||e.getAttribute(`class`)||``;break;default:t=``}return Fn(t)}function Rn(e){return N(e)?null:x(e).split(/(\s+)/).filter((e=>ar(e))).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function zn(e){var t=``;return Zn(e)&&!Qn(e)&&e.childNodes&&e.childNodes.length&&H(e.childNodes,(function(e){Nn(e)&&e.textContent&&(t+=Rn(e.textContent)??``)})),x(t)}function Bn(e){return k(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Vn=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function Hn(e,t){if(k(t))return!0;var n,r=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var i of e)if(n=r(i))return n.v;return!1}function Un(e){var t=e.parentNode;return!(!t||!jn(t))&&t}var Wn=[`next`,`previous`,`prev`,`>`,`<`],Gn=10,Kn=[`.ph-no-rageclick`,`.ph-no-capture`];function qn(t,n){if(!e||Jn(t))return!1;var r,i;if(F(n)?(r=!!n&&Kn,i=void 0):(r=n?.css_selector_ignorelist??Kn,i=n?.content_ignorelist),!1===r)return!1;var{targetElementList:a}=Yn(t,!1);return!function(e,t){if(!1===e||k(e))return!1;var n;if(!0===e)n=Wn;else{if(!T(e))return!1;if(e.length>Gn)return B.error(`[PostHog] content_ignorelist array cannot exceed `+Gn+` items. Use css_selector_ignorelist for more complex matching.`),!1;n=e.map((e=>e.toLowerCase()))}return t.some((e=>{var{safeText:t,ariaLabel:r}=e;return n.some((e=>t.includes(e)||r.includes(e)))}))}(i,a.map((e=>({safeText:zn(e).toLowerCase(),ariaLabel:e.getAttribute(`aria-label`)?.toLowerCase().trim()||``}))))&&!Hn(a,r)}var Jn=e=>!e||Mn(e,`html`)||!jn(e),Yn=(t,n)=>{if(!e||Jn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[t],a=t;a.parentNode&&!Mn(a,`body`);)if(Pn(a.parentNode))i.push(a.parentNode.host),a=a.parentNode.host;else{var o=Un(a);if(!o)break;if(n||Vn.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var s=e.getComputedStyle(o);s&&s.getPropertyValue(`cursor`)===`pointer`&&(r=!0)}i.push(o),a=o}return{parentIsUsefulElement:r,targetElementList:i}};function Xn(t,n,r,i,a){var o,s,c;if(r===void 0&&(r=void 0),!e||Jn(t)||(o=r)!=null&&o.url_allowlist&&!In(r.url_allowlist)||(s=r)!=null&&s.url_ignorelist&&In(r.url_ignorelist))return!1;if((c=r)!=null&&c.dom_event_allowlist){var l=r.dom_event_allowlist;if(l&&!l.some((e=>n.type===e)))return!1}var{parentIsUsefulElement:u,targetElementList:d}=Yn(t,i);if(!function(e,t){var n=t?.element_allowlist;if(k(n))return!0;var r,i=function(e){if(n.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var a of e)if(r=i(a))return r.v;return!1}(d,r)||!Hn(d,r?.css_selector_allowlist))return!1;var f=e.getComputedStyle(t);if(f&&f.getPropertyValue(`cursor`)===`pointer`&&n.type===`click`)return!0;var p=t.tagName.toLowerCase();switch(p){case`html`:return!1;case`form`:return(a||[`submit`]).indexOf(n.type)>=0;case`input`:case`select`:case`textarea`:return(a||[`change`,`click`]).indexOf(n.type)>=0;default:return u?(a||[`click`]).indexOf(n.type)>=0:(a||[`click`]).indexOf(n.type)>=0&&(Vn.indexOf(p)>-1||t.getAttribute(`contenteditable`)===`true`)}}function Zn(e){for(var t=e;t.parentNode&&!Mn(t,`body`);t=t.parentNode){var n=Ln(t);if(b(n,`ph-sensitive`)||b(n,`ph-no-capture`))return!1}if(b(Ln(e),`ph-include`))return!0;var r=e.type||``;if(A(r))switch(r.toLowerCase()){case`hidden`:case`password`:return!1}var i=e.name||e.id||``;return!(A(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,``)))}function Qn(e){return!!(Mn(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||Mn(e,`select`)||Mn(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var $n=`(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})`,er=RegExp(`^(?:`+$n+`)$`),tr=new RegExp($n),nr=`\\d{3}-?\\d{2}-?\\d{4}`,rr=RegExp(`^(`+nr+`)$`),ir=RegExp(`(`+nr+`)`);function ar(e,t){return t===void 0&&(t=!0),!(N(e)||A(e)&&(e=x(e),(t?er:tr).test((e||``).replace(/[- ]/g,``))||(t?rr:ir).test(e)))}function or(e){var t=zn(e);return ar(t=(t+` `+sr(e)).trim())?t:``}function sr(e){var t=``;return e&&e.childNodes&&e.childNodes.length&&H(e.childNodes,(function(e){if(e&&e.tagName?.toLowerCase()===`span`)try{var n=zn(e);t=(t+` `+n).trim(),e.childNodes&&e.childNodes.length&&(t=(t+` `+sr(e)).trim())}catch(e){B.error(`[AutoCapture]`,e)}})),t}function cr(e){return function(e){return e.map((e=>{var t=``;if(e.tag_name&&(t+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))t+=`.`+n.replace(/"/g,``);var r=g({},e.text?{text:e.text}:{},{"nth-child":e.nth_child??0,"nth-of-type":e.nth_of_type??0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),i={};return Ht(r).sort(((e,t)=>{var[n]=e,[r]=t;return n.localeCompare(r)})).forEach((e=>{var[t,n]=e;return i[lr(t.toString())]=lr(n.toString())})),t+=`:`,t+=Ht(i).map((e=>{var[t,n]=e;return t+`="`+n+`"`})).join(``)})).join(`;`)}(function(e){return e.map((e=>{var t={text:e.$el_text?.slice(0,400),tag_name:e.tag_name,href:e.attr__href?.slice(0,2048),attr_class:ur(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Ht(e).filter((e=>{var[t]=e;return t.indexOf(`attr__`)===0})).forEach((e=>{var[n,r]=e;return t.attributes[n]=r})),t}))}(e))}function lr(e){return e.replace(/"|\\"/g,`\\"`)}function ur(e){var t=e.attr__class;return t?T(t)?t:Fn(t):void 0}var dr=class{constructor(e){this.disabled=!1===e;var 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,n){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&n-r.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}},fr=e=>{var t=o?.createElement(`a`);return k(t)?null:(t.href=e,t)},pr=function(e,t){var n,r;t===void 0&&(t=`&`);var i=[];return H(e,(function(e,t){k(e)||k(t)||t===`undefined`||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),i[i.length]=r+`=`+n)})),i.join(t)},mr=function(e,t){for(var n,r=((e.split(`#`)[0]||``).split(/\?(.*)/)[1]||``).replace(/^\?+/g,``).split(`&`),i=0;i<r.length;i++){var a=r[i].split(`=`);if(a[0]===t){n=a;break}}if(!T(n)||n.length<2)return``;var o=n[1];try{o=decodeURIComponent(o)}catch{B.error(`Skipping decoding for malformed query param: `+o)}return o.replace(/\+/g,` `)},hr=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split(`#`),i=r[0]||``,a=r[1],o=i.split(`?`),s=o[1],c=o[0],l=(s||``).split(`&`),u=[],d=0;d<l.length;d++){var f=l[d].split(`=`);T(f)&&(t.includes(f[0])?u.push(f[0]+`=`+n):u.push(l[d]))}var p=c;return s!=null&&(p+=`?`+u.join(`&`)),a!=null&&(p+=`#`+a),p},gr=function(e,t){var n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},_r=`$copy_autocapture`,vr=V(`[AutoCapture]`);function yr(e,t){return t.length>e?t.slice(0,e)+`...`:t}function br(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!jn(t));return t}function xr(e,t,n,r){var i=e.tagName.toLowerCase(),a={tag_name:i};Vn.indexOf(i)>-1&&!n&&(i.toLowerCase()===`a`||i.toLowerCase()===`button`?a.$el_text=yr(1024,or(e)):a.$el_text=yr(1024,zn(e)));var o=Ln(e);o.length>0&&(a.classes=o.filter((function(e){return e!==``}))),H(e.attributes,(function(n){var i;if((!Qn(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&(r==null||!r.includes(n.name))&&!t&&ar(n.value)&&(i=n.name,!A(i)||i.substring(0,10)!==`_ngcontent`&&i.substring(0,7)!==`_nghost`)){var o=n.value;n.name===`class`&&(o=Fn(o).join(` `)),a[`attr__`+n.name]=yr(1024,o)}}));for(var s=1,c=1,l=e;l=br(l);)s++,l.tagName===e.tagName&&c++;return a.nth_child=s,a.nth_of_type=c,a}function Sr(t,n){for(var r,{e:i,maskAllElementAttributes:a,maskAllText:o,elementAttributeIgnoreList:s,elementsChainAsString:c}=n,l=[t],u=t;u.parentNode&&!Mn(u,`body`);)Pn(u.parentNode)?(l.push(u.parentNode.host),u=u.parentNode.host):(l.push(u.parentNode),u=u.parentNode);var d,f=[],p={},m=!1,h=!1;if(H(l,(e=>{var t=Zn(e);e.tagName.toLowerCase()===`a`&&(m=e.getAttribute(`href`),m=t&&m&&ar(m)&&m),b(Ln(e),`ph-no-capture`)&&(h=!0),f.push(xr(e,a,o,s)),U(p,function(e){if(!Zn(e))return{};var t={};return H(e.attributes,(function(e){if(e.name&&e.name.indexOf(`data-ph-capture-attribute`)===0){var n=e.name.replace(`data-ph-capture-attribute-`,``),r=e.value;n&&r&&ar(r)&&(t[n]=r)}})),t}(e))})),h)return{props:{},explicitNoCapture:h};if(o||(t.tagName.toLowerCase()===`a`||t.tagName.toLowerCase()===`button`?f[0].$el_text=or(t):f[0].$el_text=zn(t)),m){var g;f[0].attr__href=m;var _=fr(m)?.host,v=e==null||(g=e.location)==null?void 0:g.host;_&&v&&_!==v&&(d=m)}return{props:U({$event_type:i.type,$ce_version:1},c?{}:{$elements:f},{$elements_chain:cr(f)},(r=f[0])!=null&&r.$el_text?{$el_text:f[0]?.$el_text}:{},d&&i.type===`click`?{$external_click_url:d}:{},p)}}var Cr=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new dr(e.config.rageclick),this.C=null}get R(){var e=D(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=e.url_allowlist?.map((e=>new RegExp(e))),e.url_ignorelist=e.url_ignorelist?.map((e=>new RegExp(e))),e}F(){if(this.isBrowserSupported()){if(e&&o){var t=t=>{t||=e?.event;try{this.O(t)}catch(e){vr.error(`Failed to capture event`,e)}};if(W(o,`submit`,t,{capture:!0}),W(o,`change`,t,{capture:!0}),W(o,`click`,t,{capture:!0}),this.R.capture_copied_text){var n=t=>{t||=e?.event,this.O(t,_r)};W(o,`copy`,n,{capture:!0}),W(o,`cut`,n,{capture:!0})}}}else vr.info(`Disabling Automatic Event Collection because this browser is not supported`)}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[$t]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,n=[];return(t=this.C)==null||t.forEach((t=>{(o?.querySelectorAll(t))?.forEach((r=>{e===r&&n.push(t)}))})),n}get isEnabled(){var e=this.instance.persistence?.props[$t],t=this.T;if(M(t)&&!F(e)&&!this.instance.M())return!1;var n=this.T??!!e;return!!this.instance.config.autocapture&&!n}O(t,n){if(n===void 0&&(n=`$autocapture`),this.isEnabled){var r,i=Bn(t);Nn(i)&&(i=i.parentNode||null),n===`$autocapture`&&t.type===`click`&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&qn(i,this.instance.config.rageclick)&&this.O(t,`$rageclick`);var a=n===_r;if(i&&Xn(i,t,this.R,a,a?[`copy`,`cut`]:void 0)){var{props:o,explicitNoCapture:s}=Sr(i,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(s)return!1;var c=this.getElementSelectors(i);if(c&&c.length>0&&(o.$element_selectors=c),n===_r){var l,u=Rn(e==null||(l=e.getSelection())==null?void 0:l.toString()),d=t.type||`clipboard`;if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(n,o),!0}}}isBrowserSupported(){return E(o?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return P(e)&&isFinite(e)&&Math.floor(e)===e});var wr=`0123456789abcdef`,Tr=class e{constructor(e){if(this.bytes=e,e.length!==16)throw TypeError(`not 128-bit length`)}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError(`invalid field value`);var a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}toString(){for(var e=``,t=0;t<this.bytes.length;t++)e=e+wr.charAt(this.bytes[t]>>>4)+wr.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+=`-`);if(e.length!==36)throw Error(`Invalid UUIDv7 was generated`);return e}clone(){return new e(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},Er=class{constructor(){this.A=0,this.j=0,this.D=new kr}generate(){var e=this.generateOrAbort();if(k(e)){this.A=0;var t=this.generateOrAbort();if(k(t))throw Error(`Could not generate UUID after timestamp reset`);return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.j++,this.j>4398046511103&&(this.A++,this.L())}return Tr.fromFieldsV7(this.A,Math.trunc(this.j/2**30),this.j&2**30-1,this.D.nextUint32())}L(){this.j=1024*this.D.nextUint32()+(1023&this.D.nextUint32())}},Dr,Or=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<`u`&&UUIDV7_DENY_WEAK_RNG)throw Error(`no cryptographically strong RNG available`);for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!k(e.crypto)&&crypto.getRandomValues&&(Or=e=>crypto.getRandomValues(e));var kr=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Or(this.N),this.U=0),this.N[this.U++]}},Ar=()=>jr().toString(),jr=()=>(Dr||=new Er).generate(),Mr=``,Nr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Pr(e,t){if(t){var n=function(e,t){if(t===void 0&&(t=o),Mr)return Mr;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;for(var n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+Ar();!Mr&&r--;){var a=n.slice(r).join(`.`),s=i+`=1;domain=.`+a+`;path=/`;t.cookie=s+`;max-age=3`,t.cookie.includes(i)&&(t.cookie=s+`;max-age=0`,Mr=a)}return Mr}(e);if(!n){var r=(e=>{var t=e.match(Nr);return t?t[0]:``})(e);r!==n&&B.info(`Warning: cookie subdomain discovery mismatch`,r,n),n=r}return n?`; domain=.`+n:``}return``}var G={H:()=>!!o,B:function(e){B.error(`cookieStore error: `+e)},q:function(e){if(o){try{for(var t=e+`=`,n=o.cookie.split(`;`).filter((e=>e.length)),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==` `;)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},W:function(e){var t;try{t=JSON.parse(G.q(e))||{}}catch{}return t},G:function(e,t,n,r,i){if(o)try{var a=``,s=``,c=Pr(o.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),a=`; expires=`+l.toUTCString()}i&&(s=`; secure`);var u=e+`=`+encodeURIComponent(JSON.stringify(t))+a+`; SameSite=Lax; path=/`+c+s;return u.length>3686.4&&B.warn(`cookieStore warning: large cookie, len=`+u.length),o.cookie=u,u}catch{return}},V:function(e,t){if(o!=null&&o.cookie)try{G.G(e,``,-1,t)}catch{return}}},Fr=null,K={H:function(){if(!M(Fr))return Fr;var t=!0;if(k(e))t=!1;else try{var n=`__mplssupport__`;K.G(n,`xyz`),K.q(n)!==`"xyz"`&&(t=!1),K.V(n)}catch{t=!1}return t||B.error(`localStorage unsupported; falling back to cookie store`),Fr=t,t},B:function(e){B.error(`localStorage error: `+e)},q:function(t){try{return e?.localStorage.getItem(t)}catch(e){K.B(e)}return null},W:function(e){try{return JSON.parse(K.q(e))||{}}catch{}return null},G:function(t,n){try{e?.localStorage.setItem(t,JSON.stringify(n))}catch(e){K.B(e)}},V:function(t){try{e?.localStorage.removeItem(t)}catch(e){K.B(e)}}},Ir=[`$device_id`,`distinct_id`,un,dn,En,Tn],Lr={},Rr={H:function(){return!0},B:function(e){B.error(`memoryStorage error: `+e)},q:function(e){return Lr[e]||null},W:function(e){return Lr[e]||null},G:function(e,t){Lr[e]=t},V:function(e){delete Lr[e]}},zr=null,q={H:function(){if(!M(zr))return zr;if(zr=!0,k(e))zr=!1;else try{var t=`__support__`;q.G(t,`xyz`),q.q(t)!==`"xyz"`&&(zr=!1),q.V(t)}catch{zr=!1}return zr},B:function(e){B.error(`sessionStorage error: `,e)},q:function(t){try{return e?.sessionStorage.getItem(t)}catch(e){q.B(e)}return null},W:function(e){try{return JSON.parse(q.q(e))||null}catch{}return null},G:function(t,n){try{e?.sessionStorage.setItem(t,JSON.stringify(n))}catch(e){q.B(e)}},V:function(t){try{e?.sessionStorage.removeItem(t)}catch(e){q.B(e)}}},Br=function(e){return e[e.PENDING=-1]=`PENDING`,e[e.DENIED=0]=`DENIED`,e[e.GRANTED=1]=`GRANTED`,e}({}),Vr=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Br.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode===`always`||this.consent===Br.DENIED||this.consent===Br.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode===`on_reject`)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Br.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:`__ph_opt_in_out_`+e)}get K(){var e=this.Y.q(this.X);return le(e)?Br.GRANTED:b(ue,e)?Br.DENIED:Br.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e===`localStorage`?K:G;var t=e===`localStorage`?G:K;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(le(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!Yt([a?.doNotTrack,a?.msDoNotTrack,f.doNotTrack],(e=>le(e)))}},Hr=V(`[Dead Clicks]`),Ur=()=>!0,Wr=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(on)),r=e.instance.config.capture_dead_clicks;return F(r)?r:!!D(r)||n},Gr=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){`captureDeadClicks`in e&&(this.instance.persistence&&this.instance.persistence.register({[on]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.it((()=>{this.et()})):this.stop()}it(e){var t,n;(t=f.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,`dead-clicks-autocapture`,(t=>{t?Hr.error(`failed to load script`,t):e()}))}et(){var e;if(o){if(!this.tt&&(e=f.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=D(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=f.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(o),Hr.info(`starting...`)}}else Hr.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Hr.info(`stopping...`))}},Kr=V(`[ExceptionAutocapture]`),qr=class{constructor(t){var n;this.rt=()=>{var t;if(e&&this.isEnabled&&(t=f.__PosthogExtensions__)!=null&&t.errorWrappingFunctions){var n=f.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=f.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=f.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=n(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=r(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=i(this.captureException.bind(this)))}catch(e){Kr.error(`failed to start`,e),this.ut()}}},this._instance=t,this.ht=!((n=this._instance.persistence)==null||!n.props[tn]),this.dt=new de({refillRate:this._instance.config.error_tracking.__exceptionRateLimiterRefillRate??1,bucketSize:this._instance.config.error_tracking.__exceptionRateLimiterBucketSize??10,refillInterval:1e4,h:Kr}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return D(e)?t=g({},t,e):(k(e)?this.ht:e)&&(t=g({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Kr.info(`enabled`),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;(t=f.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`exception-autocapture`,(t=>{if(t)return Kr.error(`failed to load script`,t);e()}))}ut(){var e,t,n;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(n=this.ot)==null||n.call(this),this.ot=void 0}onRemoteConfig(e){`autocaptureExceptions`in e&&(this.ht=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[tn]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop())}onConfigChange(){this.R=this.vt()}captureException(e){var t,n=(e==null||(t=e.$exception_list)==null||(t=t[0])==null?void 0:t.type)??`Exception`;this.dt.consumeRateLimit(n)?Kr.info(`Skipping exception capture because of client rate limiting.`,{exception:n}):this._instance.exceptions.sendExceptionEvent(e)}};function Jr(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],i=n(r);return E(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var Yr=class{constructor(t){var n;this._instance=t,this.ct=(e==null||(n=e.location)==null?void 0:n.pathname)||``}get isEnabled(){return this._instance.config.capture_pageview===`history_change`}startIfEnabled(){this.isEnabled&&(B.info(`History API monitoring enabled, starting...`),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,B.info(`History API monitoring stopped`)}monitorHistoryChanges(){var t,n;if(e&&e.history){var r=this;(t=e.history.pushState)!=null&&t.__posthog_wrapped__||Jr(e.history,`pushState`,(e=>function(t,n,i){e.call(this,t,n,i),r._t(`pushState`)})),(n=e.history.replaceState)!=null&&n.__posthog_wrapped__||Jr(e.history,`replaceState`,(e=>function(t,n,i){e.call(this,t,n,i),r._t(`replaceState`)})),this.bt()}}_t(t){try{var n,r=e==null||(n=e.location)==null?void 0:n.pathname;if(!r)return;r!==this.ct&&this.isEnabled&&this._instance.capture(`$pageview`,{navigation_type:t}),this.ct=r}catch(e){B.error(`Error capturing `+t+` pageview`,e)}}bt(){if(!this.ft){var t=()=>{this._t(`popstate`)};W(e,`popstate`,t),this.ft=()=>{e&&e.removeEventListener(`popstate`,t)}}}},Xr=V(`[SegmentIntegration]`);function Zr(e,t){var n=e.config.segment;if(!n)return t();(function(e,t){var n=e.config.segment;if(!n)return t();var r=n=>{var r=()=>n.anonymousId()||Ar();e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(bn,`identified`)),t()},i=n.user();`then`in i&&E(i.then)?i.then(r):r(i)})(e,(()=>{n.register((e=>{Promise&&Promise.resolve||Xr.warn(`This browser does not have Promise support, and can not use the segment integration`);var t=(t,n)=>{if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Xr.info(`No userId set, resetting PostHog`),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Xr.info(`UserId set, identifying with PostHog`),e.identify(t.event.userId));var r=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:`PostHog JS`,type:`enrichment`,version:`1.0.0`,isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,`$pageview`),identify:e=>t(e,`$identify`),screen:e=>t(e,`$screen`)}})(e)).then((()=>{t()}))}))}var Qr=`posthog-js`;function $r(e,t){var{organization:n,projectId:r,prefix:i,severityAllowList:a=[`error`],sendExceptionsToPostHog:o=!0}=t===void 0?{}:t;return t=>{if(!(a===`*`||a.includes(t.level))||!e.__loaded)return t;t.tags||={};var s=e.requestRouter.endpointFor(`ui`,`/project/`+e.config.token+`/person/`+e.get_distinct_id());t.tags[`PostHog Person URL`]=s,e.sessionRecordingStarted()&&(t.tags[`PostHog Recording URL`]=e.get_session_replay_url({withTimestamp:!0}));var c=t.exception?.values||[],l=c.map((e=>g({},e,{stacktrace:e.stacktrace?g({},e.stacktrace,{type:`raw`,frames:(e.stacktrace.frames||[]).map((e=>g({},e,{platform:`web:javascript`})))}):void 0}))),u={$exception_message:c[0]?.value||t.message,$exception_type:c[0]?.type,$exception_level:t.level,$exception_list:l,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:c[0]?.value||t.message,$sentry_exception_type:c[0]?.type,$sentry_tags:t.tags};return n&&r&&(u.$sentry_url=(i||`https://sentry.io/organizations/`)+n+`/issues/?project=`+r+`&query=`+t.event_id),o&&e.exceptions.sendExceptionEvent(u),t}}var ei=class{constructor(e,t,n,r,i,a){this.name=Qr,this.setupOnce=function(o){o($r(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},ti=e!=null&&e.location?gr(e.location.hash,`__posthog`)||gr(location.hash,`state`):null,ni=`_postHogToolbarParams`,ri=V(`[Toolbar]`),ii=function(e){return e[e.UNINITIALIZED=0]=`UNINITIALIZED`,e[e.LOADING=1]=`LOADING`,e[e.LOADED=2]=`LOADED`,e}(ii||{}),ai=class{constructor(e){this.instance=e}yt(e){f.ph_toolbar_state=e}wt(){return f.ph_toolbar_state??ii.UNINITIALIZED}maybeLoadToolbar(t,n,r){if(t===void 0&&(t=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),this.instance.config.name&&this.instance.config.name===`ph_toolbar_internal`||!e||!o)return!1;t??=e.location,r??=e.history;try{if(!n){try{e.localStorage.setItem(`test`,`test`),e.localStorage.removeItem(`test`)}catch{return!1}n=e?.localStorage}var i,a=ti||gr(t.hash,`__posthog`)||gr(t.hash,`state`),s=a?Ut((()=>JSON.parse(atob(decodeURIComponent(a)))))||Ut((()=>JSON.parse(decodeURIComponent(a)))):null;return s&&s.action===`ph_authorize`?((i=s).source=`url`,i&&Object.keys(i).length>0&&(s.desiredHash?t.hash=s.desiredHash:r?r.replaceState(r.state,``,t.pathname+t.search):t.hash=``)):((i=JSON.parse(n.getItem(ni)||`{}`)).source=`localstorage`,delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=f.ph_load_toolbar||f.ph_load_editor;!N(t)&&E(t)?t(e,this.instance):ri.warn(`No toolbar load function found`)}loadToolbar(t){var n=!(o==null||!o.getElementById(Dn));if(!e||n)return!1;var r=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,i=g({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor(`ui`)},r?{instrument:!1}:{});if(e.localStorage.setItem(ni,JSON.stringify(g({},i,{source:void 0}))),this.wt()===ii.LOADED)this.xt(i);else if(this.wt()===ii.UNINITIALIZED){var a;this.yt(ii.LOADING),(a=f.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,`toolbar`,(e=>{if(e)return ri.error(`[Toolbar] Failed to load`,e),void this.yt(ii.UNINITIALIZED);this.yt(ii.LOADED),this.xt(i)})),W(e,`turbolinks:load`,(()=>{this.yt(ii.UNINITIALIZED),this.loadToolbar(i)}))}return!0}$t(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}},oi=V(`[TracingHeaders]`),si=class{constructor(e){this.Et=void 0,this.St=void 0,this.rt=()=>{var e,t;k(this.Et)&&((e=f.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),k(this.St)&&((t=f.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,n;(t=f.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`tracing-headers`,(t=>{if(t)return oi.error(`failed to load script`,t);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.Et)==null||e.call(this),(t=this.St)==null||t.call(this),this.Et=void 0,this.St=void 0)}},ci=`https?://(.*)`,li=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],ui=Vt([`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`],li),di=`<masked>`,fi=[`li_fat_id`];function pi(e,t,n){if(!o)return{};var r,i=t?Vt([],li,n||[]):[],a=mi(hr(o.URL,i,di),e);return U((r={},H(fi,(function(e){var t=G.q(e);r[e]=t||null})),r),a)}function mi(e,t){var n=ui.concat(t||[]),r={};return H(n,(function(t){r[t]=mr(e,t)||null})),r}function hi(e){var t=function(e){return e?e.search(ci+`google.([^/?]*)`)===0?`google`:e.search(ci+`bing.com`)===0?`bing`:e.search(ci+`yahoo.com`)===0?`yahoo`:e.search(ci+`duckduckgo.com`)===0?`duckduckgo`:null:null}(e),n=t==`yahoo`?`p`:`q`,r={};if(!M(t)){r.$search_engine=t;var i=o?mr(o.referrer,n):``;i.length&&(r.ph_keyword=i)}return r}function gi(){return navigator.language||navigator.userLanguage}function _i(){return o?.referrer||`$direct`}function vi(e,t){var n=e?Vt([],li,t||[]):[],r=s?.href.substring(0,1e3);return{r:_i().substring(0,1e3),u:r?hr(r,n,di):void 0}}function yi(e){var{r:t,u:n}=e,r={$referrer:t,$referring_domain:t==null?void 0:t==`$direct`?`$direct`:fr(t)?.host};if(n){r.$current_url=n;var i=fr(n);r.$host=i?.host,r.$pathname=i?.pathname,U(r,mi(n))}return t&&U(r,hi(t)),r}function bi(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function xi(){try{return new Date().getTimezoneOffset()}catch{return}}function Si(t,n){if(!d)return{};var r,i,a,o=t?Vt([],li,n||[]):[],[c,l]=function(e){for(var t=0;t<st.length;t++){var[n,r]=st[t],i=n.exec(e),a=i&&(E(r)?r(i,e):r);if(a)return a}return[``,``]}(d);return U(Gt({$os:c,$os_version:l,$browser:it(d,navigator.vendor),$device:ct(d),$device_type:(i=d,a=ct(i),a===ge||a===he||a===`Kobo`||a===`Kindle Fire`||a===Ke?me:a===Fe||a===Le||a===Ie||a===Ue?`Console`:a===ve?`Wearable`:a?R:`Desktop`),$timezone:bi(),$timezone_offset:xi()}),{$current_url:hr(s?.href,o,di),$host:s?.host,$pathname:s?.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+`...`:d,$browser_version:ot(d,navigator.vendor),$browser_language:gi(),$browser_language_prefix:(r=gi(),typeof r==`string`?r.split(`-`)[0]:void 0),$screen_height:e?.screen.height,$screen_width:e?.screen.width,$viewport_height:e?.innerHeight,$viewport_width:e?.innerWidth,$lib:`web`,$lib_version:p.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Ci=V(`[Web Vitals]`),wi=9e5,Ti=class{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),this.N.metrics.length!==0&&(this._instance.capture(`$web_vitals`,this.N.metrics.reduce(((e,t)=>g({},e,{[`$web_vitals_`+t.name+`_event`]:g({},t),[`$web_vitals_`+t.name+`_value`]:t.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=e=>{var t=this._instance.sessionManager?.checkAndGetSessionAndWindowId(!0);if(k(t))Ci.error(`Could not read session ID. Dropping metrics!`);else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.Ct();k(n)||(N(e?.name)||N(e?.value)?Ci.error(`Invalid metric received`,e):this.Rt&&e.value>=this.Rt?Ci.error(`Ignoring metric with value >= `+this.Rt,e):(this.N.url!==n&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),k(this.N.url)&&(this.N.url=n),this.N.firstMetricTimestamp=k(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.N.metrics.push(g({},e,{$current_url:n,$session_id:t.sessionId,$window_id:t.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{if(!this.P){var e,t,n,r,i=f.__PosthogExtensions__;k(i)||k(i.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:n,onINP:r}=i.postHogWebVitalsCallbacks),e&&t&&n&&r?(this.allowedMetrics.indexOf(`LCP`)>-1&&e(this.It.bind(this)),this.allowedMetrics.indexOf(`CLS`)>-1&&t(this.It.bind(this)),this.allowedMetrics.indexOf(`FCP`)>-1&&n(this.It.bind(this)),this.allowedMetrics.indexOf(`INP`)>-1&&r(this.It.bind(this)),this.P=!0):Ci.error(`web vitals callbacks not loaded - not starting`)}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[an]),this.startIfEnabled()}get allowedMetrics(){var e=D(this._instance.config.capture_performance)?this._instance.config.capture_performance?.web_vitals_allowed_metrics:void 0;return N(e)?this._instance.persistence?.props[cn]||[`CLS`,`FCP`,`INP`,`LCP`]:e}get flushToCaptureTimeoutMs(){return(D(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=D(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=D(this._instance.config.capture_performance)&&P(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:wi;return 0<e&&e<=6e4?wi:e}get isEnabled(){var e=s?.protocol;if(e!==`http:`&&e!==`https:`)return Ci.info(`Web Vitals are disabled on non-http/https protocols`),!1;var t=D(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:F(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return F(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Ci.info(`enabled, starting...`),this.it(this.rt))}onRemoteConfig(e){if(`capturePerformance`in e){var t=D(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=D(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[an]:t}),this._instance.persistence.register({[cn]:n})),this.kt=t,this.startIfEnabled()}}it(e){var t,n;if((t=f.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var r=this.useAttribution?`web-vitals-with-attribution`:`web-vitals`;(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,r,(t=>{t?Ci.error(`failed to load script`,t):e()}))}}Ct(){var t=e?e.location.href:void 0;if(t){var n=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties;return hr(t,n?Vt([],li,r||[]):[],di)}Ci.error(`Could not determine current URL`)}},Ei=V(`[Heatmaps]`);function Di(e){return D(e)&&`clientX`in e&&`clientY`in e&&P(e.clientX)&&P(e.clientY)}var Oi=class{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!((t=this.instance.persistence)==null||!t.props[en]),this.rageclicks=new dr(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return D(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return N(this.instance.config.capture_heatmaps)?N(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;Ei.info(`starting...`),this.Ot(),this.Mt()}else clearInterval(this.Ft??void 0),this.At(),this.getAndClearBuffer()}onRemoteConfig(e){if(`heatmaps`in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[en]:t}),this.kt=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}jt(e){this.Dt(e.originalEvent,`deadclick`)}Mt(){this.Ft&&clearInterval(this.Ft),this.Ft=function(e){return e?.visibilityState===`visible`}(o)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){e&&o&&(this.Nt=this.Lt.bind(this),W(e,`beforeunload`,this.Nt),this.Ut=t=>this.Dt(t||e?.event),W(o,`click`,this.Ut,{capture:!0}),this.zt=t=>this.Ht(t||e?.event),W(o,`mousemove`,this.zt,{capture:!0}),this.Bt=new Gr(this.instance,Ur,this.jt.bind(this)),this.Bt.startIfEnabledOrStop(),this.qt=this.Mt.bind(this),W(o,`visibilitychange`,this.qt),this.P=!0)}At(){var t;e&&o&&(this.Nt&&e.removeEventListener(`beforeunload`,this.Nt),this.Ut&&o.removeEventListener(`click`,this.Ut,{capture:!0}),this.zt&&o.removeEventListener(`mousemove`,this.zt,{capture:!0}),this.qt&&o.removeEventListener(`visibilitychange`,this.qt),clearTimeout(this.Wt),(t=this.Bt)==null||t.stop(),this.P=!1)}Gt(t,n){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=function(t,n,r){for(var i=t;i&&jn(i)&&!Mn(i,`body`);){if(i===r)return!1;if(b(n,e?.getComputedStyle(i).position))return!0;i=Un(i)}return!1}(Bn(t),[`fixed`,`sticky`],a);return{x:t.clientX+(o?0:i),y:t.clientY+(o?0:r),target_fixed:o,type:n}}Dt(e,t){var n;if(t===void 0&&(t=`click`),!An(e.target)&&Di(e)){var r=this.Gt(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(g({},r,{type:`rageclick`})),this.Vt(r)}}Ht(e){!An(e.target)&&Di(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(e,`mousemove`))}),500))}Vt(t){if(e){var n=e.location.href,r=this.instance.config.mask_personal_data_properties,i=this.instance.config.custom_personal_data_properties,a=hr(n,r?Vt([],li,i||[]):[],di);this.N=this.N||{},this.N[a]||(this.N[a]=[]),this.N[a].push(t)}}Lt(){this.N&&!O(this.N)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},ki=class{constructor(e){this.Jt=(e,t,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength)&&(B.info(`[PageViewManager] Session rotated, clearing pageview state`,{sessionId:e,changeReason:n}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){this.Xt=this._instance.sessionManager?.onSessionId(this.Jt)}destroy(){var e;(e=this.Xt)==null||e.call(this),this.Xt=void 0}doPageView(t,n){var r=this.Qt(t,n);return this.Kt={pathname:e?.location.pathname??``,pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(e){return this.Qt(e,this.Kt?.pageViewId)}doEvent(){return{$pageview_id:this.Kt?.pageViewId}}Qt(e,t){var n=this.Kt;if(!n)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:s,maxContentHeight:c,lastContentY:l,maxContentY:u}=i;if(!(k(a)||k(o)||k(s)||k(c)||k(l)||k(u))){a=Math.ceil(a),o=Math.ceil(o),s=Math.ceil(s),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u);var d=a<=1?1:L(o/a,0,1,B),f=a<=1?1:L(s/a,0,1,B),p=c<=1?1:L(l/c,0,1,B),m=c<=1?1:L(u/c,0,1,B);r=U(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:s,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:m})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}},Ai=[`fatal`,`error`,`warning`,`log`,`info`,`debug`],J=function(e){return e.GZipJS=`gzip-js`,e.Base64=`base64`,e}({}),Y=Uint8Array,X=Uint16Array,ji=Uint32Array,Mi=new Y([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]),Ni=new Y([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]),Pi=new Y([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fi=function(e,t){for(var n=new X(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new ji(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},Ii=Fi(Mi,2),Li=Ii[0],Ri=Ii[1];Li[28]=258,Ri[258]=28;for(var zi=Fi(Ni,0)[1],Bi=new X(32768),Z=0;Z<32768;++Z){var Vi=(43690&Z)>>>1|(21845&Z)<<1;Vi=(61680&(Vi=(52428&Vi)>>>2|(13107&Vi)<<2))>>>4|(3855&Vi)<<4,Bi[Z]=((65280&Vi)>>>8|(255&Vi)<<8)>>>1}var Hi=function(e,t,n){for(var r=e.length,i=0,a=new X(t);i<r;++i)++a[e[i]-1];var o,s=new X(t);for(i=0;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new X(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)o[Bi[d]>>>c]=l}else for(o=new X(r),i=0;i<r;++i)o[i]=Bi[s[e[i]-1]++]>>>15-e[i];return o},Ui=new Y(288);for(Z=0;Z<144;++Z)Ui[Z]=8;for(Z=144;Z<256;++Z)Ui[Z]=9;for(Z=256;Z<280;++Z)Ui[Z]=7;for(Z=280;Z<288;++Z)Ui[Z]=8;var Wi=new Y(32);for(Z=0;Z<32;++Z)Wi[Z]=5;var Gi=Hi(Ui,9,0),Ki=Hi(Wi,5,0),qi=function(e){return(e/8>>0)+(7&e&&1)},Ji=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof X?X:e instanceof ji?ji:Y)(n-t);return r.set(e.subarray(t,n)),r},Yi=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},Xi=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Zi=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[new Y(0),0];if(i==1){var o=new Y(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};var f=a[0].s;for(r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new X(f+1),m=Qi(n[u-1],p,0);if(m>t){r=0;var h=0,g=m-t,_=1<<g;for(a.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<i;++r){var v=a[r].s;if(!(p[v]>t))break;h+=_-(1<<m-p[v]),p[v]=t}for(h>>>=g;h>0;){var ee=a[r].s;p[ee]<t?h-=1<<t-p[ee]++-1:++r}for(;r>=0&&h;--r){var y=a[r].s;p[y]==t&&(--p[y],++h)}m=t}return[new Y(p),m]},Qi=function(e,t,n){return e.s==-1?Math.max(Qi(e.l,t,n+1),Qi(e.r,t,n+1)):t[e.s]=n},$i=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new X(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[n.subarray(0,r),t]},ea=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},ta=function(e,t,n){var r=n.length,i=qi(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<r;++a)e[i+a+4]=n[a];return 8*(i+4+r)},na=function(e,t,n,r,i,a,o,s,c,l,u){Yi(t,u++,n),++i[256];for(var d=Zi(i,15),f=d[0],p=d[1],m=Zi(a,15),h=m[0],g=m[1],_=$i(f),v=_[0],ee=_[1],y=$i(h),b=y[0],x=y[1],S=new X(19),C=0;C<v.length;++C)S[31&v[C]]++;for(C=0;C<b.length;++C)S[31&b[C]]++;for(var te=Zi(S,7),w=te[0],ne=te[1],T=19;T>4&&!w[Pi[T-1]];--T);var E,D,O,k,A=l+5<<3,j=ea(i,Ui)+ea(a,Wi)+o,M=ea(i,f)+ea(a,h)+o+14+3*T+ea(S,w)+(2*S[16]+3*S[17]+7*S[18]);if(A<=j&&A<=M)return ta(t,u,e.subarray(c,c+l));if(Yi(t,u,1+(M<j)),u+=2,M<j){E=Hi(f,p,0),D=f,O=Hi(h,g,0),k=h;var N=Hi(w,ne,0);for(Yi(t,u,ee-257),Yi(t,u+5,x-1),Yi(t,u+10,T-4),u+=14,C=0;C<T;++C)Yi(t,u+3*C,w[Pi[C]]);u+=3*T;for(var P=[v,b],re=0;re<2;++re){var F=P[re];for(C=0;C<F.length;++C){var ie=31&F[C];Yi(t,u,N[ie]),u+=w[ie],ie>15&&(Yi(t,u,F[C]>>>5&127),u+=F[C]>>>12)}}}else E=Gi,D=Ui,O=Ki,k=Wi;for(C=0;C<s;++C)if(r[C]>255){ie=r[C]>>>18&31,Xi(t,u,E[ie+257]),u+=D[ie+257],ie>7&&(Yi(t,u,r[C]>>>23&31),u+=Mi[ie]);var I=31&r[C];Xi(t,u,O[I]),u+=k[I],I>3&&(Xi(t,u,r[C]>>>5&8191),u+=Ni[I])}else Xi(t,u,E[r[C]]),u+=D[r[C]];return Xi(t,u,E[256]),u+D[256]},ra=new ji([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ia=function(){for(var e=new ji(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),aa=function(e,t,n,r,i){return function(e,t,n,r,i,a){var o=e.length,s=new Y(r+o+5*(1+Math.floor(o/7e3))+i),c=s.subarray(r,s.length-i),l=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?l=ta(c,l,e.subarray(u,d)):(c[u]=a,l=ta(c,l,e.subarray(u,o)))}else{for(var f=ra[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new X(32768),_=new X(h+1),v=Math.ceil(n/3),ee=2*v,y=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<ee)&h},b=new ji(25e3),x=new X(288),S=new X(32),C=0,te=0,w=(u=0,0),ne=0,T=0;u<o;++u){var E=y(u),D=32767&u,O=_[E];if(g[D]=O,_[E]=D,ne<=u){var k=o-u;if((C>7e3||w>24576)&&k>423){l=na(e,c,0,b,x,S,te,w,T,u-T,l),w=C=te=0,T=u;for(var A=0;A<286;++A)x[A]=0;for(A=0;A<30;++A)S[A]=0}var j=2,M=0,N=m,P=D-O&32767;if(k>2&&E==y(u-P))for(var re=Math.min(p,k)-1,F=Math.min(32767,u),ie=Math.min(258,k);P<=F&&--N&&D!=O;){if(e[u+j]==e[u+j-P]){for(var I=0;I<ie&&e[u+I]==e[u+I-P];++I);if(I>j){if(j=I,M=P,I>re)break;var ae=Math.min(P,I-2),oe=0;for(A=0;A<ae;++A){var se=u-P+A+32768&32767,ce=se-g[se]+32768&32767;ce>oe&&(oe=ce,O=se)}}}P+=(D=O)-(O=g[D])+32768&32767}if(M){b[w++]=268435456|Ri[j]<<18|zi[M];var le=31&Ri[j],ue=31&zi[M];te+=Mi[le]+Ni[ue],++x[257+le],++S[ue],ne=u+j,++C}else b[w++]=e[u],++x[e[u]]}}l=na(e,c,a,b,x,S,te,w,T,u-T,l)}return Ji(s,0,r+qi(l)+i)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!0)},oa=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function sa(e,t){t===void 0&&(t={});var n=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=ia[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,a=aa(e,t,10+((i=t).filename&&i.filename.length+1||0),8),o=a.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&oa(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}}(a,t),oa(a,o-8,n.d()),oa(a,o-4,r),a}var ca=function(e){var t,n,r,i,a=``;for(t=n=0,r=(e=(e+``).replace(/\r\n/g,`
2
+ `),o=r;o<a.length;o++){var s=a[o];if(!(s.length>1024)){var c=St.test(s)?s.replace(St,`$1`):s;if(!c.match(/\S*Error: /)){for(var l of t){var u=l(c,e);if(u){i.push(u);break}}if(i.length>=Ct)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,Ct).map((e=>{return g({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||ft});var n}))}(i)}}(`web:javascript`,vt,xt)}var Tt=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=A(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?`DOMError`:`DOMException`}getValue(e){var t=e.name||(this.isDOMError(e)?`DOMError`:`DOMException`);return e.message?t+`: `+e.message:t}isDOMException(e){return oe(e,`DOMException`)}isDOMError(e){return oe(e,`DOMError`)}},Et=class{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var n=e.message;return n.error&&typeof n.error.message==`string`?String(n.error.message):String(n)}getStack(e){return e.stacktrace||e.stack||void 0}},Dt=class{constructor(){}match(e){return oe(e,`ErrorEvent`)&&e.error!=null}coerce(e,t){return t.apply(e.error)||{type:`ErrorEvent`,value:e.message,stack:t.syntheticException?.stack,synthetic:!0}}},Ot=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,kt=class{match(e){return typeof e==`string`}coerce(e,t){var[n,r]=this.getInfos(e);return{type:n??`Error`,value:r??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){var t=`Error`,n=e,r=e.match(Ot);return r&&(t=r[1],n=r[2]),[t,n]}},At=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function jt(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return`[object has no keys]`;for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(`, `);if(!(i.length>t))return r===n.length||i.length<=t?i:i.slice(0,t)+`...`}return``}var Mt=class{match(e){return typeof e==`object`&&!!e}coerce(e,t){var n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:`error`,synthetic:!0}}getType(e){return se(e)?e.constructor.name:`Error`}getValue(e){if(`name`in e&&typeof e.name==`string`){var t=`'`+e.name+`' captured as exception`;return`message`in e&&typeof e.message==`string`&&(t+=` with message: '`+e.message+`'`),t}if(`message`in e&&typeof e.message==`string`)return e.message;var n=this.getObjectClassName(e);return(n&&n!==`Object`?`'`+n+`'`:`Object`)+` captured as exception with keys: `+jt(e)}isSeverityLevel(e){return A(e)&&!j(e)&&At.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(lt(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Nt=class{match(e){return se(e)}coerce(e,t){var n=e.constructor.name;return{type:n,value:n+` captured as exception with keys: `+jt(e),stack:t.syntheticException?.stack,synthetic:!0}}},Pt=class{match(e){return ae(e)}coerce(e,t){return{type:`Error`,value:`Primitive value captured as exception: `+String(e),stack:t.syntheticException?.stack,synthetic:!0}}},Ft=class{match(e){return oe(e,`PromiseRejectionEvent`)}coerce(e,t){var n=this.getUnhandledRejectionReason(e);return ae(n)?{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: `+String(n),stack:t.syntheticException?.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){if(ae(e))return e;try{if(`reason`in e)return e.reason;if(`detail`in e&&`reason`in e.detail)return e.detail.reason}catch{}return e}},It=function(t,n){var{debugEnabled:r}=n===void 0?{}:n,i={k:function(n){if(e&&(p.DEBUG||f.POSTHOG_DEBUG||r)&&!k(e.console)&&e.console){for(var i=(`__rrweb_original__`in e.console[n])?e.console[n].__rrweb_original__:e.console[n],a=arguments.length,o=Array(a>1?a-1:0),s=1;s<a;s++)o[s-1]=arguments[s];i(t,...o)}},info:function(){var e=[...arguments];i.k(`log`,...e)},warn:function(){var e=[...arguments];i.k(`warn`,...e)},error:function(){var e=[...arguments];i.k(`error`,...e)},critical:function(){console.error(t,...arguments)},uninitializedWarning:e=>{i.error(`You must initialize PostHog before calling `+e)},createLogger:(e,n)=>It(t+` `+e,n)};return i},B=It(`[PostHog.js]`),V=B.createLogger,Lt=V(`[ExternalScriptsLoader]`),Rt=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return Lt.warn(t+` was requested but loading of external scripts is disabled.`),n(`Loading of external scripts is disabled`);var r=o?.querySelectorAll(`script`);if(r){for(var i,a=function(){if(r[s].src===t){var e=r[s];return e.__posthog_loading_callback_fired?{v:n()}:(e.addEventListener(`load`,(t=>{e.__posthog_loading_callback_fired=!0,n(void 0,t)})),e.onerror=e=>n(e),{v:void 0})}},s=0;s<r.length;s++)if(i=a())return i.v}var c=()=>{if(!o)return n(`document not found`);var r=o.createElement(`script`);if(r.type=`text/javascript`,r.crossOrigin=`anonymous`,r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)},r.onerror=e=>n(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return n(`prepare_external_dependency_script returned null`);if(e.config.external_scripts_inject_target===`head`)o.head.appendChild(r);else{var i,a=o.querySelectorAll(`body > script`);a.length>0?(i=a[0].parentNode)==null||i.insertBefore(r,a[0]):o.body.appendChild(r)}};o!=null&&o.body?c():o?.addEventListener(`DOMContentLoaded`,c)};f.__PosthogExtensions__=f.__PosthogExtensions__||{},f.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r=`/static/`+t+`.js?v=`+e.version;if(t===`remote-config`&&(r=`/array/`+e.config.token+`/config.js`),t===`toolbar`){var i=3e5;r=r+`&t=`+Math.floor(Date.now()/i)*i}Rt(e,e.requestRouter.endpointFor(`assets`,r),n)},f.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{Rt(e,e.requestRouter.endpointFor(`api`,t),n)};var zt={};function Bt(e,t,n){if(T(e)){if(r&&e.forEach===r)e.forEach(t,n);else if(`length`in e&&e.length===+e.length){for(var i=0,a=e.length;i<a;i++)if(i in e&&t.call(n,e[i],i)===zt)return}}}function H(e,t,n){if(!N(e)){if(T(e))return Bt(e,t,n);if(ie(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===zt)return}else for(var i in e)if(w.call(e,i)&&t.call(n,e[i],i)===zt)return}}var U=function(e){return Bt([...arguments].slice(1),(function(t){for(var n in t)t[n]!==void 0&&(e[n]=t[n])})),e},Vt=function(e){return Bt([...arguments].slice(1),(function(t){Bt(t,(function(t){e.push(t)}))})),e};function Ht(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Ut=function(e){try{return e()}catch{return}},Wt=function(e){return function(){try{var t=[...arguments];return e.apply(this,t)}catch(e){B.critical(`Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.`),B.critical(e)}}},Gt=function(e){var t={};return H(e,(function(e,n){(A(e)&&e.length>0||P(e))&&(t[n]=e)})),t};function Kt(e,t){return n=e,r=e=>A(e)&&!M(t)?e.slice(0,t):e,i=new Set,function e(t,n){return t===Object(t)?i.has(t)?void 0:(i.add(t),T(t)?(a=[],Bt(t,(t=>{a.push(e(t))}))):(a={},H(t,((t,n)=>{i.has(t)||(a[n]=e(t,n))}))),a):r?r(t,n):t;var a}(n);var n,r,i}var qt=[`herokuapp.com`,`vercel.app`,`netlify.app`];function Jt(e){var t=e?.hostname;if(!A(t))return!1;var n=t.split(`.`).slice(-2).join(`.`);for(var r of qt)if(n===r)return!1;return!0}function Yt(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function W(e,t,n,r){var{capture:i=!1,passive:a=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:a})}var Xt=`$people_distinct_id`,Zt=`__alias`,Qt=`__timers`,$t=`$autocapture_disabled_server_side`,en=`$heatmaps_enabled_server_side`,tn=`$exception_capture_enabled_server_side`,nn=`$error_tracking_suppression_rules`,rn=`$error_tracking_capture_extension_exceptions`,an=`$web_vitals_enabled_server_side`,on=`$dead_clicks_enabled_server_side`,sn=`$product_tours_enabled_server_side`,cn=`$web_vitals_allowed_metrics`,ln=`$session_recording_remote_config`,un=`$sesid`,dn=`$session_is_sampled`,fn=`$enabled_feature_flags`,pn=`$early_access_features`,mn=`$feature_flag_details`,hn=`$stored_person_properties`,gn=`$stored_group_properties`,_n=`$surveys`,vn=`$flag_call_reported`,yn=`$feature_flag_errors`,bn=`$user_state`,xn=`$client_session_props`,Sn=`$capture_rate_limit`,Cn=`$initial_campaign_params`,wn=`$initial_referrer_info`,Tn=`$initial_person_info`,En=`$epp`,Dn=`__POSTHOG_TOOLBAR__`,On=`$posthog_cookieless`,kn=[Xt,Zt,`__cmpns`,Qt,`$session_recording_enabled_server_side`,en,un,fn,nn,bn,pn,mn,gn,hn,_n,vn,yn,xn,Sn,Cn,wn,En,Tn,`$conversations_widget_session_id`,`$conversations_ticket_id`,`$conversations_widget_state`,`$conversations_user_traits`];function An(e){return e instanceof Element&&(e.id===Dn||!(e.closest==null||!e.closest(`.toolbar-global-fade-container`)))}function jn(e){return!!e&&e.nodeType===1}function Mn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Nn(e){return!!e&&e.nodeType===3}function Pn(e){return!!e&&e.nodeType===11}function Fn(e){return e?x(e).split(/\s+/):[]}function In(t){var n=e?.location.href;return!!(n&&t&&t.some((e=>n.match(e))))}function Ln(e){var t=``;switch(typeof e.className){case`string`:t=e.className;break;case`object`:t=(e.className&&`baseVal`in e.className?e.className.baseVal:null)||e.getAttribute(`class`)||``;break;default:t=``}return Fn(t)}function Rn(e){return N(e)?null:x(e).split(/(\s+)/).filter((e=>ar(e))).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function zn(e){var t=``;return Zn(e)&&!Qn(e)&&e.childNodes&&e.childNodes.length&&H(e.childNodes,(function(e){Nn(e)&&e.textContent&&(t+=Rn(e.textContent)??``)})),x(t)}function Bn(e){return k(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Vn=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function Hn(e,t){if(k(t))return!0;var n,r=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var i of e)if(n=r(i))return n.v;return!1}function Un(e){var t=e.parentNode;return!(!t||!jn(t))&&t}var Wn=[`next`,`previous`,`prev`,`>`,`<`],Gn=10,Kn=[`.ph-no-rageclick`,`.ph-no-capture`];function qn(t,n){if(!e||Jn(t))return!1;var r,i;if(F(n)?(r=!!n&&Kn,i=void 0):(r=n?.css_selector_ignorelist??Kn,i=n?.content_ignorelist),!1===r)return!1;var{targetElementList:a}=Yn(t,!1);return!function(e,t){if(!1===e||k(e))return!1;var n;if(!0===e)n=Wn;else{if(!T(e))return!1;if(e.length>Gn)return B.error(`[PostHog] content_ignorelist array cannot exceed `+Gn+` items. Use css_selector_ignorelist for more complex matching.`),!1;n=e.map((e=>e.toLowerCase()))}return t.some((e=>{var{safeText:t,ariaLabel:r}=e;return n.some((e=>t.includes(e)||r.includes(e)))}))}(i,a.map((e=>({safeText:zn(e).toLowerCase(),ariaLabel:e.getAttribute(`aria-label`)?.toLowerCase().trim()||``}))))&&!Hn(a,r)}var Jn=e=>!e||Mn(e,`html`)||!jn(e),Yn=(t,n)=>{if(!e||Jn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[t],a=t;a.parentNode&&!Mn(a,`body`);)if(Pn(a.parentNode))i.push(a.parentNode.host),a=a.parentNode.host;else{var o=Un(a);if(!o)break;if(n||Vn.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var s=e.getComputedStyle(o);s&&s.getPropertyValue(`cursor`)===`pointer`&&(r=!0)}i.push(o),a=o}return{parentIsUsefulElement:r,targetElementList:i}};function Xn(t,n,r,i,a){var o,s,c;if(r===void 0&&(r=void 0),!e||Jn(t)||(o=r)!=null&&o.url_allowlist&&!In(r.url_allowlist)||(s=r)!=null&&s.url_ignorelist&&In(r.url_ignorelist))return!1;if((c=r)!=null&&c.dom_event_allowlist){var l=r.dom_event_allowlist;if(l&&!l.some((e=>n.type===e)))return!1}var{parentIsUsefulElement:u,targetElementList:d}=Yn(t,i);if(!function(e,t){var n=t?.element_allowlist;if(k(n))return!0;var r,i=function(e){if(n.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var a of e)if(r=i(a))return r.v;return!1}(d,r)||!Hn(d,r?.css_selector_allowlist))return!1;var f=e.getComputedStyle(t);if(f&&f.getPropertyValue(`cursor`)===`pointer`&&n.type===`click`)return!0;var p=t.tagName.toLowerCase();switch(p){case`html`:return!1;case`form`:return(a||[`submit`]).indexOf(n.type)>=0;case`input`:case`select`:case`textarea`:return(a||[`change`,`click`]).indexOf(n.type)>=0;default:return u?(a||[`click`]).indexOf(n.type)>=0:(a||[`click`]).indexOf(n.type)>=0&&(Vn.indexOf(p)>-1||t.getAttribute(`contenteditable`)===`true`)}}function Zn(e){for(var t=e;t.parentNode&&!Mn(t,`body`);t=t.parentNode){var n=Ln(t);if(b(n,`ph-sensitive`)||b(n,`ph-no-capture`))return!1}if(b(Ln(e),`ph-include`))return!0;var r=e.type||``;if(A(r))switch(r.toLowerCase()){case`hidden`:case`password`:return!1}var i=e.name||e.id||``;return!(A(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,``)))}function Qn(e){return!!(Mn(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||Mn(e,`select`)||Mn(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var $n=`(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})`,er=RegExp(`^(?:`+$n+`)$`),tr=new RegExp($n),nr=`\\d{3}-?\\d{2}-?\\d{4}`,rr=RegExp(`^(`+nr+`)$`),ir=RegExp(`(`+nr+`)`);function ar(e,t){return t===void 0&&(t=!0),!(N(e)||A(e)&&(e=x(e),(t?er:tr).test((e||``).replace(/[- ]/g,``))||(t?rr:ir).test(e)))}function or(e){var t=zn(e);return ar(t=(t+` `+sr(e)).trim())?t:``}function sr(e){var t=``;return e&&e.childNodes&&e.childNodes.length&&H(e.childNodes,(function(e){if(e&&e.tagName?.toLowerCase()===`span`)try{var n=zn(e);t=(t+` `+n).trim(),e.childNodes&&e.childNodes.length&&(t=(t+` `+sr(e)).trim())}catch(e){B.error(`[AutoCapture]`,e)}})),t}function cr(e){return function(e){return e.map((e=>{var t=``;if(e.tag_name&&(t+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))t+=`.`+n.replace(/"/g,``);var r=g({},e.text?{text:e.text}:{},{"nth-child":e.nth_child??0,"nth-of-type":e.nth_of_type??0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),i={};return Ht(r).sort(((e,t)=>{var[n]=e,[r]=t;return n.localeCompare(r)})).forEach((e=>{var[t,n]=e;return i[lr(t.toString())]=lr(n.toString())})),t+=`:`,t+=Ht(i).map((e=>{var[t,n]=e;return t+`="`+n+`"`})).join(``)})).join(`;`)}(function(e){return e.map((e=>{var t={text:e.$el_text?.slice(0,400),tag_name:e.tag_name,href:e.attr__href?.slice(0,2048),attr_class:ur(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Ht(e).filter((e=>{var[t]=e;return t.indexOf(`attr__`)===0})).forEach((e=>{var[n,r]=e;return t.attributes[n]=r})),t}))}(e))}function lr(e){return e.replace(/"|\\"/g,`\\"`)}function ur(e){var t=e.attr__class;return t?T(t)?t:Fn(t):void 0}var dr=class{constructor(e){this.disabled=!1===e;var 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,n){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&n-r.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}},fr=e=>{var t=o?.createElement(`a`);return k(t)?null:(t.href=e,t)},pr=function(e,t){var n,r;t===void 0&&(t=`&`);var i=[];return H(e,(function(e,t){k(e)||k(t)||t===`undefined`||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),i[i.length]=r+`=`+n)})),i.join(t)},mr=function(e,t){for(var n,r=((e.split(`#`)[0]||``).split(/\?(.*)/)[1]||``).replace(/^\?+/g,``).split(`&`),i=0;i<r.length;i++){var a=r[i].split(`=`);if(a[0]===t){n=a;break}}if(!T(n)||n.length<2)return``;var o=n[1];try{o=decodeURIComponent(o)}catch{B.error(`Skipping decoding for malformed query param: `+o)}return o.replace(/\+/g,` `)},hr=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split(`#`),i=r[0]||``,a=r[1],o=i.split(`?`),s=o[1],c=o[0],l=(s||``).split(`&`),u=[],d=0;d<l.length;d++){var f=l[d].split(`=`);T(f)&&(t.includes(f[0])?u.push(f[0]+`=`+n):u.push(l[d]))}var p=c;return s!=null&&(p+=`?`+u.join(`&`)),a!=null&&(p+=`#`+a),p},gr=function(e,t){var n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},_r=`$copy_autocapture`,vr=V(`[AutoCapture]`);function yr(e,t){return t.length>e?t.slice(0,e)+`...`:t}function br(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!jn(t));return t}function xr(e,t,n,r){var i=e.tagName.toLowerCase(),a={tag_name:i};Vn.indexOf(i)>-1&&!n&&(i.toLowerCase()===`a`||i.toLowerCase()===`button`?a.$el_text=yr(1024,or(e)):a.$el_text=yr(1024,zn(e)));var o=Ln(e);o.length>0&&(a.classes=o.filter((function(e){return e!==``}))),H(e.attributes,(function(n){var i;if((!Qn(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&(r==null||!r.includes(n.name))&&!t&&ar(n.value)&&(i=n.name,!A(i)||i.substring(0,10)!==`_ngcontent`&&i.substring(0,7)!==`_nghost`)){var o=n.value;n.name===`class`&&(o=Fn(o).join(` `)),a[`attr__`+n.name]=yr(1024,o)}}));for(var s=1,c=1,l=e;l=br(l);)s++,l.tagName===e.tagName&&c++;return a.nth_child=s,a.nth_of_type=c,a}function Sr(t,n){for(var r,{e:i,maskAllElementAttributes:a,maskAllText:o,elementAttributeIgnoreList:s,elementsChainAsString:c}=n,l=[t],u=t;u.parentNode&&!Mn(u,`body`);)Pn(u.parentNode)?(l.push(u.parentNode.host),u=u.parentNode.host):(l.push(u.parentNode),u=u.parentNode);var d,f=[],p={},m=!1,h=!1;if(H(l,(e=>{var t=Zn(e);e.tagName.toLowerCase()===`a`&&(m=e.getAttribute(`href`),m=t&&m&&ar(m)&&m),b(Ln(e),`ph-no-capture`)&&(h=!0),f.push(xr(e,a,o,s)),U(p,function(e){if(!Zn(e))return{};var t={};return H(e.attributes,(function(e){if(e.name&&e.name.indexOf(`data-ph-capture-attribute`)===0){var n=e.name.replace(`data-ph-capture-attribute-`,``),r=e.value;n&&r&&ar(r)&&(t[n]=r)}})),t}(e))})),h)return{props:{},explicitNoCapture:h};if(o||(t.tagName.toLowerCase()===`a`||t.tagName.toLowerCase()===`button`?f[0].$el_text=or(t):f[0].$el_text=zn(t)),m){var g;f[0].attr__href=m;var _=fr(m)?.host,v=e==null||(g=e.location)==null?void 0:g.host;_&&v&&_!==v&&(d=m)}return{props:U({$event_type:i.type,$ce_version:1},c?{}:{$elements:f},{$elements_chain:cr(f)},(r=f[0])!=null&&r.$el_text?{$el_text:f[0]?.$el_text}:{},d&&i.type===`click`?{$external_click_url:d}:{},p)}}var Cr=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new dr(e.config.rageclick),this.C=null}get R(){var e=D(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=e.url_allowlist?.map((e=>new RegExp(e))),e.url_ignorelist=e.url_ignorelist?.map((e=>new RegExp(e))),e}F(){if(this.isBrowserSupported()){if(e&&o){var t=t=>{t||=e?.event;try{this.O(t)}catch(e){vr.error(`Failed to capture event`,e)}};if(W(o,`submit`,t,{capture:!0}),W(o,`change`,t,{capture:!0}),W(o,`click`,t,{capture:!0}),this.R.capture_copied_text){var n=t=>{t||=e?.event,this.O(t,_r)};W(o,`copy`,n,{capture:!0}),W(o,`cut`,n,{capture:!0})}}}else vr.info(`Disabling Automatic Event Collection because this browser is not supported`)}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[$t]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,n=[];return(t=this.C)==null||t.forEach((t=>{(o?.querySelectorAll(t))?.forEach((r=>{e===r&&n.push(t)}))})),n}get isEnabled(){var e=this.instance.persistence?.props[$t],t=this.T;if(M(t)&&!F(e)&&!this.instance.M())return!1;var n=this.T??!!e;return!!this.instance.config.autocapture&&!n}O(t,n){if(n===void 0&&(n=`$autocapture`),this.isEnabled){var r,i=Bn(t);Nn(i)&&(i=i.parentNode||null),n===`$autocapture`&&t.type===`click`&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&qn(i,this.instance.config.rageclick)&&this.O(t,`$rageclick`);var a=n===_r;if(i&&Xn(i,t,this.R,a,a?[`copy`,`cut`]:void 0)){var{props:o,explicitNoCapture:s}=Sr(i,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(s)return!1;var c=this.getElementSelectors(i);if(c&&c.length>0&&(o.$element_selectors=c),n===_r){var l,u=Rn(e==null||(l=e.getSelection())==null?void 0:l.toString()),d=t.type||`clipboard`;if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(n,o),!0}}}isBrowserSupported(){return E(o?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return P(e)&&isFinite(e)&&Math.floor(e)===e});var wr=`0123456789abcdef`,Tr=class e{constructor(e){if(this.bytes=e,e.length!==16)throw TypeError(`not 128-bit length`)}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError(`invalid field value`);var a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}toString(){for(var e=``,t=0;t<this.bytes.length;t++)e=e+wr.charAt(this.bytes[t]>>>4)+wr.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+=`-`);if(e.length!==36)throw Error(`Invalid UUIDv7 was generated`);return e}clone(){return new e(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},Er=class{constructor(){this.A=0,this.j=0,this.D=new kr}generate(){var e=this.generateOrAbort();if(k(e)){this.A=0;var t=this.generateOrAbort();if(k(t))throw Error(`Could not generate UUID after timestamp reset`);return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.j++,this.j>4398046511103&&(this.A++,this.L())}return Tr.fromFieldsV7(this.A,Math.trunc(this.j/2**30),this.j&2**30-1,this.D.nextUint32())}L(){this.j=1024*this.D.nextUint32()+(1023&this.D.nextUint32())}},Dr,Or=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<`u`&&UUIDV7_DENY_WEAK_RNG)throw Error(`no cryptographically strong RNG available`);for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!k(e.crypto)&&crypto.getRandomValues&&(Or=e=>crypto.getRandomValues(e));var kr=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Or(this.N),this.U=0),this.N[this.U++]}},Ar=()=>jr().toString(),jr=()=>(Dr||=new Er).generate(),Mr=``,Nr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Pr(e,t){if(t){var n=function(e,t){if(t===void 0&&(t=o),Mr)return Mr;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;for(var n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+Ar();!Mr&&r--;){var a=n.slice(r).join(`.`),s=i+`=1;domain=.`+a+`;path=/`;t.cookie=s+`;max-age=3`,t.cookie.includes(i)&&(t.cookie=s+`;max-age=0`,Mr=a)}return Mr}(e);if(!n){var r=(e=>{var t=e.match(Nr);return t?t[0]:``})(e);r!==n&&B.info(`Warning: cookie subdomain discovery mismatch`,r,n),n=r}return n?`; domain=.`+n:``}return``}var G={H:()=>!!o,B:function(e){B.error(`cookieStore error: `+e)},q:function(e){if(o){try{for(var t=e+`=`,n=o.cookie.split(`;`).filter((e=>e.length)),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==` `;)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},W:function(e){var t;try{t=JSON.parse(G.q(e))||{}}catch{}return t},G:function(e,t,n,r,i){if(o)try{var a=``,s=``,c=Pr(o.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),a=`; expires=`+l.toUTCString()}i&&(s=`; secure`);var u=e+`=`+encodeURIComponent(JSON.stringify(t))+a+`; SameSite=Lax; path=/`+c+s;return u.length>3686.4&&B.warn(`cookieStore warning: large cookie, len=`+u.length),o.cookie=u,u}catch{return}},V:function(e,t){if(o!=null&&o.cookie)try{G.G(e,``,-1,t)}catch{return}}},Fr=null,K={H:function(){if(!M(Fr))return Fr;var t=!0;if(k(e))t=!1;else try{var n=`__mplssupport__`;K.G(n,`xyz`),K.q(n)!==`"xyz"`&&(t=!1),K.V(n)}catch{t=!1}return t||B.error(`localStorage unsupported; falling back to cookie store`),Fr=t,t},B:function(e){B.error(`localStorage error: `+e)},q:function(t){try{return e?.localStorage.getItem(t)}catch(e){K.B(e)}return null},W:function(e){try{return JSON.parse(K.q(e))||{}}catch{}return null},G:function(t,n){try{e?.localStorage.setItem(t,JSON.stringify(n))}catch(e){K.B(e)}},V:function(t){try{e?.localStorage.removeItem(t)}catch(e){K.B(e)}}},Ir=[`$device_id`,`distinct_id`,un,dn,En,Tn],Lr={},Rr={H:function(){return!0},B:function(e){B.error(`memoryStorage error: `+e)},q:function(e){return Lr[e]||null},W:function(e){return Lr[e]||null},G:function(e,t){Lr[e]=t},V:function(e){delete Lr[e]}},zr=null,q={H:function(){if(!M(zr))return zr;if(zr=!0,k(e))zr=!1;else try{var t=`__support__`;q.G(t,`xyz`),q.q(t)!==`"xyz"`&&(zr=!1),q.V(t)}catch{zr=!1}return zr},B:function(e){B.error(`sessionStorage error: `,e)},q:function(t){try{return e?.sessionStorage.getItem(t)}catch(e){q.B(e)}return null},W:function(e){try{return JSON.parse(q.q(e))||null}catch{}return null},G:function(t,n){try{e?.sessionStorage.setItem(t,JSON.stringify(n))}catch(e){q.B(e)}},V:function(t){try{e?.sessionStorage.removeItem(t)}catch(e){q.B(e)}}},Br=function(e){return e[e.PENDING=-1]=`PENDING`,e[e.DENIED=0]=`DENIED`,e[e.GRANTED=1]=`GRANTED`,e}({}),Vr=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Br.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode===`always`||this.consent===Br.DENIED||this.consent===Br.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode===`on_reject`)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Br.DENIED}optInOut(e){this.Y.G(this.X,+!!e,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:n}=this._instance.config;return n||(t?t+e:`__ph_opt_in_out_`+e)}get K(){var e=this.Y.q(this.X);return le(e)?Br.GRANTED:b(ue,e)?Br.DENIED:Br.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e===`localStorage`?K:G;var t=e===`localStorage`?G:K;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(le(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!Yt([a?.doNotTrack,a?.msDoNotTrack,f.doNotTrack],(e=>le(e)))}},Hr=V(`[Dead Clicks]`),Ur=()=>!0,Wr=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(on)),r=e.instance.config.capture_dead_clicks;return F(r)?r:!!D(r)||n},Gr=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){`captureDeadClicks`in e&&(this.instance.persistence&&this.instance.persistence.register({[on]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.it((()=>{this.et()})):this.stop()}it(e){var t,n;(t=f.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,`dead-clicks-autocapture`,(t=>{t?Hr.error(`failed to load script`,t):e()}))}et(){var e;if(o){if(!this.tt&&(e=f.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=D(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=f.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(o),Hr.info(`starting...`)}}else Hr.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Hr.info(`stopping...`))}},Kr=V(`[ExceptionAutocapture]`),qr=class{constructor(t){var n;this.rt=()=>{var t;if(e&&this.isEnabled&&(t=f.__PosthogExtensions__)!=null&&t.errorWrappingFunctions){var n=f.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=f.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=f.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=n(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=r(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=i(this.captureException.bind(this)))}catch(e){Kr.error(`failed to start`,e),this.ut()}}},this._instance=t,this.ht=!((n=this._instance.persistence)==null||!n.props[tn]),this.dt=new de({refillRate:this._instance.config.error_tracking.__exceptionRateLimiterRefillRate??1,bucketSize:this._instance.config.error_tracking.__exceptionRateLimiterBucketSize??10,refillInterval:1e4,h:Kr}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return D(e)?t=g({},t,e):(k(e)?this.ht:e)&&(t=g({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Kr.info(`enabled`),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;(t=f.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`exception-autocapture`,(t=>{if(t)return Kr.error(`failed to load script`,t);e()}))}ut(){var e,t,n;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(n=this.ot)==null||n.call(this),this.ot=void 0}onRemoteConfig(e){`autocaptureExceptions`in e&&(this.ht=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[tn]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop())}onConfigChange(){this.R=this.vt()}captureException(e){var t,n=(e==null||(t=e.$exception_list)==null||(t=t[0])==null?void 0:t.type)??`Exception`;this.dt.consumeRateLimit(n)?Kr.info(`Skipping exception capture because of client rate limiting.`,{exception:n}):this._instance.exceptions.sendExceptionEvent(e)}};function Jr(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],i=n(r);return E(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var Yr=class{constructor(t){var n;this._instance=t,this.ct=(e==null||(n=e.location)==null?void 0:n.pathname)||``}get isEnabled(){return this._instance.config.capture_pageview===`history_change`}startIfEnabled(){this.isEnabled&&(B.info(`History API monitoring enabled, starting...`),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,B.info(`History API monitoring stopped`)}monitorHistoryChanges(){var t,n;if(e&&e.history){var r=this;(t=e.history.pushState)!=null&&t.__posthog_wrapped__||Jr(e.history,`pushState`,(e=>function(t,n,i){e.call(this,t,n,i),r._t(`pushState`)})),(n=e.history.replaceState)!=null&&n.__posthog_wrapped__||Jr(e.history,`replaceState`,(e=>function(t,n,i){e.call(this,t,n,i),r._t(`replaceState`)})),this.bt()}}_t(t){try{var n,r=e==null||(n=e.location)==null?void 0:n.pathname;if(!r)return;r!==this.ct&&this.isEnabled&&this._instance.capture(`$pageview`,{navigation_type:t}),this.ct=r}catch(e){B.error(`Error capturing `+t+` pageview`,e)}}bt(){if(!this.ft){var t=()=>{this._t(`popstate`)};W(e,`popstate`,t),this.ft=()=>{e&&e.removeEventListener(`popstate`,t)}}}},Xr=V(`[SegmentIntegration]`);function Zr(e,t){var n=e.config.segment;if(!n)return t();(function(e,t){var n=e.config.segment;if(!n)return t();var r=n=>{var r=()=>n.anonymousId()||Ar();e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(bn,`identified`)),t()},i=n.user();`then`in i&&E(i.then)?i.then(r):r(i)})(e,(()=>{n.register((e=>{Promise&&Promise.resolve||Xr.warn(`This browser does not have Promise support, and can not use the segment integration`);var t=(t,n)=>{if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Xr.info(`No userId set, resetting PostHog`),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Xr.info(`UserId set, identifying with PostHog`),e.identify(t.event.userId));var r=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:`PostHog JS`,type:`enrichment`,version:`1.0.0`,isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,`$pageview`),identify:e=>t(e,`$identify`),screen:e=>t(e,`$screen`)}})(e)).then((()=>{t()}))}))}var Qr=`posthog-js`;function $r(e,t){var{organization:n,projectId:r,prefix:i,severityAllowList:a=[`error`],sendExceptionsToPostHog:o=!0}=t===void 0?{}:t;return t=>{if(!(a===`*`||a.includes(t.level))||!e.__loaded)return t;t.tags||={};var s=e.requestRouter.endpointFor(`ui`,`/project/`+e.config.token+`/person/`+e.get_distinct_id());t.tags[`PostHog Person URL`]=s,e.sessionRecordingStarted()&&(t.tags[`PostHog Recording URL`]=e.get_session_replay_url({withTimestamp:!0}));var c=t.exception?.values||[],l=c.map((e=>g({},e,{stacktrace:e.stacktrace?g({},e.stacktrace,{type:`raw`,frames:(e.stacktrace.frames||[]).map((e=>g({},e,{platform:`web:javascript`})))}):void 0}))),u={$exception_message:c[0]?.value||t.message,$exception_type:c[0]?.type,$exception_level:t.level,$exception_list:l,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:c[0]?.value||t.message,$sentry_exception_type:c[0]?.type,$sentry_tags:t.tags};return n&&r&&(u.$sentry_url=(i||`https://sentry.io/organizations/`)+n+`/issues/?project=`+r+`&query=`+t.event_id),o&&e.exceptions.sendExceptionEvent(u),t}}var ei=class{constructor(e,t,n,r,i,a){this.name=Qr,this.setupOnce=function(o){o($r(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},ti=e!=null&&e.location?gr(e.location.hash,`__posthog`)||gr(location.hash,`state`):null,ni=`_postHogToolbarParams`,ri=V(`[Toolbar]`),ii=function(e){return e[e.UNINITIALIZED=0]=`UNINITIALIZED`,e[e.LOADING=1]=`LOADING`,e[e.LOADED=2]=`LOADED`,e}(ii||{}),ai=class{constructor(e){this.instance=e}yt(e){f.ph_toolbar_state=e}wt(){return f.ph_toolbar_state??ii.UNINITIALIZED}maybeLoadToolbar(t,n,r){if(t===void 0&&(t=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),this.instance.config.name&&this.instance.config.name===`ph_toolbar_internal`||!e||!o)return!1;t??=e.location,r??=e.history;try{if(!n){try{e.localStorage.setItem(`test`,`test`),e.localStorage.removeItem(`test`)}catch{return!1}n=e?.localStorage}var i,a=ti||gr(t.hash,`__posthog`)||gr(t.hash,`state`),s=a?Ut((()=>JSON.parse(atob(decodeURIComponent(a)))))||Ut((()=>JSON.parse(decodeURIComponent(a)))):null;return s&&s.action===`ph_authorize`?((i=s).source=`url`,i&&Object.keys(i).length>0&&(s.desiredHash?t.hash=s.desiredHash:r?r.replaceState(r.state,``,t.pathname+t.search):t.hash=``)):((i=JSON.parse(n.getItem(ni)||`{}`)).source=`localstorage`,delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}xt(e){var t=f.ph_load_toolbar||f.ph_load_editor;!N(t)&&E(t)?t(e,this.instance):ri.warn(`No toolbar load function found`)}loadToolbar(t){var n=!(o==null||!o.getElementById(Dn));if(!e||n)return!1;var r=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,i=g({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor(`ui`)},r?{instrument:!1}:{});if(e.localStorage.setItem(ni,JSON.stringify(g({},i,{source:void 0}))),this.wt()===ii.LOADED)this.xt(i);else if(this.wt()===ii.UNINITIALIZED){var a;this.yt(ii.LOADING),(a=f.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,`toolbar`,(e=>{if(e)return ri.error(`[Toolbar] Failed to load`,e),void this.yt(ii.UNINITIALIZED);this.yt(ii.LOADED),this.xt(i)})),W(e,`turbolinks:load`,(()=>{this.yt(ii.UNINITIALIZED),this.loadToolbar(i)}))}return!0}$t(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}},oi=V(`[TracingHeaders]`),si=class{constructor(e){this.Et=void 0,this.St=void 0,this.rt=()=>{var e,t;k(this.Et)&&((e=f.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),k(this.St)&&((t=f.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,n;(t=f.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`tracing-headers`,(t=>{if(t)return oi.error(`failed to load script`,t);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.Et)==null||e.call(this),(t=this.St)==null||t.call(this),this.Et=void 0,this.St=void 0)}},ci=`https?://(.*)`,li=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],ui=Vt([`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`],li),di=`<masked>`,fi=[`li_fat_id`];function pi(e,t,n){if(!o)return{};var r,i=t?Vt([],li,n||[]):[],a=mi(hr(o.URL,i,di),e);return U((r={},H(fi,(function(e){var t=G.q(e);r[e]=t||null})),r),a)}function mi(e,t){var n=ui.concat(t||[]),r={};return H(n,(function(t){r[t]=mr(e,t)||null})),r}function hi(e){var t=function(e){return e?e.search(ci+`google.([^/?]*)`)===0?`google`:e.search(ci+`bing.com`)===0?`bing`:e.search(ci+`yahoo.com`)===0?`yahoo`:e.search(ci+`duckduckgo.com`)===0?`duckduckgo`:null:null}(e),n=t==`yahoo`?`p`:`q`,r={};if(!M(t)){r.$search_engine=t;var i=o?mr(o.referrer,n):``;i.length&&(r.ph_keyword=i)}return r}function gi(){return navigator.language||navigator.userLanguage}function _i(){return o?.referrer||`$direct`}function vi(e,t){var n=e?Vt([],li,t||[]):[],r=s?.href.substring(0,1e3);return{r:_i().substring(0,1e3),u:r?hr(r,n,di):void 0}}function yi(e){var{r:t,u:n}=e,r={$referrer:t,$referring_domain:t==null?void 0:t==`$direct`?`$direct`:fr(t)?.host};if(n){r.$current_url=n;var i=fr(n);r.$host=i?.host,r.$pathname=i?.pathname,U(r,mi(n))}return t&&U(r,hi(t)),r}function bi(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function xi(){try{return new Date().getTimezoneOffset()}catch{return}}function Si(t,n){if(!d)return{};var r,i,a,o=t?Vt([],li,n||[]):[],[c,l]=function(e){for(var t=0;t<st.length;t++){var[n,r]=st[t],i=n.exec(e),a=i&&(E(r)?r(i,e):r);if(a)return a}return[``,``]}(d);return U(Gt({$os:c,$os_version:l,$browser:it(d,navigator.vendor),$device:ct(d),$device_type:(i=d,a=ct(i),a===ge||a===he||a===`Kobo`||a===`Kindle Fire`||a===Ke?me:a===Fe||a===Le||a===Ie||a===Ue?`Console`:a===ve?`Wearable`:a?R:`Desktop`),$timezone:bi(),$timezone_offset:xi()}),{$current_url:hr(s?.href,o,di),$host:s?.host,$pathname:s?.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+`...`:d,$browser_version:ot(d,navigator.vendor),$browser_language:gi(),$browser_language_prefix:(r=gi(),typeof r==`string`?r.split(`-`)[0]:void 0),$screen_height:e?.screen.height,$screen_width:e?.screen.width,$viewport_height:e?.innerHeight,$viewport_width:e?.innerWidth,$lib:`web`,$lib_version:p.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Ci=V(`[Web Vitals]`),wi=9e5,Ti=class{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),this.N.metrics.length!==0&&(this._instance.capture(`$web_vitals`,this.N.metrics.reduce(((e,t)=>g({},e,{[`$web_vitals_`+t.name+`_event`]:g({},t),[`$web_vitals_`+t.name+`_value`]:t.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=e=>{var t=this._instance.sessionManager?.checkAndGetSessionAndWindowId(!0);if(k(t))Ci.error(`Could not read session ID. Dropping metrics!`);else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.Ct();k(n)||(N(e?.name)||N(e?.value)?Ci.error(`Invalid metric received`,e):this.Rt&&e.value>=this.Rt?Ci.error(`Ignoring metric with value >= `+this.Rt,e):(this.N.url!==n&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),k(this.N.url)&&(this.N.url=n),this.N.firstMetricTimestamp=k(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.N.metrics.push(g({},e,{$current_url:n,$session_id:t.sessionId,$window_id:t.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{if(!this.P){var e,t,n,r,i=f.__PosthogExtensions__;k(i)||k(i.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:n,onINP:r}=i.postHogWebVitalsCallbacks),e&&t&&n&&r?(this.allowedMetrics.indexOf(`LCP`)>-1&&e(this.It.bind(this)),this.allowedMetrics.indexOf(`CLS`)>-1&&t(this.It.bind(this)),this.allowedMetrics.indexOf(`FCP`)>-1&&n(this.It.bind(this)),this.allowedMetrics.indexOf(`INP`)>-1&&r(this.It.bind(this)),this.P=!0):Ci.error(`web vitals callbacks not loaded - not starting`)}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[an]),this.startIfEnabled()}get allowedMetrics(){var e=D(this._instance.config.capture_performance)?this._instance.config.capture_performance?.web_vitals_allowed_metrics:void 0;return N(e)?this._instance.persistence?.props[cn]||[`CLS`,`FCP`,`INP`,`LCP`]:e}get flushToCaptureTimeoutMs(){return(D(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=D(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=D(this._instance.config.capture_performance)&&P(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:wi;return 0<e&&e<=6e4?wi:e}get isEnabled(){var e=s?.protocol;if(e!==`http:`&&e!==`https:`)return Ci.info(`Web Vitals are disabled on non-http/https protocols`),!1;var t=D(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:F(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return F(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Ci.info(`enabled, starting...`),this.it(this.rt))}onRemoteConfig(e){if(`capturePerformance`in e){var t=D(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=D(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[an]:t}),this._instance.persistence.register({[cn]:n})),this.kt=t,this.startIfEnabled()}}it(e){var t,n;if((t=f.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var r=this.useAttribution?`web-vitals-with-attribution`:`web-vitals`;(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,r,(t=>{t?Ci.error(`failed to load script`,t):e()}))}}Ct(){var t=e?e.location.href:void 0;if(t){var n=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties;return hr(t,n?Vt([],li,r||[]):[],di)}Ci.error(`Could not determine current URL`)}},Ei=V(`[Heatmaps]`);function Di(e){return D(e)&&`clientX`in e&&`clientY`in e&&P(e.clientX)&&P(e.clientY)}var Oi=class{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!((t=this.instance.persistence)==null||!t.props[en]),this.rageclicks=new dr(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return D(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return N(this.instance.config.capture_heatmaps)?N(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;Ei.info(`starting...`),this.Ot(),this.Mt()}else clearInterval(this.Ft??void 0),this.At(),this.getAndClearBuffer()}onRemoteConfig(e){if(`heatmaps`in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[en]:t}),this.kt=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}jt(e){this.Dt(e.originalEvent,`deadclick`)}Mt(){this.Ft&&clearInterval(this.Ft),this.Ft=function(e){return e?.visibilityState===`visible`}(o)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){e&&o&&(this.Nt=this.Lt.bind(this),W(e,`beforeunload`,this.Nt),this.Ut=t=>this.Dt(t||e?.event),W(o,`click`,this.Ut,{capture:!0}),this.zt=t=>this.Ht(t||e?.event),W(o,`mousemove`,this.zt,{capture:!0}),this.Bt=new Gr(this.instance,Ur,this.jt.bind(this)),this.Bt.startIfEnabledOrStop(),this.qt=this.Mt.bind(this),W(o,`visibilitychange`,this.qt),this.P=!0)}At(){var t;e&&o&&(this.Nt&&e.removeEventListener(`beforeunload`,this.Nt),this.Ut&&o.removeEventListener(`click`,this.Ut,{capture:!0}),this.zt&&o.removeEventListener(`mousemove`,this.zt,{capture:!0}),this.qt&&o.removeEventListener(`visibilitychange`,this.qt),clearTimeout(this.Wt),(t=this.Bt)==null||t.stop(),this.P=!1)}Gt(t,n){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=function(t,n,r){for(var i=t;i&&jn(i)&&!Mn(i,`body`);){if(i===r)return!1;if(b(n,e?.getComputedStyle(i).position))return!0;i=Un(i)}return!1}(Bn(t),[`fixed`,`sticky`],a);return{x:t.clientX+(o?0:i),y:t.clientY+(o?0:r),target_fixed:o,type:n}}Dt(e,t){var n;if(t===void 0&&(t=`click`),!An(e.target)&&Di(e)){var r=this.Gt(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(g({},r,{type:`rageclick`})),this.Vt(r)}}Ht(e){!An(e.target)&&Di(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(e,`mousemove`))}),500))}Vt(t){if(e){var n=e.location.href,r=this.instance.config.mask_personal_data_properties,i=this.instance.config.custom_personal_data_properties,a=hr(n,r?Vt([],li,i||[]):[],di);this.N=this.N||{},this.N[a]||(this.N[a]=[]),this.N[a].push(t)}}Lt(){this.N&&!O(this.N)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},ki=class{constructor(e){this.Jt=(e,t,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength)&&(B.info(`[PageViewManager] Session rotated, clearing pageview state`,{sessionId:e,changeReason:n}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){this.Xt=this._instance.sessionManager?.onSessionId(this.Jt)}destroy(){var e;(e=this.Xt)==null||e.call(this),this.Xt=void 0}doPageView(t,n){var r=this.Qt(t,n);return this.Kt={pathname:e?.location.pathname??``,pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(e){return this.Qt(e,this.Kt?.pageViewId)}doEvent(){return{$pageview_id:this.Kt?.pageViewId}}Qt(e,t){var n=this.Kt;if(!n)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:s,maxContentHeight:c,lastContentY:l,maxContentY:u}=i;if(!(k(a)||k(o)||k(s)||k(c)||k(l)||k(u))){a=Math.ceil(a),o=Math.ceil(o),s=Math.ceil(s),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u);var d=a<=1?1:L(o/a,0,1,B),f=a<=1?1:L(s/a,0,1,B),p=c<=1?1:L(l/c,0,1,B),m=c<=1?1:L(u/c,0,1,B);r=U(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:s,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:m})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}},Ai=[`fatal`,`error`,`warning`,`log`,`info`,`debug`],J=function(e){return e.GZipJS=`gzip-js`,e.Base64=`base64`,e}({}),Y=Uint8Array,X=Uint16Array,ji=Uint32Array,Mi=new Y([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]),Ni=new Y([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]),Pi=new Y([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fi=function(e,t){for(var n=new X(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new ji(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},Ii=Fi(Mi,2),Li=Ii[0],Ri=Ii[1];Li[28]=258,Ri[258]=28;for(var zi=Fi(Ni,0)[1],Bi=new X(32768),Z=0;Z<32768;++Z){var Vi=(43690&Z)>>>1|(21845&Z)<<1;Vi=(61680&(Vi=(52428&Vi)>>>2|(13107&Vi)<<2))>>>4|(3855&Vi)<<4,Bi[Z]=((65280&Vi)>>>8|(255&Vi)<<8)>>>1}var Hi=function(e,t,n){for(var r=e.length,i=0,a=new X(t);i<r;++i)++a[e[i]-1];var o,s=new X(t);for(i=0;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new X(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)o[Bi[d]>>>c]=l}else for(o=new X(r),i=0;i<r;++i)o[i]=Bi[s[e[i]-1]++]>>>15-e[i];return o},Ui=new Y(288);for(Z=0;Z<144;++Z)Ui[Z]=8;for(Z=144;Z<256;++Z)Ui[Z]=9;for(Z=256;Z<280;++Z)Ui[Z]=7;for(Z=280;Z<288;++Z)Ui[Z]=8;var Wi=new Y(32);for(Z=0;Z<32;++Z)Wi[Z]=5;var Gi=Hi(Ui,9,0),Ki=Hi(Wi,5,0),qi=function(e){return(e/8>>0)+(7&e&&1)},Ji=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof X?X:e instanceof ji?ji:Y)(n-t);return r.set(e.subarray(t,n)),r},Yi=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},Xi=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Zi=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[new Y(0),0];if(i==1){var o=new Y(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};var f=a[0].s;for(r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new X(f+1),m=Qi(n[u-1],p,0);if(m>t){r=0;var h=0,g=m-t,_=1<<g;for(a.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<i;++r){var v=a[r].s;if(!(p[v]>t))break;h+=_-(1<<m-p[v]),p[v]=t}for(h>>>=g;h>0;){var ee=a[r].s;p[ee]<t?h-=1<<t-p[ee]++-1:++r}for(;r>=0&&h;--r){var y=a[r].s;p[y]==t&&(--p[y],++h)}m=t}return[new Y(p),m]},Qi=function(e,t,n){return e.s==-1?Math.max(Qi(e.l,t,n+1),Qi(e.r,t,n+1)):t[e.s]=n},$i=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new X(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[n.subarray(0,r),t]},ea=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},ta=function(e,t,n){var r=n.length,i=qi(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<r;++a)e[i+a+4]=n[a];return 8*(i+4+r)},na=function(e,t,n,r,i,a,o,s,c,l,u){Yi(t,u++,n),++i[256];for(var d=Zi(i,15),f=d[0],p=d[1],m=Zi(a,15),h=m[0],g=m[1],_=$i(f),v=_[0],ee=_[1],y=$i(h),b=y[0],x=y[1],S=new X(19),C=0;C<v.length;++C)S[31&v[C]]++;for(C=0;C<b.length;++C)S[31&b[C]]++;for(var te=Zi(S,7),w=te[0],ne=te[1],T=19;T>4&&!w[Pi[T-1]];--T);var E,D,O,k,A=l+5<<3,j=ea(i,Ui)+ea(a,Wi)+o,M=ea(i,f)+ea(a,h)+o+14+3*T+ea(S,w)+(2*S[16]+3*S[17]+7*S[18]);if(A<=j&&A<=M)return ta(t,u,e.subarray(c,c+l));if(Yi(t,u,1+(M<j)),u+=2,M<j){E=Hi(f,p,0),D=f,O=Hi(h,g,0),k=h;var N=Hi(w,ne,0);for(Yi(t,u,ee-257),Yi(t,u+5,x-1),Yi(t,u+10,T-4),u+=14,C=0;C<T;++C)Yi(t,u+3*C,w[Pi[C]]);u+=3*T;for(var P=[v,b],re=0;re<2;++re){var F=P[re];for(C=0;C<F.length;++C){var ie=31&F[C];Yi(t,u,N[ie]),u+=w[ie],ie>15&&(Yi(t,u,F[C]>>>5&127),u+=F[C]>>>12)}}}else E=Gi,D=Ui,O=Ki,k=Wi;for(C=0;C<s;++C)if(r[C]>255){ie=r[C]>>>18&31,Xi(t,u,E[ie+257]),u+=D[ie+257],ie>7&&(Yi(t,u,r[C]>>>23&31),u+=Mi[ie]);var I=31&r[C];Xi(t,u,O[I]),u+=k[I],I>3&&(Xi(t,u,r[C]>>>5&8191),u+=Ni[I])}else Xi(t,u,E[r[C]]),u+=D[r[C]];return Xi(t,u,E[256]),u+D[256]},ra=new ji([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ia=function(){for(var e=new ji(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),aa=function(e,t,n,r,i){return function(e,t,n,r,i,a){var o=e.length,s=new Y(r+o+5*(1+Math.floor(o/7e3))+i),c=s.subarray(r,s.length-i),l=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?l=ta(c,l,e.subarray(u,d)):(c[u]=a,l=ta(c,l,e.subarray(u,o)))}else{for(var f=ra[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new X(32768),_=new X(h+1),v=Math.ceil(n/3),ee=2*v,y=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<ee)&h},b=new ji(25e3),x=new X(288),S=new X(32),C=0,te=0,w=(u=0,0),ne=0,T=0;u<o;++u){var E=y(u),D=32767&u,O=_[E];if(g[D]=O,_[E]=D,ne<=u){var k=o-u;if((C>7e3||w>24576)&&k>423){l=na(e,c,0,b,x,S,te,w,T,u-T,l),w=C=te=0,T=u;for(var A=0;A<286;++A)x[A]=0;for(A=0;A<30;++A)S[A]=0}var j=2,M=0,N=m,P=D-O&32767;if(k>2&&E==y(u-P))for(var re=Math.min(p,k)-1,F=Math.min(32767,u),ie=Math.min(258,k);P<=F&&--N&&D!=O;){if(e[u+j]==e[u+j-P]){for(var I=0;I<ie&&e[u+I]==e[u+I-P];++I);if(I>j){if(j=I,M=P,I>re)break;var ae=Math.min(P,I-2),oe=0;for(A=0;A<ae;++A){var se=u-P+A+32768&32767,ce=se-g[se]+32768&32767;ce>oe&&(oe=ce,O=se)}}}P+=(D=O)-(O=g[D])+32768&32767}if(M){b[w++]=268435456|Ri[j]<<18|zi[M];var le=31&Ri[j],ue=31&zi[M];te+=Mi[le]+Ni[ue],++x[257+le],++S[ue],ne=u+j,++C}else b[w++]=e[u],++x[e[u]]}}l=na(e,c,a,b,x,S,te,w,T,u-T,l)}return Ji(s,0,r+qi(l)+i)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!0)},oa=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function sa(e,t){t===void 0&&(t={});var n=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=ia[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,a=aa(e,t,10+((i=t).filename&&i.filename.length+1||0),8),o=a.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&oa(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}}(a,t),oa(a,o-8,n.d()),oa(a,o-4,r),a}var ca=function(e){var t,n,r,i,a=``;for(t=n=0,r=(e=(e+``).replace(/\r\n/g,`
3
3
  `).replace(/\r/g,`
4
- `)).length,i=0;i<r;i++){var o=e.charCodeAt(i),s=null;o<128?n++:s=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),M(s)||(n>t&&(a+=e.substring(t,n)),a+=s,t=n=i+1)}return n>t&&(a+=e.substring(t,e.length)),a},la=!!l||!!c,ua=`text/plain`,da=function(e,t,n){n===void 0&&(n=!0);var[r,i]=e.split(`?`),a=g({},t),o=i?.split(`&`).map((e=>{var t,[r,i]=e.split(`=`),o=n&&(t=a[r])!=null?t:i;return delete a[r],r+`=`+o}))??[],s=pr(a);return s&&o.push(s),r+`?`+o.join(`&`)},fa=(e,t)=>JSON.stringify(e,((e,t)=>typeof t==`bigint`?t.toString():t),t),pa=e=>{var{data:t,compression:n}=e;if(t){if(n===J.GZipJS){var r=sa(function(e,t){var n=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var r=new Y(e.length+(e.length>>>1)),i=0,a=function(e){r[i++]=e},o=0;o<n;++o){if(i+5>r.length){var s=new Y(i+8+(n-o<<1));s.set(r),r=s}var c=e.charCodeAt(o);c<128||t?a(c):c<2048?(a(192|c>>>6),a(128|63&c)):c>55295&&c<57344?(a(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),a(128|c>>>12&63),a(128|c>>>6&63),a(128|63&c)):(a(224|c>>>12),a(128|c>>>6&63),a(128|63&c))}return Ji(r,0,i)}(fa(t)),{mtime:0}),i=new Blob([r],{type:ua});return{contentType:ua,body:i,estimatedSize:i.size}}if(n===J.Base64){var a=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:fa(e)))(function(e){var t,n,r,i,a,o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,s=0,c=0,l=``,u=[];if(!e)return e;e=ca(e);do t=(a=e.charCodeAt(s++)<<16|e.charCodeAt(s++)<<8|e.charCodeAt(s++))>>18&63,n=a>>12&63,r=a>>6&63,i=63&a,u[c++]=o.charAt(t)+o.charAt(n)+o.charAt(r)+o.charAt(i);while(s<e.length);switch(l=u.join(``),e.length%3){case 1:l=l.slice(0,-2)+`==`;break;case 2:l=l.slice(0,-1)+`=`}return l}(fa(t)));return{contentType:`application/x-www-form-urlencoded`,body:a,estimatedSize:new Blob([a]).size}}var o=fa(t);return{contentType:`application/json`,body:o,estimatedSize:new Blob([o]).size}}},ma=[];c&&ma.push({transport:`fetch`,method:e=>{var{contentType:t,body:n,estimatedSize:r}=pa(e)??{},i=new Headers;H(e.headers,(function(e,t){i.append(t,e)})),t&&i.append(`Content-Type`,t);var a=e.url,o=null;if(u){var s=new u;o={signal:s.signal,timeout:setTimeout((()=>s.abort()),e.timeout)}}c(a,g({method:e?.method||`GET`,headers:i,keepalive:e.method===`POST`&&(r||0)<52428.8,body:n,signal:o?.signal},e.fetchOptions)).then((t=>t.text().then((n=>{var r={statusCode:t.status,text:n};if(t.status===200)try{r.json=JSON.parse(n)}catch(e){B.error(e)}e.callback==null||e.callback(r)})))).catch((t=>{B.error(t),e.callback==null||e.callback({statusCode:0,error:t})})).finally((()=>o?clearTimeout(o.timeout):null))}}),l&&ma.push({transport:`XHR`,method:e=>{var t=new l;t.open(e.method||`GET`,e.url,!0);var{contentType:n,body:r}=pa(e)??{};H(e.headers,(function(e,n){t.setRequestHeader(n,e)})),n&&t.setRequestHeader(`Content-Type`,n),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}e.callback==null||e.callback(n)}},t.send(r)}}),a!=null&&a.sendBeacon&&ma.push({transport:`sendBeacon`,method:e=>{var t=da(e.url,{beacon:`1`});try{var{contentType:n,body:r}=pa(e)??{},i=typeof r==`string`?new Blob([r],{type:n}):r;a.sendBeacon(t,i)}catch{}}});var ha=function(e,t){if(!function(e){try{new RegExp(e)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function ga(e,t,n){return fa({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var _a={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>ha(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!ha(t,e))))),icontains:(e,t)=>t.map(va).some((t=>e.map(va).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(va).every((t=>e.map(va).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n<parseFloat(e)))}))},va=e=>e.toLowerCase();function ya(e,t){return!e||Object.entries(e).every((e=>{var[n,r]=e,i=t?.[n];if(k(i)||M(i))return!1;var a=[String(i)],o=_a[r.operator];return!!o&&o(r.values,a)}))}var ba=V(`[Error tracking]`),xa=class{constructor(e){this.Zt=[],this.ti=new dt([new Tt,new Ft,new Dt,new Et,new Nt,new Mt,new kt,new Pt],wt()),this._instance=e,this.Zt=this._instance.persistence?.get_property(nn)??[]}onRemoteConfig(e){if(`errorTracking`in e){var t=e.errorTracking?.suppressionRules??[],n=e.errorTracking?.captureExtensionExceptions;this.Zt=t,this._instance.persistence&&this._instance.persistence.register({[nn]:this.Zt,[rn]:n})}}get ii(){var e,t=!!this._instance.get_property(rn);return(e=this._instance.config.error_tracking.captureExtensionExceptions??t)!=null&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void ba.info(`Skipping exception capture because a suppression rule matched`);if(!this.ii&&this.si(t))return void ba.info(`Skipping exception capture because it was thrown by an extension`);if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void ba.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}return this._instance.capture(`$exception`,e,{_noTruncate:!0,_batchKey:`exceptionEvent`,oi:!0})}ri(e){if(e.length===0)return!1;var t=e.reduce(((e,t)=>{var{type:n,value:r}=t;return A(n)&&n.length>0&&e.$exception_types.push(n),A(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this.Zt.some((e=>{var n=e.values.map((e=>{var n=_a[e.operator],r=T(e.value)?e.value:[e.value],i=t[e.key]??[];return r.length>0&&n(r,i)}));return e.type===`OR`?n.some(Boolean):n.every(Boolean)}))}si(e){return e.flatMap((e=>e.stacktrace?.frames??[])).some((e=>e.filename&&e.filename.startsWith(`chrome-extension://`)))}ni(e){if(e.length>0){var t,n,r=e[0].stacktrace?.frames??[],i=r[r.length-1];return(t=i==null||(n=i.filename)==null?void 0:n.includes(`posthog.com/static`))!=null&&t}return!1}ei(e){return!N(e)&&T(e)}},Q=V(`[FeatureFlags]`),Sa=V(`[FeatureFlags]`,{debugEnabled:!0}),Ca=`errors_while_computing_flags`,wa=`flag_missing`,Ta=`quota_limited`,Ea=`timeout`,Da=`connection_error`,Oa=`unknown_error`,ka=e=>`api_error_`+e,Aa=`$active_feature_flags`,ja=`$override_feature_flags`,Ma=`$feature_flag_payloads`,Na=`$override_feature_flag_payloads`,Pa=`$feature_flag_request_id`,Fa=`$feature_flag_evaluated_at`,Ia=e=>{var t={};for(var[n,r]of Ht(e||{}))r&&(t[n]=r);return t},La=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>[e,t[e].variant??t[e].enabled]))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>t[e].metadata?.payload)).map((e=>[e,t[e].metadata?.payload])))):Q.warn(`Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version`),e},Ra=function(e){return e.FeatureFlags=`feature_flags`,e.Recordings=`recordings`,e}({}),za=class{constructor(e){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.ci=!1,this._instance=e,this.featureFlagEventHandlers=[]}fi(){var e=this._instance.config.evaluation_contexts??this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(Q.warn(`evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version.`),this.ci=!0),e!=null&&e.length?e.filter((e=>{var t=e&&typeof e==`string`&&e.trim().length>0;return t||Q.error(`Invalid evaluation context found:`,e,`Expected non-empty string`),t})):[]}pi(){return this.fi().length>0}get hasLoadedFlags(){return this.li}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(mn),t=this._instance.get_property(ja),n=this._instance.get_property(Na);if(!n&&!t)return e||{};var r=U({},e||{});for(var i of[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])]){var a,o,s=r[i],c=t?.[i],l=k(c)?(a=s?.enabled)!=null&&a:!!c,u=k(c)?s.variant:typeof c==`string`?c:void 0,d=n?.[i],f=g({},s,{enabled:l,variant:l?u??s?.variant:void 0});l!==s?.enabled&&(f.original_enabled=s?.enabled),u!==s?.variant&&(f.original_variant=s?.variant),d&&(f.metadata=g({},s?.metadata,{payload:d,original_payload:s==null||(o=s.metadata)==null?void 0:o.payload})),r[i]=f}return this.ai||=(Q.warn(` Overriding feature flag details!`,{flagDetails:e,overriddenPayloads:n,finalDetails:r}),!0),r}getFlagVariants(){var e=this._instance.get_property(fn),t=this._instance.get_property(ja);if(!t)return e||{};for(var n=U({},e),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this.ai||=(Q.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),!0),n}getFlagPayloads(){var e=this._instance.get_property(Ma),t=this._instance.get_property(Na);if(!t)return e||{};for(var n=U({},e||{}),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this.ai||=(Q.warn(` Overriding feature flag payloads!`,{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),!0),n}reloadFeatureFlags(){this.hi||this._instance.config.advanced_disable_feature_flags||this.gi||(this._instance.mi.emit(`featureFlagsReloading`,!0),this.gi=setTimeout((()=>{this.bi()}),5))}yi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.li||this.ui||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.hi=e}bi(e){if(this.yi(),!this._instance.M())if(this.ui)this.di=!0;else{var t=this._instance.config.token,n=this._instance.get_property(`$device_id`),r={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:g({},this._instance.persistence?.get_initial_props()||{},this._instance.get_property(hn)||{}),group_properties:this._instance.get_property(gn),timezone:bi()};M(n)||k(n)||(r.$device_id=n),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.pi()&&(r.evaluation_contexts=this.fi());var i=this._instance.config.advanced_only_evaluate_survey_feature_flags?`&only_evaluate_survey_feature_flags=true`:``,a=this._instance.requestRouter.endpointFor(`flags`,`/flags/?v=2`+i);this.ui=!0,this._instance._send_request({method:`POST`,url:a,data:r,compression:this._instance.config.disable_compression?void 0:J.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,n,i,a=!0;if(e.statusCode===200&&(this.di||(this.$anon_distinct_id=void 0),a=!1),this.ui=!1,!r.disable_flags||this.di){this.vi=!a;var o=[];e.error?e.error instanceof Error?o.push(e.error.name===`AbortError`?Ea:Da):o.push(Oa):e.statusCode!==200&&o.push(ka(e.statusCode)),(t=e.json)!=null&&t.errorsWhileComputingFlags&&o.push(Ca);var s=!((n=e.json)==null||(n=n.quotaLimited)==null||!n.includes(Ra.FeatureFlags));s&&o.push(Ta),(i=this._instance.persistence)==null||i.register({[yn]:o}),s?Q.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.`):(r.disable_flags||this.receivedFeatureFlags(e.json??{},a),this.di&&(this.di=!1,this.bi()))}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),!t.fresh||this.vi){if(this.li||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlagResult(e,t);return n?.variant??n?.enabled}Q.warn(`getFeatureFlag for key "`+e+`" failed. Feature flags didn't load in time.`)}}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFeatureFlagResult(e,{send_event:!1})?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.vi)if(this.li||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants(),r=e in n,i=n[e],a=this.getFlagPayloads()[e],o=String(i),s=this._instance.get_property(Pa)||void 0,c=this._instance.get_property(Fa)||void 0,l=this._instance.get_property(vn)||{};if((t.send_event||!(`send_event`in t))&&(!(e in l)||!l[e].includes(o))){var u,d,f,p,m,h,g,_;T(l[e])?l[e].push(o):l[e]=[o],(u=this._instance.persistence)==null||u.register({[vn]:l});var v=this.getFeatureFlagDetails(e),ee=[...this._instance.get_property(yn)??[]];k(i)&&ee.push(wa);var y={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:a||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((d=this._instance.config.bootstrap)==null||(d=d.featureFlags)==null?void 0:d[e])||null,$feature_flag_bootstrapped_payload:((f=this._instance.config.bootstrap)==null||(f=f.featureFlagPayloads)==null?void 0:f[e])||null,$used_bootstrap_value:!this.vi};k(v==null||(p=v.metadata)==null?void 0:p.version)||(y.$feature_flag_version=v.metadata.version);var b,x=(v==null||(m=v.reason)==null?void 0:m.description)??(v==null||(h=v.reason)==null?void 0:h.code);x&&(y.$feature_flag_reason=x),v!=null&&(g=v.metadata)!=null&&g.id&&(y.$feature_flag_id=v.metadata.id),k(v?.original_variant)&&k(v?.original_enabled)||(y.$feature_flag_original_response=k(v.original_variant)?v.original_enabled:v.original_variant),v!=null&&(_=v.metadata)!=null&&_.original_payload&&(y.$feature_flag_original_payload=v==null||(b=v.metadata)==null?void 0:b.original_payload),ee.length&&(y.$feature_flag_error=ee.join(`,`)),this._instance.capture(`$feature_flag_called`,y)}if(r){var S=a;if(!k(a))try{S=JSON.parse(a)}catch{}return{key:e,enabled:!!i,variant:typeof i==`string`?i:void 0,payload:S}}}else Q.warn(`getFeatureFlagResult for key "`+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var n=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.pi()&&(r.evaluation_contexts=this.fi()),this._instance._send_request({method:`POST`,url:this._instance.requestRouter.endpointFor(`flags`,`/flags/?v=2`),data:r,compression:this._instance.config.disable_compression?void 0:J.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var r=n.json?.featureFlagPayloads;t(r?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.vi){if(this.li||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return k(n)?void 0:!!n}Q.warn(`isFeatureEnabled for key "`+e+`" failed. Feature flags didn't load in time.`)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.li=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(e,t,n,r,i){n===void 0&&(n={}),r===void 0&&(r={}),i===void 0&&(i={});var a=La(e),o=a.flags,s=a.featureFlags,c=a.featureFlagPayloads;if(s){var l=e.requestId,u=e.evaluatedAt;if(T(s)){Q.warn(`v1 of the feature flags endpoint is deprecated. Please use the latest version.`);var d={};if(s)for(var f=0;f<s.length;f++)d[s[f]]=!0;t&&t.register({[Aa]:s,[fn]:d})}else{var p=s,m=c,h=o;if(e.errorsWhileComputingFlags)if(o){var _=new Set(Object.keys(o).filter((e=>{var t;return!((t=o[e])!=null&&t.failed)})));p=g({},n,Object.fromEntries(Object.entries(p).filter((e=>{var[t]=e;return _.has(t)})))),m=g({},r,Object.fromEntries(Object.entries(m||{}).filter((e=>{var[t]=e;return _.has(t)})))),h=g({},i,Object.fromEntries(Object.entries(h||{}).filter((e=>{var[t]=e;return _.has(t)}))))}else p=g({},n,p),m=g({},r,m),h=g({},i,h);t&&t.register(g({[Aa]:Object.keys(Ia(p)),[fn]:p||{},[Ma]:m||{},[mn]:h||{}},l?{[Pa]:l}:{},u?{[Fa]:u}:{}))}}})(e,this._instance.persistence,n,r,i),this.wi(t)}}override(e,t){t===void 0&&(t=!1),Q.warn(`override is deprecated. Please use overrideFeatureFlags instead.`),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Q.uninitializedWarning(`posthog.featureFlags.overrideFeatureFlags`);if(!1===e)return this._instance.persistence.unregister(ja),this._instance.persistence.unregister(Na),this.wi(),Sa.info(`All overrides cleared`);if(e&&typeof e==`object`&&(`flags`in e||`payloads`in e)){var t,n=e;if(this.ai=!!((t=n.suppressWarning)!=null&&t),`flags`in n){if(!1===n.flags)this._instance.persistence.unregister(ja),Sa.info(`Flag overrides cleared`);else if(n.flags){if(T(n.flags)){for(var r={},i=0;i<n.flags.length;i++)r[n.flags[i]]=!0;this._instance.persistence.register({[ja]:r})}else this._instance.persistence.register({[ja]:n.flags});Sa.info(`Flag overrides set`,{flags:n.flags})}}`payloads`in n&&(!1===n.payloads?(this._instance.persistence.unregister(Na),Sa.info(`Payload overrides cleared`)):n.payloads&&(this._instance.persistence.register({[Na]:n.payloads}),Sa.info(`Payload overrides set`,{payloads:n.payloads}))),this.wi();return}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.li){var{flags:t,flagVariants:n}=this.xi();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,i=(this._instance.get_property(pn)||[]).find((t=>t.flagKey===e)),a={[`$feature_enrollment/`+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture(`$feature_enrollment_update`,o),this.setPersonPropertiesForFlags(a,!1);var s=g({},this.getFlagVariants(),{[e]:t});(r=this._instance.persistence)==null||r.register({[Aa]:Object.keys(Ia(s)),[fn]:s}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(pn),i=n?`&`+n.map((e=>`stage=`+e)).join(`&`):``;if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/early_access_features/?token=`+this._instance.config.token+i),method:`GET`,callback:t=>{var n,r;if(t.json){var i=t.json.earlyAccessFeatures;return(n=this._instance.persistence)==null||n.unregister(pn),(r=this._instance.persistence)==null||r.register({[pn]:i}),e(i)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,n)=>(e[n]=t[n],e)),{})}}wi(e){var{flags:t,flagVariants:n}=this.xi();this.featureFlagEventHandlers.forEach((r=>r(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(hn)||{};this._instance.register({[hn]:g({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(hn)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(gn)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((t=>{n[t]=g({},n[t],e[t]),delete e[t]})),this._instance.register({[gn]:g({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(gn)||{};this._instance.register({[gn]:g({},t,{[e]:{}})})}else this._instance.unregister(gn)}reset(){this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.yi(),this.ai=!1}},Ba=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],Va=class{constructor(e,t){this.R=e,this.props={},this.$i=!1,this.Ei=(e=>{var t=``;return e.token&&(t=e.token.replace(/\+/g,`PL`).replace(/\//g,`SL`).replace(/=/g,`EQ`)),e.persistence_name?`ph_`+e.persistence_name:`ph_`+t+`_posthog`})(e),this.Y=this.Si(e),this.load(),e.debug&&B.info(`Persistence loaded`,e.persistence,g({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(t){Ba.indexOf(t.persistence.toLowerCase())===-1&&(B.critical(`Unknown persistence type `+t.persistence+`; falling back to localStorage+cookie`),t.persistence=`localStorage+cookie`);var n=function(t){t===void 0&&(t=[]);var n=[...Ir,...t];return g({},K,{W:function(e){try{var t={};try{t=G.W(e)||{}}catch{}var n=U(t,JSON.parse(K.q(e)||`{}`));return K.G(e,n),n}catch{}return null},G:function(e,t,r,i,a,o){try{K.G(e,t,void 0,void 0,o);var s={};n.forEach((e=>{t[e]&&(s[e]=t[e])})),Object.keys(s).length&&G.G(e,s,r,i,a,o)}catch(e){K.B(e)}},V:function(t,n){try{e?.localStorage.removeItem(t),G.V(t,n)}catch(e){K.B(e)}}})}(t.cookie_persisted_properties||[]),r=t.persistence.toLowerCase();return r===`localstorage`&&K.H()?K:r===`localstorage+cookie`&&n.H()?n:r===`sessionstorage`&&q.H()?q:r===`memory`?Rr:r===`cookie`?G:n.H()?n:G}properties(){var e={};return H(this.props,(function(t,n){if(n===fn&&D(t))for(var r=Object.keys(t),a=0;a<r.length;a++)e[`$feature/`+r[a]]=t[r[a]];else s=n,c=!1,(M(o=kn)?c:i&&o.indexOf===i?o.indexOf(s)!=-1:(H(o,(function(e){if(c||=e===s)return zt})),c))||(e[n]=t);var o,s,c})),e}load(){if(!this.ki){var e=this.Y.W(this.Ei);e&&(this.props=U({},e))}}save(){this.ki||this.Y.G(this.Ei,this.props,this.Pi,this.Ti,this.Ii,this.R.debug)}remove(){this.Y.V(this.Ei,!1),this.Y.V(this.Ei,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(D(e)){k(t)&&(t=`None`),this.Pi=k(n)?this.Ci:n;var r=!1;if(H(e,((e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(D(e)){this.Pi=k(t)?this.Ci:t;var n=!1;if(H(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.$i){var e=pi(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);O(Gt(e))||this.register(e),this.$i=!0}}update_search_keyword(){var e;this.register((e=o?.referrer)?hi(e):{})}update_referrer_info(){this.register_once({$referrer:_i(),$referring_domain:o!=null&&o.referrer&&fr(o.referrer)?.host||`$direct`},void 0)}set_initial_person_info(){this.props[Cn]||this.props[wn]||this.register_once({[Tn]:vi(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};H([wn,Cn],(t=>{var n=this.props[t];n&&H(n,(function(t,n){e[`$initial_`+S(n)]=t}))}));var t,n,r=this.props[Tn];return r&&U(e,(t=yi(r),n={},H(t,(function(e,t){n[`$initial_`+S(t)]=e})),n)),e}safe_merge(e){return H(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var n=[...e].sort(),r=[...t].sort();return n.every(((e,t)=>e===r[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.Si(e),i=this.props;this.clear(),this.Y=r,this.props=i,this.save()}}set_disabled(e){this.ki=e,this.ki?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ti&&(this.Ti=e,this.remove(),this.save())}set_secure(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[Qt]||{};n[e]=t,this.props[Qt]=n,this.save()}remove_event_timer(e){var t=(this.props[Qt]||{})[e];return k(t)||(delete this.props[Qt][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},Ha=V(`[Product Tours]`),Ua=`ph_product_tours`,Wa=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){`productTours`in e&&(this._instance.persistence&&this._instance.persistence.register({[sn]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Ri||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(sn)||this.it((()=>this.Oi()))}it(e){var t,n;(t=f.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`product-tours`,(t=>{t?Ha.error(`Could not load product tours script`,t):e()}))}Oi(){var e;!this.Ri&&(e=f.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=f.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!T(this.Fi)||t){var n=this._instance.persistence;if(n){var r=n.props[Ua];if(T(r)&&!t)return this.Fi=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/product_tours/?token=`+this._instance.config.token),method:`GET`,callback:t=>{var r=t.statusCode;if(r!==200||!t.json){var i=`Product Tours API could not be loaded, status: `+r;Ha.error(i),e([],{isLoaded:!1,error:i});return}var a=T(t.json.product_tours)?t.json.product_tours:[];this.Fi=a,n&&n.register({[Ua]:a}),e(a,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){N(this.Ri)?e([],{isLoaded:!1,error:`Product tours not loaded`}):this.Ri.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ri)==null||t.showTourById(e)}previewTour(e){this.Ri?this.Ri.previewTour(e):this.it((()=>{var t;this.Oi(),(t=this.Ri)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Ri)==null||e.dismissTour(`user_clicked_skip`)}nextStep(){var e;(e=this.Ri)==null||e.nextStep()}previousStep(){var e;(e=this.Ri)==null||e.previousStep()}clearCache(){var e;this.Fi=null,(e=this._instance.persistence)==null||e.unregister(Ua)}resetTour(e){var t;(t=this.Ri)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Ri)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ri)==null||t.cancelPendingTour(e)}},Ga=function(e){return e.Activation=`events`,e.Cancellation=`cancelEvents`,e}({}),Ka=function(e){return e.Button=`button`,e.Tab=`tab`,e.Selector=`selector`,e}({}),qa=function(e){return e.TopLeft=`top_left`,e.TopRight=`top_right`,e.TopCenter=`top_center`,e.MiddleLeft=`middle_left`,e.MiddleRight=`middle_right`,e.MiddleCenter=`middle_center`,e.Left=`left`,e.Center=`center`,e.Right=`right`,e.NextToTrigger=`next_to_trigger`,e}({}),Ja=function(e){return e.Top=`top`,e.Left=`left`,e.Right=`right`,e.Bottom=`bottom`,e}({}),Ya=function(e){return e.Popover=`popover`,e.API=`api`,e.Widget=`widget`,e.ExternalSurvey=`external_survey`,e}({}),Xa=function(e){return e.Open=`open`,e.MultipleChoice=`multiple_choice`,e.SingleChoice=`single_choice`,e.Rating=`rating`,e.Link=`link`,e}({}),Za=function(e){return e.NextQuestion=`next_question`,e.End=`end`,e.ResponseBased=`response_based`,e.SpecificQuestion=`specific_question`,e}({}),Qa=function(e){return e.Once=`once`,e.Recurring=`recurring`,e.Always=`always`,e}({}),$a=function(e){return e.SHOWN=`survey shown`,e.DISMISSED=`survey dismissed`,e.SENT=`survey sent`,e.ABANDONED=`survey abandoned`,e}({}),eo=function(e){return e.SURVEY_ID=`$survey_id`,e.SURVEY_NAME=`$survey_name`,e.SURVEY_RESPONSE=`$survey_response`,e.SURVEY_ITERATION=`$survey_iteration`,e.SURVEY_ITERATION_START_DATE=`$survey_iteration_start_date`,e.SURVEY_PARTIALLY_COMPLETED=`$survey_partially_completed`,e.SURVEY_SUBMISSION_ID=`$survey_submission_id`,e.SURVEY_QUESTIONS=`$survey_questions`,e.SURVEY_COMPLETED=`$survey_completed`,e.PRODUCT_TOUR_ID=`$product_tour_id`,e.SURVEY_LAST_SEEN_DATE=`$survey_last_seen_date`,e}({}),to=function(e){return e.Popover=`popover`,e.Inline=`inline`,e}({}),$=V(`[Surveys]`),no=`seenSurvey_`,ro=(e,t)=>{var n=`$survey_`+t+`/`+e.id;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_`+t+`/`+e.id+`/`+e.current_iteration),n},io=e=>((e,t)=>{var n=``+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=``+e+t.id+`_`+t.current_iteration),n})(no,e),ao=[Ya.Popover,Ya.Widget,Ya.API],oo={ignoreConditions:!1,ignoreDelay:!1,displayType:to.Popover},so=class{constructor(){this.Mi={},this.Mi={}}on(e,t){return this.Mi[e]||(this.Mi[e]=[]),this.Mi[e].push(t),()=>{this.Mi[e]=this.Mi[e].filter((e=>e!==t))}}emit(e,t){for(var n of this.Mi[e]||[])n(t);for(var r of this.Mi[`*`]||[])r(e,t)}};function co(e,t,n){if(N(e))return!1;switch(n){case`exact`:return e===t;case`contains`:var r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/_/g,`.`).replace(/%/g,`.*`);return new RegExp(r,`i`).test(e);case`regex`:try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var lo=class{constructor(e){this.Ai=new so,this.ji=(e,t)=>this.Di(e,t)&&this.Li(e,t)&&this.Ni(e,t)&&this.Ui(e,t),this.Di=(e,t)=>t==null||!t.event||e?.event===t?.event,this._instance=e,this.zi=new Set,this.Hi=new Set}init(){if(!k(this._instance?._addCaptureHook)){var e;(e=this._instance)==null||e._addCaptureHook(((e,t)=>{this.on(e,t)}))}}register(e){var t;if(!k(this._instance?._addCaptureHook)&&(e.forEach((e=>{var t,n;(t=this.Hi)==null||t.add(e),(n=e.steps)==null||n.forEach((e=>{var t;(t=this.zi)==null||t.add(e?.event||``)}))})),(t=this._instance)!=null&&t.autocapture)){var n,r=new Set;e.forEach((e=>{var t;(t=e.steps)==null||t.forEach((e=>{e!=null&&e.selector&&r.add(e?.selector)}))})),(n=this._instance)==null||n.autocapture.setElementSelectors(r)}}on(e,t){t!=null&&e.length!=0&&(this.zi.has(e)||this.zi.has(t?.event))&&this.Hi&&this.Hi?.size>0&&this.Hi.forEach((e=>{this.Bi(t,e)&&this.Ai.emit(`actionCaptured`,e.name)}))}qi(e){this.onAction(`actionCaptured`,(t=>e(t)))}Bi(e,t){if(t?.steps==null)return!1;for(var n of t.steps)if(this.ji(e,n))return!0;return!1}onAction(e,t){return this.Ai.on(e,t)}Li(e,t){if(t!=null&&t.url){var n,r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!=`string`||!co(r,t.url,t.url_matching||`contains`))return!1}return!0}Ni(e,t){return!!this.Wi(e,t)&&!!this.Gi(e,t)&&!!this.Vi(e,t)}Wi(e,t){var n;if(t==null||!t.href)return!0;var r=this.Ji(e);if(r.length>0)return r.some((e=>co(e.href,t.href,t.href_matching||`exact`)));var i,a=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!a&&co((i=a.match(/(?::|")href="(.*?)"/))?i[1]:``,t.href,t.href_matching||`exact`)}Gi(e,t){var n;if(t==null||!t.text)return!0;var r=this.Ji(e);if(r.length>0)return r.some((e=>co(e.text,t.text,t.text_matching||`exact`)||co(e.$el_text,t.text,t.text_matching||`exact`)));var i,a,o,s=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!s&&(i=function(e){for(var t,n=[],r=/(?::|")text="(.*?)"/g;!N(t=r.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(s),a=t.text,o=t.text_matching||`exact`,i.some((e=>co(e,a,o))))}Vi(e,t){var n,r;if(t==null||!t.selector)return!0;var i=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(i!=null&&i.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||``;if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}Ji(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Ui(e,t){return t==null||!t.properties||t.properties.length===0||ya(t.properties.reduce(((e,t)=>{var n=T(t.value)?t.value.map(String):t.value==null?[]:[String(t.value)];return e[t.key]={values:n,operator:t.operator||`exact`},e}),{}),e?.properties)}},uo=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&ya(e.propertyFilters,t?.properties)}Zi(e,t){var n=new Map;return e.forEach((e=>{var r;(r=e.conditions)==null||(r=r[t])==null||(r=r.values)==null||r.forEach((t=>{if(t!=null&&t.name){var r=n.get(t.name)||[];r.push(e.id),n.set(t.name,r)}}))})),n}te(e,t,n){var r=(n===Ga.Activation?this.Ki:this.Yi).get(e),i=[];return this.ie((e=>{i=e.filter((e=>r?.includes(e.id)))})),i.filter((r=>{var i,a=(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null?void 0:i.find((t=>t.name===e));return this.Qi(a,t)}))}register(e){k(this._instance?._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter((e=>{var t;return e.conditions?.actions&&((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null?void 0:t.length)>0}));t.length!==0&&(this.se??(this.se=new lo(this._instance),this.se.init(),this.se.qi((e=>{this.onAction(e)}))),t.forEach((e=>{var t,n,r,i,a;e.conditions&&(t=e.conditions)!=null&&t.actions&&(n=e.conditions)!=null&&(n=n.actions)!=null&&n.values&&((r=e.conditions)==null||(r=r.actions)==null||(r=r.values)==null?void 0:r.length)>0&&((i=this.se)==null||i.register(e.conditions.actions.values),(a=e.conditions)==null||(a=a.actions)==null||(a=a.values)==null||a.forEach((t=>{if(t&&t.name){var n=this.Xi.get(t.name);n&&n.push(e.id),this.Xi.set(t.name,n||[e.id])}})))})))}ee(e){var t,n=e.filter((e=>{var t;return e.conditions?.events&&((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null?void 0:t.length)>0})),r=e.filter((e=>{var t;return e.conditions?.cancelEvents&&((t=e.conditions)==null||(t=t.cancelEvents)==null||(t=t.values)==null?void 0:t.length)>0}));(n.length!==0||r.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this.Ki=this.Zi(e,Ga.Activation),this.Yi=this.Zi(e,Ga.Cancellation))}onEvent(e,t){var n,r=this.ne(),i=this.oe(),a=this.ae(),o=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[i])||[];if(a===e&&t&&o.length>0){var s,c;r.info(`event matched, removing item from activated items`,{event:e,eventPayload:t,existingActivatedItems:o});var l=(t==null||(s=t.properties)==null?void 0:s.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(l){var u=o.indexOf(l);u>=0&&(o.splice(u,1),this.le(o))}}else{if(this.Yi.has(e)){var d=this.te(e,t,Ga.Cancellation);d.length>0&&(r.info(`cancel event matched, cancelling items`,{event:e,itemsToCancel:d.map((e=>e.id))}),d.forEach((e=>{var t=o.indexOf(e.id);t>=0&&o.splice(t,1),this.ue(e.id)})),this.le(o))}if(this.Ki.has(e)){r.info(`event name matched`,{event:e,eventPayload:t,items:this.Ki.get(e)});var f=this.te(e,t,Ga.Activation);this.le(o.concat(f.map((e=>e.id))||[]))}}}onAction(e){var t,n=this.oe(),r=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[];this.Xi.has(e)&&this.le(r.concat(this.Xi.get(e)||[]))}le(e){var t,n=this.ne(),r=this.oe(),i=[...new Set(e)].filter((e=>!this.he(e)));n.info(`updating activated items`,{activatedItems:i}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[r]:i})}getActivatedIds(){var e,t=this.oe();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}},fo=class extends uo{constructor(e){super(e)}oe(){return`$surveys_activated`}ae(){return $a.SHOWN}ie(e){var t;(t=this._instance)==null||t.getSurveys(e)}ue(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}ne(){return $}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},po=class{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(N(t))return $.warn(`Flags not loaded yet. Not loading surveys.`);this.ve=T(t)?t.length>0:t,$.info(`flags response received, isSurveysEnabled: `+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem(`lastSeenSurveyDate`);for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(no)||n!=null&&n.startsWith(`inProgressSurvey_`))&&e.push(n)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)$.info(`Already initializing surveys, skipping...`);else if(this._instance.config.disable_surveys)$.info(`Disabled. Not loading surveys.`);else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())$.info(`Not loading surveys in cookieless mode without consent.`);else{var e=f?.__PosthogExtensions__;if(e){if(!k(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var n=e.generateSurveys;if(n)return void this._e(n,t);var r=e.loadExternalDependency;if(!r)return void this.ge(`PostHog loadExternalDependency extension not found.`);r(this._instance,`surveys`,(n=>{n||!e.generateSurveys?this.ge(`Could not load surveys script`,n):this._e(e.generateSurveys,t)}))}catch(e){throw this.ge(`Error initializing surveys`,e),e}finally{this.ce=!1}}}else $.error(`PostHog Extensions not found.`)}}_e(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new fo(this._instance),$.info(`Surveys loaded successfully`),this.me({isLoaded:!0})}ge(e,t){$.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return $.info(`Disabled. Not loading surveys.`),e([]);var n,r=this._instance.get_property(_n);if(r&&!t)return e(r,{isLoaded:!0});typeof Promise<`u`&&this.pe?this.pe.then((t=>{var{surveys:n,context:r}=t;return e(n,r)})):(typeof Promise<`u`&&(this.pe=new Promise((e=>{n=e}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/surveys/?token=`+this._instance.config.token),method:`GET`,timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var r;this.pe=null;var i=t.statusCode;if(i!==200||!t.json){var a=`Surveys API could not be loaded, status: `+i;$.error(a);var o={isLoaded:!1,error:a};e([],o),n?.({surveys:[],context:o});return}var s,c=t.json.surveys||[],l=c.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}(e)||function(e){var t;return!((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null||!t.length)}(e))));l.length>0&&((s=this._surveyEventReceiver)==null||s.register(l)),(r=this._instance.persistence)==null||r.register({[_n]:c});var u={isLoaded:!0};e(c,u),n?.({surveys:c,context:u})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){$.error(`Error in survey callback`,e)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!N(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);$.warn(`init was not called`)}be(e){var t=null;return this.getSurveys((n=>{t=n.find((t=>t.id===e))??null})),t}ye(e){if(N(this._surveyManager))return{eligible:!1,reason:`SDK is not enabled or survey functionality is not yet loaded`};var t=typeof e==`string`?this.be(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:`Survey not found`}}canRenderSurvey(e){if(N(this._surveyManager))return $.warn(`init was not called`),{visible:!1,disabledReason:`SDK is not enabled or survey functionality is not yet loaded`};var t=this.ye(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return N(this._surveyManager)?($.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:`SDK is not enabled or survey functionality is not yet loaded`})):new Promise((n=>{this.getSurveys((t=>{var r=t.find((t=>t.id===e))??null;if(r){var i=this.ye(r);n({visible:i.eligible,disabledReason:i.reason})}else n({visible:!1,disabledReason:`Survey not found`})}),t)}))}renderSurvey(e,t,n){var r;if(N(this._surveyManager))$.warn(`init was not called`);else{var i=typeof e==`string`?this.be(e):e;if(i!=null&&i.id)if(ao.includes(i.type)){var a=o?.querySelector(t);if(a)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?($.info(`Rendering survey `+i.id+` with delay of `+i.appearance.surveyPopupDelaySeconds+` seconds`),void setTimeout((()=>{var e;$.info(`Rendering survey `+i.id+` with delay of `+i.appearance?.surveyPopupDelaySeconds+` seconds`),(e=this._surveyManager)==null||e.renderSurvey(i,a,n),$.info(`Survey `+i.id+` rendered`)}),1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,a,n);$.warn(`Survey element not found`)}else $.warn(`Surveys of type `+i.type+` cannot be rendered in the app`);else $.warn(`Survey not found`)}}displaySurvey(e,t){var n;if(N(this._surveyManager))$.warn(`init was not called`);else{var r=this.be(e);if(r){var i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==to.Popover&&t.initialResponses&&$.warn(`initialResponses is only supported for popover surveys. prefill will not be applied.`),!1===t.ignoreConditions){var a=this.canRenderSurvey(r);if(!a.visible)return void $.warn(`Survey is not eligible to be displayed: `,a.disabledReason)}t.displayType===to.Inline?this.renderSurvey(i,t.selector,t.properties):this._surveyManager.handlePopoverSurvey(i,t)}else $.warn(`Survey not found`)}}cancelPendingSurvey(e){N(this._surveyManager)?$.warn(`init was not called`):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},mo=V(`[Conversations]`),ho=class{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.$e=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;N(t)||(F(t)?this.we=t:(this.we=t.enabled,this.$e=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.we=void 0,this.$e=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=f?.__PosthogExtensions__;if(e&&!k(this.we)&&this.we)if(this.$e&&this.$e.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.Ee(t),void(this.xe=!1);var n=e.loadExternalDependency;if(!n)return void this.Se(`PostHog loadExternalDependency extension not found.`);n(this._instance,`conversations`,(t=>{t||!e.initConversations?this.Se(`Could not load conversations script`,t):this.Ee(e.initConversations),this.xe=!1}))}catch(e){this.Se(`Error initializing conversations`,e),this.xe=!1}}else mo.error(`Conversations enabled but missing token in remote config.`)}}Ee(e){if(this.$e)try{this._conversationsManager=e(this.$e,this._instance),mo.info(`Conversations loaded successfully`)}catch(e){this.Se(`Error completing conversations initialization`,e)}else mo.error(`Cannot complete initialization: remote config is null`)}Se(e,t){mo.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():mo.warn(`Conversations not loaded yet.`)}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.we&&!M(this._conversationsManager)}isVisible(){var e;return(e=this._conversationsManager?.isVisible())!=null&&e}sendMessage(e,t,n){var r=this;return h((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(mo.warn(`Conversations not available yet.`),null)}))()}getMessages(e,t){var n=this;return h((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(mo.warn(`Conversations not available yet.`),null)}))()}markAsRead(e){var t=this;return h((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(mo.warn(`Conversations not available yet.`),null)}))()}getTickets(e){var t=this;return h((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(mo.warn(`Conversations not available yet.`),null)}))()}getCurrentTicketId(){return this._conversationsManager?.getCurrentTicketId()??null}getWidgetSessionId(){return this._conversationsManager?.getWidgetSessionId()??null}},go=class{constructor(e){var t;this.ke=!1,this.Pe=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ke=!0)}onRemoteConfig(e){var t=e.logs?.captureConsoleLogs;!N(t)&&t&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=V(`[logs]`),t=f?.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(this._instance,`logs`,(n=>{var r;n||(r=t.logs)==null||!r.initializeLogs?e.error(`Could not load logs script`,n):(t.logs.initializeLogs(this._instance),this.Pe=!0)})):e.error(`PostHog loadExternalDependency extension not found.`)}else e.error(`PostHog Extensions not found.`)}}},_o=V(`[RateLimiter]`),vo=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{_o.info((e||`events`)+` is quota limited.`),this.serverLimits[e]=new Date().getTime()+6e4}))}catch(e){_o.warn(`could not rate limit - continuing. Error: "`+e?.message+`"`,{text:t});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){return this.instance.config.rate_limiting?.events_per_second||10}get captureEventsBurstLimit(){return Math.max(this.instance.config.rate_limiting?.events_burst_limit||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,i=new Date().getTime(),a=this.instance.persistence?.get_property(Sn)??{tokens:n,last:i};a.tokens+=(i-a.last)/1e3*r,a.last=i,a.tokens>n&&(a.tokens=n);var o=a.tokens<1;return o||e||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture(`$$client_ingestion_warning`,{$$client_ingestion_warning_message:`posthog-js client rate limited. Config is set to `+r+` events per second and `+n+` events burst limit.`},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(t=this.instance.persistence)==null||t.set_property(Sn,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||`events`]||!1;return!1!==t&&new Date().getTime()<t}},yo=V(`[RemoteConfig]`),bo=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=f._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=f.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`remote-config`,(()=>e(this.remoteConfig))):e()}Ie(e){this._instance._send_request({method:`GET`,url:this._instance.requestRouter.endpointFor(`assets`,`/array/`+this._instance.config.token+`/config`),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return yo.info(`Using preloaded remote config`,this.remoteConfig),this.Ce(this.remoteConfig),void this.Re();if(this._instance.M())return void yo.warn(`Remote config is disabled. Falling back to local config.`);this.Te((e=>{if(!e)return yo.info(`No config found after loading remote JS config. Falling back to JSON.`),void this.Ie((e=>{this.Ce(e),this.Re()}));this.Ce(e),this.Re()}))}catch(e){yo.error(`Error loading remote config`,e)}}stop(){this.Fe&&=(clearInterval(this.Fe),void 0)}refresh(){this._instance.M()||o?.visibilityState===`hidden`||this._instance.featureFlags.reloadFeatureFlags()}Re(){this.Fe||=setInterval((()=>{this.refresh()}),3e5)}Ce(e){e||yo.error(`Failed to fetch remote config from PostHog.`),this._instance.Ce(e??{}),!1!==e?.hasFeatureFlags&&(this._instance.config.advanced_disable_feature_flags_on_first_load||this._instance.featureFlags.ensureFlagsLoaded())}},xo=3e3,So=class{constructor(e,t){this.Oe=!0,this.Me=[],this.Ae=L(t?.flush_interval_ms||xo,250,5e3,B.createLogger(`flush interval`),xo),this.je=e}enqueue(e){this.Me.push(e),this.De||this.Le()}unload(){this.Ne();var e=this.Me.length>0?this.Ue():{},t=Object.values(e);[...t.filter((e=>e.url.indexOf(`/e`)===0)),...t.filter((e=>e.url.indexOf(`/e`)!==0))].map((e=>{this.je(g({},e,{transport:`sendBeacon`}))}))}enable(){this.Oe=!1,this.Le()}Le(){var e=this;this.Oe||(this.De=setTimeout((()=>{if(this.Ne(),this.Me.length>0){var t=this.Ue(),n=function(){var n=t[r],i=new Date().getTime();n.data&&T(n.data)&&H(n.data,(e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),e.je(n)};for(var r in t)n()}}),this.Ae))}Ne(){clearTimeout(this.De),this.De=void 0}Ue(){var e={};return H(this.Me,(t=>{var n,r=t,i=(r?r.batchKey:null)||r.url;k(e[i])&&(e[i]=g({},r,{data:[]})),(n=e[i].data)==null||n.push(r.data)})),this.Me=[],e}},Co=[`retriesPerformedSoFar`],wo=class{constructor(t){this.ze=!1,this.He=3e3,this.Me=[],this._instance=t,this.Me=[],this.Be=!0,!k(e)&&`onLine`in e.navigator&&(this.Be=e.navigator.onLine,this.qe=()=>{this.Be=!0,this.Lt()},this.We=()=>{this.Be=!1},W(e,`online`,this.qe),W(e,`offline`,this.We))}get length(){return this.Me.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=_(e,Co);re(t)&&(n.url=da(n.url,{retry_count:t})),this._instance._send_request(g({},n,{callback:e=>{e.statusCode!==200&&(e.statusCode<400||e.statusCode>=500)&&(t??0)<10?this.Ge(g({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(e)}}))}Ge(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(e){var t=3e3*2**e,n=t/2,r=Math.min(18e5,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}(t),r=Date.now()+n;this.Me.push({retryAt:r,requestOptions:e});var i=`Enqueued failed request for retry in `+n;navigator.onLine||(i+=` (Browser is offline)`),B.warn(i),this.ze||(this.ze=!0,this.Ve())}Ve(){if(this.Je&&clearTimeout(this.Je),this.Me.length===0)return this.ze=!1,void(this.Je=void 0);this.Je=setTimeout((()=>{this.Be&&this.Me.length>0&&this.Lt(),this.Ve()}),this.He)}Lt(){var e=Date.now(),t=[],n=this.Me.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.Me=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.Je&&=(clearTimeout(this.Je),void 0),this.ze=!1,k(e)||(this.qe&&=(e.removeEventListener(`online`,this.qe),void 0),this.We&&=(e.removeEventListener(`offline`,this.We),void 0)),this.Me))try{this._instance._send_request(g({},t,{transport:`sendBeacon`}))}catch(e){B.error(e)}this.Me=[]}},To=class{constructor(e){this.Ke=()=>{this.Ye||={};var e=this.scrollElement(),t=this.scrollY(),n=e?Math.max(0,e.scrollHeight-e.clientHeight):0,r=t+(e?.clientHeight||0),i=e?.scrollHeight||0;this.Ye.lastScrollY=Math.ceil(t),this.Ye.maxScrollY=Math.max(t,this.Ye.maxScrollY??0),this.Ye.maxScrollHeight=Math.max(n,this.Ye.maxScrollHeight??0),this.Ye.lastContentY=r,this.Ye.maxContentY=Math.max(r,this.Ye.maxContentY??0),this.Ye.maxContentHeight=Math.max(i,this.Ye.maxContentHeight??0)},this._instance=e}getContext(){return this.Ye}resetContext(){var e=this.Ye;return setTimeout(this.Ke,0),e}startMeasuringScrollPosition(){W(e,`scroll`,this.Ke,{capture:!0}),W(e,`scrollend`,this.Ke,{capture:!0}),W(e,`resize`,this.Ke)}scrollElement(){if(!this._instance.config.scroll_root_selector)return e?.document.documentElement;for(var t of T(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector]){var n=e?.document.querySelector(t);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return e&&(e.scrollY||e.pageYOffset||e.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return e&&(e.scrollX||e.pageXOffset||e.document.documentElement.scrollLeft)||0}},Eo=e=>vi(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties),Do=class{constructor(e,t,n,r){this.Xe=e=>{var t=this.Qe();if(!t||t.sessionId!==e){var n={sessionId:e,props:this.Ze(this._instance)};this.tr.register({[xn]:n})}},this._instance=e,this.ir=t,this.tr=n,this.Ze=r||Eo,this.ir.onSessionId(this.Xe)}Qe(){return this.tr.props[xn]}getSetOnceProps(){var e=this.Qe()?.props;return e?`r`in e?yi(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var e={};return H(Gt(this.getSetOnceProps()),((t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_`+S(n)]=t})),e}},Oo=V(`[SessionId]`),ko=class{on(e,t){return this.er.on(e,t)}constructor(e,t,n){var r;if(this.rr=[],this.sr=void 0,this.er=new so,this.nr=(e,t)=>!(!re(e)||!re(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error(`SessionIdManager requires a PostHogPersistence instance`);if(e.config.cookieless_mode===`always`)throw Error(`SessionIdManager cannot be used with cookieless_mode="always"`);this.R=e.config,this.tr=e.persistence,this.ar=void 0,this.lr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ur=t||Ar,this.hr=n||Ar;var i=this.R.persistence_name||this.R.token;if(this._sessionTimeoutMs=1e3*L(this.R.session_idle_timeout_seconds||1800,60,36e3,Oo.createLogger(`session_idle_timeout_seconds`),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.dr(),this.vr=`ph_`+i+`_window_id`,this.cr=`ph_`+i+`_primary_window_exists`,this.pr()){var a=q.W(this.vr),o=q.W(this.cr);a&&!o?this.ar=a:q.V(this.vr),q.G(this.cr,!0)}if((r=this.R.bootstrap)!=null&&r.sessionID)try{var s=(e=>{var t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Not a valid UUID`);if(t[12]!==`7`)throw Error(`Not a UUIDv7`);return parseInt(t.substring(0,12),16)})(this.R.bootstrap.sessionID);this._r(this.R.bootstrap.sessionID,new Date().getTime(),s)}catch(e){Oo.error(`Invalid sessionID in bootstrap`,e)}this.gr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return k(this.rr)&&(this.rr=[]),this.rr.push(e),this.lr&&e(this.lr,this.ar),()=>{this.rr=this.rr.filter((t=>t!==e))}}pr(){return this.R.persistence!==`memory`&&!this.tr.ki&&q.H()}mr(e){e!==this.ar&&(this.ar=e,this.pr()&&q.G(this.vr,e))}br(){return this.ar?this.ar:this.pr()?q.W(this.vr):null}_r(e,t,n){e===this.lr&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.lr=e,this.tr.register({[un]:[t,e,n]}))}yr(){var e=this.tr.props[un];return T(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._r(null,null,null)}destroy(){clearTimeout(this.wr),this.wr=void 0,this.sr&&e&&(e.removeEventListener(`beforeunload`,this.sr,{capture:!1}),this.sr=void 0),this.rr=[]}gr(){this.sr=()=>{this.pr()&&q.V(this.cr)},W(e,`beforeunload`,this.sr,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode===`always`)throw Error(`checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"`);var n=t||new Date().getTime(),[r,i,a]=this.yr(),o=this.br(),s=re(a)&&Math.abs(n-a)>864e5,c=!1,l=!i,u=!l&&!e&&this.nr(n,r);l||u||s?(i=this.ur(),o=this.hr(),Oo.info(`new session ID generated`,{sessionId:i,windowId:o,changeReason:{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}}),a=n,c=!0):o||(o=this.hr(),c=!0);var d=re(r)&&e&&!s?r:n,f=re(a)?a:new Date().getTime();return this.mr(o),this._r(i,d,f),e||this.dr(),c&&this.rr.forEach((e=>e(i,o,c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0))),{sessionId:i,windowId:o,sessionStartTimestamp:f,changeReason:c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0,lastActivityTimestamp:r}}dr(){clearTimeout(this.wr),this.wr=setTimeout((()=>{var[e]=this.yr();if(this.nr(new Date().getTime(),e)){var t=this.lr;this.resetSessionId(),this.er.emit(`forcedIdleReset`,{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},Ao=[`$set_once`,`$set`],jo=V(`[SiteApps]`),Mo=class{constructor(e){this._instance=e,this.$r=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Er(e,t){if(t){var n=this.globalsForEvent(t);this.$r.push(n),this.$r.length>1e3&&(this.$r=this.$r.slice(10))}}get siteAppLoaders(){var e;return(e=f._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Er.bind(this));this.Sr=()=>{e(),this.$r=[],this.Sr=void 0}}}globalsForEvent(e){if(!e)throw Error(`Event payload is required`);var t={},n=this._instance.get_property(`$groups`)||[],r=this._instance.get_property(`$stored_group_properties`)||{};for(var[i,a]of Object.entries(r))t[i]={id:n[i],type:i,properties:a};var{$set_once:o,$set:s}=e;return{event:g({},_(e,Ao),{properties:g({},e.properties,s?{$set:g({},e.properties?.$set??{},s)}:{},o?{$set_once:g({},e.properties?.$set_once??{},o)}:{}),elements_chain:e.properties?.$elements_chain??``,distinct_id:e.properties?.distinct_id}),person:{properties:this._instance.get_property(`$stored_person_properties`)},groups:t}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var n;(!t.errored&&this.$r.length&&(jo.info(`Processing `+this.$r.length+` events for site app with id `+e.id),this.$r.forEach((e=>t.processEvent==null?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored)))&&((n=this.Sr)==null||n.call(this))},r=!1,i=i=>{t.errored=!i,t.loaded=!0,jo.info(`Site app with id `+e.id+` `+(i?`loaded`:`errored`)),r&&n()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:e=>{i(e)}});a&&(t.processEvent=a),r=!0}catch(t){jo.error(`Error while initializing PostHog app with config id `+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){jo.error(`Error while processing buffered events PostHog app with config id `+e.id,n),t.errored=!0}}kr(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}Pr(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(t){jo.error(`Error while processing event `+e.event+` for site app `+n.id,t)}}}onRemoteConfig(e){var t,n,r,i=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.kr(),void this._instance.on(`eventCaptured`,(e=>this.Pr(e)))):void jo.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`);if((n=this.Sr)==null||n.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var a=function(e){var t;f[`__$$ph_site_app_`+e]=i._instance,(t=f.__PosthogExtensions__)==null||t.loadSiteApp==null||t.loadSiteApp(i._instance,s,(t=>{if(t)return jo.error(`Error while initializing PostHog app with config id `+e,t)}))};for(var{id:o,url:s}of e.siteApps)a(o)}else jo.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}},No=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&y(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((e=>y(e?.brand,t))))return!0}catch{}return!!e.webdriver},Po=function(e){return e.US=`us`,e.EU=`eu`,e.CUSTOM=`custom`,e}({}),Fo=`i.posthog.com`,Io=class{constructor(e){this.Tr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,``);return e===`https://app.posthog.com`?`https://us.i.posthog.com`:e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,``):this.apiHost}get uiHost(){var e=this.instance.config.ui_host?.replace(/\/$/,``);return e||=this.apiHost.replace(`.`+Fo,`.posthog.com`),e===`https://app.posthog.com`?`https://us.posthog.com`:e}get region(){return this.Tr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Tr[this.apiHost]=Po.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Tr[this.apiHost]=Po.EU:this.Tr[this.apiHost]=Po.CUSTOM),this.Tr[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=``),t&&=t[0]===`/`?t:`/`+t,e===`ui`)return this.uiHost+t;if(e===`flags`)return this.flagsApiHost+t;if(this.region===Po.CUSTOM)return this.apiHost+t;var n=Fo+t;switch(e){case`assets`:return`https://`+this.region+`-assets.`+n;case`api`:return`https://`+this.region+`.`+n}}},Lo={icontains:(t,n)=>!!e&&n.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,n)=>!!e&&n.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,n)=>!!e&&ha(n.href,t),not_regex:(t,n)=>!!e&&!ha(n.href,t),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},Ro=class t{constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){e===void 0&&(e=!1),n.getWebExperiments((e=>{t.Ir(`retrieved web experiments from the server`),n.Cr=new Map,e.forEach((e=>{if(e.feature_flag_key){var r;n.Cr&&(t.Ir(`setting flag key `,e.feature_flag_key,` to web experiment `,e),(r=n.Cr)==null||r.set(e.feature_flag_key,e));var i=n._instance.getFeatureFlag(e.feature_flag_key);A(i)&&e.variants[i]&&n.Rr(e.name,i,e.variants[i].transforms)}else if(e.variants)for(var a in e.variants){var o=e.variants[a];t.Fr(o)&&n.Rr(e.name,a,o.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}onFeatureFlags(e){if(this._is_bot())t.Ir(`Refusing to render web experiment since the viewer is a likely bot`);else if(!this._instance.config.disable_web_experiments){if(N(this.Cr))return this.Cr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Ir(`applying feature flags`,e),e.forEach((e=>{var t;if(this.Cr&&(t=this.Cr)!=null&&t.has(e)){var n=this._instance.getFeatureFlag(e),r=this.Cr?.get(e);n&&r!=null&&r.variants[n]&&this.Rr(r.name,n,r.variants[n].transforms)}}))}}previewWebExperiment(){var e=t.getWindowLocation();if(e!=null&&e.search){var n=mr(e?.search,`__experiment_id`),r=mr(e?.search,`__experiment_variant`);n&&r&&(t.Ir(`previewing web experiments `+n+` && `+r),this.getWebExperiments((e=>{this.Or(parseInt(n),r,e)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property(`$web_experiments`);if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/web_experiments/?token=`+this._instance.config.token),method:`GET`,callback:t=>t.statusCode!==200||!t.json?e([]):e(t.json.experiments||[])})}Or(e,n,r){var i=r.filter((t=>t.id===e));i&&i.length>0&&(t.Ir(`Previewing web experiment [`+i[0].name+`] with variant [`+n+`]`),this.Rr(i[0].name,n,i[0].variants[n].transforms))}static Fr(e){return!N(e.conditions)&&t.Mr(e)&&t.Ar(e)}static Mr(e){if(N(e.conditions)||N(e.conditions?.url))return!0;var n,r=t.getWindowLocation();return!!r&&((n=e.conditions)==null||!n.url||Lo[e.conditions?.urlMatchType??`icontains`](e.conditions.url,r))}static getWindowLocation(){return e?.location}static Ar(e){if(N(e.conditions)||N(e.conditions?.utm))return!0;var t=pi();if(t.utm_source){var n,r,i,a,o,s,c,l,u=(n=e.conditions)==null||(n=n.utm)==null||!n.utm_campaign||((r=e.conditions)==null||(r=r.utm)==null?void 0:r.utm_campaign)==t.utm_campaign,d=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==t.utm_source,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_medium||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_medium)==t.utm_medium,p=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_term)==t.utm_term;return u&&f&&p&&d}return!1}static Ir(e){var t=[...arguments].slice(1);B.info(`[WebExperiments] `+e,t)}Rr(e,n,r){this._is_bot()?t.Ir(`Refusing to render web experiment since the viewer is a likely bot`):n===`control`?t.Ir(`Control variants leave the page unmodified.`):r.forEach((r=>{r.selector&&(t.Ir(`applying transform of variant `+n+` for experiment `+e+` `,r),(document?.querySelectorAll(r.selector))?.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute(`style`,r.css)})))}))}_is_bot(){return a&&this._instance?No(a,this._instance.config.custom_blocked_useragents):void 0}},zo=V(`[PostHog ExternalIntegrations]`),Bo={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`},Vo=class{constructor(e){this._instance=e}it(e,t){var n;(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(e=>{if(e)return zo.error(`failed to load script`,e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var n,i,a;(!r||(n=f.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[t]||e.it(Bo[t],(()=>{var n;(n=f.__PosthogExtensions__)==null||(n=n.integrations)==null||(n=n[t])==null||n.start(e._instance)})),!r&&(i=f.__PosthogExtensions__)!=null&&(i=i.integrations)!=null&&i[t])&&((a=f.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[t])==null||a.stop())};for(var[n,r]of Object.entries((i=this._instance.config.integrations)??{})){var i;t(n)}}};V(`[SessionRecording]`);var Ho=`[SessionRecording]`,Uo=V(Ho),Wo=class{get started(){var e;return!((e=this.jr)==null||!e.isStarted)}get status(){return this.jr?this.jr.status:this.Dr&&!this.Lr?`disabled`:`lazy_loading`}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Dr=!1,this.Nr=!1,this.Ur=void 0,this._instance=e,!this._instance.sessionManager)throw Uo.error(`started without valid sessionManager`),Error(Ho+` started without valid sessionManager. This is a bug.`);if(this._instance.config.cookieless_mode===`always`)throw Error(Ho+` cannot be used with cookieless_mode="always"`)}get Lr(){var t,n=!((t=this._instance.get_property(ln))==null||!t.enabled),r=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return e&&n&&r&&!i}startIfEnabledOrStop(e){var t;if(!this.Lr||(t=this.jr)==null||!t.isStarted){var n=!k(Object.assign)&&!k(Array.from);this.Lr&&n?(this.zr(e),Uo.info(`starting`)):this.stopRecording()}}zr(e){var t,n,r;this.Lr&&(f!=null&&(t=f.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=f.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Hr(e):(r=f.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Br,(t=>{if(t)return Uo.error(`could not load recorder`,t);this.Hr(e)})))}stopRecording(){var e,t;(e=this.Ur)==null||e.call(this),this.Ur=void 0,(t=this.jr)==null||t.stop()}qr(){var e;(e=this._instance.persistence)==null||e.unregister(dn)}Wr(e){if(this._instance.persistence){var t,n=this._instance.persistence,r=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,r=t?.sampleRate,i=N(r)?null:parseFloat(r);N(i)&&this.qr();var a=t?.minimumDurationMilliseconds;n.register({[ln]:g({cache_timestamp:Date.now(),enabled:!!t},t,{networkPayloadCapture:g({capturePerformance:e.capturePerformance},t?.networkPayloadCapture),canvasRecording:{enabled:t?.recordCanvas,fps:t?.canvasFps,quality:t?.canvasQuality},sampleRate:i,minimumDurationMilliseconds:k(a)?null:a,endpoint:t?.endpoint,triggerMatchType:t?.triggerMatchType,masking:t?.masking,urlTriggers:t?.urlTriggers})})};r(),(t=this.Ur)==null||t.call(this),this.Ur=this._instance.sessionManager?.onSessionId(r)}}onRemoteConfig(e){`sessionRecording`in e?!1===e.sessionRecording?this.Dr=!0:(this.Nr=!1,this.Wr(e),this.Dr=!0,this.startIfEnabledOrStop()):Uo.info(`skipping remote config with no sessionRecording`,e)}log(e,t){var n;t===void 0&&(t=`log`),(n=this.jr)!=null&&n.log?this.jr.log(e,t):Uo.warn(`log called before recorder was ready`)}get Br(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ln);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}Gr(){var e=this._instance.get_property(ln);if(!e)return!1;var t=(typeof e==`object`?e:JSON.parse(e)).cache_timestamp??Date.now();return Date.now()-t<=3e5}Hr(e){var t;if((t=f.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error(`Called on script loaded before session recording is available`);this.jr||(this.jr=f.__PosthogExtensions__?.initSessionRecording(this._instance),this.jr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Gr()?this.jr.start(e):this.Nr||(this.Nr=!0,Uo.info(`persisted remote config is stale, requesting fresh config before starting`),new bo(this._instance).load())}onRRwebEmit(e){var t;(t=this.jr)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.jr||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.jr)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.jr||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.jr)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.jr||(n=this._instance.persistence)==null||n.register({[e===`url`?`$replay_override_url_trigger`:`$replay_override_event_trigger`]:!0}),(t=this.jr)==null||t.overrideTrigger(e)}get sdkDebugProperties(){return this.jr?.sdkDebugProperties||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.jr)==null||!n.tryAddCustomEvent(e,t))}},Go={},Ko=0,qo=()=>{},Jo=`posthog`,Yo=!la&&d?.indexOf(`MSIE`)===-1&&d?.indexOf(`Mozilla`)===-1,Xo=t=>{var n;return g({api_host:`https://us.i.posthog.com`,flags_api_host:null,ui_host:null,token:``,autocapture:!0,cross_subdomain_cookie:Jt(o?.location),persistence:`localStorage+cookie`,persistence_name:``,cookie_persisted_properties:[],loaded:qo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:`if_capture_pageview`,defaults:t??`unset`,__preview_deferred_init_extensions:!1,debug:s&&A(s?.search)&&s.search.indexOf(`__posthog_debug=true`)!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(e==null||(n=e.location)==null?void 0:n.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_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t=`Bad HTTP status: `+e.statusCode+` `+e.text;B.error(t)},get_device_id:e=>e,capture_performance:void 0,name:`posthog`,bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:`identified_only`,before_send:void 0,request_queue_config:{flush_interval_ms:xo},error_tracking:{},_onCapture:qo,__preview_eager_load_replay:!1},(e=>({rageclick:!(e&&e>=`2025-11-30`)||{content_ignorelist:!0},capture_pageview:!(e&&e>=`2025-05-24`)||`history_change`,session_recording:e&&e>=`2025-11-30`?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>=`2026-01-30`?`head`:`body`,internal_or_test_user_hostname:e&&e>=`2026-01-30`?/^(localhost|127\.0\.0\.1)$/:void 0}))(t))},Zo=e=>{var t={};k(e.process_person)||(t.person_profiles=e.process_person),k(e.xhr_headers)||(t.request_headers=e.xhr_headers),k(e.cookie_name)||(t.persistence_name=e.cookie_name),k(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),k(e.store_google)||(t.save_campaign_params=e.store_google),k(e.verbose)||(t.debug=e.verbose);var n=U({},t,e);return T(e.property_blacklist)&&(k(e.property_denylist)?n.property_denylist=e.property_blacklist:T(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:B.error(`Invalid value for property_denylist config: `+e.property_denylist)),n},Qo=class{constructor(){this.__forceAllowLocalhost=!1}get Vr(){return this.__forceAllowLocalhost}set Vr(e){B.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},$o=class t{get decideEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}get flagsEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}constructor(){this.webPerformance=new Qo,this.Jr=!1,this.version=p.LIB_VERSION,this.mi=new so,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Xo(),this.SentryIntegration=ei,this.sentryIntegration=e=>function(e,t){var n=$r(e,t);return{name:Qr,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this.Kr=!1,this.Yr=null,this.Xr=null,this.Qr=null,this.featureFlags=new za(this),this.toolbar=new ai(this),this.scrollManager=new To(this),this.pageViewManager=new ki(this),this.surveys=new po(this),this.conversations=new ho(this),this.logs=new go(this),this.experiments=new Ro(this),this.exceptions=new xa(this),this.rateLimiter=new vo(this),this.requestRouter=new Io(this),this.consent=new Vr(this),this.externalIntegrations=new Vo(this),this.people={set:(e,t,n)=>{var r=A(e)?{[e]:t}:e;this.setPersonProperties(r),n?.({})},set_once:(e,t,n)=>{var r=A(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n?.({})}},this.on(`eventCaptured`,(e=>B.info(`send "`+e?.event+`"`,e)))}init(e,n,r){if(r&&r!==Jo){var i=Go[r]??new t;return i._init(e,n,r),Go[r]=i,Go[Jo][r]=i,i}return this._init(e,n,r)}_init(t,n,r){if(n===void 0&&(n={}),k(t)||j(t))return B.critical(`PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()`),this;if(this.__loaded)return console.warn(`[PostHog.js]`,`You have already initialized PostHog! Re-initializing is a no-op`),this;this.__loaded=!0,this.config={},n.debug=this.Zr(n.debug),this.ts=n,this.es=[],n.person_profiles?this.Xr=n.person_profiles:n.process_person&&(this.Xr=n.process_person),this.set_config(U({},Xo(n.defaults),Zo(n),{name:r,token:t})),this.config.on_xhr_error&&B.error(`on_xhr_error is deprecated. Use on_request_error instead`),this.compression=n.disable_compression?void 0:J.GZipJS;var i=this.rs();this.persistence=new Va(this.config,i),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new Va(g({},this.config,{persistence:`sessionStorage`}),i);var a=g({},this.persistence.props),o=g({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.ss=new So((e=>this.ns(e)),this.config.request_queue_config),this.os=new wo(this),this.__request_queue=[];var s=this.config.cookieless_mode===`always`||this.config.cookieless_mode===`on_reject`&&this.consent.isExplicitlyOptedOut();if(s||(this.sessionManager=new ko(this),this.sessionPropsManager=new Do(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(B.info(`Deferring extension initialization to improve startup performance`),setTimeout((()=>{this.ls(s)}),0)):(B.info(`Initializing extensions synchronously`),this.ls(s)),p.DEBUG=p.DEBUG||this.config.debug,p.DEBUG&&B.info(`Starting in debug mode`,{this:this,config:n,thisC:g({},this.config),p:a,s:o}),n.bootstrap?.distinctID!==void 0){var c,l,u=this.config.get_device_id(Ar()),d=(c=n.bootstrap)!=null&&c.isIdentifiedID?u:n.bootstrap.distinctID;this.persistence.set_property(bn,(l=n.bootstrap)!=null&&l.isIdentifiedID?`identified`:`anonymous`),this.register({distinct_id:n.bootstrap.distinctID,$device_id:d})}if(this.us()){var f=Object.keys(n.bootstrap?.featureFlags||{}).filter((e=>{var t;return!((t=n.bootstrap)==null||(t=t.featureFlags)==null||!t[e])})).reduce(((e,t)=>{var r;return e[t]=((r=n.bootstrap)==null||(r=r.featureFlags)==null?void 0:r[t])||!1,e}),{}),m=Object.keys(n.bootstrap?.featureFlagPayloads||{}).filter((e=>f[e])).reduce(((e,t)=>{var r,i;return(r=n.bootstrap)!=null&&(r=r.featureFlagPayloads)!=null&&r[t]&&(e[t]=(i=n.bootstrap)==null||(i=i.featureFlagPayloads)==null?void 0:i[t]),e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:m})}if(s)this.register_once({distinct_id:On,$device_id:null},``);else if(!this.get_distinct_id()){var h=this.config.get_device_id(Ar());this.register_once({distinct_id:h,$device_id:h},``),this.persistence.set_property(bn,`anonymous`)}return W(e,`onpagehide`in self?`pagehide`:`unload`,this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?Zr(this,(()=>this.hs())):this.hs(),E(this.config._onCapture)&&this.config._onCapture!==qo&&(B.warn("onCapture is deprecated. Please use `before_send` instead"),this.on(`eventCaptured`,(e=>this.config._onCapture(e.event,e)))),this.config.ip&&B.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}ls(e){var t=performance.now();this.historyAutocapture=new Yr(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new si(this).startIfEnabledOrStop()})),n.push((()=>{var e;this.siteApps=new Mo(this),(e=this.siteApps)==null||e.init()})),e||n.push((()=>{this.sessionRecording=new Wo(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new Cr(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new Wa(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new Oi(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new Ti(this)})),n.push((()=>{this.exceptionObserver=new qr(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new Gr(this,Wr),this.deadClicksAutocapture.startIfEnabledOrStop()})),n.push((()=>{if(this.ds){var e=this.ds;this.ds=void 0,this.Ce(e)}})),this.vs(n,t)}vs(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.vs(e,t)}),0);var n=e.shift();if(n)try{n()}catch(e){B.error(`Error initializing extension:`,e)}}var r=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?`deferred`:`synchronous`,$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&B.info(`PostHog extensions initialized (`+r+`ms)`)}Ce(e){var t,n,r,i,a,s,c,l,u;if(!o||!o.body)return B.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout((()=>{this.Ce(e)}),500);this.config.__preview_deferred_init_extensions&&(this.ds=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=b(e.supportedCompression,J.GZipJS)?J.GZipJS:b(e.supportedCompression,J.Base64)?J.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Xr?this.Xr:`identified_only`}),(n=this.siteApps)==null||n.onRemoteConfig(e),(r=this.sessionRecording)==null||r.onRemoteConfig(e),(i=this.autocapture)==null||i.onRemoteConfig(e),(a=this.heatmaps)==null||a.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(s=this.productTours)==null||s.onRemoteConfig(e),(c=this.webVitalsAutocapture)==null||c.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}hs(){try{this.config.loaded(this)}catch(e){B.critical("`loaded` function failed",e)}if(this.cs(),this.config.internal_or_test_user_hostname&&s!=null&&s.hostname){var e=s.hostname,t=this.config.internal_or_test_user_hostname;(typeof t==`string`?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===`always`)&&this.fs()}),1),this.ps=new bo(this),this.ps.load()}cs(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.ss)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Bt(this.__request_queue,(e=>this.ns(e))),this.__request_queue=[],this.cs()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this._s()&&this.capture(`$pageleave`),(e=this.ss)==null||e.unload(),(t=this.os)==null||t.unload()):this._s()&&this.capture(`$pageleave`,null,{transport:`sendBeacon`})}_send_request(e){this.__loaded&&(Yo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=da(e.url,{ip:this.config.ip?1:0}),e.headers=g({},this.config.request_headers,e.headers),e.compression=e.compression===`best-available`?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=[`sendBeacon`]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t=g({},e);t.timeout=t.timeout||6e4,t.url=da(t.url,{_:new Date().getTime().toString(),ver:p.LIB_VERSION,compression:t.compression});var n=t.transport??`fetch`,r=ma.filter((e=>!t.disableTransport||!e.transport||!t.disableTransport.includes(e.transport))),i=Yt(r,(e=>e.transport===n))?.method??r[0].method;if(!i)throw Error(`No available transport method`);i(t)})(g({},e,{callback:t=>{var n,r;(this.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&((n=(r=this.config).on_request_error)==null||n.call(r,t)),e.callback==null||e.callback(t)}}))))}ns(e){this.os?this.os.retriableRequest(e):this._send_request(e)}_execute_array(e){Ko++;try{var t,n=[],r=[],i=[];Bt(e,(e=>{e&&(t=e[0],T(t)?i.push(e):E(e)?e.call(this):T(e)&&t===`alias`?n.push(e):T(e)&&t.indexOf(`capture`)!==-1&&E(this[t])?i.push(e):r.push(e))}));var a=function(e,t){Bt(e,(function(e){if(T(e[0])){var n=t;H(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};a(n,this),a(r,this),a(i,this)}finally{Ko--}}us(){return this.config.bootstrap?.featureFlags&&Object.keys(this.config.bootstrap?.featureFlags).length>0||!1}push(e){if(Ko>0&&T(e)&&A(e[0])){var n=t.prototype[e[0]];E(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,n){if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.ss){if(this.is_capturing())if(!k(e)&&A(e)){var r=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(r&&!this.config.__preview_capture_bot_pageviews)){var i=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(i==null||!i.isRateLimited){t!=null&&t.$current_url&&!A(t?.$current_url)&&(B.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!==`$exception`||n!=null&&n.oi||B.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,o=n?.timestamp||a,s=Ar(),c={uuid:s,event:e,properties:this.calculateEventProperties(e,t||{},o,s)};e===`$pageview`&&this.config.__preview_capture_bot_pageviews&&r&&(c.event=`$bot_pageview`,c.properties.$browser_type=`bot`),i&&(c.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens),n!=null&&n.$set&&(c.$set=n?.$set);var l,u=e!==`$groupidentify`,d=this.gs(n?.$set_once,u);if(d&&(c.$set_once=d),(c=Kt(c,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,k(n?.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),e===$a.DISMISSED||e===$a.SENT){var f=t?.[eo.SURVEY_ID],p=t?.[eo.SURVEY_ITERATION];l={id:f,current_iteration:p},localStorage.getItem(io(l))||localStorage.setItem(io(l),`true`),c.$set=g({},c.$set,{[ro({id:f,current_iteration:p},e===$a.SENT?`responded`:`dismissed`)]:!0})}else e===$a.SHOWN&&(c.$set=g({},c.$set,{[eo.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=g({},c.properties.$set,c.$set);if(O(m)||this.setPersonPropertiesForFlags(m),!N(this.config.before_send)){var h=this.bs(c);if(!h)return;c=h}this.mi.emit(`eventCaptured`,c);var _={method:`POST`,url:n?._url??this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint),data:c,compression:`best-available`,batchKey:n?._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.ns(_):this.ss.enqueue(_),c}B.critical(`This capture call is ignored due to client rate limiting.`)}}else B.error(`No event name provided to posthog.capture`)}else B.uninitializedWarning(`posthog.capture`)}_addCaptureHook(e){return this.on(`eventCaptured`,(t=>e(t.event,t)))}calculateEventProperties(e,t,n,r,i){if(n||=new Date,!this.persistence||!this.sessionPersistence)return t;var a=i?void 0:this.persistence.remove_event_timer(e),s=g({},t);if(s.token=this.config.token,s.$config_defaults=this.config.defaults,(this.config.cookieless_mode==`always`||this.config.cookieless_mode==`on_reject`&&this.consent.isExplicitlyOptedOut())&&(s.$cookieless_mode=!0),e===`$snapshot`){var c=g({},this.persistence.properties(),this.sessionPersistence.properties());return s.distinct_id=c.distinct_id,(!A(s.distinct_id)&&!P(s.distinct_id)||j(s.distinct_id))&&B.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),s}var l,u=Si(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(i,n.getTime());s.$session_id=f,s.$window_id=p}this.sessionPropsManager&&U(s,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&U(s,this.sessionRecording.sdkDebugProperties),s.$sdk_debug_retry_queue_size=this.os?.length}catch(e){s.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===Po.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),l=e!==`$pageview`||i?e!==`$pageleave`||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),s=U(s,l),e===`$pageview`&&o&&(s.title=o.title),!k(a)){var m=n.getTime()-a;s.$duration=parseFloat((m/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?`bot`:`browser`),(s=U({},u,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),T(this.config.property_denylist)?H(this.config.property_denylist,(function(e){delete s[e]})):B.error(`Invalid value for property_denylist config: `+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);var h=this.config.sanitize_properties;h&&(B.error(`sanitize_properties is deprecated. Use before_send instead`),s=h(s,e));var _=this.ys();return s.$process_person_profile=_,_&&!i&&this.ws(`_calculate_event_properties`),s}gs(e,t){if(t===void 0&&(t=!0),!this.persistence||!this.ys()||this.Jr)return e;var n=U({},this.persistence.get_initial_props(),this.sessionPropsManager?.getSetOnceProps()||{},e||{}),r=this.config.sanitize_properties;return r&&(B.error(`sanitize_properties is deprecated. Use before_send instead`),n=r(n,`$set_once`)),t&&(this.Jr=!0),O(n)?void 0:n}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}xs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,n){var r=n!=null&&n.merge?this.featureFlags.getFlagVariants():{},i=n!=null&&n.merge?this.featureFlags.getFlagPayloads():{},a=g({},r,e),o=g({},i,t),s={};for(var[c,l]of Object.entries(a)){var u=typeof l==`string`;s[c]={key:c,enabled:!!u||!!l,variant:u?l:void 0,reason:void 0,metadata:k(o?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:o[c]}}}this.featureFlags.receivedFeatureFlags({flags:s})}updateEarlyAccessFeatureEnrollment(e,t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.mi.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){return this.sessionManager?.onSessionId(e)??(()=>{})}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=oo),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,n){if(!this.__loaded||!this.persistence)return B.uninitializedWarning(`posthog.identify`);if(P(e)&&(e=e.toString(),B.warn(`The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.`)),e)if([`distinct_id`,`distinctid`].includes(e.toLowerCase()))B.critical(`The string "`+e+`" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`);else if(e!==On){if(this.ws(`posthog.identify`)){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property(`$device_id`)){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},``)}e!==r&&e!==this.get_property(Zt)&&(this.unregister(Zt),this.register({distinct_id:e}));var a=(this.persistence.get_property(bn)||`anonymous`)===`anonymous`;e!==r&&a?(this.persistence.set_property(bn,`identified`),this.setPersonPropertiesForFlags(g({},n||{},t||{}),!1),this.capture(`$identify`,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.Qr=ga(e,t,n),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(vn))}}else B.critical(`The string "`+On+`" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`);else B.error(`Unique user id has not been set in posthog.identify`)}setPersonProperties(e,t){if((e||t)&&this.ws(`posthog.setPersonProperties`)){var n=ga(this.get_distinct_id(),e,t);this.Qr===n?B.info(`A duplicate setPersonProperties call was made with the same properties. It has been ignored.`):(this.setPersonPropertiesForFlags(g({},t||{},e||{})),this.capture(`$set`,{$set:e||{},$set_once:t||{}}),this.Qr=n)}}group(e,t,n){if(e&&t){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:g({},r,{[e]:t})}),n&&(this.capture(`$groupidentify`,{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),r[e]===t||n||this.reloadFeatureFlags()}else B.error(`posthog.group requires a group type and group key`)}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.ws(`posthog.setGroupPropertiesForFlags`)&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,i,a;if(B.info(`reset`),!this.__loaded)return B.uninitializedWarning(`posthog.reset`);var o=this.get_property(`$device_id`);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),(r=this.ps)==null||r.stop(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(bn,`anonymous`),(a=this.sessionManager)==null||a.resetSessionId(),this.Qr=null,this.config.cookieless_mode===`always`)this.register_once({distinct_id:On,$device_id:null},``);else{var s=this.config.get_device_id(Ar());this.register_once({distinct_id:s,$device_id:e?s:o},``)}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property(`distinct_id`)}getGroups(){return this.get_property(`$groups`)||{}}get_session_id(){return this.sessionManager?.checkAndGetSessionAndWindowId(!0).sessionId??``}get_session_replay_url(e){if(!this.sessionManager)return``;var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor(`ui`,`/project/`+this.config.token+`/replay/`+t);if(e!=null&&e.withTimestamp&&n){var i=e.timestampLookBack??10;if(!n)return r;r+=`?t=`+Math.max(Math.floor((new Date().getTime()-n)/1e3)-i,0)}return r}alias(e,t){return e===this.get_property(Xt)?(B.critical(`Attempting to create alias for existing People user - aborting.`),-2):this.ws(`posthog.alias`)?(k(t)&&(t=this.get_distinct_id()),e===t?(B.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this.xs(Zt,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){var t=g({},this.config);if(D(e)){var n,r,i,a,o,s,c,l;U(this.config,Zo(e));var u=this.rs();(n=this.persistence)==null||n.update_config(this.config,t,u),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new Va(g({},this.config,{persistence:`sessionStorage`}),u);var d=this.Zr(this.config.debug);F(d)&&(this.config.debug=d),F(this.config.debug)&&(this.config.debug?(p.DEBUG=!0,K.H()&&K.G(`ph_debug`,`true`),B.info(`set_config`,{config:e,oldConfig:t,newConfig:g({},this.config)})):(p.DEBUG=!1,K.H()&&K.V(`ph_debug`))),(r=this.exceptionObserver)==null||r.onConfigChange(),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(o=this.heatmaps)==null||o.startIfEnabled(),(s=this.exceptionObserver)==null||s.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this.$s(),(l=this.externalIntegrations)==null||l.startIfEnabledOrStop()}}startSessionRecording(e){var t=!0===e,n={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(n).some(Boolean)){var r,i,a,o,s;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),n.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),n.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger(`url`)),n.event_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger(`event`))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var n=Error(`PostHog syntheticException`),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(g({},r,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){return this.persistence?.props[e]}getSessionProperty(e){return this.sessionPersistence?.props[e]}toString(){var e=this.config.name??Jo;return e!==Jo&&(e=Jo+`.`+e),e}_isIdentified(){return this.persistence?.get_property(bn)===`identified`||this.sessionPersistence?.get_property(bn)===`identified`}ys(){var e,t;return!(this.config.person_profiles===`never`||this.config.person_profiles===`identified_only`&&!this._isIdentified()&&O(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Zt])&&((t=this.persistence)==null||(t=t.props)==null||!t[En]))}_s(){return!0===this.config.capture_pageleave||this.config.capture_pageleave===`if_capture_pageview`&&(!0===this.config.capture_pageview||this.config.capture_pageview===`history_change`)}createPersonProfile(){this.ys()||this.ws(`posthog.createPersonProfile`)&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ws(`posthog.setInternalOrTestUser`)&&this.setPersonProperties({$internal_or_test_user:!0})}ws(e){return this.config.person_profiles===`never`?(B.error(e+` was called, but process_person is set to "never". This call will be ignored.`),!1):(this.xs(En,!0),!0)}rs(){if(this.config.cookieless_mode===`always`)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode===`on_reject`;return this.config.disable_persistence||e&&!!t}$s(){var e,t,n=this.rs();return this.persistence?.ki!==n&&((e=this.persistence)==null||e.set_disabled(n)),this.sessionPersistence?.ki!==n&&((t=this.sessionPersistence)==null||t.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==`always`){var n,r;this.config.cookieless_mode===`on_reject`&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=new ko(this),this.pageViewManager=new ki(this),this.persistence&&(this.sessionPropsManager=new Do(this,this.sessionManager,this.persistence)),this.sessionRecording=new Wo(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.$s(),this.cs(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==`on_reject`&&this.surveys.loadIfEnabled(),(k(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture(e?.captureEventName??`$opt_in`,e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.fs()}else B.warn(`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`)}opt_out_capturing(){var e,t,n;this.config.cookieless_mode===`always`?B.warn(`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`):(this.config.cookieless_mode===`on_reject`&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.$s(),this.config.cookieless_mode===`on_reject`&&(this.register({distinct_id:On,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(n=this.sessionRecording)==null||n.stopRecording(),this.sessionRecording=void 0,this.fs()))}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Br.GRANTED?`granted`:e===Br.DENIED?`denied`:`pending`}is_capturing(){return this.config.cookieless_mode===`always`||(this.config.cookieless_mode===`on_reject`?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.$s()}_is_bot(){return a?No(a,this.config.custom_blocked_useragents):void 0}fs(){o&&(o.visibilityState===`visible`?this.Kr||(this.Kr=!0,this.capture(`$pageview`,{title:o.title},{send_instantly:!0}),this.Yr&&=(o.removeEventListener(`visibilitychange`,this.Yr),null)):this.Yr||(this.Yr=this.fs.bind(this),W(o,`visibilitychange`,this.Yr)))}debug(t){!1===t?(e?.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(e?.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}))}M(){var e,t,n,r,i,a,o,s=this.ts||{};return`advanced_disable_flags`in s?!!s.advanced_disable_flags:!1===this.config.advanced_disable_flags?!0===this.config.advanced_disable_decide?(B.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):(n=`advanced_disable_decide`,r=!1,i=B,a=(t=`advanced_disable_flags`)in(e=s)&&!N(e[t]),o=n in e&&!N(e[n]),a?e[t]:o?(i&&i.warn(`Config field '`+n+`' is deprecated. Please use '`+t+`' instead. The old field will be removed in a future major version.`),e[n]):r):!!this.config.advanced_disable_flags}bs(e){if(N(this.config.before_send))return e;var t=T(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),N(n)){var i=`Event '`+e.event+`' was rejected in beforeSend function`;return I(e.event)?B.warn(i+`. This can cause unexpected behavior.`):B.info(i),null}n.properties&&!O(n.properties)||B.warn(`Event '`+e.event+`' has no properties after beforeSend function, this is likely an error.`)}return n}getPageViewId(){return this.pageViewManager.Kt?.pageViewId}captureTraceFeedback(e,t){this.capture(`$ai_feedback`,{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture(`$ai_metric`,{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Zr(e){var t=F(e)&&!e,n=K.H()&&K.q(`ph_debug`)===`true`;return!t&&(!!n||e)}};(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=Wt(e.prototype[t[n]])})($o,[`identify`]);var es,ts={backgroundColor:`#ffffff`,textColor:`#1d1f27`,buttonColor:`#1d1f27`,borderRadius:8,buttonBorderRadius:6,borderColor:`#e5e7eb`,fontFamily:`system-ui`,boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},ns=function(e){return e.SHOWN=`product tour shown`,e.DISMISSED=`product tour dismissed`,e.COMPLETED=`product tour completed`,e.STEP_SHOWN=`product tour step shown`,e.STEP_COMPLETED=`product tour step completed`,e.BUTTON_CLICKED=`product tour button clicked`,e.STEP_SELECTOR_FAILED=`product tour step selector failed`,e.BANNER_CONTAINER_SELECTOR_FAILED=`product tour banner container selector failed`,e.BANNER_ACTION_CLICKED=`product tour banner action clicked`,e}({}),rs=function(e){return e.TOUR_ID=`$product_tour_id`,e.TOUR_NAME=`$product_tour_name`,e.TOUR_ITERATION=`$product_tour_iteration`,e.TOUR_RENDER_REASON=`$product_tour_render_reason`,e.TOUR_STEP_ID=`$product_tour_step_id`,e.TOUR_STEP_ORDER=`$product_tour_step_order`,e.TOUR_STEP_TYPE=`$product_tour_step_type`,e.TOUR_DISMISS_REASON=`$product_tour_dismiss_reason`,e.TOUR_BUTTON_TEXT=`$product_tour_button_text`,e.TOUR_BUTTON_ACTION=`$product_tour_button_action`,e.TOUR_BUTTON_LINK=`$product_tour_button_link`,e.TOUR_BUTTON_TOUR_ID=`$product_tour_button_tour_id`,e.TOUR_STEPS_COUNT=`$product_tour_steps_count`,e.TOUR_STEP_SELECTOR=`$product_tour_step_selector`,e.TOUR_STEP_SELECTOR_FOUND=`$product_tour_step_selector_found`,e.TOUR_STEP_ELEMENT_TAG=`$product_tour_step_element_tag`,e.TOUR_STEP_ELEMENT_ID=`$product_tour_step_element_id`,e.TOUR_STEP_ELEMENT_CLASSES=`$product_tour_step_element_classes`,e.TOUR_STEP_ELEMENT_TEXT=`$product_tour_step_element_text`,e.TOUR_ERROR=`$product_tour_error`,e.TOUR_MATCHES_COUNT=`$product_tour_matches_count`,e.TOUR_FAILURE_PHASE=`$product_tour_failure_phase`,e.TOUR_WAITED_FOR_ELEMENT=`$product_tour_waited_for_element`,e.TOUR_WAIT_DURATION_MS=`$product_tour_wait_duration_ms`,e.TOUR_BANNER_SELECTOR=`$product_tour_banner_selector`,e.TOUR_LINKED_SURVEY_ID=`$product_tour_linked_survey_id`,e.USE_MANUAL_SELECTOR=`$use_manual_selector`,e.INFERENCE_DATA_PRESENT=`$inference_data_present`,e}({}),is=(es=Go[Jo]=new $o,function(){function t(){t.done||(t.done=!0,Yo=!1,H(Go,(function(e){e._dom_loaded()})))}o!=null&&o.addEventListener?o.readyState===`complete`?t():W(o,`DOMContentLoaded`,t,{capture:!1}):e&&B.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),es);export{J as Compression,ts as DEFAULT_PRODUCT_TOUR_APPEARANCE,to as DisplaySurveyType,$o as PostHog,ns as ProductTourEventName,rs as ProductTourEventProperties,$a as SurveyEventName,eo as SurveyEventProperties,Ga as SurveyEventType,qa as SurveyPosition,Za as SurveyQuestionBranchingType,Xa as SurveyQuestionType,Qa as SurveySchedule,Ja as SurveyTabPosition,Ya as SurveyType,Ka as SurveyWidgetType,is as default,is as posthog,Ai as severityLevels};
4
+ `)).length,i=0;i<r;i++){var o=e.charCodeAt(i),s=null;o<128?n++:s=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),M(s)||(n>t&&(a+=e.substring(t,n)),a+=s,t=n=i+1)}return n>t&&(a+=e.substring(t,e.length)),a},la=!!l||!!c,ua=`text/plain`,da=function(e,t,n){n===void 0&&(n=!0);var[r,i]=e.split(`?`),a=g({},t),o=i?.split(`&`).map((e=>{var t,[r,i]=e.split(`=`),o=n&&(t=a[r])!=null?t:i;return delete a[r],r+`=`+o}))??[],s=pr(a);return s&&o.push(s),r+`?`+o.join(`&`)},fa=(e,t)=>JSON.stringify(e,((e,t)=>typeof t==`bigint`?t.toString():t),t),pa=e=>{var{data:t,compression:n}=e;if(t){if(n===J.GZipJS){var r=sa(function(e,t){var n=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var r=new Y(e.length+(e.length>>>1)),i=0,a=function(e){r[i++]=e},o=0;o<n;++o){if(i+5>r.length){var s=new Y(i+8+(n-o<<1));s.set(r),r=s}var c=e.charCodeAt(o);c<128||t?a(c):c<2048?(a(192|c>>>6),a(128|63&c)):c>55295&&c<57344?(a(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),a(128|c>>>12&63),a(128|c>>>6&63),a(128|63&c)):(a(224|c>>>12),a(128|c>>>6&63),a(128|63&c))}return Ji(r,0,i)}(fa(t)),{mtime:0}),i=new Blob([r],{type:ua});return{contentType:ua,body:i,estimatedSize:i.size}}if(n===J.Base64){var a=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:fa(e)))(function(e){var t,n,r,i,a,o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,s=0,c=0,l=``,u=[];if(!e)return e;e=ca(e);do t=(a=e.charCodeAt(s++)<<16|e.charCodeAt(s++)<<8|e.charCodeAt(s++))>>18&63,n=a>>12&63,r=a>>6&63,i=63&a,u[c++]=o.charAt(t)+o.charAt(n)+o.charAt(r)+o.charAt(i);while(s<e.length);switch(l=u.join(``),e.length%3){case 1:l=l.slice(0,-2)+`==`;break;case 2:l=l.slice(0,-1)+`=`}return l}(fa(t)));return{contentType:`application/x-www-form-urlencoded`,body:a,estimatedSize:new Blob([a]).size}}var o=fa(t);return{contentType:`application/json`,body:o,estimatedSize:new Blob([o]).size}}},ma=[];c&&ma.push({transport:`fetch`,method:e=>{var{contentType:t,body:n,estimatedSize:r}=pa(e)??{},i=new Headers;H(e.headers,(function(e,t){i.append(t,e)})),t&&i.append(`Content-Type`,t);var a=e.url,o=null;if(u){var s=new u;o={signal:s.signal,timeout:setTimeout((()=>s.abort()),e.timeout)}}c(a,g({method:e?.method||`GET`,headers:i,keepalive:e.method===`POST`&&(r||0)<52428.8,body:n,signal:o?.signal},e.fetchOptions)).then((t=>t.text().then((n=>{var r={statusCode:t.status,text:n};if(t.status===200)try{r.json=JSON.parse(n)}catch(e){B.error(e)}e.callback==null||e.callback(r)})))).catch((t=>{B.error(t),e.callback==null||e.callback({statusCode:0,error:t})})).finally((()=>o?clearTimeout(o.timeout):null))}}),l&&ma.push({transport:`XHR`,method:e=>{var t=new l;t.open(e.method||`GET`,e.url,!0);var{contentType:n,body:r}=pa(e)??{};H(e.headers,(function(e,n){t.setRequestHeader(n,e)})),n&&t.setRequestHeader(`Content-Type`,n),e.timeout&&(t.timeout=e.timeout),e.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}e.callback==null||e.callback(n)}},t.send(r)}}),a!=null&&a.sendBeacon&&ma.push({transport:`sendBeacon`,method:e=>{var t=da(e.url,{beacon:`1`});try{var{contentType:n,body:r}=pa(e)??{},i=typeof r==`string`?new Blob([r],{type:n}):r;a.sendBeacon(t,i)}catch{}}});var ha=function(e,t){if(!function(e){try{new RegExp(e)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function ga(e,t,n){return fa({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var _a={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>ha(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!ha(t,e))))),icontains:(e,t)=>t.map(va).some((t=>e.map(va).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(va).every((t=>e.map(va).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n<parseFloat(e)))}))},va=e=>e.toLowerCase();function ya(e,t){return!e||Object.entries(e).every((e=>{var[n,r]=e,i=t?.[n];if(k(i)||M(i))return!1;var a=[String(i)],o=_a[r.operator];return!!o&&o(r.values,a)}))}var ba=V(`[Error tracking]`),xa=class{constructor(e){this.Zt=[],this.ti=new dt([new Tt,new Ft,new Dt,new Et,new Nt,new Mt,new kt,new Pt],wt()),this._instance=e,this.Zt=this._instance.persistence?.get_property(nn)??[]}onRemoteConfig(e){if(`errorTracking`in e){var t=e.errorTracking?.suppressionRules??[],n=e.errorTracking?.captureExtensionExceptions;this.Zt=t,this._instance.persistence&&this._instance.persistence.register({[nn]:this.Zt,[rn]:n})}}get ii(){var e,t=!!this._instance.get_property(rn);return(e=this._instance.config.error_tracking.captureExtensionExceptions??t)!=null&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void ba.info(`Skipping exception capture because a suppression rule matched`);if(!this.ii&&this.si(t))return void ba.info(`Skipping exception capture because it was thrown by an extension`);if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void ba.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}return this._instance.capture(`$exception`,e,{_noTruncate:!0,_batchKey:`exceptionEvent`,oi:!0})}ri(e){if(e.length===0)return!1;var t=e.reduce(((e,t)=>{var{type:n,value:r}=t;return A(n)&&n.length>0&&e.$exception_types.push(n),A(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this.Zt.some((e=>{var n=e.values.map((e=>{var n=_a[e.operator],r=T(e.value)?e.value:[e.value],i=t[e.key]??[];return r.length>0&&n(r,i)}));return e.type===`OR`?n.some(Boolean):n.every(Boolean)}))}si(e){return e.flatMap((e=>e.stacktrace?.frames??[])).some((e=>e.filename&&e.filename.startsWith(`chrome-extension://`)))}ni(e){if(e.length>0){var t,n,r=e[0].stacktrace?.frames??[],i=r[r.length-1];return(t=i==null||(n=i.filename)==null?void 0:n.includes(`posthog.com/static`))!=null&&t}return!1}ei(e){return!N(e)&&T(e)}},Q=V(`[FeatureFlags]`),Sa=V(`[FeatureFlags]`,{debugEnabled:!0}),Ca=`errors_while_computing_flags`,wa=`flag_missing`,Ta=`quota_limited`,Ea=`timeout`,Da=`connection_error`,Oa=`unknown_error`,ka=e=>`api_error_`+e,Aa=`$active_feature_flags`,ja=`$override_feature_flags`,Ma=`$feature_flag_payloads`,Na=`$override_feature_flag_payloads`,Pa=`$feature_flag_request_id`,Fa=`$feature_flag_evaluated_at`,Ia=e=>{var t={};for(var[n,r]of Ht(e||{}))r&&(t[n]=r);return t},La=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>[e,t[e].variant??t[e].enabled]))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>t[e].metadata?.payload)).map((e=>[e,t[e].metadata?.payload])))):Q.warn(`Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version`),e},Ra=function(e){return e.FeatureFlags=`feature_flags`,e.Recordings=`recordings`,e}({}),za=class{constructor(e){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.ci=!1,this._instance=e,this.featureFlagEventHandlers=[]}fi(){var e=this._instance.config.evaluation_contexts??this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(Q.warn(`evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version.`),this.ci=!0),e!=null&&e.length?e.filter((e=>{var t=e&&typeof e==`string`&&e.trim().length>0;return t||Q.error(`Invalid evaluation context found:`,e,`Expected non-empty string`),t})):[]}pi(){return this.fi().length>0}get hasLoadedFlags(){return this.li}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(mn),t=this._instance.get_property(ja),n=this._instance.get_property(Na);if(!n&&!t)return e||{};var r=U({},e||{});for(var i of[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])]){var a,o,s=r[i],c=t?.[i],l=k(c)?(a=s?.enabled)!=null&&a:!!c,u=k(c)?s.variant:typeof c==`string`?c:void 0,d=n?.[i],f=g({},s,{enabled:l,variant:l?u??s?.variant:void 0});l!==s?.enabled&&(f.original_enabled=s?.enabled),u!==s?.variant&&(f.original_variant=s?.variant),d&&(f.metadata=g({},s?.metadata,{payload:d,original_payload:s==null||(o=s.metadata)==null?void 0:o.payload})),r[i]=f}return this.ai||=(Q.warn(` Overriding feature flag details!`,{flagDetails:e,overriddenPayloads:n,finalDetails:r}),!0),r}getFlagVariants(){var e=this._instance.get_property(fn),t=this._instance.get_property(ja);if(!t)return e||{};for(var n=U({},e),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this.ai||=(Q.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),!0),n}getFlagPayloads(){var e=this._instance.get_property(Ma),t=this._instance.get_property(Na);if(!t)return e||{};for(var n=U({},e||{}),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this.ai||=(Q.warn(` Overriding feature flag payloads!`,{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),!0),n}reloadFeatureFlags(){this.hi||this._instance.config.advanced_disable_feature_flags||this.gi||(this._instance.mi.emit(`featureFlagsReloading`,!0),this.gi=setTimeout((()=>{this.bi()}),5))}yi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.li||this.ui||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.hi=e}bi(e){if(this.yi(),!this._instance.M())if(this.ui)this.di=!0;else{var t=this._instance.config.token,n=this._instance.get_property(`$device_id`),r={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:g({},this._instance.persistence?.get_initial_props()||{},this._instance.get_property(hn)||{}),group_properties:this._instance.get_property(gn),timezone:bi()};M(n)||k(n)||(r.$device_id=n),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.pi()&&(r.evaluation_contexts=this.fi());var i=this._instance.config.advanced_only_evaluate_survey_feature_flags?`&only_evaluate_survey_feature_flags=true`:``,a=this._instance.requestRouter.endpointFor(`flags`,`/flags/?v=2`+i);this.ui=!0,this._instance._send_request({method:`POST`,url:a,data:r,compression:this._instance.config.disable_compression?void 0:J.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,n,i,a=!0;if(e.statusCode===200&&(this.di||(this.$anon_distinct_id=void 0),a=!1),this.ui=!1,!r.disable_flags||this.di){this.vi=!a;var o=[];e.error?e.error instanceof Error?o.push(e.error.name===`AbortError`?Ea:Da):o.push(Oa):e.statusCode!==200&&o.push(ka(e.statusCode)),(t=e.json)!=null&&t.errorsWhileComputingFlags&&o.push(Ca);var s=!((n=e.json)==null||(n=n.quotaLimited)==null||!n.includes(Ra.FeatureFlags));s&&o.push(Ta),(i=this._instance.persistence)==null||i.register({[yn]:o}),s?Q.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.`):(r.disable_flags||this.receivedFeatureFlags(e.json??{},a),this.di&&(this.di=!1,this.bi()))}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),!t.fresh||this.vi){if(this.li||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlagResult(e,t);return n?.variant??n?.enabled}Q.warn(`getFeatureFlag for key "`+e+`" failed. Feature flags didn't load in time.`)}}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFeatureFlagResult(e,{send_event:!1})?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.vi)if(this.li||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants(),r=e in n,i=n[e],a=this.getFlagPayloads()[e],o=String(i),s=this._instance.get_property(Pa)||void 0,c=this._instance.get_property(Fa)||void 0,l=this._instance.get_property(vn)||{};if((t.send_event||!(`send_event`in t))&&(!(e in l)||!l[e].includes(o))){var u,d,f,p,m,h,g,_;T(l[e])?l[e].push(o):l[e]=[o],(u=this._instance.persistence)==null||u.register({[vn]:l});var v=this.getFeatureFlagDetails(e),ee=[...this._instance.get_property(yn)??[]];k(i)&&ee.push(wa);var y={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:a||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((d=this._instance.config.bootstrap)==null||(d=d.featureFlags)==null?void 0:d[e])||null,$feature_flag_bootstrapped_payload:((f=this._instance.config.bootstrap)==null||(f=f.featureFlagPayloads)==null?void 0:f[e])||null,$used_bootstrap_value:!this.vi};k(v==null||(p=v.metadata)==null?void 0:p.version)||(y.$feature_flag_version=v.metadata.version);var b,x=(v==null||(m=v.reason)==null?void 0:m.description)??(v==null||(h=v.reason)==null?void 0:h.code);x&&(y.$feature_flag_reason=x),v!=null&&(g=v.metadata)!=null&&g.id&&(y.$feature_flag_id=v.metadata.id),k(v?.original_variant)&&k(v?.original_enabled)||(y.$feature_flag_original_response=k(v.original_variant)?v.original_enabled:v.original_variant),v!=null&&(_=v.metadata)!=null&&_.original_payload&&(y.$feature_flag_original_payload=v==null||(b=v.metadata)==null?void 0:b.original_payload),ee.length&&(y.$feature_flag_error=ee.join(`,`)),this._instance.capture(`$feature_flag_called`,y)}if(r){var S=a;if(!k(a))try{S=JSON.parse(a)}catch{}return{key:e,enabled:!!i,variant:typeof i==`string`?i:void 0,payload:S}}}else Q.warn(`getFeatureFlagResult for key "`+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var n=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.pi()&&(r.evaluation_contexts=this.fi()),this._instance._send_request({method:`POST`,url:this._instance.requestRouter.endpointFor(`flags`,`/flags/?v=2`),data:r,compression:this._instance.config.disable_compression?void 0:J.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var r=n.json?.featureFlagPayloads;t(r?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.vi){if(this.li||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return k(n)?void 0:!!n}Q.warn(`isFeatureEnabled for key "`+e+`" failed. Feature flags didn't load in time.`)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.li=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(e,t,n,r,i){n===void 0&&(n={}),r===void 0&&(r={}),i===void 0&&(i={});var a=La(e),o=a.flags,s=a.featureFlags,c=a.featureFlagPayloads;if(s){var l=e.requestId,u=e.evaluatedAt;if(T(s)){Q.warn(`v1 of the feature flags endpoint is deprecated. Please use the latest version.`);var d={};if(s)for(var f=0;f<s.length;f++)d[s[f]]=!0;t&&t.register({[Aa]:s,[fn]:d})}else{var p=s,m=c,h=o;if(e.errorsWhileComputingFlags)if(o){var _=new Set(Object.keys(o).filter((e=>{var t;return!((t=o[e])!=null&&t.failed)})));p=g({},n,Object.fromEntries(Object.entries(p).filter((e=>{var[t]=e;return _.has(t)})))),m=g({},r,Object.fromEntries(Object.entries(m||{}).filter((e=>{var[t]=e;return _.has(t)})))),h=g({},i,Object.fromEntries(Object.entries(h||{}).filter((e=>{var[t]=e;return _.has(t)}))))}else p=g({},n,p),m=g({},r,m),h=g({},i,h);t&&t.register(g({[Aa]:Object.keys(Ia(p)),[fn]:p||{},[Ma]:m||{},[mn]:h||{}},l?{[Pa]:l}:{},u?{[Fa]:u}:{}))}}})(e,this._instance.persistence,n,r,i),this.wi(t)}}override(e,t){t===void 0&&(t=!1),Q.warn(`override is deprecated. Please use overrideFeatureFlags instead.`),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Q.uninitializedWarning(`posthog.featureFlags.overrideFeatureFlags`);if(!1===e)return this._instance.persistence.unregister(ja),this._instance.persistence.unregister(Na),this.wi(),Sa.info(`All overrides cleared`);if(e&&typeof e==`object`&&(`flags`in e||`payloads`in e)){var t,n=e;if(this.ai=!!((t=n.suppressWarning)!=null&&t),`flags`in n){if(!1===n.flags)this._instance.persistence.unregister(ja),Sa.info(`Flag overrides cleared`);else if(n.flags){if(T(n.flags)){for(var r={},i=0;i<n.flags.length;i++)r[n.flags[i]]=!0;this._instance.persistence.register({[ja]:r})}else this._instance.persistence.register({[ja]:n.flags});Sa.info(`Flag overrides set`,{flags:n.flags})}}`payloads`in n&&(!1===n.payloads?(this._instance.persistence.unregister(Na),Sa.info(`Payload overrides cleared`)):n.payloads&&(this._instance.persistence.register({[Na]:n.payloads}),Sa.info(`Payload overrides set`,{payloads:n.payloads}))),this.wi();return}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.li){var{flags:t,flagVariants:n}=this.xi();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,i=(this._instance.get_property(pn)||[]).find((t=>t.flagKey===e)),a={[`$feature_enrollment/`+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture(`$feature_enrollment_update`,o),this.setPersonPropertiesForFlags(a,!1);var s=g({},this.getFlagVariants(),{[e]:t});(r=this._instance.persistence)==null||r.register({[Aa]:Object.keys(Ia(s)),[fn]:s}),this.wi()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(pn),i=n?`&`+n.map((e=>`stage=`+e)).join(`&`):``;if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/early_access_features/?token=`+this._instance.config.token+i),method:`GET`,callback:t=>{var n,r;if(t.json){var i=t.json.earlyAccessFeatures;return(n=this._instance.persistence)==null||n.unregister(pn),(r=this._instance.persistence)==null||r.register({[pn]:i}),e(i)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,n)=>(e[n]=t[n],e)),{})}}wi(e){var{flags:t,flagVariants:n}=this.xi();this.featureFlagEventHandlers.forEach((r=>r(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(hn)||{};this._instance.register({[hn]:g({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(hn)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(gn)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((t=>{n[t]=g({},n[t],e[t]),delete e[t]})),this._instance.register({[gn]:g({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(gn)||{};this._instance.register({[gn]:g({},t,{[e]:{}})})}else this._instance.unregister(gn)}reset(){this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.yi(),this.ai=!1}},Ba=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],Va=class{constructor(e,t){this.R=e,this.props={},this.$i=!1,this.Ei=(e=>{var t=``;return e.token&&(t=e.token.replace(/\+/g,`PL`).replace(/\//g,`SL`).replace(/=/g,`EQ`)),e.persistence_name?`ph_`+e.persistence_name:`ph_`+t+`_posthog`})(e),this.Y=this.Si(e),this.load(),e.debug&&B.info(`Persistence loaded`,e.persistence,g({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(t){Ba.indexOf(t.persistence.toLowerCase())===-1&&(B.critical(`Unknown persistence type `+t.persistence+`; falling back to localStorage+cookie`),t.persistence=`localStorage+cookie`);var n=function(t){t===void 0&&(t=[]);var n=[...Ir,...t];return g({},K,{W:function(e){try{var t={};try{t=G.W(e)||{}}catch{}var n=U(t,JSON.parse(K.q(e)||`{}`));return K.G(e,n),n}catch{}return null},G:function(e,t,r,i,a,o){try{K.G(e,t,void 0,void 0,o);var s={};n.forEach((e=>{t[e]&&(s[e]=t[e])})),Object.keys(s).length&&G.G(e,s,r,i,a,o)}catch(e){K.B(e)}},V:function(t,n){try{e?.localStorage.removeItem(t),G.V(t,n)}catch(e){K.B(e)}}})}(t.cookie_persisted_properties||[]),r=t.persistence.toLowerCase();return r===`localstorage`&&K.H()?K:r===`localstorage+cookie`&&n.H()?n:r===`sessionstorage`&&q.H()?q:r===`memory`?Rr:r===`cookie`?G:n.H()?n:G}properties(){var e={};return H(this.props,(function(t,n){if(n===fn&&D(t))for(var r=Object.keys(t),a=0;a<r.length;a++)e[`$feature/`+r[a]]=t[r[a]];else s=n,c=!1,(M(o=kn)?c:i&&o.indexOf===i?o.indexOf(s)!=-1:(H(o,(function(e){if(c||=e===s)return zt})),c))||(e[n]=t);var o,s,c})),e}load(){if(!this.ki){var e=this.Y.W(this.Ei);e&&(this.props=U({},e))}}save(){this.ki||this.Y.G(this.Ei,this.props,this.Pi,this.Ti,this.Ii,this.R.debug)}remove(){this.Y.V(this.Ei,!1),this.Y.V(this.Ei,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(D(e)){k(t)&&(t=`None`),this.Pi=k(n)?this.Ci:n;var r=!1;if(H(e,((e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(D(e)){this.Pi=k(t)?this.Ci:t;var n=!1;if(H(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.$i){var e=pi(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);O(Gt(e))||this.register(e),this.$i=!0}}update_search_keyword(){var e;this.register((e=o?.referrer)?hi(e):{})}update_referrer_info(){this.register_once({$referrer:_i(),$referring_domain:o!=null&&o.referrer&&fr(o.referrer)?.host||`$direct`},void 0)}set_initial_person_info(){this.props[Cn]||this.props[wn]||this.register_once({[Tn]:vi(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};H([wn,Cn],(t=>{var n=this.props[t];n&&H(n,(function(t,n){e[`$initial_`+S(n)]=t}))}));var t,n,r=this.props[Tn];return r&&U(e,(t=yi(r),n={},H(t,(function(e,t){n[`$initial_`+S(t)]=e})),n)),e}safe_merge(e){return H(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var n=[...e].sort(),r=[...t].sort();return n.every(((e,t)=>e===r[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.Si(e),i=this.props;this.clear(),this.Y=r,this.props=i,this.save()}}set_disabled(e){this.ki=e,this.ki?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ti&&(this.Ti=e,this.remove(),this.save())}set_secure(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[Qt]||{};n[e]=t,this.props[Qt]=n,this.save()}remove_event_timer(e){var t=(this.props[Qt]||{})[e];return k(t)||(delete this.props[Qt][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},Ha=V(`[Product Tours]`),Ua=`ph_product_tours`,Wa=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){`productTours`in e&&(this._instance.persistence&&this._instance.persistence.register({[sn]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Ri||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(sn)||this.it((()=>this.Oi()))}it(e){var t,n;(t=f.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`product-tours`,(t=>{t?Ha.error(`Could not load product tours script`,t):e()}))}Oi(){var e;!this.Ri&&(e=f.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=f.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!T(this.Fi)||t){var n=this._instance.persistence;if(n){var r=n.props[Ua];if(T(r)&&!t)return this.Fi=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/product_tours/?token=`+this._instance.config.token),method:`GET`,callback:t=>{var r=t.statusCode;if(r!==200||!t.json){var i=`Product Tours API could not be loaded, status: `+r;Ha.error(i),e([],{isLoaded:!1,error:i});return}var a=T(t.json.product_tours)?t.json.product_tours:[];this.Fi=a,n&&n.register({[Ua]:a}),e(a,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){N(this.Ri)?e([],{isLoaded:!1,error:`Product tours not loaded`}):this.Ri.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ri)==null||t.showTourById(e)}previewTour(e){this.Ri?this.Ri.previewTour(e):this.it((()=>{var t;this.Oi(),(t=this.Ri)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Ri)==null||e.dismissTour(`user_clicked_skip`)}nextStep(){var e;(e=this.Ri)==null||e.nextStep()}previousStep(){var e;(e=this.Ri)==null||e.previousStep()}clearCache(){var e;this.Fi=null,(e=this._instance.persistence)==null||e.unregister(Ua)}resetTour(e){var t;(t=this.Ri)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Ri)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ri)==null||t.cancelPendingTour(e)}},Ga=function(e){return e.Activation=`events`,e.Cancellation=`cancelEvents`,e}({}),Ka=function(e){return e.Button=`button`,e.Tab=`tab`,e.Selector=`selector`,e}({}),qa=function(e){return e.TopLeft=`top_left`,e.TopRight=`top_right`,e.TopCenter=`top_center`,e.MiddleLeft=`middle_left`,e.MiddleRight=`middle_right`,e.MiddleCenter=`middle_center`,e.Left=`left`,e.Center=`center`,e.Right=`right`,e.NextToTrigger=`next_to_trigger`,e}({}),Ja=function(e){return e.Top=`top`,e.Left=`left`,e.Right=`right`,e.Bottom=`bottom`,e}({}),Ya=function(e){return e.Popover=`popover`,e.API=`api`,e.Widget=`widget`,e.ExternalSurvey=`external_survey`,e}({}),Xa=function(e){return e.Open=`open`,e.MultipleChoice=`multiple_choice`,e.SingleChoice=`single_choice`,e.Rating=`rating`,e.Link=`link`,e}({}),Za=function(e){return e.NextQuestion=`next_question`,e.End=`end`,e.ResponseBased=`response_based`,e.SpecificQuestion=`specific_question`,e}({}),Qa=function(e){return e.Once=`once`,e.Recurring=`recurring`,e.Always=`always`,e}({}),$a=function(e){return e.SHOWN=`survey shown`,e.DISMISSED=`survey dismissed`,e.SENT=`survey sent`,e.ABANDONED=`survey abandoned`,e}({}),eo=function(e){return e.SURVEY_ID=`$survey_id`,e.SURVEY_NAME=`$survey_name`,e.SURVEY_RESPONSE=`$survey_response`,e.SURVEY_ITERATION=`$survey_iteration`,e.SURVEY_ITERATION_START_DATE=`$survey_iteration_start_date`,e.SURVEY_PARTIALLY_COMPLETED=`$survey_partially_completed`,e.SURVEY_SUBMISSION_ID=`$survey_submission_id`,e.SURVEY_QUESTIONS=`$survey_questions`,e.SURVEY_COMPLETED=`$survey_completed`,e.PRODUCT_TOUR_ID=`$product_tour_id`,e.SURVEY_LAST_SEEN_DATE=`$survey_last_seen_date`,e}({}),to=function(e){return e.Popover=`popover`,e.Inline=`inline`,e}({}),$=V(`[Surveys]`),no=`seenSurvey_`,ro=(e,t)=>{var n=`$survey_`+t+`/`+e.id;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_`+t+`/`+e.id+`/`+e.current_iteration),n},io=e=>((e,t)=>{var n=``+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=``+e+t.id+`_`+t.current_iteration),n})(no,e),ao=[Ya.Popover,Ya.Widget,Ya.API],oo={ignoreConditions:!1,ignoreDelay:!1,displayType:to.Popover},so=class{constructor(){this.Mi={},this.Mi={}}on(e,t){return this.Mi[e]||(this.Mi[e]=[]),this.Mi[e].push(t),()=>{this.Mi[e]=this.Mi[e].filter((e=>e!==t))}}emit(e,t){for(var n of this.Mi[e]||[])n(t);for(var r of this.Mi[`*`]||[])r(e,t)}};function co(e,t,n){if(N(e))return!1;switch(n){case`exact`:return e===t;case`contains`:var r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/_/g,`.`).replace(/%/g,`.*`);return new RegExp(r,`i`).test(e);case`regex`:try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var lo=class{constructor(e){this.Ai=new so,this.ji=(e,t)=>this.Di(e,t)&&this.Li(e,t)&&this.Ni(e,t)&&this.Ui(e,t),this.Di=(e,t)=>t==null||!t.event||e?.event===t?.event,this._instance=e,this.zi=new Set,this.Hi=new Set}init(){if(!k(this._instance?._addCaptureHook)){var e;(e=this._instance)==null||e._addCaptureHook(((e,t)=>{this.on(e,t)}))}}register(e){var t;if(!k(this._instance?._addCaptureHook)&&(e.forEach((e=>{var t,n;(t=this.Hi)==null||t.add(e),(n=e.steps)==null||n.forEach((e=>{var t;(t=this.zi)==null||t.add(e?.event||``)}))})),(t=this._instance)!=null&&t.autocapture)){var n,r=new Set;e.forEach((e=>{var t;(t=e.steps)==null||t.forEach((e=>{e!=null&&e.selector&&r.add(e?.selector)}))})),(n=this._instance)==null||n.autocapture.setElementSelectors(r)}}on(e,t){t!=null&&e.length!=0&&(this.zi.has(e)||this.zi.has(t?.event))&&this.Hi&&this.Hi?.size>0&&this.Hi.forEach((e=>{this.Bi(t,e)&&this.Ai.emit(`actionCaptured`,e.name)}))}qi(e){this.onAction(`actionCaptured`,(t=>e(t)))}Bi(e,t){if(t?.steps==null)return!1;for(var n of t.steps)if(this.ji(e,n))return!0;return!1}onAction(e,t){return this.Ai.on(e,t)}Li(e,t){if(t!=null&&t.url){var n,r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!=`string`||!co(r,t.url,t.url_matching||`contains`))return!1}return!0}Ni(e,t){return!!this.Wi(e,t)&&!!this.Gi(e,t)&&!!this.Vi(e,t)}Wi(e,t){var n;if(t==null||!t.href)return!0;var r=this.Ji(e);if(r.length>0)return r.some((e=>co(e.href,t.href,t.href_matching||`exact`)));var i,a=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!a&&co((i=a.match(/(?::|")href="(.*?)"/))?i[1]:``,t.href,t.href_matching||`exact`)}Gi(e,t){var n;if(t==null||!t.text)return!0;var r=this.Ji(e);if(r.length>0)return r.some((e=>co(e.text,t.text,t.text_matching||`exact`)||co(e.$el_text,t.text,t.text_matching||`exact`)));var i,a,o,s=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!s&&(i=function(e){for(var t,n=[],r=/(?::|")text="(.*?)"/g;!N(t=r.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(s),a=t.text,o=t.text_matching||`exact`,i.some((e=>co(e,a,o))))}Vi(e,t){var n,r;if(t==null||!t.selector)return!0;var i=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(i!=null&&i.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||``;if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}Ji(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Ui(e,t){return t==null||!t.properties||t.properties.length===0||ya(t.properties.reduce(((e,t)=>{var n=T(t.value)?t.value.map(String):t.value==null?[]:[String(t.value)];return e[t.key]={values:n,operator:t.operator||`exact`},e}),{}),e?.properties)}},uo=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&ya(e.propertyFilters,t?.properties)}Zi(e,t){var n=new Map;return e.forEach((e=>{var r;(r=e.conditions)==null||(r=r[t])==null||(r=r.values)==null||r.forEach((t=>{if(t!=null&&t.name){var r=n.get(t.name)||[];r.push(e.id),n.set(t.name,r)}}))})),n}te(e,t,n){var r=(n===Ga.Activation?this.Ki:this.Yi).get(e),i=[];return this.ie((e=>{i=e.filter((e=>r?.includes(e.id)))})),i.filter((r=>{var i,a=(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null?void 0:i.find((t=>t.name===e));return this.Qi(a,t)}))}register(e){k(this._instance?._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter((e=>{var t;return e.conditions?.actions&&((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null?void 0:t.length)>0}));t.length!==0&&(this.se??(this.se=new lo(this._instance),this.se.init(),this.se.qi((e=>{this.onAction(e)}))),t.forEach((e=>{var t,n,r,i,a;e.conditions&&(t=e.conditions)!=null&&t.actions&&(n=e.conditions)!=null&&(n=n.actions)!=null&&n.values&&((r=e.conditions)==null||(r=r.actions)==null||(r=r.values)==null?void 0:r.length)>0&&((i=this.se)==null||i.register(e.conditions.actions.values),(a=e.conditions)==null||(a=a.actions)==null||(a=a.values)==null||a.forEach((t=>{if(t&&t.name){var n=this.Xi.get(t.name);n&&n.push(e.id),this.Xi.set(t.name,n||[e.id])}})))})))}ee(e){var t,n=e.filter((e=>{var t;return e.conditions?.events&&((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null?void 0:t.length)>0})),r=e.filter((e=>{var t;return e.conditions?.cancelEvents&&((t=e.conditions)==null||(t=t.cancelEvents)==null||(t=t.values)==null?void 0:t.length)>0}));(n.length!==0||r.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this.Ki=this.Zi(e,Ga.Activation),this.Yi=this.Zi(e,Ga.Cancellation))}onEvent(e,t){var n,r=this.ne(),i=this.oe(),a=this.ae(),o=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[i])||[];if(a===e&&t&&o.length>0){var s,c;r.info(`event matched, removing item from activated items`,{event:e,eventPayload:t,existingActivatedItems:o});var l=(t==null||(s=t.properties)==null?void 0:s.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(l){var u=o.indexOf(l);u>=0&&(o.splice(u,1),this.le(o))}}else{if(this.Yi.has(e)){var d=this.te(e,t,Ga.Cancellation);d.length>0&&(r.info(`cancel event matched, cancelling items`,{event:e,itemsToCancel:d.map((e=>e.id))}),d.forEach((e=>{var t=o.indexOf(e.id);t>=0&&o.splice(t,1),this.ue(e.id)})),this.le(o))}if(this.Ki.has(e)){r.info(`event name matched`,{event:e,eventPayload:t,items:this.Ki.get(e)});var f=this.te(e,t,Ga.Activation);this.le(o.concat(f.map((e=>e.id))||[]))}}}onAction(e){var t,n=this.oe(),r=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[];this.Xi.has(e)&&this.le(r.concat(this.Xi.get(e)||[]))}le(e){var t,n=this.ne(),r=this.oe(),i=[...new Set(e)].filter((e=>!this.he(e)));n.info(`updating activated items`,{activatedItems:i}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[r]:i})}getActivatedIds(){var e,t=this.oe();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}},fo=class extends uo{constructor(e){super(e)}oe(){return`$surveys_activated`}ae(){return $a.SHOWN}ie(e){var t;(t=this._instance)==null||t.getSurveys(e)}ue(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}ne(){return $}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},po=class{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(N(t))return $.warn(`Flags not loaded yet. Not loading surveys.`);this.ve=T(t)?t.length>0:t,$.info(`flags response received, isSurveysEnabled: `+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem(`lastSeenSurveyDate`);for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(no)||n!=null&&n.startsWith(`inProgressSurvey_`))&&e.push(n)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)$.info(`Already initializing surveys, skipping...`);else if(this._instance.config.disable_surveys)$.info(`Disabled. Not loading surveys.`);else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())$.info(`Not loading surveys in cookieless mode without consent.`);else{var e=f?.__PosthogExtensions__;if(e){if(!k(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var n=e.generateSurveys;if(n)return void this._e(n,t);var r=e.loadExternalDependency;if(!r)return void this.ge(`PostHog loadExternalDependency extension not found.`);r(this._instance,`surveys`,(n=>{n||!e.generateSurveys?this.ge(`Could not load surveys script`,n):this._e(e.generateSurveys,t)}))}catch(e){throw this.ge(`Error initializing surveys`,e),e}finally{this.ce=!1}}}else $.error(`PostHog Extensions not found.`)}}_e(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new fo(this._instance),$.info(`Surveys loaded successfully`),this.me({isLoaded:!0})}ge(e,t){$.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return $.info(`Disabled. Not loading surveys.`),e([]);var n,r=this._instance.get_property(_n);if(r&&!t)return e(r,{isLoaded:!0});typeof Promise<`u`&&this.pe?this.pe.then((t=>{var{surveys:n,context:r}=t;return e(n,r)})):(typeof Promise<`u`&&(this.pe=new Promise((e=>{n=e}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/surveys/?token=`+this._instance.config.token),method:`GET`,timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var r;this.pe=null;var i=t.statusCode;if(i!==200||!t.json){var a=`Surveys API could not be loaded, status: `+i;$.error(a);var o={isLoaded:!1,error:a};e([],o),n?.({surveys:[],context:o});return}var s,c=t.json.surveys||[],l=c.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}(e)||function(e){var t;return!((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null||!t.length)}(e))));l.length>0&&((s=this._surveyEventReceiver)==null||s.register(l)),(r=this._instance.persistence)==null||r.register({[_n]:c});var u={isLoaded:!0};e(c,u),n?.({surveys:c,context:u})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){$.error(`Error in survey callback`,e)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!N(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);$.warn(`init was not called`)}be(e){var t=null;return this.getSurveys((n=>{t=n.find((t=>t.id===e))??null})),t}ye(e){if(N(this._surveyManager))return{eligible:!1,reason:`SDK is not enabled or survey functionality is not yet loaded`};var t=typeof e==`string`?this.be(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:`Survey not found`}}canRenderSurvey(e){if(N(this._surveyManager))return $.warn(`init was not called`),{visible:!1,disabledReason:`SDK is not enabled or survey functionality is not yet loaded`};var t=this.ye(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return N(this._surveyManager)?($.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:`SDK is not enabled or survey functionality is not yet loaded`})):new Promise((n=>{this.getSurveys((t=>{var r=t.find((t=>t.id===e))??null;if(r){var i=this.ye(r);n({visible:i.eligible,disabledReason:i.reason})}else n({visible:!1,disabledReason:`Survey not found`})}),t)}))}renderSurvey(e,t,n){var r;if(N(this._surveyManager))$.warn(`init was not called`);else{var i=typeof e==`string`?this.be(e):e;if(i!=null&&i.id)if(ao.includes(i.type)){var a=o?.querySelector(t);if(a)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?($.info(`Rendering survey `+i.id+` with delay of `+i.appearance.surveyPopupDelaySeconds+` seconds`),void setTimeout((()=>{var e;$.info(`Rendering survey `+i.id+` with delay of `+i.appearance?.surveyPopupDelaySeconds+` seconds`),(e=this._surveyManager)==null||e.renderSurvey(i,a,n),$.info(`Survey `+i.id+` rendered`)}),1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,a,n);$.warn(`Survey element not found`)}else $.warn(`Surveys of type `+i.type+` cannot be rendered in the app`);else $.warn(`Survey not found`)}}displaySurvey(e,t){var n;if(N(this._surveyManager))$.warn(`init was not called`);else{var r=this.be(e);if(r){var i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==to.Popover&&t.initialResponses&&$.warn(`initialResponses is only supported for popover surveys. prefill will not be applied.`),!1===t.ignoreConditions){var a=this.canRenderSurvey(r);if(!a.visible)return void $.warn(`Survey is not eligible to be displayed: `,a.disabledReason)}t.displayType===to.Inline?this.renderSurvey(i,t.selector,t.properties):this._surveyManager.handlePopoverSurvey(i,t)}else $.warn(`Survey not found`)}}cancelPendingSurvey(e){N(this._surveyManager)?$.warn(`init was not called`):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},mo=V(`[Conversations]`),ho=class{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.$e=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;N(t)||(F(t)?this.we=t:(this.we=t.enabled,this.$e=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.we=void 0,this.$e=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=f?.__PosthogExtensions__;if(e&&!k(this.we)&&this.we)if(this.$e&&this.$e.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.Ee(t),void(this.xe=!1);var n=e.loadExternalDependency;if(!n)return void this.Se(`PostHog loadExternalDependency extension not found.`);n(this._instance,`conversations`,(t=>{t||!e.initConversations?this.Se(`Could not load conversations script`,t):this.Ee(e.initConversations),this.xe=!1}))}catch(e){this.Se(`Error initializing conversations`,e),this.xe=!1}}else mo.error(`Conversations enabled but missing token in remote config.`)}}Ee(e){if(this.$e)try{this._conversationsManager=e(this.$e,this._instance),mo.info(`Conversations loaded successfully`)}catch(e){this.Se(`Error completing conversations initialization`,e)}else mo.error(`Cannot complete initialization: remote config is null`)}Se(e,t){mo.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():mo.warn(`Conversations not loaded yet.`)}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.we&&!M(this._conversationsManager)}isVisible(){var e;return(e=this._conversationsManager?.isVisible())!=null&&e}sendMessage(e,t,n){var r=this;return h((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(mo.warn(`Conversations not available yet.`),null)}))()}getMessages(e,t){var n=this;return h((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(mo.warn(`Conversations not available yet.`),null)}))()}markAsRead(e){var t=this;return h((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(mo.warn(`Conversations not available yet.`),null)}))()}getTickets(e){var t=this;return h((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(mo.warn(`Conversations not available yet.`),null)}))()}getCurrentTicketId(){return this._conversationsManager?.getCurrentTicketId()??null}getWidgetSessionId(){return this._conversationsManager?.getWidgetSessionId()??null}},go=class{constructor(e){var t;this.ke=!1,this.Pe=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ke=!0)}onRemoteConfig(e){var t=e.logs?.captureConsoleLogs;!N(t)&&t&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=V(`[logs]`),t=f?.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(this._instance,`logs`,(n=>{var r;n||(r=t.logs)==null||!r.initializeLogs?e.error(`Could not load logs script`,n):(t.logs.initializeLogs(this._instance),this.Pe=!0)})):e.error(`PostHog loadExternalDependency extension not found.`)}else e.error(`PostHog Extensions not found.`)}}},_o=V(`[RateLimiter]`),vo=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{_o.info((e||`events`)+` is quota limited.`),this.serverLimits[e]=new Date().getTime()+6e4}))}catch(e){_o.warn(`could not rate limit - continuing. Error: "`+e?.message+`"`,{text:t});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){return this.instance.config.rate_limiting?.events_per_second||10}get captureEventsBurstLimit(){return Math.max(this.instance.config.rate_limiting?.events_burst_limit||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,i=new Date().getTime(),a=this.instance.persistence?.get_property(Sn)??{tokens:n,last:i};a.tokens+=(i-a.last)/1e3*r,a.last=i,a.tokens>n&&(a.tokens=n);var o=a.tokens<1;return o||e||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture(`$$client_ingestion_warning`,{$$client_ingestion_warning_message:`posthog-js client rate limited. Config is set to `+r+` events per second and `+n+` events burst limit.`},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(t=this.instance.persistence)==null||t.set_property(Sn,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||`events`]||!1;return!1!==t&&new Date().getTime()<t}},yo=V(`[RemoteConfig]`),bo=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=f._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=f.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`remote-config`,(()=>e(this.remoteConfig))):e()}Ie(e){this._instance._send_request({method:`GET`,url:this._instance.requestRouter.endpointFor(`assets`,`/array/`+this._instance.config.token+`/config`),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return yo.info(`Using preloaded remote config`,this.remoteConfig),this.Ce(this.remoteConfig),void this.Re();if(this._instance.M())return void yo.warn(`Remote config is disabled. Falling back to local config.`);this.Te((e=>{if(!e)return yo.info(`No config found after loading remote JS config. Falling back to JSON.`),void this.Ie((e=>{this.Ce(e),this.Re()}));this.Ce(e),this.Re()}))}catch(e){yo.error(`Error loading remote config`,e)}}stop(){this.Fe&&=(clearInterval(this.Fe),void 0)}refresh(){this._instance.M()||o?.visibilityState===`hidden`||this._instance.featureFlags.reloadFeatureFlags()}Re(){this.Fe||=setInterval((()=>{this.refresh()}),3e5)}Ce(e){e||yo.error(`Failed to fetch remote config from PostHog.`),this._instance.Ce(e??{}),!1!==e?.hasFeatureFlags&&(this._instance.config.advanced_disable_feature_flags_on_first_load||this._instance.featureFlags.ensureFlagsLoaded())}},xo=3e3,So=class{constructor(e,t){this.Oe=!0,this.Me=[],this.Ae=L(t?.flush_interval_ms||xo,250,5e3,B.createLogger(`flush interval`),xo),this.je=e}enqueue(e){this.Me.push(e),this.De||this.Le()}unload(){this.Ne();var e=this.Me.length>0?this.Ue():{},t=Object.values(e);[...t.filter((e=>e.url.indexOf(`/e`)===0)),...t.filter((e=>e.url.indexOf(`/e`)!==0))].map((e=>{this.je(g({},e,{transport:`sendBeacon`}))}))}enable(){this.Oe=!1,this.Le()}Le(){var e=this;this.Oe||(this.De=setTimeout((()=>{if(this.Ne(),this.Me.length>0){var t=this.Ue(),n=function(){var n=t[r],i=new Date().getTime();n.data&&T(n.data)&&H(n.data,(e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),e.je(n)};for(var r in t)n()}}),this.Ae))}Ne(){clearTimeout(this.De),this.De=void 0}Ue(){var e={};return H(this.Me,(t=>{var n,r=t,i=(r?r.batchKey:null)||r.url;k(e[i])&&(e[i]=g({},r,{data:[]})),(n=e[i].data)==null||n.push(r.data)})),this.Me=[],e}},Co=[`retriesPerformedSoFar`],wo=class{constructor(t){this.ze=!1,this.He=3e3,this.Me=[],this._instance=t,this.Me=[],this.Be=!0,!k(e)&&`onLine`in e.navigator&&(this.Be=e.navigator.onLine,this.qe=()=>{this.Be=!0,this.Lt()},this.We=()=>{this.Be=!1},W(e,`online`,this.qe),W(e,`offline`,this.We))}get length(){return this.Me.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=_(e,Co);re(t)&&(n.url=da(n.url,{retry_count:t})),this._instance._send_request(g({},n,{callback:e=>{e.statusCode!==200&&(e.statusCode<400||e.statusCode>=500)&&(t??0)<10?this.Ge(g({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(e)}}))}Ge(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(e){var t=3e3*2**e,n=t/2,r=Math.min(18e5,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}(t),r=Date.now()+n;this.Me.push({retryAt:r,requestOptions:e});var i=`Enqueued failed request for retry in `+n;navigator.onLine||(i+=` (Browser is offline)`),B.warn(i),this.ze||(this.ze=!0,this.Ve())}Ve(){if(this.Je&&clearTimeout(this.Je),this.Me.length===0)return this.ze=!1,void(this.Je=void 0);this.Je=setTimeout((()=>{this.Be&&this.Me.length>0&&this.Lt(),this.Ve()}),this.He)}Lt(){var e=Date.now(),t=[],n=this.Me.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.Me=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.Je&&=(clearTimeout(this.Je),void 0),this.ze=!1,k(e)||(this.qe&&=(e.removeEventListener(`online`,this.qe),void 0),this.We&&=(e.removeEventListener(`offline`,this.We),void 0)),this.Me))try{this._instance._send_request(g({},t,{transport:`sendBeacon`}))}catch(e){B.error(e)}this.Me=[]}},To=class{constructor(e){this.Ke=()=>{this.Ye||={};var e=this.scrollElement(),t=this.scrollY(),n=e?Math.max(0,e.scrollHeight-e.clientHeight):0,r=t+(e?.clientHeight||0),i=e?.scrollHeight||0;this.Ye.lastScrollY=Math.ceil(t),this.Ye.maxScrollY=Math.max(t,this.Ye.maxScrollY??0),this.Ye.maxScrollHeight=Math.max(n,this.Ye.maxScrollHeight??0),this.Ye.lastContentY=r,this.Ye.maxContentY=Math.max(r,this.Ye.maxContentY??0),this.Ye.maxContentHeight=Math.max(i,this.Ye.maxContentHeight??0)},this._instance=e}getContext(){return this.Ye}resetContext(){var e=this.Ye;return setTimeout(this.Ke,0),e}startMeasuringScrollPosition(){W(e,`scroll`,this.Ke,{capture:!0}),W(e,`scrollend`,this.Ke,{capture:!0}),W(e,`resize`,this.Ke)}scrollElement(){if(!this._instance.config.scroll_root_selector)return e?.document.documentElement;for(var t of T(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector]){var n=e?.document.querySelector(t);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return e&&(e.scrollY||e.pageYOffset||e.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return e&&(e.scrollX||e.pageXOffset||e.document.documentElement.scrollLeft)||0}},Eo=e=>vi(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties),Do=class{constructor(e,t,n,r){this.Xe=e=>{var t=this.Qe();if(!t||t.sessionId!==e){var n={sessionId:e,props:this.Ze(this._instance)};this.tr.register({[xn]:n})}},this._instance=e,this.ir=t,this.tr=n,this.Ze=r||Eo,this.ir.onSessionId(this.Xe)}Qe(){return this.tr.props[xn]}getSetOnceProps(){var e=this.Qe()?.props;return e?`r`in e?yi(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var e={};return H(Gt(this.getSetOnceProps()),((t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_`+S(n)]=t})),e}},Oo=V(`[SessionId]`),ko=class{on(e,t){return this.er.on(e,t)}constructor(e,t,n){var r;if(this.rr=[],this.sr=void 0,this.er=new so,this.nr=(e,t)=>!(!re(e)||!re(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error(`SessionIdManager requires a PostHogPersistence instance`);if(e.config.cookieless_mode===`always`)throw Error(`SessionIdManager cannot be used with cookieless_mode="always"`);this.R=e.config,this.tr=e.persistence,this.ar=void 0,this.lr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ur=t||Ar,this.hr=n||Ar;var i=this.R.persistence_name||this.R.token;if(this._sessionTimeoutMs=1e3*L(this.R.session_idle_timeout_seconds||1800,60,36e3,Oo.createLogger(`session_idle_timeout_seconds`),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.dr(),this.vr=`ph_`+i+`_window_id`,this.cr=`ph_`+i+`_primary_window_exists`,this.pr()){var a=q.W(this.vr),o=q.W(this.cr);a&&!o?this.ar=a:q.V(this.vr),q.G(this.cr,!0)}if((r=this.R.bootstrap)!=null&&r.sessionID)try{var s=(e=>{var t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Not a valid UUID`);if(t[12]!==`7`)throw Error(`Not a UUIDv7`);return parseInt(t.substring(0,12),16)})(this.R.bootstrap.sessionID);this._r(this.R.bootstrap.sessionID,new Date().getTime(),s)}catch(e){Oo.error(`Invalid sessionID in bootstrap`,e)}this.gr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return k(this.rr)&&(this.rr=[]),this.rr.push(e),this.lr&&e(this.lr,this.ar),()=>{this.rr=this.rr.filter((t=>t!==e))}}pr(){return this.R.persistence!==`memory`&&!this.tr.ki&&q.H()}mr(e){e!==this.ar&&(this.ar=e,this.pr()&&q.G(this.vr,e))}br(){return this.ar?this.ar:this.pr()?q.W(this.vr):null}_r(e,t,n){e===this.lr&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.lr=e,this.tr.register({[un]:[t,e,n]}))}yr(){var e=this.tr.props[un];return T(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._r(null,null,null)}destroy(){clearTimeout(this.wr),this.wr=void 0,this.sr&&e&&(e.removeEventListener(`beforeunload`,this.sr,{capture:!1}),this.sr=void 0),this.rr=[]}gr(){this.sr=()=>{this.pr()&&q.V(this.cr)},W(e,`beforeunload`,this.sr,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode===`always`)throw Error(`checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"`);var n=t||new Date().getTime(),[r,i,a]=this.yr(),o=this.br(),s=re(a)&&Math.abs(n-a)>864e5,c=!1,l=!i,u=!l&&!e&&this.nr(n,r);l||u||s?(i=this.ur(),o=this.hr(),Oo.info(`new session ID generated`,{sessionId:i,windowId:o,changeReason:{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}}),a=n,c=!0):o||(o=this.hr(),c=!0);var d=re(r)&&e&&!s?r:n,f=re(a)?a:new Date().getTime();return this.mr(o),this._r(i,d,f),e||this.dr(),c&&this.rr.forEach((e=>e(i,o,c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0))),{sessionId:i,windowId:o,sessionStartTimestamp:f,changeReason:c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0,lastActivityTimestamp:r}}dr(){clearTimeout(this.wr),this.wr=setTimeout((()=>{var[e]=this.yr();if(this.nr(new Date().getTime(),e)){var t=this.lr;this.resetSessionId(),this.er.emit(`forcedIdleReset`,{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},Ao=[`$set_once`,`$set`],jo=V(`[SiteApps]`),Mo=class{constructor(e){this._instance=e,this.$r=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Er(e,t){if(t){var n=this.globalsForEvent(t);this.$r.push(n),this.$r.length>1e3&&(this.$r=this.$r.slice(10))}}get siteAppLoaders(){var e;return(e=f._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Er.bind(this));this.Sr=()=>{e(),this.$r=[],this.Sr=void 0}}}globalsForEvent(e){if(!e)throw Error(`Event payload is required`);var t={},n=this._instance.get_property(`$groups`)||[],r=this._instance.get_property(`$stored_group_properties`)||{};for(var[i,a]of Object.entries(r))t[i]={id:n[i],type:i,properties:a};var{$set_once:o,$set:s}=e;return{event:g({},_(e,Ao),{properties:g({},e.properties,s?{$set:g({},e.properties?.$set??{},s)}:{},o?{$set_once:g({},e.properties?.$set_once??{},o)}:{}),elements_chain:e.properties?.$elements_chain??``,distinct_id:e.properties?.distinct_id}),person:{properties:this._instance.get_property(`$stored_person_properties`)},groups:t}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var n;(!t.errored&&this.$r.length&&(jo.info(`Processing `+this.$r.length+` events for site app with id `+e.id),this.$r.forEach((e=>t.processEvent==null?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored)))&&((n=this.Sr)==null||n.call(this))},r=!1,i=i=>{t.errored=!i,t.loaded=!0,jo.info(`Site app with id `+e.id+` `+(i?`loaded`:`errored`)),r&&n()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:e=>{i(e)}});a&&(t.processEvent=a),r=!0}catch(t){jo.error(`Error while initializing PostHog app with config id `+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){jo.error(`Error while processing buffered events PostHog app with config id `+e.id,n),t.errored=!0}}kr(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}Pr(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(t){jo.error(`Error while processing event `+e.event+` for site app `+n.id,t)}}}onRemoteConfig(e){var t,n,r,i=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.kr(),void this._instance.on(`eventCaptured`,(e=>this.Pr(e)))):void jo.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`);if((n=this.Sr)==null||n.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var a=function(e){var t;f[`__$$ph_site_app_`+e]=i._instance,(t=f.__PosthogExtensions__)==null||t.loadSiteApp==null||t.loadSiteApp(i._instance,s,(t=>{if(t)return jo.error(`Error while initializing PostHog app with config id `+e,t)}))};for(var{id:o,url:s}of e.siteApps)a(o)}else jo.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}},No=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&y(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some((e=>y(e?.brand,t))))return!0}catch{}return!!e.webdriver},Po=function(e){return e.US=`us`,e.EU=`eu`,e.CUSTOM=`custom`,e}({}),Fo=`i.posthog.com`,Io=class{constructor(e){this.Tr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,``);return e===`https://app.posthog.com`?`https://us.i.posthog.com`:e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,``):this.apiHost}get uiHost(){var e=this.instance.config.ui_host?.replace(/\/$/,``);return e||=this.apiHost.replace(`.`+Fo,`.posthog.com`),e===`https://app.posthog.com`?`https://us.posthog.com`:e}get region(){return this.Tr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Tr[this.apiHost]=Po.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Tr[this.apiHost]=Po.EU:this.Tr[this.apiHost]=Po.CUSTOM),this.Tr[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=``),t&&=t[0]===`/`?t:`/`+t,e===`ui`)return this.uiHost+t;if(e===`flags`)return this.flagsApiHost+t;if(this.region===Po.CUSTOM)return this.apiHost+t;var n=Fo+t;switch(e){case`assets`:return`https://`+this.region+`-assets.`+n;case`api`:return`https://`+this.region+`.`+n}}},Lo={icontains:(t,n)=>!!e&&n.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,n)=>!!e&&n.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,n)=>!!e&&ha(n.href,t),not_regex:(t,n)=>!!e&&!ha(n.href,t),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},Ro=class t{constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){e===void 0&&(e=!1),n.getWebExperiments((e=>{t.Ir(`retrieved web experiments from the server`),n.Cr=new Map,e.forEach((e=>{if(e.feature_flag_key){var r;n.Cr&&(t.Ir(`setting flag key `,e.feature_flag_key,` to web experiment `,e),(r=n.Cr)==null||r.set(e.feature_flag_key,e));var i=n._instance.getFeatureFlag(e.feature_flag_key);A(i)&&e.variants[i]&&n.Rr(e.name,i,e.variants[i].transforms)}else if(e.variants)for(var a in e.variants){var o=e.variants[a];t.Fr(o)&&n.Rr(e.name,a,o.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}onFeatureFlags(e){if(this._is_bot())t.Ir(`Refusing to render web experiment since the viewer is a likely bot`);else if(!this._instance.config.disable_web_experiments){if(N(this.Cr))return this.Cr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Ir(`applying feature flags`,e),e.forEach((e=>{var t;if(this.Cr&&(t=this.Cr)!=null&&t.has(e)){var n=this._instance.getFeatureFlag(e),r=this.Cr?.get(e);n&&r!=null&&r.variants[n]&&this.Rr(r.name,n,r.variants[n].transforms)}}))}}previewWebExperiment(){var e=t.getWindowLocation();if(e!=null&&e.search){var n=mr(e?.search,`__experiment_id`),r=mr(e?.search,`__experiment_variant`);n&&r&&(t.Ir(`previewing web experiments `+n+` && `+r),this.getWebExperiments((e=>{this.Or(parseInt(n),r,e)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property(`$web_experiments`);if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/web_experiments/?token=`+this._instance.config.token),method:`GET`,callback:t=>t.statusCode!==200||!t.json?e([]):e(t.json.experiments||[])})}Or(e,n,r){var i=r.filter((t=>t.id===e));i&&i.length>0&&(t.Ir(`Previewing web experiment [`+i[0].name+`] with variant [`+n+`]`),this.Rr(i[0].name,n,i[0].variants[n].transforms))}static Fr(e){return!N(e.conditions)&&t.Mr(e)&&t.Ar(e)}static Mr(e){if(N(e.conditions)||N(e.conditions?.url))return!0;var n,r=t.getWindowLocation();return!!r&&((n=e.conditions)==null||!n.url||Lo[e.conditions?.urlMatchType??`icontains`](e.conditions.url,r))}static getWindowLocation(){return e?.location}static Ar(e){if(N(e.conditions)||N(e.conditions?.utm))return!0;var t=pi();if(t.utm_source){var n,r,i,a,o,s,c,l,u=(n=e.conditions)==null||(n=n.utm)==null||!n.utm_campaign||((r=e.conditions)==null||(r=r.utm)==null?void 0:r.utm_campaign)==t.utm_campaign,d=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==t.utm_source,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_medium||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_medium)==t.utm_medium,p=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_term)==t.utm_term;return u&&f&&p&&d}return!1}static Ir(e){var t=[...arguments].slice(1);B.info(`[WebExperiments] `+e,t)}Rr(e,n,r){this._is_bot()?t.Ir(`Refusing to render web experiment since the viewer is a likely bot`):n===`control`?t.Ir(`Control variants leave the page unmodified.`):r.forEach((r=>{r.selector&&(t.Ir(`applying transform of variant `+n+` for experiment `+e+` `,r),(document?.querySelectorAll(r.selector))?.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute(`style`,r.css)})))}))}_is_bot(){return a&&this._instance?No(a,this._instance.config.custom_blocked_useragents):void 0}},zo=V(`[PostHog ExternalIntegrations]`),Bo={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`},Vo=class{constructor(e){this._instance=e}it(e,t){var n;(n=f.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(e=>{if(e)return zo.error(`failed to load script`,e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var n,i,a;(!r||(n=f.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[t]||e.it(Bo[t],(()=>{var n;(n=f.__PosthogExtensions__)==null||(n=n.integrations)==null||(n=n[t])==null||n.start(e._instance)})),!r&&(i=f.__PosthogExtensions__)!=null&&(i=i.integrations)!=null&&i[t])&&((a=f.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[t])==null||a.stop())};for(var[n,r]of Object.entries((i=this._instance.config.integrations)??{})){var i;t(n)}}};V(`[SessionRecording]`);var Ho=`[SessionRecording]`,Uo=V(Ho),Wo=class{get started(){var e;return!((e=this.jr)==null||!e.isStarted)}get status(){return this.jr?this.jr.status:this.Dr&&!this.Lr?`disabled`:`lazy_loading`}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Dr=!1,this.Nr=!1,this.Ur=void 0,this._instance=e,!this._instance.sessionManager)throw Uo.error(`started without valid sessionManager`),Error(Ho+` started without valid sessionManager. This is a bug.`);if(this._instance.config.cookieless_mode===`always`)throw Error(Ho+` cannot be used with cookieless_mode="always"`)}get Lr(){var t,n=!((t=this._instance.get_property(ln))==null||!t.enabled),r=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return e&&n&&r&&!i}startIfEnabledOrStop(e){var t;if(!this.Lr||(t=this.jr)==null||!t.isStarted){var n=!k(Object.assign)&&!k(Array.from);this.Lr&&n?(this.zr(e),Uo.info(`starting`)):this.stopRecording()}}zr(e){var t,n,r;this.Lr&&(f!=null&&(t=f.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=f.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Hr(e):(r=f.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Br,(t=>{if(t)return Uo.error(`could not load recorder`,t);this.Hr(e)})))}stopRecording(){var e,t;(e=this.Ur)==null||e.call(this),this.Ur=void 0,(t=this.jr)==null||t.stop()}qr(){var e;(e=this._instance.persistence)==null||e.unregister(dn)}Wr(e){if(this._instance.persistence){var t,n=this._instance.persistence,r=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,r=t?.sampleRate,i=N(r)?null:parseFloat(r);N(i)&&this.qr();var a=t?.minimumDurationMilliseconds;n.register({[ln]:g({cache_timestamp:Date.now(),enabled:!!t},t,{networkPayloadCapture:g({capturePerformance:e.capturePerformance},t?.networkPayloadCapture),canvasRecording:{enabled:t?.recordCanvas,fps:t?.canvasFps,quality:t?.canvasQuality},sampleRate:i,minimumDurationMilliseconds:k(a)?null:a,endpoint:t?.endpoint,triggerMatchType:t?.triggerMatchType,masking:t?.masking,urlTriggers:t?.urlTriggers})})};r(),(t=this.Ur)==null||t.call(this),this.Ur=this._instance.sessionManager?.onSessionId(r)}}onRemoteConfig(e){`sessionRecording`in e?!1===e.sessionRecording?this.Dr=!0:(this.Nr=!1,this.Wr(e),this.Dr=!0,this.startIfEnabledOrStop()):Uo.info(`skipping remote config with no sessionRecording`,e)}log(e,t){var n;t===void 0&&(t=`log`),(n=this.jr)!=null&&n.log?this.jr.log(e,t):Uo.warn(`log called before recorder was ready`)}get Br(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ln);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}Gr(){var e=this._instance.get_property(ln);if(!e)return!1;var t=(typeof e==`object`?e:JSON.parse(e)).cache_timestamp??Date.now();return Date.now()-t<=3e5}Hr(e){var t;if((t=f.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error(`Called on script loaded before session recording is available`);this.jr||(this.jr=f.__PosthogExtensions__?.initSessionRecording(this._instance),this.jr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Gr()?this.jr.start(e):this.Nr||(this.Nr=!0,Uo.info(`persisted remote config is stale, requesting fresh config before starting`),new bo(this._instance).load())}onRRwebEmit(e){var t;(t=this.jr)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.jr||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.jr)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.jr||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.jr)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.jr||(n=this._instance.persistence)==null||n.register({[e===`url`?`$replay_override_url_trigger`:`$replay_override_event_trigger`]:!0}),(t=this.jr)==null||t.overrideTrigger(e)}get sdkDebugProperties(){return this.jr?.sdkDebugProperties||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.jr)==null||!n.tryAddCustomEvent(e,t))}},Go={},Ko=0,qo=()=>{},Jo=`posthog`,Yo=!la&&d?.indexOf(`MSIE`)===-1&&d?.indexOf(`Mozilla`)===-1,Xo=t=>{var n;return g({api_host:`https://us.i.posthog.com`,flags_api_host:null,ui_host:null,token:``,autocapture:!0,cross_subdomain_cookie:Jt(o?.location),persistence:`localStorage+cookie`,persistence_name:``,cookie_persisted_properties:[],loaded:qo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:`if_capture_pageview`,defaults:t??`unset`,__preview_deferred_init_extensions:!1,debug:s&&A(s?.search)&&s.search.indexOf(`__posthog_debug=true`)!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(e==null||(n=e.location)==null?void 0:n.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_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t=`Bad HTTP status: `+e.statusCode+` `+e.text;B.error(t)},get_device_id:e=>e,capture_performance:void 0,name:`posthog`,bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:`identified_only`,before_send:void 0,request_queue_config:{flush_interval_ms:xo},error_tracking:{},_onCapture:qo,__preview_eager_load_replay:!1},(e=>({rageclick:!(e&&e>=`2025-11-30`)||{content_ignorelist:!0},capture_pageview:!(e&&e>=`2025-05-24`)||`history_change`,session_recording:e&&e>=`2025-11-30`?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>=`2026-01-30`?`head`:`body`,internal_or_test_user_hostname:e&&e>=`2026-01-30`?/^(localhost|127\.0\.0\.1)$/:void 0}))(t))},Zo=e=>{var t={};k(e.process_person)||(t.person_profiles=e.process_person),k(e.xhr_headers)||(t.request_headers=e.xhr_headers),k(e.cookie_name)||(t.persistence_name=e.cookie_name),k(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),k(e.store_google)||(t.save_campaign_params=e.store_google),k(e.verbose)||(t.debug=e.verbose);var n=U({},t,e);return T(e.property_blacklist)&&(k(e.property_denylist)?n.property_denylist=e.property_blacklist:T(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:B.error(`Invalid value for property_denylist config: `+e.property_denylist)),n},Qo=class{constructor(){this.__forceAllowLocalhost=!1}get Vr(){return this.__forceAllowLocalhost}set Vr(e){B.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},$o=class t{get decideEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}get flagsEndpointWasHit(){var e;return(e=this.featureFlags?.hasLoadedFlags)!=null&&e}constructor(){this.webPerformance=new Qo,this.Jr=!1,this.version=p.LIB_VERSION,this.mi=new so,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Xo(),this.SentryIntegration=ei,this.sentryIntegration=e=>function(e,t){var n=$r(e,t);return{name:Qr,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this.Kr=!1,this.Yr=null,this.Xr=null,this.Qr=null,this.featureFlags=new za(this),this.toolbar=new ai(this),this.scrollManager=new To(this),this.pageViewManager=new ki(this),this.surveys=new po(this),this.conversations=new ho(this),this.logs=new go(this),this.experiments=new Ro(this),this.exceptions=new xa(this),this.rateLimiter=new vo(this),this.requestRouter=new Io(this),this.consent=new Vr(this),this.externalIntegrations=new Vo(this),this.people={set:(e,t,n)=>{var r=A(e)?{[e]:t}:e;this.setPersonProperties(r),n?.({})},set_once:(e,t,n)=>{var r=A(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n?.({})}},this.on(`eventCaptured`,(e=>B.info(`send "`+e?.event+`"`,e)))}init(e,n,r){if(r&&r!==Jo){var i=Go[r]??new t;return i._init(e,n,r),Go[r]=i,Go[Jo][r]=i,i}return this._init(e,n,r)}_init(t,n,r){if(n===void 0&&(n={}),k(t)||j(t))return B.critical(`PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()`),this;if(this.__loaded)return console.warn(`[PostHog.js]`,`You have already initialized PostHog! Re-initializing is a no-op`),this;this.__loaded=!0,this.config={},n.debug=this.Zr(n.debug),this.ts=n,this.es=[],n.person_profiles?this.Xr=n.person_profiles:n.process_person&&(this.Xr=n.process_person),this.set_config(U({},Xo(n.defaults),Zo(n),{name:r,token:t})),this.config.on_xhr_error&&B.error(`on_xhr_error is deprecated. Use on_request_error instead`),this.compression=n.disable_compression?void 0:J.GZipJS;var i=this.rs();this.persistence=new Va(this.config,i),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new Va(g({},this.config,{persistence:`sessionStorage`}),i);var a=g({},this.persistence.props),o=g({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.ss=new So((e=>this.ns(e)),this.config.request_queue_config),this.os=new wo(this),this.__request_queue=[];var s=this.config.cookieless_mode===`always`||this.config.cookieless_mode===`on_reject`&&this.consent.isExplicitlyOptedOut();if(s||(this.sessionManager=new ko(this),this.sessionPropsManager=new Do(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(B.info(`Deferring extension initialization to improve startup performance`),setTimeout((()=>{this.ls(s)}),0)):(B.info(`Initializing extensions synchronously`),this.ls(s)),p.DEBUG=p.DEBUG||this.config.debug,p.DEBUG&&B.info(`Starting in debug mode`,{this:this,config:n,thisC:g({},this.config),p:a,s:o}),n.bootstrap?.distinctID!==void 0){var c,l,u=this.config.get_device_id(Ar()),d=(c=n.bootstrap)!=null&&c.isIdentifiedID?u:n.bootstrap.distinctID;this.persistence.set_property(bn,(l=n.bootstrap)!=null&&l.isIdentifiedID?`identified`:`anonymous`),this.register({distinct_id:n.bootstrap.distinctID,$device_id:d})}if(this.us()){var f=Object.keys(n.bootstrap?.featureFlags||{}).filter((e=>{var t;return!((t=n.bootstrap)==null||(t=t.featureFlags)==null||!t[e])})).reduce(((e,t)=>{var r;return e[t]=((r=n.bootstrap)==null||(r=r.featureFlags)==null?void 0:r[t])||!1,e}),{}),m=Object.keys(n.bootstrap?.featureFlagPayloads||{}).filter((e=>f[e])).reduce(((e,t)=>{var r,i;return(r=n.bootstrap)!=null&&(r=r.featureFlagPayloads)!=null&&r[t]&&(e[t]=(i=n.bootstrap)==null||(i=i.featureFlagPayloads)==null?void 0:i[t]),e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:f,featureFlagPayloads:m})}if(s)this.register_once({distinct_id:On,$device_id:null},``);else if(!this.get_distinct_id()){var h=this.config.get_device_id(Ar());this.register_once({distinct_id:h,$device_id:h},``),this.persistence.set_property(bn,`anonymous`)}return W(e,`onpagehide`in self?`pagehide`:`unload`,this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?Zr(this,(()=>this.hs())):this.hs(),E(this.config._onCapture)&&this.config._onCapture!==qo&&(B.warn("onCapture is deprecated. Please use `before_send` instead"),this.on(`eventCaptured`,(e=>this.config._onCapture(e.event,e)))),this.config.ip&&B.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}ls(e){var t=performance.now();this.historyAutocapture=new Yr(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new si(this).startIfEnabledOrStop()})),n.push((()=>{var e;this.siteApps=new Mo(this),(e=this.siteApps)==null||e.init()})),e||n.push((()=>{this.sessionRecording=new Wo(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new Cr(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new Wa(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new Oi(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new Ti(this)})),n.push((()=>{this.exceptionObserver=new qr(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new Gr(this,Wr),this.deadClicksAutocapture.startIfEnabledOrStop()})),n.push((()=>{if(this.ds){var e=this.ds;this.ds=void 0,this.Ce(e)}})),this.vs(n,t)}vs(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.vs(e,t)}),0);var n=e.shift();if(n)try{n()}catch(e){B.error(`Error initializing extension:`,e)}}var r=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?`deferred`:`synchronous`,$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&B.info(`PostHog extensions initialized (`+r+`ms)`)}Ce(e){var t,n,r,i,a,s,c,l,u;if(!o||!o.body)return B.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout((()=>{this.Ce(e)}),500);this.config.__preview_deferred_init_extensions&&(this.ds=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=b(e.supportedCompression,J.GZipJS)?J.GZipJS:b(e.supportedCompression,J.Base64)?J.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Xr?this.Xr:`identified_only`}),(n=this.siteApps)==null||n.onRemoteConfig(e),(r=this.sessionRecording)==null||r.onRemoteConfig(e),(i=this.autocapture)==null||i.onRemoteConfig(e),(a=this.heatmaps)==null||a.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(s=this.productTours)==null||s.onRemoteConfig(e),(c=this.webVitalsAutocapture)==null||c.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}hs(){try{this.config.loaded(this)}catch(e){B.critical("`loaded` function failed",e)}if(this.cs(),this.config.internal_or_test_user_hostname&&s!=null&&s.hostname){var e=s.hostname,t=this.config.internal_or_test_user_hostname;(typeof t==`string`?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===`always`)&&this.fs()}),1),this.ps=new bo(this),this.ps.load()}cs(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.ss)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Bt(this.__request_queue,(e=>this.ns(e))),this.__request_queue=[],this.cs()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this._s()&&this.capture(`$pageleave`),(e=this.ss)==null||e.unload(),(t=this.os)==null||t.unload()):this._s()&&this.capture(`$pageleave`,null,{transport:`sendBeacon`})}_send_request(e){this.__loaded&&(Yo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=da(e.url,{ip:+!!this.config.ip}),e.headers=g({},this.config.request_headers,e.headers),e.compression=e.compression===`best-available`?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=[`sendBeacon`]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t=g({},e);t.timeout=t.timeout||6e4,t.url=da(t.url,{_:new Date().getTime().toString(),ver:p.LIB_VERSION,compression:t.compression});var n=t.transport??`fetch`,r=ma.filter((e=>!t.disableTransport||!e.transport||!t.disableTransport.includes(e.transport))),i=Yt(r,(e=>e.transport===n))?.method??r[0].method;if(!i)throw Error(`No available transport method`);i(t)})(g({},e,{callback:t=>{var n,r;(this.rateLimiter.checkForLimiting(t),t.statusCode>=400)&&((n=(r=this.config).on_request_error)==null||n.call(r,t)),e.callback==null||e.callback(t)}}))))}ns(e){this.os?this.os.retriableRequest(e):this._send_request(e)}_execute_array(e){Ko++;try{var t,n=[],r=[],i=[];Bt(e,(e=>{e&&(t=e[0],T(t)?i.push(e):E(e)?e.call(this):T(e)&&t===`alias`?n.push(e):T(e)&&t.indexOf(`capture`)!==-1&&E(this[t])?i.push(e):r.push(e))}));var a=function(e,t){Bt(e,(function(e){if(T(e[0])){var n=t;H(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};a(n,this),a(r,this),a(i,this)}finally{Ko--}}us(){return this.config.bootstrap?.featureFlags&&Object.keys(this.config.bootstrap?.featureFlags).length>0||!1}push(e){if(Ko>0&&T(e)&&A(e[0])){var n=t.prototype[e[0]];E(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,n){if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.ss){if(this.is_capturing())if(!k(e)&&A(e)){var r=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(r&&!this.config.__preview_capture_bot_pageviews)){var i=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(i==null||!i.isRateLimited){t!=null&&t.$current_url&&!A(t?.$current_url)&&(B.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!==`$exception`||n!=null&&n.oi||B.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,o=n?.timestamp||a,s=Ar(),c={uuid:s,event:e,properties:this.calculateEventProperties(e,t||{},o,s)};e===`$pageview`&&this.config.__preview_capture_bot_pageviews&&r&&(c.event=`$bot_pageview`,c.properties.$browser_type=`bot`),i&&(c.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens),n!=null&&n.$set&&(c.$set=n?.$set);var l,u=e!==`$groupidentify`,d=this.gs(n?.$set_once,u);if(d&&(c.$set_once=d),(c=Kt(c,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,k(n?.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),e===$a.DISMISSED||e===$a.SENT){var f=t?.[eo.SURVEY_ID],p=t?.[eo.SURVEY_ITERATION];l={id:f,current_iteration:p},localStorage.getItem(io(l))||localStorage.setItem(io(l),`true`),c.$set=g({},c.$set,{[ro({id:f,current_iteration:p},e===$a.SENT?`responded`:`dismissed`)]:!0})}else e===$a.SHOWN&&(c.$set=g({},c.$set,{[eo.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=g({},c.properties.$set,c.$set);if(O(m)||this.setPersonPropertiesForFlags(m),!N(this.config.before_send)){var h=this.bs(c);if(!h)return;c=h}this.mi.emit(`eventCaptured`,c);var _={method:`POST`,url:n?._url??this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint),data:c,compression:`best-available`,batchKey:n?._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.ns(_):this.ss.enqueue(_),c}B.critical(`This capture call is ignored due to client rate limiting.`)}}else B.error(`No event name provided to posthog.capture`)}else B.uninitializedWarning(`posthog.capture`)}_addCaptureHook(e){return this.on(`eventCaptured`,(t=>e(t.event,t)))}calculateEventProperties(e,t,n,r,i){if(n||=new Date,!this.persistence||!this.sessionPersistence)return t;var a=i?void 0:this.persistence.remove_event_timer(e),s=g({},t);if(s.token=this.config.token,s.$config_defaults=this.config.defaults,(this.config.cookieless_mode==`always`||this.config.cookieless_mode==`on_reject`&&this.consent.isExplicitlyOptedOut())&&(s.$cookieless_mode=!0),e===`$snapshot`){var c=g({},this.persistence.properties(),this.sessionPersistence.properties());return s.distinct_id=c.distinct_id,(!A(s.distinct_id)&&!P(s.distinct_id)||j(s.distinct_id))&&B.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),s}var l,u=Si(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(i,n.getTime());s.$session_id=f,s.$window_id=p}this.sessionPropsManager&&U(s,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&U(s,this.sessionRecording.sdkDebugProperties),s.$sdk_debug_retry_queue_size=this.os?.length}catch(e){s.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===Po.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),l=e!==`$pageview`||i?e!==`$pageleave`||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),s=U(s,l),e===`$pageview`&&o&&(s.title=o.title),!k(a)){var m=n.getTime()-a;s.$duration=parseFloat((m/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?`bot`:`browser`),(s=U({},u,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),T(this.config.property_denylist)?H(this.config.property_denylist,(function(e){delete s[e]})):B.error(`Invalid value for property_denylist config: `+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);var h=this.config.sanitize_properties;h&&(B.error(`sanitize_properties is deprecated. Use before_send instead`),s=h(s,e));var _=this.ys();return s.$process_person_profile=_,_&&!i&&this.ws(`_calculate_event_properties`),s}gs(e,t){if(t===void 0&&(t=!0),!this.persistence||!this.ys()||this.Jr)return e;var n=U({},this.persistence.get_initial_props(),this.sessionPropsManager?.getSetOnceProps()||{},e||{}),r=this.config.sanitize_properties;return r&&(B.error(`sanitize_properties is deprecated. Use before_send instead`),n=r(n,`$set_once`)),t&&(this.Jr=!0),O(n)?void 0:n}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}xs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,n){var r=n!=null&&n.merge?this.featureFlags.getFlagVariants():{},i=n!=null&&n.merge?this.featureFlags.getFlagPayloads():{},a=g({},r,e),o=g({},i,t),s={};for(var[c,l]of Object.entries(a)){var u=typeof l==`string`;s[c]={key:c,enabled:!!u||!!l,variant:u?l:void 0,reason:void 0,metadata:k(o?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:o[c]}}}this.featureFlags.receivedFeatureFlags({flags:s})}updateEarlyAccessFeatureEnrollment(e,t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.mi.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){return this.sessionManager?.onSessionId(e)??(()=>{})}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=oo),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,n){if(!this.__loaded||!this.persistence)return B.uninitializedWarning(`posthog.identify`);if(P(e)&&(e=e.toString(),B.warn(`The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.`)),e)if([`distinct_id`,`distinctid`].includes(e.toLowerCase()))B.critical(`The string "`+e+`" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`);else if(e!==On){if(this.ws(`posthog.identify`)){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property(`$device_id`)){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},``)}e!==r&&e!==this.get_property(Zt)&&(this.unregister(Zt),this.register({distinct_id:e}));var a=(this.persistence.get_property(bn)||`anonymous`)===`anonymous`;e!==r&&a?(this.persistence.set_property(bn,`identified`),this.setPersonPropertiesForFlags(g({},n||{},t||{}),!1),this.capture(`$identify`,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.Qr=ga(e,t,n),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(vn))}}else B.critical(`The string "`+On+`" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`);else B.error(`Unique user id has not been set in posthog.identify`)}setPersonProperties(e,t){if((e||t)&&this.ws(`posthog.setPersonProperties`)){var n=ga(this.get_distinct_id(),e,t);this.Qr===n?B.info(`A duplicate setPersonProperties call was made with the same properties. It has been ignored.`):(this.setPersonPropertiesForFlags(g({},t||{},e||{})),this.capture(`$set`,{$set:e||{},$set_once:t||{}}),this.Qr=n)}}group(e,t,n){if(e&&t){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:g({},r,{[e]:t})}),n&&(this.capture(`$groupidentify`,{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),r[e]===t||n||this.reloadFeatureFlags()}else B.error(`posthog.group requires a group type and group key`)}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.ws(`posthog.setGroupPropertiesForFlags`)&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,i,a;if(B.info(`reset`),!this.__loaded)return B.uninitializedWarning(`posthog.reset`);var o=this.get_property(`$device_id`);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),(r=this.ps)==null||r.stop(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(bn,`anonymous`),(a=this.sessionManager)==null||a.resetSessionId(),this.Qr=null,this.config.cookieless_mode===`always`)this.register_once({distinct_id:On,$device_id:null},``);else{var s=this.config.get_device_id(Ar());this.register_once({distinct_id:s,$device_id:e?s:o},``)}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property(`distinct_id`)}getGroups(){return this.get_property(`$groups`)||{}}get_session_id(){return this.sessionManager?.checkAndGetSessionAndWindowId(!0).sessionId??``}get_session_replay_url(e){if(!this.sessionManager)return``;var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor(`ui`,`/project/`+this.config.token+`/replay/`+t);if(e!=null&&e.withTimestamp&&n){var i=e.timestampLookBack??10;if(!n)return r;r+=`?t=`+Math.max(Math.floor((new Date().getTime()-n)/1e3)-i,0)}return r}alias(e,t){return e===this.get_property(Xt)?(B.critical(`Attempting to create alias for existing People user - aborting.`),-2):this.ws(`posthog.alias`)?(k(t)&&(t=this.get_distinct_id()),e===t?(B.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this.xs(Zt,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){var t=g({},this.config);if(D(e)){var n,r,i,a,o,s,c,l;U(this.config,Zo(e));var u=this.rs();(n=this.persistence)==null||n.update_config(this.config,t,u),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new Va(g({},this.config,{persistence:`sessionStorage`}),u);var d=this.Zr(this.config.debug);F(d)&&(this.config.debug=d),F(this.config.debug)&&(this.config.debug?(p.DEBUG=!0,K.H()&&K.G(`ph_debug`,`true`),B.info(`set_config`,{config:e,oldConfig:t,newConfig:g({},this.config)})):(p.DEBUG=!1,K.H()&&K.V(`ph_debug`))),(r=this.exceptionObserver)==null||r.onConfigChange(),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(o=this.heatmaps)==null||o.startIfEnabled(),(s=this.exceptionObserver)==null||s.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this.$s(),(l=this.externalIntegrations)==null||l.startIfEnabledOrStop()}}startSessionRecording(e){var t=!0===e,n={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(n).some(Boolean)){var r,i,a,o,s;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),n.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),n.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger(`url`)),n.event_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger(`event`))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var n=Error(`PostHog syntheticException`),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(g({},r,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){return this.persistence?.props[e]}getSessionProperty(e){return this.sessionPersistence?.props[e]}toString(){var e=this.config.name??Jo;return e!==Jo&&(e=Jo+`.`+e),e}_isIdentified(){return this.persistence?.get_property(bn)===`identified`||this.sessionPersistence?.get_property(bn)===`identified`}ys(){var e,t;return!(this.config.person_profiles===`never`||this.config.person_profiles===`identified_only`&&!this._isIdentified()&&O(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Zt])&&((t=this.persistence)==null||(t=t.props)==null||!t[En]))}_s(){return!0===this.config.capture_pageleave||this.config.capture_pageleave===`if_capture_pageview`&&(!0===this.config.capture_pageview||this.config.capture_pageview===`history_change`)}createPersonProfile(){this.ys()||this.ws(`posthog.createPersonProfile`)&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ws(`posthog.setInternalOrTestUser`)&&this.setPersonProperties({$internal_or_test_user:!0})}ws(e){return this.config.person_profiles===`never`?(B.error(e+` was called, but process_person is set to "never". This call will be ignored.`),!1):(this.xs(En,!0),!0)}rs(){if(this.config.cookieless_mode===`always`)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode===`on_reject`;return this.config.disable_persistence||e&&!!t}$s(){var e,t,n=this.rs();return this.persistence?.ki!==n&&((e=this.persistence)==null||e.set_disabled(n)),this.sessionPersistence?.ki!==n&&((t=this.sessionPersistence)==null||t.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==`always`){var n,r;this.config.cookieless_mode===`on_reject`&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=new ko(this),this.pageViewManager=new ki(this),this.persistence&&(this.sessionPropsManager=new Do(this,this.sessionManager,this.persistence)),this.sessionRecording=new Wo(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.$s(),this.cs(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==`on_reject`&&this.surveys.loadIfEnabled(),(k(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture(e?.captureEventName??`$opt_in`,e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.fs()}else B.warn(`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`)}opt_out_capturing(){var e,t,n;this.config.cookieless_mode===`always`?B.warn(`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`):(this.config.cookieless_mode===`on_reject`&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.$s(),this.config.cookieless_mode===`on_reject`&&(this.register({distinct_id:On,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(n=this.sessionRecording)==null||n.stopRecording(),this.sessionRecording=void 0,this.fs()))}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Br.GRANTED?`granted`:e===Br.DENIED?`denied`:`pending`}is_capturing(){return this.config.cookieless_mode===`always`||(this.config.cookieless_mode===`on_reject`?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.$s()}_is_bot(){return a?No(a,this.config.custom_blocked_useragents):void 0}fs(){o&&(o.visibilityState===`visible`?this.Kr||(this.Kr=!0,this.capture(`$pageview`,{title:o.title},{send_instantly:!0}),this.Yr&&=(o.removeEventListener(`visibilitychange`,this.Yr),null)):this.Yr||(this.Yr=this.fs.bind(this),W(o,`visibilitychange`,this.Yr)))}debug(t){!1===t?(e?.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(e?.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}))}M(){var e,t,n,r,i,a,o,s=this.ts||{};return`advanced_disable_flags`in s?!!s.advanced_disable_flags:!1===this.config.advanced_disable_flags?!0===this.config.advanced_disable_decide?(B.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):(n=`advanced_disable_decide`,r=!1,i=B,a=(t=`advanced_disable_flags`)in(e=s)&&!N(e[t]),o=n in e&&!N(e[n]),a?e[t]:o?(i&&i.warn(`Config field '`+n+`' is deprecated. Please use '`+t+`' instead. The old field will be removed in a future major version.`),e[n]):r):!!this.config.advanced_disable_flags}bs(e){if(N(this.config.before_send))return e;var t=T(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),N(n)){var i=`Event '`+e.event+`' was rejected in beforeSend function`;return I(e.event)?B.warn(i+`. This can cause unexpected behavior.`):B.info(i),null}n.properties&&!O(n.properties)||B.warn(`Event '`+e.event+`' has no properties after beforeSend function, this is likely an error.`)}return n}getPageViewId(){return this.pageViewManager.Kt?.pageViewId}captureTraceFeedback(e,t){this.capture(`$ai_feedback`,{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture(`$ai_metric`,{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Zr(e){var t=F(e)&&!e,n=K.H()&&K.q(`ph_debug`)===`true`;return!t&&(!!n||e)}};(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=Wt(e.prototype[t[n]])})($o,[`identify`]);var es,ts={backgroundColor:`#ffffff`,textColor:`#1d1f27`,buttonColor:`#1d1f27`,borderRadius:8,buttonBorderRadius:6,borderColor:`#e5e7eb`,fontFamily:`system-ui`,boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},ns=function(e){return e.SHOWN=`product tour shown`,e.DISMISSED=`product tour dismissed`,e.COMPLETED=`product tour completed`,e.STEP_SHOWN=`product tour step shown`,e.STEP_COMPLETED=`product tour step completed`,e.BUTTON_CLICKED=`product tour button clicked`,e.STEP_SELECTOR_FAILED=`product tour step selector failed`,e.BANNER_CONTAINER_SELECTOR_FAILED=`product tour banner container selector failed`,e.BANNER_ACTION_CLICKED=`product tour banner action clicked`,e}({}),rs=function(e){return e.TOUR_ID=`$product_tour_id`,e.TOUR_NAME=`$product_tour_name`,e.TOUR_ITERATION=`$product_tour_iteration`,e.TOUR_RENDER_REASON=`$product_tour_render_reason`,e.TOUR_STEP_ID=`$product_tour_step_id`,e.TOUR_STEP_ORDER=`$product_tour_step_order`,e.TOUR_STEP_TYPE=`$product_tour_step_type`,e.TOUR_DISMISS_REASON=`$product_tour_dismiss_reason`,e.TOUR_BUTTON_TEXT=`$product_tour_button_text`,e.TOUR_BUTTON_ACTION=`$product_tour_button_action`,e.TOUR_BUTTON_LINK=`$product_tour_button_link`,e.TOUR_BUTTON_TOUR_ID=`$product_tour_button_tour_id`,e.TOUR_STEPS_COUNT=`$product_tour_steps_count`,e.TOUR_STEP_SELECTOR=`$product_tour_step_selector`,e.TOUR_STEP_SELECTOR_FOUND=`$product_tour_step_selector_found`,e.TOUR_STEP_ELEMENT_TAG=`$product_tour_step_element_tag`,e.TOUR_STEP_ELEMENT_ID=`$product_tour_step_element_id`,e.TOUR_STEP_ELEMENT_CLASSES=`$product_tour_step_element_classes`,e.TOUR_STEP_ELEMENT_TEXT=`$product_tour_step_element_text`,e.TOUR_ERROR=`$product_tour_error`,e.TOUR_MATCHES_COUNT=`$product_tour_matches_count`,e.TOUR_FAILURE_PHASE=`$product_tour_failure_phase`,e.TOUR_WAITED_FOR_ELEMENT=`$product_tour_waited_for_element`,e.TOUR_WAIT_DURATION_MS=`$product_tour_wait_duration_ms`,e.TOUR_BANNER_SELECTOR=`$product_tour_banner_selector`,e.TOUR_LINKED_SURVEY_ID=`$product_tour_linked_survey_id`,e.USE_MANUAL_SELECTOR=`$use_manual_selector`,e.INFERENCE_DATA_PRESENT=`$inference_data_present`,e}({}),is=(es=Go[Jo]=new $o,function(){function t(){t.done||(t.done=!0,Yo=!1,H(Go,(function(e){e._dom_loaded()})))}o!=null&&o.addEventListener?o.readyState===`complete`?t():W(o,`DOMContentLoaded`,t,{capture:!1}):e&&B.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),es);export{J as Compression,ts as DEFAULT_PRODUCT_TOUR_APPEARANCE,to as DisplaySurveyType,$o as PostHog,ns as ProductTourEventName,rs as ProductTourEventProperties,$a as SurveyEventName,eo as SurveyEventProperties,Ga as SurveyEventType,qa as SurveyPosition,Za as SurveyQuestionBranchingType,Xa as SurveyQuestionType,Qa as SurveySchedule,Ja as SurveyTabPosition,Ya as SurveyType,Ka as SurveyWidgetType,is as default,is as posthog,Ai as severityLevels};