@amplitude/plugin-network-capture-browser 1.1.4 → 1.1.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"network-capture-plugin.d.ts","sourceRoot":"","sources":["../../src/network-capture-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EAGnB,sBAAsB,EACvB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,EAAE,uBAAuB,CAAC,KAAK,CAAC,CAAC;KAC5C;CACF;AAED,MAAM,MAAM,uBAAuB,GAAG,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAErF,MAAM,MAAM,8BAA8B,GAAG,QAAQ,CACnD,IAAI,CAAC,0BAA0B,EAAE,cAAc,GAAG,sBAAsB,GAAG,sBAAsB,CAAC,CACnG,GACC,0BAA0B,CAAC;AAE7B,oBAAY,eAAe;IACzB,iBAAiB,sBAAsB;CACxC;AAGD,KAAK,oBAAoB,CAAC,CAAC,IAAI;IAC7B,KAAK,EAAE,CAAC,CAAC;IACT,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;CACnF,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,KAAK,CAAC;AACnD,MAAM,MAAM,4BAA4B,CAAC,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAAC,GAAG;IACtE,KAAK,EAAE,UAAU,GAAG,KAAK,CAAC;IAC1B,IAAI,EAAE,OAAO,GAAG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AG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;CACnF,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,KAAK,CAAC;AACnD,MAAM,MAAM,4BAA4B,CAAC,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAAC,GAAG;IACtE,KAAK,EAAE,UAAU,GAAG,KAAK,CAAC;IAC1B,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,sBAAsB,EAAE,OAAO,CAAC;IAChC,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9C,CAAC;AAGF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAAC,GAAG,4BAA4B,CAAC,CAAC,CAAC,CAAC;AAE5F,MAAM,WAAW,oBAAoB;IACnC,CAAC,eAAe,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC;CACxF;AAED,eAAO,MAAM,oBAAoB,aAAa,sBAAsB,KAAQ,uBA8E3E,CAAC"}
@@ -15,6 +15,7 @@ var networkCapturePlugin = function (options) {
15
15
  if (options === void 0) { options = {}; }
16
16
  var name = constants.PLUGIN_NAME;
17
17
  var type = 'enrichment';
18
+ var logger;
18
19
  var subscriptions = [];
19
20
  var addAdditionalEventProperties = function (event, type) {
20
21
  var baseEvent = {
@@ -32,7 +33,7 @@ var networkCapturePlugin = function (options) {
32
33
  var eventWithProperties = addAdditionalEventProperties(event, 'network');
33
34
  observer.next(eventWithProperties);
34
35
  });
35
- analytics_core_1.networkObserver.subscribe(callback);
36
+ analytics_core_1.networkObserver.subscribe(callback, logger);
36
37
  return function () {
37
38
  analytics_core_1.networkObserver.unsubscribe(callback);
38
39
  };
@@ -43,8 +44,7 @@ var networkCapturePlugin = function (options) {
43
44
  };
44
45
  var setup = function (config, amplitude) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
45
46
  var allObservables, networkRequestSubscription;
46
- var _a;
47
- return tslib_1.__generator(this, function (_b) {
47
+ return tslib_1.__generator(this, function (_a) {
48
48
  /* istanbul ignore if */
49
49
  if (typeof document === 'undefined') {
50
50
  return [2 /*return*/];
@@ -57,7 +57,9 @@ var networkCapturePlugin = function (options) {
57
57
  });
58
58
  subscriptions.push(networkRequestSubscription);
59
59
  /* istanbul ignore next */
60
- (_a = config === null || config === void 0 ? void 0 : config.loggerProvider) === null || _a === void 0 ? void 0 : _a.log("".concat(name, " has been successfully added."));
60
+ logger = config === null || config === void 0 ? void 0 : config.loggerProvider;
61
+ /* istanbul ignore next */
62
+ logger === null || logger === void 0 ? void 0 : logger.log("".concat(name, " has been successfully added."));
61
63
  return [2 /*return*/];
62
64
  });
63
65
  }); };
@@ -1 +1 @@
1
- {"version":3,"file":"network-capture-plugin.js","sourceRoot":"","sources":["../../src/network-capture-plugin.ts"],"names":[],"mappings":";;;;AAAA,0CAA0C;AAC1C,4DASmC;AACnC,6DAAyC;AACzC,6BAAgD;AAEhD,6DAA2D;AAe3D,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,0DAAuC,CAAA;AACzC,CAAC,EAFW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAE1B;AAyBM,IAAM,oBAAoB,GAAG,UAAC,OAAoC;IAApC,wBAAA,EAAA,YAAoC;IACvE,IAAM,IAAI,GAAG,SAAS,CAAC,WAAW,CAAC;IACnC,IAAM,IAAI,GAAG,YAAY,CAAC;IAE1B,IAAM,aAAa,GAAmB,EAAE,CAAC;IAEzC,IAAM,4BAA4B,GAAG,UACnC,KAAQ,EACR,IAAiC;QAEjC,IAAM,SAAS,GAA8D;YAC3E,KAAK,OAAA;YACL,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,IAAI,MAAA;SACL,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,6CAA6C;IAC7C,IAAM,iBAAiB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ACF,CAAC;IAEF,OAAO;QACL,IAAI,MAAA;QACJ,IAAI,MAAA;QACJ,KAAK,OAAA;QACL,OAAO,SAAA;QACP,QAAQ,UAAA;KACT,CAAC;AACJ,CAAC,CAAC;AA3EW,QAAA,oBAAoB,wBA2E/B","sourcesContent":["/* eslint-disable no-restricted-globals */\nimport {\n BrowserClient,\n BrowserConfig,\n EnrichmentPlugin,\n ElementInteractionsOptions,\n NetworkRequestEvent,\n networkObserver,\n NetworkEventCallback,\n NetworkTrackingOptions,\n} from '@amplitude/analytics-core';\nimport * as constants from './constants';\nimport { Observable, Subscription } from 'rxjs';\nimport { HasEventTargetAddRemove } from 'rxjs/internal/observable/fromEvent';\nimport { trackNetworkEvents } from './track-network-event';\n\ndeclare global {\n interface Window {\n navigation: HasEventTargetAddRemove<Event>;\n }\n}\n\nexport type BrowserEnrichmentPlugin = EnrichmentPlugin<BrowserClient, BrowserConfig>;\n\nexport type AutoCaptureOptionsWithDefaults = Required<\n Pick<ElementInteractionsOptions, 'debounceTime' | 'cssSelectorAllowlist' | 'actionClickAllowlist'>\n> &\n ElementInteractionsOptions;\n\nexport enum ObservablesEnum {\n NetworkObservable = 'networkObservable',\n}\n\n// Base TimestampedEvent type\ntype BaseTimestampedEvent<T> = {\n event: T;\n timestamp: number;\n type: 'rage' | 'click' | 'change' | 'error' | 'navigate' | 'mutation' | 'network';\n};\n\n// Specific types for events with targetElementProperties\nexport type ElementBasedEvent = MouseEvent | Event;\nexport type ElementBasedTimestampedEvent<T> = BaseTimestampedEvent<T> & {\n event: MouseEvent | Event;\n type: 'click' | 'change';\n closestTrackedAncestor: Element;\n targetElementProperties: Record<string, any>;\n};\n\n// Union type for all possible TimestampedEvents\nexport type TimestampedEvent<T> = BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T>;\n\nexport interface AllWindowObservables {\n [ObservablesEnum.NetworkObservable]: Observable<TimestampedEvent<NetworkRequestEvent>>;\n}\n\nexport const networkCapturePlugin = (options: NetworkTrackingOptions = {}): BrowserEnrichmentPlugin => {\n const name = constants.PLUGIN_NAME;\n const type = 'enrichment';\n\n const subscriptions: Subscription[] = [];\n\n const addAdditionalEventProperties = <T>(\n event: T,\n type: TimestampedEvent<T>['type'],\n ): TimestampedEvent<T> | ElementBasedTimestampedEvent<T> => {\n const baseEvent: BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T> = {\n event,\n timestamp: Date.now(),\n type,\n };\n\n return baseEvent;\n };\n\n // Create observables on events on the window\n const createObservables = (): AllWindowObservables => {\n const networkObservable = new Observable<TimestampedEvent<NetworkRequestEvent>>((observer) => {\n const callback = new NetworkEventCallback((event) => {\n const eventWithProperties = addAdditionalEventProperties(event, 'network');\n observer.next(eventWithProperties);\n });\n networkObserver.subscribe(callback);\n return () => {\n networkObserver.unsubscribe(callback);\n };\n });\n\n return {\n [ObservablesEnum.NetworkObservable]: networkObservable,\n };\n };\n\n const setup: BrowserEnrichmentPlugin['setup'] = async (config, amplitude) => {\n /* istanbul ignore if */\n if (typeof document === 'undefined') {\n return;\n }\n\n // Create observables for events on the window\n const allObservables = createObservables();\n\n const networkRequestSubscription = trackNetworkEvents({\n allObservables,\n networkTrackingOptions: options,\n amplitude,\n });\n subscriptions.push(networkRequestSubscription);\n\n /* istanbul ignore next */\n config?.loggerProvider?.log(`${name} has been successfully added.`);\n };\n\n /* istanbul ignore next */\n const execute: BrowserEnrichmentPlugin['execute'] = async (event) => {\n return event;\n };\n\n const teardown = async () => {\n for (const subscription of subscriptions) {\n subscription.unsubscribe();\n }\n };\n\n return {\n name,\n type,\n setup,\n execute,\n teardown,\n };\n};\n"]}
1
+ {"version":3,"file":"network-capture-plugin.js","sourceRoot":"","sources":["../../src/network-capture-plugin.ts"],"names":[],"mappings":";;;;AAAA,0CAA0C;AAC1C,4DAUmC;AACnC,6DAAyC;AACzC,6BAAgD;AAEhD,6DAA2D;AAe3D,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,0DAAuC,CAAA;AACzC,CAAC,EAFW,e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pD,cAAc,gBAAA;gBACd,sBAAsB,EAAE,OAAO;gBAC/B,SAAS,WAAA;aACV,CAAC,CAAC;YACH,aAAa,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YAE/C,0BAA0B;YAC1B,MAAM,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,CAAC;YAChC,0BAA0B;YAC1B,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,CAAC,UAAG,IAAI,kCAA+B,CAAC,CAAC;;;SACrD,CAAC;IAEF,0BAA0B;IAC1B,IAAM,OAAO,GAAuC,UAAO,KAAK;;YAC9D,sBAAO,KAAK,EAAC;;SACd,CAAC;IAEF,IAAM,QAAQ,GAAG;;;;;gBACf,KAA2B,kBAAA,iBAAA,aAAa,CAAA,mHAAE;oBAA/B,YAAY;oBACrB,YAAY,CAAC,WAAW,EAAE,CAAC;iBAC5B;;;;;;;;;;;SACF,CAAC;IAEF,OAAO;QACL,IAAI,MAAA;QACJ,IAAI,MAAA;QACJ,KAAK,OAAA;QACL,OAAO,SAAA;QACP,QAAQ,UAAA;KACT,CAAC;AACJ,CAAC,CAAC;AA9EW,QAAA,oBAAoB,wBA8E/B","sourcesContent":["/* eslint-disable no-restricted-globals */\nimport {\n BrowserClient,\n BrowserConfig,\n EnrichmentPlugin,\n ElementInteractionsOptions,\n NetworkRequestEvent,\n networkObserver,\n NetworkEventCallback,\n NetworkTrackingOptions,\n ILogger,\n} from '@amplitude/analytics-core';\nimport * as constants from './constants';\nimport { Observable, Subscription } from 'rxjs';\nimport { HasEventTargetAddRemove } from 'rxjs/internal/observable/fromEvent';\nimport { trackNetworkEvents } from './track-network-event';\n\ndeclare global {\n interface Window {\n navigation: HasEventTargetAddRemove<Event>;\n }\n}\n\nexport type BrowserEnrichmentPlugin = EnrichmentPlugin<BrowserClient, BrowserConfig>;\n\nexport type AutoCaptureOptionsWithDefaults = Required<\n Pick<ElementInteractionsOptions, 'debounceTime' | 'cssSelectorAllowlist' | 'actionClickAllowlist'>\n> &\n ElementInteractionsOptions;\n\nexport enum ObservablesEnum {\n NetworkObservable = 'networkObservable',\n}\n\n// Base TimestampedEvent type\ntype BaseTimestampedEvent<T> = {\n event: T;\n timestamp: number;\n type: 'rage' | 'click' | 'change' | 'error' | 'navigate' | 'mutation' | 'network';\n};\n\n// Specific types for events with targetElementProperties\nexport type ElementBasedEvent = MouseEvent | Event;\nexport type ElementBasedTimestampedEvent<T> = BaseTimestampedEvent<T> & {\n event: MouseEvent | Event;\n type: 'click' | 'change';\n closestTrackedAncestor: Element;\n targetElementProperties: Record<string, any>;\n};\n\n// Union type for all possible TimestampedEvents\nexport type TimestampedEvent<T> = BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T>;\n\nexport interface AllWindowObservables {\n [ObservablesEnum.NetworkObservable]: Observable<TimestampedEvent<NetworkRequestEvent>>;\n}\n\nexport const networkCapturePlugin = (options: NetworkTrackingOptions = {}): BrowserEnrichmentPlugin => {\n const name = constants.PLUGIN_NAME;\n const type = 'enrichment';\n let logger: ILogger;\n\n const subscriptions: Subscription[] = [];\n\n const addAdditionalEventProperties = <T>(\n event: T,\n type: TimestampedEvent<T>['type'],\n ): TimestampedEvent<T> | ElementBasedTimestampedEvent<T> => {\n const baseEvent: BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T> = {\n event,\n timestamp: Date.now(),\n type,\n };\n\n return baseEvent;\n };\n\n // Create observables on events on the window\n const createObservables = (): AllWindowObservables => {\n const networkObservable = new Observable<TimestampedEvent<NetworkRequestEvent>>((observer) => {\n const callback = new NetworkEventCallback((event) => {\n const eventWithProperties = addAdditionalEventProperties(event, 'network');\n observer.next(eventWithProperties);\n });\n networkObserver.subscribe(callback, logger);\n return () => {\n networkObserver.unsubscribe(callback);\n };\n });\n\n return {\n [ObservablesEnum.NetworkObservable]: networkObservable,\n };\n };\n\n const setup: BrowserEnrichmentPlugin['setup'] = async (config, amplitude) => {\n /* istanbul ignore if */\n if (typeof document === 'undefined') {\n return;\n }\n\n // Create observables for events on the window\n const allObservables = createObservables();\n\n const networkRequestSubscription = trackNetworkEvents({\n allObservables,\n networkTrackingOptions: options,\n amplitude,\n });\n subscriptions.push(networkRequestSubscription);\n\n /* istanbul ignore next */\n logger = config?.loggerProvider;\n /* istanbul ignore next */\n logger?.log(`${name} has been successfully added.`);\n };\n\n /* istanbul ignore next */\n const execute: BrowserEnrichmentPlugin['execute'] = async (event) => {\n return event;\n };\n\n const teardown = async () => {\n for (const subscription of subscriptions) {\n subscription.unsubscribe();\n }\n };\n\n return {\n name,\n type,\n setup,\n execute,\n teardown,\n };\n};\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.1.4";
1
+ export declare const VERSION = "1.1.6";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.1.4';
4
+ exports.VERSION = '1.1.6';
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.1.4';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.1.6';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"network-capture-plugin.d.ts","sourceRoot":"","sources":["../../src/network-capture-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EAGnB,sBAAsB,EACvB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,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AGF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAAC,GAAG,4BAA4B,CAAC,CAAC,CAAC,CAAC;AAE5F,MAAM,WAAW,oBAAoB;IACnC,CAAC,eAAe,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC;CACxF;AAED,eAAO,MAAM,oBAAoB,aAAa,sBAAsB,KAAQ,uBA8E3E,CAAC"}
@@ -12,6 +12,7 @@ export var networkCapturePlugin = function (options) {
12
12
  if (options === void 0) { options = {}; }
13
13
  var name = constants.PLUGIN_NAME;
14
14
  var type = 'enrichment';
15
+ var logger;
15
16
  var subscriptions = [];
16
17
  var addAdditionalEventProperties = function (event, type) {
17
18
  var baseEvent = {
@@ -29,7 +30,7 @@ export var networkCapturePlugin = function (options) {
29
30
  var eventWithProperties = addAdditionalEventProperties(event, 'network');
30
31
  observer.next(eventWithProperties);
31
32
  });
32
- networkObserver.subscribe(callback);
33
+ networkObserver.subscribe(callback, logger);
33
34
  return function () {
34
35
  networkObserver.unsubscribe(callback);
35
36
  };
@@ -40,8 +41,7 @@ export var networkCapturePlugin = function (options) {
40
41
  };
41
42
  var setup = function (config, amplitude) { return __awaiter(void 0, void 0, void 0, function () {
42
43
  var allObservables, networkRequestSubscription;
43
- var _a;
44
- return __generator(this, function (_b) {
44
+ return __generator(this, function (_a) {
45
45
  /* istanbul ignore if */
46
46
  if (typeof document === 'undefined') {
47
47
  return [2 /*return*/];
@@ -54,7 +54,9 @@ export var networkCapturePlugin = function (options) {
54
54
  });
55
55
  subscriptions.push(networkRequestSubscription);
56
56
  /* istanbul ignore next */
57
- (_a = config === null || config === void 0 ? void 0 : config.loggerProvider) === null || _a === void 0 ? void 0 : _a.log("".concat(name, " has been successfully added."));
57
+ logger = config === null || config === void 0 ? void 0 : config.loggerProvider;
58
+ /* istanbul ignore next */
59
+ logger === null || logger === void 0 ? void 0 : logger.log("".concat(name, " has been successfully added."));
58
60
  return [2 /*return*/];
59
61
  });
60
62
  }); };
@@ -1 +1 @@
1
- {"version":3,"file":"network-capture-plugin.js","sourceRoot":"","sources":["../../src/network-capture-plugin.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,OAAO,EAML,eAAe,EACf,oBAAoB,GAErB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAe3D,MAAM,CAAN,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,0DAAuC,CAAA;AACzC,CAAC,EAFW,eAAe,KAAf,eAAe,QAE1B;AAyBD,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAAC,OAAoC;IAApC,wBAAA,EAAA,YAAoC;IACvE,IAAM,IAAI,GAAG,SAAS,CAAC,WAAW,CAAC;IACnC,IAAM,IAAI,GAAG,YAAY,CAAC;IAE1B,IAAM,aAAa,GAAmB,EAAE,CAAC;IAEzC,IAAM,4BAA4B,GAAG,UACnC,KAAQ,EACR,IAAiC;QAEjC,IAAM,SAAS,GAA8D;YAC3E,KAAK,OAAA;YACL,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,IAAI,MAAA;SACL,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,6CAA6C;IAC7C,IAAM,iBAAiB,GAAG;;QACxB,IAAM,iBAAiB,GAAG,IAAI,UAAU,CAAwC,UAAC,QAAQ;YACvF,IAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,UAAC,KAAK;gBAC9C,IAAM,mBAAmB,GAAG,4BAA4B,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;gBAC3E,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;YACH,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YACpC,OAAO;gBACL,eAAe,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACxC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH;YACE,GAAC,eAAe,CAAC,iBAAiB,IAAG,iBAAiB;eACtD;IACJ,CAAC,CAAC;IAEF,IAAM,KAAK,GAAqC,UAAO,MAAM,EAAE,SAAS;;;;YACtE,wBAAwB;YACxB,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;gBACnC,sBAAO;aACR;YAGK,cAAc,GAAG,iBAAiB,EAAE,CAAC;YAErC,0BAA0B,GAAG,kBAAkB,CAAC;gBACpD,cAAc,gBAAA;gBACd,sBAAsB,EAAE,OAAO;gBAC/B,SAAS,WAAA;aACV,CAAC,CAAC;YACH,aAAa,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;YAE/C,0BAA0B;YAC1B,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,0CAAE,GAAG,CAAC,UAAG,IAAI,kCAA+B,CAAC,CAAC;;;SACrE,CAAC;IAEF,0BAA0B;IAC1B,IAAM,OAAO,GAAuC,UAAO,KAAK;;YAC9D,sBAAO,KAAK,EAAC;;SACd,CAAC;IAEF,IAAM,QAAQ,GAAG;;;;;gBACf,KAA2B,kBAAA,SAAA,aAAa,CAAA,mHAAE;oBAA/B,YAAY;oBACrB,YAAY,CAAC,WAAW,EAAE,CAAC;iBAC5B;;;;;;;;;;;SACF,CAAC;IAEF,OAAO;QACL,IAAI,MAAA;QACJ,IAAI,MAAA;QACJ,KAAK,OAAA;QACL,OAAO,SAAA;QACP,QAAQ,UAAA;KACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable no-restricted-globals */\nimport {\n BrowserClient,\n BrowserConfig,\n EnrichmentPlugin,\n ElementInteractionsOptions,\n NetworkRequestEvent,\n networkObserver,\n NetworkEventCallback,\n NetworkTrackingOptions,\n} from '@amplitude/analytics-core';\nimport * as constants from './constants';\nimport { Observable, Subscription } from 'rxjs';\nimport { HasEventTargetAddRemove } from 'rxjs/internal/observable/fromEvent';\nimport { trackNetworkEvents } from './track-network-event';\n\ndeclare global {\n interface Window {\n navigation: HasEventTargetAddRemove<Event>;\n }\n}\n\nexport type BrowserEnrichmentPlugin = EnrichmentPlugin<BrowserClient, BrowserConfig>;\n\nexport type AutoCaptureOptionsWithDefaults = Required<\n Pick<ElementInteractionsOptions, 'debounceTime' | 'cssSelectorAllowlist' | 'actionClickAllowlist'>\n> &\n ElementInteractionsOptions;\n\nexport enum ObservablesEnum {\n NetworkObservable = 'networkObservable',\n}\n\n// Base TimestampedEvent type\ntype BaseTimestampedEvent<T> = {\n event: T;\n timestamp: number;\n type: 'rage' | 'click' | 'change' | 'error' | 'navigate' | 'mutation' | 'network';\n};\n\n// Specific types for events with targetElementProperties\nexport type ElementBasedEvent = MouseEvent | Event;\nexport type ElementBasedTimestampedEvent<T> = BaseTimestampedEvent<T> & {\n event: MouseEvent | Event;\n type: 'click' | 'change';\n closestTrackedAncestor: Element;\n targetElementProperties: Record<string, any>;\n};\n\n// Union type for all possible TimestampedEvents\nexport type TimestampedEvent<T> = BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T>;\n\nexport interface AllWindowObservables {\n [ObservablesEnum.NetworkObservable]: Observable<TimestampedEvent<NetworkRequestEvent>>;\n}\n\nexport const networkCapturePlugin = (options: NetworkTrackingOptions = {}): BrowserEnrichmentPlugin => {\n const name = constants.PLUGIN_NAME;\n const type = 'enrichment';\n\n const subscriptions: Subscription[] = [];\n\n const addAdditionalEventProperties = <T>(\n event: T,\n type: TimestampedEvent<T>['type'],\n ): TimestampedEvent<T> | ElementBasedTimestampedEvent<T> => {\n const baseEvent: BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T> = {\n event,\n timestamp: Date.now(),\n type,\n };\n\n return baseEvent;\n };\n\n // Create observables on events on the window\n const createObservables = (): AllWindowObservables => {\n const networkObservable = new Observable<TimestampedEvent<NetworkRequestEvent>>((observer) => {\n const callback = new NetworkEventCallback((event) => {\n const eventWithProperties = addAdditionalEventProperties(event, 'network');\n observer.next(eventWithProperties);\n });\n networkObserver.subscribe(callback);\n return () => {\n networkObserver.unsubscribe(callback);\n };\n });\n\n return {\n [ObservablesEnum.NetworkObservable]: networkObservable,\n };\n };\n\n const setup: BrowserEnrichmentPlugin['setup'] = async (config, amplitude) => {\n /* istanbul ignore if */\n if (typeof document === 'undefined') {\n return;\n }\n\n // Create observables for events on the window\n const allObservables = createObservables();\n\n const networkRequestSubscription = trackNetworkEvents({\n allObservables,\n networkTrackingOptions: options,\n amplitude,\n });\n subscriptions.push(networkRequestSubscription);\n\n /* istanbul ignore next */\n config?.loggerProvider?.log(`${name} has been successfully added.`);\n };\n\n /* istanbul ignore next */\n const execute: BrowserEnrichmentPlugin['execute'] = async (event) => {\n return event;\n };\n\n const teardown = async () => {\n for (const subscription of subscriptions) {\n subscription.unsubscribe();\n }\n };\n\n return {\n name,\n type,\n setup,\n execute,\n teardown,\n };\n};\n"]}
1
+ {"version":3,"file":"network-capture-plugin.js","sourceRoot":"","sources":["../../src/network-capture-plugin.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,OAAO,EAML,eAAe,EACf,oBAAoB,GAGrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAgB,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAe3D,MAAM,CAAN,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,0DAAuC,CAAA;AACzC,CAAC,EAFW,eAAe,KAAf,eAAe,QAE1B;AAyBD,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAAC,OAAoC;IAApC,wBAAA,EAAA,YAAoC;IACvE,IAAM,IAAI,GAAG,SAAS,CAAC,WAAW,CAAC;IACnC,IAAM,IAAI,GAAG,YAAY,CAAC;IAC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AAc,CAAC;YAChC,0BAA0B;YAC1B,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,CAAC,UAAG,IAAI,kCAA+B,CAAC,CAAC;;;SACrD,CAAC;IAEF,0BAA0B;IAC1B,IAAM,OAAO,GAAuC,UAAO,KAAK;;YAC9D,sBAAO,KAAK,EAAC;;SACd,CAAC;IAEF,IAAM,QAAQ,GAAG;;;;;gBACf,KAA2B,kBAAA,SAAA,aAAa,CAAA,mHAAE;oBAA/B,YAAY;oBACrB,YAAY,CAAC,WAAW,EAAE,CAAC;iBAC5B;;;;;;;;;;;SACF,CAAC;IAEF,OAAO;QACL,IAAI,MAAA;QACJ,IAAI,MAAA;QACJ,KAAK,OAAA;QACL,OAAO,SAAA;QACP,QAAQ,UAAA;KACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/* eslint-disable no-restricted-globals */\nimport {\n BrowserClient,\n BrowserConfig,\n EnrichmentPlugin,\n ElementInteractionsOptions,\n NetworkRequestEvent,\n networkObserver,\n NetworkEventCallback,\n NetworkTrackingOptions,\n ILogger,\n} from '@amplitude/analytics-core';\nimport * as constants from './constants';\nimport { Observable, Subscription } from 'rxjs';\nimport { HasEventTargetAddRemove } from 'rxjs/internal/observable/fromEvent';\nimport { trackNetworkEvents } from './track-network-event';\n\ndeclare global {\n interface Window {\n navigation: HasEventTargetAddRemove<Event>;\n }\n}\n\nexport type BrowserEnrichmentPlugin = EnrichmentPlugin<BrowserClient, BrowserConfig>;\n\nexport type AutoCaptureOptionsWithDefaults = Required<\n Pick<ElementInteractionsOptions, 'debounceTime' | 'cssSelectorAllowlist' | 'actionClickAllowlist'>\n> &\n ElementInteractionsOptions;\n\nexport enum ObservablesEnum {\n NetworkObservable = 'networkObservable',\n}\n\n// Base TimestampedEvent type\ntype BaseTimestampedEvent<T> = {\n event: T;\n timestamp: number;\n type: 'rage' | 'click' | 'change' | 'error' | 'navigate' | 'mutation' | 'network';\n};\n\n// Specific types for events with targetElementProperties\nexport type ElementBasedEvent = MouseEvent | Event;\nexport type ElementBasedTimestampedEvent<T> = BaseTimestampedEvent<T> & {\n event: MouseEvent | Event;\n type: 'click' | 'change';\n closestTrackedAncestor: Element;\n targetElementProperties: Record<string, any>;\n};\n\n// Union type for all possible TimestampedEvents\nexport type TimestampedEvent<T> = BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T>;\n\nexport interface AllWindowObservables {\n [ObservablesEnum.NetworkObservable]: Observable<TimestampedEvent<NetworkRequestEvent>>;\n}\n\nexport const networkCapturePlugin = (options: NetworkTrackingOptions = {}): BrowserEnrichmentPlugin => {\n const name = constants.PLUGIN_NAME;\n const type = 'enrichment';\n let logger: ILogger;\n\n const subscriptions: Subscription[] = [];\n\n const addAdditionalEventProperties = <T>(\n event: T,\n type: TimestampedEvent<T>['type'],\n ): TimestampedEvent<T> | ElementBasedTimestampedEvent<T> => {\n const baseEvent: BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T> = {\n event,\n timestamp: Date.now(),\n type,\n };\n\n return baseEvent;\n };\n\n // Create observables on events on the window\n const createObservables = (): AllWindowObservables => {\n const networkObservable = new Observable<TimestampedEvent<NetworkRequestEvent>>((observer) => {\n const callback = new NetworkEventCallback((event) => {\n const eventWithProperties = addAdditionalEventProperties(event, 'network');\n observer.next(eventWithProperties);\n });\n networkObserver.subscribe(callback, logger);\n return () => {\n networkObserver.unsubscribe(callback);\n };\n });\n\n return {\n [ObservablesEnum.NetworkObservable]: networkObservable,\n };\n };\n\n const setup: BrowserEnrichmentPlugin['setup'] = async (config, amplitude) => {\n /* istanbul ignore if */\n if (typeof document === 'undefined') {\n return;\n }\n\n // Create observables for events on the window\n const allObservables = createObservables();\n\n const networkRequestSubscription = trackNetworkEvents({\n allObservables,\n networkTrackingOptions: options,\n amplitude,\n });\n subscriptions.push(networkRequestSubscription);\n\n /* istanbul ignore next */\n logger = config?.loggerProvider;\n /* istanbul ignore next */\n logger?.log(`${name} has been successfully added.`);\n };\n\n /* istanbul ignore next */\n const execute: BrowserEnrichmentPlugin['execute'] = async (event) => {\n return event;\n };\n\n const teardown = async () => {\n for (const subscription of subscriptions) {\n subscription.unsubscribe();\n }\n };\n\n return {\n name,\n type,\n setup,\n execute,\n teardown,\n };\n};\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.1.4";
1
+ export declare const VERSION = "1.1.6";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export var VERSION = '1.1.4';
1
+ export var VERSION = '1.1.6';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.1.4';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["export const VERSION = '1.1.6';\n"]}
@@ -1,2 +1,2 @@
1
- var amplitudeNetworkCapturePlugin=function(t){"use strict";var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},e(t,r)};function r(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(t,e,r,n){return new(r||(r=Promise))((function(i,o){function u(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}c((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function o(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)u.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return u}function s(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var c=function(){var t="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[t]?globalThis[t]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},a=s([],u(Array(256).keys()),!1).map((function(t){return t.toString(16).padStart(2,"0")})),l=function(t){var e,r=c();if(!(null===(e=null==r?void 0:r.crypto)||void 0===e?void 0:e.getRandomValues))return function(t){return t?(t^16*Math.random()>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,l)}(t);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,s([],u(n.entries()),!1).map((function(t){var e=u(t,2),r=e[0],n=e[1];return[4,6,8,10].includes(r)?"-".concat(a[n]):a[n]})).join("")};function f(t){var e,r,n=c();if(null==n?void 0:n.TextEncoder){var i=n.TextEncoder;if("string"==typeof t)return(new i).encode(t).length;if(t instanceof Blob)return t.size;if(t instanceof URLSearchParams)return(new i).encode(t.toString()).length;if(t instanceof ArrayBuffer)return t.byteLength;if(ArrayBuffer.isView(t))return t.byteLength;if(t instanceof FormData){var s=t,a=0,l=0;try{for(var f=o(s.entries()),h=f.next();!h.done;h=f.next()){var p=u(h.value,2),d=p[0],v=p[1];if(a+=d.length,"string"==typeof v?a+=(new i).encode(v).length:v.size&&(a+=v.size),++l>=100)return}}catch(t){e={error:t}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(e)throw e.error}}return a}}}var h=function(t,e){void 0===e&&(e=l()),this.callback=t,this.id=e},p=new(function(){function t(e){var r;this.eventCallbacks=new Map,this.isObserving=!1;var n=c();t.isSupported()?(this.globalScope=n,this.originalFetch=null===(r=this.globalScope)||void 0===r?void 0:r.fetch):null==e||e.error("Fetch API is not supported in this environment.")}return t.isSupported=function(){var t=c();return!!t&&!!t.fetch},t.prototype.subscribe=function(t){this.eventCallbacks.set(t.id,t),this.isObserving||(this.observeFetch(),this.isObserving=!0)},t.prototype.unsubscribe=function(t){this.eventCallbacks.delete(t.id),this.originalFetch&&this.globalScope&&0===this.eventCallbacks.size&&this.isObserving&&(this.globalScope.fetch=this.originalFetch,this.isObserving=!1)},t.prototype.triggerEventCallbacks=function(t){this.eventCallbacks.forEach((function(e){e.callback(t)}))},t.prototype.observeFetch=function(){var t=this;if(this.globalScope&&this.originalFetch){var e=this.globalScope.fetch;this.globalScope.fetch=function(r,o){return n(t,void 0,void 0,(function(){var t,n,u,s,c,a,l,h,p;return i(this,(function(i){switch(i.label){case 0:t=Date.now(),n=performance.now(),u={timestamp:t,startTime:t,type:"fetch",method:(null==o?void 0:o.method)||"GET",url:r.toString(),requestHeaders:null==o?void 0:o.headers,requestBodySize:f(null==o?void 0:o.body)},i.label=1;case 1:return i.trys.push([1,3,,4]),[4,e(r,o)];case 2:return s=i.sent(),u.status=s.status,u.duration=Math.floor(performance.now()-n),u.startTime=t,u.endTime=Math.floor(t+u.duration),c={},a=void 0,s.headers.forEach((function(t,e){c[e]=t,"content-length"===e&&(a=parseInt(t,10)||void 0)})),u.responseHeaders=c,u.responseBodySize=a,this.triggerEventCallbacks(u),[2,s];case 3:throw l=i.sent(),h=Date.now(),u.duration=h-t,p=l,u.error={name:p.name||"UnknownError",message:p.message||"An unknown error occurred"},this.triggerEventCallbacks(u),l;case 4:return[2]}}))}))}}},t}());function d(t){return"function"==typeof t}function v(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var y=v((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function b(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var m=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,r,n,i;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var a=o(c),l=a.next();!l.done;l=a.next()){l.value.remove(this)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else c.remove(this);var f=this.initialTeardown;if(d(f))try{f()}catch(t){i=t instanceof y?t.errors:[t]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var p=o(h),v=p.next();!v.done;v=p.next()){var b=v.value;try{g(b)}catch(t){i=null!=i?i:[],t instanceof y?i=s(s([],u(i)),u(t.errors)):i.push(t)}}}catch(t){r={error:t}}finally{try{v&&!v.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}}if(i)throw new y(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)g(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&b(e,t)},t.prototype.remove=function(e){var r=this._finalizers;r&&b(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),w=m.EMPTY;function _(t){return t instanceof m||t&&"closed"in t&&d(t.remove)&&d(t.add)&&d(t.unsubscribe)}function g(t){d(t)?t():t.unsubscribe()}var x={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},S=function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,s([t,e],u(r)))};function A(){}function E(t){t()}var k=function(t){function e(e){var r=t.call(this)||this;return r.isStopped=!1,e?(r.destination=e,_(e)&&e.add(r)):r.destination=P,r}return r(e,t),e.create=function(t,e,r){return new I(t,e,r)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(m),O=Function.prototype.bind;function T(t,e){return O.call(t,e)}var C=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){F(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){F(t)}else F(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){F(t)}},t}(),I=function(t){function e(e,r,n){var i,o,u=t.call(this)||this;d(e)||!e?i={next:null!=e?e:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:u&&x.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return u.unsubscribe()},i={next:e.next&&T(e.next,o),error:e.error&&T(e.error,o),complete:e.complete&&T(e.complete,o)}):i=e;return u.destination=new C(i),u}return r(e,t),e}(k);function F(t){var e;e=t,S((function(){throw e}))}var P={closed:!0,next:A,error:function(t){throw t},complete:A},q="function"==typeof Symbol&&Symbol.observable||"@@observable";function j(t){return t}var z=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n,i=this,o=(n=t)&&n instanceof k||function(t){return t&&d(t.next)&&d(t.error)&&d(t.complete)}(n)&&_(n)?t:new I(t,e,r);return E((function(){var t=i,e=t.operator,r=t.source;o.add(e?e.call(o,r):r?i._subscribe(o):i._trySubscribe(o))})),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=R(e))((function(e,n){var i=new I({next:function(e){try{t(e)}catch(t){n(t),i.unsubscribe()}},error:n,complete:e});r.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[q]=function(){return this},t.prototype.pipe=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return(0===(t=e).length?j:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)})(this)},t.prototype.toPromise=function(t){var e=this;return new(t=R(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function R(t){var e;return null!==(e=null!=t?t:x.Promise)&&void 0!==e?e:Promise}function U(t){return d(null==t?void 0:t.lift)}function M(t){return function(e){if(U(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function B(t,e,r,n,i){return new N(t,e,r,n,i)}var N=function(t){function e(e,r,n,i,o,u){var s=t.call(this,e)||this;return s.onFinalize=o,s.shouldUnsubscribe=u,s._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,s._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,s._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,s}return r(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(k);!function(t){function e(e,r){var n=t.call(this)||this;return n.source=e,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,U(e)&&(n.lift=e.lift),n}r(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,null==t||t.unsubscribe()},e.prototype.connect=function(){var t=this,e=this._connection;if(!e){e=this._connection=new m;var r=this.getSubject();e.add(this.source.subscribe(B(r,void 0,(function(){t._teardown(),r.complete()}),(function(e){t._teardown(),r.error(e)}),(function(){return t._teardown()})))),e.closed&&(this._connection=null,e=m.EMPTY)}return e},e.prototype.refCount=function(){return M((function(t,e){var r=null;t._refCount++;var n=B(e,void 0,void 0,void 0,(function(){if(!t||t._refCount<=0||0<--t._refCount)r=null;else{var n=t._connection,i=r;r=null,!n||i&&n!==i||n.unsubscribe(),e.unsubscribe()}}));t.subscribe(n),n.closed||(r=t.connect())}))(this)}}(z);var D,V={now:function(){return(V.delegate||performance).now()},delegate:void 0},L={schedule:function(t){var e=requestAnimationFrame,r=cancelAnimationFrame,n=e((function(e){r=void 0,t(e)}));return new m((function(){return null==r?void 0:r(n)}))},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=L.delegate;return((null==r?void 0:r.requestAnimationFrame)||requestAnimationFrame).apply(void 0,s([],u(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,s([],u(t)))},delegate:void 0};new z((function(t){var e=D||V,r=e.now(),n=0,i=function(){t.closed||(n=L.requestAnimationFrame((function(o){n=0;var u=e.now();t.next({timestamp:D?u:o,elapsed:u-r}),i()})))};return i(),function(){n&&L.cancelAnimationFrame(n)}}));var W=v((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),H=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return r(e,t),e.prototype.lift=function(t){var e=new Y(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new W},e.prototype.next=function(t){var e=this;E((function(){var r,n;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=o(e.currentObservers),u=i.next();!u.done;u=i.next()){u.value.next(t)}}catch(t){r={error:t}}finally{try{u&&!u.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},e.prototype.error=function(t){var e=this;E((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var r=e.observers;r.length;)r.shift().error(t)}}))},e.prototype.complete=function(){var t=this;E((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,r=this,n=r.hasError,i=r.isStopped,o=r.observers;return n||i?w:(this.currentObservers=null,o.push(t),new m((function(){e.currentObservers=null,b(o,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,r=e.hasError,n=e.thrownError,i=e.isStopped;r?t.error(n):i&&t.complete()},e.prototype.asObservable=function(){var t=new z;return t.source=this,t},e.create=function(t,e){return new Y(t,e)},e}(z),Y=function(t){function e(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return r(e,t),e.prototype.next=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===r||r.call(e,t)},e.prototype.error=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===r||r.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,r;return null!==(r=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==r?r:w},e}(H);!function(t){function e(e){var r=t.call(this)||this;return r._value=e,r}r(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){var t=this,e=t.hasError,r=t.thrownError,n=t._value;if(e)throw r;return this._throwIfClosed(),n},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)}}(H);var Q={now:function(){return(Q.delegate||Date).now()},delegate:void 0};!function(t){function e(e,r,n){void 0===e&&(e=1/0),void 0===r&&(r=1/0),void 0===n&&(n=Q);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,r),i}r(e,t),e.prototype.next=function(e){var r=this,n=r.isStopped,i=r._buffer,o=r._infiniteTimeWindow,u=r._timestampProvider,s=r._windowTime;n||(i.push(e),!o&&i.push(u.now()+s)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!t.closed;i+=r?1:2)t.next(n[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,r=t._timestampProvider,n=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){for(var u=r.now(),s=0,c=1;c<n.length&&n[c]<=u;c+=2)s=c;s&&n.splice(0,s+1)}}}(H),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._value=null,e._hasValue=!1,e._isComplete=!1,e}r(e,t),e.prototype._checkFinalizedStatuses=function(t){var e=this,r=e.hasError,n=e._hasValue,i=e._value,o=e.thrownError,u=e.isStopped,s=e._isComplete;r?t.error(o):(u||s)&&(n&&t.next(i),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var e=this,r=e._hasValue,n=e._value;e._isComplete||(this._isComplete=!0,r&&t.prototype.next.call(this,n),t.prototype.complete.call(this))}}(H);var $,G=function(t){function e(e,r){return t.call(this)||this}return r(e,t),e.prototype.schedule=function(t,e){return this},e}(m),X=function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,s([t,e],u(r)))},J=function(t){return clearInterval(t)},K=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n.pending=!1,n}return r(e,t),e.prototype.schedule=function(t,e){var r;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,i=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,r){return void 0===r&&(r=0),X(t.flush.bind(t,this),r)},e.prototype.recycleAsyncId=function(t,e,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return e;null!=e&&J(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,e);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var r,n=!1;try{this.work(t)}catch(t){n=!0,r=t||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,b(n,this),null!=e&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(G),Z=1,tt={};function et(t){return t in tt&&(delete tt[t],!0)}var rt=function(t){var e=Z++;return tt[e]=!0,$||($=Promise.resolve()),$.then((function(){return et(e)&&t()})),e},nt=function(t){et(t)},it={setImmediate:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=it.delegate;return((null==r?void 0:r.setImmediate)||rt).apply(void 0,s([],u(t)))},clearImmediate:function(t){return nt(t)},delegate:void 0},ot=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return r(e,t),e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.actions.push(this),e._scheduled||(e._scheduled=it.setImmediate(e.flush.bind(e,void 0))))},e.prototype.recycleAsyncId=function(e,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,r,n);var o=e.actions;null!=r&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(it.clearImmediate(r),e._scheduled===r&&(e._scheduled=void 0))},e}(K),ut=function(){function t(e,r){void 0===r&&(r=t.now),this.schedulerActionCtor=e,this.now=r}return t.prototype.schedule=function(t,e,r){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(r,e)},t.now=Q.now,t}(),st=function(t){function e(e,r){void 0===r&&(r=ut.now);var n=t.call(this,e,r)||this;return n.actions=[],n._active=!1,n}return r(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var r;this._active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},e}(ut),ct=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var r,n=this.actions;t=t||n.shift();do{if(r=t.execute(t.state,t.delay))break}while((t=n[0])&&t.id===e&&n.shift());if(this._active=!1,r){for(;(t=n[0])&&t.id===e&&n.shift();)t.unsubscribe();throw r}},e}(st);new ct(ot),new st(K);var at=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return r(e,t),e.prototype.schedule=function(e,r){return void 0===r&&(r=0),r>0?t.prototype.schedule.call(this,e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,r){return r>0||this.closed?t.prototype.execute.call(this,e,r):this._execute(e,r)},e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.flush(this),0)},e}(K),lt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(st);new lt(at);var ft=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return r(e,t),e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.actions.push(this),e._scheduled||(e._scheduled=L.requestAnimationFrame((function(){return e.flush(void 0)}))))},e.prototype.recycleAsyncId=function(e,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,r,n);var o=e.actions;null!=r&&r===e._scheduled&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(L.cancelAnimationFrame(r),e._scheduled=void 0)},e}(K),ht=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.flush=function(t){var e;this._active=!0,t?e=t.id:(e=this._scheduled,this._scheduled=void 0);var r,n=this.actions;t=t||n.shift();do{if(r=t.execute(t.state,t.delay))break}while((t=n[0])&&t.id===e&&n.shift());if(this._active=!1,r){for(;(t=n[0])&&t.id===e&&n.shift();)t.unsubscribe();throw r}},e}(st);new ht(ft),function(t){function e(e,r){void 0===e&&(e=dt),void 0===r&&(r=1/0);var n=t.call(this,e,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}r(e,t),e.prototype.flush=function(){for(var t,e,r=this.actions,n=this.maxFrames;(e=r[0])&&e.delay<=n&&(r.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=r.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10}(st);var pt,dt=function(t){function e(e,r,n){void 0===n&&(n=e.index+=1);var i=t.call(this,e,r)||this;return i.scheduler=e,i.work=r,i.index=n,i.active=!0,i.index=e.index=n,i}return r(e,t),e.prototype.schedule=function(r,n){if(void 0===n&&(n=0),Number.isFinite(n)){if(!this.id)return t.prototype.schedule.call(this,r,n);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(r,n)}return m.EMPTY},e.prototype.requestAsyncId=function(t,r,n){void 0===n&&(n=0),this.delay=t.frame+n;var i=t.actions;return i.push(this),i.sort(e.sortActions),1},e.prototype.recycleAsyncId=function(t,e,r){},e.prototype._execute=function(e,r){if(!0===this.active)return t.prototype._execute.call(this,e,r)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(K);new z((function(t){return t.complete()})),function(t){t.NEXT="N",t.ERROR="E",t.COMPLETE="C"}(pt||(pt={})),v((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}})),v((function(t){return function(){t(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),v((function(t){return function(e){t(this),this.name="NotFoundError",this.message=e}})),v((function(t){return function(e){t(this),this.name="SequenceError",this.message=e}})),v((function(t){return function(e){void 0===e&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}})),new z(A);var vt,yt="500-599";function bt(t,e){var r="^"+e.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(r).test(t)}function mt(t,e){var r,n,i=e.split(",");try{for(var s=o(i),c=s.next();!c.done;c=s.next()){var a=u(c.value.split("-").map(Number),2),l=a[0],f=a[1];if(t===l&&void 0===f)return!0;if(t>=l&&t<=f)return!0}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return!1}function wt(t){var e;try{var r=null===(e=c())||void 0===e?void 0:e.location.href,n=new URL(t,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),u=n.href,s=n.host;return n.hash="",n.search="",{query:i,fragment:o,href:u,hrefWithoutQueryOrHash:n.href,host:s}}catch(t){return}}function _t(t,e){var r;void 0===e&&(e={});var n=wt(t.url);if(!n)return!1;var i,o=n.host;if(!1!==e.ignoreAmplitudeRequests&&(bt(o,"*.amplitude.com")||bt(o,"amplitude.com")))return!1;if(null===(r=e.ignoreHosts)||void 0===r?void 0:r.find((function(t){return bt(o,t)})))return!1;if(!e.captureRules&&void 0!==t.status&&!mt(t.status,yt))return!1;if(e.captureRules&&(s([],u(e.captureRules),!1).reverse().find((function(e){return i=function(t,e,r){if(!t.hosts||t.hosts.find((function(t){return bt(e,t)})))return!((r||0===r)&&!mt(r,t.statusCodeRange||yt))}(e,o,t.status),void 0!==i})),!i))return!1;return!0}function gt(t){var e,r,n=t.allObservables,i=t.networkTrackingOptions,o=t.amplitude;return n.networkObservable.pipe((e=function(t){return _t(t.event,i)},M((function(t,n){var i=0;t.subscribe(B(n,(function(t){return e.call(r,t,i++)&&n.next(t)})))})))).subscribe((function(t){var e,r=t.event,n=wt(r.url);if(n){var i=((e={})["[Amplitude] URL"]=n.hrefWithoutQueryOrHash,e["[Amplitude] URL Query"]=n.query,e["[Amplitude] URL Fragment"]=n.fragment,e["[Amplitude] Request Method"]=r.method,e["[Amplitude] Status Code"]=r.status,e["[Amplitude] Start Time"]=r.startTime,e["[Amplitude] Completion Time"]=r.endTime,e["[Amplitude] Duration"]=r.duration,e["[Amplitude] Request Body Size"]=r.requestBodySize,e["[Amplitude] Response Body Size"]=r.responseBodySize,e);null==o||o.track("[Amplitude] Network Request",i)}}))}!function(t){t.NetworkObservable="networkObservable"}(vt||(vt={}));var xt=function(t){void 0===t&&(t={});var e="@amplitude/plugin-network-capture-browser",r=[],u=function(){var t,e=new z((function(t){var e=new h((function(e){var r=function(t,e){return{event:t,timestamp:Date.now(),type:e}}(e,"network");t.next(r)}));return p.subscribe(e),function(){p.unsubscribe(e)}}));return(t={})[vt.NetworkObservable]=e,t};return{name:e,type:"enrichment",setup:function(o,s){return n(void 0,void 0,void 0,(function(){var n,c,a;return i(this,(function(i){return"undefined"==typeof document||(n=u(),c=gt({allObservables:n,networkTrackingOptions:t,amplitude:s}),r.push(c),null===(a=null==o?void 0:o.loggerProvider)||void 0===a||a.log("".concat(e," has been successfully added."))),[2]}))}))},execute:function(t){return n(void 0,void 0,void 0,(function(){return i(this,(function(e){return[2,t]}))}))},teardown:function(){return n(void 0,void 0,void 0,(function(){var t,e,n,u;return i(this,(function(i){try{for(t=o(r),e=t.next();!e.done;e=t.next())e.value.unsubscribe()}catch(t){n={error:t}}finally{try{e&&!e.done&&(u=t.return)&&u.call(t)}finally{if(n)throw n.error}}return[2]}))}))}}};return t.networkCapturePlugin=xt,t.plugin=xt,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
1
+ var amplitudeNetworkCapturePlugin=function(t){"use strict";var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},e(t,r)};function r(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(t,e,r,n){return new(r||(r=Promise))((function(i,o){function u(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}c((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=s(0),u.throw=s(1),u.return=s(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function o(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)u.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return u}function s(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var c=function(){var t="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[t]?globalThis[t]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},a=s([],u(Array(256).keys()),!1).map((function(t){return t.toString(16).padStart(2,"0")})),l=function(t){var e,r=c();if(!(null===(e=null==r?void 0:r.crypto)||void 0===e?void 0:e.getRandomValues))return function(t){return t?(t^16*Math.random()>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,l)}(t);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,s([],u(n.entries()),!1).map((function(t){var e=u(t,2),r=e[0],n=e[1];return[4,6,8,10].includes(r)?"-".concat(a[n]):a[n]})).join("")};function f(t){var e,r,n=c();if(null==n?void 0:n.TextEncoder){var i=n.TextEncoder;if("string"==typeof t)return(new i).encode(t).length;if(t instanceof Blob)return t.size;if(t instanceof URLSearchParams)return(new i).encode(t.toString()).length;if(t instanceof ArrayBuffer)return t.byteLength;if(ArrayBuffer.isView(t))return t.byteLength;if(t instanceof FormData){var s=t,a=0,l=0;try{for(var f=o(s.entries()),h=f.next();!h.done;h=f.next()){var p=u(h.value,2),d=p[0],v=p[1];if(a+=d.length,"string"==typeof v?a+=(new i).encode(v).length:v.size&&(a+=v.size),++l>=100)return}}catch(t){e={error:t}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(e)throw e.error}}return a}}}var h=function(t,e){void 0===e&&(e=l()),this.callback=t,this.id=e},p=new(function(){function t(e){var r;this.eventCallbacks=new Map,this.isObserving=!1,this.logger=e;var n=c();t.isSupported()&&(this.globalScope=n,this.originalFetch=null===(r=this.globalScope)||void 0===r?void 0:r.fetch)}return t.isSupported=function(){var t=c();return!!t&&!!t.fetch},t.prototype.subscribe=function(t,e){this.logger||(this.logger=e),this.eventCallbacks.set(t.id,t),this.isObserving||(this.observeFetch(),this.isObserving=!0)},t.prototype.unsubscribe=function(t){this.eventCallbacks.delete(t.id),this.originalFetch&&this.globalScope&&0===this.eventCallbacks.size&&this.isObserving&&(this.globalScope.fetch=this.originalFetch,this.isObserving=!1)},t.prototype.triggerEventCallbacks=function(t){var e=this;this.eventCallbacks.forEach((function(r){var n;try{r.callback(t)}catch(t){null===(n=e.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",t)}}))},t.prototype.observeFetch=function(){var t=this;if(this.globalScope&&this.originalFetch){var e=this.globalScope.fetch;this.globalScope.fetch=function(r,o){return n(t,void 0,void 0,(function(){var t,n,u,s,c,a,l,h,p;return i(this,(function(i){switch(i.label){case 0:t=Date.now(),n=performance.now(),u={timestamp:t,startTime:t,type:"fetch",method:(null==o?void 0:o.method)||"GET",url:r.toString(),requestHeaders:null==o?void 0:o.headers,requestBodySize:f(null==o?void 0:o.body)},i.label=1;case 1:return i.trys.push([1,3,,4]),[4,e(r,o)];case 2:return s=i.sent(),u.status=s.status,u.duration=Math.floor(performance.now()-n),u.startTime=t,u.endTime=Math.floor(t+u.duration),c={},a=void 0,s.headers.forEach((function(t,e){c[e]=t,"content-length"===e&&(a=parseInt(t,10)||void 0)})),u.responseHeaders=c,u.responseBodySize=a,this.triggerEventCallbacks(u),[2,s];case 3:throw l=i.sent(),h=Date.now(),u.duration=h-t,p=l,u.error={name:p.name||"UnknownError",message:p.message||"An unknown error occurred"},"AbortError"===p.name&&(u.error.name="AbortError",u.status=0),this.triggerEventCallbacks(u),l;case 4:return[2]}}))}))}}},t}());function d(t){return"function"==typeof t}function v(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var y=v((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function b(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var m=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,r,n,i;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var a=o(c),l=a.next();!l.done;l=a.next()){l.value.remove(this)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else c.remove(this);var f=this.initialTeardown;if(d(f))try{f()}catch(t){i=t instanceof y?t.errors:[t]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var p=o(h),v=p.next();!v.done;v=p.next()){var b=v.value;try{_(b)}catch(t){i=null!=i?i:[],t instanceof y?i=s(s([],u(i)),u(t.errors)):i.push(t)}}}catch(t){r={error:t}}finally{try{v&&!v.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}}if(i)throw new y(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)_(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&b(e,t)},t.prototype.remove=function(e){var r=this._finalizers;r&&b(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),w=m.EMPTY;function g(t){return t instanceof m||t&&"closed"in t&&d(t.remove)&&d(t.add)&&d(t.unsubscribe)}function _(t){d(t)?t():t.unsubscribe()}var x={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},S=function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,s([t,e],u(r)))};function A(){}function E(t){t()}var k=function(t){function e(e){var r=t.call(this)||this;return r.isStopped=!1,e?(r.destination=e,g(e)&&e.add(r)):r.destination=P,r}return r(e,t),e.create=function(t,e,r){return new I(t,e,r)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(m),O=Function.prototype.bind;function T(t,e){return O.call(t,e)}var C=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){F(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){F(t)}else F(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){F(t)}},t}(),I=function(t){function e(e,r,n){var i,o,u=t.call(this)||this;d(e)||!e?i={next:null!=e?e:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:u&&x.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return u.unsubscribe()},i={next:e.next&&T(e.next,o),error:e.error&&T(e.error,o),complete:e.complete&&T(e.complete,o)}):i=e;return u.destination=new C(i),u}return r(e,t),e}(k);function F(t){var e;e=t,S((function(){throw e}))}var P={closed:!0,next:A,error:function(t){throw t},complete:A},q="function"==typeof Symbol&&Symbol.observable||"@@observable";function j(t){return t}var z=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n,i=this,o=(n=t)&&n instanceof k||function(t){return t&&d(t.next)&&d(t.error)&&d(t.complete)}(n)&&g(n)?t:new I(t,e,r);return E((function(){var t=i,e=t.operator,r=t.source;o.add(e?e.call(o,r):r?i._subscribe(o):i._trySubscribe(o))})),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=R(e))((function(e,n){var i=new I({next:function(e){try{t(e)}catch(t){n(t),i.unsubscribe()}},error:n,complete:e});r.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[q]=function(){return this},t.prototype.pipe=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return(0===(t=e).length?j:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)})(this)},t.prototype.toPromise=function(t){var e=this;return new(t=R(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function R(t){var e;return null!==(e=null!=t?t:x.Promise)&&void 0!==e?e:Promise}function U(t){return d(null==t?void 0:t.lift)}function M(t){return function(e){if(U(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function B(t,e,r,n,i){return new N(t,e,r,n,i)}var N=function(t){function e(e,r,n,i,o,u){var s=t.call(this,e)||this;return s.onFinalize=o,s.shouldUnsubscribe=u,s._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,s._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,s._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,s}return r(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(k);!function(t){function e(e,r){var n=t.call(this)||this;return n.source=e,n.subjectFactory=r,n._subject=null,n._refCount=0,n._connection=null,U(e)&&(n.lift=e.lift),n}r(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,null==t||t.unsubscribe()},e.prototype.connect=function(){var t=this,e=this._connection;if(!e){e=this._connection=new m;var r=this.getSubject();e.add(this.source.subscribe(B(r,void 0,(function(){t._teardown(),r.complete()}),(function(e){t._teardown(),r.error(e)}),(function(){return t._teardown()})))),e.closed&&(this._connection=null,e=m.EMPTY)}return e},e.prototype.refCount=function(){return M((function(t,e){var r=null;t._refCount++;var n=B(e,void 0,void 0,void 0,(function(){if(!t||t._refCount<=0||0<--t._refCount)r=null;else{var n=t._connection,i=r;r=null,!n||i&&n!==i||n.unsubscribe(),e.unsubscribe()}}));t.subscribe(n),n.closed||(r=t.connect())}))(this)}}(z);var D,V={now:function(){return(V.delegate||performance).now()},delegate:void 0},L={schedule:function(t){var e=requestAnimationFrame,r=cancelAnimationFrame,n=e((function(e){r=void 0,t(e)}));return new m((function(){return null==r?void 0:r(n)}))},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=L.delegate;return((null==r?void 0:r.requestAnimationFrame)||requestAnimationFrame).apply(void 0,s([],u(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,s([],u(t)))},delegate:void 0};new z((function(t){var e=D||V,r=e.now(),n=0,i=function(){t.closed||(n=L.requestAnimationFrame((function(o){n=0;var u=e.now();t.next({timestamp:D?u:o,elapsed:u-r}),i()})))};return i(),function(){n&&L.cancelAnimationFrame(n)}}));var W=v((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),H=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return r(e,t),e.prototype.lift=function(t){var e=new Y(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new W},e.prototype.next=function(t){var e=this;E((function(){var r,n;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=o(e.currentObservers),u=i.next();!u.done;u=i.next()){u.value.next(t)}}catch(t){r={error:t}}finally{try{u&&!u.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},e.prototype.error=function(t){var e=this;E((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var r=e.observers;r.length;)r.shift().error(t)}}))},e.prototype.complete=function(){var t=this;E((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,r=this,n=r.hasError,i=r.isStopped,o=r.observers;return n||i?w:(this.currentObservers=null,o.push(t),new m((function(){e.currentObservers=null,b(o,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,r=e.hasError,n=e.thrownError,i=e.isStopped;r?t.error(n):i&&t.complete()},e.prototype.asObservable=function(){var t=new z;return t.source=this,t},e.create=function(t,e){return new Y(t,e)},e}(z),Y=function(t){function e(e,r){var n=t.call(this)||this;return n.destination=e,n.source=r,n}return r(e,t),e.prototype.next=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===r||r.call(e,t)},e.prototype.error=function(t){var e,r;null===(r=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===r||r.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,r;return null!==(r=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==r?r:w},e}(H);!function(t){function e(e){var r=t.call(this)||this;return r._value=e,r}r(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var r=t.prototype._subscribe.call(this,e);return!r.closed&&e.next(this._value),r},e.prototype.getValue=function(){var t=this,e=t.hasError,r=t.thrownError,n=t._value;if(e)throw r;return this._throwIfClosed(),n},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)}}(H);var Q={now:function(){return(Q.delegate||Date).now()},delegate:void 0};!function(t){function e(e,r,n){void 0===e&&(e=1/0),void 0===r&&(r=1/0),void 0===n&&(n=Q);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,r),i}r(e,t),e.prototype.next=function(e){var r=this,n=r.isStopped,i=r._buffer,o=r._infiniteTimeWindow,u=r._timestampProvider,s=r._windowTime;n||(i.push(e),!o&&i.push(u.now()+s)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i<n.length&&!t.closed;i+=r?1:2)t.next(n[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,r=t._timestampProvider,n=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<n.length&&n.splice(0,n.length-o),!i){for(var u=r.now(),s=0,c=1;c<n.length&&n[c]<=u;c+=2)s=c;s&&n.splice(0,s+1)}}}(H),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._value=null,e._hasValue=!1,e._isComplete=!1,e}r(e,t),e.prototype._checkFinalizedStatuses=function(t){var e=this,r=e.hasError,n=e._hasValue,i=e._value,o=e.thrownError,u=e.isStopped,s=e._isComplete;r?t.error(o):(u||s)&&(n&&t.next(i),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var e=this,r=e._hasValue,n=e._value;e._isComplete||(this._isComplete=!0,r&&t.prototype.next.call(this,n),t.prototype.complete.call(this))}}(H);var $,G=function(t){function e(e,r){return t.call(this)||this}return r(e,t),e.prototype.schedule=function(t,e){return this},e}(m),X=function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,s([t,e],u(r)))},J=function(t){return clearInterval(t)},K=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n.pending=!1,n}return r(e,t),e.prototype.schedule=function(t,e){var r;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var n=this.id,i=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(i,n,e)),this.pending=!0,this.delay=e,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,r){return void 0===r&&(r=0),X(t.flush.bind(t,this),r)},e.prototype.recycleAsyncId=function(t,e,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return e;null!=e&&J(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(t,e);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var r,n=!1;try{this.work(t)}catch(t){n=!0,r=t||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,b(n,this),null!=e&&(this.id=this.recycleAsyncId(r,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(G),Z=1,tt={};function et(t){return t in tt&&(delete tt[t],!0)}var rt=function(t){var e=Z++;return tt[e]=!0,$||($=Promise.resolve()),$.then((function(){return et(e)&&t()})),e},nt=function(t){et(t)},it={setImmediate:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=it.delegate;return((null==r?void 0:r.setImmediate)||rt).apply(void 0,s([],u(t)))},clearImmediate:function(t){return nt(t)},delegate:void 0},ot=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return r(e,t),e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.actions.push(this),e._scheduled||(e._scheduled=it.setImmediate(e.flush.bind(e,void 0))))},e.prototype.recycleAsyncId=function(e,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,r,n);var o=e.actions;null!=r&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(it.clearImmediate(r),e._scheduled===r&&(e._scheduled=void 0))},e}(K),ut=function(){function t(e,r){void 0===r&&(r=t.now),this.schedulerActionCtor=e,this.now=r}return t.prototype.schedule=function(t,e,r){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(r,e)},t.now=Q.now,t}(),st=function(t){function e(e,r){void 0===r&&(r=ut.now);var n=t.call(this,e,r)||this;return n.actions=[],n._active=!1,n}return r(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var r;this._active=!0;do{if(r=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,r){for(;t=e.shift();)t.unsubscribe();throw r}}},e}(ut),ct=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var r,n=this.actions;t=t||n.shift();do{if(r=t.execute(t.state,t.delay))break}while((t=n[0])&&t.id===e&&n.shift());if(this._active=!1,r){for(;(t=n[0])&&t.id===e&&n.shift();)t.unsubscribe();throw r}},e}(st);new ct(ot),new st(K);var at=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return r(e,t),e.prototype.schedule=function(e,r){return void 0===r&&(r=0),r>0?t.prototype.schedule.call(this,e,r):(this.delay=r,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,r){return r>0||this.closed?t.prototype.execute.call(this,e,r):this._execute(e,r)},e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.flush(this),0)},e}(K),lt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(st);new lt(at);var ft=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.scheduler=e,n.work=r,n}return r(e,t),e.prototype.requestAsyncId=function(e,r,n){return void 0===n&&(n=0),null!==n&&n>0?t.prototype.requestAsyncId.call(this,e,r,n):(e.actions.push(this),e._scheduled||(e._scheduled=L.requestAnimationFrame((function(){return e.flush(void 0)}))))},e.prototype.recycleAsyncId=function(e,r,n){var i;if(void 0===n&&(n=0),null!=n?n>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,r,n);var o=e.actions;null!=r&&r===e._scheduled&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==r&&(L.cancelAnimationFrame(r),e._scheduled=void 0)},e}(K),ht=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.flush=function(t){var e;this._active=!0,t?e=t.id:(e=this._scheduled,this._scheduled=void 0);var r,n=this.actions;t=t||n.shift();do{if(r=t.execute(t.state,t.delay))break}while((t=n[0])&&t.id===e&&n.shift());if(this._active=!1,r){for(;(t=n[0])&&t.id===e&&n.shift();)t.unsubscribe();throw r}},e}(st);new ht(ft),function(t){function e(e,r){void 0===e&&(e=dt),void 0===r&&(r=1/0);var n=t.call(this,e,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}r(e,t),e.prototype.flush=function(){for(var t,e,r=this.actions,n=this.maxFrames;(e=r[0])&&e.delay<=n&&(r.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=r.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10}(st);var pt,dt=function(t){function e(e,r,n){void 0===n&&(n=e.index+=1);var i=t.call(this,e,r)||this;return i.scheduler=e,i.work=r,i.index=n,i.active=!0,i.index=e.index=n,i}return r(e,t),e.prototype.schedule=function(r,n){if(void 0===n&&(n=0),Number.isFinite(n)){if(!this.id)return t.prototype.schedule.call(this,r,n);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(r,n)}return m.EMPTY},e.prototype.requestAsyncId=function(t,r,n){void 0===n&&(n=0),this.delay=t.frame+n;var i=t.actions;return i.push(this),i.sort(e.sortActions),1},e.prototype.recycleAsyncId=function(t,e,r){},e.prototype._execute=function(e,r){if(!0===this.active)return t.prototype._execute.call(this,e,r)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(K);new z((function(t){return t.complete()})),function(t){t.NEXT="N",t.ERROR="E",t.COMPLETE="C"}(pt||(pt={})),v((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}})),v((function(t){return function(){t(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),v((function(t){return function(e){t(this),this.name="NotFoundError",this.message=e}})),v((function(t){return function(e){t(this),this.name="SequenceError",this.message=e}})),v((function(t){return function(e){void 0===e&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}})),new z(A);var vt,yt="500-599";function bt(t,e){var r="^"+e.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(r).test(t)}function mt(t,e){var r,n,i=e.split(",");try{for(var s=o(i),c=s.next();!c.done;c=s.next()){var a=u(c.value.split("-").map(Number),2),l=a[0],f=a[1];if(t===l&&void 0===f)return!0;if(t>=l&&t<=f)return!0}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return!1}function wt(t){var e;try{var r=null===(e=c())||void 0===e?void 0:e.location.href,n=new URL(t,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),u=n.href,s=n.host;return n.hash="",n.search="",{query:i,fragment:o,href:u,hrefWithoutQueryOrHash:n.href,host:s}}catch(t){return}}function gt(t,e){var r;void 0===e&&(e={});var n=wt(t.url);if(!n)return!1;var i,o=n.host;if(!1!==e.ignoreAmplitudeRequests&&(bt(o,"*.amplitude.com")||bt(o,"amplitude.com")))return!1;if(null===(r=e.ignoreHosts)||void 0===r?void 0:r.find((function(t){return bt(o,t)})))return!1;if(!e.captureRules&&void 0!==t.status&&!mt(t.status,yt))return!1;if(e.captureRules&&(s([],u(e.captureRules),!1).reverse().find((function(e){return i=function(t,e,r){if(!t.hosts||t.hosts.find((function(t){return bt(e,t)})))return!((r||0===r)&&!mt(r,t.statusCodeRange||yt))}(e,o,t.status),void 0!==i})),!i))return!1;return!0}function _t(t){var e,r,n=t.allObservables,i=t.networkTrackingOptions,o=t.amplitude;return n.networkObservable.pipe((e=function(t){return gt(t.event,i)},M((function(t,n){var i=0;t.subscribe(B(n,(function(t){return e.call(r,t,i++)&&n.next(t)})))})))).subscribe((function(t){var e,r=t.event,n=wt(r.url);if(n){var i=((e={})["[Amplitude] URL"]=n.hrefWithoutQueryOrHash,e["[Amplitude] URL Query"]=n.query,e["[Amplitude] URL Fragment"]=n.fragment,e["[Amplitude] Request Method"]=r.method,e["[Amplitude] Status Code"]=r.status,e["[Amplitude] Start Time"]=r.startTime,e["[Amplitude] Completion Time"]=r.endTime,e["[Amplitude] Duration"]=r.duration,e["[Amplitude] Request Body Size"]=r.requestBodySize,e["[Amplitude] Response Body Size"]=r.responseBodySize,e);null==o||o.track("[Amplitude] Network Request",i)}}))}!function(t){t.NetworkObservable="networkObservable"}(vt||(vt={}));var xt=function(t){void 0===t&&(t={});var e,r="@amplitude/plugin-network-capture-browser",u=[],s=function(){var t,r=new z((function(t){var r=new h((function(e){var r=function(t,e){return{event:t,timestamp:Date.now(),type:e}}(e,"network");t.next(r)}));return p.subscribe(r,e),function(){p.unsubscribe(r)}}));return(t={})[vt.NetworkObservable]=r,t};return{name:r,type:"enrichment",setup:function(o,c){return n(void 0,void 0,void 0,(function(){var n,a;return i(this,(function(i){return"undefined"==typeof document||(n=s(),a=_t({allObservables:n,networkTrackingOptions:t,amplitude:c}),u.push(a),null==(e=null==o?void 0:o.loggerProvider)||e.log("".concat(r," has been successfully added."))),[2]}))}))},execute:function(t){return n(void 0,void 0,void 0,(function(){return i(this,(function(e){return[2,t]}))}))},teardown:function(){return n(void 0,void 0,void 0,(function(){var t,e,r,n;return i(this,(function(i){try{for(t=o(u),e=t.next();!e.done;e=t.next())e.value.unsubscribe()}catch(t){r={error:t}}finally{try{e&&!e.done&&(n=t.return)&&n.call(t)}finally{if(r)throw r.error}}return[2]}))}))}}};return t.networkCapturePlugin=xt,t.plugin=xt,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
2
2
  //# sourceMappingURL=amplitude-min.js.map
Binary file