autotel-subscribers 12.0.0 → 14.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.
package/dist/factories.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { dirname, posix, sep } from 'path';
2
2
  import { createReadStream } from 'fs';
3
3
  import { createInterface } from 'readline';
4
+ import { AsyncLocalStorage } from 'async_hooks';
4
5
  import process2 from 'process';
5
6
  import os from 'os';
6
7
  import tty from 'tty';
@@ -85,11 +86,11 @@ function normalizeWindowsPath(path) {
85
86
  return path.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
86
87
  }
87
88
  var init_module_node = __esm({
88
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs"() {
89
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs"() {
89
90
  }
90
91
  });
91
92
 
92
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/featureFlagUtils.mjs
93
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/featureFlagUtils.mjs
93
94
  function getFlagDetailFromFlagAndPayload(key, value, payload) {
94
95
  return {
95
96
  key,
@@ -106,7 +107,7 @@ function getFlagDetailFromFlagAndPayload(key, value, payload) {
106
107
  }
107
108
  var normalizeFlagsResponse, getFlagValuesFromFlags, getPayloadsFromFlags, getFeatureFlagValue, parsePayload;
108
109
  var init_featureFlagUtils = __esm({
109
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/featureFlagUtils.mjs"() {
110
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/featureFlagUtils.mjs"() {
110
111
  normalizeFlagsResponse = (flagsResponse) => {
111
112
  if ("flags" in flagsResponse) {
112
113
  const featureFlags = getFlagValuesFromFlags(flagsResponse.flags);
@@ -164,10 +165,10 @@ var init_featureFlagUtils = __esm({
164
165
  }
165
166
  });
166
167
 
167
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
168
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
168
169
  var DIGITS, UUID, V7Generator, getDefaultRandom, defaultGenerator, uuidv7, uuidv7obj;
169
170
  var init_uuidv7 = __esm({
170
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/vendor/uuidv7.mjs"() {
171
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/vendor/uuidv7.mjs"() {
171
172
  DIGITS = "0123456789abcdef";
172
173
  UUID = class _UUID {
173
174
  constructor(bytes) {
@@ -328,10 +329,10 @@ var init_uuidv7 = __esm({
328
329
  }
329
330
  });
330
331
 
331
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/bot-detection.mjs
332
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/bot-detection.mjs
332
333
  var DEFAULT_BLOCKED_UA_STRS, isBlockedUA;
333
334
  var init_bot_detection = __esm({
334
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/bot-detection.mjs"() {
335
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/bot-detection.mjs"() {
335
336
  DEFAULT_BLOCKED_UA_STRS = [
336
337
  "amazonbot",
337
338
  "amazonproductbot",
@@ -422,10 +423,10 @@ var init_bot_detection = __esm({
422
423
  }
423
424
  });
424
425
 
425
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/types.mjs
426
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/types.mjs
426
427
  var types_PostHogPersistedProperty;
427
428
  var init_types = __esm({
428
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/types.mjs"() {
429
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/types.mjs"() {
429
430
  types_PostHogPersistedProperty = /* @__PURE__ */ (function(PostHogPersistedProperty) {
430
431
  PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
431
432
  PostHogPersistedProperty["DistinctId"] = "distinct_id";
@@ -457,13 +458,13 @@ var init_types = __esm({
457
458
  }
458
459
  });
459
460
 
460
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/string-utils.mjs
461
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/string-utils.mjs
461
462
  var init_string_utils = __esm({
462
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/string-utils.mjs"() {
463
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/string-utils.mjs"() {
463
464
  }
464
465
  });
465
466
 
466
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/type-utils.mjs
467
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/type-utils.mjs
467
468
  function isInstanceOf(candidate, base) {
468
469
  try {
469
470
  return candidate instanceof base;
@@ -488,7 +489,7 @@ function isPlainObject(candidate) {
488
489
  }
489
490
  var nativeIsArray, ObjProto, type_utils_toString, isArray, isUndefined, isString, isEmptyString, isNumber, isPlainError;
490
491
  var init_type_utils = __esm({
491
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/type-utils.mjs"() {
492
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/type-utils.mjs"() {
492
493
  init_types();
493
494
  init_string_utils();
494
495
  nativeIsArray = Array.isArray;
@@ -506,7 +507,7 @@ var init_type_utils = __esm({
506
507
  }
507
508
  });
508
509
 
509
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/number-utils.mjs
510
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/number-utils.mjs
510
511
  function clampToRange(value, min, max, logger, fallbackValue) {
511
512
  if (min > max) {
512
513
  logger.warn("min cannot be greater than max.");
@@ -524,15 +525,15 @@ function clampToRange(value, min, max, logger, fallbackValue) {
524
525
  return clampToRange(max, min, max, logger);
525
526
  }
526
527
  var init_number_utils = __esm({
527
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/number-utils.mjs"() {
528
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/number-utils.mjs"() {
528
529
  init_type_utils();
529
530
  }
530
531
  });
531
532
 
532
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
533
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
533
534
  var ONE_DAY_IN_MS, BucketedRateLimiter;
534
535
  var init_bucketed_rate_limiter = __esm({
535
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs"() {
536
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs"() {
536
537
  init_number_utils();
537
538
  ONE_DAY_IN_MS = 864e5;
538
539
  BucketedRateLimiter = class {
@@ -576,10 +577,10 @@ var init_bucketed_rate_limiter = __esm({
576
577
  }
577
578
  });
578
579
 
579
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/promise-queue.mjs
580
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/promise-queue.mjs
580
581
  var PromiseQueue;
581
582
  var init_promise_queue = __esm({
582
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/promise-queue.mjs"() {
583
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/promise-queue.mjs"() {
583
584
  init_uuidv7();
584
585
  PromiseQueue = class {
585
586
  add(promise) {
@@ -610,7 +611,7 @@ var init_promise_queue = __esm({
610
611
  }
611
612
  });
612
613
 
613
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/logger.mjs
614
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/logger.mjs
614
615
  function createConsole(consoleLike = console) {
615
616
  const lockedMethods = {
616
617
  log: consoleLike.log.bind(consoleLike),
@@ -625,7 +626,7 @@ function createLogger(prefix, maybeCall = passThrough) {
625
626
  }
626
627
  var _createLogger, passThrough;
627
628
  var init_logger = __esm({
628
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/logger.mjs"() {
629
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/logger.mjs"() {
629
630
  _createLogger = (prefix, maybeCall, consoleLike) => {
630
631
  function _log(level, ...args) {
631
632
  maybeCall(() => {
@@ -654,7 +655,21 @@ var init_logger = __esm({
654
655
  }
655
656
  });
656
657
 
657
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/index.mjs
658
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
659
+ var MOBILE, TABLET, GENERIC;
660
+ var init_user_agent_utils = __esm({
661
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs"() {
662
+ init_string_utils();
663
+ init_type_utils();
664
+ MOBILE = "Mobile";
665
+ TABLET = "Tablet";
666
+ GENERIC = "Generic";
667
+ GENERIC + " " + MOBILE.toLowerCase();
668
+ GENERIC + " " + TABLET.toLowerCase();
669
+ }
670
+ });
671
+
672
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/index.mjs
658
673
  function assert(truthyValue, message2) {
659
674
  if (!truthyValue || "string" != typeof truthyValue || isEmpty(truthyValue)) throw new Error(message2);
660
675
  }
@@ -698,7 +713,7 @@ function allSettled(promises) {
698
713
  }
699
714
  var STRING_FORMAT, isError;
700
715
  var init_utils = __esm({
701
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/utils/index.mjs"() {
716
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/index.mjs"() {
702
717
  init_bot_detection();
703
718
  init_bucketed_rate_limiter();
704
719
  init_number_utils();
@@ -706,15 +721,16 @@ var init_utils = __esm({
706
721
  init_type_utils();
707
722
  init_promise_queue();
708
723
  init_logger();
724
+ init_user_agent_utils();
709
725
  STRING_FORMAT = "utf8";
710
726
  isError = (x) => x instanceof Error;
711
727
  }
712
728
  });
713
729
 
714
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/eventemitter.mjs
730
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/eventemitter.mjs
715
731
  var SimpleEventEmitter;
716
732
  var init_eventemitter = __esm({
717
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/eventemitter.mjs"() {
733
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/eventemitter.mjs"() {
718
734
  SimpleEventEmitter = class {
719
735
  constructor() {
720
736
  this.events = {};
@@ -735,7 +751,7 @@ var init_eventemitter = __esm({
735
751
  }
736
752
  });
737
753
 
738
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/gzip.mjs
754
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/gzip.mjs
739
755
  function isGzipSupported() {
740
756
  return "CompressionStream" in globalThis;
741
757
  }
@@ -754,11 +770,11 @@ async function gzipCompress(input, isDebug = true) {
754
770
  }
755
771
  }
756
772
  var init_gzip = __esm({
757
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/gzip.mjs"() {
773
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/gzip.mjs"() {
758
774
  }
759
775
  });
760
776
 
761
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
777
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
762
778
  async function logFlushError(err) {
763
779
  if (err instanceof PostHogFetchHttpError) {
764
780
  let text = "";
@@ -778,7 +794,7 @@ function isPostHogFetchContentTooLargeError(err) {
778
794
  }
779
795
  var PostHogFetchHttpError, PostHogFetchNetworkError, PostHogCoreStateless;
780
796
  var init_posthog_core_stateless = __esm({
781
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/posthog-core-stateless.mjs"() {
797
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/posthog-core-stateless.mjs"() {
782
798
  init_eventemitter();
783
799
  init_featureFlagUtils();
784
800
  init_gzip();
@@ -1052,7 +1068,8 @@ var init_posthog_core_stateless = __esm({
1052
1068
  const flagDetail = featureFlags[key];
1053
1069
  return {
1054
1070
  response: flagDetail,
1055
- requestId: flagsResponse.requestId
1071
+ requestId: flagsResponse.requestId,
1072
+ evaluatedAt: flagsResponse.evaluatedAt
1056
1073
  };
1057
1074
  }
1058
1075
  async getFeatureFlagPayloadStateless(key, distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip) {
@@ -1102,7 +1119,8 @@ var init_posthog_core_stateless = __esm({
1102
1119
  flags: {},
1103
1120
  featureFlags: {},
1104
1121
  featureFlagPayloads: {},
1105
- requestId: flagsResponse?.requestId
1122
+ requestId: flagsResponse?.requestId,
1123
+ quotaLimited: flagsResponse.quotaLimited
1106
1124
  };
1107
1125
  }
1108
1126
  return flagsResponse;
@@ -1394,9 +1412,9 @@ var init_posthog_core_stateless = __esm({
1394
1412
  }
1395
1413
  });
1396
1414
 
1397
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/posthog-core.mjs
1415
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/posthog-core.mjs
1398
1416
  var init_posthog_core = __esm({
1399
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/posthog-core.mjs"() {
1417
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/posthog-core.mjs"() {
1400
1418
  init_featureFlagUtils();
1401
1419
  init_types();
1402
1420
  init_posthog_core_stateless();
@@ -1405,7 +1423,7 @@ var init_posthog_core = __esm({
1405
1423
  }
1406
1424
  });
1407
1425
 
1408
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
1426
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
1409
1427
  function getFilenameToChunkIdMap(stackParser) {
1410
1428
  const chunkIdMap = globalThis._posthogChunkIds;
1411
1429
  if (!chunkIdMap) return;
@@ -1438,14 +1456,14 @@ function getFilenameToChunkIdMap(stackParser) {
1438
1456
  }
1439
1457
  var parsedStackResults, lastKeysCount, cachedFilenameChunkIds;
1440
1458
  var init_chunk_ids = __esm({
1441
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs"() {
1459
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs"() {
1442
1460
  }
1443
1461
  });
1444
1462
 
1445
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
1463
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
1446
1464
  var MAX_CAUSE_RECURSION, ErrorPropertiesBuilder;
1447
1465
  var init_error_properties_builder = __esm({
1448
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs"() {
1466
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs"() {
1449
1467
  init_utils();
1450
1468
  init_chunk_ids();
1451
1469
  MAX_CAUSE_RECURSION = 4;
@@ -1559,7 +1577,7 @@ var init_error_properties_builder = __esm({
1559
1577
  }
1560
1578
  });
1561
1579
 
1562
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs
1580
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs
1563
1581
  function createFrame(platform, filename, func, lineno, colno) {
1564
1582
  const frame = {
1565
1583
  platform,
@@ -1573,16 +1591,16 @@ function createFrame(platform, filename, func, lineno, colno) {
1573
1591
  }
1574
1592
  var UNKNOWN_FUNCTION;
1575
1593
  var init_base = __esm({
1576
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs"() {
1594
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs"() {
1577
1595
  init_utils();
1578
1596
  UNKNOWN_FUNCTION = "?";
1579
1597
  }
1580
1598
  });
1581
1599
 
1582
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
1600
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
1583
1601
  var extractSafariExtensionDetails;
1584
1602
  var init_safari = __esm({
1585
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs"() {
1603
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs"() {
1586
1604
  init_base();
1587
1605
  extractSafariExtensionDetails = (func, filename) => {
1588
1606
  const isSafariExtension = -1 !== func.indexOf("safari-extension");
@@ -1598,10 +1616,10 @@ var init_safari = __esm({
1598
1616
  }
1599
1617
  });
1600
1618
 
1601
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
1619
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
1602
1620
  var chromeRegexNoFnName, chromeRegex, chromeEvalRegex, chromeStackLineParser;
1603
1621
  var init_chrome = __esm({
1604
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs"() {
1622
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs"() {
1605
1623
  init_base();
1606
1624
  init_safari();
1607
1625
  chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
@@ -1631,10 +1649,10 @@ var init_chrome = __esm({
1631
1649
  }
1632
1650
  });
1633
1651
 
1634
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs
1652
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs
1635
1653
  var winjsRegex, winjsStackLineParser;
1636
1654
  var init_winjs = __esm({
1637
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs"() {
1655
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs"() {
1638
1656
  init_base();
1639
1657
  winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
1640
1658
  winjsStackLineParser = (line, platform) => {
@@ -1644,10 +1662,10 @@ var init_winjs = __esm({
1644
1662
  }
1645
1663
  });
1646
1664
 
1647
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
1665
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
1648
1666
  var geckoREgex, geckoEvalRegex, geckoStackLineParser;
1649
1667
  var init_gecko = __esm({
1650
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs"() {
1668
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs"() {
1651
1669
  init_base();
1652
1670
  init_safari();
1653
1671
  geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
@@ -1674,10 +1692,10 @@ var init_gecko = __esm({
1674
1692
  }
1675
1693
  });
1676
1694
 
1677
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs
1695
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs
1678
1696
  var opera10Regex, opera10StackLineParser, opera11Regex, opera11StackLineParser;
1679
1697
  var init_opera = __esm({
1680
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs"() {
1698
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs"() {
1681
1699
  init_base();
1682
1700
  opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
1683
1701
  opera10StackLineParser = (line, platform) => {
@@ -1692,7 +1710,7 @@ var init_opera = __esm({
1692
1710
  }
1693
1711
  });
1694
1712
 
1695
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
1713
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
1696
1714
  function filenameIsInApp(filename, isNative = false) {
1697
1715
  const isInternal = isNative || filename && !filename.startsWith("/") && !filename.match(/^[A-Z]:/) && !filename.startsWith(".") && !filename.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//);
1698
1716
  return !isInternal && void 0 !== filename && !filename.includes("node_modules/");
@@ -1702,7 +1720,7 @@ function _parseIntOrUndefined(input) {
1702
1720
  }
1703
1721
  var FILENAME_MATCH, FULL_MATCH, nodeStackLineParser;
1704
1722
  var init_node = __esm({
1705
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs"() {
1723
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs"() {
1706
1724
  init_base();
1707
1725
  FILENAME_MATCH = /^\s*[-]{4,}$/;
1708
1726
  FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
@@ -1763,7 +1781,7 @@ var init_node = __esm({
1763
1781
  }
1764
1782
  });
1765
1783
 
1766
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
1784
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
1767
1785
  function reverseAndStripFrames(stack) {
1768
1786
  if (!stack.length) return [];
1769
1787
  const localStack = Array.from(stack);
@@ -1801,7 +1819,7 @@ function createStackParser(platform, ...parsers) {
1801
1819
  }
1802
1820
  var WEBPACK_ERROR_REGEXP, STACKTRACE_FRAME_LIMIT;
1803
1821
  var init_parsers = __esm({
1804
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs"() {
1822
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs"() {
1805
1823
  init_base();
1806
1824
  init_chrome();
1807
1825
  init_winjs();
@@ -1813,10 +1831,10 @@ var init_parsers = __esm({
1813
1831
  }
1814
1832
  });
1815
1833
 
1816
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs
1834
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs
1817
1835
  var DOMExceptionCoercer;
1818
1836
  var init_dom_exception_coercer = __esm({
1819
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs"() {
1837
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs"() {
1820
1838
  init_utils();
1821
1839
  DOMExceptionCoercer = class {
1822
1840
  match(err) {
@@ -1850,10 +1868,10 @@ var init_dom_exception_coercer = __esm({
1850
1868
  }
1851
1869
  });
1852
1870
 
1853
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
1871
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
1854
1872
  var ErrorCoercer;
1855
1873
  var init_error_coercer = __esm({
1856
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs"() {
1874
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs"() {
1857
1875
  init_utils();
1858
1876
  ErrorCoercer = class {
1859
1877
  match(err) {
@@ -1883,10 +1901,10 @@ var init_error_coercer = __esm({
1883
1901
  }
1884
1902
  });
1885
1903
 
1886
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs
1904
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs
1887
1905
  var ErrorEventCoercer;
1888
1906
  var init_error_event_coercer = __esm({
1889
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs"() {
1907
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs"() {
1890
1908
  init_utils();
1891
1909
  ErrorEventCoercer = class {
1892
1910
  constructor() {
@@ -1908,10 +1926,10 @@ var init_error_event_coercer = __esm({
1908
1926
  }
1909
1927
  });
1910
1928
 
1911
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
1929
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
1912
1930
  var ERROR_TYPES_PATTERN, StringCoercer;
1913
1931
  var init_string_coercer = __esm({
1914
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs"() {
1932
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs"() {
1915
1933
  ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
1916
1934
  StringCoercer = class {
1917
1935
  match(input) {
@@ -1943,10 +1961,10 @@ var init_string_coercer = __esm({
1943
1961
  }
1944
1962
  });
1945
1963
 
1946
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/types.mjs
1964
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/types.mjs
1947
1965
  var severityLevels;
1948
1966
  var init_types2 = __esm({
1949
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/types.mjs"() {
1967
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/types.mjs"() {
1950
1968
  severityLevels = [
1951
1969
  "fatal",
1952
1970
  "error",
@@ -1958,7 +1976,7 @@ var init_types2 = __esm({
1958
1976
  }
1959
1977
  });
1960
1978
 
1961
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
1979
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
1962
1980
  function extractExceptionKeysForMessage(err, maxLength = 40) {
1963
1981
  const keys = Object.keys(err);
1964
1982
  keys.sort();
@@ -1973,14 +1991,14 @@ function extractExceptionKeysForMessage(err, maxLength = 40) {
1973
1991
  return "";
1974
1992
  }
1975
1993
  var init_utils2 = __esm({
1976
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs"() {
1994
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs"() {
1977
1995
  }
1978
1996
  });
1979
1997
 
1980
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
1998
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
1981
1999
  var ObjectCoercer;
1982
2000
  var init_object_coercer = __esm({
1983
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs"() {
2001
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs"() {
1984
2002
  init_utils();
1985
2003
  init_types2();
1986
2004
  init_utils2();
@@ -2034,10 +2052,10 @@ var init_object_coercer = __esm({
2034
2052
  }
2035
2053
  });
2036
2054
 
2037
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
2055
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
2038
2056
  var EventCoercer;
2039
2057
  var init_event_coercer = __esm({
2040
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs"() {
2058
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs"() {
2041
2059
  init_utils();
2042
2060
  init_utils2();
2043
2061
  EventCoercer = class {
@@ -2057,10 +2075,10 @@ var init_event_coercer = __esm({
2057
2075
  }
2058
2076
  });
2059
2077
 
2060
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
2078
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
2061
2079
  var PrimitiveCoercer;
2062
2080
  var init_primitive_coercer = __esm({
2063
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs"() {
2081
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs"() {
2064
2082
  init_utils();
2065
2083
  PrimitiveCoercer = class {
2066
2084
  match(candidate) {
@@ -2078,10 +2096,10 @@ var init_primitive_coercer = __esm({
2078
2096
  }
2079
2097
  });
2080
2098
 
2081
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs
2099
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs
2082
2100
  var PromiseRejectionEventCoercer;
2083
2101
  var init_promise_rejection_event = __esm({
2084
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs"() {
2102
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs"() {
2085
2103
  init_utils();
2086
2104
  PromiseRejectionEventCoercer = class {
2087
2105
  match(err) {
@@ -2110,9 +2128,9 @@ var init_promise_rejection_event = __esm({
2110
2128
  }
2111
2129
  });
2112
2130
 
2113
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/index.mjs
2131
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/index.mjs
2114
2132
  var init_coercers = __esm({
2115
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/coercers/index.mjs"() {
2133
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/index.mjs"() {
2116
2134
  init_dom_exception_coercer();
2117
2135
  init_error_coercer();
2118
2136
  init_error_event_coercer();
@@ -2124,10 +2142,10 @@ var init_coercers = __esm({
2124
2142
  }
2125
2143
  });
2126
2144
 
2127
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/utils.mjs
2145
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/utils.mjs
2128
2146
  var ReduceableCache;
2129
2147
  var init_utils3 = __esm({
2130
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/utils.mjs"() {
2148
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/utils.mjs"() {
2131
2149
  ReduceableCache = class {
2132
2150
  constructor(_maxSize) {
2133
2151
  this._maxSize = _maxSize;
@@ -2153,7 +2171,7 @@ var init_utils3 = __esm({
2153
2171
  }
2154
2172
  });
2155
2173
 
2156
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/index.mjs
2174
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/index.mjs
2157
2175
  var error_tracking_exports = {};
2158
2176
  __export(error_tracking_exports, {
2159
2177
  DOMExceptionCoercer: () => DOMExceptionCoercer,
@@ -2176,7 +2194,7 @@ __export(error_tracking_exports, {
2176
2194
  winjsStackLineParser: () => winjsStackLineParser
2177
2195
  });
2178
2196
  var init_error_tracking = __esm({
2179
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/error-tracking/index.mjs"() {
2197
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/index.mjs"() {
2180
2198
  init_error_properties_builder();
2181
2199
  init_parsers();
2182
2200
  init_coercers();
@@ -2184,9 +2202,9 @@ var init_error_tracking = __esm({
2184
2202
  }
2185
2203
  });
2186
2204
 
2187
- // ../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/index.mjs
2205
+ // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/index.mjs
2188
2206
  var init_dist = __esm({
2189
- "../../node_modules/.pnpm/@posthog+core@1.6.0/node_modules/@posthog/core/dist/index.mjs"() {
2207
+ "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/index.mjs"() {
2190
2208
  init_featureFlagUtils();
2191
2209
  init_uuidv7();
2192
2210
  init_utils();
@@ -2377,7 +2395,7 @@ function snipLine(line, colno) {
2377
2395
  }
2378
2396
  var LRU_FILE_CONTENTS_CACHE, LRU_FILE_CONTENTS_FS_READ_FAILED, DEFAULT_LINES_OF_CONTEXT, MAX_CONTEXTLINES_COLNO, MAX_CONTEXTLINES_LINENO;
2379
2397
  var init_context_lines_node = __esm({
2380
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs"() {
2398
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs"() {
2381
2399
  init_dist();
2382
2400
  LRU_FILE_CONTENTS_CACHE = new error_tracking_exports.ReduceableCache(25);
2383
2401
  LRU_FILE_CONTENTS_FS_READ_FAILED = new error_tracking_exports.ReduceableCache(20);
@@ -2387,7 +2405,7 @@ var init_context_lines_node = __esm({
2387
2405
  }
2388
2406
  });
2389
2407
 
2390
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
2408
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
2391
2409
  function makeUncaughtExceptionHandler(captureFn, onFatalFn) {
2392
2410
  let calledFatalError = false;
2393
2411
  return Object.assign((error) => {
@@ -2408,10 +2426,10 @@ function makeUncaughtExceptionHandler(captureFn, onFatalFn) {
2408
2426
  });
2409
2427
  }
2410
2428
  function addUncaughtExceptionListener(captureFn, onFatalFn) {
2411
- global.process.on("uncaughtException", makeUncaughtExceptionHandler(captureFn, onFatalFn));
2429
+ globalThis.process?.on("uncaughtException", makeUncaughtExceptionHandler(captureFn, onFatalFn));
2412
2430
  }
2413
2431
  function addUnhandledRejectionListener(captureFn) {
2414
- global.process.on("unhandledRejection", (reason) => captureFn(reason, {
2432
+ globalThis.process?.on("unhandledRejection", (reason) => captureFn(reason, {
2415
2433
  mechanism: {
2416
2434
  type: "onunhandledrejection",
2417
2435
  handled: false
@@ -2419,14 +2437,14 @@ function addUnhandledRejectionListener(captureFn) {
2419
2437
  }));
2420
2438
  }
2421
2439
  var init_autocapture = __esm({
2422
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs"() {
2440
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs"() {
2423
2441
  }
2424
2442
  });
2425
2443
 
2426
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
2444
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
2427
2445
  var SHUTDOWN_TIMEOUT, ErrorTracking;
2428
2446
  var init_error_tracking2 = __esm({
2429
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs"() {
2447
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs"() {
2430
2448
  init_autocapture();
2431
2449
  init_dist();
2432
2450
  SHUTDOWN_TIMEOUT = 2e3;
@@ -2492,15 +2510,28 @@ var init_error_tracking2 = __esm({
2492
2510
  }
2493
2511
  });
2494
2512
 
2495
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/version.mjs
2513
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/version.mjs
2496
2514
  var version;
2497
2515
  var init_version = __esm({
2498
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/version.mjs"() {
2499
- version = "5.14.0";
2516
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/version.mjs"() {
2517
+ version = "5.18.1";
2500
2518
  }
2501
2519
  });
2502
2520
 
2503
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
2521
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/types.mjs
2522
+ var FeatureFlagError;
2523
+ var init_types3 = __esm({
2524
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/types.mjs"() {
2525
+ FeatureFlagError = {
2526
+ ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
2527
+ FLAG_MISSING: "flag_missing",
2528
+ QUOTA_LIMITED: "quota_limited",
2529
+ UNKNOWN_ERROR: "unknown_error"
2530
+ };
2531
+ }
2532
+ });
2533
+
2534
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
2504
2535
  async function hashSHA1(text) {
2505
2536
  const subtle = globalThis.crypto?.subtle;
2506
2537
  if (!subtle) throw new Error("SubtleCrypto API not available");
@@ -2509,11 +2540,11 @@ async function hashSHA1(text) {
2509
2540
  return hashArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
2510
2541
  }
2511
2542
  var init_crypto = __esm({
2512
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs"() {
2543
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs"() {
2513
2544
  }
2514
2545
  });
2515
2546
 
2516
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
2547
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
2517
2548
  async function _hash(key, distinctId, salt = "") {
2518
2549
  const hashString = await hashSHA1(`${key}.${distinctId}${salt}`);
2519
2550
  return parseInt(hashString.slice(0, 15), 16) / LONG_SCALE;
@@ -2681,7 +2712,7 @@ function relativeDateParseForFeatureFlagMatching(value) {
2681
2712
  }
2682
2713
  var SIXTY_SECONDS, LONG_SCALE, NULL_VALUES_ALLOWED_OPERATORS, ClientError, InconclusiveMatchError, RequiresServerEvaluation, FeatureFlagsPoller;
2683
2714
  var init_feature_flags = __esm({
2684
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs"() {
2715
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs"() {
2685
2716
  init_dist();
2686
2717
  init_crypto();
2687
2718
  SIXTY_SECONDS = 6e4;
@@ -2719,7 +2750,6 @@ var init_feature_flags = __esm({
2719
2750
  this.debugMode = false;
2720
2751
  this.shouldBeginExponentialBackoff = false;
2721
2752
  this.backOffCount = 0;
2722
- this.hasAttemptedCacheLoad = false;
2723
2753
  this.pollingInterval = pollingInterval;
2724
2754
  this.personalApiKey = personalApiKey;
2725
2755
  this.featureFlags = [];
@@ -2948,15 +2978,12 @@ var init_feature_flags = __esm({
2948
2978
  }
2949
2979
  }
2950
2980
  async loadFeatureFlags(forceReload = false) {
2951
- if (this.cacheProvider && !this.hasAttemptedCacheLoad) {
2952
- this.hasAttemptedCacheLoad = true;
2953
- await this.loadFromCache("Loaded flags from cache");
2954
- }
2955
- if (this.loadingPromise) return this.loadingPromise;
2956
- if (!this.loadedSuccessfullyOnce || forceReload) {
2957
- this.loadingPromise = this._loadFeatureFlags();
2958
- await this.loadingPromise;
2959
- }
2981
+ if (this.loadedSuccessfullyOnce && !forceReload) return;
2982
+ if (!forceReload && this.nextFetchAllowedAt && Date.now() < this.nextFetchAllowedAt) return void this.logMsgIfDebug(() => console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period"));
2983
+ if (!this.loadingPromise) this.loadingPromise = this._loadFeatureFlags().catch((err) => this.logMsgIfDebug(() => console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${err}`))).finally(() => {
2984
+ this.loadingPromise = void 0;
2985
+ });
2986
+ return this.loadingPromise;
2960
2987
  }
2961
2988
  isLocalEvaluationReady() {
2962
2989
  return (this.loadedSuccessfullyOnce ?? false) && (this.featureFlags?.length ?? 0) > 0;
@@ -2965,12 +2992,22 @@ var init_feature_flags = __esm({
2965
2992
  if (!this.shouldBeginExponentialBackoff) return this.pollingInterval;
2966
2993
  return Math.min(SIXTY_SECONDS, this.pollingInterval * 2 ** this.backOffCount);
2967
2994
  }
2995
+ beginBackoff() {
2996
+ this.shouldBeginExponentialBackoff = true;
2997
+ this.backOffCount += 1;
2998
+ this.nextFetchAllowedAt = Date.now() + this.getPollingInterval();
2999
+ }
3000
+ clearBackoff() {
3001
+ this.shouldBeginExponentialBackoff = false;
3002
+ this.backOffCount = 0;
3003
+ this.nextFetchAllowedAt = void 0;
3004
+ }
2968
3005
  async _loadFeatureFlags() {
2969
3006
  if (this.poller) {
2970
3007
  clearTimeout(this.poller);
2971
3008
  this.poller = void 0;
2972
3009
  }
2973
- this.poller = setTimeout(() => this._loadFeatureFlags(), this.getPollingInterval());
3010
+ this.poller = setTimeout(() => this.loadFeatureFlags(true), this.getPollingInterval());
2974
3011
  try {
2975
3012
  let shouldFetch = true;
2976
3013
  if (this.cacheProvider) try {
@@ -2986,9 +3023,14 @@ var init_feature_flags = __esm({
2986
3023
  const res = await this._requestFeatureFlagDefinitions();
2987
3024
  if (!res) return;
2988
3025
  switch (res.status) {
3026
+ case 304:
3027
+ this.logMsgIfDebug(() => console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data"));
3028
+ this.flagsEtag = res.headers?.get("ETag") ?? this.flagsEtag;
3029
+ this.loadedSuccessfullyOnce = true;
3030
+ this.clearBackoff();
3031
+ return;
2989
3032
  case 401:
2990
- this.shouldBeginExponentialBackoff = true;
2991
- this.backOffCount += 1;
3033
+ this.beginBackoff();
2992
3034
  throw new ClientError(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);
2993
3035
  case 402:
2994
3036
  console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts");
@@ -2998,24 +3040,22 @@ var init_feature_flags = __esm({
2998
3040
  this.cohorts = {};
2999
3041
  return;
3000
3042
  case 403:
3001
- this.shouldBeginExponentialBackoff = true;
3002
- this.backOffCount += 1;
3043
+ this.beginBackoff();
3003
3044
  throw new ClientError(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);
3004
3045
  case 429:
3005
- this.shouldBeginExponentialBackoff = true;
3006
- this.backOffCount += 1;
3046
+ this.beginBackoff();
3007
3047
  throw new ClientError(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);
3008
3048
  case 200: {
3009
3049
  const responseJson = await res.json() ?? {};
3010
3050
  if (!("flags" in responseJson)) return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(responseJson)}`));
3051
+ this.flagsEtag = res.headers?.get("ETag") ?? void 0;
3011
3052
  const flagData = {
3012
3053
  flags: responseJson.flags ?? [],
3013
3054
  groupTypeMapping: responseJson.group_type_mapping || {},
3014
3055
  cohorts: responseJson.cohorts || {}
3015
3056
  };
3016
3057
  this.updateFlagState(flagData);
3017
- this.shouldBeginExponentialBackoff = false;
3018
- this.backOffCount = 0;
3058
+ this.clearBackoff();
3019
3059
  if (this.cacheProvider && shouldFetch) try {
3020
3060
  await this.cacheProvider.onFlagDefinitionsReceived(flagData);
3021
3061
  } catch (err) {
@@ -3029,23 +3069,23 @@ var init_feature_flags = __esm({
3029
3069
  }
3030
3070
  } catch (err) {
3031
3071
  if (err instanceof ClientError) this.onError?.(err);
3032
- } finally {
3033
- this.loadingPromise = void 0;
3034
3072
  }
3035
3073
  }
3036
- getPersonalApiKeyRequestOptions(method = "GET") {
3074
+ getPersonalApiKeyRequestOptions(method = "GET", etag) {
3075
+ const headers = {
3076
+ ...this.customHeaders,
3077
+ "Content-Type": "application/json",
3078
+ Authorization: `Bearer ${this.personalApiKey}`
3079
+ };
3080
+ if (etag) headers["If-None-Match"] = etag;
3037
3081
  return {
3038
3082
  method,
3039
- headers: {
3040
- ...this.customHeaders,
3041
- "Content-Type": "application/json",
3042
- Authorization: `Bearer ${this.personalApiKey}`
3043
- }
3083
+ headers
3044
3084
  };
3045
3085
  }
3046
3086
  _requestFeatureFlagDefinitions() {
3047
3087
  const url = `${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`;
3048
- const options = this.getPersonalApiKeyRequestOptions();
3088
+ const options = this.getPersonalApiKeyRequestOptions("GET", this.flagsEtag);
3049
3089
  let abortTimeout = null;
3050
3090
  if (this.timeout && "number" == typeof this.timeout) {
3051
3091
  const controller = new AbortController();
@@ -3077,10 +3117,10 @@ var init_feature_flags = __esm({
3077
3117
  }
3078
3118
  });
3079
3119
 
3080
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/storage-memory.mjs
3120
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/storage-memory.mjs
3081
3121
  var PostHogMemoryStorage;
3082
3122
  var init_storage_memory = __esm({
3083
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/storage-memory.mjs"() {
3123
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/storage-memory.mjs"() {
3084
3124
  PostHogMemoryStorage = class {
3085
3125
  getProperty(key) {
3086
3126
  return this._memoryStorage[key];
@@ -3095,12 +3135,13 @@ var init_storage_memory = __esm({
3095
3135
  }
3096
3136
  });
3097
3137
 
3098
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/client.mjs
3138
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/client.mjs
3099
3139
  var MINIMUM_POLLING_INTERVAL, THIRTY_SECONDS, MAX_CACHE_SIZE, PostHogBackendClient;
3100
3140
  var init_client = __esm({
3101
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/client.mjs"() {
3141
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/client.mjs"() {
3102
3142
  init_version();
3103
3143
  init_dist();
3144
+ init_types3();
3104
3145
  init_feature_flags();
3105
3146
  init_error_tracking2();
3106
3147
  init_storage_memory();
@@ -3111,6 +3152,7 @@ var init_client = __esm({
3111
3152
  constructor(apiKey, options = {}) {
3112
3153
  super(apiKey, options), this._memoryStorage = new PostHogMemoryStorage();
3113
3154
  this.options = options;
3155
+ this.context = this.initializeContext();
3114
3156
  this.options.featureFlagsPollingInterval = "number" == typeof options.featureFlagsPollingInterval ? Math.max(options.featureFlagsPollingInterval, MINIMUM_POLLING_INTERVAL) : THIRTY_SECONDS;
3115
3157
  if (options.personalApiKey) {
3116
3158
  if (options.personalApiKey.includes("phc_")) throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');
@@ -3181,25 +3223,29 @@ var init_client = __esm({
3181
3223
  if (err) console.error(err);
3182
3224
  }));
3183
3225
  }
3184
- identify({ distinctId, properties, disableGeoip }) {
3185
- const userPropsOnce = properties?.$set_once;
3186
- delete properties?.$set_once;
3187
- const userProps = properties?.$set || properties;
3188
- super.identifyStateless(distinctId, {
3189
- $set: userProps,
3190
- $set_once: userPropsOnce
3191
- }, {
3226
+ identify({ distinctId, properties = {}, disableGeoip }) {
3227
+ const { $set, $set_once, $anon_distinct_id, ...rest } = properties;
3228
+ const setProps = $set || rest;
3229
+ const setOnceProps = $set_once || {};
3230
+ const eventProperties = {
3231
+ $set: setProps,
3232
+ $set_once: setOnceProps,
3233
+ $anon_distinct_id: $anon_distinct_id ?? void 0
3234
+ };
3235
+ super.identifyStateless(distinctId, eventProperties, {
3192
3236
  disableGeoip
3193
3237
  });
3194
3238
  }
3195
- async identifyImmediate({ distinctId, properties, disableGeoip }) {
3196
- const userPropsOnce = properties?.$set_once;
3197
- delete properties?.$set_once;
3198
- const userProps = properties?.$set || properties;
3199
- await super.identifyStatelessImmediate(distinctId, {
3200
- $set: userProps,
3201
- $set_once: userPropsOnce
3202
- }, {
3239
+ async identifyImmediate({ distinctId, properties = {}, disableGeoip }) {
3240
+ const { $set, $set_once, $anon_distinct_id, ...rest } = properties;
3241
+ const setProps = $set || rest;
3242
+ const setOnceProps = $set_once || {};
3243
+ const eventProperties = {
3244
+ $set: setProps,
3245
+ $set_once: setOnceProps,
3246
+ $anon_distinct_id: $anon_distinct_id ?? void 0
3247
+ };
3248
+ super.identifyStatelessImmediate(distinctId, eventProperties, {
3203
3249
  disableGeoip
3204
3250
  });
3205
3251
  }
@@ -3242,13 +3288,25 @@ var init_client = __esm({
3242
3288
  let response = await this.featureFlagsPoller?.getFeatureFlag(key, distinctId, groups, personProperties, groupProperties);
3243
3289
  const flagWasLocallyEvaluated = void 0 !== response;
3244
3290
  let requestId;
3291
+ let evaluatedAt;
3245
3292
  let flagDetail;
3293
+ let featureFlagError;
3246
3294
  if (!flagWasLocallyEvaluated && !onlyEvaluateLocally) {
3247
- const remoteResponse = await super.getFeatureFlagDetailStateless(key, distinctId, groups, personProperties, groupProperties, disableGeoip);
3248
- if (void 0 === remoteResponse) return;
3249
- flagDetail = remoteResponse.response;
3250
- response = getFeatureFlagValue(flagDetail);
3251
- requestId = remoteResponse?.requestId;
3295
+ const flagsResponse = await super.getFeatureFlagDetailsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, [
3296
+ key
3297
+ ]);
3298
+ if (void 0 === flagsResponse) featureFlagError = FeatureFlagError.UNKNOWN_ERROR;
3299
+ else {
3300
+ requestId = flagsResponse.requestId;
3301
+ evaluatedAt = flagsResponse.evaluatedAt;
3302
+ const errors = [];
3303
+ if (flagsResponse.errorsWhileComputingFlags) errors.push(FeatureFlagError.ERRORS_WHILE_COMPUTING);
3304
+ if (flagsResponse.quotaLimited?.includes("feature_flags")) errors.push(FeatureFlagError.QUOTA_LIMITED);
3305
+ flagDetail = flagsResponse.flags[key];
3306
+ if (void 0 === flagDetail) errors.push(FeatureFlagError.FLAG_MISSING);
3307
+ if (errors.length > 0) featureFlagError = errors.join(",");
3308
+ response = getFeatureFlagValue(flagDetail);
3309
+ }
3252
3310
  }
3253
3311
  const featureFlagReportedKey = `${key}_${response}`;
3254
3312
  if (sendFeatureFlagEvents && (!(distinctId in this.distinctIdHasSentFlagCalls) || !this.distinctIdHasSentFlagCalls[distinctId].includes(featureFlagReportedKey))) {
@@ -3257,19 +3315,22 @@ var init_client = __esm({
3257
3315
  else this.distinctIdHasSentFlagCalls[distinctId] = [
3258
3316
  featureFlagReportedKey
3259
3317
  ];
3318
+ const properties = {
3319
+ $feature_flag: key,
3320
+ $feature_flag_response: response,
3321
+ $feature_flag_id: flagDetail?.metadata?.id,
3322
+ $feature_flag_version: flagDetail?.metadata?.version,
3323
+ $feature_flag_reason: flagDetail?.reason?.description ?? flagDetail?.reason?.code,
3324
+ locally_evaluated: flagWasLocallyEvaluated,
3325
+ [`$feature/${key}`]: response,
3326
+ $feature_flag_request_id: requestId,
3327
+ $feature_flag_evaluated_at: evaluatedAt
3328
+ };
3329
+ if (featureFlagError) properties.$feature_flag_error = featureFlagError;
3260
3330
  this.capture({
3261
3331
  distinctId,
3262
3332
  event: "$feature_flag_called",
3263
- properties: {
3264
- $feature_flag: key,
3265
- $feature_flag_response: response,
3266
- $feature_flag_id: flagDetail?.metadata?.id,
3267
- $feature_flag_version: flagDetail?.metadata?.version,
3268
- $feature_flag_reason: flagDetail?.reason?.description ?? flagDetail?.reason?.code,
3269
- locally_evaluated: flagWasLocallyEvaluated,
3270
- [`$feature/${key}`]: response,
3271
- $feature_flag_request_id: requestId
3272
- },
3333
+ properties,
3273
3334
  groups,
3274
3335
  disableGeoip
3275
3336
  });
@@ -3363,6 +3424,13 @@ var init_client = __esm({
3363
3424
  async reloadFeatureFlags() {
3364
3425
  await this.featureFlagsPoller?.loadFeatureFlags(true);
3365
3426
  }
3427
+ withContext(data, fn, options) {
3428
+ if (!this.context) return fn();
3429
+ return this.context.run(data, fn, options);
3430
+ }
3431
+ getContext() {
3432
+ return this.context?.get();
3433
+ }
3366
3434
  async _shutdown(shutdownTimeoutMs) {
3367
3435
  this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
3368
3436
  this.errorTracking.shutdown();
@@ -3474,10 +3542,21 @@ var init_client = __esm({
3474
3542
  }
3475
3543
  async prepareEventMessage(props) {
3476
3544
  const { distinctId, event, properties, groups, sendFeatureFlags, timestamp, disableGeoip, uuid } = props;
3545
+ const contextData = this.context?.get();
3546
+ let mergedDistinctId = distinctId || contextData?.distinctId;
3547
+ const mergedProperties = {
3548
+ ...contextData?.properties || {},
3549
+ ...properties || {}
3550
+ };
3551
+ if (!mergedDistinctId) {
3552
+ mergedDistinctId = uuidv7();
3553
+ mergedProperties.$process_person_profile = false;
3554
+ }
3555
+ if (contextData?.sessionId && !mergedProperties.$session_id) mergedProperties.$session_id = contextData.sessionId;
3477
3556
  const eventMessage = this._runBeforeSend({
3478
- distinctId,
3557
+ distinctId: mergedDistinctId,
3479
3558
  event,
3480
- properties,
3559
+ properties: mergedProperties,
3481
3560
  groups,
3482
3561
  sendFeatureFlags,
3483
3562
  timestamp,
@@ -3488,8 +3567,9 @@ var init_client = __esm({
3488
3567
  const eventProperties = await Promise.resolve().then(async () => {
3489
3568
  if (sendFeatureFlags) {
3490
3569
  const sendFeatureFlagsOptions = "object" == typeof sendFeatureFlags ? sendFeatureFlags : void 0;
3491
- return await this.getFeatureFlagsForEvent(distinctId, groups, disableGeoip, sendFeatureFlagsOptions);
3570
+ return await this.getFeatureFlagsForEvent(eventMessage.distinctId, groups, disableGeoip, sendFeatureFlagsOptions);
3492
3571
  }
3572
+ eventMessage.event;
3493
3573
  return {};
3494
3574
  }).then((flags) => {
3495
3575
  const additionalProperties = {};
@@ -3545,8 +3625,37 @@ var init_client = __esm({
3545
3625
  };
3546
3626
  }
3547
3627
  });
3628
+ var PostHogContext;
3629
+ var init_context = __esm({
3630
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/context/context.mjs"() {
3631
+ PostHogContext = class {
3632
+ constructor() {
3633
+ this.storage = new AsyncLocalStorage();
3634
+ }
3635
+ get() {
3636
+ return this.storage.getStore();
3637
+ }
3638
+ run(context, fn, options) {
3639
+ const fresh = options?.fresh === true;
3640
+ if (fresh) return this.storage.run(context, fn);
3641
+ {
3642
+ const currentContext = this.get() || {};
3643
+ const mergedContext = {
3644
+ distinctId: context.distinctId ?? currentContext.distinctId,
3645
+ sessionId: context.sessionId ?? currentContext.sessionId,
3646
+ properties: {
3647
+ ...currentContext.properties || {},
3648
+ ...context.properties || {}
3649
+ }
3650
+ };
3651
+ return this.storage.run(mergedContext, fn);
3652
+ }
3653
+ }
3654
+ };
3655
+ }
3656
+ });
3548
3657
 
3549
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
3658
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
3550
3659
  function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
3551
3660
  "error"
3552
3661
  ], sendExceptionsToPostHog = true } = {}) {
@@ -3602,7 +3711,7 @@ function sentryIntegration(_posthog, options) {
3602
3711
  }
3603
3712
  var NAME, PostHogSentryIntegration;
3604
3713
  var init_sentry_integration = __esm({
3605
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/sentry-integration.mjs"() {
3714
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/sentry-integration.mjs"() {
3606
3715
  NAME = "posthog-node";
3607
3716
  PostHogSentryIntegration = class {
3608
3717
  static #_ = this.POSTHOG_ID_TAG = "posthog_distinct_id";
@@ -3624,46 +3733,55 @@ var init_sentry_integration = __esm({
3624
3733
  }
3625
3734
  });
3626
3735
 
3627
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/express.mjs
3736
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/express.mjs
3628
3737
  function setupExpressErrorHandler(_posthog, app) {
3629
- app.use((error, _, __, next) => {
3738
+ app.use(posthogErrorHandler(_posthog));
3739
+ }
3740
+ function posthogErrorHandler(posthog) {
3741
+ return (error, req, res, next) => {
3742
+ const sessionId = req.headers["x-posthog-session-id"];
3743
+ const distinctId = req.headers["x-posthog-distinct-id"];
3744
+ const syntheticException = new Error("Synthetic exception");
3630
3745
  const hint = {
3631
3746
  mechanism: {
3632
3747
  type: "middleware",
3633
3748
  handled: false
3634
- }
3749
+ },
3750
+ syntheticException
3635
3751
  };
3636
- ErrorTracking.buildEventMessage(error, hint, uuidv7(), {
3637
- $process_person_profile: false
3638
- }).then((msg) => _posthog.capture(msg));
3752
+ posthog.addPendingPromise(ErrorTracking.buildEventMessage(error, hint, distinctId, {
3753
+ $session_id: sessionId,
3754
+ $current_url: req.url,
3755
+ $request_method: req.method,
3756
+ $request_path: req.path,
3757
+ $user_agent: req.headers["user-agent"],
3758
+ $response_status_code: res.statusCode,
3759
+ $ip: req.headers["x-forwarded-for"] || req?.socket?.remoteAddress
3760
+ }).then((msg) => {
3761
+ posthog.capture(msg);
3762
+ }));
3639
3763
  next(error);
3640
- });
3764
+ };
3641
3765
  }
3642
3766
  var init_express = __esm({
3643
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/extensions/express.mjs"() {
3644
- init_dist();
3767
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/extensions/express.mjs"() {
3645
3768
  init_error_tracking2();
3646
3769
  }
3647
3770
  });
3648
3771
 
3649
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/types.mjs
3650
- var init_types3 = __esm({
3651
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/types.mjs"() {
3652
- }
3653
- });
3654
-
3655
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/exports.mjs
3772
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/exports.mjs
3656
3773
  var init_exports = __esm({
3657
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/exports.mjs"() {
3774
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/exports.mjs"() {
3658
3775
  init_sentry_integration();
3659
3776
  init_express();
3660
3777
  init_types3();
3661
3778
  }
3662
3779
  });
3663
3780
 
3664
- // ../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/entrypoints/index.node.mjs
3781
+ // ../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/entrypoints/index.node.mjs
3665
3782
  var index_node_exports = {};
3666
3783
  __export(index_node_exports, {
3784
+ FeatureFlagError: () => FeatureFlagError,
3667
3785
  PostHog: () => PostHog,
3668
3786
  PostHogSentryIntegration: () => PostHogSentryIntegration,
3669
3787
  createEventProcessor: () => createEventProcessor,
@@ -3672,12 +3790,13 @@ __export(index_node_exports, {
3672
3790
  });
3673
3791
  var PostHog;
3674
3792
  var init_index_node = __esm({
3675
- "../../node_modules/.pnpm/posthog-node@5.14.0/node_modules/posthog-node/dist/entrypoints/index.node.mjs"() {
3793
+ "../../node_modules/.pnpm/posthog-node@5.18.1/node_modules/posthog-node/dist/entrypoints/index.node.mjs"() {
3676
3794
  init_module_node();
3677
3795
  init_context_lines_node();
3678
3796
  init_error_tracking2();
3679
3797
  init_client();
3680
3798
  init_dist();
3799
+ init_context();
3681
3800
  init_exports();
3682
3801
  ErrorTracking.errorPropertiesBuilder = new error_tracking_exports.ErrorPropertiesBuilder([
3683
3802
  new error_tracking_exports.EventCoercer(),
@@ -3693,6 +3812,9 @@ var init_index_node = __esm({
3693
3812
  getLibraryId() {
3694
3813
  return "posthog-node";
3695
3814
  }
3815
+ initializeContext() {
3816
+ return new PostHogContext();
3817
+ }
3696
3818
  };
3697
3819
  }
3698
3820
  });
@@ -6684,10 +6806,10 @@ var init_tslib_es6 = __esm({
6684
6806
  }
6685
6807
  });
6686
6808
 
6687
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/event/event.js
6809
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/event/event.js
6688
6810
  var IdentifyOperation, SpecialEventType;
6689
6811
  var init_event = __esm({
6690
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/event/event.js"() {
6812
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/event/event.js"() {
6691
6813
  (function(IdentifyOperation3) {
6692
6814
  IdentifyOperation3["SET"] = "$set";
6693
6815
  IdentifyOperation3["SET_ONCE"] = "$setOnce";
@@ -6708,10 +6830,10 @@ var init_event = __esm({
6708
6830
  }
6709
6831
  });
6710
6832
 
6711
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/constants.js
6833
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/constants.js
6712
6834
  var UNSET_VALUE, AMPLITUDE_PREFIX, STORAGE_PREFIX, DEFAULT_INSTANCE_NAME, AMPLITUDE_SERVER_URL, EU_AMPLITUDE_SERVER_URL, AMPLITUDE_BATCH_SERVER_URL, EU_AMPLITUDE_BATCH_SERVER_URL;
6713
6835
  var init_constants = __esm({
6714
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"() {
6836
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"() {
6715
6837
  UNSET_VALUE = "-";
6716
6838
  AMPLITUDE_PREFIX = "AMP";
6717
6839
  STORAGE_PREFIX = "".concat(AMPLITUDE_PREFIX, "_unsent");
@@ -6723,10 +6845,10 @@ var init_constants = __esm({
6723
6845
  }
6724
6846
  });
6725
6847
 
6726
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js
6848
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js
6727
6849
  var MAX_PROPERTY_KEYS, isValidObject, isValidProperties;
6728
6850
  var init_valid_properties = __esm({
6729
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js"() {
6851
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js"() {
6730
6852
  init_tslib_es6();
6731
6853
  MAX_PROPERTY_KEYS = 1e3;
6732
6854
  isValidObject = function(properties) {
@@ -6781,10 +6903,10 @@ var init_valid_properties = __esm({
6781
6903
  }
6782
6904
  });
6783
6905
 
6784
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/identify.js
6906
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/identify.js
6785
6907
  var Identify, IdentifyOperation2, OrderedIdentifyOperations;
6786
6908
  var init_identify = __esm({
6787
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/identify.js"() {
6909
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/identify.js"() {
6788
6910
  init_tslib_es6();
6789
6911
  init_constants();
6790
6912
  init_valid_properties();
@@ -6895,10 +7017,10 @@ var init_identify = __esm({
6895
7017
  }
6896
7018
  });
6897
7019
 
6898
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/messages.js
7020
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/messages.js
6899
7021
  var SUCCESS_MESSAGE, UNEXPECTED_ERROR_MESSAGE, MAX_RETRIES_EXCEEDED_MESSAGE, OPT_OUT_MESSAGE, MISSING_API_KEY_MESSAGE, INVALID_API_KEY, CLIENT_NOT_INITIALIZED;
6900
7022
  var init_messages = __esm({
6901
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/messages.js"() {
7023
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/messages.js"() {
6902
7024
  SUCCESS_MESSAGE = "Event tracked successfully";
6903
7025
  UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";
6904
7026
  MAX_RETRIES_EXCEEDED_MESSAGE = "Event rejected due to exceeded retry count";
@@ -6909,10 +7031,10 @@ var init_messages = __esm({
6909
7031
  }
6910
7032
  });
6911
7033
 
6912
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/status.js
7034
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/status.js
6913
7035
  var Status;
6914
7036
  var init_status = __esm({
6915
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/status.js"() {
7037
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/status.js"() {
6916
7038
  (function(Status2) {
6917
7039
  Status2["Unknown"] = "unknown";
6918
7040
  Status2["Skipped"] = "skipped";
@@ -6927,10 +7049,10 @@ var init_status = __esm({
6927
7049
  }
6928
7050
  });
6929
7051
 
6930
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js
7052
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js
6931
7053
  var buildResult;
6932
7054
  var init_result_builder = __esm({
6933
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js"() {
7055
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js"() {
6934
7056
  init_status();
6935
7057
  buildResult = function(event, code, message2) {
6936
7058
  if (code === void 0) {
@@ -6944,10 +7066,10 @@ var init_result_builder = __esm({
6944
7066
  }
6945
7067
  });
6946
7068
 
6947
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/global-scope.js
7069
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/global-scope.js
6948
7070
  var getGlobalScope;
6949
7071
  var init_global_scope = __esm({
6950
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"() {
7072
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"() {
6951
7073
  getGlobalScope = function() {
6952
7074
  var ampIntegrationContextName = "ampIntegrationContext";
6953
7075
  if (typeof globalThis !== "undefined" && typeof globalThis[ampIntegrationContextName] !== "undefined") {
@@ -6970,10 +7092,10 @@ var init_global_scope = __esm({
6970
7092
  }
6971
7093
  });
6972
7094
 
6973
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js
7095
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js
6974
7096
  var legacyUUID, hex, UUID2;
6975
7097
  var init_uuid = __esm({
6976
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js"() {
7098
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js"() {
6977
7099
  init_tslib_es6();
6978
7100
  init_global_scope();
6979
7101
  legacyUUID = function(a) {
@@ -7017,10 +7139,10 @@ var init_uuid = __esm({
7017
7139
  }
7018
7140
  });
7019
7141
 
7020
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/timeline.js
7142
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/timeline.js
7021
7143
  var Timeline;
7022
7144
  var init_timeline = __esm({
7023
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/timeline.js"() {
7145
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/timeline.js"() {
7024
7146
  init_tslib_es6();
7025
7147
  init_result_builder();
7026
7148
  init_uuid();
@@ -7322,10 +7444,10 @@ var init_timeline = __esm({
7322
7444
  }
7323
7445
  });
7324
7446
 
7325
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js
7447
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js
7326
7448
  var createTrackEvent, createIdentifyEvent, createGroupIdentifyEvent, createGroupEvent, createRevenueEvent;
7327
7449
  var init_event_builder = __esm({
7328
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js"() {
7450
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js"() {
7329
7451
  init_tslib_es6();
7330
7452
  init_identify();
7331
7453
  init_event();
@@ -7355,10 +7477,10 @@ var init_event_builder = __esm({
7355
7477
  }
7356
7478
  });
7357
7479
 
7358
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js
7480
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js
7359
7481
  var returnWrapper;
7360
7482
  var init_return_wrapper = __esm({
7361
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js"() {
7483
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js"() {
7362
7484
  returnWrapper = function(awaitable) {
7363
7485
  return {
7364
7486
  promise: awaitable || Promise.resolve()
@@ -7367,10 +7489,10 @@ var init_return_wrapper = __esm({
7367
7489
  }
7368
7490
  });
7369
7491
 
7370
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/core-client.js
7492
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/core-client.js
7371
7493
  var AmplitudeCore;
7372
7494
  var init_core_client = __esm({
7373
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/core-client.js"() {
7495
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/core-client.js"() {
7374
7496
  init_tslib_es6();
7375
7497
  init_event();
7376
7498
  init_identify();
@@ -7638,10 +7760,10 @@ var init_core_client = __esm({
7638
7760
  }
7639
7761
  });
7640
7762
 
7641
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/revenue.js
7763
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/revenue.js
7642
7764
  var Revenue, RevenueProperty;
7643
7765
  var init_revenue = __esm({
7644
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/revenue.js"() {
7766
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/revenue.js"() {
7645
7767
  init_tslib_es6();
7646
7768
  init_valid_properties();
7647
7769
  Revenue = /** @class */
@@ -7718,10 +7840,10 @@ var init_revenue = __esm({
7718
7840
  }
7719
7841
  });
7720
7842
 
7721
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js
7843
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js
7722
7844
  var chunk;
7723
7845
  var init_chunk = __esm({
7724
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js"() {
7846
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js"() {
7725
7847
  chunk = function(arr, size) {
7726
7848
  var chunkSize = Math.max(size, 1);
7727
7849
  return arr.reduce(function(chunks, element, index) {
@@ -7736,10 +7858,10 @@ var init_chunk = __esm({
7736
7858
  }
7737
7859
  });
7738
7860
 
7739
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js
7861
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js
7740
7862
  var LogLevel;
7741
7863
  var init_loglevel = __esm({
7742
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js"() {
7864
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js"() {
7743
7865
  (function(LogLevel2) {
7744
7866
  LogLevel2[LogLevel2["None"] = 0] = "None";
7745
7867
  LogLevel2[LogLevel2["Error"] = 1] = "Error";
@@ -7750,10 +7872,10 @@ var init_loglevel = __esm({
7750
7872
  }
7751
7873
  });
7752
7874
 
7753
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/logger.js
7875
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/logger.js
7754
7876
  var PREFIX, Logger;
7755
7877
  var init_logger2 = __esm({
7756
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/logger.js"() {
7878
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/logger.js"() {
7757
7879
  init_loglevel();
7758
7880
  PREFIX = "Amplitude Logger ";
7759
7881
  Logger = /** @class */
@@ -7815,10 +7937,10 @@ var init_logger2 = __esm({
7815
7937
  }
7816
7938
  });
7817
7939
 
7818
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/config.js
7940
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/config.js
7819
7941
  var getDefaultConfig, Config, getServerUrl, createServerConfig, RequestMetadata;
7820
7942
  var init_config = __esm({
7821
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/config.js"() {
7943
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/config.js"() {
7822
7944
  init_constants();
7823
7945
  init_logger2();
7824
7946
  init_loglevel();
@@ -7919,19 +8041,19 @@ var init_config = __esm({
7919
8041
  }
7920
8042
  });
7921
8043
 
7922
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/status-code.js
8044
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/status-code.js
7923
8045
  function isSuccessStatusCode(code) {
7924
8046
  return code >= 200 && code < 300;
7925
8047
  }
7926
8048
  var init_status_code = __esm({
7927
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/status-code.js"() {
8049
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/status-code.js"() {
7928
8050
  }
7929
8051
  });
7930
8052
 
7931
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js
8053
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js
7932
8054
  var getStacktrace, getClientLogConfig, getValueByStringPath, getClientStates, debugWrapper;
7933
8055
  var init_debug = __esm({
7934
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js"() {
8056
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js"() {
7935
8057
  init_tslib_es6();
7936
8058
  init_loglevel();
7937
8059
  getStacktrace = function(ignoreDepth) {
@@ -8049,7 +8171,7 @@ var init_debug = __esm({
8049
8171
  }
8050
8172
  });
8051
8173
 
8052
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js
8174
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js
8053
8175
  function getErrorMessage(error) {
8054
8176
  if (error instanceof Error)
8055
8177
  return error.message;
@@ -8067,7 +8189,7 @@ function getResponseBodyString(res) {
8067
8189
  }
8068
8190
  var Destination;
8069
8191
  var init_destination = __esm({
8070
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js"() {
8192
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js"() {
8071
8193
  init_tslib_es6();
8072
8194
  init_status();
8073
8195
  init_messages();
@@ -8458,10 +8580,10 @@ var init_destination = __esm({
8458
8580
  }
8459
8581
  });
8460
8582
 
8461
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/transports/base.js
8583
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/transports/base.js
8462
8584
  var BaseTransport;
8463
8585
  var init_base2 = __esm({
8464
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/transports/base.js"() {
8586
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/transports/base.js"() {
8465
8587
  init_status();
8466
8588
  init_status_code();
8467
8589
  BaseTransport = /** @class */
@@ -8563,10 +8685,10 @@ var init_base2 = __esm({
8563
8685
  }
8564
8686
  });
8565
8687
 
8566
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/server-zone.js
8688
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/server-zone.js
8567
8689
  var ServerZone;
8568
8690
  var init_server_zone = __esm({
8569
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/server-zone.js"() {
8691
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/server-zone.js"() {
8570
8692
  (function(ServerZone2) {
8571
8693
  ServerZone2["US"] = "US";
8572
8694
  ServerZone2["EU"] = "EU";
@@ -8575,17 +8697,17 @@ var init_server_zone = __esm({
8575
8697
  }
8576
8698
  });
8577
8699
 
8578
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/offline.js
8700
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/offline.js
8579
8701
  var OfflineDisabled;
8580
8702
  var init_offline = __esm({
8581
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/offline.js"() {
8703
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/offline.js"() {
8582
8704
  OfflineDisabled = null;
8583
8705
  }
8584
8706
  });
8585
8707
 
8586
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/index.js
8708
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/index.js
8587
8709
  var init_esm = __esm({
8588
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/index.js"() {
8710
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/index.js"() {
8589
8711
  init_core_client();
8590
8712
  init_identify();
8591
8713
  init_revenue();
@@ -8602,18 +8724,18 @@ var init_esm = __esm({
8602
8724
  }
8603
8725
  });
8604
8726
 
8605
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/version.js
8727
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/version.js
8606
8728
  var VERSION;
8607
8729
  var init_version2 = __esm({
8608
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/version.js"() {
8609
- VERSION = "1.5.26";
8730
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/version.js"() {
8731
+ VERSION = "1.5.29";
8610
8732
  }
8611
8733
  });
8612
8734
 
8613
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js
8735
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js
8614
8736
  var Context;
8615
- var init_context = __esm({
8616
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js"() {
8737
+ var init_context2 = __esm({
8738
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js"() {
8617
8739
  init_tslib_es6();
8618
8740
  init_esm();
8619
8741
  init_version2();
@@ -8648,7 +8770,7 @@ var init_context = __esm({
8648
8770
  });
8649
8771
  var Http;
8650
8772
  var init_http = __esm({
8651
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/transports/http.js"() {
8773
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/transports/http.js"() {
8652
8774
  init_tslib_es6();
8653
8775
  init_esm();
8654
8776
  Http = /** @class */
@@ -8710,10 +8832,10 @@ var init_http = __esm({
8710
8832
  }
8711
8833
  });
8712
8834
 
8713
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/config.js
8835
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/config.js
8714
8836
  var NodeConfig, useNodeConfig;
8715
8837
  var init_config2 = __esm({
8716
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/config.js"() {
8838
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/config.js"() {
8717
8839
  init_tslib_es6();
8718
8840
  init_esm();
8719
8841
  init_http();
@@ -8731,13 +8853,13 @@ var init_config2 = __esm({
8731
8853
  }
8732
8854
  });
8733
8855
 
8734
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/node-client.js
8856
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/node-client.js
8735
8857
  var AmplitudeNode, createInstance, node_client_default;
8736
8858
  var init_node_client = __esm({
8737
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/node-client.js"() {
8859
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/node-client.js"() {
8738
8860
  init_tslib_es6();
8739
8861
  init_esm();
8740
- init_context();
8862
+ init_context2();
8741
8863
  init_config2();
8742
8864
  AmplitudeNode = /** @class */
8743
8865
  (function(_super) {
@@ -8808,7 +8930,7 @@ var init_node_client = __esm({
8808
8930
  }
8809
8931
  });
8810
8932
 
8811
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/types.js
8933
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/types.js
8812
8934
  var types_exports = {};
8813
8935
  __export(types_exports, {
8814
8936
  IdentifyOperation: () => IdentifyOperation,
@@ -8819,12 +8941,12 @@ __export(types_exports, {
8819
8941
  SpecialEventType: () => SpecialEventType
8820
8942
  });
8821
8943
  var init_types4 = __esm({
8822
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/types.js"() {
8944
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/types.js"() {
8823
8945
  init_esm();
8824
8946
  }
8825
8947
  });
8826
8948
 
8827
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/index.js
8949
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/index.js
8828
8950
  var esm_exports = {};
8829
8951
  __export(esm_exports, {
8830
8952
  Identify: () => Identify,
@@ -8845,7 +8967,7 @@ __export(esm_exports, {
8845
8967
  });
8846
8968
  var add, groupIdentify, identify, init, logEvent, remove, revenue, setGroup, setOptOut, track, flush;
8847
8969
  var init_esm2 = __esm({
8848
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/index.js"() {
8970
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/index.js"() {
8849
8971
  init_node_client();
8850
8972
  init_node_client();
8851
8973
  init_esm();
@@ -9617,7 +9739,7 @@ var init_stats = __esm({
9617
9739
 
9618
9740
  // ../../node_modules/.pnpm/@segment+analytics-core@1.8.2/node_modules/@segment/analytics-core/dist/esm/context/index.js
9619
9741
  var ContextCancelation, CoreContext;
9620
- var init_context2 = __esm({
9742
+ var init_context3 = __esm({
9621
9743
  "../../node_modules/.pnpm/@segment+analytics-core@1.8.2/node_modules/@segment/analytics-core/dist/esm/context/index.js"() {
9622
9744
  init_dist3();
9623
9745
  init_dist2();
@@ -9843,7 +9965,7 @@ function ensure(ctx, plugin) {
9843
9965
  var init_delivery = __esm({
9844
9966
  "../../node_modules/.pnpm/@segment+analytics-core@1.8.2/node_modules/@segment/analytics-core/dist/esm/queue/delivery.js"() {
9845
9967
  init_tslib_es6();
9846
- init_context2();
9968
+ init_context3();
9847
9969
  }
9848
9970
  });
9849
9971
 
@@ -9854,7 +9976,7 @@ var init_event_queue = __esm({
9854
9976
  init_tslib_es6();
9855
9977
  init_group_by();
9856
9978
  init_priority_queue();
9857
- init_context2();
9979
+ init_context3();
9858
9980
  init_esm3();
9859
9981
  init_task_group();
9860
9982
  init_delivery();
@@ -10286,7 +10408,7 @@ var init_esm4 = __esm({
10286
10408
  init_callback();
10287
10409
  init_priority_queue();
10288
10410
  init_backoff();
10289
- init_context2();
10411
+ init_context3();
10290
10412
  init_event_queue();
10291
10413
  init_analytics();
10292
10414
  init_dispatch();
@@ -11954,7 +12076,7 @@ var init_event_factory = __esm({
11954
12076
 
11955
12077
  // ../../node_modules/.pnpm/@segment+analytics-node@2.3.0/node_modules/@segment/analytics-node/dist/esm/app/context.js
11956
12078
  var Context2;
11957
- var init_context3 = __esm({
12079
+ var init_context4 = __esm({
11958
12080
  "../../node_modules/.pnpm/@segment+analytics-node@2.3.0/node_modules/@segment/analytics-node/dist/esm/app/context.js"() {
11959
12081
  init_esm4();
11960
12082
  Context2 = class extends CoreContext {
@@ -11970,7 +12092,7 @@ var normalizeDispatchCb, dispatchAndEmit;
11970
12092
  var init_dispatch_emit = __esm({
11971
12093
  "../../node_modules/.pnpm/@segment+analytics-node@2.3.0/node_modules/@segment/analytics-node/dist/esm/app/dispatch-emit.js"() {
11972
12094
  init_esm4();
11973
- init_context3();
12095
+ init_context4();
11974
12096
  normalizeDispatchCb = (cb) => (ctx) => {
11975
12097
  const failedDelivery = ctx.failedDelivery();
11976
12098
  return failedDelivery ? cb(failedDelivery.reason, ctx) : cb(void 0, ctx);
@@ -15142,7 +15264,7 @@ var init_analytics_node = __esm({
15142
15264
  init_event_factory();
15143
15265
  init_dispatch_emit();
15144
15266
  init_emitter3();
15145
- init_context3();
15267
+ init_context4();
15146
15268
  init_event_queue2();
15147
15269
  init_http_client();
15148
15270
  Analytics = class extends NodeEmitter {
@@ -15344,7 +15466,7 @@ var init_analytics_node = __esm({
15344
15466
  var init_index_common = __esm({
15345
15467
  "../../node_modules/.pnpm/@segment+analytics-node@2.3.0/node_modules/@segment/analytics-node/dist/esm/index.common.js"() {
15346
15468
  init_analytics_node();
15347
- init_context3();
15469
+ init_context4();
15348
15470
  init_http_client();
15349
15471
  }
15350
15472
  });
@@ -15993,7 +16115,8 @@ var MixpanelSubscriber = class {
15993
16115
  var AmplitudeSubscriber = class {
15994
16116
  name = "AmplitudeSubscriber";
15995
16117
  version = "1.0.0";
15996
- amplitude;
16118
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16119
+ amplitudeModule = null;
15997
16120
  enabled;
15998
16121
  config;
15999
16122
  initPromise = null;
@@ -16006,11 +16129,12 @@ var AmplitudeSubscriber = class {
16006
16129
  }
16007
16130
  async initialize() {
16008
16131
  try {
16009
- const { init: init2 } = await Promise.resolve().then(() => (init_esm2(), esm_exports));
16010
- this.amplitude = init2(this.config.apiKey);
16132
+ const amplitude = await Promise.resolve().then(() => (init_esm2(), esm_exports));
16133
+ amplitude.init(this.config.apiKey);
16134
+ this.amplitudeModule = amplitude;
16011
16135
  } catch (error) {
16012
16136
  console.error(
16013
- "Amplitude subscriber failed to initialize. Install @amplitude/events-node: pnpm add @amplitude/events-node",
16137
+ "Amplitude subscriber failed to initialize. Install @amplitude/analytics-node: pnpm add @amplitude/analytics-node",
16014
16138
  error
16015
16139
  );
16016
16140
  this.enabled = false;
@@ -16025,7 +16149,7 @@ var AmplitudeSubscriber = class {
16025
16149
  async trackEvent(name, attributes) {
16026
16150
  if (!this.enabled) return;
16027
16151
  await this.ensureInitialized();
16028
- this.amplitude?.track({
16152
+ this.amplitudeModule?.track({
16029
16153
  event_type: name,
16030
16154
  user_id: attributes?.userId || attributes?.user_id || "anonymous",
16031
16155
  event_properties: attributes
@@ -16034,7 +16158,7 @@ var AmplitudeSubscriber = class {
16034
16158
  async trackFunnelStep(funnelName, step, attributes) {
16035
16159
  if (!this.enabled) return;
16036
16160
  await this.ensureInitialized();
16037
- this.amplitude?.trackEvent({
16161
+ this.amplitudeModule?.track({
16038
16162
  event_type: `${funnelName}.${step}`,
16039
16163
  user_id: attributes?.userId || attributes?.user_id || "anonymous",
16040
16164
  event_properties: {
@@ -16047,7 +16171,7 @@ var AmplitudeSubscriber = class {
16047
16171
  async trackOutcome(operationName, outcome, attributes) {
16048
16172
  if (!this.enabled) return;
16049
16173
  await this.ensureInitialized();
16050
- this.amplitude?.trackEvent({
16174
+ this.amplitudeModule?.track({
16051
16175
  event_type: `${operationName}.${outcome}`,
16052
16176
  user_id: attributes?.userId || attributes?.user_id || "anonymous",
16053
16177
  event_properties: {
@@ -16060,7 +16184,7 @@ var AmplitudeSubscriber = class {
16060
16184
  async trackValue(name, value, attributes) {
16061
16185
  if (!this.enabled) return;
16062
16186
  await this.ensureInitialized();
16063
- this.amplitude?.trackEvent({
16187
+ this.amplitudeModule?.track({
16064
16188
  event_type: name,
16065
16189
  user_id: attributes?.userId || attributes?.user_id || "anonymous",
16066
16190
  event_properties: {
@@ -16072,8 +16196,8 @@ var AmplitudeSubscriber = class {
16072
16196
  /** Flush pending events before shutdown */
16073
16197
  async shutdown() {
16074
16198
  await this.ensureInitialized();
16075
- if (this.amplitude) {
16076
- await this.amplitude.flush();
16199
+ if (this.amplitudeModule) {
16200
+ await this.amplitudeModule.flush();
16077
16201
  }
16078
16202
  }
16079
16203
  };