@twick/timeline 0.15.7 → 0.15.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -320,15 +320,9 @@ const createAudioTimeline = async (segments, duration) => {
320
320
  const totalFrames = Math.ceil(duration * sampleRate);
321
321
  const offline = new OfflineAudioContextCtor(2, totalFrames, sampleRate);
322
322
  for (const segment of segments) {
323
- if (segment.s >= segment.e) {
324
- console.warn(`Invalid segment: start (${segment.s}) >= end (${segment.e})`);
325
- continue;
326
- }
323
+ if (segment.s >= segment.e) continue;
327
324
  const volume = segment.volume ?? 1;
328
- if (volume <= 0) {
329
- console.warn(`Skipping muted segment: ${segment.src}`);
330
- continue;
331
- }
325
+ if (volume <= 0) continue;
332
326
  try {
333
327
  const audioBuffer = await fetchAndDecodeAudio(segment.src);
334
328
  const segmentDuration = segment.e - segment.s;
@@ -344,8 +338,7 @@ const createAudioTimeline = async (segments, duration) => {
344
338
  source.connect(offline.destination);
345
339
  }
346
340
  source.start(segment.s, 0, sourceDuration);
347
- } catch (error) {
348
- console.warn(`Failed to process segment: ${segment.src}`, error);
341
+ } catch {
349
342
  }
350
343
  }
351
344
  return await offline.startRendering();
@@ -3029,10 +3022,10 @@ class TimelineEditor {
3029
3022
  }
3030
3023
  }
3031
3024
  /**
3032
- * Add an element to a specific track using the visitor pattern
3033
- * @param track The track to add the element to
3034
- * @param element The element to add
3035
- * @returns Promise<boolean> true if element was added successfully
3025
+ * Add an element to a specific track using the visitor pattern.
3026
+ * @param track The track to add the element to.
3027
+ * @param element The element to add.
3028
+ * @returns A promise that resolves to `true` if the element was added successfully, otherwise `false`.
3036
3029
  */
3037
3030
  async addElementToTrack(track, element) {
3038
3031
  var _a;
@@ -3060,9 +3053,9 @@ class TimelineEditor {
3060
3053
  }
3061
3054
  }
3062
3055
  /**
3063
- * Remove an element from a specific track using the visitor pattern
3064
- * @param element The element to remove
3065
- * @returns boolean true if element was removed successfully
3056
+ * Remove an element from a specific track using the visitor pattern.
3057
+ * @param element The element to remove.
3058
+ * @returns `true` if the element was removed successfully, otherwise `false`.
3066
3059
  */
3067
3060
  removeElement(element) {
3068
3061
  const track = this.getTrackById(element.getTrackId());
@@ -3084,9 +3077,9 @@ class TimelineEditor {
3084
3077
  }
3085
3078
  }
3086
3079
  /**
3087
- * Update an element in a specific track using the visitor pattern
3088
- * @param element The updated element
3089
- * @returns TrackElement the updated element
3080
+ * Update an element in a specific track using the visitor pattern.
3081
+ * @param element The updated element.
3082
+ * @returns The updated `TrackElement`.
3090
3083
  */
