@v-tilt/browser 1.0.8 → 1.0.9

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.
Files changed (48) hide show
  1. package/dist/array.js +1 -1
  2. package/dist/array.js.map +1 -1
  3. package/dist/array.no-external.js +1 -1
  4. package/dist/array.no-external.js.map +1 -1
  5. package/dist/constants.d.ts +0 -1
  6. package/dist/extensions/history-autocapture.d.ts +0 -2
  7. package/dist/main.js +1 -1
  8. package/dist/main.js.map +1 -1
  9. package/dist/module.d.ts +52 -132
  10. package/dist/module.js +1 -1
  11. package/dist/module.js.map +1 -1
  12. package/dist/module.no-external.d.ts +52 -132
  13. package/dist/module.no-external.js +1 -1
  14. package/dist/module.no-external.js.map +1 -1
  15. package/dist/session.d.ts +5 -5
  16. package/dist/types.d.ts +1 -0
  17. package/dist/user-manager.d.ts +30 -20
  18. package/dist/utils/event-utils.d.ts +7 -8
  19. package/dist/utils/index.d.ts +0 -5
  20. package/dist/utils/patch.d.ts +0 -1
  21. package/dist/vtilt.d.ts +54 -14
  22. package/dist/web-vitals.d.ts +3 -3
  23. package/lib/constants.d.ts +0 -1
  24. package/lib/constants.js +1 -23
  25. package/lib/extensions/history-autocapture.d.ts +0 -2
  26. package/lib/extensions/history-autocapture.js +3 -5
  27. package/lib/session.d.ts +5 -5
  28. package/lib/session.js +8 -8
  29. package/lib/types.d.ts +1 -0
  30. package/lib/user-manager.d.ts +30 -20
  31. package/lib/user-manager.js +103 -92
  32. package/lib/utils/event-utils.d.ts +7 -8
  33. package/lib/utils/event-utils.js +8 -9
  34. package/lib/utils/index.d.ts +0 -5
  35. package/lib/utils/index.js +0 -13
  36. package/lib/utils/patch.d.ts +0 -1
  37. package/lib/utils/patch.js +0 -1
  38. package/lib/vtilt.d.ts +54 -14
  39. package/lib/vtilt.js +328 -45
  40. package/lib/web-vitals.d.ts +3 -3
  41. package/lib/web-vitals.js +3 -3
  42. package/package.json +61 -61
  43. package/dist/tracking.d.ts +0 -120
  44. package/dist/utils/is-function.d.ts +0 -4
  45. package/lib/tracking.d.ts +0 -120
  46. package/lib/tracking.js +0 -338
  47. package/lib/utils/is-function.d.ts +0 -4
  48. package/lib/utils/is-function.js +0 -9
package/dist/module.d.ts CHANGED
@@ -40,6 +40,7 @@ interface TrackingEvent {
40
40
  domain: string;
41
41
  payload: EventPayload;
42
42
  distinct_id?: string;
43
+ anonymous_id?: string;
43
44
  }
44
45
  type StorageMethod = "cookie" | "localStorage" | "sessionStorage";
