@amplitude/plugin-network-capture-browser 1.1.0 → 1.1.2
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/lib/cjs/track-network-event.d.ts +2 -2
- package/lib/cjs/track-network-event.d.ts.map +1 -1
- package/lib/cjs/track-network-event.js +2 -4
- package/lib/cjs/track-network-event.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/track-network-event.d.ts +2 -2
- package/lib/esm/track-network-event.d.ts.map +1 -1
- package/lib/esm/track-network-event.js +2 -4
- package/lib/esm/track-network-event.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/scripts/amplitude-min.js +1 -1
- package/lib/scripts/amplitude-min.js.gz +0 -0
- package/lib/scripts/amplitude-min.js.map +1 -1
- package/lib/scripts/amplitude-min.umd.js +1 -1
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/lib/scripts/track-network-event.d.ts +2 -2
- package/lib/scripts/track-network-event.d.ts.map +1 -1
- package/lib/scripts/version.d.ts +1 -1
- package/package.json +5 -4
|
@@ -7,8 +7,8 @@ export type NetworkAnalyticsEvent = {
|
|
|
7
7
|
['[Amplitude] URL Fragment']?: string;
|
|
8
8
|
['[Amplitude] Request Method']: string;
|
|
9
9
|
['[Amplitude] Status Code']?: number;
|
|
10
|
-
['[Amplitude] Start Time']?:
|
|
11
|
-
['[Amplitude] Completion Time']?:
|
|
10
|
+
['[Amplitude] Start Time']?: number;
|
|
11
|
+
['[Amplitude] Completion Time']?: number;
|
|
12
12
|
['[Amplitude] Duration']?: number;
|
|
13
13
|
['[Amplitude] Request Body Size']?: number;
|
|
14
14
|
['[Amplitude] Response Body Size']?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track-network-event.d.ts","sourceRoot":"","sources":["../../src/track-network-event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,mBAAmB,EAEnB,sBAAsB,EACvB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAoB,MAAM,0BAA0B,CAAC;AA6ClF,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,mBAAmB,EAAE,OAAO,GAAE,sBAA2B,WA2C9G;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC5B,CAAC,uBAAuB,CAAC,CAAC,EAAE,MAAM,CAAC;IACnC,CAAC,0BAA0B,CAAC,CAAC,EAAE,MAAM,CAAC;IACtC,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACvC,CAAC,yBAAyB,CAAC,CAAC,EAAE,MAAM,CAAC;IACrC,CAAC,wBAAwB,CAAC,CAAC,EAAE,MAAM,CAAC;IACpC,CAAC,6BAA6B,CAAC,CAAC,EAAE,MAAM,CAAC;IACzC,CAAC,sBAAsB,CAAC,CAAC,EAAE,MAAM,CAAC;IAClC,CAAC,+BAA+B,CAAC,CAAC,EAAE,MAAM,CAAC;IAC3C,CAAC,gCAAgC,CAAC,CAAC,EAAE,MAAM,CAAC;CAC7C,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,cAAc,EACd,sBAAsB,EACtB,SAAS,GACV,EAAE;IACD,cAAc,EAAE,oBAAoB,CAAC;IACrC,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,SAAS,EAAE,aAAa,CAAC;CAC1B,+
|
|
1
|
+
{"version":3,"file":"track-network-event.d.ts","sourceRoot":"","sources":["../../src/track-network-event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,mBAAmB,EAEnB,sBAAsB,EACvB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAoB,MAAM,0BAA0B,CAAC;AA6ClF,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,mBAAmB,EAAE,OAAO,GAAE,sBAA2B,WA2C9G;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC5B,CAAC,uBAAuB,CAAC,CAAC,EAAE,MAAM,CAAC;IACnC,CAAC,0BAA0B,CAAC,CAAC,EAAE,MAAM,CAAC;IACtC,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACvC,CAAC,yBAAyB,CAAC,CAAC,EAAE,MAAM,CAAC;IACrC,CAAC,wBAAwB,CAAC,CAAC,EAAE,MAAM,CAAC;IACpC,CAAC,6BAA6B,CAAC,CAAC,EAAE,MAAM,CAAC;IACzC,CAAC,sBAAsB,CAAC,CAAC,EAAE,MAAM,CAAC;IAClC,CAAC,+BAA+B,CAAC,CAAC,EAAE,MAAM,CAAC;IAC3C,CAAC,gCAAgC,CAAC,CAAC,EAAE,MAAM,CAAC;CAC7C,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,cAAc,EACd,sBAAsB,EACtB,SAAS,GACV,EAAE;IACD,cAAc,EAAE,oBAAoB,CAAC;IACrC,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,SAAS,EAAE,aAAa,CAAC;CAC1B,+BAwCA"}
|
|
@@ -109,16 +109,14 @@ function trackNetworkEvents(_a) {
|
|
|
109
109
|
// if the URL failed to parse, just use the original URL
|
|
110
110
|
// and do not include the query or fragment
|
|
111
111
|
}
|
|
112
|
-
var startTimeAsDate = request.startTime ? new Date(request.startTime).toISOString() : undefined;
|
|
113
|
-
var endTimeAsDate = request.endTime ? new Date(request.endTime).toISOString() : undefined;
|
|
114
112
|
var networkAnalyticsEvent = (_a = {},
|
|
115
113
|
_a['[Amplitude] URL'] = request.url,
|
|
116
114
|
_a['[Amplitude] URL Query'] = urlQuery,
|
|
117
115
|
_a['[Amplitude] URL Fragment'] = urlFragment,
|
|
118
116
|
_a['[Amplitude] Request Method'] = request.method,
|
|
119
117
|
_a['[Amplitude] Status Code'] = request.status,
|
|
120
|
-
_a['[Amplitude] Start Time'] =
|
|
121
|
-
_a['[Amplitude] Completion Time'] =
|
|
118
|
+
_a['[Amplitude] Start Time'] = request.startTime,
|
|
119
|
+
_a['[Amplitude] Completion Time'] = request.endTime,
|
|
122
120
|
_a['[Amplitude] Duration'] = request.duration,
|
|
123
121
|
_a['[Amplitude] Request Body Size'] = request.requestBodySize,
|
|
124
122
|
_a['[Amplitude] Response Body Size'] = request.responseBodySize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track-network-event.js","sourceRoot":"","sources":["../../src/track-network-event.ts"],"names":[],"mappings":";;;;AAMA,6BAA8B;AAE9B,yCAA8D;AAE9D,IAAM,yBAAyB,GAAG,SAAS,CAAC;AAE5C,SAAS,aAAa,CAAC,GAAW,EAAE,OAAe;IACjD,mDAAmD;IACnD,IAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;IAC1E,oBAAoB;IACpB,IAAM,YAAY,GAAG,GAAG,GAAG,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,GAAG,CAAC;IACrE,IAAM,KAAK,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC;IACvC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,mBAAmB,CAAC,UAAkB,EAAE,KAAa;;IAC5D,IAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;;QAChC,KAAgB,IAAA,WAAA,iBAAA,MAAM,CAAA,8BAAA,kDAAE;YAAnB,IAAM,CAAC,mBAAA;YACJ,IAAA,KAAA,eAAe,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAA,EAAtC,KAAK,QAAA,EAAE,GAAG,QAA4B,CAAC;YAC9C,IAAI,UAAU,KAAK,KAAK,I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G,CAAC,CAAC;YAC3B,QAAQ,GAAG,GAAG,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;YACvC,WAAW,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;SACzC;QAAC,OAAO,CAAC,EAAE;YACV,wDAAwD;YACxD,2CAA2C;SAC5C;QAED,IAAM,qBAAqB;YACzB,GAAC,iBAAiB,IAAG,OAAO,CAAC,GAAG;YAChC,GAAC,uBAAuB,IAAG,QAAQ;YACnC,GAAC,0BAA0B,IAAG,WAAW;YACzC,GAAC,4BAA4B,IAAG,OAAO,CAAC,MAAM;YAC9C,GAAC,yBAAyB,IAAG,OAAO,CAAC,MAAM;YAC3C,GAAC,wBAAwB,IAAG,OAAO,CAAC,SAAS;YAC7C,GAAC,6BAA6B,IAAG,OAAO,CAAC,OAAO;YAChD,GAAC,sBAAsB,IAAG,OAAO,CAAC,QAAQ;YAC1C,GAAC,+BAA+B,IAAG,OAAO,CAAC,eAAe;YAC1D,GAAC,gCAAgC,IAAG,OAAO,CAAC,gBAAgB;eAC7D,CAAC;QAEF,0BAA0B;QAC1B,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,CAAC,2CAA+B,EAAE,qBAAqB,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC;AAhDD,gDAgDC","sourcesContent":["import {\n BrowserClient,\n NetworkRequestEvent,\n NetworkCaptureRule,\n NetworkTrackingOptions,\n} from '@amplitude/analytics-core';\nimport { filter } from 'rxjs';\nimport { AllWindowObservables, TimestampedEvent } from './network-capture-plugin';\nimport { AMPLITUDE_NETWORK_REQUEST_EVENT } from './constants';\n\nconst DEFAULT_STATUS_CODE_RANGE = '500-599';\n\nfunction wildcardMatch(str: string, pattern: string) {\n // Escape all regex special characters except for *\n const escapedPattern = pattern.replace(/[-[\\]{}()+?.,\\\\^$|#\\s]/g, '\\\\$&');\n // Replace * with .*\n const regexPattern = '^' + escapedPattern.replace(/\\*/g, '.*') + '$';\n const regex = new RegExp(regexPattern);\n return regex.test(str);\n}\n\nfunction isStatusCodeInRange(statusCode: number, range: string) {\n const ranges = range.split(',');\n for (const r of ranges) {\n const [start, end] = r.split('-').map(Number);\n if (statusCode === start && end === undefined) {\n return true;\n }\n if (statusCode >= start && statusCode <= end) {\n return true;\n }\n }\n return false;\n}\n\nfunction isCaptureRuleMatch(rule: NetworkCaptureRule, hostname: string, status?: number) {\n // check if the host is in the allowed hosts\n if (rule.hosts && !rule.hosts.find((host: string) => wildcardMatch(hostname, host))) {\n return;\n }\n\n // check if the status code is in the allowed range\n if (status || status === 0) {\n const statusCodeRange = rule.statusCodeRange || DEFAULT_STATUS_CODE_RANGE;\n if (!isStatusCodeInRange(status, statusCodeRange)) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function shouldTrackNetworkEvent(networkEvent: NetworkRequestEvent, options: NetworkTrackingOptions = {}) {\n const url = new URL(networkEvent.url);\n const host = url.hostname;\n\n // false if is amplitude request and not configured to track amplitude requests\n if (\n options.ignoreAmplitudeRequests !== false &&\n (wildcardMatch(host, '*.amplitude.com') || wildcardMatch(host, 'amplitude.com'))\n ) {\n return false;\n }\n\n // false if the host is in the ignore list\n if (options.ignoreHosts?.find((ignoreHost: string) => wildcardMatch(host, ignoreHost))) {\n return false;\n }\n\n // false if the status code is not 500-599 and there are no captureRules\n if (\n !options.captureRules &&\n networkEvent.status !== undefined &&\n !isStatusCodeInRange(networkEvent.status, DEFAULT_STATUS_CODE_RANGE)\n ) {\n return false;\n }\n\n if (options.captureRules) {\n // find the first capture rule, in reverse-order,\n // that is a match (true) or a miss (false)\n let isMatch: boolean | undefined;\n [...options.captureRules].reverse().find((rule) => {\n isMatch = isCaptureRuleMatch(rule, host, networkEvent.status);\n return isMatch !== undefined;\n });\n\n // if we found a miss (false) or no match (undefined),\n // then do not track the event\n if (!isMatch) {\n return false;\n }\n }\n\n return true;\n}\n\nexport type NetworkAnalyticsEvent = {\n ['[Amplitude] URL']: string;\n ['[Amplitude] URL Query']?: string;\n ['[Amplitude] URL Fragment']?: string;\n ['[Amplitude] Request Method']: string;\n ['[Amplitude] Status Code']?: number;\n ['[Amplitude] Start Time']?: number; // unix timestamp\n ['[Amplitude] Completion Time']?: number; // unix timestamp\n ['[Amplitude] Duration']?: number; // completionTime - startTime (millis)\n ['[Amplitude] Request Body Size']?: number;\n ['[Amplitude] Response Body Size']?: number;\n};\n\nexport function trackNetworkEvents({\n allObservables,\n networkTrackingOptions,\n amplitude,\n}: {\n allObservables: AllWindowObservables;\n networkTrackingOptions: NetworkTrackingOptions;\n amplitude: BrowserClient;\n}) {\n const { networkObservable } = allObservables;\n\n const filteredNetworkObservable = networkObservable.pipe(\n filter((event: TimestampedEvent<NetworkRequestEvent>) => {\n // Only track network events that should be tracked,\n return shouldTrackNetworkEvent(event.event as NetworkRequestEvent, networkTrackingOptions);\n }),\n );\n\n return filteredNetworkObservable.subscribe((networkEvent) => {\n const request = networkEvent.event as NetworkRequestEvent;\n\n // convert to NetworkAnalyticsEvent\n let url, urlQuery, urlFragment;\n try {\n url = new URL(request.url);\n urlQuery = url.searchParams.toString();\n urlFragment = url.hash.replace('#', '');\n } catch (e) {\n // if the URL failed to parse, just use the original URL\n // and do not include the query or fragment\n }\n\n const networkAnalyticsEvent: NetworkAnalyticsEvent = {\n ['[Amplitude] URL']: request.url,\n ['[Amplitude] URL Query']: urlQuery,\n ['[Amplitude] URL Fragment']: urlFragment,\n ['[Amplitude] Request Method']: request.method,\n ['[Amplitude] Status Code']: request.status,\n ['[Amplitude] Start Time']: request.startTime,\n ['[Amplitude] Completion Time']: request.endTime,\n ['[Amplitude] Duration']: request.duration,\n ['[Amplitude] Request Body Size']: request.requestBodySize,\n ['[Amplitude] Response Body Size']: request.responseBodySize,\n };\n\n /* istanbul ignore next */\n amplitude?.track(AMPLITUDE_NETWORK_REQUEST_EVENT, networkAnalyticsEvent);\n });\n}\n"]}
|
package/lib/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.1.
|
|
1
|
+
export declare const VERSION = "1.1.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/cjs/version.js
CHANGED
package/lib/cjs/version.js.map
CHANGED
|
@@ -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.
|
|
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.2';\n"]}
|
|
@@ -7,8 +7,8 @@ export type NetworkAnalyticsEvent = {
|
|
|
7
7
|
['[Amplitude] URL Fragment']?: string;
|
|
8
8
|
['[Amplitude] Request Method']: string;
|
|
9
9
|
['[Amplitude] Status Code']?: number;
|
|
10
|
-
['[Amplitude] Start Time']?:
|
|
11
|
-
['[Amplitude] Completion Time']?:
|
|
10
|
+
['[Amplitude] Start Time']?: number;
|
|
11
|
+
['[Amplitude] Completion Time']?: number;
|
|
12
12
|
['[Amplitude] Duration']?: number;
|
|
13
13
|
['[Amplitude] Request Body Size']?: number;
|
|
14
14
|
['[Amplitude] Response Body Size']?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track-network-event.d.ts","sourceRoot":"","sources":["../../src/track-network-event.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,mBAAmB,EAEnB,sBAAsB,EACvB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAoB,MAAM,0BAA0B,CAAC;AA6ClF,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,mBAAmB,EAAE,OAAO,GAAE,sBAA2B,WA2C9G;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,CAAC,iBAAiB,C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AE,MAAM,CAAC;IACrC,CAAC,wBAAwB,CAAC,CAAC,EAAE,MAAM,CAAC;IACpC,CAAC,6BAA6B,CAAC,CAAC,EAAE,MAAM,CAAC;IACzC,CAAC,sBAAsB,CAAC,CAAC,EAAE,MAAM,CAAC;IAClC,CAAC,+BAA+B,CAAC,CAAC,EAAE,MAAM,CAAC;IAC3C,CAAC,gCAAgC,CAAC,CAAC,EAAE,MAAM,CAAC;CAC7C,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,cAAc,EACd,sBAAsB,EACtB,SAAS,GACV,EAAE;IACD,cAAc,EAAE,oBAAoB,CAAC;IACrC,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,SAAS,EAAE,aAAa,CAAC;CAC1B,+BAwCA"}
|
|
@@ -105,16 +105,14 @@ export function trackNetworkEvents(_a) {
|
|
|
105
105
|
// if the URL failed to parse, just use the original URL
|
|
106
106
|
// and do not include the query or fragment
|
|
107
107
|
}
|
|
108
|
-
var startTimeAsDate = request.startTime ? new Date(request.startTime).toISOString() : undefined;
|
|
109
|
-
var endTimeAsDate = request.endTime ? new Date(request.endTime).toISOString() : undefined;
|
|
110
108
|
var networkAnalyticsEvent = (_a = {},
|
|
111
109
|
_a['[Amplitude] URL'] = request.url,
|
|
112
110
|
_a['[Amplitude] URL Query'] = urlQuery,
|
|
113
111
|
_a['[Amplitude] URL Fragment'] = urlFragment,
|
|
114
112
|
_a['[Amplitude] Request Method'] = request.method,
|
|
115
113
|
_a['[Amplitude] Status Code'] = request.status,
|
|
116
|
-
_a['[Amplitude] Start Time'] =
|
|
117
|
-
_a['[Amplitude] Completion Time'] =
|
|
114
|
+
_a['[Amplitude] Start Time'] = request.startTime,
|
|
115
|
+
_a['[Amplitude] Completion Time'] = request.endTime,
|
|
118
116
|
_a['[Amplitude] Duration'] = request.duration,
|
|
119
117
|
_a['[Amplitude] Request Body Size'] = request.requestBodySize,
|
|
120
118
|
_a['[Amplitude] Response Body Size'] = request.responseBodySize,
|
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DAAwD;YACxD,2CAA2C;SAC5C;QAED,IAAM,qBAAqB;YACzB,GAAC,iBAAiB,IAAG,OAAO,CAAC,GAAG;YAChC,GAAC,uBAAuB,IAAG,QAAQ;YACnC,GAAC,0BAA0B,IAAG,WAAW;YACzC,GAAC,4BAA4B,IAAG,OAAO,CAAC,MAAM;YAC9C,GAAC,yBAAyB,IAAG,OAAO,CAAC,MAAM;YAC3C,GAAC,wBAAwB,IAAG,OAAO,CAAC,SAAS;YAC7C,GAAC,6BAA6B,IAAG,OAAO,CAAC,OAAO;YAChD,GAAC,sBAAsB,IAAG,OAAO,CAAC,QAAQ;YAC1C,GAAC,+BAA+B,IAAG,OAAO,CAAC,eAAe;YAC1D,GAAC,gCAAgC,IAAG,OAAO,CAAC,gBAAgB;eAC7D,CAAC;QAEF,0BAA0B;QAC1B,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n BrowserClient,\n NetworkRequestEvent,\n NetworkCaptureRule,\n NetworkTrackingOptions,\n} from '@amplitude/analytics-core';\nimport { filter } from 'rxjs';\nimport { AllWindowObservables, TimestampedEvent } from './network-capture-plugin';\nimport { AMPLITUDE_NETWORK_REQUEST_EVENT } from './constants';\n\nconst DEFAULT_STATUS_CODE_RANGE = '500-599';\n\nfunction wildcardMatch(str: string, pattern: string) {\n // Escape all regex special characters except for *\n const escapedPattern = pattern.replace(/[-[\\]{}()+?.,\\\\^$|#\\s]/g, '\\\\$&');\n // Replace * with .*\n const regexPattern = '^' + escapedPattern.replace(/\\*/g, '.*') + '$';\n const regex = new RegExp(regexPattern);\n return regex.test(str);\n}\n\nfunction isStatusCodeInRange(statusCode: number, range: string) {\n const ranges = range.split(',');\n for (const r of ranges) {\n const [start, end] = r.split('-').map(Number);\n if (statusCode === start && end === undefined) {\n return true;\n }\n if (statusCode >= start && statusCode <= end) {\n return true;\n }\n }\n return false;\n}\n\nfunction isCaptureRuleMatch(rule: NetworkCaptureRule, hostname: string, status?: number) {\n // check if the host is in the allowed hosts\n if (rule.hosts && !rule.hosts.find((host: string) => wildcardMatch(hostname, host))) {\n return;\n }\n\n // check if the status code is in the allowed range\n if (status || status === 0) {\n const statusCodeRange = rule.statusCodeRange || DEFAULT_STATUS_CODE_RANGE;\n if (!isStatusCodeInRange(status, statusCodeRange)) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function shouldTrackNetworkEvent(networkEvent: NetworkRequestEvent, options: NetworkTrackingOptions = {}) {\n const url = new URL(networkEvent.url);\n const host = url.hostname;\n\n // false if is amplitude request and not configured to track amplitude requests\n if (\n options.ignoreAmplitudeRequests !== false &&\n (wildcardMatch(host, '*.amplitude.com') || wildcardMatch(host, 'amplitude.com'))\n ) {\n return false;\n }\n\n // false if the host is in the ignore list\n if (options.ignoreHosts?.find((ignoreHost: string) => wildcardMatch(host, ignoreHost))) {\n return false;\n }\n\n // false if the status code is not 500-599 and there are no captureRules\n if (\n !options.captureRules &&\n networkEvent.status !== undefined &&\n !isStatusCodeInRange(networkEvent.status, DEFAULT_STATUS_CODE_RANGE)\n ) {\n return false;\n }\n\n if (options.captureRules) {\n // find the first capture rule, in reverse-order,\n // that is a match (true) or a miss (false)\n let isMatch: boolean | undefined;\n [...options.captureRules].reverse().find((rule) => {\n isMatch = isCaptureRuleMatch(rule, host, networkEvent.status);\n return isMatch !== undefined;\n });\n\n // if we found a miss (false) or no match (undefined),\n // then do not track the event\n if (!isMatch) {\n return false;\n }\n }\n\n return true;\n}\n\nexport type NetworkAnalyticsEvent = {\n ['[Amplitude] URL']: string;\n ['[Amplitude] URL Query']?: string;\n ['[Amplitude] URL Fragment']?: string;\n ['[Amplitude] Request Method']: string;\n ['[Amplitude] Status Code']?: number;\n ['[Amplitude] Start Time']?: number; // unix timestamp\n ['[Amplitude] Completion Time']?: number; // unix timestamp\n ['[Amplitude] Duration']?: number; // completionTime - startTime (millis)\n ['[Amplitude] Request Body Size']?: number;\n ['[Amplitude] Response Body Size']?: number;\n};\n\nexport function trackNetworkEvents({\n allObservables,\n networkTrackingOptions,\n amplitude,\n}: {\n allObservables: AllWindowObservables;\n networkTrackingOptions: NetworkTrackingOptions;\n amplitude: BrowserClient;\n}) {\n const { networkObservable } = allObservables;\n\n const filteredNetworkObservable = networkObservable.pipe(\n filter((event: TimestampedEvent<NetworkRequestEvent>) => {\n // Only track network events that should be tracked,\n return shouldTrackNetworkEvent(event.event as NetworkRequestEvent, networkTrackingOptions);\n }),\n );\n\n return filteredNetworkObservable.subscribe((networkEvent) => {\n const request = networkEvent.event as NetworkRequestEvent;\n\n // convert to NetworkAnalyticsEvent\n let url, urlQuery, urlFragment;\n try {\n url = new URL(request.url);\n urlQuery = url.searchParams.toString();\n urlFragment = url.hash.replace('#', '');\n } catch (e) {\n // if the URL failed to parse, just use the original URL\n // and do not include the query or fragment\n }\n\n const networkAnalyticsEvent: NetworkAnalyticsEvent = {\n ['[Amplitude] URL']: request.url,\n ['[Amplitude] URL Query']: urlQuery,\n ['[Amplitude] URL Fragment']: urlFragment,\n ['[Amplitude] Request Method']: request.method,\n ['[Amplitude] Status Code']: request.status,\n ['[Amplitude] Start Time']: request.startTime,\n ['[Amplitude] Completion Time']: request.endTime,\n ['[Amplitude] Duration']: request.duration,\n ['[Amplitude] Request Body Size']: request.requestBodySize,\n ['[Amplitude] Response Body Size']: request.responseBodySize,\n };\n\n /* istanbul ignore next */\n amplitude?.track(AMPLITUDE_NETWORK_REQUEST_EVENT, networkAnalyticsEvent);\n });\n}\n"]}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.1.
|
|
1
|
+
export declare const VERSION = "1.1.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var VERSION = '1.1.
|
|
1
|
+
export var VERSION = '1.1.2';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/lib/esm/version.js.map
CHANGED
|
@@ -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.
|
|
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.2';\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 s(t){try{c(n.next(t))}catch(t){o(t)}}function u(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(s,u)}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:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=e.call(t,o)}catch(t){u=[6,t],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,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 s(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)s.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 s}function u(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=u([],s(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,u([],s(n.entries()),!1).map((function(t){var e=s(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 u=t,a=0,l=0;try{for(var f=o(u.entries()),h=f.next();!h.done;h=f.next()){var p=s(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,s,u,c,a,l,h;return i(this,(function(i){switch(i.label){case 0:t=Date.now(),n={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(),l=Date.now(),n.status=s.status,n.duration=l-t,n.startTime=t,n.endTime=l,u={},c=void 0,s.headers.forEach((function(t,e){u[e]=t,"content-length"===e&&(c=parseInt(t,10)||void 0)})),n.responseHeaders=u,n.responseBodySize=c,this.triggerEventCallbacks(n),[2,s];case 3:throw a=i.sent(),l=Date.now(),n.duration=l-t,h=a,n.error={name:h.name||"UnknownError",message:h.message||"An unknown error occurred"},this.triggerEventCallbacks(n),a;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=u(u([],s(i)),s(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,u([t,e],s(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 C(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 I=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}(),C=function(t){function e(e,r,n){var i,o,s=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}:s&&x.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return s.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 s.destination=new I(i),s}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},j="function"==typeof Symbol&&Symbol.observable||"@@observable";function z(t){return t}var q=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 C(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 C({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[j]=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?z: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 B(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 D(t,e,r,n,i){return new N(t,e,r,n,i)}var N=function(t){function e(e,r,n,i,o,s){var u=t.call(this,e)||this;return u.onFinalize=o,u.shouldUnsubscribe=s,u._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,u._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,u._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,u}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(D(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 B((function(t,e){var r=null;t._refCount++;var n=D(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)}}(q);var M,L={now:function(){return(L.delegate||performance).now()},delegate:void 0},V={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=V.delegate;return((null==r?void 0:r.requestAnimationFrame)||requestAnimationFrame).apply(void 0,u([],s(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,u([],s(t)))},delegate:void 0};new q((function(t){var e=M||L,r=e.now(),n=0,i=function(){t.closed||(n=V.requestAnimationFrame((function(o){n=0;var s=e.now();t.next({timestamp:M?s:o,elapsed:s-r}),i()})))};return i(),function(){n&&V.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),s=i.next();!s.done;s=i.next()){s.value.next(t)}}catch(t){r={error:t}}finally{try{s&&!s.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 q;return t.source=this,t},e.create=function(t,e){return new Y(t,e)},e}(q),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 $={now:function(){return($.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=$);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,s=r._timestampProvider,u=r._windowTime;n||(i.push(e),!o&&i.push(s.now()+u)),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 s=r.now(),u=0,c=1;c<n.length&&n[c]<=s;c+=2)u=c;u&&n.splice(0,u+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,s=e.isStopped,u=e._isComplete;r?t.error(o):(s||u)&&(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,Q=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,u([t,e],s(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}(Q),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,G||(G=Promise.resolve()),G.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,u([],s(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),st=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=$.now,t}(),ut=function(t){function e(e,r){void 0===r&&(r=st.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}(st),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}(ut);new ct(ot),new ut(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}(ut);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=V.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&&(V.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}(ut);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}(ut);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 q((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 q(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 u=o(i),c=u.next();!c.done;c=u.next()){var a=s(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=u.return)&&n.call(u)}finally{if(r)throw r.error}}return!1}function wt(t,e){var r;void 0===e&&(e={});var n,i=new URL(t.url).hostname;if(!1!==e.ignoreAmplitudeRequests&&(bt(i,"*.amplitude.com")||bt(i,"amplitude.com")))return!1;if(null===(r=e.ignoreHosts)||void 0===r?void 0:r.find((function(t){return bt(i,t)})))return!1;if(!e.captureRules&&void 0!==t.status&&!mt(t.status,yt))return!1;if(e.captureRules&&(u([],s(e.captureRules),!1).reverse().find((function(e){return n=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,i,t.status),void 0!==n})),!n))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 wt(t.event,i)},B((function(t,n){var i=0;t.subscribe(D(n,(function(t){return e.call(r,t,i++)&&n.next(t)})))})))).subscribe((function(t){var e,r,n,i,s=t.event;try{n=(r=new URL(s.url)).searchParams.toString(),i=r.hash.replace("#","")}catch(t){}var u=s.startTime?new Date(s.startTime).toISOString():void 0,c=s.endTime?new Date(s.endTime).toISOString():void 0,a=((e={})["[Amplitude] URL"]=s.url,e["[Amplitude] URL Query"]=n,e["[Amplitude] URL Fragment"]=i,e["[Amplitude] Request Method"]=s.method,e["[Amplitude] Status Code"]=s.status,e["[Amplitude] Start Time"]=u,e["[Amplitude] Completion Time"]=c,e["[Amplitude] Duration"]=s.duration,e["[Amplitude] Request Body Size"]=s.requestBodySize,e["[Amplitude] Response Body Size"]=s.responseBodySize,e);null==o||o.track("[Amplitude] Network Request",a)}))}!function(t){t.NetworkObservable="networkObservable"}(vt||(vt={}));var gt=function(t){void 0===t&&(t={});var e="@amplitude/plugin-network-capture-browser",r=[],s=function(){var t,e=new q((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,u){return n(void 0,void 0,void 0,(function(){var n,c,a;return i(this,(function(i){return"undefined"==typeof document||(n=s(),c=_t({allObservables:n,networkTrackingOptions:t,amplitude:u}),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,s;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&&(s=t.return)&&s.call(t)}finally{if(n)throw n.error}}return[2]}))}))}}};return t.networkCapturePlugin=gt,t.plugin=gt,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 s(t){try{c(n.next(t))}catch(t){o(t)}}function u(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(s,u)}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:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&u[0]?n.return:u[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,u[1])).done)return i;switch(n=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,n=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=e.call(t,o)}catch(t){u=[6,t],n=0}finally{r=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,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 s(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)s.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 s}function u(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=u([],s(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,u([],s(n.entries()),!1).map((function(t){var e=s(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 u=t,a=0,l=0;try{for(var f=o(u.entries()),h=f.next();!h.done;h=f.next()){var p=s(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,s,u,c,a,l,h;return i(this,(function(i){switch(i.label){case 0:t=Date.now(),n={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(),l=Date.now(),n.status=s.status,n.duration=l-t,n.startTime=t,n.endTime=l,u={},c=void 0,s.headers.forEach((function(t,e){u[e]=t,"content-length"===e&&(c=parseInt(t,10)||void 0)})),n.responseHeaders=u,n.responseBodySize=c,this.triggerEventCallbacks(n),[2,s];case 3:throw a=i.sent(),l=Date.now(),n.duration=l-t,h=a,n.error={name:h.name||"UnknownError",message:h.message||"An unknown error occurred"},this.triggerEventCallbacks(n),a;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=u(u([],s(i)),s(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,u([t,e],s(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,s=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}:s&&x.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return s.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 s.destination=new C(i),s}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},j="function"==typeof Symbol&&Symbol.observable||"@@observable";function z(t){return t}var q=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[j]=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?z: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 B(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 N(t,e,r,n,i){return new M(t,e,r,n,i)}var M=function(t){function e(e,r,n,i,o,s){var u=t.call(this,e)||this;return u.onFinalize=o,u.shouldUnsubscribe=s,u._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,u._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,u._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,u}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(N(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 B((function(t,e){var r=null;t._refCount++;var n=N(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)}}(q);var D,L={now:function(){return(L.delegate||performance).now()},delegate:void 0},V={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=V.delegate;return((null==r?void 0:r.requestAnimationFrame)||requestAnimationFrame).apply(void 0,u([],s(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,u([],s(t)))},delegate:void 0};new q((function(t){var e=D||L,r=e.now(),n=0,i=function(){t.closed||(n=V.requestAnimationFrame((function(o){n=0;var s=e.now();t.next({timestamp:D?s:o,elapsed:s-r}),i()})))};return i(),function(){n&&V.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),s=i.next();!s.done;s=i.next()){s.value.next(t)}}catch(t){r={error:t}}finally{try{s&&!s.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 q;return t.source=this,t},e.create=function(t,e){return new Y(t,e)},e}(q),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 $={now:function(){return($.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=$);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,s=r._timestampProvider,u=r._windowTime;n||(i.push(e),!o&&i.push(s.now()+u)),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 s=r.now(),u=0,c=1;c<n.length&&n[c]<=s;c+=2)u=c;u&&n.splice(0,u+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,s=e.isStopped,u=e._isComplete;r?t.error(o):(s||u)&&(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,Q=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,u([t,e],s(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}(Q),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,G||(G=Promise.resolve()),G.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,u([],s(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),st=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=$.now,t}(),ut=function(t){function e(e,r){void 0===r&&(r=st.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}(st),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}(ut);new ct(ot),new ut(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}(ut);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=V.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&&(V.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}(ut);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}(ut);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 q((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 q(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 u=o(i),c=u.next();!c.done;c=u.next()){var a=s(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=u.return)&&n.call(u)}finally{if(r)throw r.error}}return!1}function wt(t,e){var r;void 0===e&&(e={});var n,i=new URL(t.url).hostname;if(!1!==e.ignoreAmplitudeRequests&&(bt(i,"*.amplitude.com")||bt(i,"amplitude.com")))return!1;if(null===(r=e.ignoreHosts)||void 0===r?void 0:r.find((function(t){return bt(i,t)})))return!1;if(!e.captureRules&&void 0!==t.status&&!mt(t.status,yt))return!1;if(e.captureRules&&(u([],s(e.captureRules),!1).reverse().find((function(e){return n=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,i,t.status),void 0!==n})),!n))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 wt(t.event,i)},B((function(t,n){var i=0;t.subscribe(N(n,(function(t){return e.call(r,t,i++)&&n.next(t)})))})))).subscribe((function(t){var e,r,n,i,s=t.event;try{n=(r=new URL(s.url)).searchParams.toString(),i=r.hash.replace("#","")}catch(t){}var u=((e={})["[Amplitude] URL"]=s.url,e["[Amplitude] URL Query"]=n,e["[Amplitude] URL Fragment"]=i,e["[Amplitude] Request Method"]=s.method,e["[Amplitude] Status Code"]=s.status,e["[Amplitude] Start Time"]=s.startTime,e["[Amplitude] Completion Time"]=s.endTime,e["[Amplitude] Duration"]=s.duration,e["[Amplitude] Request Body Size"]=s.requestBodySize,e["[Amplitude] Response Body Size"]=s.responseBodySize,e);null==o||o.track("[Amplitude] Network Request",u)}))}!function(t){t.NetworkObservable="networkObservable"}(vt||(vt={}));var gt=function(t){void 0===t&&(t={});var e="@amplitude/plugin-network-capture-browser",r=[],s=function(){var t,e=new q((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,u){return n(void 0,void 0,void 0,(function(){var n,c,a;return i(this,(function(i){return"undefined"==typeof document||(n=s(),c=_t({allObservables:n,networkTrackingOptions:t,amplitude:u}),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,s;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&&(s=t.return)&&s.call(t)}finally{if(n)throw n.error}}return[2]}))}))}}};return t.networkCapturePlugin=gt,t.plugin=gt,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
|
2
2
|
//# sourceMappingURL=amplitude-min.js.map
|
|
Binary file
|