3091
3084
  updateElement(element) {
3092
3085
  const track = this.getTrackById(element.getTrackId());
@@ -3410,7 +3403,7 @@ if (typeof window !== "undefined") {
3410
3403
  var t = "undefined" != typeof window ? window : void 0, i = "undefined" != typeof globalThis ? globalThis : t;
3411
3404
  "undefined" == typeof self && (i.self = i), "undefined" == typeof File && (i.File = function() {
3412
3405
  });
3413
- var e = Array.prototype, r = e.forEach, s = e.indexOf, n = null == i ? void 0 : i.navigator, o = null == i ? void 0 : i.document, a = null == i ? void 0 : i.location, l = null == i ? void 0 : i.fetch, u = null != i && i.XMLHttpRequest && "withCredentials" in new i.XMLHttpRequest() ? i.XMLHttpRequest : void 0, h = null == i ? void 0 : i.AbortController, d = null == n ? void 0 : n.userAgent, v = null != t ? t : {}, c = { DEBUG: false, LIB_VERSION: "1.321.2" };
3406
+ var e = Array.prototype, r = e.forEach, s = e.indexOf, n = null == i ? void 0 : i.navigator, o = null == i ? void 0 : i.document, a = null == i ? void 0 : i.location, l = null == i ? void 0 : i.fetch, u = null != i && i.XMLHttpRequest && "withCredentials" in new i.XMLHttpRequest() ? i.XMLHttpRequest : void 0, h = null == i ? void 0 : i.AbortController, d = null == n ? void 0 : n.userAgent, v = null != t ? t : {}, c = { DEBUG: false, LIB_VERSION: "1.335.5" };
3414
3407
  function f(t2, i2, e2, r2, s2, n2, o2) {
3415
3408
  try {
3416
3409
  var a2 = t2[n2](o2), l2 = a2.value;
@@ -3897,8 +3890,12 @@ var Ei = function(i2, e2) {
3897
3890
  if (r3.type = "text/javascript", r3.crossOrigin = "anonymous", r3.src = i2, r3.onload = (t3) => {
3898
3891
  r3.__posthog_loading_callback_fired = true, e2(void 0, t3);
3899
3892
  }, r3.onerror = (t3) => e2(t3), t2.config.prepare_external_dependency_script && (r3 = t2.config.prepare_external_dependency_script(r3)), !r3) return e2("prepare_external_dependency_script returned null");
3900
- var s3, n3 = o.querySelectorAll("body > script");
3901
- n3.length > 0 ? null == (s3 = n3[0].parentNode) || s3.insertBefore(r3, n3[0]) : o.body.appendChild(r3);
3893
+ if ("head" === t2.config.external_scripts_inject_target) o.head.appendChild(r3);
3894
+ else {
3895
+ var s3, n3 = o.querySelectorAll("body > script");
3896
+ if (n3.length > 0) null == (s3 = n3[0].parentNode) || s3.insertBefore(r3, n3[0]);
3897
+ else o.body.appendChild(r3);
3898
+ }
3902
3899
  };
3903
3900
  null != o && o.body ? l2() : null == o || o.addEventListener("DOMContentLoaded", l2);
3904
3901
  };
@@ -5041,8 +5038,10 @@ class ms {
5041
5038
  else this.N.url !== r2 && (this.Pt(), this.Tt = setTimeout(this.Pt, this.flushToCaptureTimeoutMs)), M(this.N.url) && (this.N.url = r2), this.N.firstMetricTimestamp = M(this.N.firstMetricTimestamp) ? Date.now() : this.N.firstMetricTimestamp, t3.attribution && t3.attribution.interactionTargetElement && (t3.attribution.interactionTargetElement = void 0), this.N.metrics.push(g({}, t3, { $current_url: r2, $session_id: e2.sessionId, $window_id: e2.windowId, timestamp: Date.now() })), this.N.metrics.length === this.allowedMetrics.length && this.Pt();
5042
5039
  }
5043
5040
  }, this.rt = () => {
5044
- var t3, i3, e2, r2, s2 = v.__PosthogExtensions__;
5045
- M(s2) || M(s2.postHogWebVitalsCallbacks) || ({ onLCP: t3, onCLS: i3, onFCP: e2, onINP: r2 } = s2.postHogWebVitalsCallbacks), t3 && i3 && e2 && r2 ? (this.allowedMetrics.indexOf("LCP") > -1 && t3(this.It.bind(this)), this.allowedMetrics.indexOf("CLS") > -1 && i3(this.It.bind(this)), this.allowedMetrics.indexOf("FCP") > -1 && e2(this.It.bind(this)), this.allowedMetrics.indexOf("INP") > -1 && r2(this.It.bind(this)), this.P = true) : gs.error("web vitals callbacks not loaded - not starting");
5041
+ if (!this.P) {
5042
+ var t3, i3, e2, r2, s2 = v.__PosthogExtensions__;
5043
+ M(s2) || M(s2.postHogWebVitalsCallbacks) || ({ onLCP: t3, onCLS: i3, onFCP: e2, onINP: r2 } = s2.postHogWebVitalsCallbacks), t3 && i3 && e2 && r2 ? (this.allowedMetrics.indexOf("LCP") > -1 && t3(this.It.bind(this)), this.allowedMetrics.indexOf("CLS") > -1 && i3(this.It.bind(this)), this.allowedMetrics.indexOf("FCP") > -1 && e2(this.It.bind(this)), this.allowedMetrics.indexOf("INP") > -1 && r2(this.It.bind(this)), this.P = true) : gs.error("web vitals callbacks not loaded - not starting");
5044
+ }
5046
5045
  }, this._instance = t2, this.kt = !(null == (i2 = this._instance.persistence) || !i2.props[Yi]), this.startIfEnabled();
5047
5046
  }
5048
5047
  get allowedMetrics() {
@@ -5052,6 +5051,10 @@ class ms {
5052
5051
  get flushToCaptureTimeoutMs() {
5053
5052
  return (R(this._instance.config.capture_performance) ? this._instance.config.capture_performance.web_vitals_delayed_flush_ms : void 0) || 5e3;
5054
5053
  }
5054
+ get useAttribution() {
5055
+ var t2 = R(this._instance.config.capture_performance) ? this._instance.config.capture_performance.web_vitals_attribution : void 0;
5056
+ return null == t2 || t2;
5057
+ }
5055
5058
  get Rt() {
5056
5059
  var t2 = R(this._instance.config.capture_performance) && L(this._instance.config.capture_performance.__web_vitals_max_value) ? this._instance.config.capture_performance.__web_vitals_max_value : _s;
5057
5060
  return 0 < t2 && t2 <= 6e4 ? _s : t2;
@@ -5071,8 +5074,13 @@ class ms {
5071
5074
  }
5072
5075
  it(t2) {
5073
5076
  var i2, e2;
5074
- null != (i2 = v.__PosthogExtensions__) && i2.postHogWebVitalsCallbacks && t2(), null == (e2 = v.__PosthogExtensions__) || null == e2.loadExternalDependency || e2.loadExternalDependency(this._instance, "web-vitals", (i3) => {
5075
- i3 ? gs.error("failed to load script", i3) : t2();
5077
+ null != (i2 = v.__PosthogExtensions__) && i2.postHogWebVitalsCallbacks ? t2() : null == (e2 = v.__PosthogExtensions__) || null == e2.loadExternalDependency || e2.loadExternalDependency(this._instance, "web-vitals", (i3) => {
5078
+ var e3;
5079
+ if (i3) gs.error("failed to load script", i3);
5080
+ else {
5081
+ var r2 = null == (e3 = v.__PosthogExtensions__) ? void 0 : e3.loadWebVitalsCallbacks;
5082
+ r2 ? (r2(this.useAttribution), t2()) : t2();
5083
+ }
5076
5084
  });
5077
5085
  }
5078
5086
  Ct() {
@@ -5628,23 +5636,23 @@ var bn = Si("[FeatureFlags]"), wn = Si("[FeatureFlags]", { debugEnabled: true })
5628
5636
  }({});
5629
5637
  class Rn {
5630
5638
  constructor(t2) {
5631
- this.oi = false, this.ai = false, this.li = false, this.ui = false, this.hi = false, this.di = false, this.vi = false, this._instance = t2, this.featureFlagEventHandlers = [];
5639
+ this.oi = false, this.ai = false, this.li = false, this.ui = false, this.hi = false, this.di = false, this.vi = false, this.ci = false, this._instance = t2, this.featureFlagEventHandlers = [];
5632
5640
  }
5633
- ci() {
5634
- var t2 = this._instance.config.evaluation_environments;
5635
- return null != t2 && t2.length ? t2.filter((t3) => {
5636
- var i2 = t3 && "string" == typeof t3 && t3.trim().length > 0;
5637
- return i2 || bn.error("Invalid evaluation environment found:", t3, "Expected non-empty string"), i2;
5641
+ fi() {
5642
+ var t2, i2 = null !== (t2 = this._instance.config.evaluation_contexts) && void 0 !== t2 ? t2 : this._instance.config.evaluation_environments;
5643
+ return !this._instance.config.evaluation_environments || this._instance.config.evaluation_contexts || this.ci || (bn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."), this.ci = true), null != i2 && i2.length ? i2.filter((t3) => {
5644
+ var i3 = t3 && "string" == typeof t3 && t3.trim().length > 0;
5645
+ return i3 || bn.error("Invalid evaluation context found:", t3, "Expected non-empty string"), i3;
5638
5646
  }) : [];
5639
5647
  }
5640
- fi() {
5641
- return this.ci().length > 0;
5648
+ pi() {
5649
+ return this.fi().length > 0;
5642
5650
  }
5643
5651
  flags() {
5644
5652
  if (this._instance.config.__preview_remote_config) this.di = true;
5645
5653
  else {
5646
- var t2 = !this.pi && (this._instance.config.advanced_disable_feature_flags || this._instance.config.advanced_disable_feature_flags_on_first_load);
5647
- this.gi({ disableFlags: t2 });
5654
+ var t2 = !this.gi && (this._instance.config.advanced_disable_feature_flags || this._instance.config.advanced_disable_feature_flags_on_first_load);
5655
+ this.mi({ disableFlags: t2 });
5648
5656
  }
5649
5657
  }
5650
5658
  get hasLoadedFlags() {
@@ -5677,15 +5685,15 @@ class Rn {
5677
5685
  return this.oi || (bn.warn(" Overriding feature flag payloads!", { flagPayloads: t2, overriddenPayloads: i2, finalPayloads: e2 }), this.oi = true), e2;
5678
5686
  }
5679
5687
  reloadFeatureFlags() {
5680
- this.ui || this._instance.config.advanced_disable_feature_flags || this.pi || (this.pi = setTimeout(() => {
5681
- this.gi();
5688
+ this.ui || this._instance.config.advanced_disable_feature_flags || this.gi || (this.gi = setTimeout(() => {
5689
+ this.mi();
5682
5690
  }, 5));
5683
5691
  }
5684
- mi() {
5685
- clearTimeout(this.pi), this.pi = void 0;
5692
+ yi() {
5693
+ clearTimeout(this.gi), this.gi = void 0;
5686
5694
  }
5687
5695
  ensureFlagsLoaded() {
5688
- this.ai || this.li || this.pi || this.reloadFeatureFlags();
5696
+ this.ai || this.li || this.gi || this.reloadFeatureFlags();
5689
5697
  }
5690
5698
  setAnonymousDistinctId(t2) {
5691
5699
  this.$anon_distinct_id = t2;
@@ -5693,21 +5701,21 @@ class Rn {
5693
5701
  setReloadingPaused(t2) {
5694
5702
  this.ui = t2;
5695
5703
  }
5696
- gi(t2) {
5704
+ mi(t2) {
5697
5705
  var i2;
5698
- if (this.mi(), !this._instance.O()) if (this.li) this.hi = true;
5706
+ if (this.yi(), !this._instance.O()) if (this.li) this.hi = true;
5699
5707
  else {
5700
5708
  var e2 = this._instance.config.token, r2 = this._instance.get_property("$device_id"), s2 = { token: e2, distinct_id: this._instance.get_distinct_id(), groups: this._instance.getGroups(), $anon_distinct_id: this.$anon_distinct_id, person_properties: g({}, (null == (i2 = this._instance.persistence) ? void 0 : i2.get_initial_props()) || {}, this._instance.get_property(oe) || {}), group_properties: this._instance.get_property(ae) };
5701
- D(r2) || M(r2) || (s2.$device_id = r2), (null != t2 && t2.disableFlags || this._instance.config.advanced_disable_feature_flags) && (s2.disable_flags = true), this.fi() && (s2.evaluation_environments = this.ci());
5709
+ D(r2) || M(r2) || (s2.$device_id = r2), (null != t2 && t2.disableFlags || this._instance.config.advanced_disable_feature_flags) && (s2.disable_flags = true), this.pi() && (s2.evaluation_contexts = this.fi());
5702
5710
  var n2 = this._instance.config.__preview_remote_config, o2 = n2 ? "/flags/?v=2" : "/flags/?v=2&config=true", a2 = this._instance.config.advanced_only_evaluate_survey_feature_flags ? "&only_evaluate_survey_feature_flags=true" : "", l2 = this._instance.requestRouter.endpointFor("flags", o2 + a2);
5703
5711
  n2 && (s2.timezone = cs()), this.li = true, this._instance._send_request({ method: "POST", url: l2, data: s2, compression: this._instance.config.disable_compression ? void 0 : $s.Base64, timeout: this._instance.config.feature_flag_request_timeout_ms, callback: (t3) => {
5704
5712
  var i3, e3, r3 = true;
5705
- (200 === t3.statusCode && (this.hi || (this.$anon_distinct_id = void 0), r3 = false), this.li = false, this.di) || (this.di = true, this._instance.yi(null !== (e3 = t3.json) && void 0 !== e3 ? e3 : {}));
5713
+ (200 === t3.statusCode && (this.hi || (this.$anon_distinct_id = void 0), r3 = false), this.li = false, this.di) || (this.di = true, this._instance.bi(null !== (e3 = t3.json) && void 0 !== e3 ? e3 : {}));
5706
5714
  if (!s2.disable_flags || this.hi) if (this.vi = !r3, t3.json && null != (i3 = t3.json.quotaLimited) && i3.includes(Cn.FeatureFlags)) bn.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.");
5707
5715
  else {
5708
5716
  var n3;
5709
5717
  if (!s2.disable_flags) this.receivedFeatureFlags(null !== (n3 = t3.json) && void 0 !== n3 ? n3 : {}, r3);
5710
- this.hi && (this.hi = false, this.gi());
5718
+ this.hi && (this.hi = false, this.mi());
5711
5719
  }
5712
5720
  } });
5713
5721
  }
@@ -5736,7 +5744,7 @@ class Rn {
5736
5744
  }
5737
5745
  getRemoteConfigPayload(t2, i2) {
5738
5746
  var e2 = this._instance.config.token, r2 = { distinct_id: this._instance.get_distinct_id(), token: e2 };
5739
- this.fi() && (r2.evaluation_environments = this.ci()), this._instance._send_request({ method: "POST", url: this._instance.requestRouter.endpointFor("flags", "/flags/?v=2&config=true"), data: r2, compression: this._instance.config.disable_compression ? void 0 : $s.Base64, timeout: this._instance.config.feature_flag_request_timeout_ms, callback: (e3) => {
5747
+ this.pi() && (r2.evaluation_contexts = this.fi()), this._instance._send_request({ method: "POST", url: this._instance.requestRouter.endpointFor("flags", "/flags/?v=2&config=true"), data: r2, compression: this._instance.config.disable_compression ? void 0 : $s.Base64, timeout: this._instance.config.feature_flag_request_timeout_ms, callback: (e3) => {
5740
5748
  var r3, s2 = null == (r3 = e3.json) ? void 0 : r3.featureFlagPayloads;
5741
5749
  i2((null == s2 ? void 0 : s2[t2]) || void 0);
5742
5750
  } });
@@ -5773,7 +5781,7 @@ class Rn {
5773
5781
  t3.errorsWhileComputingFlags && (c2 = g({}, e3, c2), f2 = g({}, r3, f2), p2 = g({}, s3, p2)), i3 && i3.register(g({ [xn]: Object.keys(Tn(c2)), [re]: c2 || {}, [$n]: f2 || {}, [ne]: p2 || {} }, u2 ? { [kn]: u2 } : {}, h2 ? { [Pn]: h2 } : {}));
5774
5782
  }
5775
5783
  }
5776
- }(t2, this._instance.persistence, e2, r2, s2), this.bi(i2);
5784
+ }(t2, this._instance.persistence, e2, r2, s2), this.wi(i2);
5777
5785
  }
5778
5786
  }
5779
5787
  override(t2, i2) {
@@ -5781,7 +5789,7 @@ class Rn {
5781
5789
  }
5782
5790
  overrideFeatureFlags(t2) {
5783
5791
  if (!this._instance.__loaded || !this._instance.persistence) return bn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");
5784
- if (false === t2) return this._instance.persistence.unregister(En), this._instance.persistence.unregister(Sn), this.bi(), wn.info("All overrides cleared");
5792
+ if (false === t2) return this._instance.persistence.unregister(En), this._instance.persistence.unregister(Sn), this.wi(), wn.info("All overrides cleared");
5785
5793
  if (t2 && "object" == typeof t2 && ("flags" in t2 || "payloads" in t2)) {
5786
5794
  var i2, e2 = t2;
5787
5795
  if (this.oi = Boolean(null !== (i2 = e2.suppressWarning) && void 0 !== i2 && i2), "flags" in e2) {
@@ -5794,13 +5802,13 @@ class Rn {
5794
5802
  wn.info("Flag overrides set", { flags: e2.flags });
5795
5803
  }
5796
5804
  }
5797
- return "payloads" in e2 && (false === e2.payloads ? (this._instance.persistence.unregister(Sn), wn.info("Payload overrides cleared")) : e2.payloads && (this._instance.persistence.register({ [Sn]: e2.payloads }), wn.info("Payload overrides set", { payloads: e2.payloads }))), void this.bi();
5805
+ return "payloads" in e2 && (false === e2.payloads ? (this._instance.persistence.unregister(Sn), wn.info("Payload overrides cleared")) : e2.payloads && (this._instance.persistence.register({ [Sn]: e2.payloads }), wn.info("Payload overrides set", { payloads: e2.payloads }))), void this.wi();
5798
5806
  }
5799
- this.bi();
5807
+ this.wi();
5800
5808
  }
5801
5809
  onFeatureFlags(t2) {
5802
5810
  if (this.addFeatureFlagsHandler(t2), this.ai) {
5803
- var { flags: i2, flagVariants: e2 } = this.wi();
5811
+ var { flags: i2, flagVariants: e2 } = this.xi();
5804
5812
  t2(i2, e2);
5805
5813
  }
5806
5814
  return () => this.removeFeatureFlagsHandler(t2);
@@ -5809,7 +5817,7 @@ class Rn {
5809
5817
  var r2, s2 = (this._instance.get_property(se) || []).find((i3) => i3.flagKey === t2), n2 = { ["$feature_enrollment/" + t2]: i2 }, o2 = { $feature_flag: t2, $feature_enrollment: i2, $set: n2 };
5810
5818
  s2 && (o2.$early_access_feature_name = s2.name), e2 && (o2.$feature_enrollment_stage = e2), this._instance.capture("$feature_enrollment_update", o2), this.setPersonPropertiesForFlags(n2, false);
5811
5819
  var a2 = g({}, this.getFlagVariants(), { [t2]: i2 });
5812
- null == (r2 = this._instance.persistence) || r2.register({ [xn]: Object.keys(Tn(a2)), [re]: a2 }), this.bi();
5820
+ null == (r2 = this._instance.persistence) || r2.register({ [xn]: Object.keys(Tn(a2)), [re]: a2 }), this.wi();
5813
5821
  }
5814
5822
  getEarlyAccessFeatures(t2, i2, e2) {
5815
5823
  void 0 === i2 && (i2 = false);
@@ -5823,12 +5831,12 @@ class Rn {
5823
5831
  }
5824
5832
  } });
5825
5833
  }
5826
- wi() {
5834
+ xi() {
5827
5835
  var t2 = this.getFlags(), i2 = this.getFlagVariants();
5828
5836
  return { flags: t2.filter((t3) => i2[t3]), flagVariants: Object.keys(i2).filter((t3) => i2[t3]).reduce((t3, e2) => (t3[e2] = i2[e2], t3), {}) };
5829
5837
  }
5830
- bi(t2) {
5831
- var { flags: i2, flagVariants: e2 } = this.wi();
5838
+ wi(t2) {
5839
+ var { flags: i2, flagVariants: e2 } = this.xi();
5832
5840
  this.featureFlagEventHandlers.forEach((r2) => r2(i2, e2, { errorsLoading: t2 }));
5833
5841
  }
5834
5842
  setPersonPropertiesForFlags(t2, i2) {
@@ -5853,21 +5861,21 @@ class Rn {
5853
5861
  } else this._instance.unregister(ae);
5854
5862
  }
5855
5863
  reset() {
5856
- this.ai = false, this.li = false, this.ui = false, this.hi = false, this.di = false, this.vi = false, this.$anon_distinct_id = void 0, this.mi(), this.oi = false;
5864
+ this.ai = false, this.li = false, this.ui = false, this.hi = false, this.di = false, this.vi = false, this.$anon_distinct_id = void 0, this.yi(), this.oi = false;
5857
5865
  }
5858
5866
  }
5859
5867
  var Fn = ["cookie", "localstorage", "localstorage+cookie", "sessionstorage", "memory"];
5860
5868
  class Mn {
5861
5869
  constructor(t2, i2) {
5862
- this.R = t2, this.props = {}, this.xi = false, this.Ei = ((t3) => {
5870
+ this.R = t2, this.props = {}, this.Ei = false, this.$i = ((t3) => {
5863
5871
  var i3 = "";
5864
5872
  return t3.token && (i3 = t3.token.replace(/\+/g, "PL").replace(/\//g, "SL").replace(/=/g, "EQ")), t3.persistence_name ? "ph_" + t3.persistence_name : "ph_" + i3 + "_posthog";
5865
- })(t2), this.Y = this.$i(t2), this.load(), t2.debug && $i.info("Persistence loaded", t2.persistence, g({}, this.props)), this.update_config(t2, t2, i2), this.save();
5873
+ })(t2), this.Y = this.Si(t2), this.load(), t2.debug && $i.info("Persistence loaded", t2.persistence, g({}, this.props)), this.update_config(t2, t2, i2), this.save();
5866
5874
  }
5867
5875
  isDisabled() {
5868
- return !!this.Si;
5876
+ return !!this.ki;
5869
5877
  }
5870
- $i(i2) {
5878
+ Si(i2) {
5871
5879
  -1 === Fn.indexOf(i2.persistence.toLowerCase()) && ($i.critical("Unknown persistence type " + i2.persistence + "; falling back to localStorage+cookie"), i2.persistence = "localStorage+cookie");
5872
5880
  var e2 = function(i3) {
5873
5881
  void 0 === i3 && (i3 = []);
@@ -5915,23 +5923,23 @@ class Mn {
5915
5923
  }), t2;
5916
5924
  }
5917
5925
  load() {
5918
- if (!this.Si) {
5919
- var t2 = this.Y.W(this.Ei);
5926
+ if (!this.ki) {
5927
+ var t2 = this.Y.W(this.$i);
5920
5928
  t2 && (this.props = Ri({}, t2));
5921
5929
  }
5922
5930
  }
5923
5931
  save() {
5924
- this.Si || this.Y.G(this.Ei, this.props, this.ki, this.Pi, this.Ti, this.R.debug);
5932
+ this.ki || this.Y.G(this.$i, this.props, this.Pi, this.Ti, this.Ii, this.R.debug);
5925
5933
  }
5926
5934
  remove() {
5927
- this.Y.V(this.Ei, false), this.Y.V(this.Ei, true);
5935
+ this.Y.V(this.$i, false), this.Y.V(this.$i, true);
5928
5936
  }
5929
5937
  clear() {
5930
5938
  this.remove(), this.props = {};
5931
5939
  }
5932
5940
  register_once(t2, i2, e2) {
5933
5941
  if (R(t2)) {
5934
- M(i2) && (i2 = "None"), this.ki = M(e2) ? this.Ii : e2;
5942
+ M(i2) && (i2 = "None"), this.Pi = M(e2) ? this.Ci : e2;
5935
5943
  var r2 = false;
5936
5944
  if (Ci(t2, (t3, e3) => {
5937
5945
  this.props.hasOwnProperty(e3) && this.props[e3] !== i2 || (this.props[e3] = t3, r2 = true);
@@ -5941,7 +5949,7 @@ class Mn {
5941
5949
  }
5942
5950
  register(t2, i2) {
5943
5951
  if (R(t2)) {
5944
- this.ki = M(i2) ? this.Ii : i2;
5952
+ this.Pi = M(i2) ? this.Ci : i2;
5945
5953
  var e2 = false;
5946
5954
  if (Ci(t2, (i3, r2) => {
5947
5955
  t2.hasOwnProperty(r2) && this.props[r2] !== i3 && (this.props[r2] = i3, e2 = true);
@@ -5953,9 +5961,9 @@ class Mn {
5953
5961
  t2 in this.props && (delete this.props[t2], this.save());
5954
5962
  }
5955
5963
  update_campaign_params() {
5956
- if (!this.xi) {
5964
+ if (!this.Ei) {
5957
5965
  var t2 = os(this.R.custom_campaign_params, this.R.mask_personal_data_properties, this.R.custom_personal_data_properties);
5958
- F(Di(t2)) || this.register(t2), this.xi = true;
5966
+ F(Di(t2)) || this.register(t2), this.Ei = true;
5959
5967
  }
5960
5968
  }
5961
5969
  update_search_keyword() {
@@ -5992,23 +6000,23 @@ class Mn {
5992
6000
  }), t2;
5993
6001
  }
5994
6002
  update_config(t2, i2, e2) {
5995
- if (this.Ii = this.ki = t2.cookie_expiration, this.set_disabled(t2.disable_persistence || !!e2), this.set_cross_subdomain(t2.cross_subdomain_cookie), this.set_secure(t2.secure_cookie), t2.persistence !== i2.persistence || !((t3, i3) => {
6003
+ if (this.Ci = this.Pi = t2.cookie_expiration, this.set_disabled(t2.disable_persistence || !!e2), this.set_cross_subdomain(t2.cross_subdomain_cookie), this.set_secure(t2.secure_cookie), t2.persistence !== i2.persistence || !((t3, i3) => {
5996
6004
  if (t3.length !== i3.length) return false;
5997
6005
  var e3 = [...t3].sort(), r3 = [...i3].sort();
5998
6006
  return e3.every((t4, i4) => t4 === r3[i4]);
5999
6007
  })(t2.cookie_persisted_properties || [], i2.cookie_persisted_properties || [])) {
6000
- var r2 = this.$i(t2), s2 = this.props;
6008
+ var r2 = this.Si(t2), s2 = this.props;
6001
6009
  this.clear(), this.Y = r2, this.props = s2, this.save();
6002
6010
  }
6003
6011
  }
6004
6012
  set_disabled(t2) {
6005
- this.Si = t2, this.Si ? this.remove() : this.save();
6013
+ this.ki = t2, this.ki ? this.remove() : this.save();
6006
6014
  }
6007
6015
  set_cross_subdomain(t2) {
6008
- t2 !== this.Pi && (this.Pi = t2, this.remove(), this.save());
6016
+ t2 !== this.Ti && (this.Ti = t2, this.remove(), this.save());
6009
6017
  }
6010
6018
  set_secure(t2) {
6011
- t2 !== this.Ti && (this.Ti = t2, this.remove(), this.save());
6019
+ t2 !== this.Ii && (this.Ii = t2, this.remove(), this.save());
6012
6020
  }
6013
6021
  set_event_timer(t2, i2) {
6014
6022
  var e2 = this.props[qi] || {};
@@ -6028,14 +6036,14 @@ class Mn {
6028
6036
  var On = Si("[Product Tours]"), An = "ph_product_tours";
6029
6037
  class Dn {
6030
6038
  constructor(t2) {
6031
- this.Ci = null, this.Ri = null, this._instance = t2;
6039
+ this.Ri = null, this.Fi = null, this._instance = t2;
6032
6040
  }
6033
6041
  onRemoteConfig(t2) {
6034
6042
  this._instance.persistence && this._instance.persistence.register({ [Qi]: !(null == t2 || !t2.productTours) }), this.loadIfEnabled();
6035
6043
  }
6036
6044
  loadIfEnabled() {
6037
6045
  var t2, i2;
6038
- this.Ci || ((t2 = this._instance).config.disable_product_tours || null == (i2 = t2.persistence) || !i2.get_property(Qi)) || this.it(() => this.Fi());
6046
+ this.Ri || ((t2 = this._instance).config.disable_product_tours || null == (i2 = t2.persistence) || !i2.get_property(Qi)) || this.it(() => this.Mi());
6039
6047
  }
6040
6048
  it(t2) {
6041
6049
  var i2, e2;
@@ -6043,16 +6051,16 @@ class Dn {
6043
6051
  i3 ? On.error("Could not load product tours script", i3) : t2();
6044
6052
  });
6045
6053
  }
6046
- Fi() {
6054
+ Mi() {
6047
6055
  var t2;
6048
- !this.Ci && null != (t2 = v.__PosthogExtensions__) && t2.generateProductTours && (this.Ci = v.__PosthogExtensions__.generateProductTours(this._instance, true));
6056
+ !this.Ri && null != (t2 = v.__PosthogExtensions__) && t2.generateProductTours && (this.Ri = v.__PosthogExtensions__.generateProductTours(this._instance, true));
6049
6057
  }
6050
6058
  getProductTours(t2, i2) {
6051
- if (void 0 === i2 && (i2 = false), !I(this.Ri) || i2) {
6059
+ if (void 0 === i2 && (i2 = false), !I(this.Fi) || i2) {
6052
6060
  var e2 = this._instance.persistence;
6053
6061
  if (e2) {
6054
6062
  var r2 = e2.props[An];
6055
- if (I(r2) && !i2) return this.Ri = r2, void t2(r2, { isLoaded: true });
6063
+ if (I(r2) && !i2) return this.Fi = r2, void t2(r2, { isLoaded: true });
6056
6064
  }
6057
6065
  this._instance._send_request({ url: this._instance.requestRouter.endpointFor("api", "/api/product_tours/?token=" + this._instance.config.token), method: "GET", callback: (i3) => {
6058
6066
  var r3 = i3.statusCode;
@@ -6061,50 +6069,50 @@ class Dn {
6061
6069
  return On.error(s2), void t2([], { isLoaded: false, error: s2 });
6062
6070
  }
6063
6071
  var n2 = I(i3.json.product_tours) ? i3.json.product_tours : [];
6064
- this.Ri = n2, e2 && e2.register({ [An]: n2 }), t2(n2, { isLoaded: true });
6072
+ this.Fi = n2, e2 && e2.register({ [An]: n2 }), t2(n2, { isLoaded: true });
6065
6073
  } });
6066
- } else t2(this.Ri, { isLoaded: true });
6074
+ } else t2(this.Fi, { isLoaded: true });
6067
6075
  }
6068
6076
  getActiveProductTours(t2) {
6069
- j(this.Ci) ? t2([], { isLoaded: false, error: "Product tours not loaded" }) : this.Ci.getActiveProductTours(t2);
6077
+ j(this.Ri) ? t2([], { isLoaded: false, error: "Product tours not loaded" }) : this.Ri.getActiveProductTours(t2);
6070
6078
  }
6071
6079
  showProductTour(t2) {
6072
6080
  var i2;
6073
- null == (i2 = this.Ci) || i2.showTourById(t2);
6081
+ null == (i2 = this.Ri) || i2.showTourById(t2);
6074
6082
  }
6075
6083
  previewTour(t2) {
6076
- this.Ci ? this.Ci.previewTour(t2) : this.it(() => {
6084
+ this.Ri ? this.Ri.previewTour(t2) : this.it(() => {
6077
6085
  var i2;
6078
- this.Fi(), null == (i2 = this.Ci) || i2.previewTour(t2);
6086
+ this.Mi(), null == (i2 = this.Ri) || i2.previewTour(t2);
6079
6087
  });
6080
6088
  }
6081
6089
  dismissProductTour() {
6082
6090
  var t2;
6083
- null == (t2 = this.Ci) || t2.dismissTour("user_clicked_skip");
6091
+ null == (t2 = this.Ri) || t2.dismissTour("user_clicked_skip");
6084
6092
  }
6085
6093
  nextStep() {
6086
6094
  var t2;
6087
- null == (t2 = this.Ci) || t2.nextStep();
6095
+ null == (t2 = this.Ri) || t2.nextStep();
6088
6096
  }
6089
6097
  previousStep() {
6090
6098
  var t2;
6091
- null == (t2 = this.Ci) || t2.previousStep();
6099
+ null == (t2 = this.Ri) || t2.previousStep();
6092
6100
  }
6093
6101
  clearCache() {
6094
6102
  var t2;
6095
- this.Ri = null, null == (t2 = this._instance.persistence) || t2.unregister(An);
6103
+ this.Fi = null, null == (t2 = this._instance.persistence) || t2.unregister(An);
6096
6104
  }
6097
6105
  resetTour(t2) {
6098
6106
  var i2;
6099
- null == (i2 = this.Ci) || i2.resetTour(t2);
6107
+ null == (i2 = this.Ri) || i2.resetTour(t2);
6100
6108
  }
6101
6109
  resetAllTours() {
6102
6110
  var t2;
6103
- null == (t2 = this.Ci) || t2.resetAllTours();
6111
+ null == (t2 = this.Ri) || t2.resetAllTours();
6104
6112
  }
6105
6113
  cancelPendingTour(t2) {
6106
6114
  var i2;
6107
- null == (i2 = this.Ci) || i2.cancelPendingTour(t2);
6115
+ null == (i2 = this.Ri) || i2.cancelPendingTour(t2);
6108
6116
  }
6109
6117
  }
6110
6118
  var jn = function(t2) {
@@ -6147,16 +6155,16 @@ var Kn = "seenSurvey_", Yn = (t2, i2) => {
6147
6155
  })(Kn, t2), Qn = [zn.Popover, zn.Widget, zn.API], Zn = { ignoreConditions: false, ignoreDelay: false, displayType: Vn.Popover };
6148
6156
  class to {
6149
6157
  constructor() {
6150
- this.Mi = {}, this.Mi = {};
6158
+ this.Oi = {}, this.Oi = {};
6151
6159
  }
6152
6160
  on(t2, i2) {
6153
- return this.Mi[t2] || (this.Mi[t2] = []), this.Mi[t2].push(i2), () => {
6154
- this.Mi[t2] = this.Mi[t2].filter((t3) => t3 !== i2);
6161
+ return this.Oi[t2] || (this.Oi[t2] = []), this.Oi[t2].push(i2), () => {
6162
+ this.Oi[t2] = this.Oi[t2].filter((t3) => t3 !== i2);
6155
6163
  };
6156
6164
  }
6157
6165
  emit(t2, i2) {
6158
- for (var e2 of this.Mi[t2] || []) e2(i2);
6159
- for (var r2 of this.Mi["*"] || []) r2(t2, i2);
6166
+ for (var e2 of this.Oi[t2] || []) e2(i2);
6167
+ for (var r2 of this.Oi["*"] || []) r2(t2, i2);
6160
6168
  }
6161
6169
  }
6162
6170
  function io(t2, i2, e2) {
@@ -6179,24 +6187,24 @@ function io(t2, i2, e2) {
6179
6187
  }
6180
6188
  class eo {
6181
6189
  constructor(t2) {
6182
- this.Oi = new to(), this.Ai = (t3, i2) => this.Di(t3, i2) && this.ji(t3, i2) && this.Li(t3, i2) && this.Ni(t3, i2), this.Di = (t3, i2) => null == i2 || !i2.event || (null == t3 ? void 0 : t3.event) === (null == i2 ? void 0 : i2.event), this._instance = t2, this.Ui = /* @__PURE__ */ new Set(), this.zi = /* @__PURE__ */ new Set();
6190
+ this.Ai = new to(), this.Di = (t3, i2) => this.ji(t3, i2) && this.Li(t3, i2) && this.Ni(t3, i2) && this.Ui(t3, i2), this.ji = (t3, i2) => null == i2 || !i2.event || (null == t3 ? void 0 : t3.event) === (null == i2 ? void 0 : i2.event), this._instance = t2, this.zi = /* @__PURE__ */ new Set(), this.Hi = /* @__PURE__ */ new Set();
6183
6191
  }
6184
6192
  init() {
6185
6193
  var t2;
6186
- if (!M(null == (t2 = this._instance) ? void 0 : t2.Hi)) {
6194
+ if (!M(null == (t2 = this._instance) ? void 0 : t2._addCaptureHook)) {
6187
6195
  var i2;
6188
- null == (i2 = this._instance) || i2.Hi((t3, i3) => {
6196
+ null == (i2 = this._instance) || i2._addCaptureHook((t3, i3) => {
6189
6197
  this.on(t3, i3);
6190
6198
  });
6191
6199
  }
6192
6200
  }
6193
6201
  register(t2) {
6194
6202
  var i2, e2;
6195
- if (!M(null == (i2 = this._instance) ? void 0 : i2.Hi) && (t2.forEach((t3) => {
6203
+ if (!M(null == (i2 = this._instance) ? void 0 : i2._addCaptureHook) && (t2.forEach((t3) => {
6196
6204
  var i3, e3;
6197
- null == (i3 = this.zi) || i3.add(t3), null == (e3 = t3.steps) || e3.forEach((t4) => {
6205
+ null == (i3 = this.Hi) || i3.add(t3), null == (e3 = t3.steps) || e3.forEach((t4) => {
6198
6206
  var i4;
6199
- null == (i4 = this.Ui) || i4.add((null == t4 ? void 0 : t4.event) || "");
6207
+ null == (i4 = this.zi) || i4.add((null == t4 ? void 0 : t4.event) || "");
6200
6208
  });
6201
6209
  }), null != (e2 = this._instance) && e2.autocapture)) {
6202
6210
  var r2, s2 = /* @__PURE__ */ new Set();
@@ -6210,8 +6218,8 @@ class eo {
6210
6218
  }
6211
6219
  on(t2, i2) {
6212
6220
  var e2;
6213
- null != i2 && 0 != t2.length && (this.Ui.has(t2) || this.Ui.has(null == i2 ? void 0 : i2.event)) && this.zi && (null == (e2 = this.zi) ? void 0 : e2.size) > 0 && this.zi.forEach((t3) => {
6214
- this.Bi(i2, t3) && this.Oi.emit("actionCaptured", t3.name);
6221
+ null != i2 && 0 != t2.length && (this.zi.has(t2) || this.zi.has(null == i2 ? void 0 : i2.event)) && this.Hi && (null == (e2 = this.Hi) ? void 0 : e2.size) > 0 && this.Hi.forEach((t3) => {
6222
+ this.Bi(i2, t3) && this.Ai.emit("actionCaptured", t3.name);
6215
6223
  });
6216
6224
  }
6217
6225
  qi(t2) {
@@ -6219,13 +6227,13 @@ class eo {
6219
6227
  }
6220
6228
  Bi(t2, i2) {
6221
6229
  if (null == (null == i2 ? void 0 : i2.steps)) return false;
6222
- for (var e2 of i2.steps) if (this.Ai(t2, e2)) return true;
6230
+ for (var e2 of i2.steps) if (this.Di(t2, e2)) return true;
6223
6231
  return false;
6224
6232
  }
6225
6233
  onAction(t2, i2) {
6226
- return this.Oi.on(t2, i2);
6234
+ return this.Ai.on(t2, i2);
6227
6235
  }
6228
- ji(t2, i2) {
6236
+ Li(t2, i2) {
6229
6237
  if (null != i2 && i2.url) {
6230
6238
  var e2, r2 = null == t2 || null == (e2 = t2.properties) ? void 0 : e2.$current_url;
6231
6239
  if (!r2 || "string" != typeof r2) return false;
@@ -6233,7 +6241,7 @@ class eo {
6233
6241
  }
6234
6242
  return true;
6235
6243
  }
6236
- Li(t2, i2) {
6244
+ Ni(t2, i2) {
6237
6245
  return !!this.Wi(t2, i2) && (!!this.Gi(t2, i2) && !!this.Vi(t2, i2));
6238
6246
  }
6239
6247
  Wi(t2, i2) {
@@ -6272,7 +6280,7 @@ class eo {
6272
6280
  var i2;
6273
6281
  return null == (null == t2 || null == (i2 = t2.properties) ? void 0 : i2.$elements) ? [] : null == t2 ? void 0 : t2.properties.$elements;
6274
6282
  }
6275
- Ni(t2, i2) {
6283
+ Ui(t2, i2) {
6276
6284
  return null == i2 || !i2.properties || 0 === i2.properties.length || _n(i2.properties.reduce((t3, i3) => {
6277
6285
  var e2 = I(i3.value) ? i3.value.map(String) : null != i3.value ? [String(i3.value)] : [];
6278
6286
  return t3[i3.key] = { values: e2, operator: i3.operator || "exact" }, t3;
@@ -6309,7 +6317,7 @@ class ro {
6309
6317
  }
6310
6318
  register(t2) {
6311
6319
  var i2;
6312
- M(null == (i2 = this._instance) ? void 0 : i2.Hi) || (this.ee(t2), this.re(t2));
6320
+ M(null == (i2 = this._instance) ? void 0 : i2._addCaptureHook) || (this.ee(t2), this.re(t2));
6313
6321
  }
6314
6322
  re(t2) {
6315
6323
  var i2 = t2.filter((t3) => {
@@ -6343,7 +6351,7 @@ class ro {
6343
6351
  return (null == (i3 = t3.conditions) ? void 0 : i3.cancelEvents) && (null == (e3 = t3.conditions) || null == (e3 = e3.cancelEvents) || null == (e3 = e3.values) ? void 0 : e3.length) > 0;
6344
6352
  });
6345
6353
  if (0 !== e2.length || 0 !== r2.length) {
6346
- null == (i2 = this._instance) || i2.Hi((t3, i3) => {
6354
+ null == (i2 = this._instance) || i2._addCaptureHook((t3, i3) => {
6347
6355
  this.onEvent(t3, i3);
6348
6356
  }), this.Ki = this.Zi(t2, jn.Activation), this.Yi = this.Zi(t2, jn.Cancellation);
6349
6357
  }
@@ -6578,11 +6586,11 @@ class no {
6578
6586
  var r2 = this.ye(t2);
6579
6587
  if (r2) {
6580
6588
  var s2 = r2;
6581
- if (null != (e2 = r2.appearance) && e2.surveyPopupDelaySeconds && i2.ignoreDelay && (s2 = g({}, r2, { appearance: g({}, r2.appearance, { surveyPopupDelaySeconds: 0 }) })), false === i2.ignoreConditions) {
6589
+ if (null != (e2 = r2.appearance) && e2.surveyPopupDelaySeconds && i2.ignoreDelay && (s2 = g({}, r2, { appearance: g({}, r2.appearance, { surveyPopupDelaySeconds: 0 }) })), i2.displayType !== Vn.Popover && i2.initialResponses && Jn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."), false === i2.ignoreConditions) {
6582
6590
  var n2 = this.canRenderSurvey(r2);
6583
6591
  if (!n2.visible) return void Jn.warn("Survey is not eligible to be displayed: ", n2.disabledReason);
6584
6592
  }
6585
- i2.displayType !== Vn.Inline ? this._surveyManager.handlePopoverSurvey(s2, i2.properties) : this.renderSurvey(s2, i2.selector, i2.properties);
6593
+ i2.displayType !== Vn.Inline ? this._surveyManager.handlePopoverSurvey(s2, i2) : this.renderSurvey(s2, i2.selector, i2.properties);
6586
6594
  } else Jn.warn("Survey not found");
6587
6595
  }
6588
6596
  }
@@ -6712,25 +6720,32 @@ class lo {
6712
6720
  var uo = Si("[RateLimiter]");
6713
6721
  class ho {
6714
6722
  constructor(t2) {
6715
- var i2, e2;
6716
6723
  this.serverLimits = {}, this.lastEventRateLimited = false, this.checkForLimiting = (t3) => {
6717
- var i3 = t3.text;
6718
- if (i3 && i3.length) try {
6719
- (JSON.parse(i3).quota_limited || []).forEach((t4) => {
6724
+ var i2 = t3.text;
6725
+ if (i2 && i2.length) try {
6726
+ (JSON.parse(i2).quota_limited || []).forEach((t4) => {
6720
6727
  uo.info((t4 || "events") + " is quota limited."), this.serverLimits[t4] = (/* @__PURE__ */ new Date()).getTime() + 6e4;
6721
6728
  });
6722
6729
  } catch (t4) {
6723
- return void uo.warn('could not rate limit - continuing. Error: "' + (null == t4 ? void 0 : t4.message) + '"', { text: i3 });
6730
+ return void uo.warn('could not rate limit - continuing. Error: "' + (null == t4 ? void 0 : t4.message) + '"', { text: i2 });
6724
6731
  }
6725
- }, this.instance = t2, this.captureEventsPerSecond = (null == (i2 = t2.config.rate_limiting) ? void 0 : i2.events_per_second) || 10, this.captureEventsBurstLimit = Math.max((null == (e2 = t2.config.rate_limiting) ? void 0 : e2.events_burst_limit) || 10 * this.captureEventsPerSecond, this.captureEventsPerSecond), this.lastEventRateLimited = this.clientRateLimitContext(true).isRateLimited;
6732
+ }, this.instance = t2, this.lastEventRateLimited = this.clientRateLimitContext(true).isRateLimited;
6733
+ }
6734
+ get captureEventsPerSecond() {
6735
+ var t2;
6736
+ return (null == (t2 = this.instance.config.rate_limiting) ? void 0 : t2.events_per_second) || 10;
6737
+ }
6738
+ get captureEventsBurstLimit() {
6739
+ var t2;
6740
+ return Math.max((null == (t2 = this.instance.config.rate_limiting) ? void 0 : t2.events_burst_limit) || 10 * this.captureEventsPerSecond, this.captureEventsPerSecond);
6726
6741
  }
6727
6742
  clientRateLimitContext(t2) {
6728
6743
  var i2, e2, r2;
6729
6744
  void 0 === t2 && (t2 = false);
6730
- var s2 = (/* @__PURE__ */ new Date()).getTime(), n2 = null !== (i2 = null == (e2 = this.instance.persistence) ? void 0 : e2.get_property(ve)) && void 0 !== i2 ? i2 : { tokens: this.captureEventsBurstLimit, last: s2 };
6731
- n2.tokens += (s2 - n2.last) / 1e3 * this.captureEventsPerSecond, n2.last = s2, n2.tokens > this.captureEventsBurstLimit && (n2.tokens = this.captureEventsBurstLimit);
6732
- var o2 = n2.tokens < 1;
6733
- return o2 || t2 || (n2.tokens = Math.max(0, n2.tokens - 1)), !o2 || this.lastEventRateLimited || t2 || this.instance.capture("$$client_ingestion_warning", { $$client_ingestion_warning_message: "posthog-js client rate limited. Config is set to " + this.captureEventsPerSecond + " events per second and " + this.captureEventsBurstLimit + " events burst limit." }, { skip_client_rate_limiting: true }), this.lastEventRateLimited = o2, null == (r2 = this.instance.persistence) || r2.set_property(ve, n2), { isRateLimited: o2, remainingTokens: n2.tokens };
6745
+ var { captureEventsBurstLimit: s2, captureEventsPerSecond: n2 } = this, o2 = (/* @__PURE__ */ new Date()).getTime(), a2 = null !== (i2 = null == (e2 = this.instance.persistence) ? void 0 : e2.get_property(ve)) && void 0 !== i2 ? i2 : { tokens: s2, last: o2 };
6746
+ a2.tokens += (o2 - a2.last) / 1e3 * n2, a2.last = o2, a2.tokens > s2 && (a2.tokens = s2);
6747
+ var l2 = a2.tokens < 1;
6748
+ return l2 || t2 || (a2.tokens = Math.max(0, a2.tokens - 1)), !l2 || this.lastEventRateLimited || t2 || this.instance.capture("$$client_ingestion_warning", { $$client_ingestion_warning_message: "posthog-js client rate limited. Config is set to " + n2 + " events per second and " + s2 + " events burst limit." }, { skip_client_rate_limiting: true }), this.lastEventRateLimited = l2, null == (r2 = this.instance.persistence) || r2.set_property(ve, a2), { isRateLimited: l2, remainingTokens: a2.tokens };
6734
6749
  }
6735
6750
  isServerRateLimited(t2) {
6736
6751
  var i2 = this.serverLimits[t2 || "events"] || false;
@@ -6757,20 +6772,20 @@ class co {
6757
6772
  }
6758
6773
  load() {
6759
6774
  try {
6760
- if (this.remoteConfig) return vo.info("Using preloaded remote config", this.remoteConfig), void this.yi(this.remoteConfig);
6775
+ if (this.remoteConfig) return vo.info("Using preloaded remote config", this.remoteConfig), void this.bi(this.remoteConfig);
6761
6776
  if (this._instance.O()) return void vo.warn("Remote config is disabled. Falling back to local config.");
6762
6777
  this.Te((t2) => {
6763
6778
  if (!t2) return vo.info("No config found after loading remote JS config. Falling back to JSON."), void this.Ie((t3) => {
6764
- this.yi(t3);
6779
+ this.bi(t3);
6765
6780
  });
6766
- this.yi(t2);
6781
+ this.bi(t2);
6767
6782
  });
6768
6783
  } catch (t2) {
6769
6784
  vo.error("Error loading remote config", t2);
6770
6785
  }
6771
6786
  }
6772
- yi(t2) {
6773
- t2 ? this._instance.config.__preview_remote_config ? (this._instance.yi(t2), false !== t2.hasFeatureFlags && this._instance.featureFlags.ensureFlagsLoaded()) : vo.info("__preview_remote_config is disabled. Logging config instead", t2) : vo.error("Failed to fetch remote config from PostHog.");
6787
+ bi(t2) {
6788
+ t2 ? this._instance.config.__preview_remote_config ? (this._instance.bi(t2), false !== t2.hasFeatureFlags && this._instance.featureFlags.ensureFlagsLoaded()) : vo.info("__preview_remote_config is disabled. Logging config instead", t2) : vo.error("Failed to fetch remote config from PostHog.");
6774
6789
  }
6775
6790
  }
6776
6791
  var fo = 3e3;
@@ -6968,7 +6983,7 @@ class xo {
6968
6983
  };
6969
6984
  }
6970
6985
  dr() {
6971
- return "memory" !== this.R.persistence && !this.Xe.Si && Fr.H();
6986
+ return "memory" !== this.R.persistence && !this.Xe.ki && Fr.H();
6972
6987
  }
6973
6988
  pr(t2) {
6974
6989
  t2 !== this.rr && (this.rr = t2, this.dr() && Fr.G(this.ur, t2));
@@ -7031,7 +7046,7 @@ class So {
7031
7046
  }
7032
7047
  init() {
7033
7048
  if (this.isEnabled) {
7034
- var t2 = this._instance.Hi(this.br.bind(this));
7049
+ var t2 = this._instance._addCaptureHook(this.br.bind(this));
7035
7050
  this.wr = () => {
7036
7051
  t2(), this.yr = [], this.wr = void 0;
7037
7052
  };
@@ -7371,7 +7386,7 @@ var Lo = {}, No = () => {
7371
7386
  return g({ api_host: "https://us.i.posthog.com", flags_api_host: null, ui_host: null, token: "", autocapture: true, cross_subdomain_cookie: Ni(null == o ? void 0 : o.location), persistence: "localStorage+cookie", persistence_name: "", cookie_persisted_properties: [], loaded: No, save_campaign_params: true, custom_campaign_params: [], custom_blocked_useragents: [], save_referrer: true, capture_pageleave: "if_capture_pageview", defaults: null != i2 ? i2 : "unset", __preview_deferred_init_extensions: false, debug: a && O(null == a ? void 0 : a.search) && -1 !== a.search.indexOf("__posthog_debug=true") || false, cookie_expiration: 365, upgrade: false, disable_session_recording: false, disable_persistence: false, disable_web_experiments: true, disable_surveys: false, disable_surveys_automatic_display: false, disable_conversations: false, disable_product_tours: true, disable_external_dependency_loading: false, enable_recording_console_log: void 0, secure_cookie: "https:" === (null == t || null == (e2 = t.location) ? void 0 : e2.protocol), ip: false, opt_out_capturing_by_default: false, opt_out_persistence_by_default: false, opt_out_useragent_filter: false, opt_out_capturing_persistence_type: "localStorage", consent_persistence_name: null, opt_out_capturing_cookie_prefix: null, opt_in_site_apps: false, property_denylist: [], respect_dnt: false, sanitize_properties: null, request_headers: {}, request_batching: true, properties_string_max_length: 65535, mask_all_element_attributes: false, mask_all_text: false, mask_personal_data_properties: false, custom_personal_data_properties: [], advanced_disable_flags: false, advanced_disable_decide: false, advanced_disable_feature_flags: false, advanced_disable_feature_flags_on_first_load: false, advanced_only_evaluate_survey_feature_flags: false, advanced_enable_surveys: false, advanced_disable_toolbar_metrics: false, feature_flag_request_timeout_ms: 3e3, surveys_request_timeout_ms: 1e4, on_request_error: (t2) => {
7372
7387
  var i3 = "Bad HTTP status: " + t2.statusCode + " " + t2.text;
7373
7388
  $i.error(i3);
7374
- }, get_device_id: (t2) => t2, capture_performance: void 0, name: "posthog", bootstrap: {}, disable_compression: false, session_idle_timeout_seconds: 1800, person_profiles: "identified_only", before_send: void 0, request_queue_config: { flush_interval_ms: fo }, error_tracking: {}, _onCapture: No, __preview_eager_load_replay: false }, ((t2) => ({ rageclick: !(t2 && t2 >= "2025-11-30") || { content_ignorelist: true }, capture_pageview: !(t2 && t2 >= "2025-05-24") || "history_change", session_recording: t2 && t2 >= "2025-11-30" ? { strictMinimumDuration: true } : {} }))(i2));
7389
+ }, get_device_id: (t2) => t2, capture_performance: void 0, name: "posthog", bootstrap: {}, disable_compression: false, session_idle_timeout_seconds: 1800, person_profiles: "identified_only", before_send: void 0, request_queue_config: { flush_interval_ms: fo }, error_tracking: {}, _onCapture: No, __preview_eager_load_replay: false }, ((t2) => ({ rageclick: !(t2 && t2 >= "2025-11-30") || { content_ignorelist: true }, capture_pageview: !(t2 && t2 >= "2025-05-24") || "history_change", session_recording: t2 && t2 >= "2025-11-30" ? { strictMinimumDuration: true } : {}, external_scripts_inject_target: t2 && t2 >= "2026-01-30" ? "head" : "body" }))(i2));
7375
7390
  }, Bo = (t2) => {
7376
7391
  var i2 = {};
7377
7392
  M(t2.process_person) || (i2.person_profiles = t2.process_person), M(t2.xhr_headers) || (i2.request_headers = t2.xhr_headers), M(t2.cookie_name) || (i2.persistence_name = t2.cookie_name), M(t2.disable_cookie) || (i2.disable_persistence = t2.disable_cookie), M(t2.store_google) || (i2.save_campaign_params = t2.store_google), M(t2.verbose) || (i2.debug = t2.verbose);
@@ -7488,7 +7503,7 @@ class Wo {
7488
7503
  }), e2.push(() => {
7489
7504
  if (this.os) {
7490
7505
  var t3 = this.os;
7491
- this.os = void 0, this.yi(t3);
7506
+ this.os = void 0, this.bi(t3);
7492
7507
  }
7493
7508
  }), this.ls(e2, i2);
7494
7509
  }
@@ -7509,10 +7524,10 @@ class Wo {
7509
7524
  var r2 = Math.round(performance.now() - i2);
7510
7525
  this.register_for_session({ $sdk_debug_extensions_init_method: this.config.__preview_deferred_init_extensions ? "deferred" : "synchronous", $sdk_debug_extensions_init_time_ms: r2 }), this.config.__preview_deferred_init_extensions && $i.info("PostHog extensions initialized (" + r2 + "ms)");
7511
7526
  }
7512
- yi(t2) {
7527
+ bi(t2) {
7513
7528
  var i2, e2, r2, s2, n2, a2, l2, u2, h2;
7514
7529
  if (!o || !o.body) return $i.info("document not ready yet, trying again in 500 milliseconds..."), void setTimeout(() => {
7515
- this.yi(t2);
7530
+ this.bi(t2);
7516
7531
  }, 500);
7517
7532
  this.config.__preview_deferred_init_extensions && (this.os = t2), this.compression = void 0, t2.supportedCompression && !this.config.disable_compression && (this.compression = w(t2.supportedCompression, $s.GZipJS) ? $s.GZipJS : w(t2.supportedCompression, $s.Base64) ? $s.Base64 : void 0), null != (i2 = t2.analytics) && i2.endpoint && (this.analyticsDefaultEndpoint = t2.analytics.endpoint), this.set_config({ person_profiles: this.Vr ? this.Vr : "identified_only" }), null == (e2 = this.siteApps) || e2.onRemoteConfig(t2), null == (r2 = this.sessionRecording) || r2.onRemoteConfig(t2), null == (s2 = this.autocapture) || s2.onRemoteConfig(t2), null == (n2 = this.heatmaps) || n2.onRemoteConfig(t2), this.surveys.onRemoteConfig(t2), this.logs.onRemoteConfig(t2), this.conversations.onRemoteConfig(t2), null == (a2 = this.productTours) || a2.onRemoteConfig(t2), null == (l2 = this.webVitalsAutocapture) || l2.onRemoteConfig(t2), null == (u2 = this.exceptionObserver) || u2.onRemoteConfig(t2), this.exceptions.onRemoteConfig(t2), null == (h2 = this.deadClicksAutocapture) || h2.onRemoteConfig(t2);
7518
7533
  }
@@ -7608,7 +7623,7 @@ class Wo {
7608
7623
  } else $i.error("No event name provided to posthog.capture");
7609
7624
  } else $i.uninitializedWarning("posthog.capture");
7610
7625
  }
7611
- Hi(t2) {
7626
+ _addCaptureHook(t2) {
7612
7627
  return this.on("eventCaptured", (i2) => t2(i2.event, i2));
7613
7628
  }
7614
7629
  calculateEventProperties(t2, i2, e2, r2, s2) {
@@ -7894,8 +7909,8 @@ class Wo {
7894
7909
  }
7895
7910
  _s() {
7896
7911
  var t2, i2, e2, r2, s2 = this.Qr();
7897
- (null == (t2 = this.persistence) ? void 0 : t2.Si) !== s2 && (null == (e2 = this.persistence) || e2.set_disabled(s2));
7898
- (null == (i2 = this.sessionPersistence) ? void 0 : i2.Si) !== s2 && (null == (r2 = this.sessionPersistence) || r2.set_disabled(s2));
7912
+ (null == (t2 = this.persistence) ? void 0 : t2.ki) !== s2 && (null == (e2 = this.persistence) || e2.set_disabled(s2));
7913
+ (null == (i2 = this.sessionPersistence) ? void 0 : i2.ki) !== s2 && (null == (r2 = this.sessionPersistence) || r2.set_disabled(s2));
7899
7914
  return s2;
7900
7915
  }
7901
7916
  opt_in_capturing(t2) {
@@ -8138,7 +8153,7 @@ var __POSTHOG_ERROR_MESSAGES = {
8138
8153
  return PostHogErrorBoundary;
8139
8154
  })(React.Component);
8140
8155
  const name = "@twick/timeline";
8141
- const version = "0.15.7";
8156
+ const version = "0.15.9";
8142
8157
  const packageJson = {
8143
8158
  name,
8144
8159
  version