@amplitude/analytics-browser 1.0.2 → 1.0.3
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/README.md +3 -3
- package/lib/cjs/attribution/campaign-tracker.d.ts +0 -1
- package/lib/cjs/attribution/campaign-tracker.d.ts.map +1 -1
- package/lib/cjs/browser-client.d.ts.map +1 -1
- package/lib/cjs/browser-client.js +9 -3
- package/lib/cjs/browser-client.js.map +1 -1
- package/lib/cjs/config.d.ts +1 -1
- package/lib/cjs/config.d.ts.map +1 -1
- package/lib/cjs/config.js +37 -17
- package/lib/cjs/config.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/attribution/campaign-tracker.d.ts +0 -1
- package/lib/esm/attribution/campaign-tracker.d.ts.map +1 -1
- package/lib/esm/browser-client.d.ts.map +1 -1
- package/lib/esm/browser-client.js +9 -3
- package/lib/esm/browser-client.js.map +1 -1
- package/lib/esm/config.d.ts +1 -1
- package/lib/esm/config.d.ts.map +1 -1
- package/lib/esm/config.js +38 -18
- package/lib/esm/config.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.umd.js +1 -1
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/package.json +8 -7
package/lib/esm/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign, __awaiter, __extends, __generator } from "tslib";
|
|
1
|
+
import { __assign, __awaiter, __extends, __generator, __values } from "tslib";
|
|
2
2
|
import { TransportType, } from '@amplitude/analytics-types';
|
|
3
3
|
import { Config, MemoryStorage, UUID } from '@amplitude/analytics-core';
|
|
4
4
|
import { CookieStorage } from './storage/cookie';
|
|
@@ -45,7 +45,7 @@ var BrowserConfig = /** @class */ (function (_super) {
|
|
|
45
45
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
46
46
|
var _this = this;
|
|
47
47
|
var defaultConfig = getDefaultConfig();
|
|
48
|
-
_this = _super.call(this, __assign(__assign({}, options), { apiKey: apiKey, storageProvider: (_a = options === null || options === void 0 ? void 0 : options.storageProvider) !== null && _a !== void 0 ? _a : defaultConfig.storageProvider, transportProvider: (_b = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _b !== void 0 ? _b : defaultConfig.transportProvider })) || this;
|
|
48
|
+
_this = _super.call(this, __assign(__assign({ flushIntervalMillis: 1000, flushMaxRetries: 5, flushQueueSize: 30 }, options), { apiKey: apiKey, storageProvider: (_a = options === null || options === void 0 ? void 0 : options.storageProvider) !== null && _a !== void 0 ? _a : defaultConfig.storageProvider, transportProvider: (_b = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _b !== void 0 ? _b : defaultConfig.transportProvider })) || this;
|
|
49
49
|
_this.cookieStorage = (_c = options === null || options === void 0 ? void 0 : options.cookieStorage) !== null && _c !== void 0 ? _c : defaultConfig.cookieStorage;
|
|
50
50
|
_this.sessionManager = (_d = options === null || options === void 0 ? void 0 : options.sessionManager) !== null && _d !== void 0 ? _d : defaultConfig.sessionManager;
|
|
51
51
|
_this.sessionTimeout = (_e = options === null || options === void 0 ? void 0 : options.sessionTimeout) !== null && _e !== void 0 ? _e : defaultConfig.sessionTimeout;
|
|
@@ -213,27 +213,47 @@ export var createFlexibleStorage = function (options) { return __awaiter(void 0,
|
|
|
213
213
|
});
|
|
214
214
|
}); };
|
|
215
215
|
export var createEventsStorage = function (overrides) { return __awaiter(void 0, void 0, void 0, function () {
|
|
216
|
-
var
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
var hasStorageProviderProperty, _a, _b, storage, _c, e_1_1;
|
|
217
|
+
var e_1, _d;
|
|
218
|
+
return __generator(this, function (_e) {
|
|
219
|
+
switch (_e.label) {
|
|
219
220
|
case 0:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return [4 /*yield*/, eventsStorage.isEnabled()];
|
|
221
|
+
hasStorageProviderProperty = overrides && Object.prototype.hasOwnProperty.call(overrides, 'storageProvider');
|
|
222
|
+
if (!(!hasStorageProviderProperty || overrides.storageProvider)) return [3 /*break*/, 9];
|
|
223
|
+
_e.label = 1;
|
|
224
224
|
case 1:
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
_e.trys.push([1, 7, 8, 9]);
|
|
226
|
+
_a = __values([overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider, new LocalStorage()]), _b = _a.next();
|
|
227
|
+
_e.label = 2;
|
|
227
228
|
case 2:
|
|
228
|
-
if (
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
if (!!_b.done) return [3 /*break*/, 6];
|
|
230
|
+
storage = _b.value;
|
|
231
|
+
_c = storage;
|
|
232
|
+
if (!_c) return [3 /*break*/, 4];
|
|
233
|
+
return [4 /*yield*/, storage.isEnabled()];
|
|
231
234
|
case 3:
|
|
232
|
-
|
|
233
|
-
|
|
235
|
+
_c = (_e.sent());
|
|
236
|
+
_e.label = 4;
|
|
237
|
+
case 4:
|
|
238
|
+
if (_c) {
|
|
239
|
+
return [2 /*return*/, storage];
|
|
234
240
|
}
|
|
235
|
-
|
|
236
|
-
case
|
|
241
|
+
_e.label = 5;
|
|
242
|
+
case 5:
|
|
243
|
+
_b = _a.next();
|
|
244
|
+
return [3 /*break*/, 2];
|
|
245
|
+
case 6: return [3 /*break*/, 9];
|
|
246
|
+
case 7:
|
|
247
|
+
e_1_1 = _e.sent();
|
|
248
|
+
e_1 = { error: e_1_1 };
|
|
249
|
+
return [3 /*break*/, 9];
|
|
250
|
+
case 8:
|
|
251
|
+
try {
|
|
252
|
+
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
253
|
+
}
|
|
254
|
+
finally { if (e_1) throw e_1.error; }
|
|
255
|
+
return [7 /*endfinally*/];
|
|
256
|
+
case 9: return [2 /*return*/, undefined];
|
|
237
257
|
}
|
|
238
258
|
});
|
|
239
259
|
}); };
|
package/lib/esm/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";AAAA,OAAO,EAML,aAAa,GAGd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,CAAC,IAAM,gBAAgB,GAAG;IAC9B,IAAM,aAAa,GAAG,IAAI,aAAa,EAAe,CAAC;IACvD,OAAO;QACL,gBAAgB,EAAE,GAAG;QACrB,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE,KAAK;QACnB,aAAa,eAAA;QACb,cAAc,EAAE,KAAK;QACrB,MAAM,EAAE,EAAE;QACV,cAAc,EAAE,IAAI,cAAc,CAAC,aAAa,EAAE,EAAE,CAAC;QACrD,cAAc,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;QAC9B,eAAe,EAAE,IAAI,aAAa,EAAW;QAC7C,eAAe,EAAE;YACf,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;YACb,kBAAkB,EAAE,I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,QAAQ,CAAC;gBAChC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACxB,MAAM,GAAG,EAAE,CAAC;gBACZ,UAAU,GAAG,aAAa,CAAC;gBAEjC,KAAS,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;oBAC1C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;iBACvC;gBACQ,CAAC,GAAG,CAAC;;;qBAAE,CAAA,CAAC,GAAG,MAAM,CAAC,MAAM,CAAA;gBACzB,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;gBACnB,OAAO,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,EAAE,CAAC;gBACnC,OAAO,GAAG,IAAI,aAAa,CAAS,OAAO,CAAC,CAAC;gBACnD,qBAAM,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,EAAA;;gBAAhC,SAAgC,CAAC;gBACnB,qBAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAA;;gBAArC,KAAK,GAAG,SAA6B;qBACvC,KAAK,EAAL,wBAAK;gBACP,qBAAM,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAA;;gBAAhC,SAAgC,CAAC;gBACjC,sBAAO,GAAG,GAAG,MAAM,EAAC;;gBARW,CAAC,EAAE,CAAA;;oBAYtC,sBAAO,EAAE,EAAC;;;KACX,CAAC","sourcesContent":["import {\n Event,\n BrowserOptions,\n BrowserConfig as IBrowserConfig,\n Storage,\n TrackingOptions,\n TransportType,\n UserSession,\n SessionManager as ISessionManager,\n} from '@amplitude/analytics-types';\nimport { Config, MemoryStorage, UUID } from '@amplitude/analytics-core';\n\nimport { CookieStorage } from './storage/cookie';\nimport { FetchTransport } from './transports/fetch';\nimport { LocalStorage } from './storage/local-storage';\nimport { getCookieName } from './utils/cookie-name';\nimport { getQueryParams } from './utils/query-params';\nimport { XHRTransport } from './transports/xhr';\nimport { SendBeaconTransport } from './transports/send-beacon';\nimport { SessionManager } from './session-manager';\n\nexport const getDefaultConfig = () => {\n const cookieStorage = new MemoryStorage<UserSession>();\n return {\n cookieExpiration: 365,\n cookieSameSite: 'Lax',\n cookieSecure: false,\n cookieStorage,\n disableCookies: false,\n domain: '',\n sessionManager: new SessionManager(cookieStorage, ''),\n sessionTimeout: 30 * 60 * 1000,\n storageProvider: new MemoryStorage<Event[]>(),\n trackingOptions: {\n city: true,\n country: true,\n carrier: true,\n deviceManufacturer: true,\n deviceModel: true,\n dma: true,\n ipAddress: true,\n language: true,\n osName: true,\n osVersion: true,\n platform: true,\n region: true,\n versionName: true,\n },\n transportProvider: new FetchTransport(),\n };\n};\n\nexport class BrowserConfig extends Config implements IBrowserConfig {\n appVersion?: string;\n cookieExpiration: number;\n cookieSameSite: string;\n cookieSecure: boolean;\n cookieStorage: Storage<UserSession>;\n disableCookies: boolean;\n domain: string;\n partnerId?: string;\n sessionTimeout: number;\n trackingOptions: TrackingOptions;\n sessionManager: ISessionManager;\n\n constructor(apiKey: string, userId?: string, options?: BrowserOptions) {\n const defaultConfig = getDefaultConfig();\n super({\n ...options,\n apiKey,\n storageProvider: options?.storageProvider ?? defaultConfig.storageProvider,\n transportProvider: options?.transportProvider ?? defaultConfig.transportProvider,\n });\n this.cookieStorage = options?.cookieStorage ?? defaultConfig.cookieStorage;\n this.sessionManager = options?.sessionManager ?? defaultConfig.sessionManager;\n this.sessionTimeout = options?.sessionTimeout ?? defaultConfig.sessionTimeout;\n\n this.appVersion = options?.appVersion;\n this.cookieExpiration = options?.cookieExpiration ?? defaultConfig.cookieExpiration;\n this.cookieSameSite = options?.cookieSameSite ?? defaultConfig.cookieSameSite;\n this.cookieSecure = options?.cookieSecure ?? defaultConfig.cookieSecure;\n this.deviceId = options?.deviceId;\n this.disableCookies = options?.disableCookies ?? defaultConfig.disableCookies;\n this.domain = options?.domain ?? defaultConfig.domain;\n this.lastEventTime = this.lastEventTime ?? options?.lastEventTime;\n this.optOut = Boolean(options?.optOut);\n this.partnerId = options?.partnerId;\n this.sessionId = options?.sessionId;\n this.trackingOptions = options?.trackingOptions ?? defaultConfig.trackingOptions;\n this.userId = userId;\n }\n\n get deviceId() {\n return this.sessionManager.getDeviceId();\n }\n\n set deviceId(deviceId: string | undefined) {\n this.sessionManager.setDeviceId(deviceId);\n }\n\n get userId() {\n return this.sessionManager.getUserId();\n }\n\n set userId(userId: string | undefined) {\n this.sessionManager.setUserId(userId);\n }\n\n get sessionId() {\n return this.sessionManager.getSessionId();\n }\n\n set sessionId(sessionId: number | undefined) {\n this.sessionManager.setSessionId(sessionId);\n }\n\n get optOut() {\n return this.sessionManager.getOptOut();\n }\n\n set optOut(optOut: boolean) {\n this.sessionManager?.setOptOut(Boolean(optOut));\n }\n\n get lastEventTime() {\n return this.sessionManager.getLastEventTime();\n }\n\n set lastEventTime(lastEventTime: number | undefined) {\n this.sessionManager.setLastEventTime(lastEventTime);\n }\n}\n\nexport const useBrowserConfig = async (\n apiKey: string,\n userId?: string,\n options?: BrowserOptions,\n): Promise<IBrowserConfig> => {\n const defaultConfig = getDefaultConfig();\n const domain = options?.domain ?? (await getTopLevelDomain());\n const cookieStorage = await createCookieStorage({ ...options, domain });\n const cookieName = getCookieName(apiKey);\n const cookies = await cookieStorage.get(cookieName);\n const queryParams = getQueryParams();\n const sessionManager = await new SessionManager(cookieStorage, apiKey).load();\n\n return new BrowserConfig(apiKey, userId ?? cookies?.userId, {\n ...options,\n cookieStorage,\n sessionManager,\n deviceId: createDeviceId(cookies?.deviceId, options?.deviceId, queryParams.deviceId),\n domain,\n optOut: options?.optOut ?? Boolean(cookies?.optOut),\n sessionId: (await cookieStorage.get(cookieName))?.sessionId ?? options?.sessionId,\n storageProvider: await createEventsStorage(options),\n trackingOptions: { ...defaultConfig.trackingOptions, ...options?.trackingOptions },\n transportProvider: options?.transportProvider ?? createTransport(options?.transport),\n });\n};\n\nexport const createCookieStorage = async (\n overrides?: BrowserOptions,\n baseConfig = getDefaultConfig(),\n): Promise<Storage<UserSession>> => {\n const options = { ...baseConfig, ...overrides };\n const cookieStorage = overrides?.cookieStorage;\n if (!cookieStorage || !(await cookieStorage.isEnabled())) {\n return createFlexibleStorage<UserSession>(options);\n }\n return cookieStorage;\n};\n\nexport const createFlexibleStorage = async <T>(options: BrowserOptions): Promise<Storage<T>> => {\n let storage: Storage<T> = new CookieStorage({\n domain: options.domain,\n expirationDays: options.cookieExpiration,\n sameSite: options.cookieSameSite,\n secure: options.cookieSecure,\n });\n if (options.disableCookies || !(await storage.isEnabled())) {\n storage = new LocalStorage();\n if (!(await storage.isEnabled())) {\n storage = new MemoryStorage();\n }\n }\n return storage;\n};\n\nexport const createEventsStorage = async (overrides?: BrowserOptions): Promise<Storage<Event[]>> => {\n let eventsStorage = overrides?.storageProvider;\n if (!eventsStorage || !(await eventsStorage.isEnabled())) {\n eventsStorage = new LocalStorage();\n if (!(await eventsStorage.isEnabled())) {\n eventsStorage = new MemoryStorage();\n }\n }\n return eventsStorage;\n};\n\nexport const createDeviceId = (idFromCookies?: string, idFromOptions?: string, idFromQueryParams?: string) => {\n return idFromOptions || idFromQueryParams || idFromCookies || UUID();\n};\n\nexport const createTransport = (transport?: TransportType) => {\n if (transport === TransportType.XHR) {\n return new XHRTransport();\n }\n if (transport === TransportType.SendBeacon) {\n return new SendBeaconTransport();\n }\n return getDefaultConfig().transportProvider;\n};\n\nexport const getTopLevelDomain = async (url?: string) => {\n if (!(await new CookieStorage<string>().isEnabled()) || (!url && typeof location === 'undefined')) {\n return '';\n }\n\n const host = url ?? location.hostname;\n const parts = host.split('.');\n const levels = [];\n const storageKey = 'AMP_TLDTEST';\n\n for (let i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join('.'));\n }\n for (let i = 0; i < levels.length; i++) {\n const domain = levels[i];\n const options = { domain: '.' + domain };\n const storage = new CookieStorage<number>(options);\n await storage.set(storageKey, 1);\n const value = await storage.get(storageKey);\n if (value) {\n await storage.remove(storageKey);\n return '.' + domain;\n }\n }\n\n return '';\n};\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";AAAA,OAAO,EAML,aAAa,GAGd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,CAAC,IAAM,gBAAgB,GAAG;IAC9B,IAAM,aAAa,GAAG,IAAI,aAAa,EAAe,CAAC;IACvD,OAAO;QACL,gBAAgB,EAAE,GAAG;QACrB,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE,KAAK;QACnB,aAAa,eAAA;QACb,cAAc,EAAE,KAAK;QACrB,MAAM,EAAE,EAAE;QACV,cAAc,EAAE,IAAI,cAAc,CAAC,aAAa,EAAE,EAAE,CAAC;QACrD,cAAc,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI;QAC9B,eAAe,EAAE,IAAI,aAAa,EAAW;QAC7C,eAAe,EAAE;YACf,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,IAAI;YACb,kBAAkB,EAAE,IAAI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ingOptions,\n TransportType,\n UserSession,\n SessionManager as ISessionManager,\n} from '@amplitude/analytics-types';\nimport { Config, MemoryStorage, UUID } from '@amplitude/analytics-core';\n\nimport { CookieStorage } from './storage/cookie';\nimport { FetchTransport } from './transports/fetch';\nimport { LocalStorage } from './storage/local-storage';\nimport { getCookieName } from './utils/cookie-name';\nimport { getQueryParams } from './utils/query-params';\nimport { XHRTransport } from './transports/xhr';\nimport { SendBeaconTransport } from './transports/send-beacon';\nimport { SessionManager } from './session-manager';\n\nexport const getDefaultConfig = () => {\n const cookieStorage = new MemoryStorage<UserSession>();\n return {\n cookieExpiration: 365,\n cookieSameSite: 'Lax',\n cookieSecure: false,\n cookieStorage,\n disableCookies: false,\n domain: '',\n sessionManager: new SessionManager(cookieStorage, ''),\n sessionTimeout: 30 * 60 * 1000,\n storageProvider: new MemoryStorage<Event[]>(),\n trackingOptions: {\n city: true,\n country: true,\n carrier: true,\n deviceManufacturer: true,\n deviceModel: true,\n dma: true,\n ipAddress: true,\n language: true,\n osName: true,\n osVersion: true,\n platform: true,\n region: true,\n versionName: true,\n },\n transportProvider: new FetchTransport(),\n };\n};\n\nexport class BrowserConfig extends Config implements IBrowserConfig {\n appVersion?: string;\n cookieExpiration: number;\n cookieSameSite: string;\n cookieSecure: boolean;\n cookieStorage: Storage<UserSession>;\n disableCookies: boolean;\n domain: string;\n partnerId?: string;\n sessionTimeout: number;\n trackingOptions: TrackingOptions;\n sessionManager: ISessionManager;\n\n constructor(apiKey: string, userId?: string, options?: BrowserOptions) {\n const defaultConfig = getDefaultConfig();\n super({\n flushIntervalMillis: 1000,\n flushMaxRetries: 5,\n flushQueueSize: 30,\n ...options,\n apiKey,\n storageProvider: options?.storageProvider ?? defaultConfig.storageProvider,\n transportProvider: options?.transportProvider ?? defaultConfig.transportProvider,\n });\n this.cookieStorage = options?.cookieStorage ?? defaultConfig.cookieStorage;\n this.sessionManager = options?.sessionManager ?? defaultConfig.sessionManager;\n this.sessionTimeout = options?.sessionTimeout ?? defaultConfig.sessionTimeout;\n\n this.appVersion = options?.appVersion;\n this.cookieExpiration = options?.cookieExpiration ?? defaultConfig.cookieExpiration;\n this.cookieSameSite = options?.cookieSameSite ?? defaultConfig.cookieSameSite;\n this.cookieSecure = options?.cookieSecure ?? defaultConfig.cookieSecure;\n this.deviceId = options?.deviceId;\n this.disableCookies = options?.disableCookies ?? defaultConfig.disableCookies;\n this.domain = options?.domain ?? defaultConfig.domain;\n this.lastEventTime = this.lastEventTime ?? options?.lastEventTime;\n this.optOut = Boolean(options?.optOut);\n this.partnerId = options?.partnerId;\n this.sessionId = options?.sessionId;\n this.trackingOptions = options?.trackingOptions ?? defaultConfig.trackingOptions;\n this.userId = userId;\n }\n\n get deviceId() {\n return this.sessionManager.getDeviceId();\n }\n\n set deviceId(deviceId: string | undefined) {\n this.sessionManager.setDeviceId(deviceId);\n }\n\n get userId() {\n return this.sessionManager.getUserId();\n }\n\n set userId(userId: string | undefined) {\n this.sessionManager.setUserId(userId);\n }\n\n get sessionId() {\n return this.sessionManager.getSessionId();\n }\n\n set sessionId(sessionId: number | undefined) {\n this.sessionManager.setSessionId(sessionId);\n }\n\n get optOut() {\n return this.sessionManager.getOptOut();\n }\n\n set optOut(optOut: boolean) {\n this.sessionManager?.setOptOut(Boolean(optOut));\n }\n\n get lastEventTime() {\n return this.sessionManager.getLastEventTime();\n }\n\n set lastEventTime(lastEventTime: number | undefined) {\n this.sessionManager.setLastEventTime(lastEventTime);\n }\n}\n\nexport const useBrowserConfig = async (\n apiKey: string,\n userId?: string,\n options?: BrowserOptions,\n): Promise<IBrowserConfig> => {\n const defaultConfig = getDefaultConfig();\n const domain = options?.domain ?? (await getTopLevelDomain());\n const cookieStorage = await createCookieStorage({ ...options, domain });\n const cookieName = getCookieName(apiKey);\n const cookies = await cookieStorage.get(cookieName);\n const queryParams = getQueryParams();\n const sessionManager = await new SessionManager(cookieStorage, apiKey).load();\n\n return new BrowserConfig(apiKey, userId ?? cookies?.userId, {\n ...options,\n cookieStorage,\n sessionManager,\n deviceId: createDeviceId(cookies?.deviceId, options?.deviceId, queryParams.deviceId),\n domain,\n optOut: options?.optOut ?? Boolean(cookies?.optOut),\n sessionId: (await cookieStorage.get(cookieName))?.sessionId ?? options?.sessionId,\n storageProvider: await createEventsStorage(options),\n trackingOptions: { ...defaultConfig.trackingOptions, ...options?.trackingOptions },\n transportProvider: options?.transportProvider ?? createTransport(options?.transport),\n });\n};\n\nexport const createCookieStorage = async (\n overrides?: BrowserOptions,\n baseConfig = getDefaultConfig(),\n): Promise<Storage<UserSession>> => {\n const options = { ...baseConfig, ...overrides };\n const cookieStorage = overrides?.cookieStorage;\n if (!cookieStorage || !(await cookieStorage.isEnabled())) {\n return createFlexibleStorage<UserSession>(options);\n }\n return cookieStorage;\n};\n\nexport const createFlexibleStorage = async <T>(options: BrowserOptions): Promise<Storage<T>> => {\n let storage: Storage<T> = new CookieStorage({\n domain: options.domain,\n expirationDays: options.cookieExpiration,\n sameSite: options.cookieSameSite,\n secure: options.cookieSecure,\n });\n if (options.disableCookies || !(await storage.isEnabled())) {\n storage = new LocalStorage();\n if (!(await storage.isEnabled())) {\n storage = new MemoryStorage();\n }\n }\n return storage;\n};\n\nexport const createEventsStorage = async (overrides?: BrowserOptions): Promise<Storage<Event[]> | undefined> => {\n const hasStorageProviderProperty = overrides && Object.prototype.hasOwnProperty.call(overrides, 'storageProvider');\n // If storageProperty is explicitly undefined `{ storageProperty: undefined }`\n // then storageProvider is undefined\n // If storageProvider is implicitly undefined `{ }`\n // then storageProvider is LocalStorage\n // Otherwise storageProvider is overriden\n if (!hasStorageProviderProperty || overrides.storageProvider) {\n for (const storage of [overrides?.storageProvider, new LocalStorage<Event[]>()]) {\n if (storage && (await storage.isEnabled())) {\n return storage;\n }\n }\n }\n return undefined;\n};\n\nexport const createDeviceId = (idFromCookies?: string, idFromOptions?: string, idFromQueryParams?: string) => {\n return idFromOptions || idFromQueryParams || idFromCookies || UUID();\n};\n\nexport const createTransport = (transport?: TransportType) => {\n if (transport === TransportType.XHR) {\n return new XHRTransport();\n }\n if (transport === TransportType.SendBeacon) {\n return new SendBeaconTransport();\n }\n return getDefaultConfig().transportProvider;\n};\n\nexport const getTopLevelDomain = async (url?: string) => {\n if (!(await new CookieStorage<string>().isEnabled()) || (!url && typeof location === 'undefined')) {\n return '';\n }\n\n const host = url ?? location.hostname;\n const parts = host.split('.');\n const levels = [];\n const storageKey = 'AMP_TLDTEST';\n\n for (let i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join('.'));\n }\n for (let i = 0; i < levels.length; i++) {\n const domain = levels[i];\n const options = { domain: '.' + domain };\n const storage = new CookieStorage<number>(options);\n await storage.set(storageKey, 1);\n const value = await storage.get(storageKey);\n if (value) {\n await storage.remove(storageKey);\n return '.' + domain;\n }\n }\n\n return '';\n};\n"]}
|
package/lib/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.0.
|
|
1
|
+
export declare const VERSION = "1.0.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var VERSION = '1.0.
|
|
1
|
+
export var VERSION = '1.0.3';
|
|
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.0.
|
|
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.0.3';\n"]}
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},t(e,i)};function i(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n=function(){return n=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function r(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function u(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))}function o(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s}function a(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d,p,f={},v={};d=v,Object.defineProperty(d,"__esModule",{value:!0}),d.ServerZone=void 0,(p=d.ServerZone||(d.ServerZone={})).US="US",p.EU="EU";var h={};!function(e){var t,i,n;Object.defineProperty(e,"__esModule",{value:!0}),e.SpecialEventType=e.RevenueProperty=e.IdentifyOperation=void 0,(t=e.IdentifyOperation||(e.IdentifyOperation={})).SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll",(i=e.RevenueProperty||(e.RevenueProperty={})).REVENUE_PRODUCT_ID="$productId",i.REVENUE_QUANTITY="$quantity",i.REVENUE_PRICE="$price",i.REVENUE_TYPE="$revenueType",i.REVENUE="$revenue",(n=e.SpecialEventType||(e.SpecialEventType={})).IDENTIFY="$identify",n.GROUP_IDENTIFY="$groupidentify",n.REVENUE="revenue_amount"}(h);var g={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.LogLevel=void 0,(t=e.LogLevel||(e.LogLevel={}))[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Verbose=3]="Verbose"}(g);var b={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.PluginType=void 0,(t=e.PluginType||(e.PluginType={})).BEFORE="before",t.ENRICHMENT="enrichment",t.DESTINATION="destination"}(b);var y={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Status=void 0,(t=e.Status||(e.Status={})).Unknown="unknown",t.Skipped="skipped",t.Success="success",t.RateLimit="rate_limit",t.PayloadTooLarge="payload_too_large",t.Invalid="invalid",t.Failed="failed",t.Timeout="Timeout",t.SystemError="SystemError"}(y);var m={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.TransportType=void 0,(t=e.TransportType||(e.TransportType={})).XHR="xhr",t.SendBeacon="beacon",t.Fetch="fetch"}(m),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TransportType=e.Status=e.PluginType=e.LogLevel=e.RevenueProperty=e.IdentifyOperation=e.SpecialEventType=e.ServerZone=void 0;var t=v;Object.defineProperty(e,"ServerZone",{enumerable:!0,get:function(){return t.ServerZone}});var i=h;Object.defineProperty(e,"SpecialEventType",{enumerable:!0,get:function(){return i.SpecialEventType}}),Object.defineProperty(e,"IdentifyOperation",{enumerable:!0,get:function(){return i.IdentifyOperation}}),Object.defineProperty(e,"RevenueProperty",{enumerable:!0,get:function(){return i.RevenueProperty}});var n=g;Object.defineProperty(e,"LogLevel",{enumerable:!0,get:function(){return n.LogLevel}});var r=b;Object.defineProperty(e,"PluginType",{enumerable:!0,get:function(){return r.PluginType}});var o=y;Object.defineProperty(e,"Status",{enumerable:!0,get:function(){return o.Status}});var s=m;Object.defineProperty(e,"TransportType",{enumerable:!0,get:function(){return s.TransportType}})}(f);var w=e({__proto__:null,default:l(f)},[f]),S="AMP",_="".concat(S,"_unsent"),E="https://api2.amplitude.com/2/httpapi",I=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var i=e[t];if(!T(t,i))return!1}return!0},T=function(e,t){var i,n;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;if(Array.isArray(a))return!1;if("object"==typeof a)r=r&&I(a);else if(!["number","string"].includes(typeof a))return!1;if(!r)return!1}}catch(e){i={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}}else{if(null==t)return!1;if("object"==typeof t)return I(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},O=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return n({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(f.IdentifyOperation.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(f.IdentifyOperation.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(f.IdentifyOperation.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(f.IdentifyOperation.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(f.IdentifyOperation.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(f.IdentifyOperation.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(f.IdentifyOperation.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(f.IdentifyOperation.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(f.IdentifyOperation.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[f.IdentifyOperation.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,i){if(this._validate(e,t,i)){var n=this._properties[e];return void 0===n&&(n={},this._properties[e]=n),n[t]=i,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,i){return void 0===this._properties[f.IdentifyOperation.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===f.IdentifyOperation.ADD?"number"==typeof i:e===f.IdentifyOperation.UNSET||e===f.IdentifyOperation.REMOVE||T(t,i)))},e}(),k=function(e,t){return n(n({},t),{event_type:f.SpecialEventType.IDENTIFY,user_properties:e.getUserProperties()})},P=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=f.Status.Unknown),{event:e,code:t,message:i}},x=function(){function e(){this.queue=[],this.applying=!1,this.flushing=!1,this.plugins=[]}return e.prototype.register=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,e.setup(t)];case 1:return i.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e){return this.plugins.splice(this.plugins.findIndex((function(t){return t.name===e})),1),Promise.resolve()},e.prototype.push=function(e,t){var i=this;return new Promise((function(n){t.optOut?n(P(e,0,"Event skipped due to optOut config")):(i.queue.push([e,n]),i.scheduleApply(0))}))},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout((function(){t.apply(t.queue.shift()).then((function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)}))}),e))},e.prototype.apply=function(e){return r(this,void 0,void 0,(function(){var t,i,r,a,c,l,d,p,v,h,g,b,y,m,w,S,_,E;return o(this,(function(o){switch(o.label){case 0:if(!e)return[2];t=u(e,1),i=t[0],r=u(e,2),a=r[1],c=this.plugins.filter((function(e){return e.type===f.PluginType.BEFORE})),o.label=1;case 1:o.trys.push([1,6,7,8]),l=s(c),d=l.next(),o.label=2;case 2:return d.done?[3,5]:[4,d.value.execute(n({},i))];case 3:i=o.sent(),o.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return p=o.sent(),w={error:p},[3,8];case 7:try{d&&!d.done&&(S=l.return)&&S.call(l)}finally{if(w)throw w.error}return[7];case 8:v=this.plugins.filter((function(e){return e.type===f.PluginType.ENRICHMENT})),o.label=9;case 9:o.trys.push([9,14,15,16]),h=s(v),g=h.next(),o.label=10;case 10:return g.done?[3,13]:[4,g.value.execute(n({},i))];case 11:i=o.sent(),o.label=12;case 12:return g=h.next(),[3,10];case 13:return[3,16];case 14:return b=o.sent(),_={error:b},[3,16];case 15:try{g&&!g.done&&(E=h.return)&&E.call(h)}finally{if(_)throw _.error}return[7];case 16:return y=this.plugins.filter((function(e){return e.type===f.PluginType.DESTINATION})),m=y.map((function(e){var t=n({},i);return e.execute(t).catch((function(e){return P(t,0,String(e))}))})),Promise.all(m).then((function(e){var t=u(e,1)[0];a(t)})),[2]}}))}))},e.prototype.flush=function(){return r(this,void 0,void 0,(function(){var e,t,i,n=this;return o(this,(function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return n.apply(e)})))];case 1:return r.sent(),t=this.plugins.filter((function(e){return e.type===f.PluginType.DESTINATION})),i=t.map((function(e){return e.flush&&e.flush()})),[4,Promise.all(i)];case 2:return r.sent(),[2]}}))}))},e}(),R=function(){function e(e){void 0===e&&(e="$default"),this.logEvent=this.track.bind(this),this.name=e}return e.prototype.init=function(e,t,i){return this.config=i,this.timeline=new x,Promise.resolve()},e.prototype.track=function(e,t,i){var r=function(e,t,i){return n(n(n({},"string"==typeof e?{event_type:e}:e),i),t&&{event_properties:t})}(e,t,i);return this.dispatch(r)},e.prototype.identify=function(e,t){var i=k(e,t);return this.dispatch(i)},e.prototype.groupIdentify=function(e,t,i,r){var o=function(e,t,i,r){var o;return n(n({},r),{event_type:f.SpecialEventType.GROUP_IDENTIFY,group_properties:i.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,i,r);return this.dispatch(o)},e.prototype.setGroup=function(e,t){var i=function(e,t){var i,n=new O;return n.set(e,t),{event_type:f.SpecialEventType.IDENTIFY,user_properties:n.getUserProperties(),groups:(i={},i[e]=t,i)}}(e,t);return this.dispatch(i)},e.prototype.revenue=function(e,t){var i=function(e,t){return n(n({},t),{event_type:f.SpecialEventType.REVENUE,event_properties:e.getEventProperties()})}(e,t);return this.dispatch(i)},e.prototype.add=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){return t=this.config,[2,this.timeline.register(e,t)]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.timeline.deregister(e)]}))}))},e.prototype.dispatch=function(e){return r(this,void 0,void 0,(function(){var t,i,n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.timeline.push(e,this.config)];case 1:return 200===(t=r.sent()).code?this.config.loggerProvider.log(t.message):this.config.loggerProvider.error(t.message),[2,t];case 2:return i=r.sent(),n=String(i),this.config.loggerProvider.error(n),[2,P(e,0,n)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.config.optOut=Boolean(e)},e.prototype.flush=function(){return this.timeline.flush()},e}(),N=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return I(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?n({},this.properties):{};return e[f.RevenueProperty.REVENUE_PRODUCT_ID]=this.productId,e[f.RevenueProperty.REVENUE_QUANTITY]=this.quantity,e[f.RevenueProperty.REVENUE_PRICE]=this.price,e[f.RevenueProperty.REVENUE_TYPE]=this.revenueType,e[f.RevenueProperty.REVENUE]=this.revenue,e},e}(),U="Amplitude Logger ",C=function(){function e(){this.logLevel=f.LogLevel.None}return e.prototype.disable=function(){this.logLevel=f.LogLevel.None},e.prototype.enable=function(e){void 0===e&&(e=f.LogLevel.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.LogLevel.Verbose||console.log("".concat(U,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.LogLevel.Warn||console.warn("".concat(U,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.LogLevel.Error||console.error("".concat(U,"[Error]: ").concat(e.join(" ")))},e}(),L=function(){return{flushMaxRetries:5,flushQueueSize:10,flushIntervalMillis:1e3,logLevel:f.LogLevel.Warn,loggerProvider:new C,saveEvents:!0,optOut:!1,serverUrl:E,serverZone:f.ServerZone.US,useBatch:!1}},D=function(){function e(e){var t,i,n,r;this._optOut=!1;var o=L();this.apiKey=e.apiKey,this.flushIntervalMillis=e.flushIntervalMillis||o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(t=e.logLevel)&&void 0!==t?t:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.optOut=null!==(i=e.optOut)&&void 0!==i?i:o.optOut,this.saveEvents=null!==(n=e.saveEvents)&&void 0!==n?n:o.saveEvents,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(r=e.useBatch)&&void 0!==r?r:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=q(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),j=function(e,t){return e===f.ServerZone.EU?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":E},q=function(e,t,i){if(void 0===e&&(e=""),void 0===t&&(t=L().serverZone),void 0===i&&(i=L().useBatch),e)return{serverUrl:e,serverZone:void 0};var n=[f.ServerZone.US,f.ServerZone.EU].includes(t)?t:L().serverZone;return{serverZone:n,serverUrl:j(n,i)}},M=function(){function e(){this.name="amplitude",this.type=f.PluginType.DESTINATION,this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=!1,this.queue=[]}return e.prototype.setup=function(e){return r(this,void 0,void 0,(function(){var t,i=this;return o(this,(function(n){switch(n.label){case 0:return this.config=e,this.storageKey="".concat(_,"_").concat(this.config.apiKey.substring(0,10)),[4,this.config.storageProvider.get(this.storageKey)];case 1:return t=n.sent(),this.saveEvents(),t&&t.length>0&&Promise.all(t.map((function(e){return i.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return new Promise((function(i){var n={event:e,attempts:0,callback:function(e){return i(e)},timeout:0};t.addToQueue(n)}))},e.prototype.addToQueue=function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var n=t.filter((function(t){return t.attempts<e.config.flushMaxRetries?(t.attempts+=1,!0):(e.fulfillRequest([t],500,f.Status.Unknown),!1)}));n.forEach((function(t){e.queue=e.queue.concat(t),0!==t.timeout?setTimeout((function(){t.timeout=0,e.schedule(0)}),t.timeout):e.schedule(e.config.flushIntervalMillis)})),this.saveEvents()},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=!0,setTimeout((function(){t.flush(!0).then((function(){t.scheduled=!1,t.queue.length>0&&t.schedule(e)}))}),e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),r(this,void 0,void 0,(function(){var t,i,n,r=this;return o(this,(function(o){switch(o.label){case 0:return t=[],i=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):i.push(e)})),this.queue=i,s=t,u=this.config.flushQueueSize,a=Math.max(u,1),n=s.reduce((function(e,t,i){var n=Math.floor(i/a);return e[n]||(e[n]=[]),e[n].push(t),e}),[]),[4,Promise.all(n.map((function(t){return r.send(t,e)})))];case 1:return o.sent(),[2]}var s,u,a}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),r(this,void 0,void 0,(function(){var i,n,r,s;return o(this,(function(o){switch(o.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];i={api_key:this.config.apiKey,events:e.map((function(e){return e.event})),options:{min_id_length:this.config.minIdLength}},o.label=1;case 1:return o.trys.push([1,3,,4]),n=q(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(n,i)];case 2:return null===(r=o.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleReponse(r,e),[3,4]):(this.fulfillRequest(e,r.statusCode,r.status),[2]);case 3:return s=o.sent(),this.fulfillRequest(e,0,String(s)),[3,4];case 4:return[2]}}))}))},e.prototype.handleReponse=function(e,t){switch(e.status){case f.Status.Success:this.handleSuccessResponse(e,t);break;case f.Status.Invalid:this.handleInvalidResponse(e,t);break;case f.Status.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case f.Status.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.handleOtherReponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var i=this;if(e.body.missingField)this.fulfillRequest(t,e.statusCode,e.body.error);else{var n=a(a(a(a([],u(Object.values(e.body.eventsWithInvalidFields)),!1),u(Object.values(e.body.eventsWithMissingFields)),!1),u(Object.values(e.body.eventsWithInvalidIdLengths)),!1),u(e.body.silencedEvents),!1).flat(),r=new Set(n),o=t.filter((function(t,n){if(!r.has(n))return!0;i.fulfillRequest([t],e.statusCode,e.body.error)}));this.addToQueue.apply(this,a([],u(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(this.config.flushQueueSize/=2,this.addToQueue.apply(this,a([],u(t),!1))):this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var i=this,n=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(n),c=new Set(r),l=new Set(o),d=t.filter((function(t,n){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&c.has(t.event.device_id)))return l.has(n)&&(t.timeout=i.throttleTimeout),!0;i.fulfillRequest([t],e.statusCode,e.body.error)}));this.addToQueue.apply(this,a([],u(d),!1))},e.prototype.handleOtherReponse=function(e){var t=this;this.addToQueue.apply(this,a([],u(e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e}))),!1))},e.prototype.fulfillRequest=function(e,t,i){this.saveEvents(),e.forEach((function(e){return e.callback(P(e.event,t,i))}))},e.prototype.saveEvents=function(){if(this.config.saveEvents){var e=Array.from(this.queue.map((function(e){return e.event})));this.config.storageProvider.set(this.storageKey,e)}},e}(),A=function(e){return function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return{promise:e.apply(void 0,a([],u(t),!1))}}},V=function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,V)},B=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){switch(i.label){case 0:return[4,this.get(e)];case 1:return[2,(t=i.sent())?JSON.stringify(t):void 0]}}))}))},e.prototype.set=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(i){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),z=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,i,n,r,o,s,u,a,c,l,d,p,v,h,g,b,y,m,w,S,_,E;if("object"!=typeof e)return null;var I=e.code||0,T=this.buildStatus(I);switch(T){case f.Status.Success:return{status:T,statusCode:I,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(i=e.payload_size_bytes)&&void 0!==i?i:0,serverUploadTime:null!==(n=e.server_upload_time)&&void 0!==n?n:0}};case f.Status.Invalid:return{status:T,statusCode:I,body:{error:null!==(r=e.error)&&void 0!==r?r:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(p=e.silenced_events)&&void 0!==p?p:[],throttledDevices:null!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(h=e.throttled_events)&&void 0!==h?h:[]}};case f.Status.PayloadTooLarge:return{status:T,statusCode:I,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case f.Status.RateLimit:return{status:T,statusCode:I,body:{error:null!==(b=e.error)&&void 0!==b?b:"",epsThreshold:null!==(y=e.eps_threshold)&&void 0!==y?y:0,throttledDevices:null!==(m=e.throttled_devices)&&void 0!==m?m:{},throttledUsers:null!==(w=e.throttled_users)&&void 0!==w?w:{},exceededDailyQuotaDevices:null!==(S=e.exceeded_daily_quota_devices)&&void 0!==S?S:{},exceededDailyQuotaUsers:null!==(_=e.exceeded_daily_quota_users)&&void 0!==_?_:{},throttledEvents:null!==(E=e.throttled_events)&&void 0!==E?E:[]}};case f.Status.Timeout:default:return{status:T,statusCode:I}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?f.Status.Success:429===e?f.Status.RateLimit:413===e?f.Status.PayloadTooLarge:408===e?f.Status.Timeout:e>=400&&e<500?f.Status.Invalid:e>=500?f.Status.Failed:f.Status.Unknown},e}(),F=function(e,t){Z(e,t)},Z=function(e,t){for(var i=0;i<t.length;i++){var n=t[i],r=n.name,o=n.args,s=n.resolve,u=e&&e[r];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},$=function(e){return e&&void 0!==e._q},Q={exports:{}};!function(e,t){!function(i,n){var r="function",o="undefined",s="object",u="string",a="model",c="name",l="type",d="vendor",p="version",f="architecture",v="console",h="mobile",g="tablet",b="smarttv",y="wearable",m="embedded",w="Amazon",S="Apple",_="ASUS",E="BlackBerry",I="Firefox",T="Google",O="Huawei",k="LG",P="Microsoft",x="Motorola",R="Opera",N="Samsung",U="Sony",C="Xiaomi",L="Zebra",D="Facebook",j=function(e){for(var t={},i=0;i<e.length;i++)t[e[i].toUpperCase()]=e[i];return t},q=function(e,t){return typeof e===u&&-1!==M(t).indexOf(M(e))},M=function(e){return e.toLowerCase()},A=function(e,t){if(typeof e===u)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof t===o?e:e.substring(0,275)},V=function(e,t){for(var i,o,u,a,c,l,d=0;d<t.length&&!c;){var p=t[d],f=t[d+1];for(i=o=0;i<p.length&&!c;)if(c=p[i++].exec(e))for(u=0;u<f.length;u++)l=c[++o],typeof(a=f[u])===s&&a.length>0?2===a.length?typeof a[1]==r?this[a[0]]=a[1].call(this,l):this[a[0]]=a[1]:3===a.length?typeof a[1]!==r||a[1].exec&&a[1].test?this[a[0]]=l?l.replace(a[1],a[2]):n:this[a[0]]=l?a[1].call(this,l,a[2]):n:4===a.length&&(this[a[0]]=l?a[3].call(this,l.replace(a[1],a[2])):n):this[a]=l||n;d+=2}},B=function(e,t){for(var i in t)if(typeof t[i]===s&&t[i].length>0){for(var r=0;r<t[i].length;r++)if(q(t[i][r],e))return"?"===i?n:i}else if(q(t[i],e))return"?"===i?n:i;return e},z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},F={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,p],[/opios[\/ ]+([\w\.]+)/i],[p,[c,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[p,[c,R]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[c,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[c,"UCBrowser"]],[/\bqbcore\/([\w\.]+)/i],[p,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[c,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure Browser"],p],[/\bfocus\/([\w\.]+)/i],[p,[c,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[p,[c,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[c,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[c,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[p,[c,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[c,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 Browser"],p],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[c,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,D],p],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[c,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[c,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[c,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,"Chrome WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[c,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,p],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[p,[c,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[p,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[p,B,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[c,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[c,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[c,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,M]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",M]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,M]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[a,[d,N],[l,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[a,[d,N],[l,h]],[/((ipod|iphone)\d+,\d+)/i],[a,[d,S],[l,h]],[/(ipad\d+,\d+)/i],[a,[d,S],[l,g]],[/\((ip(?:hone|od)[\w ]*);/i],[a,[d,S],[l,h]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[a,[d,S],[l,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[a,[d,O],[l,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[a,[d,O],[l,h]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[a,/_/g," "],[d,C],[l,h]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[a,/_/g," "],[d,C],[l,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[a,[d,"OPPO"],[l,h]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[a,[d,"Vivo"],[l,h]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[a,[d,"Realme"],[l,h]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[a,[d,x],[l,h]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[a,[d,x],[l,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[a,[d,k],[l,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[a,[d,k],[l,h]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[a,[d,"Lenovo"],[l,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[a,/_/g," "],[d,"Nokia"],[l,h]],[/(pixel c)\b/i],[a,[d,T],[l,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[a,[d,T],[l,h]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[a,[d,U],[l,h]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[a,"Xperia Tablet"],[d,U],[l,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[a,[d,"OnePlus"],[l,h]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[a,[d,w],[l,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[a,/(.+)/g,"Fire Phone $1"],[d,w],[l,h]],[/(playbook);[-\w\),; ]+(rim)/i],[a,d,[l,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[a,[d,E],[l,h]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[a,[d,_],[l,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[a,[d,_],[l,h]],[/(nexus 9)/i],[a,[d,"HTC"],[l,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[a,/_/g," "],[l,h]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[a,[d,"Acer"],[l,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[a,[d,"Meizu"],[l,h]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[a,[d,"Sharp"],[l,h]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,a,[l,h]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,a,[l,g]],[/(surface duo)/i],[a,[d,P],[l,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[a,[d,"Fairphone"],[l,h]],[/(u304aa)/i],[a,[d,"AT&T"],[l,h]],[/\bsie-(\w*)/i],[a,[d,"Siemens"],[l,h]],[/\b(rct\w+) b/i],[a,[d,"RCA"],[l,g]],[/\b(venue[\d ]{2,7}) b/i],[a,[d,"Dell"],[l,g]],[/\b(q(?:mv|ta)\w+) b/i],[a,[d,"Verizon"],[l,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[a,[d,"Barnes & Noble"],[l,g]],[/\b(tm\d{3}\w+) b/i],[a,[d,"NuVision"],[l,g]],[/\b(k88) b/i],[a,[d,"ZTE"],[l,g]],[/\b(nx\d{3}j) b/i],[a,[d,"ZTE"],[l,h]],[/\b(gen\d{3}) b.+49h/i],[a,[d,"Swiss"],[l,h]],[/\b(zur\d{3}) b/i],[a,[d,"Swiss"],[l,g]],[/\b((zeki)?tb.*\b) b/i],[a,[d,"Zeki"],[l,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],a,[l,g]],[/\b(ns-?\w{0,9}) b/i],[a,[d,"Insignia"],[l,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[a,[d,"NextBook"],[l,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],a,[l,h]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],a,[l,h]],[/\b(ph-1) /i],[a,[d,"Essential"],[l,h]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[a,[d,"Envizen"],[l,g]],[/\b(trio[-\w\. ]+) b/i],[a,[d,"MachSpeed"],[l,g]],[/\btu_(1491) b/i],[a,[d,"Rotor"],[l,g]],[/(shield[\w ]+) b/i],[a,[d,"Nvidia"],[l,g]],[/(sprint) (\w+)/i],[d,a,[l,h]],[/(kin\.[onetw]{3})/i],[[a,/\./g," "],[d,P],[l,h]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[a,[d,L],[l,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[a,[d,L],[l,h]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,a,[l,v]],[/droid.+; (shield) bui/i],[a,[d,"Nvidia"],[l,v]],[/(playstation [345portablevi]+)/i],[a,[d,U],[l,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[a,[d,P],[l,v]],[/smart-tv.+(samsung)/i],[d,[l,b]],[/hbbtv.+maple;(\d+)/i],[[a,/^/,"SmartTV"],[d,N],[l,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,k],[l,b]],[/(apple) ?tv/i],[d,[a,"Apple TV"],[l,b]],[/crkey/i],[[a,"Chromecast"],[d,T],[l,b]],[/droid.+aft(\w)( bui|\))/i],[a,[d,w],[l,b]],[/\(dtv[\);].+(aquos)/i],[a,[d,"Sharp"],[l,b]],[/(bravia[\w- ]+) bui/i],[a,[d,U],[l,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,A],[a,A],[l,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,b]],[/((pebble))app/i],[d,a,[l,y]],[/droid.+; (glass) \d/i],[a,[d,T],[l,y]],[/droid.+; (wt63?0{2,3})\)/i],[a,[d,L],[l,y]],[/(quest( 2)?)/i],[a,[d,D],[l,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[a,[l,h]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[a,[l,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,g]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[l,h]],[/(android[-\w\. ]{0,9});.+buil/i],[a,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[c,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[c,[p,B,z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,"Windows"],[p,B,z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,"Mac OS"],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[p,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,p],[/\(bb(10);/i],[p,[c,E]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[c,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[c,"webOS"]],[/crkey\/([\d\.]+)/i],[p,[c,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[c,"Chromium OS"],p],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[c,p],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[c,p]]},Z=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof Z))return new Z(e,t).getResult();var r=e||(typeof i!==o&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),a=t?function(e,t){var i={};for(var n in e)t[n]&&t[n].length%2==0?i[n]=t[n].concat(e[n]):i[n]=e[n];return i}(F,t):F;return this.getBrowser=function(){var e,t={};return t.name=n,t.version=n,V.call(t,r,a.browser),t.major=typeof(e=t.version)===u?e.replace(/[^\d\.]/g,"").split(".")[0]:n,t},this.getCPU=function(){var e={};return e.architecture=n,V.call(e,r,a.cpu),e},this.getDevice=function(){var e={};return e.vendor=n,e.model=n,e.type=n,V.call(e,r,a.device),e},this.getEngine=function(){var e={};return e.name=n,e.version=n,V.call(e,r,a.engine),e},this.getOS=function(){var e={};return e.name=n,e.version=n,V.call(e,r,a.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=typeof e===u&&e.length>275?A(e,275):e,this},this.setUA(r),this};Z.VERSION="0.7.31",Z.BROWSER=j([c,p,"major"]),Z.CPU=j([f]),Z.DEVICE=j([a,d,l,v,h,b,g,y,m]),Z.ENGINE=Z.OS=j([c,p]),e.exports&&(t=e.exports=Z),t.UAParser=Z;var $=typeof i!==o&&(i.jQuery||i.Zepto);if($&&!$.ua){var Q=new Z;$.ua=Q.getResult(),$.ua.get=function(){return Q.getUA()},$.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var i in t)$.ua[i]=t[i]}}}("object"==typeof window?window:c)}(Q,Q.exports);var K=Q.exports,W=function(){var e,t,i,n;if("undefined"==typeof navigator)return"";var r=navigator.userLanguage;return null!==(n=null!==(i=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==i?i:r)&&void 0!==n?n:""},H=function(){function e(){var e;this.name="context",this.type=f.PluginType.BEFORE,this.eventId=0,this.library="amplitude-ts/".concat("1.0.2"),"undefined"!=typeof navigator&&(e=navigator.userAgent),this.uaResult=new K(e).getResult()}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){return r(this,void 0,void 0,(function(){var t,i,r,s,u;return o(this,(function(o){return this.isSessionValid()||(this.config.sessionId=Date.now()),this.config.lastEventTime=Date.now(),t=(new Date).getTime(),i=this.uaResult.browser.name,r=this.uaResult.browser.version,s=this.uaResult.device.model||this.uaResult.os.name,u=this.uaResult.device.vendor,[2,n(n(n(n(n(n(n(n(n(n(n({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:t},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.osName&&{os_name:i}),this.config.trackingOptions.osVersion&&{os_version:r}),this.config.trackingOptions.deviceManufacturer&&{device_manufacturer:u}),this.config.trackingOptions.deviceModel&&{device_model:s}),this.config.trackingOptions.language&&{language:W()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:V(),partner_id:this.config.partnerId,plan:this.config.plan}),e),{event_id:this.eventId++,library:this.library})]}))}))},e.prototype.isSessionValid=function(){var e=this.config.lastEventTime||Date.now();return Date.now()-e<this.config.sessionTimeout},e}(),G=function(){function e(e){this.options=n({},e)}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,i,n;return o(this,(function(r){switch(r.label){case 0:if("undefined"==typeof window)return[2,!1];t=String(Date.now()),i=new e,n="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,i.set(n,t)];case 2:return r.sent(),[4,i.get(n)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,i.remove(n)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){switch(i.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=i.sent()))return[2,void 0];try{try{t=decodeURIComponent(atob(t))}catch(e){}return[2,JSON.parse(t)]}catch(e){return[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){return r(this,void 0,void 0,(function(){var t,i;return o(this,(function(n){return t=window.document.cookie.split("; "),(i=t.find((function(t){return 0===t.indexOf(e+"=")})))?[2,i.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var i;return r(this,void 0,void 0,(function(){var n,r,s,u,a;return o(this,(function(o){try{n=null!==(i=this.options.expirationDays)&&void 0!==i?i:0,s=void 0,(r=null!==t?n:-1)&&((u=new Date).setTime(u.getTime()+24*r*60*60*1e3),s=u),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),s&&(a+="; expires=".concat(s.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),window.document.cookie=a}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}}))}))},e.prototype.reset=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2]}))}))},e}(),Y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var i,n;return o(this,(function(r){switch(r.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return i={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,i)];case 1:return[4,r.sent().json()];case 2:return n=r.sent(),[2,this.buildResponse(n)]}}))}))},t}(z),J=function(){function e(){}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,i,n;return o(this,(function(r){switch(r.label){case 0:if("undefined"==typeof window)return[2,!1];t=String(Date.now()),i=new e,n="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,i.set(n,t)];case 2:return r.sent(),[4,i.get(n)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,i.remove(n)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=i.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return i.sent(),[2,void 0];case 3:return[2]}}))}))},e.prototype.getRaw=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,window.localStorage.getItem(e)||void 0]}))}))},e.prototype.set=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(i){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){try{window.localStorage.removeItem(e)}catch(e){}return[2]}))}))},e.prototype.reset=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){try{window.localStorage.clear()}catch(e){}return[2]}))}))},e}(),X=function(e,t,i){return void 0===t&&(t=""),void 0===i&&(i=10),[S,t,e.substring(0,i)].filter(Boolean).join("_")},ee=function(){return"undefined"==typeof window?{}:window.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var i=u(t.split("=",2),2),n=i[0],r=i[1],o=void 0===r?"":r;return o?(e[decodeURIComponent(n)]=decodeURIComponent(o),e):e}),{})},te=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return i(t,e),t.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var i=this;return o(this,(function(n){return[2,new Promise((function(n,r){"undefined"==typeof XMLHttpRequest&&r(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===i.state.done)try{var e=o.responseText,t=JSON.parse(e),s=i.buildResponse(t);n(s)}catch(e){r(e)}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},t}(z),ie=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var i=this;return o(this,(function(n){return[2,new Promise((function(n,r){if("undefined"==typeof window||void 0===window.navigator||void 0===window.navigator.sendBeacon)throw new Error("SendBeaconTransport is not supported");try{var o=JSON.stringify(t);return n(window.navigator.sendBeacon(e,JSON.stringify(t))?i.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:o.length,server_upload_time:Date.now()}):i.buildResponse({code:500}))}catch(e){r(e)}}))]}))}))},t}(z),ne=function(){function e(e,t){this.storage=e,this.isSessionCacheValid=!0,this.storageKey=X(t),this.cache={optOut:!1}}return e.prototype.load=function(){var e;return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){switch(i.label){case 0:return t=this,[4,this.storage.get(this.storageKey)];case 1:return t.cache=null!==(e=i.sent())&&void 0!==e?e:{optOut:!1},[2,this]}}))}))},e.prototype.setSession=function(e){this.cache=n(n({},this.cache),e),this.storage.set(this.storageKey,this.cache)},e.prototype.getSessionId=function(){var e=this;return this.isSessionCacheValid=!0,this.storage.get(this.storageKey).then((function(t){e.isSessionCacheValid&&(e.cache.sessionId=null==t?void 0:t.sessionId)})),this.cache.sessionId},e.prototype.setSessionId=function(e){this.isSessionCacheValid=!1,this.setSession({sessionId:e})},e.prototype.getDeviceId=function(){return this.cache.deviceId},e.prototype.setDeviceId=function(e){this.setSession({deviceId:e})},e.prototype.getUserId=function(){return this.cache.userId},e.prototype.setUserId=function(e){this.setSession({userId:e})},e.prototype.getLastEventTime=function(){return this.cache.lastEventTime},e.prototype.setLastEventTime=function(e){this.setSession({lastEventTime:e})},e.prototype.getOptOut=function(){return this.cache.optOut},e.prototype.setOptOut=function(e){this.setSession({optOut:e})},e}(),re=function(){var e=new B;return{cookieExpiration:365,cookieSameSite:"Lax",cookieSecure:!1,cookieStorage:e,disableCookies:!1,domain:"",sessionManager:new ne(e,""),sessionTimeout:18e5,storageProvider:new B,trackingOptions:{city:!0,country:!0,carrier:!0,deviceManufacturer:!0,deviceModel:!0,dma:!0,ipAddress:!0,language:!0,osName:!0,osVersion:!0,platform:!0,region:!0,versionName:!0},transportProvider:new Y}},oe=function(e){function t(t,i,r){var o,s,u,a,c,l,d,p,f,v,h,g,b=this,y=re();return(b=e.call(this,n(n({},r),{apiKey:t,storageProvider:null!==(o=null==r?void 0:r.storageProvider)&&void 0!==o?o:y.storageProvider,transportProvider:null!==(s=null==r?void 0:r.transportProvider)&&void 0!==s?s:y.transportProvider}))||this).cookieStorage=null!==(u=null==r?void 0:r.cookieStorage)&&void 0!==u?u:y.cookieStorage,b.sessionManager=null!==(a=null==r?void 0:r.sessionManager)&&void 0!==a?a:y.sessionManager,b.sessionTimeout=null!==(c=null==r?void 0:r.sessionTimeout)&&void 0!==c?c:y.sessionTimeout,b.appVersion=null==r?void 0:r.appVersion,b.cookieExpiration=null!==(l=null==r?void 0:r.cookieExpiration)&&void 0!==l?l:y.cookieExpiration,b.cookieSameSite=null!==(d=null==r?void 0:r.cookieSameSite)&&void 0!==d?d:y.cookieSameSite,b.cookieSecure=null!==(p=null==r?void 0:r.cookieSecure)&&void 0!==p?p:y.cookieSecure,b.deviceId=null==r?void 0:r.deviceId,b.disableCookies=null!==(f=null==r?void 0:r.disableCookies)&&void 0!==f?f:y.disableCookies,b.domain=null!==(v=null==r?void 0:r.domain)&&void 0!==v?v:y.domain,b.lastEventTime=null!==(h=b.lastEventTime)&&void 0!==h?h:null==r?void 0:r.lastEventTime,b.optOut=Boolean(null==r?void 0:r.optOut),b.partnerId=null==r?void 0:r.partnerId,b.sessionId=null==r?void 0:r.sessionId,b.trackingOptions=null!==(g=null==r?void 0:r.trackingOptions)&&void 0!==g?g:y.trackingOptions,b.userId=i,b}return i(t,e),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this.sessionManager.getDeviceId()},set:function(e){this.sessionManager.setDeviceId(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this.sessionManager.getUserId()},set:function(e){this.sessionManager.setUserId(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this.sessionManager.getSessionId()},set:function(e){this.sessionManager.setSessionId(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this.sessionManager.getOptOut()},set:function(e){var t;null===(t=this.sessionManager)||void 0===t||t.setOptOut(Boolean(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this.sessionManager.getLastEventTime()},set:function(e){this.sessionManager.setLastEventTime(e)},enumerable:!1,configurable:!0}),t}(D),se=function(e,t,i){return r(void 0,void 0,void 0,(function(){var r,s,u,a,c,l,d,p,f,v,h,g,b,y,m,w,S;return o(this,(function(o){switch(o.label){case 0:return r=re(),null===(b=null==i?void 0:i.domain)||void 0===b?[3,1]:(u=b,[3,3]);case 1:return[4,pe()];case 2:u=o.sent(),o.label=3;case 3:return s=u,[4,ue(n(n({},i),{domain:s}))];case 4:return a=o.sent(),c=X(e),[4,a.get(c)];case 5:return l=o.sent(),d=ee(),[4,new ne(a,e).load()];case 6:return p=o.sent(),f=oe.bind,v=[void 0,e,null!=t?t:null==l?void 0:l.userId],h=[n({},i)],g={cookieStorage:a,sessionManager:p,deviceId:le(null==l?void 0:l.deviceId,null==i?void 0:i.deviceId,d.deviceId),domain:s,optOut:null!==(y=null==i?void 0:i.optOut)&&void 0!==y?y:Boolean(null==l?void 0:l.optOut)},[4,a.get(c)];case 7:return g.sessionId=null!==(w=null===(m=o.sent())||void 0===m?void 0:m.sessionId)&&void 0!==w?w:null==i?void 0:i.sessionId,[4,ce(i)];case 8:return[2,new(f.apply(oe,v.concat([n.apply(void 0,h.concat([(g.storageProvider=o.sent(),g.trackingOptions=n(n({},r.trackingOptions),null==i?void 0:i.trackingOptions),g.transportProvider=null!==(S=null==i?void 0:i.transportProvider)&&void 0!==S?S:de(null==i?void 0:i.transport),g)]))])))]}}))}))},ue=function(e,t){return void 0===t&&(t=re()),r(void 0,void 0,void 0,(function(){var i,r,s;return o(this,(function(o){switch(o.label){case 0:return i=n(n({},t),e),r=null==e?void 0:e.cookieStorage,(s=!r)?[3,2]:[4,r.isEnabled()];case 1:s=!o.sent(),o.label=2;case 2:return s?[2,ae(i)]:[2,r]}}))}))},ae=function(e){return r(void 0,void 0,void 0,(function(){var t,i;return o(this,(function(n){switch(n.label){case 0:return t=new G({domain:e.domain,expirationDays:e.cookieExpiration,sameSite:e.cookieSameSite,secure:e.cookieSecure}),(i=e.disableCookies)?[3,2]:[4,t.isEnabled()];case 1:i=!n.sent(),n.label=2;case 2:return i?[4,(t=new J).isEnabled()]:[3,4];case 3:n.sent()||(t=new B),n.label=4;case 4:return[2,t]}}))}))},ce=function(e){return r(void 0,void 0,void 0,(function(){var t,i;return o(this,(function(n){switch(n.label){case 0:return t=null==e?void 0:e.storageProvider,(i=!t)?[3,2]:[4,t.isEnabled()];case 1:i=!n.sent(),n.label=2;case 2:return i?[4,(t=new J).isEnabled()]:[3,4];case 3:n.sent()||(t=new B),n.label=4;case 4:return[2,t]}}))}))},le=function(e,t,i){return t||i||e||V()},de=function(e){return e===f.TransportType.XHR?new te:e===f.TransportType.SendBeacon?new ie:re().transportProvider},pe=function(e){return r(void 0,void 0,void 0,(function(){var t,i,n,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:return[4,(new G).isEnabled()];case 1:if(!o.sent()||!e&&"undefined"==typeof location)return[2,""];for(t=null!=e?e:location.hostname,i=t.split("."),n=[],r="AMP_TLDTEST",s=i.length-2;s>=0;--s)n.push(i.slice(s).join("."));s=0,o.label=2;case 2:return s<n.length?(u=n[s],[4,(a=new G({domain:"."+u})).set(r,1)]):[3,7];case 3:return o.sent(),[4,a.get(r)];case 4:return o.sent()?[4,a.remove(r)]:[3,6];case 5:return o.sent(),[2,"."+u];case 6:return s++,[3,2];case 7:return[2,""]}}))}))},fe=function(e,t){return r(void 0,void 0,void 0,(function(){var i,n,r,s,a,c,l,d,p;return o(this,(function(o){switch(o.label){case 0:return[4,(i=new G).isEnabled()];case 1:return o.sent()&&!(null==t?void 0:t.disableCookies)||(i=new J),[4,i.isEnabled()];case 2:return o.sent()?(n=function(e){return"".concat(S.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,i.getRaw(n)]):[2,{optOut:!1}];case 3:return(r=o.sent())?[4,i.remove(n)]:[2,{optOut:!1}];case 4:return o.sent(),s=u(r.split("."),5),a=s[0],c=s[1],l=s[2],d=s[3],p=s[4],[2,{deviceId:a,userId:he(c),sessionId:ve(d),lastEventTime:ve(p),optOut:Boolean(l)}]}}))}))},ve=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},he=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},ge=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=i.sent())?[2,t.split(".").splice(-1)[0].split("|").reduce((function(e,t){var i=u(t.split("=",2),2),n=i[0],r=i[1],o=void 0===r?"":r;return o?(e[n]=decodeURIComponent(o),e):e}),{})]:[2,void 0];case 2:return i.sent(),[2,void 0];case 3:return[2]}}))}))},t.prototype.set=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,void 0]}))}))},t}(G),be={utm_source:void 0,utm_medium:void 0,utm_campaign:void 0,utm_term:void 0,utm_content:void 0,referrer:void 0,referring_domain:void 0,gclid:void 0,fbclid:void 0},ye=function(){function e(){this.utmCookieStorage=new ge}return e.prototype.parse=function(){return r(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=[n({},be)],[4,this.getUtmParam()];case 1:return[2,n.apply(void 0,[n.apply(void 0,[n.apply(void 0,e.concat([t.sent()])),this.getReferrer()]),this.getClickIds()])]}}))}))},e.prototype.getUtmParam=function(){return r(this,void 0,void 0,(function(){var e,t,i,n,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:return e=ee(),[4,this.utmCookieStorage.isEnabled()];case 1:return(i=o.sent())?[4,this.utmCookieStorage.get("__utmz")]:[3,3];case 2:i=o.sent(),o.label=3;case 3:return t=i||{},n=e.utm_source||t.utmcsr,r=e.utm_medium||t.utmcmd,s=e.utm_campaign||t.utmccn,u=e.utm_term||t.utmctr,a=e.utm_content||t.utmcct,[2,{utm_source:n,utm_medium:r,utm_campaign:s,utm_term:u,utm_content:a}]}}))}))},e.prototype.getReferrer=function(){var e,t,i={referrer:void 0,referring_domain:void 0};try{i.referrer=document.referrer||void 0,i.referring_domain=null!==(t=null===(e=i.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return i},e.prototype.getClickIds=function(){var e,t=ee();return(e={}).gclid=t.gclid,e.fbclid=t.fbclid,e},e}(),me=function(){function e(e,t){var i,n;this.storage=t.storage,this.storageKey=X(e,"MKTG"),this.parser=new ye,this.track=t.track,this.onNewCampaign=t.onNewCampaign,this.disabled=Boolean(t.disabled),this.trackNewCampaigns=Boolean(t.trackNewCampaigns),this.trackPageViews=Boolean(t.trackPageViews),this.excludeReferrers=null!==(i=t.excludeReferrers)&&void 0!==i?i:[],"undefined"!=typeof location&&this.excludeReferrers.unshift(location.hostname),this.initialEmptyValue=null!==(n=t.initialEmptyValue)&&void 0!==n?n:"EMPTY"}return e.prototype.isNewCampaign=function(e,t){var i=Boolean(e.referring_domain&&this.excludeReferrers.includes(e.referring_domain)),n=t.utm_campaign!==e.utm_campaign||t.utm_source!==e.utm_source||t.utm_medium!==e.utm_medium||t.utm_term!==e.utm_term||t.utm_content!==e.utm_content,r=t.referring_domain!==e.referring_domain;return!i&&(n||r)},e.prototype.saveCampaignToStorage=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.storage.set(this.storageKey,e)];case 1:return t.sent(),[2]}}))}))},e.prototype.getCampaignFromStorage=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.storage.get(this.storageKey)];case 1:return[2,e.sent()||n({},be)]}}))}))},e.prototype.createCampaignEvent=function(e){var t=this,i=n(n({},be),e),r=Object.entries(i).reduce((function(e,i){var n=u(i,2),r=n[0],o=n[1];return e.setOnce("initial_".concat(r),o||t.initialEmptyValue),o?e.set(r,o):e.unset(r)}),new O),o={event_type:"Page View",event_properties:{page_title:"undefined"!=typeof document&&document.title||"",page_location:"undefined"!=typeof location&&location.href||"",page_path:"undefined"!=typeof location&&location.pathname||""}};return n(n({},k(r)),this.trackPageViews&&o)},e.prototype.send=function(e){return r(this,void 0,void 0,(function(){var t,i;return o(this,(function(n){switch(n.label){case 0:return this.disabled?[2]:[4,this.parser.parse()];case 1:return t=n.sent(),[4,this.getCampaignFromStorage()];case 2:if(i=n.sent(),!e){if(!this.trackNewCampaigns||!this.isNewCampaign(t,i))return[2];this.onNewCampaign(t)}return[4,this.track(this.createCampaignEvent(t))];case 3:return n.sent(),[4,this.saveCampaignToStorage(t)];case 4:return n.sent(),[2]}}))}))},e}(),we=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.init=function(t,i,s){var u,a,c;return r(this,void 0,void 0,(function(){var r,l,d;return o(this,(function(o){switch(o.label){case 0:return[4,fe(t,s)];case 1:return r=o.sent(),[4,se(t,i||r.userId,n(n({},s),{deviceId:null!==(u=r.deviceId)&&void 0!==u?u:null==s?void 0:s.deviceId,sessionId:null!==(a=r.sessionId)&&void 0!==a?a:null==s?void 0:s.sessionId,optOut:null!==(c=null==s?void 0:s.optOut)&&void 0!==c?c:r.optOut,lastEventTime:r.lastEventTime}))];case 2:return l=o.sent(),[4,e.prototype.init.call(this,void 0,void 0,l)];case 3:return o.sent(),d=!1,(!this.config.sessionId||this.config.lastEventTime&&Date.now()-this.config.lastEventTime>this.config.sessionTimeout)&&(this.config.sessionId=Date.now(),d=!0),[4,this.add(new H)];case 4:return o.sent(),[4,this.add(new M)];case 5:return o.sent(),[4,this.runAttributionStrategy(null==s?void 0:s.attribution,d)];case 6:return o.sent(),[2]}}))}))},t.prototype.runAttributionStrategy=function(e,t){return void 0===t&&(t=!1),r(this,void 0,void 0,(function(){var i,r,s;return o(this,(function(o){switch(o.label){case 0:return i=this.track.bind(this),r=this.setSessionId.bind(this,Date.now()),[4,ae(this.config)];case 1:return s=o.sent(),[4,new me(this.config.apiKey,n(n({},e),{storage:s,track:i,onNewCampaign:r})).send(t)];case 2:return o.sent(),[2]}}))}))},t.prototype.getUserId=function(){return this.config.userId},t.prototype.setUserId=function(e){this.config.userId=e},t.prototype.getDeviceId=function(){return this.config.deviceId},t.prototype.setDeviceId=function(e){this.config.deviceId=e},t.prototype.regenerateDeviceId=function(){var e=le();this.setDeviceId(e)},t.prototype.getSessionId=function(){return this.config.sessionId},t.prototype.setSessionId=function(e){this.config.sessionId=e},t.prototype.setOptOut=function(e){this.config.optOut=e},t.prototype.setTransport=function(e){this.config.transportProvider=de(e)},t.prototype.identify=function(t,i){if($(t)){var n=t._q;t._q=[],t=Z(new O,n)}return e.prototype.identify.call(this,t,i)},t.prototype.groupIdentify=function(t,i,n,r){if($(n)){var o=n._q;n._q=[],n=Z(new O,o)}return e.prototype.groupIdentify.call(this,t,i,n,r)},t.prototype.revenue=function(t,i){if($(t)){var n=t._q;t._q=[],t=Z(new N,n)}return e.prototype.revenue.call(this,t,i)},t}(R),Se=new we,_e=A(Se.init.bind(Se)),Ee=A(Se.add.bind(Se)),Ie=A(Se.remove.bind(Se)),Te=A(Se.track.bind(Se)),Oe=A(Se.logEvent.bind(Se)),ke=A(Se.identify.bind(Se)),Pe=A(Se.groupIdentify.bind(Se)),xe=A(Se.setGroup.bind(Se)),Re=A(Se.revenue.bind(Se)),Ne=Se.getUserId.bind(Se),Ue=Se.setUserId.bind(Se),Ce=Se.getDeviceId.bind(Se),Le=Se.setDeviceId.bind(Se);Se.regenerateDeviceId.bind(Se);var De=Se.getSessionId.bind(Se),je=Se.setSessionId.bind(Se),qe=Se.setOptOut.bind(Se),Me=Se.setTransport.bind(Se),Ae=A(Se.flush.bind(Se)),Ve=Object.freeze({__proto__:null,Types:w,add:Ee,flush:Ae,getDeviceId:Ce,getSessionId:De,getUserId:Ne,groupIdentify:Pe,identify:ke,init:_e,logEvent:Oe,remove:Ie,revenue:Re,setDeviceId:Le,setGroup:xe,setOptOut:qe,setSessionId:je,setTransport:Me,setUserId:Ue,track:Te,runQueuedFunctions:F,Revenue:N,Identify:O});if(globalThis.amplitude=Object.assign(globalThis.amplitude||{},Ve),globalThis.amplitude.invoked){var Be=globalThis.amplitude._q;globalThis.amplitude._q=[],F(Ve,Be)}}();
|
|
15
|
+
***************************************************************************** */var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},t(e,i)};function i(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n=function(){return n=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function r(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{a(n.next(e))}catch(e){o(e)}}function u(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,u)}a((n=n.apply(e,t||[])).next())}))}function o(e,t){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return s}function a(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d,p,f={},h={};d=h,Object.defineProperty(d,"__esModule",{value:!0}),d.ServerZone=void 0,(p=d.ServerZone||(d.ServerZone={})).US="US",p.EU="EU";var v={};!function(e){var t,i,n;Object.defineProperty(e,"__esModule",{value:!0}),e.SpecialEventType=e.RevenueProperty=e.IdentifyOperation=void 0,(t=e.IdentifyOperation||(e.IdentifyOperation={})).SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll",(i=e.RevenueProperty||(e.RevenueProperty={})).REVENUE_PRODUCT_ID="$productId",i.REVENUE_QUANTITY="$quantity",i.REVENUE_PRICE="$price",i.REVENUE_TYPE="$revenueType",i.REVENUE="$revenue",(n=e.SpecialEventType||(e.SpecialEventType={})).IDENTIFY="$identify",n.GROUP_IDENTIFY="$groupidentify",n.REVENUE="revenue_amount"}(v);var g={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.LogLevel=void 0,(t=e.LogLevel||(e.LogLevel={}))[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Verbose=3]="Verbose"}(g);var y={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.PluginType=void 0,(t=e.PluginType||(e.PluginType={})).BEFORE="before",t.ENRICHMENT="enrichment",t.DESTINATION="destination"}(y);var b={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Status=void 0,(t=e.Status||(e.Status={})).Unknown="unknown",t.Skipped="skipped",t.Success="success",t.RateLimit="rate_limit",t.PayloadTooLarge="payload_too_large",t.Invalid="invalid",t.Failed="failed",t.Timeout="Timeout",t.SystemError="SystemError"}(b);var m={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.TransportType=void 0,(t=e.TransportType||(e.TransportType={})).XHR="xhr",t.SendBeacon="beacon",t.Fetch="fetch"}(m),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TransportType=e.Status=e.PluginType=e.LogLevel=e.RevenueProperty=e.IdentifyOperation=e.SpecialEventType=e.ServerZone=void 0;var t=h;Object.defineProperty(e,"ServerZone",{enumerable:!0,get:function(){return t.ServerZone}});var i=v;Object.defineProperty(e,"SpecialEventType",{enumerable:!0,get:function(){return i.SpecialEventType}}),Object.defineProperty(e,"IdentifyOperation",{enumerable:!0,get:function(){return i.IdentifyOperation}}),Object.defineProperty(e,"RevenueProperty",{enumerable:!0,get:function(){return i.RevenueProperty}});var n=g;Object.defineProperty(e,"LogLevel",{enumerable:!0,get:function(){return n.LogLevel}});var r=y;Object.defineProperty(e,"PluginType",{enumerable:!0,get:function(){return r.PluginType}});var o=b;Object.defineProperty(e,"Status",{enumerable:!0,get:function(){return o.Status}});var s=m;Object.defineProperty(e,"TransportType",{enumerable:!0,get:function(){return s.TransportType}})}(f);var w=e({__proto__:null,default:l(f)},[f]),_="AMP",S="".concat(_,"_unsent"),E="https://api2.amplitude.com/2/httpapi",I=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var i=e[t];if(!T(t,i))return!1}return!0},T=function(e,t){var i,n;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;if(Array.isArray(a))return!1;if("object"==typeof a)r=r&&I(a);else if(!["number","string"].includes(typeof a))return!1;if(!r)return!1}}catch(e){i={error:e}}finally{try{u&&!u.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}}else{if(null==t)return!1;if("object"==typeof t)return I(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},O=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return n({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(f.IdentifyOperation.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(f.IdentifyOperation.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(f.IdentifyOperation.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(f.IdentifyOperation.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(f.IdentifyOperation.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(f.IdentifyOperation.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(f.IdentifyOperation.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(f.IdentifyOperation.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(f.IdentifyOperation.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[f.IdentifyOperation.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,i){if(this._validate(e,t,i)){var n=this._properties[e];return void 0===n&&(n={},this._properties[e]=n),n[t]=i,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,i){return void 0===this._properties[f.IdentifyOperation.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===f.IdentifyOperation.ADD?"number"==typeof i:e===f.IdentifyOperation.UNSET||e===f.IdentifyOperation.REMOVE||T(t,i)))},e}(),k=function(e,t){return n(n({},t),{event_type:f.SpecialEventType.IDENTIFY,user_properties:e.getUserProperties()})},P=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=f.Status.Unknown),{event:e,code:t,message:i}},x=function(){function e(){this.queue=[],this.applying=!1,this.isReady=!1,this.plugins=[]}return e.prototype.register=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(i){switch(i.label){case 0:return[4,e.setup(t)];case 1:return i.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e){return this.plugins.splice(this.plugins.findIndex((function(t){return t.name===e})),1),Promise.resolve()},e.prototype.reset=function(){this.applying=!1,this.isReady=!1,this.plugins=[]},e.prototype.push=function(e){var t=this;return new Promise((function(i){t.queue.push([e,i]),t.scheduleApply(0)}))},e.prototype.scheduleApply=function(e){var t=this;this.applying&&this.isReady||(this.applying=!0,setTimeout((function(){t.apply(t.queue.shift()).then((function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)}))}),e))},e.prototype.apply=function(e){return r(this,void 0,void 0,(function(){var t,i,r,a,c,l,d,p,h,v,g,y,b,m,w,_,S,E;return o(this,(function(o){switch(o.label){case 0:if(!e)return[2];t=u(e,1),i=t[0],r=u(e,2),a=r[1],c=this.plugins.filter((function(e){return e.type===f.PluginType.BEFORE})),o.label=1;case 1:o.trys.push([1,6,7,8]),l=s(c),d=l.next(),o.label=2;case 2:return d.done?[3,5]:[4,d.value.execute(n({},i))];case 3:i=o.sent(),o.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return p=o.sent(),w={error:p},[3,8];case 7:try{d&&!d.done&&(_=l.return)&&_.call(l)}finally{if(w)throw w.error}return[7];case 8:h=this.plugins.filter((function(e){return e.type===f.PluginType.ENRICHMENT})),o.label=9;case 9:o.trys.push([9,14,15,16]),v=s(h),g=v.next(),o.label=10;case 10:return g.done?[3,13]:[4,g.value.execute(n({},i))];case 11:i=o.sent(),o.label=12;case 12:return g=v.next(),[3,10];case 13:return[3,16];case 14:return y=o.sent(),S={error:y},[3,16];case 15:try{g&&!g.done&&(E=v.return)&&E.call(v)}finally{if(S)throw S.error}return[7];case 16:return b=this.plugins.filter((function(e){return e.type===f.PluginType.DESTINATION})),m=b.map((function(e){var t=n({},i);return e.execute(t).catch((function(e){return P(t,0,String(e))}))})),Promise.all(m).then((function(e){var t=u(e,1)[0];a(t)})),[2]}}))}))},e.prototype.flush=function(){return r(this,void 0,void 0,(function(){var e,t,i,n=this;return o(this,(function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return n.apply(e)})))];case 1:return r.sent(),t=this.plugins.filter((function(e){return e.type===f.PluginType.DESTINATION})),i=t.map((function(e){return e.flush&&e.flush()})),[4,Promise.all(i)];case 2:return r.sent(),[2]}}))}))},e}(),R="Event rejected due to exceeded retry count",N=function(){function e(e){void 0===e&&(e="$default"),this.logEvent=this.track.bind(this),this.timeline=new x,this.name=e}return e.prototype._init=function(e){return this.config=e,this.timeline.reset(),Promise.resolve()},e.prototype.track=function(e,t,i){var r=function(e,t,i){return n(n(n({},"string"==typeof e?{event_type:e}:e),i),t&&{event_properties:t})}(e,t,i);return this.dispatch(r)},e.prototype.identify=function(e,t){var i=k(e,t);return this.dispatch(i)},e.prototype.groupIdentify=function(e,t,i,r){var o=function(e,t,i,r){var o;return n(n({},r),{event_type:f.SpecialEventType.GROUP_IDENTIFY,group_properties:i.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,i,r);return this.dispatch(o)},e.prototype.setGroup=function(e,t){var i=function(e,t){var i,n=new O;return n.set(e,t),{event_type:f.SpecialEventType.IDENTIFY,user_properties:n.getUserProperties(),groups:(i={},i[e]=t,i)}}(e,t);return this.dispatch(i)},e.prototype.revenue=function(e,t){var i=function(e,t){return n(n({},t),{event_type:f.SpecialEventType.REVENUE,event_properties:e.getEventProperties()})}(e,t);return this.dispatch(i)},e.prototype.add=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){return t=this.config,[2,this.timeline.register(e,t)]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.timeline.deregister(e)]}))}))},e.prototype.dispatch=function(e){var t;return r(this,void 0,void 0,(function(){var i,n,r;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),(null===(t=this.config)||void 0===t?void 0:t.optOut)?[2,P(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(i=o.sent()).code?this.config.loggerProvider.log(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return n=o.sent(),r=String(n),this.config.loggerProvider.error(r),[2,P(e,0,r)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.config.optOut=Boolean(e)},e.prototype.flush=function(){return this.timeline.flush()},e}(),U=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return I(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?n({},this.properties):{};return e[f.RevenueProperty.REVENUE_PRODUCT_ID]=this.productId,e[f.RevenueProperty.REVENUE_QUANTITY]=this.quantity,e[f.RevenueProperty.REVENUE_PRICE]=this.price,e[f.RevenueProperty.REVENUE_TYPE]=this.revenueType,e[f.RevenueProperty.REVENUE]=this.revenue,e},e}(),C="Amplitude Logger ",L=function(){function e(){this.logLevel=f.LogLevel.None}return e.prototype.disable=function(){this.logLevel=f.LogLevel.None},e.prototype.enable=function(e){void 0===e&&(e=f.LogLevel.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.LogLevel.Verbose||console.log("".concat(C,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.LogLevel.Warn||console.warn("".concat(C,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<f.LogLevel.Error||console.error("".concat(C,"[Error]: ").concat(e.join(" ")))},e}(),D=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,logLevel:f.LogLevel.Warn,loggerProvider:new L,optOut:!1,serverUrl:E,serverZone:f.ServerZone.US,useBatch:!1}},j=function(){function e(e){var t,i,n;this._optOut=!1;var r=D();this.apiKey=e.apiKey,this.flushIntervalMillis=e.flushIntervalMillis||r.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||r.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||r.flushQueueSize,this.loggerProvider=e.loggerProvider||r.loggerProvider,this.logLevel=null!==(t=e.logLevel)&&void 0!==t?t:r.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.optOut=null!==(i=e.optOut)&&void 0!==i?i:r.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||r.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(n=e.useBatch)&&void 0!==n?n:r.useBatch,this.loggerProvider.enable(this.logLevel);var o=q(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=o.serverZone,this.serverUrl=o.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),M=function(e,t){return e===f.ServerZone.EU?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":E},q=function(e,t,i){if(void 0===e&&(e=""),void 0===t&&(t=D().serverZone),void 0===i&&(i=D().useBatch),e)return{serverUrl:e,serverZone:void 0};var n=[f.ServerZone.US,f.ServerZone.EU].includes(t)?t:D().serverZone;return{serverZone:n,serverUrl:M(n,i)}},A=function(){function e(){this.name="amplitude",this.type=f.PluginType.DESTINATION,this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=!1,this.queue=[]}return e.prototype.setup=function(e){var t;return r(this,void 0,void 0,(function(){var i,n=this;return o(this,(function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(S,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return i=r.sent(),this.saveEvents(),i&&i.length>0&&Promise.all(i.map((function(e){return n.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return new Promise((function(i){var n={event:e,attempts:0,callback:function(e){return i(e)},timeout:0};t.addToQueue(n)}))},e.prototype.addToQueue=function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var n=t.filter((function(t){return t.attempts<e.config.flushMaxRetries?(t.attempts+=1,!0):(e.fulfillRequest([t],500,R),!1)}));n.forEach((function(t){e.queue=e.queue.concat(t),0!==t.timeout?setTimeout((function(){t.timeout=0,e.schedule(0)}),t.timeout):e.schedule(e.config.flushIntervalMillis)})),this.saveEvents()},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=!0,setTimeout((function(){t.flush(!0).then((function(){t.scheduled=!1,t.queue.length>0&&t.schedule(e)}))}),e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),r(this,void 0,void 0,(function(){var t,i,n,r=this;return o(this,(function(o){switch(o.label){case 0:return t=[],i=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):i.push(e)})),this.queue=i,s=t,u=this.config.flushQueueSize,a=Math.max(u,1),n=s.reduce((function(e,t,i){var n=Math.floor(i/a);return e[n]||(e[n]=[]),e[n].push(t),e}),[]),[4,Promise.all(n.map((function(t){return r.send(t,e)})))];case 1:return o.sent(),[2]}var s,u,a}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),r(this,void 0,void 0,(function(){var i,n,r,s;return o(this,(function(o){switch(o.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];i={api_key:this.config.apiKey,events:e.map((function(e){return e.event})),options:{min_id_length:this.config.minIdLength}},o.label=1;case 1:return o.trys.push([1,3,,4]),n=q(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(n,i)];case 2:return null===(r=o.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleReponse(r,e),[3,4]):(this.fulfillRequest(e,r.statusCode,r.status),[2]);case 3:return s=o.sent(),this.fulfillRequest(e,0,String(s)),[3,4];case 4:return[2]}}))}))},e.prototype.handleReponse=function(e,t){switch(e.status){case f.Status.Success:this.handleSuccessResponse(e,t);break;case f.Status.Invalid:this.handleInvalidResponse(e,t);break;case f.Status.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case f.Status.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.handleOtherReponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var i=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var n=a(a(a(a([],u(Object.values(e.body.eventsWithInvalidFields)),!1),u(Object.values(e.body.eventsWithMissingFields)),!1),u(Object.values(e.body.eventsWithInvalidIdLengths)),!1),u(e.body.silencedEvents),!1).flat(),r=new Set(n),o=t.filter((function(t,n){if(!r.has(n))return!0;i.fulfillRequest([t],e.statusCode,e.body.error)}));this.addToQueue.apply(this,a([],u(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(this.config.flushQueueSize/=2,this.addToQueue.apply(this,a([],u(t),!1))):this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var i=this,n=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(n),c=new Set(r),l=new Set(o),d=t.filter((function(t,n){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&c.has(t.event.device_id)))return l.has(n)&&(t.timeout=i.throttleTimeout),!0;i.fulfillRequest([t],e.statusCode,e.body.error)}));this.addToQueue.apply(this,a([],u(d),!1))},e.prototype.handleOtherReponse=function(e){var t=this;this.addToQueue.apply(this,a([],u(e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e}))),!1))},e.prototype.fulfillRequest=function(e,t,i){this.saveEvents(),e.forEach((function(e){return e.callback(P(e.event,t,i))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map((function(e){return e.event})));this.config.storageProvider.set(this.storageKey,e)}},e}(),V=function(e){return function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return{promise:e.apply(void 0,a([],u(t),!1))}}},B=function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,B)},z=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){switch(i.label){case 0:return[4,this.get(e)];case 1:return[2,(t=i.sent())?JSON.stringify(t):void 0]}}))}))},e.prototype.set=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(i){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),F=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,i,n,r,o,s,u,a,c,l,d,p,h,v,g,y,b,m,w,_,S,E;if("object"!=typeof e)return null;var I=e.code||0,T=this.buildStatus(I);switch(T){case f.Status.Success:return{status:T,statusCode:I,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(i=e.payload_size_bytes)&&void 0!==i?i:0,serverUploadTime:null!==(n=e.server_upload_time)&&void 0!==n?n:0}};case f.Status.Invalid:return{status:T,statusCode:I,body:{error:null!==(r=e.error)&&void 0!==r?r:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(p=e.silenced_events)&&void 0!==p?p:[],throttledDevices:null!==(h=e.throttled_devices)&&void 0!==h?h:{},throttledEvents:null!==(v=e.throttled_events)&&void 0!==v?v:[]}};case f.Status.PayloadTooLarge:return{status:T,statusCode:I,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case f.Status.RateLimit:return{status:T,statusCode:I,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(b=e.eps_threshold)&&void 0!==b?b:0,throttledDevices:null!==(m=e.throttled_devices)&&void 0!==m?m:{},throttledUsers:null!==(w=e.throttled_users)&&void 0!==w?w:{},exceededDailyQuotaDevices:null!==(_=e.exceeded_daily_quota_devices)&&void 0!==_?_:{},exceededDailyQuotaUsers:null!==(S=e.exceeded_daily_quota_users)&&void 0!==S?S:{},throttledEvents:null!==(E=e.throttled_events)&&void 0!==E?E:[]}};case f.Status.Timeout:default:return{status:T,statusCode:I}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?f.Status.Success:429===e?f.Status.RateLimit:413===e?f.Status.PayloadTooLarge:408===e?f.Status.Timeout:e>=400&&e<500?f.Status.Invalid:e>=500?f.Status.Failed:f.Status.Unknown},e}(),Z=function(e,t){$(e,t)},$=function(e,t){for(var i=0;i<t.length;i++){var n=t[i],r=n.name,o=n.args,s=n.resolve,u=e&&e[r];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},Q=function(e){return e&&void 0!==e._q},K={exports:{}};!function(e,t){!function(i,n){var r="function",o="undefined",s="object",u="string",a="model",c="name",l="type",d="vendor",p="version",f="architecture",h="console",v="mobile",g="tablet",y="smarttv",b="wearable",m="embedded",w="Amazon",_="Apple",S="ASUS",E="BlackBerry",I="Firefox",T="Google",O="Huawei",k="LG",P="Microsoft",x="Motorola",R="Opera",N="Samsung",U="Sony",C="Xiaomi",L="Zebra",D="Facebook",j=function(e){for(var t={},i=0;i<e.length;i++)t[e[i].toUpperCase()]=e[i];return t},M=function(e,t){return typeof e===u&&-1!==q(t).indexOf(q(e))},q=function(e){return e.toLowerCase()},A=function(e,t){if(typeof e===u)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof t===o?e:e.substring(0,275)},V=function(e,t){for(var i,o,u,a,c,l,d=0;d<t.length&&!c;){var p=t[d],f=t[d+1];for(i=o=0;i<p.length&&!c;)if(c=p[i++].exec(e))for(u=0;u<f.length;u++)l=c[++o],typeof(a=f[u])===s&&a.length>0?2===a.length?typeof a[1]==r?this[a[0]]=a[1].call(this,l):this[a[0]]=a[1]:3===a.length?typeof a[1]!==r||a[1].exec&&a[1].test?this[a[0]]=l?l.replace(a[1],a[2]):n:this[a[0]]=l?a[1].call(this,l,a[2]):n:4===a.length&&(this[a[0]]=l?a[3].call(this,l.replace(a[1],a[2])):n):this[a]=l||n;d+=2}},B=function(e,t){for(var i in t)if(typeof t[i]===s&&t[i].length>0){for(var r=0;r<t[i].length;r++)if(M(t[i][r],e))return"?"===i?n:i}else if(M(t[i],e))return"?"===i?n:i;return e},z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},F={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[c,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[c,p],[/opios[\/ ]+([\w\.]+)/i],[p,[c,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[p,[c,R]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[c,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[c,"UCBrowser"]],[/\bqbcore\/([\w\.]+)/i],[p,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[c,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[c,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure Browser"],p],[/\bfocus\/([\w\.]+)/i],[p,[c,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[p,[c,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[c,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[c,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[p,[c,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[c,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 Browser"],p],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[c,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[c],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[c,D],p],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[c,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[c,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[c,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[c,"Chrome WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[c,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[c,p],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[p,[c,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[p,c],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[c,[p,B,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[c,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[c,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[c,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[c,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,q]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",q]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,q]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[a,[d,N],[l,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[a,[d,N],[l,v]],[/((ipod|iphone)\d+,\d+)/i],[a,[d,_],[l,v]],[/(ipad\d+,\d+)/i],[a,[d,_],[l,g]],[/\((ip(?:hone|od)[\w ]*);/i],[a,[d,_],[l,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[a,[d,_],[l,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[a,[d,O],[l,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[a,[d,O],[l,v]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[a,/_/g," "],[d,C],[l,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[a,/_/g," "],[d,C],[l,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[a,[d,"OPPO"],[l,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[a,[d,"Vivo"],[l,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[a,[d,"Realme"],[l,v]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[a,[d,x],[l,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[a,[d,x],[l,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[a,[d,k],[l,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[a,[d,k],[l,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[a,[d,"Lenovo"],[l,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[a,/_/g," "],[d,"Nokia"],[l,v]],[/(pixel c)\b/i],[a,[d,T],[l,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[a,[d,T],[l,v]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[a,[d,U],[l,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[a,"Xperia Tablet"],[d,U],[l,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[a,[d,"OnePlus"],[l,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[a,[d,w],[l,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[a,/(.+)/g,"Fire Phone $1"],[d,w],[l,v]],[/(playbook);[-\w\),; ]+(rim)/i],[a,d,[l,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[a,[d,E],[l,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[a,[d,S],[l,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[a,[d,S],[l,v]],[/(nexus 9)/i],[a,[d,"HTC"],[l,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[d,[a,/_/g," "],[l,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[a,[d,"Acer"],[l,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[a,[d,"Meizu"],[l,v]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[a,[d,"Sharp"],[l,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[d,a,[l,v]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[d,a,[l,g]],[/(surface duo)/i],[a,[d,P],[l,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[a,[d,"Fairphone"],[l,v]],[/(u304aa)/i],[a,[d,"AT&T"],[l,v]],[/\bsie-(\w*)/i],[a,[d,"Siemens"],[l,v]],[/\b(rct\w+) b/i],[a,[d,"RCA"],[l,g]],[/\b(venue[\d ]{2,7}) b/i],[a,[d,"Dell"],[l,g]],[/\b(q(?:mv|ta)\w+) b/i],[a,[d,"Verizon"],[l,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[a,[d,"Barnes & Noble"],[l,g]],[/\b(tm\d{3}\w+) b/i],[a,[d,"NuVision"],[l,g]],[/\b(k88) b/i],[a,[d,"ZTE"],[l,g]],[/\b(nx\d{3}j) b/i],[a,[d,"ZTE"],[l,v]],[/\b(gen\d{3}) b.+49h/i],[a,[d,"Swiss"],[l,v]],[/\b(zur\d{3}) b/i],[a,[d,"Swiss"],[l,g]],[/\b((zeki)?tb.*\b) b/i],[a,[d,"Zeki"],[l,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[d,"Dragon Touch"],a,[l,g]],[/\b(ns-?\w{0,9}) b/i],[a,[d,"Insignia"],[l,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[a,[d,"NextBook"],[l,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[d,"Voice"],a,[l,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[d,"LvTel"],a,[l,v]],[/\b(ph-1) /i],[a,[d,"Essential"],[l,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[a,[d,"Envizen"],[l,g]],[/\b(trio[-\w\. ]+) b/i],[a,[d,"MachSpeed"],[l,g]],[/\btu_(1491) b/i],[a,[d,"Rotor"],[l,g]],[/(shield[\w ]+) b/i],[a,[d,"Nvidia"],[l,g]],[/(sprint) (\w+)/i],[d,a,[l,v]],[/(kin\.[onetw]{3})/i],[[a,/\./g," "],[d,P],[l,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[a,[d,L],[l,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[a,[d,L],[l,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[d,a,[l,h]],[/droid.+; (shield) bui/i],[a,[d,"Nvidia"],[l,h]],[/(playstation [345portablevi]+)/i],[a,[d,U],[l,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[a,[d,P],[l,h]],[/smart-tv.+(samsung)/i],[d,[l,y]],[/hbbtv.+maple;(\d+)/i],[[a,/^/,"SmartTV"],[d,N],[l,y]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[d,k],[l,y]],[/(apple) ?tv/i],[d,[a,"Apple TV"],[l,y]],[/crkey/i],[[a,"Chromecast"],[d,T],[l,y]],[/droid.+aft(\w)( bui|\))/i],[a,[d,w],[l,y]],[/\(dtv[\);].+(aquos)/i],[a,[d,"Sharp"],[l,y]],[/(bravia[\w- ]+) bui/i],[a,[d,U],[l,y]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[d,A],[a,A],[l,y]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,y]],[/((pebble))app/i],[d,a,[l,b]],[/droid.+; (glass) \d/i],[a,[d,T],[l,b]],[/droid.+; (wt63?0{2,3})\)/i],[a,[d,L],[l,b]],[/(quest( 2)?)/i],[a,[d,D],[l,b]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[d,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[a,[l,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[a,[l,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,g]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[l,v]],[/(android[-\w\. ]{0,9});.+buil/i],[a,[d,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[c,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,c]],os:[[/microsoft (windows) (vista|xp)/i],[c,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[c,[p,B,z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,"Windows"],[p,B,z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[c,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[c,"Mac OS"],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[p,c],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[c,p],[/\(bb(10);/i],[p,[c,E]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[c,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[c,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[c,"webOS"]],[/crkey\/([\d\.]+)/i],[p,[c,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[c,"Chromium OS"],p],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[c,p],[/(sunos) ?([\w\.\d]*)/i],[[c,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[c,p]]},Z=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof Z))return new Z(e,t).getResult();var r=e||(typeof i!==o&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),a=t?function(e,t){var i={};for(var n in e)t[n]&&t[n].length%2==0?i[n]=t[n].concat(e[n]):i[n]=e[n];return i}(F,t):F;return this.getBrowser=function(){var e,t={};return t.name=n,t.version=n,V.call(t,r,a.browser),t.major=typeof(e=t.version)===u?e.replace(/[^\d\.]/g,"").split(".")[0]:n,t},this.getCPU=function(){var e={};return e.architecture=n,V.call(e,r,a.cpu),e},this.getDevice=function(){var e={};return e.vendor=n,e.model=n,e.type=n,V.call(e,r,a.device),e},this.getEngine=function(){var e={};return e.name=n,e.version=n,V.call(e,r,a.engine),e},this.getOS=function(){var e={};return e.name=n,e.version=n,V.call(e,r,a.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return r},this.setUA=function(e){return r=typeof e===u&&e.length>275?A(e,275):e,this},this.setUA(r),this};Z.VERSION="0.7.31",Z.BROWSER=j([c,p,"major"]),Z.CPU=j([f]),Z.DEVICE=j([a,d,l,h,v,y,g,b,m]),Z.ENGINE=Z.OS=j([c,p]),e.exports&&(t=e.exports=Z),t.UAParser=Z;var $=typeof i!==o&&(i.jQuery||i.Zepto);if($&&!$.ua){var Q=new Z;$.ua=Q.getResult(),$.ua.get=function(){return Q.getUA()},$.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var i in t)$.ua[i]=t[i]}}}("object"==typeof window?window:c)}(K,K.exports);var W=K.exports,H=function(){var e,t,i,n;if("undefined"==typeof navigator)return"";var r=navigator.userLanguage;return null!==(n=null!==(i=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==i?i:r)&&void 0!==n?n:""},G=function(){function e(){var e;this.name="context",this.type=f.PluginType.BEFORE,this.eventId=0,this.library="amplitude-ts/".concat("1.0.3"),"undefined"!=typeof navigator&&(e=navigator.userAgent),this.uaResult=new W(e).getResult()}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){return r(this,void 0,void 0,(function(){var t,i,r,s,u;return o(this,(function(o){return this.isSessionValid()||(this.config.sessionId=Date.now()),this.config.lastEventTime=Date.now(),t=(new Date).getTime(),i=this.uaResult.browser.name,r=this.uaResult.browser.version,s=this.uaResult.device.model||this.uaResult.os.name,u=this.uaResult.device.vendor,[2,n(n(n(n(n(n(n(n(n(n(n({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:t},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.osName&&{os_name:i}),this.config.trackingOptions.osVersion&&{os_version:r}),this.config.trackingOptions.deviceManufacturer&&{device_manufacturer:u}),this.config.trackingOptions.deviceModel&&{device_model:s}),this.config.trackingOptions.language&&{language:H()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:B(),partner_id:this.config.partnerId,plan:this.config.plan}),e),{event_id:this.eventId++,library:this.library})]}))}))},e.prototype.isSessionValid=function(){var e=this.config.lastEventTime||Date.now();return Date.now()-e<this.config.sessionTimeout},e}(),Y=function(){function e(e){this.options=n({},e)}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,i,n;return o(this,(function(r){switch(r.label){case 0:if("undefined"==typeof window)return[2,!1];t=String(Date.now()),i=new e,n="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,i.set(n,t)];case 2:return r.sent(),[4,i.get(n)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,i.remove(n)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){switch(i.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=i.sent()))return[2,void 0];try{try{t=decodeURIComponent(atob(t))}catch(e){}return[2,JSON.parse(t)]}catch(e){return[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){return r(this,void 0,void 0,(function(){var t,i;return o(this,(function(n){return t=window.document.cookie.split("; "),(i=t.find((function(t){return 0===t.indexOf(e+"=")})))?[2,i.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var i;return r(this,void 0,void 0,(function(){var n,r,s,u,a;return o(this,(function(o){try{n=null!==(i=this.options.expirationDays)&&void 0!==i?i:0,s=void 0,(r=null!==t?n:-1)&&((u=new Date).setTime(u.getTime()+24*r*60*60*1e3),s=u),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),s&&(a+="; expires=".concat(s.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),window.document.cookie=a}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}}))}))},e.prototype.reset=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2]}))}))},e}(),J=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var i,n;return o(this,(function(r){switch(r.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return i={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,i)];case 1:return[4,r.sent().json()];case 2:return n=r.sent(),[2,this.buildResponse(n)]}}))}))},t}(F),X=function(){function e(){}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,i,n;return o(this,(function(r){switch(r.label){case 0:if("undefined"==typeof window)return[2,!1];t=String(Date.now()),i=new e,n="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,i.set(n,t)];case 2:return r.sent(),[4,i.get(n)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,i.remove(n)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=i.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return i.sent(),[2,void 0];case 3:return[2]}}))}))},e.prototype.getRaw=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,window.localStorage.getItem(e)||void 0]}))}))},e.prototype.set=function(e,t){return r(this,void 0,void 0,(function(){return o(this,(function(i){try{window.localStorage.setItem(e,JSON.stringify(t))}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){try{window.localStorage.removeItem(e)}catch(e){}return[2]}))}))},e.prototype.reset=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){try{window.localStorage.clear()}catch(e){}return[2]}))}))},e}(),ee=function(e,t,i){return void 0===t&&(t=""),void 0===i&&(i=10),[_,t,e.substring(0,i)].filter(Boolean).join("_")},te=function(){return"undefined"==typeof window?{}:window.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var i=u(t.split("=",2),2),n=i[0],r=i[1],o=void 0===r?"":r;return o?(e[decodeURIComponent(n)]=decodeURIComponent(o),e):e}),{})},ie=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return i(t,e),t.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var i=this;return o(this,(function(n){return[2,new Promise((function(n,r){"undefined"==typeof XMLHttpRequest&&r(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===i.state.done)try{var e=o.responseText,t=JSON.parse(e),s=i.buildResponse(t);n(s)}catch(e){r(e)}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},t}(F),ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var i=this;return o(this,(function(n){return[2,new Promise((function(n,r){if("undefined"==typeof window||void 0===window.navigator||void 0===window.navigator.sendBeacon)throw new Error("SendBeaconTransport is not supported");try{var o=JSON.stringify(t);return n(window.navigator.sendBeacon(e,JSON.stringify(t))?i.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:o.length,server_upload_time:Date.now()}):i.buildResponse({code:500}))}catch(e){r(e)}}))]}))}))},t}(F),re=function(){function e(e,t){this.storage=e,this.isSessionCacheValid=!0,this.storageKey=ee(t),this.cache={optOut:!1}}return e.prototype.load=function(){var e;return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){switch(i.label){case 0:return t=this,[4,this.storage.get(this.storageKey)];case 1:return t.cache=null!==(e=i.sent())&&void 0!==e?e:{optOut:!1},[2,this]}}))}))},e.prototype.setSession=function(e){this.cache=n(n({},this.cache),e),this.storage.set(this.storageKey,this.cache)},e.prototype.getSessionId=function(){var e=this;return this.isSessionCacheValid=!0,this.storage.get(this.storageKey).then((function(t){e.isSessionCacheValid&&(e.cache.sessionId=null==t?void 0:t.sessionId)})),this.cache.sessionId},e.prototype.setSessionId=function(e){this.isSessionCacheValid=!1,this.setSession({sessionId:e})},e.prototype.getDeviceId=function(){return this.cache.deviceId},e.prototype.setDeviceId=function(e){this.setSession({deviceId:e})},e.prototype.getUserId=function(){return this.cache.userId},e.prototype.setUserId=function(e){this.setSession({userId:e})},e.prototype.getLastEventTime=function(){return this.cache.lastEventTime},e.prototype.setLastEventTime=function(e){this.setSession({lastEventTime:e})},e.prototype.getOptOut=function(){return this.cache.optOut},e.prototype.setOptOut=function(e){this.setSession({optOut:e})},e}(),oe=function(){var e=new z;return{cookieExpiration:365,cookieSameSite:"Lax",cookieSecure:!1,cookieStorage:e,disableCookies:!1,domain:"",sessionManager:new re(e,""),sessionTimeout:18e5,storageProvider:new z,trackingOptions:{city:!0,country:!0,carrier:!0,deviceManufacturer:!0,deviceModel:!0,dma:!0,ipAddress:!0,language:!0,osName:!0,osVersion:!0,platform:!0,region:!0,versionName:!0},transportProvider:new J}},se=function(e){function t(t,i,r){var o,s,u,a,c,l,d,p,f,h,v,g,y=this,b=oe();return(y=e.call(this,n(n({flushIntervalMillis:1e3,flushMaxRetries:5,flushQueueSize:30},r),{apiKey:t,storageProvider:null!==(o=null==r?void 0:r.storageProvider)&&void 0!==o?o:b.storageProvider,transportProvider:null!==(s=null==r?void 0:r.transportProvider)&&void 0!==s?s:b.transportProvider}))||this).cookieStorage=null!==(u=null==r?void 0:r.cookieStorage)&&void 0!==u?u:b.cookieStorage,y.sessionManager=null!==(a=null==r?void 0:r.sessionManager)&&void 0!==a?a:b.sessionManager,y.sessionTimeout=null!==(c=null==r?void 0:r.sessionTimeout)&&void 0!==c?c:b.sessionTimeout,y.appVersion=null==r?void 0:r.appVersion,y.cookieExpiration=null!==(l=null==r?void 0:r.cookieExpiration)&&void 0!==l?l:b.cookieExpiration,y.cookieSameSite=null!==(d=null==r?void 0:r.cookieSameSite)&&void 0!==d?d:b.cookieSameSite,y.cookieSecure=null!==(p=null==r?void 0:r.cookieSecure)&&void 0!==p?p:b.cookieSecure,y.deviceId=null==r?void 0:r.deviceId,y.disableCookies=null!==(f=null==r?void 0:r.disableCookies)&&void 0!==f?f:b.disableCookies,y.domain=null!==(h=null==r?void 0:r.domain)&&void 0!==h?h:b.domain,y.lastEventTime=null!==(v=y.lastEventTime)&&void 0!==v?v:null==r?void 0:r.lastEventTime,y.optOut=Boolean(null==r?void 0:r.optOut),y.partnerId=null==r?void 0:r.partnerId,y.sessionId=null==r?void 0:r.sessionId,y.trackingOptions=null!==(g=null==r?void 0:r.trackingOptions)&&void 0!==g?g:b.trackingOptions,y.userId=i,y}return i(t,e),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this.sessionManager.getDeviceId()},set:function(e){this.sessionManager.setDeviceId(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this.sessionManager.getUserId()},set:function(e){this.sessionManager.setUserId(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this.sessionManager.getSessionId()},set:function(e){this.sessionManager.setSessionId(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this.sessionManager.getOptOut()},set:function(e){var t;null===(t=this.sessionManager)||void 0===t||t.setOptOut(Boolean(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this.sessionManager.getLastEventTime()},set:function(e){this.sessionManager.setLastEventTime(e)},enumerable:!1,configurable:!0}),t}(j),ue=function(e,t,i){return r(void 0,void 0,void 0,(function(){var r,s,u,a,c,l,d,p,f,h,v,g,y,b,m,w,_;return o(this,(function(o){switch(o.label){case 0:return r=oe(),null===(y=null==i?void 0:i.domain)||void 0===y?[3,1]:(u=y,[3,3]);case 1:return[4,fe()];case 2:u=o.sent(),o.label=3;case 3:return s=u,[4,ae(n(n({},i),{domain:s}))];case 4:return a=o.sent(),c=ee(e),[4,a.get(c)];case 5:return l=o.sent(),d=te(),[4,new re(a,e).load()];case 6:return p=o.sent(),f=se.bind,h=[void 0,e,null!=t?t:null==l?void 0:l.userId],v=[n({},i)],g={cookieStorage:a,sessionManager:p,deviceId:de(null==l?void 0:l.deviceId,null==i?void 0:i.deviceId,d.deviceId),domain:s,optOut:null!==(b=null==i?void 0:i.optOut)&&void 0!==b?b:Boolean(null==l?void 0:l.optOut)},[4,a.get(c)];case 7:return g.sessionId=null!==(w=null===(m=o.sent())||void 0===m?void 0:m.sessionId)&&void 0!==w?w:null==i?void 0:i.sessionId,[4,le(i)];case 8:return[2,new(f.apply(se,h.concat([n.apply(void 0,v.concat([(g.storageProvider=o.sent(),g.trackingOptions=n(n({},r.trackingOptions),null==i?void 0:i.trackingOptions),g.transportProvider=null!==(_=null==i?void 0:i.transportProvider)&&void 0!==_?_:pe(null==i?void 0:i.transport),g)]))])))]}}))}))},ae=function(e,t){return void 0===t&&(t=oe()),r(void 0,void 0,void 0,(function(){var i,r,s;return o(this,(function(o){switch(o.label){case 0:return i=n(n({},t),e),r=null==e?void 0:e.cookieStorage,(s=!r)?[3,2]:[4,r.isEnabled()];case 1:s=!o.sent(),o.label=2;case 2:return s?[2,ce(i)]:[2,r]}}))}))},ce=function(e){return r(void 0,void 0,void 0,(function(){var t,i;return o(this,(function(n){switch(n.label){case 0:return t=new Y({domain:e.domain,expirationDays:e.cookieExpiration,sameSite:e.cookieSameSite,secure:e.cookieSecure}),(i=e.disableCookies)?[3,2]:[4,t.isEnabled()];case 1:i=!n.sent(),n.label=2;case 2:return i?[4,(t=new X).isEnabled()]:[3,4];case 3:n.sent()||(t=new z),n.label=4;case 4:return[2,t]}}))}))},le=function(e){return r(void 0,void 0,void 0,(function(){var t,i,n,r,u,a,c;return o(this,(function(o){switch(o.label){case 0:if(e&&Object.prototype.hasOwnProperty.call(e,"storageProvider")&&!e.storageProvider)return[3,9];o.label=1;case 1:o.trys.push([1,7,8,9]),t=s([null==e?void 0:e.storageProvider,new X]),i=t.next(),o.label=2;case 2:return i.done?[3,6]:(n=i.value,(r=n)?[4,n.isEnabled()]:[3,4]);case 3:r=o.sent(),o.label=4;case 4:if(r)return[2,n];o.label=5;case 5:return i=t.next(),[3,2];case 6:return[3,9];case 7:return u=o.sent(),a={error:u},[3,9];case 8:try{i&&!i.done&&(c=t.return)&&c.call(t)}finally{if(a)throw a.error}return[7];case 9:return[2,void 0]}}))}))},de=function(e,t,i){return t||i||e||B()},pe=function(e){return e===f.TransportType.XHR?new ie:e===f.TransportType.SendBeacon?new ne:oe().transportProvider},fe=function(e){return r(void 0,void 0,void 0,(function(){var t,i,n,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:return[4,(new Y).isEnabled()];case 1:if(!o.sent()||!e&&"undefined"==typeof location)return[2,""];for(t=null!=e?e:location.hostname,i=t.split("."),n=[],r="AMP_TLDTEST",s=i.length-2;s>=0;--s)n.push(i.slice(s).join("."));s=0,o.label=2;case 2:return s<n.length?(u=n[s],[4,(a=new Y({domain:"."+u})).set(r,1)]):[3,7];case 3:return o.sent(),[4,a.get(r)];case 4:return o.sent()?[4,a.remove(r)]:[3,6];case 5:return o.sent(),[2,"."+u];case 6:return s++,[3,2];case 7:return[2,""]}}))}))},he=function(e,t){return r(void 0,void 0,void 0,(function(){var i,n,r,s,a,c,l,d,p;return o(this,(function(o){switch(o.label){case 0:return[4,(i=new Y).isEnabled()];case 1:return o.sent()&&!(null==t?void 0:t.disableCookies)||(i=new X),[4,i.isEnabled()];case 2:return o.sent()?(n=function(e){return"".concat(_.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,i.getRaw(n)]):[2,{optOut:!1}];case 3:return(r=o.sent())?[4,i.remove(n)]:[2,{optOut:!1}];case 4:return o.sent(),s=u(r.split("."),5),a=s[0],c=s[1],l=s[2],d=s[3],p=s[4],[2,{deviceId:a,userId:ge(c),sessionId:ve(d),lastEventTime:ve(p),optOut:Boolean(l)}]}}))}))},ve=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},ge=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},ye=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=i.sent())?[2,t.split(".").splice(-1)[0].split("|").reduce((function(e,t){var i=u(t.split("=",2),2),n=i[0],r=i[1],o=void 0===r?"":r;return o?(e[n]=decodeURIComponent(o),e):e}),{})]:[2,void 0];case 2:return i.sent(),[2,void 0];case 3:return[2]}}))}))},t.prototype.set=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){return[2,void 0]}))}))},t}(Y),be={utm_source:void 0,utm_medium:void 0,utm_campaign:void 0,utm_term:void 0,utm_content:void 0,referrer:void 0,referring_domain:void 0,gclid:void 0,fbclid:void 0},me=function(){function e(){this.utmCookieStorage=new ye}return e.prototype.parse=function(){return r(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=[n({},be)],[4,this.getUtmParam()];case 1:return[2,n.apply(void 0,[n.apply(void 0,[n.apply(void 0,e.concat([t.sent()])),this.getReferrer()]),this.getClickIds()])]}}))}))},e.prototype.getUtmParam=function(){return r(this,void 0,void 0,(function(){var e,t,i,n,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:return e=te(),[4,this.utmCookieStorage.isEnabled()];case 1:return(i=o.sent())?[4,this.utmCookieStorage.get("__utmz")]:[3,3];case 2:i=o.sent(),o.label=3;case 3:return t=i||{},n=e.utm_source||t.utmcsr,r=e.utm_medium||t.utmcmd,s=e.utm_campaign||t.utmccn,u=e.utm_term||t.utmctr,a=e.utm_content||t.utmcct,[2,{utm_source:n,utm_medium:r,utm_campaign:s,utm_term:u,utm_content:a}]}}))}))},e.prototype.getReferrer=function(){var e,t,i={referrer:void 0,referring_domain:void 0};try{i.referrer=document.referrer||void 0,i.referring_domain=null!==(t=null===(e=i.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return i},e.prototype.getClickIds=function(){var e,t=te();return(e={}).gclid=t.gclid,e.fbclid=t.fbclid,e},e}(),we=function(){function e(e,t){var i,n;this.storage=t.storage,this.storageKey=ee(e,"MKTG"),this.parser=new me,this.track=t.track,this.onNewCampaign=t.onNewCampaign,this.disabled=Boolean(t.disabled),this.trackNewCampaigns=Boolean(t.trackNewCampaigns),this.trackPageViews=Boolean(t.trackPageViews),this.excludeReferrers=null!==(i=t.excludeReferrers)&&void 0!==i?i:[],"undefined"!=typeof location&&this.excludeReferrers.unshift(location.hostname),this.initialEmptyValue=null!==(n=t.initialEmptyValue)&&void 0!==n?n:"EMPTY"}return e.prototype.isNewCampaign=function(e,t){var i=Boolean(e.referring_domain&&this.excludeReferrers.includes(e.referring_domain)),n=t.utm_campaign!==e.utm_campaign||t.utm_source!==e.utm_source||t.utm_medium!==e.utm_medium||t.utm_term!==e.utm_term||t.utm_content!==e.utm_content,r=t.referring_domain!==e.referring_domain;return!i&&(n||r)},e.prototype.saveCampaignToStorage=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.storage.set(this.storageKey,e)];case 1:return t.sent(),[2]}}))}))},e.prototype.getCampaignFromStorage=function(){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,this.storage.get(this.storageKey)];case 1:return[2,e.sent()||n({},be)]}}))}))},e.prototype.createCampaignEvent=function(e){var t=this,i=n(n({},be),e),r=Object.entries(i).reduce((function(e,i){var n=u(i,2),r=n[0],o=n[1];return e.setOnce("initial_".concat(r),o||t.initialEmptyValue),o?e.set(r,o):e.unset(r)}),new O),o={event_type:"Page View",event_properties:{page_title:"undefined"!=typeof document&&document.title||"",page_location:"undefined"!=typeof location&&location.href||"",page_path:"undefined"!=typeof location&&location.pathname||""}};return n(n({},k(r)),this.trackPageViews&&o)},e.prototype.send=function(e){return r(this,void 0,void 0,(function(){var t,i;return o(this,(function(n){switch(n.label){case 0:return this.disabled?[2]:[4,this.parser.parse()];case 1:return t=n.sent(),[4,this.getCampaignFromStorage()];case 2:if(i=n.sent(),!e){if(!this.trackNewCampaigns||!this.isNewCampaign(t,i))return[2];this.onNewCampaign(t)}return[4,this.track(this.createCampaignEvent(t))];case 3:return n.sent(),[4,this.saveCampaignToStorage(t)];case 4:return n.sent(),[2]}}))}))},e}(),_e=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.init=function(t,i,s){var u,a,c;return r(this,void 0,void 0,(function(){var r,l,d;return o(this,(function(o){switch(o.label){case 0:return[4,he(t,s)];case 1:return r=o.sent(),[4,ue(t,i||r.userId,n(n({},s),{deviceId:null!==(u=r.deviceId)&&void 0!==u?u:null==s?void 0:s.deviceId,sessionId:null!==(a=r.sessionId)&&void 0!==a?a:null==s?void 0:s.sessionId,optOut:null!==(c=null==s?void 0:s.optOut)&&void 0!==c?c:r.optOut,lastEventTime:r.lastEventTime}))];case 2:return l=o.sent(),[4,e.prototype._init.call(this,l)];case 3:return o.sent(),d=!1,(!this.config.sessionId||this.config.lastEventTime&&Date.now()-this.config.lastEventTime>this.config.sessionTimeout)&&(this.config.sessionId=Date.now(),d=!0),[4,this.add(new G)];case 4:return o.sent(),[4,this.add(new A)];case 5:return o.sent(),this.timeline.isReady=!0,this.config.optOut||this.timeline.scheduleApply(0),[4,this.runAttributionStrategy(null==s?void 0:s.attribution,d)];case 6:return o.sent(),[2]}}))}))},t.prototype.runAttributionStrategy=function(e,t){return void 0===t&&(t=!1),r(this,void 0,void 0,(function(){var i,r,s;return o(this,(function(o){switch(o.label){case 0:return i=this.track.bind(this),r=this.setSessionId.bind(this,Date.now()),[4,ce(this.config)];case 1:return s=o.sent(),[4,new we(this.config.apiKey,n(n({},e),{storage:s,track:i,onNewCampaign:r})).send(t)];case 2:return o.sent(),[2]}}))}))},t.prototype.getUserId=function(){return this.config.userId},t.prototype.setUserId=function(e){this.config.userId=e},t.prototype.getDeviceId=function(){return this.config.deviceId},t.prototype.setDeviceId=function(e){this.config.deviceId=e},t.prototype.regenerateDeviceId=function(){var e=de();this.setDeviceId(e)},t.prototype.getSessionId=function(){return this.config.sessionId},t.prototype.setSessionId=function(e){this.config.sessionId=e},t.prototype.setOptOut=function(e){this.config.optOut=e},t.prototype.setTransport=function(e){this.config.transportProvider=pe(e)},t.prototype.identify=function(t,i){if(Q(t)){var n=t._q;t._q=[],t=$(new O,n)}return e.prototype.identify.call(this,t,i)},t.prototype.groupIdentify=function(t,i,n,r){if(Q(n)){var o=n._q;n._q=[],n=$(new O,o)}return e.prototype.groupIdentify.call(this,t,i,n,r)},t.prototype.revenue=function(t,i){if(Q(t)){var n=t._q;t._q=[],t=$(new U,n)}return e.prototype.revenue.call(this,t,i)},t}(N),Se=new _e,Ee=V(Se.init.bind(Se)),Ie=V(Se.add.bind(Se)),Te=V(Se.remove.bind(Se)),Oe=V(Se.track.bind(Se)),ke=V(Se.logEvent.bind(Se)),Pe=V(Se.identify.bind(Se)),xe=V(Se.groupIdentify.bind(Se)),Re=V(Se.setGroup.bind(Se)),Ne=V(Se.revenue.bind(Se)),Ue=Se.getUserId.bind(Se),Ce=Se.setUserId.bind(Se),Le=Se.getDeviceId.bind(Se),De=Se.setDeviceId.bind(Se);Se.regenerateDeviceId.bind(Se);var je=Se.getSessionId.bind(Se),Me=Se.setSessionId.bind(Se),qe=Se.setOptOut.bind(Se),Ae=Se.setTransport.bind(Se),Ve=V(Se.flush.bind(Se)),Be=Object.freeze({__proto__:null,Types:w,add:Ie,flush:Ve,getDeviceId:Le,getSessionId:je,getUserId:Ue,groupIdentify:xe,identify:Pe,init:Ee,logEvent:ke,remove:Te,revenue:Ne,setDeviceId:De,setGroup:Re,setOptOut:qe,setSessionId:Me,setTransport:Ae,setUserId:Ce,track:Oe,runQueuedFunctions:Z,Revenue:U,Identify:O});if(globalThis.amplitude=Object.assign(globalThis.amplitude||{},Be),globalThis.amplitude.invoked){var ze=globalThis.amplitude._q;globalThis.amplitude._q=[],Z(Be,ze)}}();
|
|
Binary file
|