autotel-subscribers 13.0.0 → 14.1.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/index.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
  });
@@ -7437,7 +7559,7 @@ var init_stats = __esm({
7437
7559
 
7438
7560
  // ../../node_modules/.pnpm/@segment+analytics-core@1.8.2/node_modules/@segment/analytics-core/dist/esm/context/index.js
7439
7561
  var ContextCancelation, CoreContext;
7440
- var init_context = __esm({
7562
+ var init_context2 = __esm({
7441
7563
  "../../node_modules/.pnpm/@segment+analytics-core@1.8.2/node_modules/@segment/analytics-core/dist/esm/context/index.js"() {
7442
7564
  init_dist3();
7443
7565
  init_dist2();
@@ -7663,7 +7785,7 @@ function ensure(ctx, plugin) {
7663
7785
  var init_delivery = __esm({
7664
7786
  "../../node_modules/.pnpm/@segment+analytics-core@1.8.2/node_modules/@segment/analytics-core/dist/esm/queue/delivery.js"() {
7665
7787
  init_tslib_es6();
7666
- init_context();
7788
+ init_context2();
7667
7789
  }
7668
7790
  });
7669
7791
 
@@ -7674,7 +7796,7 @@ var init_event_queue = __esm({
7674
7796
  init_tslib_es6();
7675
7797
  init_group_by();
7676
7798
  init_priority_queue();
7677
- init_context();
7799
+ init_context2();
7678
7800
  init_esm();
7679
7801
  init_task_group();
7680
7802
  init_delivery();
@@ -8106,7 +8228,7 @@ var init_esm2 = __esm({
8106
8228
  init_callback();
8107
8229
  init_priority_queue();
8108
8230
  init_backoff();
8109
- init_context();
8231
+ init_context2();
8110
8232
  init_event_queue();
8111
8233
  init_analytics();
8112
8234
  init_dispatch();
@@ -9774,7 +9896,7 @@ var init_event_factory = __esm({
9774
9896
 
9775
9897
  // ../../node_modules/.pnpm/@segment+analytics-node@2.3.0/node_modules/@segment/analytics-node/dist/esm/app/context.js
9776
9898
  var Context;
9777
- var init_context2 = __esm({
9899
+ var init_context3 = __esm({
9778
9900
  "../../node_modules/.pnpm/@segment+analytics-node@2.3.0/node_modules/@segment/analytics-node/dist/esm/app/context.js"() {
9779
9901
  init_esm2();
9780
9902
  Context = class extends CoreContext {
@@ -9790,7 +9912,7 @@ var normalizeDispatchCb, dispatchAndEmit;
9790
9912
  var init_dispatch_emit = __esm({
9791
9913
  "../../node_modules/.pnpm/@segment+analytics-node@2.3.0/node_modules/@segment/analytics-node/dist/esm/app/dispatch-emit.js"() {
9792
9914
  init_esm2();
9793
- init_context2();
9915
+ init_context3();
9794
9916
  normalizeDispatchCb = (cb) => (ctx) => {
9795
9917
  const failedDelivery = ctx.failedDelivery();
9796
9918
  return failedDelivery ? cb(failedDelivery.reason, ctx) : cb(void 0, ctx);
@@ -12962,7 +13084,7 @@ var init_analytics_node = __esm({
12962
13084
  init_event_factory();
12963
13085
  init_dispatch_emit();
12964
13086
  init_emitter3();
12965
- init_context2();
13087
+ init_context3();
12966
13088
  init_event_queue2();
12967
13089
  init_http_client();
12968
13090
  Analytics = class extends NodeEmitter {
@@ -13164,7 +13286,7 @@ var init_analytics_node = __esm({
13164
13286
  var init_index_common = __esm({
13165
13287
  "../../node_modules/.pnpm/@segment+analytics-node@2.3.0/node_modules/@segment/analytics-node/dist/esm/index.common.js"() {
13166
13288
  init_analytics_node();
13167
- init_context2();
13289
+ init_context3();
13168
13290
  init_http_client();
13169
13291
  }
13170
13292
  });
@@ -13186,10 +13308,10 @@ var init_esm4 = __esm({
13186
13308
  }
13187
13309
  });
13188
13310
 
13189
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/event/event.js
13311
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/event/event.js
13190
13312
  var IdentifyOperation, SpecialEventType;
13191
13313
  var init_event = __esm({
13192
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/event/event.js"() {
13314
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/event/event.js"() {
13193
13315
  (function(IdentifyOperation3) {
13194
13316
  IdentifyOperation3["SET"] = "$set";
13195
13317
  IdentifyOperation3["SET_ONCE"] = "$setOnce";
@@ -13210,10 +13332,10 @@ var init_event = __esm({
13210
13332
  }
13211
13333
  });
13212
13334
 
13213
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/constants.js
13335
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/constants.js
13214
13336
  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;
13215
13337
  var init_constants = __esm({
13216
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"() {
13338
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/constants.js"() {
13217
13339
  UNSET_VALUE = "-";
13218
13340
  AMPLITUDE_PREFIX = "AMP";
13219
13341
  STORAGE_PREFIX = "".concat(AMPLITUDE_PREFIX, "_unsent");
@@ -13225,10 +13347,10 @@ var init_constants = __esm({
13225
13347
  }
13226
13348
  });
13227
13349
 
13228
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js
13350
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js
13229
13351
  var MAX_PROPERTY_KEYS, isValidObject, isValidProperties;
13230
13352
  var init_valid_properties = __esm({
13231
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js"() {
13353
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js"() {
13232
13354
  init_tslib_es6();
13233
13355
  MAX_PROPERTY_KEYS = 1e3;
13234
13356
  isValidObject = function(properties) {
@@ -13283,10 +13405,10 @@ var init_valid_properties = __esm({
13283
13405
  }
13284
13406
  });
13285
13407
 
13286
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/identify.js
13408
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/identify.js
13287
13409
  var Identify, IdentifyOperation2, OrderedIdentifyOperations;
13288
13410
  var init_identify = __esm({
13289
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/identify.js"() {
13411
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/identify.js"() {
13290
13412
  init_tslib_es6();
13291
13413
  init_constants();
13292
13414
  init_valid_properties();
@@ -13397,10 +13519,10 @@ var init_identify = __esm({
13397
13519
  }
13398
13520
  });
13399
13521
 
13400
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/messages.js
13522
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/messages.js
13401
13523
  var SUCCESS_MESSAGE, UNEXPECTED_ERROR_MESSAGE, MAX_RETRIES_EXCEEDED_MESSAGE, OPT_OUT_MESSAGE, MISSING_API_KEY_MESSAGE, INVALID_API_KEY, CLIENT_NOT_INITIALIZED;
13402
13524
  var init_messages = __esm({
13403
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/messages.js"() {
13525
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/messages.js"() {
13404
13526
  SUCCESS_MESSAGE = "Event tracked successfully";
13405
13527
  UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";
13406
13528
  MAX_RETRIES_EXCEEDED_MESSAGE = "Event rejected due to exceeded retry count";
@@ -13411,10 +13533,10 @@ var init_messages = __esm({
13411
13533
  }
13412
13534
  });
13413
13535
 
13414
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/status.js
13536
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/status.js
13415
13537
  var Status;
13416
13538
  var init_status = __esm({
13417
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/status.js"() {
13539
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/status.js"() {
13418
13540
  (function(Status2) {
13419
13541
  Status2["Unknown"] = "unknown";
13420
13542
  Status2["Skipped"] = "skipped";
@@ -13429,10 +13551,10 @@ var init_status = __esm({
13429
13551
  }
13430
13552
  });
13431
13553
 
13432
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js
13554
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js
13433
13555
  var buildResult;
13434
13556
  var init_result_builder = __esm({
13435
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js"() {
13557
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js"() {
13436
13558
  init_status();
13437
13559
  buildResult = function(event, code, message2) {
13438
13560
  if (code === void 0) {
@@ -13446,10 +13568,10 @@ var init_result_builder = __esm({
13446
13568
  }
13447
13569
  });
13448
13570
 
13449
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/global-scope.js
13571
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/global-scope.js
13450
13572
  var getGlobalScope;
13451
13573
  var init_global_scope = __esm({
13452
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"() {
13574
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/global-scope.js"() {
13453
13575
  getGlobalScope = function() {
13454
13576
  var ampIntegrationContextName = "ampIntegrationContext";
13455
13577
  if (typeof globalThis !== "undefined" && typeof globalThis[ampIntegrationContextName] !== "undefined") {
@@ -13472,10 +13594,10 @@ var init_global_scope = __esm({
13472
13594
  }
13473
13595
  });
13474
13596
 
13475
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js
13597
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js
13476
13598
  var legacyUUID, hex, UUID2;
13477
13599
  var init_uuid2 = __esm({
13478
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js"() {
13600
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js"() {
13479
13601
  init_tslib_es6();
13480
13602
  init_global_scope();
13481
13603
  legacyUUID = function(a) {
@@ -13519,10 +13641,10 @@ var init_uuid2 = __esm({
13519
13641
  }
13520
13642
  });
13521
13643
 
13522
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/timeline.js
13644
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/timeline.js
13523
13645
  var Timeline;
13524
13646
  var init_timeline = __esm({
13525
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/timeline.js"() {
13647
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/timeline.js"() {
13526
13648
  init_tslib_es6();
13527
13649
  init_result_builder();
13528
13650
  init_uuid2();
@@ -13824,10 +13946,10 @@ var init_timeline = __esm({
13824
13946
  }
13825
13947
  });
13826
13948
 
13827
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js
13949
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js
13828
13950
  var createTrackEvent, createIdentifyEvent, createGroupIdentifyEvent, createGroupEvent, createRevenueEvent;
13829
13951
  var init_event_builder = __esm({
13830
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js"() {
13952
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js"() {
13831
13953
  init_tslib_es6();
13832
13954
  init_identify();
13833
13955
  init_event();
@@ -13857,10 +13979,10 @@ var init_event_builder = __esm({
13857
13979
  }
13858
13980
  });
13859
13981
 
13860
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js
13982
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js
13861
13983
  var returnWrapper;
13862
13984
  var init_return_wrapper = __esm({
13863
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js"() {
13985
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js"() {
13864
13986
  returnWrapper = function(awaitable) {
13865
13987
  return {
13866
13988
  promise: awaitable || Promise.resolve()
@@ -13869,10 +13991,10 @@ var init_return_wrapper = __esm({
13869
13991
  }
13870
13992
  });
13871
13993
 
13872
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/core-client.js
13994
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/core-client.js
13873
13995
  var AmplitudeCore;
13874
13996
  var init_core_client = __esm({
13875
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/core-client.js"() {
13997
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/core-client.js"() {
13876
13998
  init_tslib_es6();
13877
13999
  init_event();
13878
14000
  init_identify();
@@ -14140,10 +14262,10 @@ var init_core_client = __esm({
14140
14262
  }
14141
14263
  });
14142
14264
 
14143
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/revenue.js
14265
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/revenue.js
14144
14266
  var Revenue, RevenueProperty;
14145
14267
  var init_revenue = __esm({
14146
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/revenue.js"() {
14268
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/revenue.js"() {
14147
14269
  init_tslib_es6();
14148
14270
  init_valid_properties();
14149
14271
  Revenue = /** @class */
@@ -14220,10 +14342,10 @@ var init_revenue = __esm({
14220
14342
  }
14221
14343
  });
14222
14344
 
14223
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js
14345
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js
14224
14346
  var chunk;
14225
14347
  var init_chunk = __esm({
14226
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js"() {
14348
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js"() {
14227
14349
  chunk = function(arr, size) {
14228
14350
  var chunkSize = Math.max(size, 1);
14229
14351
  return arr.reduce(function(chunks, element, index) {
@@ -14238,10 +14360,10 @@ var init_chunk = __esm({
14238
14360
  }
14239
14361
  });
14240
14362
 
14241
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js
14363
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js
14242
14364
  var LogLevel;
14243
14365
  var init_loglevel = __esm({
14244
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js"() {
14366
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/loglevel.js"() {
14245
14367
  (function(LogLevel2) {
14246
14368
  LogLevel2[LogLevel2["None"] = 0] = "None";
14247
14369
  LogLevel2[LogLevel2["Error"] = 1] = "Error";
@@ -14252,10 +14374,10 @@ var init_loglevel = __esm({
14252
14374
  }
14253
14375
  });
14254
14376
 
14255
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/logger.js
14377
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/logger.js
14256
14378
  var PREFIX, Logger;
14257
14379
  var init_logger3 = __esm({
14258
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/logger.js"() {
14380
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/logger.js"() {
14259
14381
  init_loglevel();
14260
14382
  PREFIX = "Amplitude Logger ";
14261
14383
  Logger = /** @class */
@@ -14317,10 +14439,10 @@ var init_logger3 = __esm({
14317
14439
  }
14318
14440
  });
14319
14441
 
14320
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/config.js
14442
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/config.js
14321
14443
  var getDefaultConfig, Config, getServerUrl, createServerConfig, RequestMetadata;
14322
14444
  var init_config = __esm({
14323
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/config.js"() {
14445
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/config.js"() {
14324
14446
  init_constants();
14325
14447
  init_logger3();
14326
14448
  init_loglevel();
@@ -14421,19 +14543,19 @@ var init_config = __esm({
14421
14543
  }
14422
14544
  });
14423
14545
 
14424
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/status-code.js
14546
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/status-code.js
14425
14547
  function isSuccessStatusCode(code) {
14426
14548
  return code >= 200 && code < 300;
14427
14549
  }
14428
14550
  var init_status_code = __esm({
14429
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/status-code.js"() {
14551
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/status-code.js"() {
14430
14552
  }
14431
14553
  });
14432
14554
 
14433
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js
14555
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js
14434
14556
  var getStacktrace, getClientLogConfig, getValueByStringPath, getClientStates, debugWrapper;
14435
14557
  var init_debug = __esm({
14436
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js"() {
14558
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js"() {
14437
14559
  init_tslib_es6();
14438
14560
  init_loglevel();
14439
14561
  getStacktrace = function(ignoreDepth) {
@@ -14551,7 +14673,7 @@ var init_debug = __esm({
14551
14673
  }
14552
14674
  });
14553
14675
 
14554
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js
14676
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js
14555
14677
  function getErrorMessage(error) {
14556
14678
  if (error instanceof Error)
14557
14679
  return error.message;
@@ -14569,7 +14691,7 @@ function getResponseBodyString(res) {
14569
14691
  }
14570
14692
  var Destination;
14571
14693
  var init_destination = __esm({
14572
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js"() {
14694
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js"() {
14573
14695
  init_tslib_es6();
14574
14696
  init_status();
14575
14697
  init_messages();
@@ -14960,10 +15082,10 @@ var init_destination = __esm({
14960
15082
  }
14961
15083
  });
14962
15084
 
14963
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/transports/base.js
15085
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/transports/base.js
14964
15086
  var BaseTransport;
14965
15087
  var init_base2 = __esm({
14966
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/transports/base.js"() {
15088
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/transports/base.js"() {
14967
15089
  init_status();
14968
15090
  init_status_code();
14969
15091
  BaseTransport = /** @class */
@@ -15065,10 +15187,10 @@ var init_base2 = __esm({
15065
15187
  }
15066
15188
  });
15067
15189
 
15068
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/server-zone.js
15190
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/server-zone.js
15069
15191
  var ServerZone;
15070
15192
  var init_server_zone = __esm({
15071
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/server-zone.js"() {
15193
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/server-zone.js"() {
15072
15194
  (function(ServerZone2) {
15073
15195
  ServerZone2["US"] = "US";
15074
15196
  ServerZone2["EU"] = "EU";
@@ -15077,17 +15199,17 @@ var init_server_zone = __esm({
15077
15199
  }
15078
15200
  });
15079
15201
 
15080
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/offline.js
15202
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/offline.js
15081
15203
  var OfflineDisabled;
15082
15204
  var init_offline = __esm({
15083
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/types/offline.js"() {
15205
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/types/offline.js"() {
15084
15206
  OfflineDisabled = null;
15085
15207
  }
15086
15208
  });
15087
15209
 
15088
- // ../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/index.js
15210
+ // ../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/index.js
15089
15211
  var init_esm5 = __esm({
15090
- "../../node_modules/.pnpm/@amplitude+analytics-core@2.33.0/node_modules/@amplitude/analytics-core/lib/esm/index.js"() {
15212
+ "../../node_modules/.pnpm/@amplitude+analytics-core@2.35.0/node_modules/@amplitude/analytics-core/lib/esm/index.js"() {
15091
15213
  init_core_client();
15092
15214
  init_identify();
15093
15215
  init_revenue();
@@ -15104,18 +15226,18 @@ var init_esm5 = __esm({
15104
15226
  }
15105
15227
  });
15106
15228
 
15107
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/version.js
15229
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/version.js
15108
15230
  var VERSION;
15109
15231
  var init_version3 = __esm({
15110
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/version.js"() {
15111
- VERSION = "1.5.26";
15232
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/version.js"() {
15233
+ VERSION = "1.5.29";
15112
15234
  }
15113
15235
  });
15114
15236
 
15115
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js
15237
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js
15116
15238
  var Context2;
15117
- var init_context3 = __esm({
15118
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js"() {
15239
+ var init_context4 = __esm({
15240
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js"() {
15119
15241
  init_tslib_es6();
15120
15242
  init_esm5();
15121
15243
  init_version3();
@@ -15150,7 +15272,7 @@ var init_context3 = __esm({
15150
15272
  });
15151
15273
  var Http;
15152
15274
  var init_http = __esm({
15153
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/transports/http.js"() {
15275
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/transports/http.js"() {
15154
15276
  init_tslib_es6();
15155
15277
  init_esm5();
15156
15278
  Http = /** @class */
@@ -15212,10 +15334,10 @@ var init_http = __esm({
15212
15334
  }
15213
15335
  });
15214
15336
 
15215
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/config.js
15337
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/config.js
15216
15338
  var NodeConfig, useNodeConfig;
15217
15339
  var init_config2 = __esm({
15218
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/config.js"() {
15340
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/config.js"() {
15219
15341
  init_tslib_es6();
15220
15342
  init_esm5();
15221
15343
  init_http();
@@ -15233,13 +15355,13 @@ var init_config2 = __esm({
15233
15355
  }
15234
15356
  });
15235
15357
 
15236
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/node-client.js
15358
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/node-client.js
15237
15359
  var AmplitudeNode, createInstance, node_client_default;
15238
15360
  var init_node_client = __esm({
15239
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/node-client.js"() {
15361
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/node-client.js"() {
15240
15362
  init_tslib_es6();
15241
15363
  init_esm5();
15242
- init_context3();
15364
+ init_context4();
15243
15365
  init_config2();
15244
15366
  AmplitudeNode = /** @class */
15245
15367
  (function(_super) {
@@ -15310,7 +15432,7 @@ var init_node_client = __esm({
15310
15432
  }
15311
15433
  });
15312
15434
 
15313
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/types.js
15435
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/types.js
15314
15436
  var types_exports = {};
15315
15437
  __export(types_exports, {
15316
15438
  IdentifyOperation: () => IdentifyOperation,
@@ -15321,12 +15443,12 @@ __export(types_exports, {
15321
15443
  SpecialEventType: () => SpecialEventType
15322
15444
  });
15323
15445
  var init_types4 = __esm({
15324
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/types.js"() {
15446
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/types.js"() {
15325
15447
  init_esm5();
15326
15448
  }
15327
15449
  });
15328
15450
 
15329
- // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/index.js
15451
+ // ../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/index.js
15330
15452
  var esm_exports2 = {};
15331
15453
  __export(esm_exports2, {
15332
15454
  Identify: () => Identify,
@@ -15347,7 +15469,7 @@ __export(esm_exports2, {
15347
15469
  });
15348
15470
  var add, groupIdentify, identify, init, logEvent, remove, revenue, setGroup, setOptOut, track, flush;
15349
15471
  var init_esm6 = __esm({
15350
- "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.26/node_modules/@amplitude/analytics-node/lib/esm/index.js"() {
15472
+ "../../node_modules/.pnpm/@amplitude+analytics-node@1.5.29/node_modules/@amplitude/analytics-node/lib/esm/index.js"() {
15351
15473
  init_node_client();
15352
15474
  init_node_client();
15353
15475
  init_esm5();
@@ -16082,7 +16204,8 @@ var SegmentSubscriber = class {
16082
16204
  var AmplitudeSubscriber = class {
16083
16205
  name = "AmplitudeSubscriber";
16084
16206
  version = "1.0.0";
16085
- amplitude;
16207
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16208
+ amplitudeModule = null;
16086
16209
  enabled;
16087
16210
  config;
16088
16211
  initPromise = null;
@@ -16095,11 +16218,12 @@ var AmplitudeSubscriber = class {
16095
16218
  }
16096
16219
  async initialize() {
16097
16220
  try {
16098
- const { init: init2 } = await Promise.resolve().then(() => (init_esm6(), esm_exports2));
16099
- this.amplitude = init2(this.config.apiKey);
16221
+ const amplitude = await Promise.resolve().then(() => (init_esm6(), esm_exports2));
16222
+ amplitude.init(this.config.apiKey);
16223
+ this.amplitudeModule = amplitude;
16100
16224
  } catch (error) {
16101
16225
  console.error(
16102
- "Amplitude subscriber failed to initialize. Install @amplitude/events-node: pnpm add @amplitude/events-node",
16226
+ "Amplitude subscriber failed to initialize. Install @amplitude/analytics-node: pnpm add @amplitude/analytics-node",
16103
16227
  error
16104
16228
  );
16105
16229
  this.enabled = false;
@@ -16114,7 +16238,7 @@ var AmplitudeSubscriber = class {
16114
16238
  async trackEvent(name, attributes) {
16115
16239
  if (!this.enabled) return;
16116
16240
  await this.ensureInitialized();
16117
- this.amplitude?.track({
16241
+ this.amplitudeModule?.track({
16118
16242
  event_type: name,
16119
16243
  user_id: attributes?.userId || attributes?.user_id || "anonymous",
16120
16244
  event_properties: attributes
@@ -16123,7 +16247,7 @@ var AmplitudeSubscriber = class {
16123
16247
  async trackFunnelStep(funnelName, step, attributes) {
16124
16248
  if (!this.enabled) return;
16125
16249
  await this.ensureInitialized();
16126
- this.amplitude?.trackEvent({
16250
+ this.amplitudeModule?.track({
16127
16251
  event_type: `${funnelName}.${step}`,
16128
16252
  user_id: attributes?.userId || attributes?.user_id || "anonymous",
16129
16253
  event_properties: {
@@ -16136,7 +16260,7 @@ var AmplitudeSubscriber = class {
16136
16260
  async trackOutcome(operationName, outcome, attributes) {
16137
16261
  if (!this.enabled) return;
16138
16262
  await this.ensureInitialized();
16139
- this.amplitude?.trackEvent({
16263
+ this.amplitudeModule?.track({
16140
16264
  event_type: `${operationName}.${outcome}`,
16141
16265
  user_id: attributes?.userId || attributes?.user_id || "anonymous",
16142
16266
  event_properties: {
@@ -16149,7 +16273,7 @@ var AmplitudeSubscriber = class {
16149
16273
  async trackValue(name, value, attributes) {
16150
16274
  if (!this.enabled) return;
16151
16275
  await this.ensureInitialized();
16152
- this.amplitude?.trackEvent({
16276
+ this.amplitudeModule?.track({
16153
16277
  event_type: name,
16154
16278
  user_id: attributes?.userId || attributes?.user_id || "anonymous",
16155
16279
  event_properties: {
@@ -16161,8 +16285,8 @@ var AmplitudeSubscriber = class {
16161
16285
  /** Flush pending events before shutdown */
16162
16286
  async shutdown() {
16163
16287
  await this.ensureInitialized();
16164
- if (this.amplitude) {
16165
- await this.amplitude.flush();
16288
+ if (this.amplitudeModule) {
16289
+ await this.amplitudeModule.flush();
16166
16290
  }
16167
16291
  }
16168
16292
  };