45
46
  interface StorageMethods {
@@ -66,130 +67,9 @@ interface AliasEvent {
66
67
  original: string;
67
68
  }
68
69
 
69
- interface QueuedRequest {
70
- url: string;
71
- event: any;
72
- }
73
- declare class TrackingManager {
74
- private config;
75
- private sessionManager;
76
- private userManager;
77
- __request_queue: QueuedRequest[];
78
- private _hasWarnedAboutConfig;
79
- constructor(config: VTiltConfig);
80
- /**
81
- * Get current domain from location
82
- * Returns full URL format for consistency with dashboard
83
- */
84
- private getCurrentDomain;
85
- /**
86
- * Check if tracking is properly configured
87
- * Returns true if projectId and token are present, false otherwise
88
- * Logs a warning only once per instance if not configured
89
- */
90
- private _isConfigured;
91
- /**
92
- * Send event to endpoint
93
- * PostHog-style: Automatically adds common properties to all events
94
- * ($current_url, $host, $pathname, $referrer, $referring_domain, $browser_language, etc.)
95
- * Also adds title property for $pageview events only
96
- */
97
- sendEvent(name: string, payload: EventPayload): Promise<void>;
98
- /**
99
- * Build the tracking URL with token in query parameters (PostHog style)
100
- */
101
- private buildUrl;
102
- /**
103
- * Send HTTP request
104
- * This is the central entry point for all tracking requests
105
- */
106
- private sendRequest;
107
- /**
108
- * Send a queued request (called after DOM is loaded)
109
- */
110
- _send_retriable_request(item: QueuedRequest): void;
111
- /**
112
- * Get current session ID
113
- */
114
- getSessionId(): string | null;
115
- /**
116
- * Identify a user with PostHog-style property operations
117
- * Copied from PostHog's identify method signature
118
- */
119
- identify(distinctId?: string, userPropertiesToSet?: Record<string, any>, userPropertiesToSetOnce?: Record<string, any>): void;
120
- /**
121
- * Set user properties (PostHog-style)
122
- */
123
- setUserProperties(userPropertiesToSet?: Record<string, any>, userPropertiesToSetOnce?: Record<string, any>): void;
124
- /**
125
- * Reset user identity (logout)
126
- * PostHog behavior: Clears all user data, generates new anonymous ID, resets session
127
- *
128
- * @param reset_device_id - If true, also resets device_id. Default: false
129
- */
130
- resetUser(reset_device_id?: boolean): void;
131
- /**
132
- * Get current user identity
133
- */
134
- getUserIdentity(): UserIdentity;
135
- /**
136
- * Get current device ID
137
- */
138
- getDeviceId(): string;
139
- /**
140
- * Get current user state
141
- */
142
- getUserState(): "anonymous" | "identified";
143
- /**
144
- * Create an alias to link two distinct IDs
145
- * PostHog behavior: Links anonymous session to account on signup
146
- *
147
- * @param alias - A unique identifier that you want to use for this user in the future
148
- * @param original - The current identifier being used for this user (optional, defaults to current distinct_id)
149
- *
150
- * @example
151
- * // Link anonymous user to account on signup
152
- * vtilt.createAlias('user_12345')
153
- *
154
- * @example
155
- * // Explicit alias with original ID
156
- * vtilt.createAlias('user_12345', 'anonymous_abc123')
157
- */
158
- createAlias(alias: string, original?: string): void;
159
- /**
160
- * Setup listener for identify, set, and alias events
161
- */
162
- private setupIdentifyListener;
163
- /**
164
- * Get session and window IDs (PostHog-style)
165
- * Both methods ensure IDs always exist (generate if needed)
166
- */
167
- private _getSessionAndWindowIds;
168
- /**
169
- * Create base tracking event structure
170
- */
171
- private _createTrackingEvent;
172
- /**
173
- * Send identify event for session merging
174
- */
175
- private sendIdentifyEvent;
176
- /**
177
- * Send $set event for property updates (PostHog behavior)
178
- * This notifies Tinybird when user properties are updated
179
- */
180
- private sendSetEvent;
181
- /**
182
- * Send alias event for identity linking
183
- * PostHog format: { alias: alias, distinct_id: original }
184
- */
185
- private sendAliasEvent;
186
- }
187
-
188
70
  /**
189
71
  * This class is used to capture pageview events when the user navigates using the history API (pushState, replaceState)
190
72
  * and when the user navigates using the browser's back/forward buttons.
191
- *
192
- * Based on PostHog's HistoryAutocapture implementation
193
73
  */
194
74
  declare class HistoryAutocapture {
195
75
  private _instance;
@@ -204,14 +84,21 @@ declare class HistoryAutocapture {
204
84
  private _setupPopstateListener;
205
85
  }
206
86
 
87
+ interface QueuedRequest {
88
+ url: string;
89
+ event: any;
90
+ }
207
91
  declare class VTilt {
208
92
  private configManager;
209
- trackingManager: TrackingManager;
93
+ private sessionManager;
94
+ private userManager;
210
95
  private webVitalsManager;
211
96
  historyAutocapture?: HistoryAutocapture;
212
97
  __loaded: boolean;
213
98
  private _initialPageviewCaptured;
214
99
  private _visibilityStateListener;
100
+ __request_queue: QueuedRequest[];
101
+ private _hasWarnedAboutConfig;
215
102
  constructor(config?: Partial<VTiltConfig>);
216
103
  /**
217
104
  * Initializes a new instance of the VTilt tracking object.
@@ -247,23 +134,57 @@ declare class VTilt {
247
134
  /**
248
135
  * Handles the actual initialization logic for a VTilt instance.
249
136
  * This internal method should only be called by `init()`.
250
- * Follows the PostHog convention of using a private `_init()` method for instance setup.
251
137
  */
252
138
  private _init;
253
139
  /**
254
- * Returns a string representation of the instance name (PostHog-style)
140
+ * Returns a string representation of the instance name
255
141
  * Used for debugging and logging
256
142
  *
257
143
  * @internal
258
144
  */
259
145
  toString(): string;
260
146
  /**
261
- * Track a custom event
147
+ * Get current domain from location
148
+ * Returns full URL format for consistency with dashboard
149
+ */
150
+ private getCurrentDomain;
151
+ /**
152
+ * Check if tracking is properly configured
153
+ * Returns true if projectId and token are present, false otherwise
154
+ * Logs a warning only once per instance if not configured
155
+ */
156
+ private _isConfigured;
157
+ /**
158
+ * Build the tracking URL with token in query parameters
159
+ */
160
+ private buildUrl;
161
+ /**
162
+ * Send HTTP request
163
+ * This is the central entry point for all tracking requests
164
+ */
165
+ private sendRequest;
166
+ /**
167
+ * Send a queued request (called after DOM is loaded)
168
+ */
169
+ _send_retriable_request(item: QueuedRequest): void;
170
+ /**
171
+ * Capture an event
172
+ * Automatically adds common properties to all events
173
+ * ($current_url, $host, $pathname, $referrer, $referring_domain, $browser_language, etc.)
174
+ * Also adds title property for $pageview events only
175
+ *
176
+ * @param name - Event name
177
+ * @param payload - Event payload
178
+ */
179
+ capture(name: string, payload: EventPayload): void;
180
+ /**
181
+ * Track a custom event (alias for capture)
262
182
  */
263
183
  trackEvent(name: string, payload?: EventPayload): void;
264
184
  /**
265
- * Identify a user with PostHog-style property operations
266
- * Copied from PostHog's identify method signature
185
+ * Identify a user with property operations
186
+ * Sends $identify event when transitioning from anonymous to identified
187
+ * Event's distinct_id is the previous/anonymous ID, new distinct_id is in payload
267
188
  *
268
189
  * @example
269
190
  * ```js
@@ -280,9 +201,9 @@ declare class VTilt {
280
201
  * vTilt.identify('user_123', { name: 'John Doe', email: 'john@example.com' })
281
202
  * ```
282
203
  */
283
- identify(distinctId?: string, userPropertiesToSet?: Record<string, any>, userPropertiesToSetOnce?: Record<string, any>): void;
204
+ identify(newDistinctId?: string, userPropertiesToSet?: Record<string, any>, userPropertiesToSetOnce?: Record<string, any>): void;
284
205
  /**
285
- * Set user properties with PostHog-style operations
206
+ * Set user properties
286
207
  * Sets properties on the person profile associated with the current distinct_id
287
208
  *
288
209
  * @example
@@ -306,7 +227,7 @@ declare class VTilt {
306
227
  setUserProperties(userPropertiesToSet?: Record<string, any>, userPropertiesToSetOnce?: Record<string, any>): void;
307
228
  /**
308
229
  * Reset user identity (logout)
309
- * PostHog behavior: Clears all user data, generates new anonymous ID
230
+ * Clears all user data, generates new anonymous ID, resets session
310
231
  *
311
232
  * @param reset_device_id - If true, also resets device_id. Default: false
312
233
  *
@@ -333,7 +254,7 @@ declare class VTilt {
333
254
  getUserState(): "anonymous" | "identified";
334
255
  /**
335
256
  * Create an alias to link two distinct IDs
336
- * PostHog behavior: Links anonymous session to account on signup
257
+ * Links anonymous session to account on signup
337
258
  *
338
259
  * @param alias - A unique identifier that you want to use for this user in the future
339
260
  * @param original - The current identifier being used for this user (optional, defaults to current distinct_id)
@@ -349,7 +270,6 @@ declare class VTilt {
349
270
  createAlias(alias: string, original?: string): void;
350
271
  /**
351
272
  * Capture initial pageview with visibility check
352
- * Based on PostHog's _captureInitialPageview implementation
353
273
  */
354
274
  private _captureInitialPageview;
355
275
  /**
package/dist/module.js CHANGED
@@ -1,2 +1,2 @@
1
- function i(i,e,a,t,r,n,s){try{var o=i[n](s),c=o.value}catch(i){return void a(i)}o.done?e(c):Promise.resolve(c).then(t,r)}function e(){return e=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var t in a)({}).hasOwnProperty.call(a,t)&&(i[t]=a[t])}return i},e.apply(null,arguments)}class a{constructor(i){void 0===i&&(i={}),this.config=this.parseConfigFromScript(i)}parseConfigFromScript(i){if(!document.currentScript)return e({projectId:i.projectId||"",token:i.token||""},i);var a=document.currentScript,t=e({projectId:"",token:""},i);if(t.host=a.getAttribute("data-host")||i.host,t.proxy=a.getAttribute("data-proxy")||i.proxy,t.proxyUrl=a.getAttribute("data-proxy-url")||i.proxyUrl,t.token=a.getAttribute("data-token")||i.token||"",t.projectId=a.getAttribute("data-project-id")||i.projectId||"",t.domain=a.getAttribute("data-domain")||i.domain,t.storage=a.getAttribute("data-storage")||i.storage,t.stringifyPayload="false"!==a.getAttribute("data-stringify-payload"),t.webVitals="true"===a.getAttribute("web-vitals")||"true"===a.getAttribute("data-web-vitals")||i.webVitals,t.proxy&&t.proxyUrl)throw console.error("Error: Both data-proxy and data-proxy-url are specified. Please use only one of them."),new Error("Both data-proxy and data-proxy-url are specified. Please use only one of them.");for(var r of(t.globalAttributes=e({},i.globalAttributes),Array.from(a.attributes)))r.name.startsWith("tb_")&&(t.globalAttributes[r.name.slice(3).replace(/-/g,"_")]=r.value),r.name.startsWith("data-tb-")&&(t.globalAttributes[r.name.slice(8).replace(/-/g,"_")]=r.value);return t}getConfig(){return e({},this.config)}updateConfig(i){this.config=e({},this.config,i)}}var t="vt_session_id",r="vt_window_id",n="vt_primary_window_exists",s="vt_anonymous_id",o="vt_distinct_id",c="vt_device_id",u="vt_user_properties",A="vt_user_state",d="localStorage",l="sessionStorage",h={"Asia/Barnaul":"RU","Africa/Nouakchott":"MR","Africa/Lusaka":"ZM","Asia/Pyongyang":"KP","Europe/Bratislava":"SK","America/Belize":"BZ","America/Maceio":"BR","Pacific/Chuuk":"FM","Indian/Comoro":"KM","Pacific/Palau":"PW","Asia/Jakarta":"ID","Africa/Windhoek":"NA","America/Chihuahua":"MX","America/Nome":"US","Africa/Mbabane":"SZ","Africa/Porto-Novo":"BJ","Europe/San_Marino":"SM","Pacific/Fakaofo":"TK","America/Denver":"US","Europe/Belgrade":"RS","America/Indiana/Tell_City":"US","America/Fortaleza":"BR","America/Halifax":"CA","Europe/Bucharest":"RO","America/Indiana/Petersburg":"US","Europe/Kirov":"RU","Europe/Athens":"GR","America/Argentina/Ushuaia":"AR","Europe/Monaco":"MC","Europe/Vilnius":"LT","Europe/Copenhagen":"DK","Pacific/Kanton":"KI","America/Caracas":"VE","Asia/Almaty":"KZ","Europe/Paris":"FR","Africa/Blantyre":"MW","Asia/Muscat":"OM","America/North_Dakota/Beulah":"US","America/Matamoros":"MX","Asia/Irkutsk":"RU","America/Costa_Rica":"CR","America/Araguaina":"BR","Atlantic/Canary":"ES","America/Santo_Domingo":"DO","America/Vancouver":"CA","Africa/Addis_Ababa":"ET","Africa/Accra":"GH","Pacific/Kwajalein":"MH","Asia/Baghdad":"IQ","Australia/Adelaide":"AU","Australia/Hobart":"AU","America/Guayaquil":"EC","America/Argentina/Tucuman":"AR","Australia/Lindeman":"AU","America/New_York":"US","Pacific/Fiji":"FJ","America/Antigua":"AG","Africa/Casablanca":"MA","America/Paramaribo":"SR","Africa/Cairo":"EG","America/Cayenne":"GF","America/Detroit":"US","Antarctica/Syowa":"AQ","Africa/Douala":"CM","America/Argentina/La_Rioja":"AR","Africa/Lagos":"NG","America/St_Barthelemy":"BL","Asia/Nicosia":"CY","Asia/Macau":"MO","Europe/Riga":"LV","Asia/Ashgabat":"TM","Indian/Antananarivo":"MG","America/Argentina/San_Juan":"AR","Asia/Aden":"YE","Asia/Tomsk":"RU","America/Asuncion":"PY","Pacific/Bougainville":"PG","Asia/Vientiane":"LA","America/Mazatlan":"MX","Africa/Luanda":"AO","Europe/Oslo":"NO","Africa/Kinshasa":"CD","Europe/Warsaw":"PL","America/Grand_Turk":"TC","Asia/Seoul":"KR","Africa/Tripoli":"LY","America/St_Thomas":"VI","Asia/Kathmandu":"NP","Pacific/Pitcairn":"PN","Pacific/Nauru":"NR","America/Curacao":"CW","Asia/Kabul":"AF","Pacific/Tongatapu":"TO","Europe/Simferopol":"UA","Asia/Ust-Nera":"RU","Africa/Mogadishu":"SO","Indian/Mayotte":"YT","Pacific/Niue":"NU","America/Thunder_Bay":"CA","Atlantic/Azores":"PT","Pacific/Gambier":"PF","Europe/Stockholm":"SE","Africa/Libreville":"GA","America/Punta_Arenas":"CL","America/Guatemala":"GT","America/Noronha":"BR","Europe/Helsinki":"FI","Asia/Gaza":"PS","Pacific/Kosrae":"FM","America/Aruba":"AW","America/Nassau":"BS","Asia/Choibalsan":"MN","America/Winnipeg":"CA","America/Anguilla":"AI","Asia/Thimphu":"BT","Asia/Beirut":"LB","Atlantic/Faroe":"FO","Europe/Berlin":"DE","Europe/Amsterdam":"NL","Pacific/Honolulu":"US","America/Regina":"CA","America/Scoresbysund":"GL","Europe/Vienna":"AT","Europe/Tirane":"AL","Africa/El_Aaiun":"EH","America/Creston":"CA","Asia/Qostanay":"KZ","Asia/Ho_Chi_Minh":"VN","Europe/Samara":"RU","Europe/Rome":"IT","Australia/Eucla":"AU","America/El_Salvador":"SV","America/Chicago":"US","Africa/Abidjan":"CI","Asia/Kamchatka":"RU","Pacific/Tarawa":"KI","America/Santiago":"CL","America/Bahia":"BR","Indian/Christmas":"CX","Asia/Atyrau":"KZ","Asia/Dushanbe":"TJ","Europe/Ulyanovsk":"RU","America/Yellowknife":"CA","America/Recife":"BR","Australia/Sydney":"AU","America/Fort_Nelson":"CA","Pacific/Efate":"VU","Europe/Saratov":"RU","Africa/Banjul":"GM","Asia/Omsk":"RU","Europe/Ljubljana":"SI","Europe/Budapest":"HU","Europe/Astrakhan":"RU","America/Argentina/Buenos_Aires":"AR","Pacific/Chatham":"NZ","America/Argentina/Salta":"AR","Africa/Niamey":"NE","Asia/Pontianak":"ID","Indian/Reunion":"RE","Asia/Hong_Kong":"HK","Antarctica/McMurdo":"AQ","Africa/Malabo":"GQ","America/Los_Angeles":"US","America/Argentina/Cordoba":"AR","Pacific/Pohnpei":"FM","America/Tijuana":"MX","America/Campo_Grande":"BR","America/Dawson_Creek":"CA","Asia/Novosibirsk":"RU","Pacific/Pago_Pago":"AS","Asia/Jerusalem":"IL","Europe/Sarajevo":"BA","Africa/Freetown":"SL","Asia/Yekaterinburg":"RU","America/Juneau":"US","Africa/Ouagadougou":"BF","Africa/Monrovia":"LR","Europe/Kiev":"UA","America/Argentina/San_Luis":"AR","Asia/Tokyo":"JP","Asia/Qatar":"QA","America/La_Paz":"BO","America/Bogota":"CO","America/Thule":"GL","Asia/Manila":"PH","Asia/Hovd":"MN","Asia/Tehran":"IR","Atlantic/Madeira":"PT","America/Metlakatla":"US","Europe/Vatican":"VA","Asia/Bishkek":"KG","Asia/Dili":"TL","Antarctica/Palmer":"AQ","Atlantic/Cape_Verde":"CV","Indian/Chagos":"IO","America/Kentucky/Monticello":"US","Africa/Algiers":"DZ","Africa/Maseru":"LS","Asia/Kuala_Lumpur":"MY","Africa/Khartoum":"SD","America/Argentina/Rio_Gallegos":"AR","America/Blanc-Sablon":"CA","Africa/Maputo":"MZ","America/Tortola":"VG","Atlantic/Bermuda":"BM","America/Argentina/Catamarca":"AR","America/Cayman":"KY","America/Puerto_Rico":"PR","Pacific/Majuro":"MH","Europe/Busingen":"DE","Pacific/Midway":"UM","Indian/Cocos":"CC","Asia/Singapore":"SG","America/Boise":"US","America/Nuuk":"GL","America/Goose_Bay":"CA","Australia/Broken_Hill":"AU","Africa/Dar_es_Salaam":"TZ","Africa/Asmara":"ER","Asia/Samarkand":"UZ","Asia/Tbilisi":"GE","America/Argentina/Jujuy":"AR","America/Indiana/Winamac":"US","America/Porto_Velho":"BR","Asia/Magadan":"RU","Europe/Zaporozhye":"UA","Antarctica/Casey":"AQ","Asia/Shanghai":"CN","Pacific/Norfolk":"NF","Europe/Guernsey":"GG","Australia/Brisbane":"AU","Antarctica/DumontDUrville":"AQ","America/Havana":"CU","America/Atikokan":"CA","America/Mexico_City":"MX","America/Rankin_Inlet":"CA","America/Cuiaba":"BR","America/Resolute":"CA","Africa/Ceuta":"ES","Arctic/Longyearbyen":"SJ","Pacific/Guam":"GU","Asia/Damascus":"SY","Asia/Colombo":"LK","Asia/Yerevan":"AM","America/Montserrat":"MS","America/Belem":"BR","Europe/Kaliningrad":"RU","Atlantic/South_Georgia":"GS","Asia/Tashkent":"UZ","Asia/Kolkata":"IN","America/St_Johns":"CA","Asia/Srednekolymsk":"RU","Asia/Yakutsk":"RU","Europe/Prague":"CZ","Africa/Djibouti":"DJ","Asia/Dubai":"AE","Europe/Uzhgorod":"UA","America/Edmonton":"CA","Asia/Famagusta":"CY","America/Indiana/Knox":"US","Asia/Hebron":"PS","Asia/Taipei":"TW","Europe/London":"GB","Africa/Dakar":"SN","Australia/Darwin":"AU","America/Glace_Bay":"CA","Antarctica/Vostok":"AQ","America/Indiana/Vincennes":"US","America/Nipigon":"CA","Asia/Kuwait":"KW","Pacific/Guadalcanal":"SB","America/Toronto":"CA","Africa/Gaborone":"BW","Africa/Bujumbura":"BI","Africa/Lubumbashi":"CD","America/Merida":"MX","America/Marigot":"MF","Europe/Zagreb":"HR","Pacific/Easter":"CL","America/Santarem":"BR","Pacific/Noumea":"NC","America/Sitka":"US","Atlantic/Stanley":"FK","Pacific/Funafuti":"TV","America/Iqaluit":"CA","America/Rainy_River":"CA","America/Anchorage":"US","America/Lima":"PE","Asia/Baku":"AZ","America/Indiana/Vevay":"US","Asia/Ulaanbaatar":"MN","America/Managua":"NI","Asia/Krasnoyarsk":"RU","Asia/Qyzylorda":"KZ","America/Eirunepe":"BR","Europe/Podgorica":"ME","Europe/Chisinau":"MD","Europe/Mariehamn":"AX","Europe/Volgograd":"RU","Africa/Nairobi":"KE","Europe/Isle_of_Man":"IM","America/Menominee":"US","Africa/Harare":"ZW","Asia/Anadyr":"RU","America/Moncton":"CA","Indian/Maldives":"MV","America/Whitehorse":"CA","Antarctica/Mawson":"AQ","Europe/Madrid":"ES","America/Argentina/Mendoza":"AR","America/Manaus":"BR","Africa/Bangui":"CF","Indian/Mauritius":"MU","Africa/Tunis":"TN","Australia/Lord_Howe":"AU","America/Kentucky/Louisville":"US","America/North_Dakota/Center":"US","Asia/Novokuznetsk":"RU","Asia/Makassar":"ID","America/Port_of_Spain":"TT","America/Bahia_Banderas":"MX","Pacific/Auckland":"NZ","America/Sao_Paulo":"BR","Asia/Dhaka":"BD","America/Pangnirtung":"CA","Europe/Dublin":"IE","Asia/Brunei":"BN","Africa/Brazzaville":"CG","America/Montevideo":"UY","America/Jamaica":"JM","America/Indiana/Indianapolis":"US","America/Kralendijk":"BQ","Europe/Gibraltar":"GI","Pacific/Marquesas":"PF","Pacific/Apia":"WS","Europe/Jersey":"JE","America/Phoenix":"US","Africa/Ndjamena":"TD","Asia/Karachi":"PK","Africa/Kampala":"UG","Asia/Sakhalin":"RU","America/Martinique":"MQ","Europe/Moscow":"RU","Africa/Conakry":"GN","America/Barbados":"BB","Africa/Lome":"TG","America/Ojinaga":"MX","America/Tegucigalpa":"HN","Asia/Bangkok":"TH","Africa/Johannesburg":"ZA","Europe/Vaduz":"LI","Africa/Sao_Tome":"ST","America/Cambridge_Bay":"CA","America/Lower_Princes":"SX","America/Miquelon":"PM","America/St_Kitts":"KN","Australia/Melbourne":"AU","Europe/Minsk":"BY","Asia/Vladivostok":"RU","Europe/Sofia":"BG","Antarctica/Davis":"AQ","Pacific/Galapagos":"EC","America/North_Dakota/New_Salem":"US","Asia/Amman":"JO","Pacific/Wallis":"WF","America/Hermosillo":"MX","Pacific/Kiritimati":"KI","Antarctica/Macquarie":"AU","America/Guyana":"GY","Asia/Riyadh":"SA","Pacific/Tahiti":"PF","America/St_Vincent":"VC","America/Cancun":"MX","America/Grenada":"GD","Pacific/Wake":"UM","America/Dawson":"CA","Europe/Brussels":"BE","Indian/Kerguelen":"TF","America/Yakutat":"US","Indian/Mahe":"SC","Atlantic/Reykjavik":"IS","America/Panama":"PA","America/Guadeloupe":"GP","Europe/Malta":"MT","Antarctica/Troll":"AQ","Asia/Jayapura":"ID","Asia/Bahrain":"BH","Asia/Chita":"RU","Europe/Tallinn":"EE","Asia/Khandyga":"RU","America/Rio_Branco":"BR","Atlantic/St_Helena":"SH","Africa/Juba":"SS","America/Adak":"US","Pacific/Saipan":"MP","America/St_Lucia":"LC","America/Inuvik":"CA","Europe/Luxembourg":"LU","Africa/Bissau":"GW","Asia/Oral":"KZ","America/Boa_Vista":"BR","Europe/Skopje":"MK","America/Port-au-Prince":"HT","Pacific/Port_Moresby":"PG","Europe/Andorra":"AD","America/Indiana/Marengo":"US","Africa/Kigali":"RW","Africa/Bamako":"ML","America/Dominica":"DM","Asia/Aqtobe":"KZ","Europe/Istanbul":"TR","Pacific/Rarotonga":"CK","America/Danmarkshavn":"GL","Europe/Zurich":"CH","Asia/Yangon":"MM","America/Monterrey":"MX","Europe/Lisbon":"PT","Asia/Kuching":"MY","Antarctica/Rothera":"AQ","Australia/Perth":"AU","Asia/Phnom_Penh":"KH","America/Swift_Current":"CA","Asia/Aqtau":"KZ","Asia/Urumqi":"CN","Asia/Calcutta":"IN"},m=["username","user","user_id","userid","password","pass","pin","passcode","token","api_token","email","address","phone","sex","gender","order","order_id","orderid","payment","credit_card"];function v(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+i/4).toString(16))}function f(i){return!(!i||"string"!=typeof i)&&!(i.length<2||i.length>10240)}function p(i){var e=JSON.stringify(i);return m.forEach(i=>{e=e.replace(new RegExp('("'+i+'"):(".+?"|\\d+)',"gmi"),'$1:"********"')}),e}function g(i,e,a,t){var{capture:r=!1,passive:n=!0}=null!=t?t:{};null==i||i.addEventListener(e,a,{capture:r,passive:n})}var S="undefined"!=typeof window?window:void 0,_="undefined"!=typeof globalThis?globalThis:S,E=null==_?void 0:_.navigator,w=null==_?void 0:_.document,y=null==_?void 0:_.location,C=null==_?void 0:_.fetch,P=(null==_?void 0:_.XMLHttpRequest)&&"withCredentials"in new _.XMLHttpRequest?_.XMLHttpRequest:void 0;null==_||_.AbortController;var M=null==E?void 0:E.userAgent;class R{constructor(i,e){void 0===i&&(i="cookie"),this.storageMethod=i,this.domain=e,this.i=void 0,this.t()}o(){return this.storageMethod===d||this.storageMethod===l}u(){return this.o()?this.storageMethod===d?localStorage:sessionStorage:null}A(i){return{value:i,expiry:(new Date).getTime()+18e5}}l(i){var e=this.u();if(e){var a=this.A(i);e.setItem(t,JSON.stringify(a))}}getSessionIdFromCookie(){var i={};return document.cookie.split(";").forEach(function(e){var[a,t]=e.split("=");i[a.trim()]=t}),i[t]||null}setSessionIdFromCookie(i){var e=t+"="+i+"; Max-Age=1800; path=/; secure";this.domain&&(e+="; domain="+this.domain),document.cookie=e}h(i){this.o()?this.l(i):this.setSessionIdFromCookie(i)}m(){var i=this.u();if(i){var e=i.getItem(t);if(!e)return null;var a=null;try{a=JSON.parse(e)}catch(i){return null}return"object"!=typeof a||null===a?null:(new Date).getTime()>a.expiry?(i.removeItem(t),null):a.value}return this.getSessionIdFromCookie()}getSessionId(){var i=this.m();return i||(i=v(),this.h(i)),i}setSessionId(){var i=this.m()||v();return this.h(i),i}v(){var i=this.u();if(i)i.removeItem(t);else{var e="Thu, 01 Jan 1970 00:00:00 UTC";document.cookie=t+"=; expires="+e+"; path=/;",this.domain&&(document.cookie=t+"=; expires="+e+"; path=/; domain="+this.domain+";")}}resetSessionId(){this.v(),this.setSessionId(),this.p(v())}getWindowId(){if(this.i)return this.i;if(this.S()&&S){var i=S.sessionStorage.getItem(r);if(i)return this.i=i,i}var e=v();return this.p(e),e}p(i){i!==this.i&&(this.i=i,this.S()&&S&&S.sessionStorage.setItem(r,i))}S(){if(void 0===S||!S.sessionStorage)return!1;try{var i="__vt_session_storage_test__";return S.sessionStorage.setItem(i,"test"),S.sessionStorage.removeItem(i),!0}catch(i){return!1}}t(){if(this.S()&&S){var i=S.sessionStorage.getItem(n),e=S.sessionStorage.getItem(r);e&&!i?this.i=e:(e&&S.sessionStorage.removeItem(r),this.p(v())),S.sessionStorage.setItem(n,"true"),this.C()}else this.i=v()}C(){S&&this.S()&&g(S,"beforeunload",()=>{S&&S.sessionStorage&&S.sessionStorage.removeItem(n)},{capture:!1})}}class U{constructor(i,e){void 0===i&&(i="localStorage"),this.P=null,this.storageMethod=i,this.domain=e,this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return e({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.saveUserIdentity()),this.userIdentity.anonymous_id}getUserProperties(){return e({},this.userIdentity.properties)}identify(i,a,t){if("number"==typeof i&&(i=i.toString(),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),i)if(this.isDistinctIdStringLike(i))console.error('The string "'+i+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==i){var r=this.userIdentity.distinct_id,n=this.userIdentity.anonymous_id,s=this.userIdentity.device_id;if(this.userIdentity.distinct_id=i,!this.userIdentity.device_id){var o=r||this.userIdentity.anonymous_id;this.userIdentity.device_id=o,this.userIdentity.properties=e({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:o})}i!==r&&(this.userIdentity.distinct_id=i);var c="anonymous"===this.userIdentity.user_state;i!==r&&c?(this.userIdentity.user_state="identified",a&&(this.userIdentity.properties=e({},this.userIdentity.properties,a)),t&&Object.keys(t).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=t[i])}),this.saveUserIdentity(),this.sendIdentifyEvent(i,n,s,{$set:a||{},$set_once:t||{}})):a||t?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),a&&(this.userIdentity.properties=e({},this.userIdentity.properties,a)),t&&Object.keys(t).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=t[i])}),this.saveUserIdentity(),this.sendSetEvent(a||{},t||{})):i!==r&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+i+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(i,a){if(i||a){var t=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,r=this.getPersonPropertiesHash(t,i,a);this.P!==r?(i&&(this.userIdentity.properties=e({},this.userIdentity.properties,i)),a&&Object.keys(a).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=a[i])}),this.saveUserIdentity(),this.sendSetEvent(i||{},a||{}),this.P=r):console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored.")}}getPersonPropertiesHash(i,e,a){return JSON.stringify({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:a})}sendSetEvent(i,e){var a=new CustomEvent("vtilt:set",{detail:{$set:i||{},$set_once:e||{}}});window.dispatchEvent(a)}reset(i){var a=this.generateAnonymousId(),t=this.userIdentity.device_id,r=i?this.generateDeviceId():t;this.userIdentity={distinct_id:null,anonymous_id:a,device_id:r,properties:{},user_state:"anonymous"},this.P=null,this.saveUserIdentity(),this.userIdentity.properties=e({},this.userIdentity.properties,{$last_posthog_reset:(new Date).toISOString()}),this.saveUserIdentity()}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}createAlias(i,e){if(this.isValidDistinctId(i))if(void 0===e&&(e=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(e)){if(i===e)return console.warn("alias matches current distinct_id - calling identify instead"),void this.identify(i);var a=new CustomEvent("vtilt:alias",{detail:{distinct_id:i,original:e}});window.dispatchEvent(a)}else console.warn("Invalid original distinct ID");else console.warn("Invalid alias provided")}isValidDistinctId(i){if(!i||"string"!=typeof i)return!1;var e=i.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(e)&&0!==i.trim().length}isDistinctIdStringLike(i){if(!i||"string"!=typeof i)return!1;var e=i.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(e)}loadUserIdentity(){var i=this.getStoredValue(s)||this.generateAnonymousId(),e=this.getStoredValue(o)||null,a=this.getStoredValue(c)||this.generateDeviceId(),t=this.getStoredUserProperties(),r=this.getStoredValue(A)||"anonymous";return{distinct_id:e,anonymous_id:i||this.generateAnonymousId(),device_id:a,properties:t,user_state:r}}saveUserIdentity(){this.setStoredValue(s,this.userIdentity.anonymous_id),this.setStoredValue(c,this.userIdentity.device_id),this.setStoredValue(A,this.userIdentity.user_state),this.userIdentity.distinct_id?this.setStoredValue(o,this.userIdentity.distinct_id):this.removeStoredValue(o),this.setStoredUserProperties(this.userIdentity.properties)}generateAnonymousId(){return"anon_"+v()}generateDeviceId(){return"device_"+v()}sendIdentifyEvent(i,a,t,r){var n=new CustomEvent("vtilt:identify",{detail:{distinct_id:i,anonymous_id:a,device_id:t,properties:e({$anon_distinct_id:a,$device_id:t},r)}});window.dispatchEvent(n)}getStoredValue(i){try{return this.storageMethod===d?localStorage.getItem(i):this.storageMethod===l?sessionStorage.getItem(i):this.getCookieValue(i)}catch(i){return console.warn("Failed to access storage:",i),null}}setStoredValue(i,e){try{this.storageMethod===d?localStorage.setItem(i,e):this.storageMethod===l?sessionStorage.setItem(i,e):this.setCookieValue(i,e)}catch(i){console.warn("Failed to save to storage:",i)}}removeStoredValue(i){this.storageMethod===d?localStorage.removeItem(i):this.storageMethod===l?sessionStorage.removeItem(i):this.removeCookieValue(i)}getStoredUserProperties(){var i=this.getStoredValue(u);if(!i)return{};try{return JSON.parse(i)}catch(i){return{}}}setStoredUserProperties(i){this.setStoredValue(u,JSON.stringify(i))}getCookieValue(i){var e=document.cookie.split(";");for(var a of e){var[t,r]=a.trim().split("=");if(t===i)return decodeURIComponent(r)}return null}setCookieValue(i,e){var a=i+"="+encodeURIComponent(e)+"; Max-Age=31536000; path=/; secure; SameSite=Lax";this.domain&&(a+="; domain="+this.domain),document.cookie=a}removeCookieValue(i){var e=i+"=; Max-Age=0; path=/";this.domain&&(e+="; domain="+this.domain),document.cookie=e}}function I(i){return"function"==typeof i}var k="Mobile",b="iOS",B="Android",T="Tablet",x=B+" "+T,N="iPad",D="Apple",K=D+" Watch",L="Safari",O="BlackBerry",G="Samsung",V=G+"Browser",F=G+" Internet",W="Chrome",j=W+" OS",H=W+" "+b,J="Internet Explorer",Z=J+" "+k,z="Opera",X=z+" Mini",Y="Edge",Q="Microsoft "+Y,q="Firefox",ii=q+" "+b,ei="Nintendo",ai="PlayStation",ti="Xbox",ri=B+" "+k,ni=k+" "+L,si="Windows",oi=si+" Phone",ci="Nokia",ui="Ouya",Ai="Generic",di=Ai+" "+k.toLowerCase(),li=Ai+" "+T.toLowerCase(),hi="Konqueror",mi="(\\d+(\\.\\d+)?)",vi=new RegExp("Version/"+mi),fi=new RegExp(ti,"i"),pi=new RegExp(ai+" \\w+","i"),gi=new RegExp(ei+" \\w+","i"),Si=new RegExp(O+"|PlayBook|BB10","i"),_i={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};function Ei(i,e){return i.toLowerCase().includes(e.toLowerCase())}var wi=(i,e)=>e&&Ei(e,D)||function(i){return Ei(i,L)&&!Ei(i,W)&&!Ei(i,B)}(i),yi=function(i,e){return e=e||"",Ei(i," OPR/")&&Ei(i,"Mini")?X:Ei(i," OPR/")?z:Si.test(i)?O:Ei(i,"IE"+k)||Ei(i,"WPDesktop")?Z:Ei(i,V)?F:Ei(i,Y)||Ei(i,"Edg/")?Q:Ei(i,"FBIOS")?"Facebook "+k:Ei(i,"UCWEB")||Ei(i,"UCBrowser")?"UC Browser":Ei(i,"CriOS")?H:Ei(i,"CrMo")||Ei(i,W)?W:Ei(i,B)&&Ei(i,L)?ri:Ei(i,"FxiOS")?ii:Ei(i.toLowerCase(),hi.toLowerCase())?hi:wi(i,e)?Ei(i,k)?ni:L:Ei(i,q)?q:Ei(i,"MSIE")||Ei(i,"Trident/")?J:Ei(i,"Gecko")?q:""},Ci={[Z]:[new RegExp("rv:"+mi)],[Q]:[new RegExp(Y+"?\\/"+mi)],[W]:[new RegExp("("+W+"|CrMo)\\/"+mi)],[H]:[new RegExp("CriOS\\/"+mi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+mi)],[L]:[vi],[ni]:[vi],[z]:[new RegExp("(Opera|OPR)\\/"+mi)],[q]:[new RegExp(q+"\\/"+mi)],[ii]:[new RegExp("FxiOS\\/"+mi)],[hi]:[new RegExp("Konqueror[:/]?"+mi,"i")],[O]:[new RegExp(O+" "+mi),vi],[ri]:[new RegExp("android\\s"+mi,"i")],[F]:[new RegExp(V+"\\/"+mi)],[J]:[new RegExp("(rv:|MSIE )"+mi)],Mozilla:[new RegExp("rv:"+mi)]},Pi=[[new RegExp(ti+"; "+ti+" (.*?)[);]","i"),i=>[ti,i&&i[1]||""]],[new RegExp(ei,"i"),[ei,""]],[new RegExp(ai,"i"),[ai,""]],[Si,[O,""]],[new RegExp(si,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[oi,""];if(new RegExp(k).test(e)&&!/IEMobile\b/.test(e))return[si+" "+k,""];var a=/Windows NT ([0-9.]+)/i.exec(e);if(a&&a[1]){var t=a[1],r=_i[t]||"";return/arm/i.test(e)&&(r="RT"),[si,r]}return[si,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[b,e.join(".")]}return[b,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=void 0===i[2]?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+B+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+B+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[B,e.join(".")]}return[B,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];if(i&&i[1]){var a=[i[1],i[2],i[3]||"0"];e[1]=a.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[j,""]],[/Linux|debian/i,["Linux",""]]],Mi=function(i){return gi.test(i)?ei:pi.test(i)?ai:fi.test(i)?ti:new RegExp(ui,"i").test(i)?ui:new RegExp("("+oi+"|WPDesktop)","i").test(i)?oi:/iPad/.test(i)?N:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?K:Si.test(i)?O:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(ci,"i").test(i)?ci:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?!new RegExp(k).test(i)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)?/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?B:x:B:new RegExp("(pda|"+k+")","i").test(i)?di:new RegExp(T,"i").test(i)&&!new RegExp(T+" pc","i").test(i)?li:""};function Ri(){if(void 0!==E)return E.language||E.userLanguage}function Ui(){var i={};if(!M)return i;var[e,a]=function(i){for(var e=0;e<Pi.length;e++){var[a,t]=Pi[e],r=a.exec(i),n=r&&(I(t)?t(r,i):t);if(n)return n}return["",""]}(M);e&&(i.$os=e),a&&(i.$os_version=a);var t=yi(M,null==E?void 0:E.vendor);t&&(i.$browser=t);var r=function(i,e){var a=yi(i,e),t=Ci[a];if(void 0===t)return null;for(var r=0;r<t.length;r++){var n=t[r],s=i.match(n);if(s)return parseFloat(s[s.length-2])}return null}(M,null==E?void 0:E.vendor);r&&(i.$browser_version=r);var n=Mi(M);n&&(i.$device=n);var s=function(i){var e=Mi(i);return e===N||e===x||"Kobo"===e||"Kindle Fire"===e||e===li?T:e===ei||e===ti||e===ai||e===ui?"Console":e===K?"Wearable":e?k:"Desktop"}(M);s&&(i.$device_type=s);var o=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return}}();o&&(i.$timezone=o);var c=function(){try{return(new Date).getTimezoneOffset()}catch(i){return}}();void 0!==c&&(i.$timezone_offset=c),y&&(i.$current_url=y.href,i.$host=y.host,i.$pathname=y.pathname),M&&(i.$raw_user_agent=M.length>1e3?M.substring(0,997)+"...":M);var u,A=Ri(),d="string"==typeof(u=Ri())?u.split("-")[0]:void 0;return A&&(i.$browser_language=A),d&&(i.$browser_language_prefix=d),(null==S?void 0:S.screen)&&(S.screen.height&&(i.$screen_height=S.screen.height),S.screen.width&&(i.$screen_width=S.screen.width)),S&&(S.innerHeight&&(i.$viewport_height=S.innerHeight),S.innerWidth&&(i.$viewport_width=S.innerWidth)),i.$lib="web",i.$lib_version="1.0.7",i.$insert_id=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),i.$time=Date.now()/1e3,i.$referrer=(null==w?void 0:w.referrer)||"$direct",i.$referring_domain=function(){if(!(null==w?void 0:w.referrer))return"$direct";try{return new URL(w.referrer).host||"$direct"}catch(i){return"$direct"}}(),i}class Ii{constructor(i){this.__request_queue=[],this.M=!1,this.config=i,!this.config.domain&&y&&(this.config.domain=this.getCurrentDomain()),this.sessionManager=new R(i.storage||"cookie",this.config.domain),this.userManager=new U(i.persistence||"localStorage",this.config.domain),this.setupIdentifyListener()}getCurrentDomain(){if(!y)return"";var i=y.protocol,e=y.hostname,a=y.port;return i+"//"+e+(a?":"+a:"")}R(){return!(!this.config.projectId||!this.config.token)||(this.M||(console.warn("VTilt: projectId and token are required for tracking. Events will be skipped until init() or updateConfig() is called with these fields."),this.M=!0),!1)}sendEvent(a,t){var r,n=this;return(r=function*(){if(n.sessionManager.setSessionId(),E&&E.userAgent&&function(i){return!(i&&"string"==typeof i&&i.length>500)}(E.userAgent)){var i,r=n.buildUrl(),s=e({},Ui(),{$session_id:n.sessionManager.getSessionId(),$window_id:n.sessionManager.getWindowId()},t);if("$pageview"===a&&w&&(s.title=w.title),!1!==n.config.stringifyPayload){if(i=p(s),i=Object.assign({},JSON.parse(i),n.config.globalAttributes),!f(i=JSON.stringify(i)))return}else{var o=p(i=Object.assign({},s,n.config.globalAttributes));if(!f(o))return;i=JSON.parse(o)}var c=n.userManager.getDistinctId(),u=n.userManager.getAnonymousId(),A={timestamp:(new Date).toISOString(),event:a,tenant_id:n.config.projectId||"",domain:n.config.domain||n.getCurrentDomain(),payload:i,distinct_id:c||u};n.sendRequest(r,A,!0)}},function(){var e=this,a=arguments;return new Promise(function(t,n){var s=r.apply(e,a);function o(e){i(s,t,n,o,c,"next",e)}function c(e){i(s,t,n,o,c,"throw",e)}o(void 0)})})()}buildUrl(){var{proxyUrl:i,proxy:e,host:a,token:t}=this.config;return i||(e?e+"/api/tracking?token="+t:a?a.replace(/\/+$/gm,"")+"/api/tracking?token="+t:"/api/tracking?token="+t)}sendRequest(i,e,a){if(this.R()){if(a&&void 0!==S)if(S.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:i,event:e});var t=new XMLHttpRequest;t.open("POST",i,!0),t.setRequestHeader("Content-Type","application/json"),t.send(JSON.stringify(e))}}U(i){this.sendRequest(i.url,i.event,!1)}getSessionId(){return this.sessionManager.getSessionId()}identify(i,e,a){this.userManager.identify(i,e,a)}setUserProperties(i,e){this.userManager.setUserProperties(i,e)}resetUser(i){this.sessionManager.resetSessionId(),this.userManager.reset(i)}getUserIdentity(){return this.userManager.getUserIdentity()}getDeviceId(){return this.userManager.getDeviceId()}getUserState(){return this.userManager.getUserState()}createAlias(i,e){this.userManager.createAlias(i,e)}setupIdentifyListener(){S&&(S.addEventListener("vtilt:identify",i=>{var e=i,{distinct_id:a,anonymous_id:t,device_id:r,properties:n}=e.detail;this.sendIdentifyEvent(a,t,r,n)}),S.addEventListener("vtilt:set",i=>{var e=i,{$set:a,$set_once:t}=e.detail;this.sendSetEvent(a||{},t||{})}),S.addEventListener("vtilt:alias",i=>{var e=i.detail;this.sendAliasEvent(e)}))}I(){return{session_id:this.sessionManager.getSessionId(),window_id:this.sessionManager.getWindowId()}}k(i,e,a){return{timestamp:(new Date).toISOString(),event:i,tenant_id:this.config.projectId||"",domain:this.config.domain||this.getCurrentDomain(),payload:e,distinct_id:a}}sendIdentifyEvent(i,a,t,r){var{session_id:n,window_id:s}=this.I(),o=e({$session_id:n,$window_id:s,$anon_distinct_id:a,$device_id:t},r),c=this.k("$identify",o,i);this.sendRequest(this.buildUrl(),c,!0)}sendSetEvent(i,e){var{session_id:a,window_id:t}=this.I(),r=this.userManager.getDistinctId(),n=this.userManager.getAnonymousId(),s={$session_id:a,$window_id:t,$set:i||{},$set_once:e||{}},o=this.k("$set",s,r||n);this.sendRequest(this.buildUrl(),o,!0)}sendAliasEvent(i){var{session_id:e,window_id:a}=this.I(),t={$session_id:e,$window_id:a,$original_id:i.original,$alias_id:i.distinct_id},r=this.k("$alias",t,i.distinct_id);this.sendRequest(this.buildUrl(),r,!0)}}class ki{constructor(i,e){if(this.trackingManager=e,i.webVitals&&S)try{this.webVitals=require("web-vitals"),this.initializeWebVitals()}catch(i){console.warn("web-vitals library not found. Please install it to enable web vitals tracking.",i)}}initializeWebVitals(){if(this.webVitals){var i=i=>{try{if(!(S&&w&&E&&y))return;var{country:e,locale:a}=function(){var i,e;if(!E)return{country:i,locale:e};try{var a=Intl.DateTimeFormat().resolvedOptions().timeZone;i=h[a],e=E.languages&&E.languages.length?E.languages[0]:E.userLanguage||E.language||E.browserLanguage||"en"}catch(i){}return{country:i,locale:e}}();this.trackingManager.sendEvent("web_vital",{name:i.name,value:i.value,delta:i.delta,rating:i.rating,id:i.id,navigationType:i.navigationType,pathname:y.pathname,href:y.href,"user-agent":E.userAgent,locale:a,location:e,referrer:w.referrer})}catch(i){console.error("Error sending web vital:",i)}};this.webVitals.onCLS&&this.webVitals.onCLS(i),this.webVitals.onFCP&&this.webVitals.onFCP(i),this.webVitals.onLCP&&this.webVitals.onLCP(i),this.webVitals.onTTFB&&this.webVitals.onTTFB(i),this.webVitals.onINP&&this.webVitals.onINP(i)}}}function bi(i,e,a){try{if(!(e in i))return()=>{};var t=i[e],r=a(t);return I(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),i[e]=r,()=>{i[e]=t}}catch(i){return()=>{}}}class Bi{constructor(i){var e;this._instance=i,this.B=(null===(e=null==S?void 0:S.location)||void 0===e?void 0:e.pathname)||""}get isEnabled(){return!0}startIfEnabled(){this.isEnabled&&this.monitorHistoryChanges()}stop(){this.T&&this.T(),this.T=void 0}monitorHistoryChanges(){var i,e;if(S&&y&&(this.B=y.pathname||"",S.history)){var a=this;(null===(i=S.history.pushState)||void 0===i?void 0:i.__vtilt_wrapped__)||bi(S.history,"pushState",i=>function(e,t,r){i.call(this,e,t,r),a.N("pushState")}),(null===(e=S.history.replaceState)||void 0===e?void 0:e.__vtilt_wrapped__)||bi(S.history,"replaceState",i=>function(e,t,r){i.call(this,e,t,r),a.N("replaceState")}),this.D()}}N(i){var e;try{var a=null===(e=null==S?void 0:S.location)||void 0===e?void 0:e.pathname;if(!a||!y||!w)return;if(a!==this.B&&this.isEnabled){var t={navigation_type:i};this._instance.trackingManager.sendEvent("$pageview",t)}this.B=a}catch(e){console.error("Error capturing "+i+" pageview",e)}}D(){if(!this.T&&S){var i=()=>{this.N("popstate")};g(S,"popstate",i),this.T=()=>{S&&S.removeEventListener("popstate",i)}}}}class Ti{constructor(i){void 0===i&&(i={}),this.__loaded=!1,this.K=!1,this.L=null,this.configManager=new a(i),this.trackingManager=new Ii(this.configManager.getConfig()),this.webVitalsManager=new ki(this.configManager.getConfig(),this.trackingManager)}init(i,e,a){var t;if(a&&a!==Ni){var r=null!==(t=xi[a])&&void 0!==t?t:new Ti;return r._init(i,e,a),xi[a]=r,xi[Ni][a]=r,r}return this._init(i,e,a)}_init(i,a,t){return void 0===a&&(a={}),this.__loaded?(console.warn("vTilt: You have already initialized vTilt! Re-initializing is a no-op"),this):(this.updateConfig(e({},a,{projectId:i||a.projectId,name:t})),this.__loaded=!0,this.historyAutocapture=new Bi(this),this.historyAutocapture.startIfEnabled(),this.O(),this)}toString(){var i,e=null!==(i=this.configManager.getConfig().name)&&void 0!==i?i:Ni;return e!==Ni&&(e=Ni+"."+e),e}trackEvent(i,e){void 0===e&&(e={}),this.trackingManager.sendEvent(i,e)}identify(i,e,a){this.trackingManager.identify(i,e,a)}setUserProperties(i,e){this.trackingManager.setUserProperties(i,e)}resetUser(i){this.trackingManager.resetUser(i)}getUserIdentity(){return this.trackingManager.getUserIdentity()}getDeviceId(){return this.trackingManager.getDeviceId()}getUserState(){return this.trackingManager.getUserState()}createAlias(i,e){this.trackingManager.createAlias(i,e)}O(){w&&("visible"===w.visibilityState?this.K||(this.K=!0,setTimeout(()=>{if(w&&y){this.trackingManager.sendEvent("$pageview",{navigation_type:"initial_load"})}},300),this.L&&(w.removeEventListener("visibilitychange",this.L),this.L=null)):this.L||(this.L=()=>{this.O()},g(w,"visibilitychange",this.L)))}getConfig(){return this.configManager.getConfig()}getSessionId(){return this.trackingManager.getSessionId()}updateConfig(i){this.configManager.updateConfig(i),this.trackingManager=new Ii(this.configManager.getConfig()),this.webVitalsManager=new ki(this.configManager.getConfig(),this.trackingManager)}_execute_array(i){Array.isArray(i)&&i.forEach(i=>{if(i&&Array.isArray(i)&&i.length>0){var e=i[0],a=i.slice(1);if("function"==typeof this[e])try{this[e](...a)}catch(i){console.error("vTilt: Error executing queued call "+e+":",i)}}})}_dom_loaded(){this.trackingManager&&(this.trackingManager.__request_queue.forEach(i=>{this.trackingManager.U(i)}),this.trackingManager.__request_queue=[])}}var xi={},Ni="vt",Di=!(void 0!==P||void 0!==C)&&-1===(null==M?void 0:M.indexOf("MSIE"))&&-1===(null==M?void 0:M.indexOf("Mozilla"));S&&(S.__VTILT_ENQUEUE_REQUESTS=Di);var Ki=function(){function i(){i.done||(i.done=!0,Di=!1,void 0!==S&&(S.__VTILT_ENQUEUE_REQUESTS=!1),function(i,e,a){if(i)if(Array.isArray(i))i.forEach((i,t)=>{e.call(a,i,t)});else for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&e.call(a,i[t],t)}(xi,function(i){i._dom_loaded()}))}w&&"function"==typeof w.addEventListener?"complete"===w.readyState?i():g(w,"DOMContentLoaded",i,{capture:!1}):S&&console.error("Browser doesn't support `document.addEventListener` so vTilt couldn't be initialized")};var Li,Oi=(Li=xi[Ni]=new Ti,Ki(),Li);export{Ti as VTilt,Oi as default,Oi as vt};
1
+ function i(){return i=Object.assign?Object.assign.bind():function(i){for(var a=1;a<arguments.length;a++){var e=arguments[a];for(var t in e)({}).hasOwnProperty.call(e,t)&&(i[t]=e[t])}return i},i.apply(null,arguments)}class a{constructor(i){void 0===i&&(i={}),this.config=this.parseConfigFromScript(i)}parseConfigFromScript(a){if(!document.currentScript)return i({projectId:a.projectId||"",token:a.token||""},a);var e=document.currentScript,t=i({projectId:"",token:""},a);if(t.host=e.getAttribute("data-host")||a.host,t.proxy=e.getAttribute("data-proxy")||a.proxy,t.proxyUrl=e.getAttribute("data-proxy-url")||a.proxyUrl,t.token=e.getAttribute("data-token")||a.token||"",t.projectId=e.getAttribute("data-project-id")||a.projectId||"",t.domain=e.getAttribute("data-domain")||a.domain,t.storage=e.getAttribute("data-storage")||a.storage,t.stringifyPayload="false"!==e.getAttribute("data-stringify-payload"),t.webVitals="true"===e.getAttribute("web-vitals")||"true"===e.getAttribute("data-web-vitals")||a.webVitals,t.proxy&&t.proxyUrl)throw console.error("Error: Both data-proxy and data-proxy-url are specified. Please use only one of them."),new Error("Both data-proxy and data-proxy-url are specified. Please use only one of them.");for(var r of(t.globalAttributes=i({},a.globalAttributes),Array.from(e.attributes)))r.name.startsWith("tb_")&&(t.globalAttributes[r.name.slice(3).replace(/-/g,"_")]=r.value),r.name.startsWith("data-tb-")&&(t.globalAttributes[r.name.slice(8).replace(/-/g,"_")]=r.value);return t}getConfig(){return i({},this.config)}updateConfig(a){this.config=i({},this.config,a)}}var e="vt_session_id",t="vt_window_id",r="vt_primary_window_exists",n="vt_anonymous_id",s="vt_distinct_id",o="vt_device_id",c="vt_user_properties",u="vt_user_state",A="localStorage",l="sessionStorage",h={"Asia/Barnaul":"RU","Africa/Nouakchott":"MR","Africa/Lusaka":"ZM","Asia/Pyongyang":"KP","Europe/Bratislava":"SK","America/Belize":"BZ","America/Maceio":"BR","Pacific/Chuuk":"FM","Indian/Comoro":"KM","Pacific/Palau":"PW","Asia/Jakarta":"ID","Africa/Windhoek":"NA","America/Chihuahua":"MX","America/Nome":"US","Africa/Mbabane":"SZ","Africa/Porto-Novo":"BJ","Europe/San_Marino":"SM","Pacific/Fakaofo":"TK","America/Denver":"US","Europe/Belgrade":"RS","America/Indiana/Tell_City":"US","America/Fortaleza":"BR","America/Halifax":"CA","Europe/Bucharest":"RO","America/Indiana/Petersburg":"US","Europe/Kirov":"RU","Europe/Athens":"GR","America/Argentina/Ushuaia":"AR","Europe/Monaco":"MC","Europe/Vilnius":"LT","Europe/Copenhagen":"DK","Pacific/Kanton":"KI","America/Caracas":"VE","Asia/Almaty":"KZ","Europe/Paris":"FR","Africa/Blantyre":"MW","Asia/Muscat":"OM","America/North_Dakota/Beulah":"US","America/Matamoros":"MX","Asia/Irkutsk":"RU","America/Costa_Rica":"CR","America/Araguaina":"BR","Atlantic/Canary":"ES","America/Santo_Domingo":"DO","America/Vancouver":"CA","Africa/Addis_Ababa":"ET","Africa/Accra":"GH","Pacific/Kwajalein":"MH","Asia/Baghdad":"IQ","Australia/Adelaide":"AU","Australia/Hobart":"AU","America/Guayaquil":"EC","America/Argentina/Tucuman":"AR","Australia/Lindeman":"AU","America/New_York":"US","Pacific/Fiji":"FJ","America/Antigua":"AG","Africa/Casablanca":"MA","America/Paramaribo":"SR","Africa/Cairo":"EG","America/Cayenne":"GF","America/Detroit":"US","Antarctica/Syowa":"AQ","Africa/Douala":"CM","America/Argentina/La_Rioja":"AR","Africa/Lagos":"NG","America/St_Barthelemy":"BL","Asia/Nicosia":"CY","Asia/Macau":"MO","Europe/Riga":"LV","Asia/Ashgabat":"TM","Indian/Antananarivo":"MG","America/Argentina/San_Juan":"AR","Asia/Aden":"YE","Asia/Tomsk":"RU","America/Asuncion":"PY","Pacific/Bougainville":"PG","Asia/Vientiane":"LA","America/Mazatlan":"MX","Africa/Luanda":"AO","Europe/Oslo":"NO","Africa/Kinshasa":"CD","Europe/Warsaw":"PL","America/Grand_Turk":"TC","Asia/Seoul":"KR","Africa/Tripoli":"LY","America/St_Thomas":"VI","Asia/Kathmandu":"NP","Pacific/Pitcairn":"PN","Pacific/Nauru":"NR","America/Curacao":"CW","Asia/Kabul":"AF","Pacific/Tongatapu":"TO","Europe/Simferopol":"UA","Asia/Ust-Nera":"RU","Africa/Mogadishu":"SO","Indian/Mayotte":"YT","Pacific/Niue":"NU","America/Thunder_Bay":"CA","Atlantic/Azores":"PT","Pacific/Gambier":"PF","Europe/Stockholm":"SE","Africa/Libreville":"GA","America/Punta_Arenas":"CL","America/Guatemala":"GT","America/Noronha":"BR","Europe/Helsinki":"FI","Asia/Gaza":"PS","Pacific/Kosrae":"FM","America/Aruba":"AW","America/Nassau":"BS","Asia/Choibalsan":"MN","America/Winnipeg":"CA","America/Anguilla":"AI","Asia/Thimphu":"BT","Asia/Beirut":"LB","Atlantic/Faroe":"FO","Europe/Berlin":"DE","Europe/Amsterdam":"NL","Pacific/Honolulu":"US","America/Regina":"CA","America/Scoresbysund":"GL","Europe/Vienna":"AT","Europe/Tirane":"AL","Africa/El_Aaiun":"EH","America/Creston":"CA","Asia/Qostanay":"KZ","Asia/Ho_Chi_Minh":"VN","Europe/Samara":"RU","Europe/Rome":"IT","Australia/Eucla":"AU","America/El_Salvador":"SV","America/Chicago":"US","Africa/Abidjan":"CI","Asia/Kamchatka":"RU","Pacific/Tarawa":"KI","America/Santiago":"CL","America/Bahia":"BR","Indian/Christmas":"CX","Asia/Atyrau":"KZ","Asia/Dushanbe":"TJ","Europe/Ulyanovsk":"RU","America/Yellowknife":"CA","America/Recife":"BR","Australia/Sydney":"AU","America/Fort_Nelson":"CA","Pacific/Efate":"VU","Europe/Saratov":"RU","Africa/Banjul":"GM","Asia/Omsk":"RU","Europe/Ljubljana":"SI","Europe/Budapest":"HU","Europe/Astrakhan":"RU","America/Argentina/Buenos_Aires":"AR","Pacific/Chatham":"NZ","America/Argentina/Salta":"AR","Africa/Niamey":"NE","Asia/Pontianak":"ID","Indian/Reunion":"RE","Asia/Hong_Kong":"HK","Antarctica/McMurdo":"AQ","Africa/Malabo":"GQ","America/Los_Angeles":"US","America/Argentina/Cordoba":"AR","Pacific/Pohnpei":"FM","America/Tijuana":"MX","America/Campo_Grande":"BR","America/Dawson_Creek":"CA","Asia/Novosibirsk":"RU","Pacific/Pago_Pago":"AS","Asia/Jerusalem":"IL","Europe/Sarajevo":"BA","Africa/Freetown":"SL","Asia/Yekaterinburg":"RU","America/Juneau":"US","Africa/Ouagadougou":"BF","Africa/Monrovia":"LR","Europe/Kiev":"UA","America/Argentina/San_Luis":"AR","Asia/Tokyo":"JP","Asia/Qatar":"QA","America/La_Paz":"BO","America/Bogota":"CO","America/Thule":"GL","Asia/Manila":"PH","Asia/Hovd":"MN","Asia/Tehran":"IR","Atlantic/Madeira":"PT","America/Metlakatla":"US","Europe/Vatican":"VA","Asia/Bishkek":"KG","Asia/Dili":"TL","Antarctica/Palmer":"AQ","Atlantic/Cape_Verde":"CV","Indian/Chagos":"IO","America/Kentucky/Monticello":"US","Africa/Algiers":"DZ","Africa/Maseru":"LS","Asia/Kuala_Lumpur":"MY","Africa/Khartoum":"SD","America/Argentina/Rio_Gallegos":"AR","America/Blanc-Sablon":"CA","Africa/Maputo":"MZ","America/Tortola":"VG","Atlantic/Bermuda":"BM","America/Argentina/Catamarca":"AR","America/Cayman":"KY","America/Puerto_Rico":"PR","Pacific/Majuro":"MH","Europe/Busingen":"DE","Pacific/Midway":"UM","Indian/Cocos":"CC","Asia/Singapore":"SG","America/Boise":"US","America/Nuuk":"GL","America/Goose_Bay":"CA","Australia/Broken_Hill":"AU","Africa/Dar_es_Salaam":"TZ","Africa/Asmara":"ER","Asia/Samarkand":"UZ","Asia/Tbilisi":"GE","America/Argentina/Jujuy":"AR","America/Indiana/Winamac":"US","America/Porto_Velho":"BR","Asia/Magadan":"RU","Europe/Zaporozhye":"UA","Antarctica/Casey":"AQ","Asia/Shanghai":"CN","Pacific/Norfolk":"NF","Europe/Guernsey":"GG","Australia/Brisbane":"AU","Antarctica/DumontDUrville":"AQ","America/Havana":"CU","America/Atikokan":"CA","America/Mexico_City":"MX","America/Rankin_Inlet":"CA","America/Cuiaba":"BR","America/Resolute":"CA","Africa/Ceuta":"ES","Arctic/Longyearbyen":"SJ","Pacific/Guam":"GU","Asia/Damascus":"SY","Asia/Colombo":"LK","Asia/Yerevan":"AM","America/Montserrat":"MS","America/Belem":"BR","Europe/Kaliningrad":"RU","Atlantic/South_Georgia":"GS","Asia/Tashkent":"UZ","Asia/Kolkata":"IN","America/St_Johns":"CA","Asia/Srednekolymsk":"RU","Asia/Yakutsk":"RU","Europe/Prague":"CZ","Africa/Djibouti":"DJ","Asia/Dubai":"AE","Europe/Uzhgorod":"UA","America/Edmonton":"CA","Asia/Famagusta":"CY","America/Indiana/Knox":"US","Asia/Hebron":"PS","Asia/Taipei":"TW","Europe/London":"GB","Africa/Dakar":"SN","Australia/Darwin":"AU","America/Glace_Bay":"CA","Antarctica/Vostok":"AQ","America/Indiana/Vincennes":"US","America/Nipigon":"CA","Asia/Kuwait":"KW","Pacific/Guadalcanal":"SB","America/Toronto":"CA","Africa/Gaborone":"BW","Africa/Bujumbura":"BI","Africa/Lubumbashi":"CD","America/Merida":"MX","America/Marigot":"MF","Europe/Zagreb":"HR","Pacific/Easter":"CL","America/Santarem":"BR","Pacific/Noumea":"NC","America/Sitka":"US","Atlantic/Stanley":"FK","Pacific/Funafuti":"TV","America/Iqaluit":"CA","America/Rainy_River":"CA","America/Anchorage":"US","America/Lima":"PE","Asia/Baku":"AZ","America/Indiana/Vevay":"US","Asia/Ulaanbaatar":"MN","America/Managua":"NI","Asia/Krasnoyarsk":"RU","Asia/Qyzylorda":"KZ","America/Eirunepe":"BR","Europe/Podgorica":"ME","Europe/Chisinau":"MD","Europe/Mariehamn":"AX","Europe/Volgograd":"RU","Africa/Nairobi":"KE","Europe/Isle_of_Man":"IM","America/Menominee":"US","Africa/Harare":"ZW","Asia/Anadyr":"RU","America/Moncton":"CA","Indian/Maldives":"MV","America/Whitehorse":"CA","Antarctica/Mawson":"AQ","Europe/Madrid":"ES","America/Argentina/Mendoza":"AR","America/Manaus":"BR","Africa/Bangui":"CF","Indian/Mauritius":"MU","Africa/Tunis":"TN","Australia/Lord_Howe":"AU","America/Kentucky/Louisville":"US","America/North_Dakota/Center":"US","Asia/Novokuznetsk":"RU","Asia/Makassar":"ID","America/Port_of_Spain":"TT","America/Bahia_Banderas":"MX","Pacific/Auckland":"NZ","America/Sao_Paulo":"BR","Asia/Dhaka":"BD","America/Pangnirtung":"CA","Europe/Dublin":"IE","Asia/Brunei":"BN","Africa/Brazzaville":"CG","America/Montevideo":"UY","America/Jamaica":"JM","America/Indiana/Indianapolis":"US","America/Kralendijk":"BQ","Europe/Gibraltar":"GI","Pacific/Marquesas":"PF","Pacific/Apia":"WS","Europe/Jersey":"JE","America/Phoenix":"US","Africa/Ndjamena":"TD","Asia/Karachi":"PK","Africa/Kampala":"UG","Asia/Sakhalin":"RU","America/Martinique":"MQ","Europe/Moscow":"RU","Africa/Conakry":"GN","America/Barbados":"BB","Africa/Lome":"TG","America/Ojinaga":"MX","America/Tegucigalpa":"HN","Asia/Bangkok":"TH","Africa/Johannesburg":"ZA","Europe/Vaduz":"LI","Africa/Sao_Tome":"ST","America/Cambridge_Bay":"CA","America/Lower_Princes":"SX","America/Miquelon":"PM","America/St_Kitts":"KN","Australia/Melbourne":"AU","Europe/Minsk":"BY","Asia/Vladivostok":"RU","Europe/Sofia":"BG","Antarctica/Davis":"AQ","Pacific/Galapagos":"EC","America/North_Dakota/New_Salem":"US","Asia/Amman":"JO","Pacific/Wallis":"WF","America/Hermosillo":"MX","Pacific/Kiritimati":"KI","Antarctica/Macquarie":"AU","America/Guyana":"GY","Asia/Riyadh":"SA","Pacific/Tahiti":"PF","America/St_Vincent":"VC","America/Cancun":"MX","America/Grenada":"GD","Pacific/Wake":"UM","America/Dawson":"CA","Europe/Brussels":"BE","Indian/Kerguelen":"TF","America/Yakutat":"US","Indian/Mahe":"SC","Atlantic/Reykjavik":"IS","America/Panama":"PA","America/Guadeloupe":"GP","Europe/Malta":"MT","Antarctica/Troll":"AQ","Asia/Jayapura":"ID","Asia/Bahrain":"BH","Asia/Chita":"RU","Europe/Tallinn":"EE","Asia/Khandyga":"RU","America/Rio_Branco":"BR","Atlantic/St_Helena":"SH","Africa/Juba":"SS","America/Adak":"US","Pacific/Saipan":"MP","America/St_Lucia":"LC","America/Inuvik":"CA","Europe/Luxembourg":"LU","Africa/Bissau":"GW","Asia/Oral":"KZ","America/Boa_Vista":"BR","Europe/Skopje":"MK","America/Port-au-Prince":"HT","Pacific/Port_Moresby":"PG","Europe/Andorra":"AD","America/Indiana/Marengo":"US","Africa/Kigali":"RW","Africa/Bamako":"ML","America/Dominica":"DM","Asia/Aqtobe":"KZ","Europe/Istanbul":"TR","Pacific/Rarotonga":"CK","America/Danmarkshavn":"GL","Europe/Zurich":"CH","Asia/Yangon":"MM","America/Monterrey":"MX","Europe/Lisbon":"PT","Asia/Kuching":"MY","Antarctica/Rothera":"AQ","Australia/Perth":"AU","Asia/Phnom_Penh":"KH","America/Swift_Current":"CA","Asia/Aqtau":"KZ","Asia/Urumqi":"CN","Asia/Calcutta":"IN"};function d(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+i/4).toString(16))}function m(i){return!(!i||"string"!=typeof i)&&!(i.length<2||i.length>10240)}function f(i,a,e,t){var{capture:r=!1,passive:n=!0}=null!=t?t:{};null==i||i.addEventListener(a,e,{capture:r,passive:n})}var p="undefined"!=typeof window?window:void 0,v="undefined"!=typeof globalThis?globalThis:p,g=null==v?void 0:v.navigator,S=null==v?void 0:v.document,_=null==v?void 0:v.location,E=null==v?void 0:v.fetch,y=(null==v?void 0:v.XMLHttpRequest)&&"withCredentials"in new v.XMLHttpRequest?v.XMLHttpRequest:void 0;null==v||v.AbortController;var P=null==g?void 0:g.userAgent;class C{constructor(i,a){void 0===i&&(i="cookie"),this.storageMethod=i,this.domain=a,this.i=void 0,this.t()}o(){return this.storageMethod===A||this.storageMethod===l}u(){return this.o()?this.storageMethod===A?localStorage:sessionStorage:null}A(i){return{value:i,expiry:(new Date).getTime()+18e5}}l(i){var a=this.u();if(a){var t=this.A(i);a.setItem(e,JSON.stringify(t))}}getSessionIdFromCookie(){var i={};return document.cookie.split(";").forEach(function(a){var[e,t]=a.split("=");i[e.trim()]=t}),i[e]||null}setSessionIdFromCookie(i){var a=e+"="+i+"; Max-Age=1800; path=/; secure";this.domain&&(a+="; domain="+this.domain),document.cookie=a}h(i){this.o()?this.l(i):this.setSessionIdFromCookie(i)}m(){var i=this.u();if(i){var a=i.getItem(e);if(!a)return null;var t=null;try{t=JSON.parse(a)}catch(i){return null}return"object"!=typeof t||null===t?null:(new Date).getTime()>t.expiry?(i.removeItem(e),null):t.value}return this.getSessionIdFromCookie()}getSessionId(){var i=this.m();return i||(i=d(),this.h(i)),i}setSessionId(){var i=this.m()||d();return this.h(i),i}p(){var i=this.u();if(i)i.removeItem(e);else{var a="Thu, 01 Jan 1970 00:00:00 UTC";document.cookie=e+"=; expires="+a+"; path=/;",this.domain&&(document.cookie=e+"=; expires="+a+"; path=/; domain="+this.domain+";")}}resetSessionId(){this.p(),this.setSessionId(),this.v(d())}getWindowId(){if(this.i)return this.i;if(this.S()&&p){var i=p.sessionStorage.getItem(t);if(i)return this.i=i,i}var a=d();return this.v(a),a}v(i){i!==this.i&&(this.i=i,this.S()&&p&&p.sessionStorage.setItem(t,i))}S(){if(void 0===p||!p.sessionStorage)return!1;try{var i="__vt_session_storage_test__";return p.sessionStorage.setItem(i,"test"),p.sessionStorage.removeItem(i),!0}catch(i){return!1}}t(){if(this.S()&&p){var i=p.sessionStorage.getItem(r),a=p.sessionStorage.getItem(t);a&&!i?this.i=a:(a&&p.sessionStorage.removeItem(t),this.v(d())),p.sessionStorage.setItem(r,"true"),this.P()}else this.i=d()}P(){p&&this.S()&&f(p,"beforeunload",()=>{p&&p.sessionStorage&&p.sessionStorage.removeItem(r)},{capture:!1})}}class w{constructor(i,a){void 0===i&&(i="localStorage"),this.C=null,this.storageMethod=i,this.domain=a,this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return i({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.saveUserIdentity()),this.userIdentity.anonymous_id}getUserProperties(){return i({},this.userIdentity.properties)}identify(a,e,t){if("number"==typeof a&&(a=a.toString(),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),a)if(this.isDistinctIdStringLike(a))console.error('The string "'+a+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==a){var r=this.userIdentity.distinct_id;if(this.userIdentity.anonymous_id,this.userIdentity.device_id,this.userIdentity.distinct_id=a,!this.userIdentity.device_id){var n=r||this.userIdentity.anonymous_id;this.userIdentity.device_id=n,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:n})}a!==r&&(this.userIdentity.distinct_id=a);var s="anonymous"===this.userIdentity.user_state;a!==r&&s?(this.userIdentity.user_state="identified",e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),t&&Object.keys(t).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=t[i])}),this.saveUserIdentity()):e||t?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),t&&Object.keys(t).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=t[i])}),this.saveUserIdentity()):a!==r&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+a+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(a,e){if(!a&&!e)return!1;var t=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,r=this.getPersonPropertiesHash(t,a,e);return this.C===r?(console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored."),!1):(a&&(this.userIdentity.properties=i({},this.userIdentity.properties,a)),e&&Object.keys(e).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=e[i])}),this.saveUserIdentity(),this.C=r,!0)}getPersonPropertiesHash(i,a,e){return JSON.stringify({distinct_id:i,userPropertiesToSet:a,userPropertiesToSetOnce:e})}reset(a){var e=this.generateAnonymousId(),t=this.userIdentity.device_id,r=a?this.generateDeviceId():t;this.userIdentity={distinct_id:null,anonymous_id:e,device_id:r,properties:{},user_state:"anonymous"},this.C=null,this.saveUserIdentity(),this.userIdentity.properties=i({},this.userIdentity.properties,{$last_vtilt_reset:(new Date).toISOString()}),this.saveUserIdentity()}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}setDistinctId(i){this.userIdentity.distinct_id=i,this.saveUserIdentity()}setUserState(i){this.userIdentity.user_state=i,this.saveUserIdentity()}updateUserProperties(a,e){a&&(this.userIdentity.properties=i({},this.userIdentity.properties,a)),e&&Object.keys(e).forEach(i=>{i in this.userIdentity.properties||(this.userIdentity.properties[i]=e[i])}),this.saveUserIdentity()}ensureDeviceId(a){this.userIdentity.device_id||(this.userIdentity.device_id=a,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:a}),this.saveUserIdentity())}isDistinctIdStringLikePublic(i){return this.isDistinctIdStringLike(i)}createAlias(i,a){return this.isValidDistinctId(i)?(void 0===a&&(a=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(a)?i===a?(console.warn("alias matches current distinct_id - should use identify instead"),null):{distinct_id:i,original:a}:(console.warn("Invalid original distinct ID"),null)):(console.warn("Invalid alias provided"),null)}isValidDistinctId(i){if(!i||"string"!=typeof i)return!1;var a=i.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(a)&&0!==i.trim().length}isDistinctIdStringLike(i){if(!i||"string"!=typeof i)return!1;var a=i.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(a)}loadUserIdentity(){var i=this.getStoredValue(n)||this.generateAnonymousId(),a=this.getStoredValue(s)||null,e=this.getStoredValue(o)||this.generateDeviceId(),t=this.getStoredUserProperties(),r=this.getStoredValue(u)||"anonymous";return{distinct_id:a,anonymous_id:i||this.generateAnonymousId(),device_id:e,properties:t,user_state:r}}saveUserIdentity(){this.setStoredValue(n,this.userIdentity.anonymous_id),this.setStoredValue(o,this.userIdentity.device_id),this.setStoredValue(u,this.userIdentity.user_state),this.userIdentity.distinct_id?this.setStoredValue(s,this.userIdentity.distinct_id):this.removeStoredValue(s),this.setStoredUserProperties(this.userIdentity.properties)}generateAnonymousId(){return"anon_"+d()}generateDeviceId(){return"device_"+d()}getStoredValue(i){try{return this.storageMethod===A?localStorage.getItem(i):this.storageMethod===l?sessionStorage.getItem(i):this.getCookieValue(i)}catch(i){return console.warn("Failed to access storage:",i),null}}setStoredValue(i,a){try{this.storageMethod===A?localStorage.setItem(i,a):this.storageMethod===l?sessionStorage.setItem(i,a):this.setCookieValue(i,a)}catch(i){console.warn("Failed to save to storage:",i)}}removeStoredValue(i){this.storageMethod===A?localStorage.removeItem(i):this.storageMethod===l?sessionStorage.removeItem(i):this.removeCookieValue(i)}getStoredUserProperties(){var i=this.getStoredValue(c);if(!i)return{};try{return JSON.parse(i)}catch(i){return{}}}setStoredUserProperties(i){this.setStoredValue(c,JSON.stringify(i))}getCookieValue(i){var a=document.cookie.split(";");for(var e of a){var[t,r]=e.trim().split("=");if(t===i)return decodeURIComponent(r)}return null}setCookieValue(i,a){var e=i+"="+encodeURIComponent(a)+"; Max-Age=31536000; path=/; secure; SameSite=Lax";this.domain&&(e+="; domain="+this.domain),document.cookie=e}removeCookieValue(i){var a=i+"=; Max-Age=0; path=/";this.domain&&(a+="; domain="+this.domain),document.cookie=a}}class M{constructor(i,a){if(this.instance=a,i.webVitals&&p)try{this.webVitals=require("web-vitals"),this.initializeWebVitals()}catch(i){console.warn("web-vitals library not found. Please install it to enable web vitals tracking.",i)}}initializeWebVitals(){if(this.webVitals){var i=i=>{try{if(!(p&&S&&g&&_))return;var{country:a,locale:e}=function(){var i,a;if(!g)return{country:i,locale:a};try{var e=Intl.DateTimeFormat().resolvedOptions().timeZone;i=h[e],a=g.languages&&g.languages.length?g.languages[0]:g.userLanguage||g.language||g.browserLanguage||"en"}catch(i){}return{country:i,locale:a}}();this.instance.capture("web_vital",{name:i.name,value:i.value,delta:i.delta,rating:i.rating,id:i.id,navigationType:i.navigationType,pathname:_.pathname,href:_.href,"user-agent":g.userAgent,locale:e,location:a,referrer:S.referrer})}catch(i){console.error("Error sending web vital:",i)}};this.webVitals.onCLS&&this.webVitals.onCLS(i),this.webVitals.onFCP&&this.webVitals.onFCP(i),this.webVitals.onLCP&&this.webVitals.onLCP(i),this.webVitals.onTTFB&&this.webVitals.onTTFB(i),this.webVitals.onINP&&this.webVitals.onINP(i)}}}function R(i){return"function"==typeof i}function U(i,a,e){try{if(!(a in i))return()=>{};var t=i[a],r=e(t);return R(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),i[a]=r,()=>{i[a]=t}}catch(i){return()=>{}}}class b{constructor(i){var a;this._instance=i,this.M=(null===(a=null==p?void 0:p.location)||void 0===a?void 0:a.pathname)||""}get isEnabled(){return!0}startIfEnabled(){this.isEnabled&&this.monitorHistoryChanges()}stop(){this.R&&this.R(),this.R=void 0}monitorHistoryChanges(){var i,a;if(p&&_&&(this.M=_.pathname||"",p.history)){var e=this;(null===(i=p.history.pushState)||void 0===i?void 0:i.__vtilt_wrapped__)||U(p.history,"pushState",i=>function(a,t,r){i.call(this,a,t,r),e.U("pushState")}),(null===(a=p.history.replaceState)||void 0===a?void 0:a.__vtilt_wrapped__)||U(p.history,"replaceState",i=>function(a,t,r){i.call(this,a,t,r),e.U("replaceState")}),this.I()}}U(i){var a;try{var e=null===(a=null==p?void 0:p.location)||void 0===a?void 0:a.pathname;if(!e||!_||!S)return;if(e!==this.M&&this.isEnabled){var t={navigation_type:i};this._instance.capture("$pageview",t)}this.M=e}catch(a){console.error("Error capturing "+i+" pageview",a)}}I(){if(!this.R&&p){var i=()=>{this.U("popstate")};f(p,"popstate",i),this.R=()=>{p&&p.removeEventListener("popstate",i)}}}}var I="Mobile",k="iOS",T="Android",B="Tablet",N=T+" "+B,D="iPad",x="Apple",K=x+" Watch",L="Safari",O="BlackBerry",G="Samsung",V=G+"Browser",F=G+" Internet",j="Chrome",W=j+" OS",H=j+" "+k,J="Internet Explorer",Z=J+" "+I,z="Opera",q=z+" Mini",X="Edge",Y="Microsoft "+X,Q="Firefox",ii=Q+" "+k,ai="Nintendo",ei="PlayStation",ti="Xbox",ri=T+" "+I,ni=I+" "+L,si="Windows",oi=si+" Phone",ci="Nokia",ui="Ouya",Ai="Generic",li=Ai+" "+I.toLowerCase(),hi=Ai+" "+B.toLowerCase(),di="Konqueror",mi="(\\d+(\\.\\d+)?)",fi=new RegExp("Version/"+mi),pi=new RegExp(ti,"i"),vi=new RegExp(ei+" \\w+","i"),gi=new RegExp(ai+" \\w+","i"),Si=new RegExp(O+"|PlayBook|BB10","i"),_i={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};function Ei(i,a){return i.toLowerCase().includes(a.toLowerCase())}var yi=(i,a)=>a&&Ei(a,x)||function(i){return Ei(i,L)&&!Ei(i,j)&&!Ei(i,T)}(i),Pi=function(i,a){return a=a||"",Ei(i," OPR/")&&Ei(i,"Mini")?q:Ei(i," OPR/")?z:Si.test(i)?O:Ei(i,"IE"+I)||Ei(i,"WPDesktop")?Z:Ei(i,V)?F:Ei(i,X)||Ei(i,"Edg/")?Y:Ei(i,"FBIOS")?"Facebook "+I:Ei(i,"UCWEB")||Ei(i,"UCBrowser")?"UC Browser":Ei(i,"CriOS")?H:Ei(i,"CrMo")||Ei(i,j)?j:Ei(i,T)&&Ei(i,L)?ri:Ei(i,"FxiOS")?ii:Ei(i.toLowerCase(),di.toLowerCase())?di:yi(i,a)?Ei(i,I)?ni:L:Ei(i,Q)?Q:Ei(i,"MSIE")||Ei(i,"Trident/")?J:Ei(i,"Gecko")?Q:""},Ci={[Z]:[new RegExp("rv:"+mi)],[Y]:[new RegExp(X+"?\\/"+mi)],[j]:[new RegExp("("+j+"|CrMo)\\/"+mi)],[H]:[new RegExp("CriOS\\/"+mi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+mi)],[L]:[fi],[ni]:[fi],[z]:[new RegExp("(Opera|OPR)\\/"+mi)],[Q]:[new RegExp(Q+"\\/"+mi)],[ii]:[new RegExp("FxiOS\\/"+mi)],[di]:[new RegExp("Konqueror[:/]?"+mi,"i")],[O]:[new RegExp(O+" "+mi),fi],[ri]:[new RegExp("android\\s"+mi,"i")],[F]:[new RegExp(V+"\\/"+mi)],[J]:[new RegExp("(rv:|MSIE )"+mi)],Mozilla:[new RegExp("rv:"+mi)]},wi=[[new RegExp(ti+"; "+ti+" (.*?)[);]","i"),i=>[ti,i&&i[1]||""]],[new RegExp(ai,"i"),[ai,""]],[new RegExp(ei,"i"),[ei,""]],[Si,[O,""]],[new RegExp(si,"i"),(i,a)=>{if(/Phone/.test(a)||/WPDesktop/.test(a))return[oi,""];if(new RegExp(I).test(a)&&!/IEMobile\b/.test(a))return[si+" "+I,""];var e=/Windows NT ([0-9.]+)/i.exec(a);if(e&&e[1]){var t=e[1],r=_i[t]||"";return/arm/i.test(a)&&(r="RT"),[si,r]}return[si,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var a=[i[3],i[4],i[5]||"0"];return[k,a.join(".")]}return[k,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var a="";return i&&i.length>=3&&(a=void 0===i[2]?i[3]:i[2]),["watchOS",a]}],[new RegExp("("+T+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+T+")","i"),i=>{if(i&&i[2]){var a=[i[2],i[3],i[4]||"0"];return[T,a.join(".")]}return[T,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var a=["Mac OS X",""];if(i&&i[1]){var e=[i[1],i[2],i[3]||"0"];a[1]=e.join(".")}return a}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[W,""]],[/Linux|debian/i,["Linux",""]]],Mi=function(i){return gi.test(i)?ai:vi.test(i)?ei:pi.test(i)?ti:new RegExp(ui,"i").test(i)?ui:new RegExp("("+oi+"|WPDesktop)","i").test(i)?oi:/iPad/.test(i)?D:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?K:Si.test(i)?O:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(ci,"i").test(i)?ci:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?!new RegExp(I).test(i)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)?/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?T:N:T:new RegExp("(pda|"+I+")","i").test(i)?li:new RegExp(B,"i").test(i)&&!new RegExp(B+" pc","i").test(i)?hi:""};function Ri(){if(void 0!==g)return g.language||g.userLanguage}function Ui(){var i={};if(!P)return i;var[a,e]=function(i){for(var a=0;a<wi.length;a++){var[e,t]=wi[a],r=e.exec(i),n=r&&(R(t)?t(r,i):t);if(n)return n}return["",""]}(P);a&&(i.$os=a),e&&(i.$os_version=e);var t=Pi(P,null==g?void 0:g.vendor);t&&(i.$browser=t);var r=function(i,a){var e=Pi(i,a),t=Ci[e];if(void 0===t)return null;for(var r=0;r<t.length;r++){var n=t[r],s=i.match(n);if(s)return parseFloat(s[s.length-2])}return null}(P,null==g?void 0:g.vendor);r&&(i.$browser_version=r);var n=Mi(P);n&&(i.$device=n);var s=function(i){var a=Mi(i);return a===D||a===N||"Kobo"===a||"Kindle Fire"===a||a===hi?B:a===ai||a===ti||a===ei||a===ui?"Console":a===K?"Wearable":a?I:"Desktop"}(P);s&&(i.$device_type=s);var o=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return}}();o&&(i.$timezone=o);var c=function(){try{return(new Date).getTimezoneOffset()}catch(i){return}}();void 0!==c&&(i.$timezone_offset=c),_&&(i.$current_url=_.href,i.$host=_.host,i.$pathname=_.pathname),P&&(i.$raw_user_agent=P.length>1e3?P.substring(0,997)+"...":P);var u,A=Ri(),l="string"==typeof(u=Ri())?u.split("-")[0]:void 0;return A&&(i.$browser_language=A),l&&(i.$browser_language_prefix=l),(null==p?void 0:p.screen)&&(p.screen.height&&(i.$screen_height=p.screen.height),p.screen.width&&(i.$screen_width=p.screen.width)),p&&(p.innerHeight&&(i.$viewport_height=p.innerHeight),p.innerWidth&&(i.$viewport_width=p.innerWidth)),i.$lib="web",i.$lib_version="1.0.7",i.$insert_id=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),i.$time=Date.now()/1e3,i.$referrer=(null==S?void 0:S.referrer)||"$direct",i.$referring_domain=function(){if(!(null==S?void 0:S.referrer))return"$direct";try{return new URL(S.referrer).host||"$direct"}catch(i){return"$direct"}}(),i}class bi{constructor(i){void 0===i&&(i={}),this.__loaded=!1,this.k=!1,this.T=null,this.__request_queue=[],this.B=!1,this.configManager=new a(i);var e=this.configManager.getConfig(),t=e.domain;!t&&_&&(t=this.getCurrentDomain()),this.sessionManager=new C(e.storage||"cookie",t),this.userManager=new w(e.persistence||"localStorage",t),this.webVitalsManager=new M(e,this)}init(i,a,e){var t;if(e&&e!==ki){var r=null!==(t=Ii[e])&&void 0!==t?t:new bi;return r._init(i,a,e),Ii[e]=r,Ii[ki][e]=r,r}return this._init(i,a,e)}_init(a,e,t){return void 0===e&&(e={}),this.__loaded?(console.warn("vTilt: You have already initialized vTilt! Re-initializing is a no-op"),this):(this.updateConfig(i({},e,{projectId:a||e.projectId,name:t})),this.__loaded=!0,this.historyAutocapture=new b(this),this.historyAutocapture.startIfEnabled(),this.N(),this)}toString(){var i,a=null!==(i=this.configManager.getConfig().name)&&void 0!==i?i:ki;return a!==ki&&(a=ki+"."+a),a}getCurrentDomain(){if(!_)return"";var i=_.protocol,a=_.hostname,e=_.port;return i+"//"+a+(e?":"+e:"")}D(){var i=this.configManager.getConfig();return!(!i.projectId||!i.token)||(this.B||(console.warn("VTilt: projectId and token are required for tracking. Events will be skipped until init() or updateConfig() is called with these fields."),this.B=!0),!1)}buildUrl(){var i=this.configManager.getConfig(),{proxyUrl:a,proxy:e,host:t,token:r}=i;return a||(e?e+"/api/tracking?token="+r:t?t.replace(/\/+$/gm,"")+"/api/tracking?token="+r:"/api/tracking?token="+r)}sendRequest(i,a,e){if(this.D()){if(e&&void 0!==p)if(p.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:i,event:a});var t=new XMLHttpRequest;t.open("POST",i,!0),t.setRequestHeader("Content-Type","application/json"),t.send(JSON.stringify(a))}}K(i){this.sendRequest(i.url,i.event,!1)}capture(a,e){if(this.sessionManager.setSessionId(),g&&g.userAgent&&function(i){return!(i&&"string"==typeof i&&i.length>500)}(g.userAgent)){var t=this.buildUrl(),r=Ui(),n=this.userManager.getUserProperties(),s=this.sessionManager.getSessionId(),o=this.sessionManager.getWindowId(),c=this.userManager.getAnonymousId(),u=i({},r,n,{$session_id:s,$window_id:o},c?{$anon_distinct_id:c}:{},e);"$pageview"===a&&S&&(u.title=S.title);var A,l,h=this.configManager.getConfig();if(!1!==h.stringifyPayload){if(A=Object.assign({},u,h.globalAttributes),!m(A=JSON.stringify(A)))return}else if(A=Object.assign({},u,h.globalAttributes),!m(JSON.stringify(A)))return;l="$identify"===a?this.userManager.getAnonymousId():this.userManager.getDistinctId()||this.userManager.getAnonymousId();var d={timestamp:(new Date).toISOString(),event:a,tenant_id:h.projectId||"",domain:h.domain||this.getCurrentDomain(),payload:A,distinct_id:l,anonymous_id:c};this.sendRequest(t,d,!0)}}trackEvent(i,a){void 0===a&&(a={}),this.capture(i,a)}identify(i,a,e){if("number"==typeof i&&(i=String(i),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),i)if(this.userManager.isDistinctIdStringLikePublic(i))console.error('The string "'+i+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==i){var t=this.userManager.getDistinctId(),r=this.userManager.getAnonymousId(),n=this.userManager.getDeviceId(),s="anonymous"===this.userManager.getUserState();if(!n){var o=t||r;this.userManager.ensureDeviceId(o)}i!==t&&s?(this.userManager.setUserState("identified"),this.userManager.updateUserProperties(a,e),this.capture("$identify",{distinct_id:i,$anon_distinct_id:t||r,$set:a||{},$set_once:e||{}}),this.userManager.setDistinctId(i)):a||e?(s&&this.userManager.setUserState("identified"),this.userManager.updateUserProperties(a,e),this.capture("$set",{$set:a||{},$set_once:e||{}})):i!==t&&(this.userManager.setUserState("identified"),this.userManager.setDistinctId(i))}else console.error('The string "'+i+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(i,a){this.userManager.setUserProperties(i,a)&&this.capture("$set",{$set:i||{},$set_once:a||{}})}resetUser(i){this.sessionManager.resetSessionId(),this.userManager.reset(i)}getUserIdentity(){return this.userManager.getUserIdentity()}getDeviceId(){return this.userManager.getDeviceId()}getUserState(){return this.userManager.getUserState()}createAlias(i,a){var e=this.userManager.createAlias(i,a);e?this.capture("$alias",{$original_id:e.original,$alias_id:e.distinct_id}):i===(a||this.userManager.getDistinctId()||this.userManager.getAnonymousId())&&this.identify(i)}N(){S&&("visible"===S.visibilityState?this.k||(this.k=!0,setTimeout(()=>{if(S&&_){this.capture("$pageview",{navigation_type:"initial_load"})}},300),this.T&&(S.removeEventListener("visibilitychange",this.T),this.T=null)):this.T||(this.T=()=>{this.N()},f(S,"visibilitychange",this.T)))}getConfig(){return this.configManager.getConfig()}getSessionId(){return this.sessionManager.getSessionId()}updateConfig(i){this.configManager.updateConfig(i);var a=this.configManager.getConfig(),e=a.domain;!e&&_&&(e=this.getCurrentDomain()),this.sessionManager=new C(a.storage||"cookie",e),this.userManager=new w(a.persistence||"localStorage",e),this.webVitalsManager=new M(a,this)}_execute_array(i){Array.isArray(i)&&i.forEach(i=>{if(i&&Array.isArray(i)&&i.length>0){var a=i[0],e=i.slice(1);if("function"==typeof this[a])try{this[a](...e)}catch(i){console.error("vTilt: Error executing queued call "+a+":",i)}}})}_dom_loaded(){this.__request_queue.forEach(i=>{this.K(i)}),this.__request_queue=[]}}var Ii={},ki="vt",Ti=!(void 0!==y||void 0!==E)&&-1===(null==P?void 0:P.indexOf("MSIE"))&&-1===(null==P?void 0:P.indexOf("Mozilla"));p&&(p.__VTILT_ENQUEUE_REQUESTS=Ti);var Bi=function(){function i(){i.done||(i.done=!0,Ti=!1,void 0!==p&&(p.__VTILT_ENQUEUE_REQUESTS=!1),function(i,a,e){if(i)if(Array.isArray(i))i.forEach((i,t)=>{a.call(e,i,t)});else for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&a.call(e,i[t],t)}(Ii,function(i){i._dom_loaded()}))}S&&"function"==typeof S.addEventListener?"complete"===S.readyState?i():f(S,"DOMContentLoaded",i,{capture:!1}):p&&console.error("Browser doesn't support `document.addEventListener` so vTilt couldn't be initialized")};var Ni,Di=(Ni=Ii[ki]=new bi,Bi(),Ni);export{bi as VTilt,Di as default,Di as vt};
2
2
  //# sourceMappingURL=module.js.map