Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@amplitude/plugin-autocapture-browser

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplitude/plugin-autocapture-browser - npm Package Compare versions

Comparing version 0.9.2 to 0.10.0

1

lib/cjs/helpers.d.ts

@@ -24,2 +24,3 @@ import { Logger } from '@amplitude/analytics-types';

export declare const asyncLoadScript: (url: string) => Promise<unknown>;
export declare function generateUniqueId(): string;
//# sourceMappingURL=helpers.d.ts.map
Object.defineProperty(exports, "__esModule", { value: true });
exports.asyncLoadScript = exports.getEventTagProps = exports.getClosestElement = exports.querySelectUniqueElements = exports.getNearestLabel = exports.removeEmptyProperties = exports.isEmpty = exports.getAttributesWithPrefix = exports.isPageUrlAllowed = exports.getSelector = exports.getText = exports.isNonSensitiveElement = exports.isTextNode = exports.isNonSensitiveString = void 0;
exports.generateUniqueId = exports.asyncLoadScript = exports.getEventTagProps = exports.getClosestElement = exports.querySelectUniqueElements = exports.getNearestLabel = exports.removeEmptyProperties = exports.isEmpty = exports.getAttributesWithPrefix = exports.isPageUrlAllowed = exports.getSelector = exports.getText = exports.isNonSensitiveElement = exports.isTextNode = exports.isNonSensitiveString = void 0;
var tslib_1 = require("tslib");

@@ -228,2 +228,6 @@ /* eslint-disable no-restricted-globals */

exports.asyncLoadScript = asyncLoadScript;
function generateUniqueId() {
return "".concat(Date.now(), "-").concat(Math.random().toString(36).substr(2, 9));
}
exports.generateUniqueId = generateUniqueId;
//# sourceMappingURL=helpers.js.map

@@ -44,2 +44,8 @@ import { Logger } from '@amplitude/analytics-types';

logger?: Logger;
requestCallbacks: {
[id: string]: {
resolve: (data: any) => void;
reject: (data: any) => void;
};
};
constructor({ origin }?: {

@@ -49,2 +55,6 @@ origin?: string;

private notify;
sendRequest(action: string, args: Record<string, any>, options?: {
timeout: number;
}): Promise<any>;
private handleResponse;
setup({ logger, endpoint, isElementSelectable, }?: {

@@ -51,0 +61,0 @@ logger?: Logger;

111

lib/cjs/libs/messenger.js

@@ -7,2 +7,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

var helpers_1 = require("../helpers");
// TODO: use MessageChannel instead of window.postMessage
var WindowMessenger = /** @class */ (function () {

@@ -13,2 +14,3 @@ function WindowMessenger(_a) {

this.endpoint = constants_1.AMPLITUDE_ORIGIN;
this.requestCallbacks = {};
this.onSelect = function (data) {

@@ -32,2 +34,38 @@ _this.notify({ action: 'element-selected', data: data });

};
// Send an async request to the parent window
WindowMessenger.prototype.sendRequest = function (action, args, options) {
var _this = this;
if (options === void 0) { options = { timeout: 15000 }; }
// Create Request ID
var id = (0, helpers_1.generateUniqueId)();
var request = {
id: id,
action: action,
args: args,
};
// Create a Promise that will be resolved when the response is received
var promise = new Promise(function (resolve, reject) {
_this.requestCallbacks[id] = { resolve: resolve, reject: reject };
// Send the request
_this.notify(request);
// Handle request timeouts
if ((options === null || options === void 0 ? void 0 : options.timeout) > 0) {
setTimeout(function () {
reject(new Error("".concat(action, " timed out (id: ").concat(id, ")")));
delete _this.requestCallbacks[id];
}, options.timeout);
}
});
return promise;
};
// Handle messages from the parent window
WindowMessenger.prototype.handleResponse = function (response) {
var _a;
if (!this.requestCallbacks[response.id]) {
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.warn("No callback found for request id: ".concat(response.id));
return;
}
this.requestCallbacks[response.id].resolve(response.responseData);
delete this.requestCallbacks[response.id];
};
WindowMessenger.prototype.setup = function (_a) {

@@ -42,5 +80,7 @@ var _this = this;

var amplitudeVisualTaggingSelectorInstance = null;
// Attach Event Listener to listen for messages from the parent window
window.addEventListener('message', function (event) {
var _a, _b, _c;
var _a, _b, _c, _d, _e;
(_b = (_a = _this.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, 'Message received: ', JSON.stringify(event));
// Only accept messages from the specified origin
if (_this.endpoint !== event.origin) {

@@ -51,38 +91,49 @@ return;

var action = eventData === null || eventData === void 0 ? void 0 : eventData.action;
// Ignore messages without action
if (!action) {
return;
}
if (action === 'ping') {
_this.notify({ action: 'pong' });
// If id exists, handle responses to previous requests
if ('id' in eventData) {
(_d = (_c = _this.logger) === null || _c === void 0 ? void 0 : _c.debug) === null || _d === void 0 ? void 0 : _d.call(_c, 'Received Response to previous request: ', JSON.stringify(event));
_this.handleResponse(eventData);
// If action exists, handle the action using existing handlers
}
else if (action === 'initialize-visual-tagging-selector') {
var actionData_1 = eventData === null || eventData === void 0 ? void 0 : eventData.data;
(0, helpers_1.asyncLoadScript)(constants_1.AMPLITUDE_VISUAL_TAGGING_SELECTOR_SCRIPT_URL)
.then(function () {
var _a;
else {
if (action === 'ping') {
_this.notify({ action: 'pong' });
}
else if (action === 'initialize-visual-tagging-selector') {
var actionData_1 = eventData === null || eventData === void 0 ? void 0 : eventData.data;
(0, helpers_1.asyncLoadScript)(constants_1.AMPLITUDE_VISUAL_TAGGING_SELECTOR_SCRIPT_URL)
.then(function () {
var _a;
// eslint-disable-next-line
amplitudeVisualTaggingSelectorInstance = (_a = window === null || window === void 0 ? void 0 : window.amplitudeVisualTaggingSelector) === null || _a === void 0 ? void 0 : _a.call(window, {
getEventTagProps: helpers_1.getEventTagProps,
isElementSelectable: function (element) {
if (isElementSelectable) {
return isElementSelectable((actionData_1 === null || actionData_1 === void 0 ? void 0 : actionData_1.actionType) || 'click', element);
}
return true;
},
onSelect: _this.onSelect,
onTrack: _this.onTrack,
visualHighlightClass: constants_1.AMPLITUDE_VISUAL_TAGGING_HIGHLIGHT_CLASS,
messenger: _this,
});
_this.notify({ action: 'selector-loaded' });
})
.catch(function () {
var _a;
(_a = _this.logger) === null || _a === void 0 ? void 0 : _a.warn('Failed to initialize visual tagging selector');
});
}
else if (action === 'close-visual-tagging-selector') {
// eslint-disable-next-line
amplitudeVisualTaggingSelectorInstance = (_a = window === null || window === void 0 ? void 0 : window.amplitudeVisualTaggingSelector) === null || _a === void 0 ? void 0 : _a.call(window, {
getEventTagProps: helpers_1.getEventTagProps,
isElementSelectable: function (element) {
if (isElementSelectable) {
return isElementSelectable((actionData_1 === null || actionData_1 === void 0 ? void 0 : actionData_1.actionType) || 'click', element);
}
return true;
},
onSelect: _this.onSelect,
onTrack: _this.onTrack,
visualHighlightClass: constants_1.AMPLITUDE_VISUAL_TAGGING_HIGHLIGHT_CLASS,
});
_this.notify({ action: 'selector-loaded' });
})
.catch(function () {
var _a;
(_a = _this.logger) === null || _a === void 0 ? void 0 : _a.warn('Failed to initialize visual tagging selector');
});
(_e = amplitudeVisualTaggingSelectorInstance === null || amplitudeVisualTaggingSelectorInstance === void 0 ? void 0 : amplitudeVisualTaggingSelectorInstance.close) === null || _e === void 0 ? void 0 : _e.call(amplitudeVisualTaggingSelectorInstance);
}
}
else if (action === 'close-visual-tagging-selector') {
// eslint-disable-next-line
(_c = amplitudeVisualTaggingSelectorInstance === null || amplitudeVisualTaggingSelectorInstance === void 0 ? void 0 : amplitudeVisualTaggingSelectorInstance.close) === null || _c === void 0 ? void 0 : _c.call(amplitudeVisualTaggingSelectorInstance);
}
});
// Notify the parent window that the page has loaded
this.notify({ action: 'page-loaded' });

@@ -89,0 +140,0 @@ };

@@ -1,2 +0,2 @@

export declare const VERSION = "0.9.1";
export declare const VERSION = "0.9.2";
//# sourceMappingURL=version.d.ts.map
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = void 0;
exports.VERSION = '0.9.1';
exports.VERSION = '0.9.2';
//# sourceMappingURL=version.js.map

@@ -24,2 +24,3 @@ import { Logger } from '@amplitude/analytics-types';

export declare const asyncLoadScript: (url: string) => Promise<unknown>;
export declare function generateUniqueId(): string;
//# sourceMappingURL=helpers.d.ts.map

@@ -211,2 +211,5 @@ /* eslint-disable no-restricted-globals */

};
export function generateUniqueId() {
return "".concat(Date.now(), "-").concat(Math.random().toString(36).substr(2, 9));
}
//# sourceMappingURL=helpers.js.map

@@ -44,2 +44,8 @@ import { Logger } from '@amplitude/analytics-types';

logger?: Logger;
requestCallbacks: {
[id: string]: {
resolve: (data: any) => void;
reject: (data: any) => void;
};
};
constructor({ origin }?: {

@@ -49,2 +55,6 @@ origin?: string;

private notify;
sendRequest(action: string, args: Record<string, any>, options?: {
timeout: number;
}): Promise<any>;
private handleResponse;
setup({ logger, endpoint, isElementSelectable, }?: {

@@ -51,0 +61,0 @@ logger?: Logger;

/* istanbul ignore file */
/* eslint-disable no-restricted-globals */
import { AMPLITUDE_ORIGIN, AMPLITUDE_VISUAL_TAGGING_SELECTOR_SCRIPT_URL, AMPLITUDE_VISUAL_TAGGING_HIGHLIGHT_CLASS, } from '../constants';
import { asyncLoadScript, getEventTagProps } from '../helpers';
import { asyncLoadScript, generateUniqueId, getEventTagProps } from '../helpers';
// TODO: use MessageChannel instead of window.postMessage
var WindowMessenger = /** @class */ (function () {

@@ -10,2 +11,3 @@ function WindowMessenger(_a) {

this.endpoint = AMPLITUDE_ORIGIN;
this.requestCallbacks = {};
this.onSelect = function (data) {

@@ -29,2 +31,38 @@ _this.notify({ action: 'element-selected', data: data });

};
// Send an async request to the parent window
WindowMessenger.prototype.sendRequest = function (action, args, options) {
var _this = this;
if (options === void 0) { options = { timeout: 15000 }; }
// Create Request ID
var id = generateUniqueId();
var request = {
id: id,
action: action,
args: args,
};
// Create a Promise that will be resolved when the response is received
var promise = new Promise(function (resolve, reject) {
_this.requestCallbacks[id] = { resolve: resolve, reject: reject };
// Send the request
_this.notify(request);
// Handle request timeouts
if ((options === null || options === void 0 ? void 0 : options.timeout) > 0) {
setTimeout(function () {
reject(new Error("".concat(action, " timed out (id: ").concat(id, ")")));
delete _this.requestCallbacks[id];
}, options.timeout);
}
});
return promise;
};
// Handle messages from the parent window
WindowMessenger.prototype.handleResponse = function (response) {
var _a;
if (!this.requestCallbacks[response.id]) {
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.warn("No callback found for request id: ".concat(response.id));
return;
}
this.requestCallbacks[response.id].resolve(response.responseData);
delete this.requestCallbacks[response.id];
};
WindowMessenger.prototype.setup = function (_a) {

@@ -39,5 +77,7 @@ var _this = this;

var amplitudeVisualTaggingSelectorInstance = null;
// Attach Event Listener to listen for messages from the parent window
window.addEventListener('message', function (event) {
var _a, _b, _c;
var _a, _b, _c, _d, _e;
(_b = (_a = _this.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, 'Message received: ', JSON.stringify(event));
// Only accept messages from the specified origin
if (_this.endpoint !== event.origin) {

@@ -48,38 +88,49 @@ return;

var action = eventData === null || eventData === void 0 ? void 0 : eventData.action;
// Ignore messages without action
if (!action) {
return;
}
if (action === 'ping') {
_this.notify({ action: 'pong' });
// If id exists, handle responses to previous requests
if ('id' in eventData) {
(_d = (_c = _this.logger) === null || _c === void 0 ? void 0 : _c.debug) === null || _d === void 0 ? void 0 : _d.call(_c, 'Received Response to previous request: ', JSON.stringify(event));
_this.handleResponse(eventData);
// If action exists, handle the action using existing handlers
}
else if (action === 'initialize-visual-tagging-selector') {
var actionData_1 = eventData === null || eventData === void 0 ? void 0 : eventData.data;
asyncLoadScript(AMPLITUDE_VISUAL_TAGGING_SELECTOR_SCRIPT_URL)
.then(function () {
var _a;
else {
if (action === 'ping') {
_this.notify({ action: 'pong' });
}
else if (action === 'initialize-visual-tagging-selector') {
var actionData_1 = eventData === null || eventData === void 0 ? void 0 : eventData.data;
asyncLoadScript(AMPLITUDE_VISUAL_TAGGING_SELECTOR_SCRIPT_URL)
.then(function () {
var _a;
// eslint-disable-next-line
amplitudeVisualTaggingSelectorInstance = (_a = window === null || window === void 0 ? void 0 : window.amplitudeVisualTaggingSelector) === null || _a === void 0 ? void 0 : _a.call(window, {
getEventTagProps: getEventTagProps,
isElementSelectable: function (element) {
if (isElementSelectable) {
return isElementSelectable((actionData_1 === null || actionData_1 === void 0 ? void 0 : actionData_1.actionType) || 'click', element);
}
return true;
},
onSelect: _this.onSelect,
onTrack: _this.onTrack,
visualHighlightClass: AMPLITUDE_VISUAL_TAGGING_HIGHLIGHT_CLASS,
messenger: _this,
});
_this.notify({ action: 'selector-loaded' });
})
.catch(function () {
var _a;
(_a = _this.logger) === null || _a === void 0 ? void 0 : _a.warn('Failed to initialize visual tagging selector');
});
}
else if (action === 'close-visual-tagging-selector') {
// eslint-disable-next-line
amplitudeVisualTaggingSelectorInstance = (_a = window === null || window === void 0 ? void 0 : window.amplitudeVisualTaggingSelector) === null || _a === void 0 ? void 0 : _a.call(window, {
getEventTagProps: getEventTagProps,
isElementSelectable: function (element) {
if (isElementSelectable) {
return isElementSelectable((actionData_1 === null || actionData_1 === void 0 ? void 0 : actionData_1.actionType) || 'click', element);
}
return true;
},
onSelect: _this.onSelect,
onTrack: _this.onTrack,
visualHighlightClass: AMPLITUDE_VISUAL_TAGGING_HIGHLIGHT_CLASS,
});
_this.notify({ action: 'selector-loaded' });
})
.catch(function () {
var _a;
(_a = _this.logger) === null || _a === void 0 ? void 0 : _a.warn('Failed to initialize visual tagging selector');
});
(_e = amplitudeVisualTaggingSelectorInstance === null || amplitudeVisualTaggingSelectorInstance === void 0 ? void 0 : amplitudeVisualTaggingSelectorInstance.close) === null || _e === void 0 ? void 0 : _e.call(amplitudeVisualTaggingSelectorInstance);
}
}
else if (action === 'close-visual-tagging-selector') {
// eslint-disable-next-line
(_c = amplitudeVisualTaggingSelectorInstance === null || amplitudeVisualTaggingSelectorInstance === void 0 ? void 0 : amplitudeVisualTaggingSelectorInstance.close) === null || _c === void 0 ? void 0 : _c.call(amplitudeVisualTaggingSelectorInstance);
}
});
// Notify the parent window that the page has loaded
this.notify({ action: 'page-loaded' });

@@ -86,0 +137,0 @@ };

@@ -1,2 +0,2 @@

export declare const VERSION = "0.9.1";
export declare const VERSION = "0.9.2";
//# sourceMappingURL=version.d.ts.map

@@ -1,2 +0,2 @@

export var VERSION = '0.9.1';
export var VERSION = '0.9.2';
//# sourceMappingURL=version.js.map

@@ -1,1 +0,1 @@

var amplitudeAutocapturePlugin=function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function l(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(l,a)}u((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function o(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)l.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return l}function l(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var a,u,c="[Amplitude] Element Tag",d="[Amplitude] Element Text",s="[Amplitude] Element Selector",f="[Amplitude] Page URL",v="https://app.amplitude.com",p={US:v,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},g="amp-visual-tagging-selector-highlight";function h(e,n){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};a=t(t({},r),n),u=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(a.root,r);var o=m(e,"all",(function(){return m(e,"two",(function(){return m(e,"one",(function(){return m(e,"none")}))}))}));if(o){var i=k(C(o,e));return i.length>0&&(o=i[0]),w(o)}throw new Error("Selector was not found.")}function m(e,t,n){for(var r=null,u=[],c=e,d=0,s=function(){var e,s,f=N(function(e){var t=e.getAttribute("id");if(t&&a.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(c))||N.apply(void 0,l([],i(function(e){var t=Array.from(e.attributes).filter((function(e){return a.attr(e.name,e.value)}));return t.map((function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}}))}(c)),!1))||N.apply(void 0,l([],i(function(e){var t=Array.from(e.classList).filter(a.className);return t.map((function(e){return{name:"."+CSS.escape(e),penalty:1}}))}(c)),!1))||N(function(e){var t=e.tagName.toLowerCase();if(a.tagName(t))return{name:t,penalty:2};return null}(c))||[{name:"*",penalty:3}],v=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(c);if("all"==t)v&&(f=f.concat(f.filter(S).map((function(e){return A(e,v)}))));else if("two"==t)f=f.slice(0,1),v&&(f=f.concat(f.filter(S).map((function(e){return A(e,v)}))));else if("one"==t){var p=i(f=f.slice(0,1),1)[0];v&&S(p)&&(f=[A(p,v)])}else"none"==t&&(f=[{name:"*",penalty:3}],v&&(f=[A(f[0],v)]));try{for(var g=(e=void 0,o(f)),h=g.next();!h.done;h=g.next()){(p=h.value).level=d}}catch(t){e={error:t}}finally{try{h&&!h.done&&(s=g.return)&&s.call(g)}finally{if(e)throw e.error}}if(u.push(f),u.length>=a.seedMinLength&&(r=y(u,n)))return"break";c=c.parentElement,d++};c;){if("break"===s())break}return r||(r=y(u,n)),!r&&n?n():r}function y(e,t){var n,r,i=k(L(e));if(i.length>a.threshold)return t?t():null;try{for(var l=o(i),u=l.next();!u.done;u=l.next()){var c=u.value;if(E(c))return c}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}function w(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var o=e[r].level||0;n=t.level===o-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function b(e){return e.map((function(e){return e.penalty})).reduce((function(e,t){return e+t}),0)}function E(e){var t=w(e);switch(u.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function A(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function S(e){return"html"!==e.name&&!e.name.startsWith("#")}function N(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(T);return n.length>0?n:null}function T(e){return null!=e}function L(e,t){var n,i,l,a,u,c;return void 0===t&&(t=[]),r(this,(function(r){switch(r.label){case 0:if(!(e.length>0))return[3,9];r.label=1;case 1:r.trys.push([1,6,7,8]),n=o(e[0]),i=n.next(),r.label=2;case 2:return i.done?[3,5]:(l=i.value,[5,o(L(e.slice(1,e.length),t.concat(l)))]);case 3:r.sent(),r.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return a=r.sent(),u={error:a},[3,8];case 7:try{i&&!i.done&&(c=n.return)&&c.call(n)}finally{if(u)throw u.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:r.sent(),r.label=11;case 11:return[2]}}))}function k(e){return l([],i(e),!1).sort((function(e,t){return b(e)-b(t)}))}function C(e,t,n){var c,d,s;return void 0===n&&(n={counter:0,visited:new Map}),r(this,(function(r){switch(r.label){case 0:if(!(e.length>2&&e.length>a.optimizedMinLength))return[3,5];c=1,r.label=1;case 1:return c<e.length-1?n.counter>a.maxNumberOfTries?[2]:(n.counter+=1,(d=l([],i(e),!1)).splice(c,1),s=w(d),n.visited.has(s)?[2]:E(d)&&function(e,t){return u.querySelector(w(e))===t}(d,t)?[4,d]:[3,4]):[3,5];case 2:return r.sent(),n.visited.set(s,!0),[5,o(C(d,t,n))];case 3:r.sent(),r.label=4;case 4:return c++,[3,1];case 5:return[2]}}))}var x=["input","select","textarea"],O=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0},P=function(e){var t="";return function(e){var t,n,r=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t);return!x.includes(r)}(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=P(e),t+=r.split(/(\s+)/).filter(O).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},M=function(e,t){var n,r,o="";try{return o=h(e,{className:function(e){return e!==g}})}catch(e){if(t){var i=e;t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(i.toString()))}}var l=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(l&&(o=l),e.id)o="#".concat(e.id);else if(e.className){var a=e.className.split(" ").filter((function(e){return e!==g})).join(".");a&&(o="".concat(o,".").concat(a))}return o},j=function(e){return Object.keys(e).reduce((function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t}),{})},_=function(e){var t=e.parentElement;if(!t)return"";var n=t.querySelector(":scope>span,h1,h2,h3,h4,h5,h6");if(n){var r=n.textContent||"";return O(r)?r:""}return _(t)},q=function(e,t){if(e&&"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var n=t.reduce((function(t,n){n&&Array.from(e.querySelectorAll(n)).forEach((function(e){t.add(e)}));return t}),new Set);return Array.from(n)}return[]},D=function(e,t){return e?t.some((function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))?e:D(null==e?void 0:e.parentElement,t):null},U=function(e,t){var n,r,o;if(!e)return{};var i=null===(o=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l=M(e,t),a=((n={})[c]=i,n[d]=P(e),n[s]=l,n[f]=window.location.href.split("?")[0],n);return j(a)},R=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?v:t,r=this;this.endpoint=v,this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,o;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(o=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===o||o.call(r,e,this.endpoint)},e.prototype.setup=function(e){var t=this,n=void 0===e?{}:e,r=n.logger,o=n.endpoint,i=n.isElementSelectable;this.logger=r,o&&this.endpoint===v&&(this.endpoint=o);var l=null;window.addEventListener("message",(function(e){var n,r,o;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var a,u=null==e?void 0:e.data,c=null==u?void 0:u.action;if(c)if("ping"===c)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===c){var d=null==u?void 0:u.data;(a="https://cdn.amplitude.com/libs/visual-tagging-selector-0.2.2.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=a,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(a)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;l=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:U,isElementSelectable:function(e){return!i||i((null==d?void 0:d.actionType)||"click",e)},onSelect:t.onSelect,onTrack:t.onTrack,visualHighlightClass:g}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===c&&(null===(o=null==l?void 0:l.close)||void 0===o||o.call(l))}})),this.notify({action:"page-loaded"})},e}(),F=["a","button","input","select","textarea","label","[data-amp-default-track]",".amp-default-track"],W="data-amp-track-",z=function(e){void 0===e&&(e={});var o,i=e.cssSelectorAllowlist,l=void 0===i?F:i,a=e.pageUrlAllowlist,u=e.shouldTrackEventResolver,v=e.dataAttributePrefix,g=void 0===v?W:v,h=e.visualTaggingOptions,m=void 0===h?{enabled:!0,messenger:new R}:h,y="@amplitude/plugin-autocapture-browser",w=[],b=void 0,E=function(e,t,n){e.addEventListener(t,n),w.push({element:e,type:t,handler:n})},A=function(e,t){var n,r,o;if(!t)return!1;var i=null===(r=null===(n=null==t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(!i)return!1;if(u)return u(e,t);if(!function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(window.location.href,a))return!1;var c=(null==t?void 0:t.type)||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}if(l){var d=l.some((function(e){var n;return!!(null===(n=null==t?void 0:t.matches)||void 0===n?void 0:n.call(t,e))}));if(!d)return!1}switch(i){case"input":case"select":case"textarea":return"change"===e||"click"===e;default:var s=null===(o=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===o?void 0:o.call(window,t);return!(!s||"pointer"!==s.getPropertyValue("cursor")||"click"!==e)||"click"===e}},S=function(e,t){var n,r,o,i=null===(o=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),u=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var o=r.replace(t,""),i=e.getAttribute(r);o&&(n[o]=i||"")}return n}),{})}(t,g),v=_(t),p=M(t,b),h=((n={})["[Amplitude] Element ID"]=t.id,n["[Amplitude] Element Class"]=t.className,n[c]=i,n[d]=P(t),n["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),n["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),n["[Amplitude] Element Aria Label"]=a,n["[Amplitude] Element Attributes"]=u,n[s]=p,n["[Amplitude] Element Parent Label"]=v,n[f]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===i&&"click"===e&&t instanceof HTMLAnchorElement&&(h["[Amplitude] Element Href"]=t.href),j(h)};return{name:y,type:"enrichment",setup:function(e,i){return n(void 0,void 0,void 0,(function(){var n,a,u,c,d;return r(this,(function(r){return i?(b=e.loggerProvider,"undefined"==typeof document||(n=function(e){A("click",e)&&E(e,"click",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&D(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Clicked",S("click",e))})),A("change",e)&&E(e,"change",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&D(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Changed",S("change",e))}))},"undefined"!=typeof MutationObserver&&(o=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&q(e,l).map(n)}))}))}))),a=function(){q(document.body,l).forEach(n),null==o||o.observe(document.body,{subtree:!0,childList:!0})},document.body?a():window.addEventListener("load",a),null===(c=null==e?void 0:e.loggerProvider)||void 0===c||c.log("".concat(y," has been successfully added.")),window.opener&&m.enabled&&(null===(d=m.messenger)||void 0===d||d.setup(t(t({logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:p[e.serverZone]}),{isElementSelectable:A})))),[2]):(null===(u=null==e?void 0:e.loggerProvider)||void 0===u||u.warn("".concat(y," plugin requires a later version of @amplitude/analytics-browser. Events are not tracked.")),[2])}))}))},execute:function(e){return n(void 0,void 0,void 0,(function(){return r(this,(function(t){return[2,e]}))}))},teardown:function(){return n(void 0,void 0,void 0,(function(){return r(this,(function(e){return o&&o.disconnect(),w.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),w=[],[2]}))}))}}};return e.DEFAULT_CSS_SELECTOR_ALLOWLIST=F,e.DEFAULT_DATA_ATTRIBUTE_PREFIX=W,e.WindowMessenger=R,e.autocapturePlugin=z,e.plugin=z,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var amplitudeAutocapturePlugin=function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function l(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(l,a)}u((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function o(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)l.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return l}function l(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var a,u,c="[Amplitude] Element Tag",d="[Amplitude] Element Text",s="[Amplitude] Element Selector",f="[Amplitude] Page URL",v="https://app.amplitude.com",p={US:v,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},g="amp-visual-tagging-selector-highlight";function h(e,n){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};a=t(t({},r),n),u=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(a.root,r);var o=m(e,"all",(function(){return m(e,"two",(function(){return m(e,"one",(function(){return m(e,"none")}))}))}));if(o){var i=C(L(o,e));return i.length>0&&(o=i[0]),w(o)}throw new Error("Selector was not found.")}function m(e,t,n){for(var r=null,u=[],c=e,d=0,s=function(){var e,s,f=N(function(e){var t=e.getAttribute("id");if(t&&a.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(c))||N.apply(void 0,l([],i(function(e){var t=Array.from(e.attributes).filter((function(e){return a.attr(e.name,e.value)}));return t.map((function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}}))}(c)),!1))||N.apply(void 0,l([],i(function(e){var t=Array.from(e.classList).filter(a.className);return t.map((function(e){return{name:"."+CSS.escape(e),penalty:1}}))}(c)),!1))||N(function(e){var t=e.tagName.toLowerCase();if(a.tagName(t))return{name:t,penalty:2};return null}(c))||[{name:"*",penalty:3}],v=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(c);if("all"==t)v&&(f=f.concat(f.filter(A).map((function(e){return S(e,v)}))));else if("two"==t)f=f.slice(0,1),v&&(f=f.concat(f.filter(A).map((function(e){return S(e,v)}))));else if("one"==t){var p=i(f=f.slice(0,1),1)[0];v&&A(p)&&(f=[S(p,v)])}else"none"==t&&(f=[{name:"*",penalty:3}],v&&(f=[S(f[0],v)]));try{for(var g=(e=void 0,o(f)),h=g.next();!h.done;h=g.next()){(p=h.value).level=d}}catch(t){e={error:t}}finally{try{h&&!h.done&&(s=g.return)&&s.call(g)}finally{if(e)throw e.error}}if(u.push(f),u.length>=a.seedMinLength&&(r=y(u,n)))return"break";c=c.parentElement,d++};c;){if("break"===s())break}return r||(r=y(u,n)),!r&&n?n():r}function y(e,t){var n,r,i=C(T(e));if(i.length>a.threshold)return t?t():null;try{for(var l=o(i),u=l.next();!u.done;u=l.next()){var c=u.value;if(E(c))return c}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}function w(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var o=e[r].level||0;n=t.level===o-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function b(e){return e.map((function(e){return e.penalty})).reduce((function(e,t){return e+t}),0)}function E(e){var t=w(e);switch(u.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function S(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function A(e){return"html"!==e.name&&!e.name.startsWith("#")}function N(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(k);return n.length>0?n:null}function k(e){return null!=e}function T(e,t){var n,i,l,a,u,c;return void 0===t&&(t=[]),r(this,(function(r){switch(r.label){case 0:if(!(e.length>0))return[3,9];r.label=1;case 1:r.trys.push([1,6,7,8]),n=o(e[0]),i=n.next(),r.label=2;case 2:return i.done?[3,5]:(l=i.value,[5,o(T(e.slice(1,e.length),t.concat(l)))]);case 3:r.sent(),r.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return a=r.sent(),u={error:a},[3,8];case 7:try{i&&!i.done&&(c=n.return)&&c.call(n)}finally{if(u)throw u.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:r.sent(),r.label=11;case 11:return[2]}}))}function C(e){return l([],i(e),!1).sort((function(e,t){return b(e)-b(t)}))}function L(e,t,n){var c,d,s;return void 0===n&&(n={counter:0,visited:new Map}),r(this,(function(r){switch(r.label){case 0:if(!(e.length>2&&e.length>a.optimizedMinLength))return[3,5];c=1,r.label=1;case 1:return c<e.length-1?n.counter>a.maxNumberOfTries?[2]:(n.counter+=1,(d=l([],i(e),!1)).splice(c,1),s=w(d),n.visited.has(s)?[2]:E(d)&&function(e,t){return u.querySelector(w(e))===t}(d,t)?[4,d]:[3,4]):[3,5];case 2:return r.sent(),n.visited.set(s,!0),[5,o(L(d,t,n))];case 3:r.sent(),r.label=4;case 4:return c++,[3,1];case 5:return[2]}}))}var x=["input","select","textarea"],O=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0},P=function(e){var t="";return function(e){var t,n,r=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t);return!x.includes(r)}(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=P(e),t+=r.split(/(\s+)/).filter(O).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},M=function(e,t){var n,r,o="";try{return o=h(e,{className:function(e){return e!==g}})}catch(e){if(t){var i=e;t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(i.toString()))}}var l=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(l&&(o=l),e.id)o="#".concat(e.id);else if(e.className){var a=e.className.split(" ").filter((function(e){return e!==g})).join(".");a&&(o="".concat(o,".").concat(a))}return o},q=function(e){return Object.keys(e).reduce((function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t}),{})},j=function(e){var t=e.parentElement;if(!t)return"";var n=t.querySelector(":scope>span,h1,h2,h3,h4,h5,h6");if(n){var r=n.textContent||"";return O(r)?r:""}return j(t)},R=function(e,t){if(e&&"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var n=t.reduce((function(t,n){n&&Array.from(e.querySelectorAll(n)).forEach((function(e){t.add(e)}));return t}),new Set);return Array.from(n)}return[]},D=function(e,t){return e?t.some((function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))?e:D(null==e?void 0:e.parentElement,t):null},_=function(e,t){var n,r,o;if(!e)return{};var i=null===(o=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l=M(e,t),a=((n={})[c]=i,n[d]=P(e),n[s]=l,n[f]=window.location.href.split("?")[0],n);return q(a)};var U=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?v:t,r=this;this.endpoint=v,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,o;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(o=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===o||o.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var o="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),i={id:o,action:e,args:t};return new Promise((function(t,l){r.requestCallbacks[o]={resolve:t,reject:l},r.notify(i),(null==n?void 0:n.timeout)>0&&setTimeout((function(){l(new Error("".concat(e," timed out (id: ").concat(o,")"))),delete r.requestCallbacks[o]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{}:e,r=n.logger,o=n.endpoint,i=n.isElementSelectable;this.logger=r,o&&this.endpoint===v&&(this.endpoint=o);var l=null;window.addEventListener("message",(function(e){var n,r,o,a,u;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var c,d=null==e?void 0:e.data,s=null==d?void 0:d.action;if(s)if("id"in d)null===(a=null===(o=t.logger)||void 0===o?void 0:o.debug)||void 0===a||a.call(o,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(d);else if("ping"===s)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===s){var f=null==d?void 0:d.data;(c="https://cdn.amplitude.com/libs/visual-tagging-selector-0.2.2.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=c,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(c)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;l=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:_,isElementSelectable:function(e){return!i||i((null==f?void 0:f.actionType)||"click",e)},onSelect:t.onSelect,onTrack:t.onTrack,visualHighlightClass:g,messenger:t}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===s&&(null===(u=null==l?void 0:l.close)||void 0===u||u.call(l))}})),this.notify({action:"page-loaded"})},e}(),F=["a","button","input","select","textarea","label","[data-amp-default-track]",".amp-default-track"],W="data-amp-track-",z=function(e){void 0===e&&(e={});var o,i=e.cssSelectorAllowlist,l=void 0===i?F:i,a=e.pageUrlAllowlist,u=e.shouldTrackEventResolver,v=e.dataAttributePrefix,g=void 0===v?W:v,h=e.visualTaggingOptions,m=void 0===h?{enabled:!0,messenger:new U}:h,y="@amplitude/plugin-autocapture-browser",w=[],b=void 0,E=function(e,t,n){e.addEventListener(t,n),w.push({element:e,type:t,handler:n})},S=function(e,t){var n,r,o;if(!t)return!1;var i=null===(r=null===(n=null==t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(!i)return!1;if(u)return u(e,t);if(!function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(window.location.href,a))return!1;var c=(null==t?void 0:t.type)||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}if(l){var d=l.some((function(e){var n;return!!(null===(n=null==t?void 0:t.matches)||void 0===n?void 0:n.call(t,e))}));if(!d)return!1}switch(i){case"input":case"select":case"textarea":return"change"===e||"click"===e;default:var s=null===(o=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===o?void 0:o.call(window,t);return!(!s||"pointer"!==s.getPropertyValue("cursor")||"click"!==e)||"click"===e}},A=function(e,t){var n,r,o,i=null===(o=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),u=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var o=r.replace(t,""),i=e.getAttribute(r);o&&(n[o]=i||"")}return n}),{})}(t,g),v=j(t),p=M(t,b),h=((n={})["[Amplitude] Element ID"]=t.id,n["[Amplitude] Element Class"]=t.className,n[c]=i,n[d]=P(t),n["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),n["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),n["[Amplitude] Element Aria Label"]=a,n["[Amplitude] Element Attributes"]=u,n[s]=p,n["[Amplitude] Element Parent Label"]=v,n[f]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===i&&"click"===e&&t instanceof HTMLAnchorElement&&(h["[Amplitude] Element Href"]=t.href),q(h)};return{name:y,type:"enrichment",setup:function(e,i){return n(void 0,void 0,void 0,(function(){var n,a,u,c,d;return r(this,(function(r){return i?(b=e.loggerProvider,"undefined"==typeof document||(n=function(e){S("click",e)&&E(e,"click",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&D(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Clicked",A("click",e))})),S("change",e)&&E(e,"change",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&D(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Changed",A("change",e))}))},"undefined"!=typeof MutationObserver&&(o=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&R(e,l).map(n)}))}))}))),a=function(){R(document.body,l).forEach(n),null==o||o.observe(document.body,{subtree:!0,childList:!0})},document.body?a():window.addEventListener("load",a),null===(c=null==e?void 0:e.loggerProvider)||void 0===c||c.log("".concat(y," has been successfully added.")),window.opener&&m.enabled&&(null===(d=m.messenger)||void 0===d||d.setup(t(t({logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:p[e.serverZone]}),{isElementSelectable:S})))),[2]):(null===(u=null==e?void 0:e.loggerProvider)||void 0===u||u.warn("".concat(y," plugin requires a later version of @amplitude/analytics-browser. Events are not tracked.")),[2])}))}))},execute:function(e){return n(void 0,void 0,void 0,(function(){return r(this,(function(t){return[2,e]}))}))},teardown:function(){return n(void 0,void 0,void 0,(function(){return r(this,(function(e){return o&&o.disconnect(),w.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),w=[],[2]}))}))}}};return e.DEFAULT_CSS_SELECTOR_ALLOWLIST=F,e.DEFAULT_DATA_ATTRIBUTE_PREFIX=W,e.WindowMessenger=U,e.autocapturePlugin=z,e.plugin=z,Object.defineProperty(e,"__esModule",{value:!0}),e}({});

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function l(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(l,a)}u((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function o(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)l.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return l}function l(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var a,u,c="[Amplitude] Element Tag",d="[Amplitude] Element Text",s="[Amplitude] Element Selector",f="[Amplitude] Page URL",v="https://app.amplitude.com",p={US:v,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},h="amp-visual-tagging-selector-highlight";function g(e,n){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};a=t(t({},r),n),u=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(a.root,r);var o=m(e,"all",(function(){return m(e,"two",(function(){return m(e,"one",(function(){return m(e,"none")}))}))}));if(o){var i=k(C(o,e));return i.length>0&&(o=i[0]),w(o)}throw new Error("Selector was not found.")}function m(e,t,n){for(var r=null,u=[],c=e,d=0,s=function(){var e,s,f=T(function(e){var t=e.getAttribute("id");if(t&&a.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(c))||T.apply(void 0,l([],i(function(e){var t=Array.from(e.attributes).filter((function(e){return a.attr(e.name,e.value)}));return t.map((function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}}))}(c)),!1))||T.apply(void 0,l([],i(function(e){var t=Array.from(e.classList).filter(a.className);return t.map((function(e){return{name:"."+CSS.escape(e),penalty:1}}))}(c)),!1))||T(function(e){var t=e.tagName.toLowerCase();if(a.tagName(t))return{name:t,penalty:2};return null}(c))||[{name:"*",penalty:3}],v=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(c);if("all"==t)v&&(f=f.concat(f.filter(A).map((function(e){return S(e,v)}))));else if("two"==t)f=f.slice(0,1),v&&(f=f.concat(f.filter(A).map((function(e){return S(e,v)}))));else if("one"==t){var p=i(f=f.slice(0,1),1)[0];v&&A(p)&&(f=[S(p,v)])}else"none"==t&&(f=[{name:"*",penalty:3}],v&&(f=[S(f[0],v)]));try{for(var h=(e=void 0,o(f)),g=h.next();!g.done;g=h.next()){(p=g.value).level=d}}catch(t){e={error:t}}finally{try{g&&!g.done&&(s=h.return)&&s.call(h)}finally{if(e)throw e.error}}if(u.push(f),u.length>=a.seedMinLength&&(r=y(u,n)))return"break";c=c.parentElement,d++};c;){if("break"===s())break}return r||(r=y(u,n)),!r&&n?n():r}function y(e,t){var n,r,i=k(L(e));if(i.length>a.threshold)return t?t():null;try{for(var l=o(i),u=l.next();!u.done;u=l.next()){var c=u.value;if(E(c))return c}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}function w(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var o=e[r].level||0;n=t.level===o-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function b(e){return e.map((function(e){return e.penalty})).reduce((function(e,t){return e+t}),0)}function E(e){var t=w(e);switch(u.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function S(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function A(e){return"html"!==e.name&&!e.name.startsWith("#")}function T(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(N);return n.length>0?n:null}function N(e){return null!=e}function L(e,t){var n,i,l,a,u,c;return void 0===t&&(t=[]),r(this,(function(r){switch(r.label){case 0:if(!(e.length>0))return[3,9];r.label=1;case 1:r.trys.push([1,6,7,8]),n=o(e[0]),i=n.next(),r.label=2;case 2:return i.done?[3,5]:(l=i.value,[5,o(L(e.slice(1,e.length),t.concat(l)))]);case 3:r.sent(),r.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return a=r.sent(),u={error:a},[3,8];case 7:try{i&&!i.done&&(c=n.return)&&c.call(n)}finally{if(u)throw u.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:r.sent(),r.label=11;case 11:return[2]}}))}function k(e){return l([],i(e),!1).sort((function(e,t){return b(e)-b(t)}))}function C(e,t,n){var c,d,s;return void 0===n&&(n={counter:0,visited:new Map}),r(this,(function(r){switch(r.label){case 0:if(!(e.length>2&&e.length>a.optimizedMinLength))return[3,5];c=1,r.label=1;case 1:return c<e.length-1?n.counter>a.maxNumberOfTries?[2]:(n.counter+=1,(d=l([],i(e),!1)).splice(c,1),s=w(d),n.visited.has(s)?[2]:E(d)&&function(e,t){return u.querySelector(w(e))===t}(d,t)?[4,d]:[3,4]):[3,5];case 2:return r.sent(),n.visited.set(s,!0),[5,o(C(d,t,n))];case 3:r.sent(),r.label=4;case 4:return c++,[3,1];case 5:return[2]}}))}var x=["input","select","textarea"],O=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0},M=function(e){var t="";return function(e){var t,n,r=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t);return!x.includes(r)}(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=M(e),t+=r.split(/(\s+)/).filter(O).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},P=function(e,t){var n,r,o="";try{return o=g(e,{className:function(e){return e!==h}})}catch(e){if(t){var i=e;t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(i.toString()))}}var l=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(l&&(o=l),e.id)o="#".concat(e.id);else if(e.className){var a=e.className.split(" ").filter((function(e){return e!==h})).join(".");a&&(o="".concat(o,".").concat(a))}return o},j=function(e){return Object.keys(e).reduce((function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t}),{})},_=function(e){var t=e.parentElement;if(!t)return"";var n=t.querySelector(":scope>span,h1,h2,h3,h4,h5,h6");if(n){var r=n.textContent||"";return O(r)?r:""}return _(t)},q=function(e,t){if(e&&"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var n=t.reduce((function(t,n){n&&Array.from(e.querySelectorAll(n)).forEach((function(e){t.add(e)}));return t}),new Set);return Array.from(n)}return[]},D=function(e,t){return e?t.some((function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))?e:D(null==e?void 0:e.parentElement,t):null},U=function(e,t){var n,r,o;if(!e)return{};var i=null===(o=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l=P(e,t),a=((n={})[c]=i,n[d]=M(e),n[s]=l,n[f]=window.location.href.split("?")[0],n);return j(a)},R=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?v:t,r=this;this.endpoint=v,this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,o;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(o=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===o||o.call(r,e,this.endpoint)},e.prototype.setup=function(e){var t=this,n=void 0===e?{}:e,r=n.logger,o=n.endpoint,i=n.isElementSelectable;this.logger=r,o&&this.endpoint===v&&(this.endpoint=o);var l=null;window.addEventListener("message",(function(e){var n,r,o;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var a,u=null==e?void 0:e.data,c=null==u?void 0:u.action;if(c)if("ping"===c)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===c){var d=null==u?void 0:u.data;(a="https://cdn.amplitude.com/libs/visual-tagging-selector-0.2.2.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=a,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(a)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;l=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:U,isElementSelectable:function(e){return!i||i((null==d?void 0:d.actionType)||"click",e)},onSelect:t.onSelect,onTrack:t.onTrack,visualHighlightClass:h}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===c&&(null===(o=null==l?void 0:l.close)||void 0===o||o.call(l))}})),this.notify({action:"page-loaded"})},e}(),F=["a","button","input","select","textarea","label","[data-amp-default-track]",".amp-default-track"],W="data-amp-track-",z=function(e){void 0===e&&(e={});var o,i=e.cssSelectorAllowlist,l=void 0===i?F:i,a=e.pageUrlAllowlist,u=e.shouldTrackEventResolver,v=e.dataAttributePrefix,h=void 0===v?W:v,g=e.visualTaggingOptions,m=void 0===g?{enabled:!0,messenger:new R}:g,y="@amplitude/plugin-autocapture-browser",w=[],b=void 0,E=function(e,t,n){e.addEventListener(t,n),w.push({element:e,type:t,handler:n})},S=function(e,t){var n,r,o;if(!t)return!1;var i=null===(r=null===(n=null==t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(!i)return!1;if(u)return u(e,t);if(!function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(window.location.href,a))return!1;var c=(null==t?void 0:t.type)||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}if(l){var d=l.some((function(e){var n;return!!(null===(n=null==t?void 0:t.matches)||void 0===n?void 0:n.call(t,e))}));if(!d)return!1}switch(i){case"input":case"select":case"textarea":return"change"===e||"click"===e;default:var s=null===(o=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===o?void 0:o.call(window,t);return!(!s||"pointer"!==s.getPropertyValue("cursor")||"click"!==e)||"click"===e}},A=function(e,t){var n,r,o,i=null===(o=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),u=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var o=r.replace(t,""),i=e.getAttribute(r);o&&(n[o]=i||"")}return n}),{})}(t,h),v=_(t),p=P(t,b),g=((n={})["[Amplitude] Element ID"]=t.id,n["[Amplitude] Element Class"]=t.className,n[c]=i,n[d]=M(t),n["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),n["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),n["[Amplitude] Element Aria Label"]=a,n["[Amplitude] Element Attributes"]=u,n[s]=p,n["[Amplitude] Element Parent Label"]=v,n[f]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===i&&"click"===e&&t instanceof HTMLAnchorElement&&(g["[Amplitude] Element Href"]=t.href),j(g)};return{name:y,type:"enrichment",setup:function(e,i){return n(void 0,void 0,void 0,(function(){var n,a,u,c,d;return r(this,(function(r){return i?(b=e.loggerProvider,"undefined"==typeof document||(n=function(e){S("click",e)&&E(e,"click",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&D(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Clicked",A("click",e))})),S("change",e)&&E(e,"change",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&D(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Changed",A("change",e))}))},"undefined"!=typeof MutationObserver&&(o=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&q(e,l).map(n)}))}))}))),a=function(){q(document.body,l).forEach(n),null==o||o.observe(document.body,{subtree:!0,childList:!0})},document.body?a():window.addEventListener("load",a),null===(c=null==e?void 0:e.loggerProvider)||void 0===c||c.log("".concat(y," has been successfully added.")),window.opener&&m.enabled&&(null===(d=m.messenger)||void 0===d||d.setup(t(t({logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:p[e.serverZone]}),{isElementSelectable:S})))),[2]):(null===(u=null==e?void 0:e.loggerProvider)||void 0===u||u.warn("".concat(y," plugin requires a later version of @amplitude/analytics-browser. Events are not tracked.")),[2])}))}))},execute:function(e){return n(void 0,void 0,void 0,(function(){return r(this,(function(t){return[2,e]}))}))},teardown:function(){return n(void 0,void 0,void 0,(function(){return r(this,(function(e){return o&&o.disconnect(),w.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),w=[],[2]}))}))}}};e.DEFAULT_CSS_SELECTOR_ALLOWLIST=F,e.DEFAULT_DATA_ATTRIBUTE_PREFIX=W,e.WindowMessenger=R,e.autocapturePlugin=z,e.plugin=z,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function l(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(l,a)}u((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function o(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)l.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return l}function l(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var a,u,c="[Amplitude] Element Tag",d="[Amplitude] Element Text",s="[Amplitude] Element Selector",f="[Amplitude] Page URL",v="https://app.amplitude.com",p={US:v,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},h="amp-visual-tagging-selector-highlight";function g(e,n){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};a=t(t({},r),n),u=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(a.root,r);var o=m(e,"all",(function(){return m(e,"two",(function(){return m(e,"one",(function(){return m(e,"none")}))}))}));if(o){var i=C(L(o,e));return i.length>0&&(o=i[0]),w(o)}throw new Error("Selector was not found.")}function m(e,t,n){for(var r=null,u=[],c=e,d=0,s=function(){var e,s,f=T(function(e){var t=e.getAttribute("id");if(t&&a.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(c))||T.apply(void 0,l([],i(function(e){var t=Array.from(e.attributes).filter((function(e){return a.attr(e.name,e.value)}));return t.map((function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}}))}(c)),!1))||T.apply(void 0,l([],i(function(e){var t=Array.from(e.classList).filter(a.className);return t.map((function(e){return{name:"."+CSS.escape(e),penalty:1}}))}(c)),!1))||T(function(e){var t=e.tagName.toLowerCase();if(a.tagName(t))return{name:t,penalty:2};return null}(c))||[{name:"*",penalty:3}],v=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(c);if("all"==t)v&&(f=f.concat(f.filter(A).map((function(e){return S(e,v)}))));else if("two"==t)f=f.slice(0,1),v&&(f=f.concat(f.filter(A).map((function(e){return S(e,v)}))));else if("one"==t){var p=i(f=f.slice(0,1),1)[0];v&&A(p)&&(f=[S(p,v)])}else"none"==t&&(f=[{name:"*",penalty:3}],v&&(f=[S(f[0],v)]));try{for(var h=(e=void 0,o(f)),g=h.next();!g.done;g=h.next()){(p=g.value).level=d}}catch(t){e={error:t}}finally{try{g&&!g.done&&(s=h.return)&&s.call(h)}finally{if(e)throw e.error}}if(u.push(f),u.length>=a.seedMinLength&&(r=y(u,n)))return"break";c=c.parentElement,d++};c;){if("break"===s())break}return r||(r=y(u,n)),!r&&n?n():r}function y(e,t){var n,r,i=C(k(e));if(i.length>a.threshold)return t?t():null;try{for(var l=o(i),u=l.next();!u.done;u=l.next()){var c=u.value;if(E(c))return c}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}function w(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var o=e[r].level||0;n=t.level===o-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function b(e){return e.map((function(e){return e.penalty})).reduce((function(e,t){return e+t}),0)}function E(e){var t=w(e);switch(u.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function S(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function A(e){return"html"!==e.name&&!e.name.startsWith("#")}function T(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(N);return n.length>0?n:null}function N(e){return null!=e}function k(e,t){var n,i,l,a,u,c;return void 0===t&&(t=[]),r(this,(function(r){switch(r.label){case 0:if(!(e.length>0))return[3,9];r.label=1;case 1:r.trys.push([1,6,7,8]),n=o(e[0]),i=n.next(),r.label=2;case 2:return i.done?[3,5]:(l=i.value,[5,o(k(e.slice(1,e.length),t.concat(l)))]);case 3:r.sent(),r.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return a=r.sent(),u={error:a},[3,8];case 7:try{i&&!i.done&&(c=n.return)&&c.call(n)}finally{if(u)throw u.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:r.sent(),r.label=11;case 11:return[2]}}))}function C(e){return l([],i(e),!1).sort((function(e,t){return b(e)-b(t)}))}function L(e,t,n){var c,d,s;return void 0===n&&(n={counter:0,visited:new Map}),r(this,(function(r){switch(r.label){case 0:if(!(e.length>2&&e.length>a.optimizedMinLength))return[3,5];c=1,r.label=1;case 1:return c<e.length-1?n.counter>a.maxNumberOfTries?[2]:(n.counter+=1,(d=l([],i(e),!1)).splice(c,1),s=w(d),n.visited.has(s)?[2]:E(d)&&function(e,t){return u.querySelector(w(e))===t}(d,t)?[4,d]:[3,4]):[3,5];case 2:return r.sent(),n.visited.set(s,!0),[5,o(L(d,t,n))];case 3:r.sent(),r.label=4;case 4:return c++,[3,1];case 5:return[2]}}))}var x=["input","select","textarea"],O=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0},M=function(e){var t="";return function(e){var t,n,r=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t);return!x.includes(r)}(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=M(e),t+=r.split(/(\s+)/).filter(O).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},P=function(e,t){var n,r,o="";try{return o=g(e,{className:function(e){return e!==h}})}catch(e){if(t){var i=e;t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(i.toString()))}}var l=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(l&&(o=l),e.id)o="#".concat(e.id);else if(e.className){var a=e.className.split(" ").filter((function(e){return e!==h})).join(".");a&&(o="".concat(o,".").concat(a))}return o},q=function(e){return Object.keys(e).reduce((function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t}),{})},j=function(e){var t=e.parentElement;if(!t)return"";var n=t.querySelector(":scope>span,h1,h2,h3,h4,h5,h6");if(n){var r=n.textContent||"";return O(r)?r:""}return j(t)},R=function(e,t){if(e&&"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var n=t.reduce((function(t,n){n&&Array.from(e.querySelectorAll(n)).forEach((function(e){t.add(e)}));return t}),new Set);return Array.from(n)}return[]},D=function(e,t){return e?t.some((function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))?e:D(null==e?void 0:e.parentElement,t):null},_=function(e,t){var n,r,o;if(!e)return{};var i=null===(o=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l=P(e,t),a=((n={})[c]=i,n[d]=M(e),n[s]=l,n[f]=window.location.href.split("?")[0],n);return q(a)};var U=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?v:t,r=this;this.endpoint=v,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,o;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(o=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===o||o.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var o="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),i={id:o,action:e,args:t};return new Promise((function(t,l){r.requestCallbacks[o]={resolve:t,reject:l},r.notify(i),(null==n?void 0:n.timeout)>0&&setTimeout((function(){l(new Error("".concat(e," timed out (id: ").concat(o,")"))),delete r.requestCallbacks[o]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{}:e,r=n.logger,o=n.endpoint,i=n.isElementSelectable;this.logger=r,o&&this.endpoint===v&&(this.endpoint=o);var l=null;window.addEventListener("message",(function(e){var n,r,o,a,u;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var c,d=null==e?void 0:e.data,s=null==d?void 0:d.action;if(s)if("id"in d)null===(a=null===(o=t.logger)||void 0===o?void 0:o.debug)||void 0===a||a.call(o,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(d);else if("ping"===s)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===s){var f=null==d?void 0:d.data;(c="https://cdn.amplitude.com/libs/visual-tagging-selector-0.2.2.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=c,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(c)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;l=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:_,isElementSelectable:function(e){return!i||i((null==f?void 0:f.actionType)||"click",e)},onSelect:t.onSelect,onTrack:t.onTrack,visualHighlightClass:h,messenger:t}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===s&&(null===(u=null==l?void 0:l.close)||void 0===u||u.call(l))}})),this.notify({action:"page-loaded"})},e}(),F=["a","button","input","select","textarea","label","[data-amp-default-track]",".amp-default-track"],W="data-amp-track-",z=function(e){void 0===e&&(e={});var o,i=e.cssSelectorAllowlist,l=void 0===i?F:i,a=e.pageUrlAllowlist,u=e.shouldTrackEventResolver,v=e.dataAttributePrefix,h=void 0===v?W:v,g=e.visualTaggingOptions,m=void 0===g?{enabled:!0,messenger:new U}:g,y="@amplitude/plugin-autocapture-browser",w=[],b=void 0,E=function(e,t,n){e.addEventListener(t,n),w.push({element:e,type:t,handler:n})},S=function(e,t){var n,r,o;if(!t)return!1;var i=null===(r=null===(n=null==t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(!i)return!1;if(u)return u(e,t);if(!function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(window.location.href,a))return!1;var c=(null==t?void 0:t.type)||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}if(l){var d=l.some((function(e){var n;return!!(null===(n=null==t?void 0:t.matches)||void 0===n?void 0:n.call(t,e))}));if(!d)return!1}switch(i){case"input":case"select":case"textarea":return"change"===e||"click"===e;default:var s=null===(o=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===o?void 0:o.call(window,t);return!(!s||"pointer"!==s.getPropertyValue("cursor")||"click"!==e)||"click"===e}},A=function(e,t){var n,r,o,i=null===(o=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),u=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var o=r.replace(t,""),i=e.getAttribute(r);o&&(n[o]=i||"")}return n}),{})}(t,h),v=j(t),p=P(t,b),g=((n={})["[Amplitude] Element ID"]=t.id,n["[Amplitude] Element Class"]=t.className,n[c]=i,n[d]=M(t),n["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),n["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),n["[Amplitude] Element Aria Label"]=a,n["[Amplitude] Element Attributes"]=u,n[s]=p,n["[Amplitude] Element Parent Label"]=v,n[f]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===i&&"click"===e&&t instanceof HTMLAnchorElement&&(g["[Amplitude] Element Href"]=t.href),q(g)};return{name:y,type:"enrichment",setup:function(e,i){return n(void 0,void 0,void 0,(function(){var n,a,u,c,d;return r(this,(function(r){return i?(b=e.loggerProvider,"undefined"==typeof document||(n=function(e){S("click",e)&&E(e,"click",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&D(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Clicked",A("click",e))})),S("change",e)&&E(e,"change",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&D(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Changed",A("change",e))}))},"undefined"!=typeof MutationObserver&&(o=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&R(e,l).map(n)}))}))}))),a=function(){R(document.body,l).forEach(n),null==o||o.observe(document.body,{subtree:!0,childList:!0})},document.body?a():window.addEventListener("load",a),null===(c=null==e?void 0:e.loggerProvider)||void 0===c||c.log("".concat(y," has been successfully added.")),window.opener&&m.enabled&&(null===(d=m.messenger)||void 0===d||d.setup(t(t({logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:p[e.serverZone]}),{isElementSelectable:S})))),[2]):(null===(u=null==e?void 0:e.loggerProvider)||void 0===u||u.warn("".concat(y," plugin requires a later version of @amplitude/analytics-browser. Events are not tracked.")),[2])}))}))},execute:function(e){return n(void 0,void 0,void 0,(function(){return r(this,(function(t){return[2,e]}))}))},teardown:function(){return n(void 0,void 0,void 0,(function(){return r(this,(function(e){return o&&o.disconnect(),w.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),w=[],[2]}))}))}}};e.DEFAULT_CSS_SELECTOR_ALLOWLIST=F,e.DEFAULT_DATA_ATTRIBUTE_PREFIX=W,e.WindowMessenger=U,e.autocapturePlugin=z,e.plugin=z,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -24,2 +24,3 @@ import { Logger } from '@amplitude/analytics-types';

export declare const asyncLoadScript: (url: string) => Promise<unknown>;
export declare function generateUniqueId(): string;
//# sourceMappingURL=helpers.d.ts.map

@@ -44,2 +44,8 @@ import { Logger } from '@amplitude/analytics-types';

logger?: Logger;
requestCallbacks: {
[id: string]: {
resolve: (data: any) => void;
reject: (data: any) => void;
};
};
constructor({ origin }?: {

@@ -49,2 +55,6 @@ origin?: string;

private notify;
sendRequest(action: string, args: Record<string, any>, options?: {
timeout: number;
}): Promise<any>;
private handleResponse;
setup({ logger, endpoint, isElementSelectable, }?: {

@@ -51,0 +61,0 @@ logger?: Logger;

@@ -1,2 +0,2 @@

export declare const VERSION = "0.9.1";
export declare const VERSION = "0.9.2";
//# sourceMappingURL=version.d.ts.map
{
"name": "@amplitude/plugin-autocapture-browser",
"version": "0.9.2",
"version": "0.10.0",
"description": "",

@@ -60,3 +60,3 @@ "author": "Amplitude Inc",

],
"gitHead": "3521a68a84a7295aa639c4b40019f2922bfc6e6a"
"gitHead": "ebaa74d28661efea69405f7610b9761effed4fb2"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc