@builder.io/dev-tools 1.18.14-dev.202511251124.4f45e4b71 → 1.18.14-dev.202511251716.8d6784f55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +710 -180
- package/cli/index.cjs.map +4 -4
- package/core/index.cjs +1 -1
- package/core/index.mjs +1 -1
- package/node/index.cjs +1 -1
- package/node/index.mjs +1 -1
- package/package.json +1 -1
- package/server/index.cjs +11 -2
- package/server/index.mjs +11 -2
- package/types/cli/code-tools.d.ts +1 -0
- package/types/cli/codegen.d.ts +3 -1
- package/types/cli/sync-utils.d.ts +5 -0
- package/types/cli/utils/gif-generator.d.ts +54 -0
- package/types/tsconfig.tsbuildinfo +1 -1
package/cli/index.cjs
CHANGED
|
@@ -1674,7 +1674,7 @@ var builderVersion, pkgVersion;
|
|
|
1674
1674
|
var init_version = __esm({
|
|
1675
1675
|
"packages/dev-tools/cli/version.ts"() {
|
|
1676
1676
|
"use strict";
|
|
1677
|
-
builderVersion = true ? "1.18.14-dev.
|
|
1677
|
+
builderVersion = true ? "1.18.14-dev.202511251716.8d6784f55" : "0.0.0";
|
|
1678
1678
|
pkgVersion = process.env.OVERRIDE_VERSION ?? builderVersion;
|
|
1679
1679
|
}
|
|
1680
1680
|
});
|
|
@@ -29808,7 +29808,7 @@ var require_util2 = __commonJS({
|
|
|
29808
29808
|
return path11;
|
|
29809
29809
|
});
|
|
29810
29810
|
exports2.normalize = normalize4;
|
|
29811
|
-
function
|
|
29811
|
+
function join14(aRoot, aPath) {
|
|
29812
29812
|
if (aRoot === "") {
|
|
29813
29813
|
aRoot = ".";
|
|
29814
29814
|
}
|
|
@@ -29840,7 +29840,7 @@ var require_util2 = __commonJS({
|
|
|
29840
29840
|
}
|
|
29841
29841
|
return joined;
|
|
29842
29842
|
}
|
|
29843
|
-
exports2.join =
|
|
29843
|
+
exports2.join = join14;
|
|
29844
29844
|
exports2.isAbsolute = function(aPath) {
|
|
29845
29845
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
29846
29846
|
};
|
|
@@ -30054,7 +30054,7 @@ var require_util2 = __commonJS({
|
|
|
30054
30054
|
parsed.path = parsed.path.substring(0, index + 1);
|
|
30055
30055
|
}
|
|
30056
30056
|
}
|
|
30057
|
-
sourceURL =
|
|
30057
|
+
sourceURL = join14(urlGenerate(parsed), sourceURL);
|
|
30058
30058
|
}
|
|
30059
30059
|
return normalize4(sourceURL);
|
|
30060
30060
|
}
|
|
@@ -54600,10 +54600,10 @@ async function writeConfigFile(contents) {
|
|
|
54600
54600
|
}
|
|
54601
54601
|
function getGitRemoteURL(repoPath) {
|
|
54602
54602
|
try {
|
|
54603
|
-
const
|
|
54603
|
+
const spawn5 = (0, import_node_child_process.spawnSync)("git", ["config", "--get", "remote.origin.url"], {
|
|
54604
54604
|
cwd: repoPath
|
|
54605
54605
|
});
|
|
54606
|
-
const output =
|
|
54606
|
+
const output = spawn5.stdout;
|
|
54607
54607
|
return (output || "").toString().trim();
|
|
54608
54608
|
} catch (error) {
|
|
54609
54609
|
Sentry2.captureException(
|
|
@@ -54638,10 +54638,10 @@ function getGitRepoDefaultBranchName(repoPath) {
|
|
|
54638
54638
|
}
|
|
54639
54639
|
function hasGit(repoPath) {
|
|
54640
54640
|
try {
|
|
54641
|
-
const
|
|
54641
|
+
const spawn5 = (0, import_node_child_process.spawnSync)("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
54642
54642
|
cwd: repoPath
|
|
54643
54643
|
});
|
|
54644
|
-
const output = (
|
|
54644
|
+
const output = (spawn5.stdout || "").toString().trim();
|
|
54645
54645
|
return output === "true";
|
|
54646
54646
|
} catch (error) {
|
|
54647
54647
|
Sentry2.captureException(
|
|
@@ -54652,10 +54652,10 @@ function hasGit(repoPath) {
|
|
|
54652
54652
|
}
|
|
54653
54653
|
function getGitCommit(repoPath) {
|
|
54654
54654
|
try {
|
|
54655
|
-
const
|
|
54655
|
+
const spawn5 = (0, import_node_child_process.spawnSync)("git", ["rev-parse", "HEAD"], {
|
|
54656
54656
|
cwd: repoPath
|
|
54657
54657
|
});
|
|
54658
|
-
const output =
|
|
54658
|
+
const output = spawn5.stdout;
|
|
54659
54659
|
return (output || "").toString().trim();
|
|
54660
54660
|
} catch (error) {
|
|
54661
54661
|
Sentry2.captureException(
|
|
@@ -54666,10 +54666,10 @@ function getGitCommit(repoPath) {
|
|
|
54666
54666
|
}
|
|
54667
54667
|
function getCurrentBranchName(repoPath) {
|
|
54668
54668
|
try {
|
|
54669
|
-
const
|
|
54669
|
+
const spawn5 = (0, import_node_child_process.spawnSync)("git", ["branch", "--show-current"], {
|
|
54670
54670
|
cwd: repoPath
|
|
54671
54671
|
});
|
|
54672
|
-
const output =
|
|
54672
|
+
const output = spawn5.stdout;
|
|
54673
54673
|
return (output || "").toString().trim();
|
|
54674
54674
|
} catch (error) {
|
|
54675
54675
|
Sentry2.captureException(
|
|
@@ -59507,8 +59507,8 @@ var require_utils3 = __commonJS({
|
|
|
59507
59507
|
exports2.array = array;
|
|
59508
59508
|
var errno = require_errno();
|
|
59509
59509
|
exports2.errno = errno;
|
|
59510
|
-
var
|
|
59511
|
-
exports2.fs =
|
|
59510
|
+
var fs14 = require_fs();
|
|
59511
|
+
exports2.fs = fs14;
|
|
59512
59512
|
var path11 = require_path();
|
|
59513
59513
|
exports2.path = path11;
|
|
59514
59514
|
var pattern = require_pattern();
|
|
@@ -59692,12 +59692,12 @@ var require_fs2 = __commonJS({
|
|
|
59692
59692
|
"use strict";
|
|
59693
59693
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
59694
59694
|
exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
|
|
59695
|
-
var
|
|
59695
|
+
var fs14 = require("fs");
|
|
59696
59696
|
exports2.FILE_SYSTEM_ADAPTER = {
|
|
59697
|
-
lstat:
|
|
59698
|
-
stat:
|
|
59699
|
-
lstatSync:
|
|
59700
|
-
statSync:
|
|
59697
|
+
lstat: fs14.lstat,
|
|
59698
|
+
stat: fs14.stat,
|
|
59699
|
+
lstatSync: fs14.lstatSync,
|
|
59700
|
+
statSync: fs14.statSync
|
|
59701
59701
|
};
|
|
59702
59702
|
function createFileSystemAdapter(fsMethods) {
|
|
59703
59703
|
if (fsMethods === void 0) {
|
|
@@ -59714,12 +59714,12 @@ var require_settings = __commonJS({
|
|
|
59714
59714
|
"node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
|
|
59715
59715
|
"use strict";
|
|
59716
59716
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
59717
|
-
var
|
|
59717
|
+
var fs14 = require_fs2();
|
|
59718
59718
|
var Settings = class {
|
|
59719
59719
|
constructor(_options = {}) {
|
|
59720
59720
|
this._options = _options;
|
|
59721
59721
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
59722
|
-
this.fs =
|
|
59722
|
+
this.fs = fs14.createFileSystemAdapter(this._options.fs);
|
|
59723
59723
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
59724
59724
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
59725
59725
|
}
|
|
@@ -59874,8 +59874,8 @@ var require_utils4 = __commonJS({
|
|
|
59874
59874
|
"use strict";
|
|
59875
59875
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
59876
59876
|
exports2.fs = void 0;
|
|
59877
|
-
var
|
|
59878
|
-
exports2.fs =
|
|
59877
|
+
var fs14 = require_fs3();
|
|
59878
|
+
exports2.fs = fs14;
|
|
59879
59879
|
}
|
|
59880
59880
|
});
|
|
59881
59881
|
|
|
@@ -60070,14 +60070,14 @@ var require_fs4 = __commonJS({
|
|
|
60070
60070
|
"use strict";
|
|
60071
60071
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
60072
60072
|
exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
|
|
60073
|
-
var
|
|
60073
|
+
var fs14 = require("fs");
|
|
60074
60074
|
exports2.FILE_SYSTEM_ADAPTER = {
|
|
60075
|
-
lstat:
|
|
60076
|
-
stat:
|
|
60077
|
-
lstatSync:
|
|
60078
|
-
statSync:
|
|
60079
|
-
readdir:
|
|
60080
|
-
readdirSync:
|
|
60075
|
+
lstat: fs14.lstat,
|
|
60076
|
+
stat: fs14.stat,
|
|
60077
|
+
lstatSync: fs14.lstatSync,
|
|
60078
|
+
statSync: fs14.statSync,
|
|
60079
|
+
readdir: fs14.readdir,
|
|
60080
|
+
readdirSync: fs14.readdirSync
|
|
60081
60081
|
};
|
|
60082
60082
|
function createFileSystemAdapter(fsMethods) {
|
|
60083
60083
|
if (fsMethods === void 0) {
|
|
@@ -60096,12 +60096,12 @@ var require_settings2 = __commonJS({
|
|
|
60096
60096
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
60097
60097
|
var path11 = require("path");
|
|
60098
60098
|
var fsStat = require_out();
|
|
60099
|
-
var
|
|
60099
|
+
var fs14 = require_fs4();
|
|
60100
60100
|
var Settings = class {
|
|
60101
60101
|
constructor(_options = {}) {
|
|
60102
60102
|
this._options = _options;
|
|
60103
60103
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
60104
|
-
this.fs =
|
|
60104
|
+
this.fs = fs14.createFileSystemAdapter(this._options.fs);
|
|
60105
60105
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path11.sep);
|
|
60106
60106
|
this.stats = this._getValue(this._options.stats, false);
|
|
60107
60107
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
@@ -61459,16 +61459,16 @@ var require_settings4 = __commonJS({
|
|
|
61459
61459
|
"use strict";
|
|
61460
61460
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
61461
61461
|
exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
61462
|
-
var
|
|
61462
|
+
var fs14 = require("fs");
|
|
61463
61463
|
var os7 = require("os");
|
|
61464
61464
|
var CPU_COUNT = Math.max(os7.cpus().length, 1);
|
|
61465
61465
|
exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
61466
|
-
lstat:
|
|
61467
|
-
lstatSync:
|
|
61468
|
-
stat:
|
|
61469
|
-
statSync:
|
|
61470
|
-
readdir:
|
|
61471
|
-
readdirSync:
|
|
61466
|
+
lstat: fs14.lstat,
|
|
61467
|
+
lstatSync: fs14.lstatSync,
|
|
61468
|
+
stat: fs14.stat,
|
|
61469
|
+
statSync: fs14.statSync,
|
|
61470
|
+
readdir: fs14.readdir,
|
|
61471
|
+
readdirSync: fs14.readdirSync
|
|
61472
61472
|
};
|
|
61473
61473
|
var Settings = class {
|
|
61474
61474
|
constructor(_options = {}) {
|
|
@@ -62585,7 +62585,7 @@ var init_dev_tools_api = __esm({
|
|
|
62585
62585
|
|
|
62586
62586
|
// packages/dev-tools/server/client-script.ts
|
|
62587
62587
|
async function getClientScript2(ctx) {
|
|
62588
|
-
return updateClientRuntimeVariables(ctx, '"use strict";\n(() => {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. "__esModule" has not been set), then set\n // "default" to the CommonJS "module.exports" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,\n mod\n ));\n\n // node_modules/@amplitude/ua-parser-js/src/ua-parser.js\n var require_ua_parser = __commonJS({\n "node_modules/@amplitude/ua-parser-js/src/ua-parser.js"(exports, module) {\n (function(window2, undefined2) {\n "use strict";\n var LIBVERSION = "0.7.33", EMPTY = "", UNKNOWN = "?", FUNC_TYPE = "function", UNDEF_TYPE = "undefined", OBJ_TYPE = "object", STR_TYPE = "string", MAJOR = "major", MODEL = "model", NAME = "name", TYPE = "type", VENDOR = "vendor", VERSION2 = "version", ARCHITECTURE = "architecture", CONSOLE = "console", MOBILE = "mobile", TABLET = "tablet", SMARTTV = "smarttv", WEARABLE = "wearable", EMBEDDED = "embedded", UA_MAX_LENGTH = 350;\n var AMAZON = "Amazon", APPLE = "Apple", ASUS = "ASUS", BLACKBERRY = "BlackBerry", BROWSER = "Browser", CHROME = "Chrome", EDGE = "Edge", FIREFOX = "Firefox", GOOGLE = "Google", HUAWEI = "Huawei", LG = "LG", MICROSOFT = "Microsoft", MOTOROLA = "Motorola", OPERA = "Opera", SAMSUNG = "Samsung", SHARP = "Sharp", SONY = "Sony", XIAOMI = "Xiaomi", ZEBRA = "Zebra", FACEBOOK = "Facebook";\n var extend = function(regexes2, extensions) {\n var mergedRegexes = {};\n for (var i in regexes2) {\n if (extensions[i] && extensions[i].length % 2 === 0) {\n mergedRegexes[i] = extensions[i].concat(regexes2[i]);\n } else {\n mergedRegexes[i] = regexes2[i];\n }\n }\n return mergedRegexes;\n }, enumerize = function(arr) {\n var enums = {};\n for (var i = 0; i < arr.length; i++) {\n enums[arr[i].toUpperCase()] = arr[i];\n }\n return enums;\n }, has = function(str1, str2) {\n return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;\n }, lowerize = function(str) {\n return str.toLowerCase();\n }, majorize = function(version) {\n return typeof version === STR_TYPE ? version.replace(/[^\\d\\.]/g, EMPTY).split(".")[0] : undefined2;\n }, trim = function(str, len) {\n if (typeof str === STR_TYPE) {\n str = str.replace(/^\\s\\s*/, EMPTY);\n return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);\n }\n };\n var rgxMapper = function(ua, arrays) {\n var i = 0, j, k, p, q, matches, match;\n while (i < arrays.length && !matches) {\n var regex = arrays[i], props = arrays[i + 1];\n j = k = 0;\n while (j < regex.length && !matches) {\n matches = regex[j++].exec(ua);\n if (!!matches) {\n for (p = 0; p < props.length; p++) {\n match = matches[++k];\n q = props[p];\n if (typeof q === OBJ_TYPE && q.length > 0) {\n if (q.length === 2) {\n if (typeof q[1] == FUNC_TYPE) {\n this[q[0]] = q[1].call(this, match);\n } else {\n this[q[0]] = q[1];\n }\n } else if (q.length === 3) {\n if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {\n this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined2;\n } else {\n this[q[0]] = match ? match.replace(q[1], q[2]) : undefined2;\n }\n } else if (q.length === 4) {\n this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined2;\n }\n } else {\n this[q] = match ? match : undefined2;\n }\n }\n }\n }\n i += 2;\n }\n }, strMapper = function(str, map) {\n for (var i in map) {\n if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {\n for (var j = 0; j < map[i].length; j++) {\n if (has(map[i][j], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n } else if (has(map[i], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n return str;\n };\n var oldSafariMap = {\n "1.0": "/8",\n 1.2: "/1",\n 1.3: "/3",\n "2.0": "/412",\n "2.0.2": "/416",\n "2.0.3": "/417",\n "2.0.4": "/419",\n "?": "/"\n }, windowsVersionMap = {\n ME: "4.90",\n "NT 3.11": "NT3.51",\n "NT 4.0": "NT4.0",\n 2e3: "NT 5.0",\n XP: ["NT 5.1", "NT 5.2"],\n Vista: "NT 6.0",\n 7: "NT 6.1",\n 8: "NT 6.2",\n 8.1: "NT 6.3",\n 10: ["NT 6.4", "NT 10.0"],\n RT: "ARM"\n };\n var regexes = {\n browser: [\n [\n /\\b(?:crmo|crios)\\/([\\w\\.]+)/i\n // Chrome for Android/iOS\n ],\n [VERSION2, [NAME, "Chrome"]],\n [\n /edg(?:e|ios|a)?\\/([\\w\\.]+)/i\n // Microsoft Edge\n ],\n [VERSION2, [NAME, "Edge"]],\n [\n // Presto based\n /(opera mini)\\/([-\\w\\.]+)/i,\n // Opera Mini\n /(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,\n // Opera Mobi/Tablet\n /(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i\n // Opera\n ],\n [NAME, VERSION2],\n [\n /opios[\\/ ]+([\\w\\.]+)/i\n // Opera mini on iphone >= 8.0\n ],\n [VERSION2, [NAME, OPERA + " Mini"]],\n [\n /\\bopr\\/([\\w\\.]+)/i\n // Opera Webkit\n ],\n [VERSION2, [NAME, OPERA]],\n [\n // Mixed\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,\n // Lunascape/Maxthon/Netfront/Jasmine/Blazer\n // Trident based\n /(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,\n // Avant/IEMobile/SlimBrowser\n /(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,\n // Baidu Browser\n /(?:ms|\\()(ie) ([\\w\\.]+)/i,\n // Internet Explorer\n // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon\n /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,\n // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ\n /(weibo)__([\\d\\.]+)/i\n // Weibo\n ],\n [NAME, VERSION2],\n [\n /(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i\n // UCBrowser\n ],\n [VERSION2, [NAME, "UC" + BROWSER]],\n [\n /microm.+\\bqbcore\\/([\\w\\.]+)/i,\n // WeChat Desktop for Windows Built-in Browser\n /\\bqbcore\\/([\\w\\.]+).+microm/i\n ],\n [VERSION2, [NAME, "WeChat(Win) Desktop"]],\n [\n /micromessenger\\/([\\w\\.]+)/i\n // WeChat\n ],\n [VERSION2, [NAME, "WeChat"]],\n [\n /konqueror\\/([\\w\\.]+)/i\n // Konqueror\n ],\n [VERSION2, [NAME, "Konqueror"]],\n [\n /trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i\n // IE11\n ],\n [VERSION2, [NAME, "IE"]],\n [\n /yabrowser\\/([\\w\\.]+)/i\n // Yandex\n ],\n [VERSION2, [NAME, "Yandex"]],\n [\n /(avast|avg)\\/([\\w\\.]+)/i\n // Avast/AVG Secure Browser\n ],\n [[NAME, /(.+)/, "$1 Secure " + BROWSER], VERSION2],\n [\n /\\bfocus\\/([\\w\\.]+)/i\n // Firefox Focus\n ],\n [VERSION2, [NAME, FIREFOX + " Focus"]],\n [\n /\\bopt\\/([\\w\\.]+)/i\n // Opera Touch\n ],\n [VERSION2, [NAME, OPERA + " Touch"]],\n [\n /coc_coc\\w+\\/([\\w\\.]+)/i\n // Coc Coc Browser\n ],\n [VERSION2, [NAME, "Coc Coc"]],\n [\n /dolfin\\/([\\w\\.]+)/i\n // Dolphin\n ],\n [VERSION2, [NAME, "Dolphin"]],\n [\n /coast\\/([\\w\\.]+)/i\n // Opera Coast\n ],\n [VERSION2, [NAME, OPERA + " Coast"]],\n [\n /miuibrowser\\/([\\w\\.]+)/i\n // MIUI Browser\n ],\n [VERSION2, [NAME, "MIUI " + BROWSER]],\n [\n /fxios\\/([-\\w\\.]+)/i\n // Firefox for iOS\n ],\n [VERSION2, [NAME, FIREFOX]],\n [\n /\\bqihu|(qi?ho?o?|360)browser/i\n // 360\n ],\n [[NAME, "360 " + BROWSER]],\n [/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],\n [[NAME, /(.+)/, "$1 " + BROWSER], VERSION2],\n [\n // Oculus/Samsung/Sailfish/Huawei Browser\n /(comodo_dragon)\\/([\\w\\.]+)/i\n // Comodo Dragon\n ],\n [[NAME, /_/g, " "], VERSION2],\n [\n /(electron)\\/([\\w\\.]+) safari/i,\n // Electron-based App\n /(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,\n // Tesla\n /m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i\n // QQBrowser/Baidu App/2345 Browser\n ],\n [NAME, VERSION2],\n [\n /(metasr)[\\/ ]?([\\w\\.]+)/i,\n // SouGouBrowser\n /(lbbrowser)/i,\n // LieBao Browser\n /\\[(linkedin)app\\]/i\n // LinkedIn App for iOS & Android\n ],\n [NAME],\n [\n // WebView\n /((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i\n // Facebook App for iOS & Android\n ],\n [[NAME, FACEBOOK], VERSION2],\n [\n /safari (line)\\/([\\w\\.]+)/i,\n // Line App for iOS\n /\\b(line)\\/([\\w\\.]+)\\/iab/i,\n // Line App for Android\n /(chromium|instagram)[\\/ ]([-\\w\\.]+)/i\n // Chromium/Instagram\n ],\n [NAME, VERSION2],\n [\n /\\bgsa\\/([\\w\\.]+) .*safari\\//i\n // Google Search Appliance on iOS\n ],\n [VERSION2, [NAME, "GSA"]],\n [\n /headlesschrome(?:\\/([\\w\\.]+)| )/i\n // Chrome Headless\n ],\n [VERSION2, [NAME, CHROME + " Headless"]],\n [\n / wv\\).+(chrome)\\/([\\w\\.]+)/i\n // Chrome WebView\n ],\n [[NAME, CHROME + " WebView"], VERSION2],\n [\n /droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i\n // Android Browser\n ],\n [VERSION2, [NAME, "Android " + BROWSER]],\n [\n /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i\n // Chrome/OmniWeb/Arora/Tizen/Nokia\n ],\n [NAME, VERSION2],\n [\n /version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i\n // Mobile Safari\n ],\n [VERSION2, [NAME, "Mobile Safari"]],\n [\n /version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i\n // Safari & Safari Mobile\n ],\n [VERSION2, NAME],\n [\n /webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i\n // Safari < 3.0\n ],\n [NAME, [VERSION2, strMapper, oldSafariMap]],\n [/(webkit|khtml)\\/([\\w\\.]+)/i],\n [NAME, VERSION2],\n [\n // Gecko based\n /(navigator|netscape\\d?)\\/([-\\w\\.]+)/i\n // Netscape\n ],\n [[NAME, "Netscape"], VERSION2],\n [\n /mobile vr; rv:([\\w\\.]+)\\).+firefox/i\n // Firefox Reality\n ],\n [VERSION2, [NAME, FIREFOX + " Reality"]],\n [\n /ekiohf.+(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(swiftfox)/i,\n // Swiftfox\n /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,\n // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar\n /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,\n // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix\n /(firefox)\\/([\\w\\.]+)/i,\n // Other Firefox-based\n /(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,\n // Mozilla\n // Other\n /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,\n // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser\n /(links) \\(([\\w\\.]+)/i\n // Links\n ],\n [NAME, VERSION2],\n [\n /(cobalt)\\/([\\w\\.]+)/i\n // Cobalt\n ],\n [NAME, [VERSION2, /master.|lts./, ""]]\n ],\n cpu: [\n [\n /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i\n // AMD64 (x64)\n ],\n [[ARCHITECTURE, "amd64"]],\n [\n /(ia32(?=;))/i\n // IA32 (quicktime)\n ],\n [[ARCHITECTURE, lowerize]],\n [\n /((?:i[346]|x)86)[;\\)]/i\n // IA32 (x86)\n ],\n [[ARCHITECTURE, "ia32"]],\n [\n /\\b(aarch64|arm(v?8e?l?|_?64))\\b/i\n // ARM64\n ],\n [[ARCHITECTURE, "arm64"]],\n [\n /\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i\n // ARMHF\n ],\n [[ARCHITECTURE, "armhf"]],\n [\n // PocketPC mistakenly identified as PowerPC\n /windows (ce|mobile); ppc;/i\n ],\n [[ARCHITECTURE, "arm"]],\n [\n /((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i\n // PowerPC\n ],\n [[ARCHITECTURE, /ower/, EMPTY, lowerize]],\n [\n /(sun4\\w)[;\\)]/i\n // SPARC\n ],\n [[ARCHITECTURE, "sparc"]],\n [\n /((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i\n // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC\n ],\n [[ARCHITECTURE, lowerize]]\n ],\n device: [\n [\n //////////////////////////\n // MOBILES & TABLETS\n // Ordered by popularity\n /////////////////////////\n // Samsung\n /\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]],\n [\n /\\b((?:s[cgp]h|gt|sm)-\\w+|galaxy nexus)/i,\n /samsung[- ]([-\\w]+)/i,\n /sec-(sgh\\w+)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]],\n [\n // Apple\n /((ipod|iphone)\\d+,\\d+)/i\n // iPod/iPhone model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /(ipad\\d+,\\d+)/i\n // iPad model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [\n /\\((ip(?:hone|od)[\\w ]*);/i\n // iPod/iPhone\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /\\((ipad);[-\\w\\),; ]+apple/i,\n // iPad\n /applecoremedia\\/[\\w\\.]+ \\((ipad)/i,\n /\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [/(macintosh);/i],\n [MODEL, [VENDOR, APPLE]],\n [\n // Huawei\n /\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]],\n [\n /(?:huawei|honor)([-\\w ]+)[;\\)]/i,\n /\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]],\n [\n // Xiaomi\n /\\b(poco[\\w ]+)(?: bui|\\))/i,\n // Xiaomi POCO\n /\\b; (\\w+) build\\/hm\\1/i,\n // Xiaomi Hongmi \'numeric\' models\n /\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,\n // Xiaomi Hongmi\n /\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,\n // Xiaomi Redmi\n /\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i\n // Xiaomi Mi\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, MOBILE]\n ],\n [\n /\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i\n // Mi Pad tablets\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, TABLET]\n ],\n [\n // OPPO\n /; (\\w+) bui.+ oppo/i,\n /\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i\n ],\n [MODEL, [VENDOR, "OPPO"], [TYPE, MOBILE]],\n [\n // Vivo\n /vivo (\\w+)(?: bui|\\))/i,\n /\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i\n ],\n [MODEL, [VENDOR, "Vivo"], [TYPE, MOBILE]],\n [\n // Realme\n /\\b(rmx[12]\\d{3})(?: bui|;|\\))/i\n ],\n [MODEL, [VENDOR, "Realme"], [TYPE, MOBILE]],\n [\n // Motorola\n /\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,\n /\\bmot(?:orola)?[- ](\\w*)/i,\n /((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i\n ],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]],\n [/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]],\n [\n // LG\n /((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, TABLET]],\n [\n /(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,\n /\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,\n /\\blg-?([\\d\\w]+) bui/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, MOBILE]],\n [\n // Lenovo\n /(ideatab[-\\w ]+)/i,\n /lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i\n ],\n [MODEL, [VENDOR, "Lenovo"], [TYPE, TABLET]],\n [\n // Nokia\n /(?:maemo|nokia).*(n900|lumia \\d+)/i,\n /nokia[-_ ]?([-\\w\\.]*)/i\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, "Nokia"],\n [TYPE, MOBILE]\n ],\n [\n // Google\n /(pixel c)\\b/i\n // Google Pixel C\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]],\n [\n /droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i\n // Google Pixel\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]],\n [\n // Sony\n /droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i\n ],\n [MODEL, [VENDOR, SONY], [TYPE, MOBILE]],\n [/sony tablet [ps]/i, /\\b(?:sony)?sgp\\w+(?: bui|\\))/i],\n [\n [MODEL, "Xperia Tablet"],\n [VENDOR, SONY],\n [TYPE, TABLET]\n ],\n [\n // OnePlus\n / (kb2005|in20[12]5|be20[12][59])\\b/i,\n /(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i\n ],\n [MODEL, [VENDOR, "OnePlus"], [TYPE, MOBILE]],\n [\n // Amazon\n /(alexa)webm/i,\n /(kf[a-z]{2}wi)( bui|\\))/i,\n // Kindle Fire without Silk\n /(kf[a-z]+)( bui|\\)).+silk\\//i\n // Kindle Fire HD\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]],\n [\n /((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i\n // Fire Phone\n ],\n [\n [MODEL, /(.+)/g, "Fire Phone $1"],\n [VENDOR, AMAZON],\n [TYPE, MOBILE]\n ],\n [\n // BlackBerry\n /(playbook);[-\\w\\),; ]+(rim)/i\n // BlackBerry PlayBook\n ],\n [MODEL, VENDOR, [TYPE, TABLET]],\n [\n /\\b((?:bb[a-f]|st[hv])100-\\d)/i,\n /\\(bb10; (\\w+)/i\n // BlackBerry 10\n ],\n [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]],\n [\n // Asus\n /(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i\n ],\n [MODEL, [VENDOR, ASUS], [TYPE, TABLET]],\n [/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],\n [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]],\n [\n // HTC\n /(nexus 9)/i\n // HTC Nexus 9\n ],\n [MODEL, [VENDOR, "HTC"], [TYPE, TABLET]],\n [\n /(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,\n // HTC\n // ZTE\n /(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,\n /(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\\w]*)/i\n // Alcatel/GeeksPhone/Nexian/Panasonic/Sony\n ],\n [VENDOR, [MODEL, /_/g, " "], [TYPE, MOBILE]],\n [\n // Acer\n /droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i\n ],\n [MODEL, [VENDOR, "Acer"], [TYPE, TABLET]],\n [\n // Meizu\n /droid.+; (m[1-5] note) bui/i,\n /\\bmz-([-\\w]{2,})/i\n ],\n [MODEL, [VENDOR, "Meizu"], [TYPE, MOBILE]],\n [\n // Sharp\n /\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]],\n [\n // MIXED\n /(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,\n // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron\n /(hp) ([\\w ]+\\w)/i,\n // HP iPAQ\n /(asus)-?(\\w+)/i,\n // Asus\n /(microsoft); (lumia[\\w ]+)/i,\n // Microsoft Lumia\n /(lenovo)[-_ ]?([-\\w]+)/i,\n // Lenovo\n /(jolla)/i,\n // Jolla\n /(oppo) ?([\\w ]+) bui/i\n // OPPO\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(archos) (gamepad2?)/i,\n // Archos\n /(hp).+(touchpad(?!.+tablet)|tablet)/i,\n // HP TouchPad\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(nook)[\\w ]+build\\/(\\w+)/i,\n // Nook\n /(dell) (strea[kpr\\d ]*[\\dko])/i,\n // Dell Streak\n /(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,\n // Le Pan Tablets\n /(trinity)[- ]*(t\\d{3}) bui/i,\n // Trinity Tablets\n /(gigaset)[- ]+(q\\w{1,9}) bui/i,\n // Gigaset Tablets\n /(vodafone) ([\\w ]+)(?:\\)| bui)/i\n // Vodafone\n ],\n [VENDOR, MODEL, [TYPE, TABLET]],\n [\n /(surface duo)/i\n // Surface Duo\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]],\n [\n /droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i\n // Fairphone\n ],\n [MODEL, [VENDOR, "Fairphone"], [TYPE, MOBILE]],\n [\n /(u304aa)/i\n // AT&T\n ],\n [MODEL, [VENDOR, "AT&T"], [TYPE, MOBILE]],\n [\n /\\bsie-(\\w*)/i\n // Siemens\n ],\n [MODEL, [VENDOR, "Siemens"], [TYPE, MOBILE]],\n [\n /\\b(rct\\w+) b/i\n // RCA Tablets\n ],\n [MODEL, [VENDOR, "RCA"], [TYPE, TABLET]],\n [\n /\\b(venue[\\d ]{2,7}) b/i\n // Dell Venue Tablets\n ],\n [MODEL, [VENDOR, "Dell"], [TYPE, TABLET]],\n [\n /\\b(q(?:mv|ta)\\w+) b/i\n // Verizon Tablet\n ],\n [MODEL, [VENDOR, "Verizon"], [TYPE, TABLET]],\n [\n /\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i\n // Barnes & Noble Tablet\n ],\n [MODEL, [VENDOR, "Barnes & Noble"], [TYPE, TABLET]],\n [/\\b(tm\\d{3}\\w+) b/i],\n [MODEL, [VENDOR, "NuVision"], [TYPE, TABLET]],\n [\n /\\b(k88) b/i\n // ZTE K Series Tablet\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, TABLET]],\n [\n /\\b(nx\\d{3}j) b/i\n // ZTE Nubia\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, MOBILE]],\n [\n /\\b(gen\\d{3}) b.+49h/i\n // Swiss GEN Mobile\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, MOBILE]],\n [\n /\\b(zur\\d{3}) b/i\n // Swiss ZUR Tablet\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, TABLET]],\n [\n /\\b((zeki)?tb.*\\b) b/i\n // Zeki Tablets\n ],\n [MODEL, [VENDOR, "Zeki"], [TYPE, TABLET]],\n [\n /\\b([yr]\\d{2}) b/i,\n /\\b(dragon[- ]+touch |dt)(\\w{5}) b/i\n // Dragon Touch Tablet\n ],\n [[VENDOR, "Dragon Touch"], MODEL, [TYPE, TABLET]],\n [\n /\\b(ns-?\\w{0,9}) b/i\n // Insignia Tablets\n ],\n [MODEL, [VENDOR, "Insignia"], [TYPE, TABLET]],\n [\n /\\b((nxa|next)-?\\w{0,9}) b/i\n // NextBook Tablets\n ],\n [MODEL, [VENDOR, "NextBook"], [TYPE, TABLET]],\n [\n /\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i\n // Voice Xtreme Phones\n ],\n [[VENDOR, "Voice"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(lvtel\\-)?(v1[12]) b/i\n // LvTel Phones\n ],\n [[VENDOR, "LvTel"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(ph-1) /i\n // Essential PH-1\n ],\n [MODEL, [VENDOR, "Essential"], [TYPE, MOBILE]],\n [\n /\\b(v(100md|700na|7011|917g).*\\b) b/i\n // Envizen Tablets\n ],\n [MODEL, [VENDOR, "Envizen"], [TYPE, TABLET]],\n [\n /\\b(trio[-\\w\\. ]+) b/i\n // MachSpeed Tablets\n ],\n [MODEL, [VENDOR, "MachSpeed"], [TYPE, TABLET]],\n [\n /\\btu_(1491) b/i\n // Rotor Tablets\n ],\n [MODEL, [VENDOR, "Rotor"], [TYPE, TABLET]],\n [\n /(shield[\\w ]+) b/i\n // Nvidia Shield Tablets\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, TABLET]],\n [\n /(sprint) (\\w+)/i\n // Sprint Phones\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(kin\\.[onetw]{3})/i\n // Microsoft Kin\n ],\n [\n [MODEL, /\\./g, " "],\n [VENDOR, MICROSOFT],\n [TYPE, MOBILE]\n ],\n [\n /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i\n // Zebra\n ],\n [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]],\n [/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]],\n [\n ///////////////////\n // CONSOLES\n ///////////////////\n /(ouya)/i,\n // Ouya\n /(nintendo) ([wids3utch]+)/i\n // Nintendo\n ],\n [VENDOR, MODEL, [TYPE, CONSOLE]],\n [\n /droid.+; (shield) bui/i\n // Nvidia\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, CONSOLE]],\n [\n /(playstation [345portablevi]+)/i\n // Playstation\n ],\n [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]],\n [\n /\\b(xbox(?: one)?(?!; xbox))[\\); ]/i\n // Microsoft Xbox\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]],\n [\n ///////////////////\n // SMARTTVS\n ///////////////////\n /smart-tv.+(samsung)/i\n // Samsung\n ],\n [VENDOR, [TYPE, SMARTTV]],\n [/hbbtv.+maple;(\\d+)/i],\n [\n [MODEL, /^/, "SmartTV"],\n [VENDOR, SAMSUNG],\n [TYPE, SMARTTV]\n ],\n [\n /(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i\n // LG SmartTV\n ],\n [\n [VENDOR, LG],\n [TYPE, SMARTTV]\n ],\n [\n /(apple) ?tv/i\n // Apple TV\n ],\n [VENDOR, [MODEL, APPLE + " TV"], [TYPE, SMARTTV]],\n [\n /crkey/i\n // Google Chromecast\n ],\n [\n [MODEL, CHROME + "cast"],\n [VENDOR, GOOGLE],\n [TYPE, SMARTTV]\n ],\n [\n /droid.+aft(\\w)( bui|\\))/i\n // Fire TV\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]],\n [\n /\\(dtv[\\);].+(aquos)/i,\n /(aquos-tv[\\w ]+)\\)/i\n // Sharp\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],\n [\n /(bravia[\\w ]+)( bui|\\))/i\n // Sony\n ],\n [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]],\n [\n /(mitv-\\w{5}) bui/i\n // Xiaomi\n ],\n [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]],\n [\n /\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,\n // Roku\n /hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w ]*; *(\\w[^;]*);([^;]*)/i\n // HbbTV devices\n ],\n [\n [VENDOR, trim],\n [MODEL, trim],\n [TYPE, SMARTTV]\n ],\n [\n /\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i\n // SmartTV from Unidentified Vendors\n ],\n [[TYPE, SMARTTV]],\n [\n ///////////////////\n // WEARABLES\n ///////////////////\n /((pebble))app/i\n // Pebble\n ],\n [VENDOR, MODEL, [TYPE, WEARABLE]],\n [\n /droid.+; (glass) \\d/i\n // Google Glass\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]],\n [/droid.+; (wt63?0{2,3})\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]],\n [\n /(quest( 2)?)/i\n // Oculus Quest\n ],\n [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]],\n [\n ///////////////////\n // EMBEDDED\n ///////////////////\n /(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i\n // Tesla\n ],\n [VENDOR, [TYPE, EMBEDDED]],\n [\n ////////////////////\n // MIXED (GENERIC)\n ///////////////////\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i\n // Android Phones from Unidentified Vendors\n ],\n [MODEL, [TYPE, MOBILE]],\n [\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i\n // Android Tablets from Unidentified Vendors\n ],\n [MODEL, [TYPE, TABLET]],\n [\n /\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i\n // Unidentifiable Tablet\n ],\n [[TYPE, TABLET]],\n [\n /(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i\n // Unidentifiable Mobile\n ],\n [[TYPE, MOBILE]],\n [\n /(android[-\\w\\. ]{0,9});.+buil/i\n // Generic Android Device\n ],\n [MODEL, [VENDOR, "Generic"]]\n ],\n engine: [\n [\n /windows.+ edge\\/([\\w\\.]+)/i\n // EdgeHTML\n ],\n [VERSION2, [NAME, EDGE + "HTML"]],\n [\n /webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i\n // Blink\n ],\n [VERSION2, [NAME, "Blink"]],\n [\n /(presto)\\/([\\w\\.]+)/i,\n // Presto\n /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,\n // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna\n /ekioh(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,\n // KHTML/Tasman/Links\n /(icab)[\\/ ]([23]\\.[\\d\\.]+)/i\n // iCab\n ],\n [NAME, VERSION2],\n [\n /rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i\n // Gecko\n ],\n [VERSION2, NAME]\n ],\n os: [\n [\n // Windows\n /microsoft (windows) (vista|xp)/i\n // Windows (iTunes)\n ],\n [NAME, VERSION2],\n [\n /(windows) nt 6\\.2; (arm)/i,\n // Windows RT\n /(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,\n // Windows Phone\n /(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i\n ],\n [NAME, [VERSION2, strMapper, windowsVersionMap]],\n [/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],\n [\n [NAME, "Windows"],\n [VERSION2, strMapper, windowsVersionMap]\n ],\n [\n // iOS/macOS\n /ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,\n // iOS\n /cfnetwork\\/.+darwin/i\n ],\n [\n [VERSION2, /_/g, "."],\n [NAME, "iOS"]\n ],\n [\n /(mac os x) ?([\\w\\. ]*)/i,\n /(macintosh|mac_powerpc\\b)(?!.+haiku)/i\n // Mac OS\n ],\n [\n [NAME, "Mac OS"],\n [VERSION2, /_/g, "."]\n ],\n [\n // Mobile OSes\n /droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i\n // Android-x86/HarmonyOS\n ],\n [VERSION2, NAME],\n [\n // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS\n /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,\n /(blackberry)\\w*\\/([\\w\\.]*)/i,\n // Blackberry\n /(tizen|kaios)[\\/ ]([\\w\\.]+)/i,\n // Tizen/KaiOS\n /\\((series40);/i\n // Series 40\n ],\n [NAME, VERSION2],\n [\n /\\(bb(10);/i\n // BlackBerry 10\n ],\n [VERSION2, [NAME, BLACKBERRY]],\n [\n /(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i\n // Symbian\n ],\n [VERSION2, [NAME, "Symbian"]],\n [\n /mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i\n // Firefox OS\n ],\n [VERSION2, [NAME, FIREFOX + " OS"]],\n [\n /web0s;.+rt(tv)/i,\n /\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i\n // WebOS\n ],\n [VERSION2, [NAME, "webOS"]],\n [\n // Google Chromecast\n /crkey\\/([\\d\\.]+)/i\n // Google Chromecast\n ],\n [VERSION2, [NAME, CHROME + "cast"]],\n [\n /(cros) [\\w]+ ([\\w\\.]+\\w)/i\n // Chromium OS\n ],\n [[NAME, "Chromium OS"], VERSION2],\n [\n // Console\n /(nintendo|playstation) ([wids345portablevuch]+)/i,\n // Nintendo/Playstation\n /(xbox); +xbox ([^\\);]+)/i,\n // Microsoft Xbox (360, One, X, S, Series X, Series S)\n // Other\n /\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,\n // Joli/Palm\n /(mint)[\\/\\(\\) ]?(\\w*)/i,\n // Mint\n /(mageia|vectorlinux)[; ]/i,\n // Mageia/VectorLinux\n /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,\n // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire\n /(hurd|linux) ?([\\w\\.]*)/i,\n // Hurd/Linux\n /(gnu) ?([\\w\\.]*)/i,\n // GNU\n /\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,\n // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly\n /(haiku) (\\w+)/i\n // Haiku\n ],\n [NAME, VERSION2],\n [\n /(sunos) ?([\\w\\.\\d]*)/i\n // Solaris\n ],\n [[NAME, "Solaris"], VERSION2],\n [\n /((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,\n // Solaris\n /(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,\n // AIX\n /\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,\n // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX\n /(unix) ?([\\w\\.]*)/i\n // UNIX\n ],\n [NAME, VERSION2]\n ]\n };\n var UAParser2 = function(ua, extensions) {\n if (typeof ua === OBJ_TYPE) {\n extensions = ua;\n ua = undefined2;\n }\n if (!(this instanceof UAParser2)) {\n return new UAParser2(ua, extensions).getResult();\n }\n var _ua = ua || (typeof window2 !== UNDEF_TYPE && window2.navigator && window2.navigator.userAgent ? window2.navigator.userAgent : EMPTY);\n var _rgxmap = extensions ? extend(regexes, extensions) : regexes;\n this.getBrowser = function() {\n var _browser = {};\n _browser[NAME] = undefined2;\n _browser[VERSION2] = undefined2;\n rgxMapper.call(_browser, _ua, _rgxmap.browser);\n _browser.major = majorize(_browser.version);\n return _browser;\n };\n this.getCPU = function() {\n var _cpu = {};\n _cpu[ARCHITECTURE] = undefined2;\n rgxMapper.call(_cpu, _ua, _rgxmap.cpu);\n return _cpu;\n };\n this.getDevice = function() {\n var _device = {};\n _device[VENDOR] = undefined2;\n _device[MODEL] = undefined2;\n _device[TYPE] = undefined2;\n rgxMapper.call(_device, _ua, _rgxmap.device);\n return _device;\n };\n this.getEngine = function() {\n var _engine = {};\n _engine[NAME] = undefined2;\n _engine[VERSION2] = undefined2;\n rgxMapper.call(_engine, _ua, _rgxmap.engine);\n return _engine;\n };\n this.getOS = function() {\n var _os = {};\n _os[NAME] = undefined2;\n _os[VERSION2] = undefined2;\n rgxMapper.call(_os, _ua, _rgxmap.os);\n return _os;\n };\n this.getResult = function() {\n return {\n ua: this.getUA(),\n browser: this.getBrowser(),\n engine: this.getEngine(),\n os: this.getOS(),\n device: this.getDevice(),\n cpu: this.getCPU()\n };\n };\n this.getUA = function() {\n return _ua;\n };\n this.setUA = function(ua2) {\n _ua = typeof ua2 === STR_TYPE && ua2.length > UA_MAX_LENGTH ? trim(ua2, UA_MAX_LENGTH) : ua2;\n return this;\n };\n this.setUA(_ua);\n return this;\n };\n UAParser2.VERSION = LIBVERSION;\n UAParser2.BROWSER = enumerize([NAME, VERSION2, MAJOR]);\n UAParser2.CPU = enumerize([ARCHITECTURE]);\n UAParser2.DEVICE = enumerize([\n MODEL,\n VENDOR,\n TYPE,\n CONSOLE,\n MOBILE,\n SMARTTV,\n TABLET,\n WEARABLE,\n EMBEDDED\n ]);\n UAParser2.ENGINE = UAParser2.OS = enumerize([NAME, VERSION2]);\n if (typeof exports !== UNDEF_TYPE) {\n if (typeof module !== UNDEF_TYPE && module.exports) {\n exports = module.exports = UAParser2;\n }\n exports.UAParser = UAParser2;\n } else {\n if (typeof define === FUNC_TYPE && define.amd) {\n define(function() {\n return UAParser2;\n });\n } else if (typeof window2 !== UNDEF_TYPE) {\n window2.UAParser = UAParser2;\n }\n }\n var $ = typeof window2 !== UNDEF_TYPE && (window2.jQuery || window2.Zepto);\n if ($ && !$.ua) {\n var parser = new UAParser2();\n $.ua = parser.getResult();\n $.ua.get = function() {\n return parser.getUA();\n };\n $.ua.set = function(ua) {\n parser.setUA(ua);\n var result = parser.getResult();\n for (var prop in result) {\n $.ua[prop] = result[prop];\n }\n };\n }\n })(typeof window === "object" ? window : exports);\n }\n });\n\n // packages/dev-tools/client/utils.ts\n var goToSection = (shadow, view) => {\n closeToasts(shadow);\n const aside = shadow.querySelector("aside");\n aside.dataset.view = view;\n aside.classList.remove("section-ready");\n setTimeout(() => {\n aside.classList.add("section-ready");\n }, 200);\n };\n var initBackButtons = (shadow) => {\n Array.from(shadow.querySelectorAll(".back-button")).forEach((elm) => {\n elm.addEventListener("click", (ev) => {\n closeToasts(shadow);\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n goToSection(shadow, target?.dataset.back || "nav-home");\n });\n });\n };\n var showToast = (shadow, html) => {\n closeToasts(shadow);\n const aside = shadow.querySelector("aside");\n const toast = document.createElement("div");\n toast.className = `ui-toast`;\n toast.innerHTML = html;\n aside.appendChild(toast);\n setTimeout(() => {\n toast.classList.add("ui-toast-show");\n setTimeout(() => {\n toast.classList.remove("ui-toast-show");\n setTimeout(() => {\n toast.remove();\n }, 500);\n }, 4e3);\n }, 30);\n };\n var closeToasts = (shadow) => {\n const aside = shadow.querySelector("aside");\n const existing = Array.from(aside.querySelectorAll(".ui-toast"));\n existing.forEach((el) => {\n el.classList.remove("ui-toast-show");\n });\n };\n var isEditEnabled = () => {\n const key = getDisableEditKey();\n return localStorage.getItem(key) !== "true";\n };\n var enableEdit = (enable) => {\n const key = getDisableEditKey();\n if (enable) {\n localStorage.removeItem(key);\n } else {\n localStorage.setItem(key, "true");\n }\n };\n var getDisableEditKey = () => getLocalStorageKey("disableEdit");\n var getLocalStorageKey = (name) => `builder.__LOCAL_APP_ID__.${name}`;\n var getEditorUrl = () => {\n const contentElm = document.body.querySelector("[builder-content-id]");\n const contentId = contentElm?.getAttribute("builder-content-id");\n return getBuilderContentUrl(contentId);\n };\n var getBuilderContentUrl = (contentId, blockId) => {\n let pathname = "/content";\n if (contentId) {\n pathname += "/" + contentId + "/edit";\n }\n const url = new URL(pathname, "https://builder.io");\n if (contentId && blockId) {\n url.searchParams.set("selectedBlock", blockId);\n }\n const previewUrl = new URL(location.pathname, location.href);\n url.searchParams.set("overridePreviewUrl", previewUrl.href);\n return url.href;\n };\n var DEV_TOOLS_URL = "__DEV_TOOLS_URL__";\n var APP_STATE = {\n components: [],\n registryPath: "",\n registryDisplayPath: "",\n frameworks: [],\n dependencies: [],\n publicApiKey: void 0,\n devToolsVersion: ""\n };\n var updateAppState = (registry) => {\n APP_STATE.components = registry.components;\n APP_STATE.registryPath = registry.registryPath;\n APP_STATE.registryDisplayPath = registry.registryDisplayPath;\n APP_STATE.dependencies = registry.dependencies;\n APP_STATE.publicApiKey = registry.publicApiKey;\n };\n\n // packages/dev-tools/client/edit-button/document-listeners.ts\n function initDocumentListeners(editButton) {\n let lastBlockId = null;\n const menu = document.querySelector(\n "builder-dev-tools-menu"\n );\n const hideEditButton = () => {\n editButton.hide();\n };\n const onPointerOver = (ev) => {\n const hoverElm = ev.target;\n if (!hoverElm) {\n hideEditButton();\n return;\n }\n if (hoverElm.closest("builder-dev-tools-edit")) {\n return;\n }\n const contentElm = hoverElm.closest("[builder-content-id]");\n const blockElm = hoverElm.closest("[builder-id]");\n if (!contentElm || !blockElm) {\n editButton.hide();\n return;\n }\n const blockId = editButton.show(contentElm, blockElm);\n if (!blockId || blockId === lastBlockId) {\n return;\n }\n menu.highlightOpener();\n lastBlockId = blockId;\n };\n document.addEventListener("pointerover", onPointerOver, { passive: true });\n document.addEventListener("pointerleave", hideEditButton, {\n passive: true\n });\n document.addEventListener("pointercancel", hideEditButton, {\n passive: true\n });\n document.addEventListener("visibilitychange", hideEditButton, {\n passive: true\n });\n window.addEventListener("popstate", hideEditButton, { passive: true });\n const originalPushState = history.pushState;\n history.pushState = function(...args) {\n editButton.hide();\n originalPushState.apply(this, args);\n };\n const originalReplaceState = history.replaceState;\n history.replaceState = function(...args) {\n editButton.hide();\n originalReplaceState.apply(this, args);\n };\n }\n\n // packages/dev-tools/client/edit-button/index.ts\n var BuilderDevToolsEditButton = class extends HTMLElement {\n openInBuilder = null;\n block = null;\n constructor() {\n super();\n }\n connectedCallback() {\n this.setAttribute("aria-hidden", "true");\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = \'<style>/* packages/dev-tools/client/common.css */\\n*,\\n*::before,\\n*::after {\\n box-sizing: border-box;\\n}\\n:host {\\n --background-color: rgba(40, 40, 40, 1);\\n --primary-color: rgba(72, 161, 255, 1);\\n --primary-color-subdued: rgb(72, 161, 255, 0.6);\\n --primary-color-highlight: rgb(126, 188, 255);\\n --primary-contrast-color: white;\\n --edit-color: #1d74e2;\\n --edit-color-highlight: #1c6bd1;\\n --edit-color-alpha: rgb(72, 161, 255, 0.15);\\n --error-color: #ff2b55;\\n --text-color: white;\\n --text-color-highlight: white;\\n --border-color: #454545;\\n --button-background-color-hover: rgba(255, 255, 255, 0.1);\\n --menu-width: 320px;\\n --transition-time: 150ms;\\n --font-family:\\n ui-sans-serif,\\n system-ui,\\n -apple-system,\\n BlinkMacSystemFont,\\n "Segoe UI",\\n Roboto,\\n "Helvetica Neue",\\n Arial,\\n "Noto Sans",\\n sans-serif,\\n "Apple Color Emoji",\\n "Segoe UI Emoji",\\n "Segoe UI Symbol",\\n "Noto Color Emoji";\\n font-family: var(--font-family);\\n line-height: 1.6;\\n}\\nbutton {\\n cursor: pointer;\\n color: var(--text-color);\\n -webkit-tap-highlight-color: transparent;\\n}\\ninput,\\nselect,\\nbutton {\\n font-family: var(--font-family);\\n}\\n\\n/* packages/dev-tools/client/edit-button/edit-button.css */\\n:host {\\n display: none;\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n z-index: 2147483646;\\n user-select: none;\\n pointer-events: none;\\n color: var(--text-color);\\n}\\n#content-highlight,\\n#block {\\n position: absolute;\\n}\\n#content-highlight {\\n border: 3px solid var(--primary-color);\\n background-color: var(--primary-color-alpha);\\n}\\na {\\n position: absolute;\\n top: -33px;\\n left: 0;\\n display: block;\\n padding: 5px 10px 8px 10px;\\n pointer-events: auto;\\n z-index: 100;\\n text-decoration: none;\\n}\\na:hover {\\n text-decoration: none;\\n}\\na span {\\n display: block;\\n padding: 3px 6px;\\n font-size: 10px;\\n font-weight: 300;\\n border-radius: 3px;\\n text-align: center;\\n text-decoration: none;\\n pointer-events: none;\\n background-color: var(--edit-color);\\n color: var(--text-color);\\n white-space: nowrap;\\n}\\na:hover span {\\n background-color: var(--edit-color-highlight);\\n}\\na:hover ~ .outline {\\n border-color: var(--edit-color-highlight);\\n}\\n#open-in-editor {\\n display: none;\\n}\\n.outline {\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n border: 1px solid var(--edit-color);\\n background-color: var(--edit-color-alpha);\\n}</style><div id="block"> <a id="open-in-builder" target="builder"><span>Open In Builder</span></a> <a id="open-in-editor" href="#open-in-editor"><span>Open In Editor</span></a> <div class="outline"></div> </div>\';\n this.openInBuilder = shadow.getElementById(\n "open-in-builder"\n );\n this.block = shadow.getElementById("block");\n initDocumentListeners(this);\n }\n show(contentElm, blockElm) {\n if (!isEditEnabled()) {\n this.hide();\n return null;\n }\n const contentId = contentElm.getAttribute("builder-content-id");\n const blockId = blockElm.getAttribute("builder-id");\n if (!contentId || !blockId) {\n this.hide();\n return null;\n }\n const block = this.block;\n const openInBuilder = this.openInBuilder;\n const builderRect = blockElm.getBoundingClientRect();\n block.style.top = builderRect.top + window.scrollY - 1 + "px";\n block.style.left = builderRect.left + window.scrollX + "px";\n block.style.width = builderRect.width + "px";\n block.style.height = builderRect.height + 1 + "px";\n const openInBuilderRect = openInBuilder.getBoundingClientRect();\n if (openInBuilderRect.width > builderRect.width) {\n const diff = openInBuilderRect.width - builderRect.width;\n openInBuilder.style.left = diff / 2 * -1 + "px";\n } else {\n openInBuilder.style.left = "";\n }\n openInBuilder.href = getBuilderContentUrl(contentId, blockId);\n this.style.display = "block";\n return blockId;\n }\n hide() {\n this.style.display = "";\n }\n };\n\n // packages/dev-tools/common/constants.ts\n var PREVIEW_URL_QS = `preview-url`;\n var CONNECTED_USER_ID_QS = "_b-uid";\n var BUILDER_AUTH_CONNECT_PATH = "/~builder-connect";\n var DEV_TOOLS_API_PATH = "/~builder-dev-tools";\n var AMPLITUDE_PROXY_URL = "https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";\n\n // packages/dev-tools/client/client-api.ts\n var apiValidateBuilder = () => apiFetch({\n type: "validateBuilder"\n });\n var apiLaunchEditor = (file) => apiFetch({\n type: "launchEditor",\n data: file\n });\n var apiRegistry = (opts) => apiFetch({\n type: "getRegistry",\n data: opts\n });\n var apiLoadComponent = (opts) => apiFetch({\n type: "loadComponent",\n data: opts\n });\n var apiRegisterComponent = (opts) => apiFetch({\n type: "registerComponent",\n data: opts\n });\n var apiSetComponentInfo = (opts) => apiFetch({\n type: "setComponentInfo",\n data: opts\n });\n var apiSetComponentInput = (opts) => apiFetch({\n type: "setComponentInput",\n data: opts\n });\n var apiUnregisterComponent = (opts) => apiFetch({\n type: "unregisterComponent",\n data: opts\n });\n var apiDevToolsEnabled = (enabled) => apiFetch({\n type: "enableDevTools",\n data: { enabled }\n });\n var apiLocalConfig = () => apiFetch({ type: "localConfig" });\n var apiFetch = async (data) => {\n const url = new URL(DEV_TOOLS_API_PATH, DEV_TOOLS_URL);\n let rsp;\n try {\n rsp = await fetch(url, {\n method: "POST",\n body: JSON.stringify(data)\n });\n } catch (e) {\n console.error(`Devtools Fetch Error, ${url.href}`, e);\n throw new Error(`Builder Devtools Fetch Error`);\n }\n const contentType = rsp.headers.get("content-type") || "";\n if (contentType.includes("application/json")) {\n const r = await rsp.json();\n if (rsp.ok) {\n return r.data;\n }\n if (Array.isArray(r.errors) && r.errors.length > 0) {\n r.errors.forEach((e) => console.error(e));\n throw new Error(`Builder Devtools Fetch Error: ${r.errors[0]}`);\n }\n }\n throw new Error(\n `Builder Devtools Fetch Error: ${rsp.status}, ${await rsp.text()}`\n );\n };\n\n // packages/dev-tools/common/ast/component-input-types.ts\n var INPUT_TYPES = [\n { value: "boolean", text: "boolean" },\n { value: "color", text: "color (provides a color in hex or rgb)" },\n { value: "date", text: "date (same format as the Date constructor)" },\n { value: "email", text: "email" },\n { value: "file", text: "file (uploads a file and provides a url)" },\n { value: "list", text: "list (collection of items)" },\n { value: "longText", text: "longText (multiline text editor)" },\n { value: "number", text: "number" },\n { value: "object", text: "object (set of specific names and values)" },\n { value: "richText", text: "richText (provides value as html)" },\n { value: "string", text: "string" }\n ];\n var STRING_TYPES = [\n "color",\n "date",\n "email",\n "file",\n "longText",\n "richText",\n "string"\n ];\n var NUMBER_TYPES = ["number"];\n var BOOLEAN_TYPES = ["boolean"];\n var ARRAY_TYPES = ["list"];\n var OBJECT_TYPES = ["object"];\n function getPrimitiveType(t) {\n if (STRING_TYPES.includes(t)) {\n return "string";\n } else if (NUMBER_TYPES.includes(t)) {\n return "number";\n } else if (BOOLEAN_TYPES.includes(t)) {\n return "boolean";\n } else if (ARRAY_TYPES.includes(t)) {\n return "array";\n } else if (OBJECT_TYPES.includes(t)) {\n return "object";\n } else {\n return "string";\n }\n }\n var PROP_BLACKLIST = new Set(\n [\n "about",\n "accessKey",\n "accessKeyLabel",\n "asChild",\n "autoCapitalize",\n "autoCorrect",\n "autoFocus",\n "autoSave",\n "blur",\n "contentEditable",\n "contextMenu",\n "dangerouslySetInnerHTML",\n "datatype",\n "defaultChecked",\n "defaultValue",\n "dir",\n "draggable",\n "enterKeyHint",\n "focus",\n "form",\n "formAction",\n "formEncType",\n "formMethod",\n "formNoValidate",\n "formTarget",\n "inlist",\n "innerText",\n "inputMode",\n "is",\n "isContentEditable",\n "itemID",\n "itemProp",\n "itemRef",\n "itemScope",\n "itemType",\n "lang",\n "nonce",\n "offsetHeight",\n "offsetLeft",\n "offsetTop",\n "offsetWidth",\n "outerText",\n "prefix",\n "property",\n "radioGroup",\n "rel",\n "resource",\n "results",\n "rev",\n "role",\n "security",\n "slot",\n "spellCheck",\n "suppressContentEditableWarning",\n "suppressHydrationWarning",\n "tabIndex",\n "translate",\n "typeof",\n "unselectable",\n "vocab"\n ].map((s) => s.toLowerCase())\n );\n\n // node_modules/tslib/tslib.es6.mjs\n var extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {\n d2.__proto__ = b2;\n } || function(d2, b2) {\n for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];\n };\n return extendStatics(d, b);\n };\n function __extends(d, b) {\n if (typeof b !== "function" && b !== null)\n throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n }\n var __assign = function() {\n __assign = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === "function")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n }\n function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function(resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function(resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator["throw"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n }\n function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() {\n if (t[0] & 1) throw t[1];\n return t[1];\n }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);\n return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([n, v]);\n };\n }\n function step(op) {\n if (f) throw new TypeError("Generator is already executing.");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return { value: op[1], done: false };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return { value: op[0] ? op[1] : void 0, done: true };\n }\n }\n function __values(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = { error };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n }\n\n // node_modules/@amplitude/analytics-types/lib/esm/index.js\n var esm_exports = {};\n __export(esm_exports, {\n IdentifyOperation: () => IdentifyOperation,\n LogLevel: () => LogLevel,\n PluginType: () => PluginType,\n RevenueProperty: () => RevenueProperty,\n ServerZone: () => ServerZone,\n SpecialEventType: () => SpecialEventType,\n Status: () => Status,\n TransportType: () => TransportType\n });\n\n // node_modules/@amplitude/analytics-types/lib/esm/event.js\n var IdentifyOperation;\n (function(IdentifyOperation2) {\n IdentifyOperation2["SET"] = "$set";\n IdentifyOperation2["SET_ONCE"] = "$setOnce";\n IdentifyOperation2["ADD"] = "$add";\n IdentifyOperation2["APPEND"] = "$append";\n IdentifyOperation2["PREPEND"] = "$prepend";\n IdentifyOperation2["REMOVE"] = "$remove";\n IdentifyOperation2["PREINSERT"] = "$preInsert";\n IdentifyOperation2["POSTINSERT"] = "$postInsert";\n IdentifyOperation2["UNSET"] = "$unset";\n IdentifyOperation2["CLEAR_ALL"] = "$clearAll";\n })(IdentifyOperation || (IdentifyOperation = {}));\n var RevenueProperty;\n (function(RevenueProperty2) {\n RevenueProperty2["REVENUE_PRODUCT_ID"] = "$productId";\n RevenueProperty2["REVENUE_QUANTITY"] = "$quantity";\n RevenueProperty2["REVENUE_PRICE"] = "$price";\n RevenueProperty2["REVENUE_TYPE"] = "$revenueType";\n RevenueProperty2["REVENUE_CURRENCY"] = "$currency";\n RevenueProperty2["REVENUE"] = "$revenue";\n })(RevenueProperty || (RevenueProperty = {}));\n var SpecialEventType;\n (function(SpecialEventType2) {\n SpecialEventType2["IDENTIFY"] = "$identify";\n SpecialEventType2["GROUP_IDENTIFY"] = "$groupidentify";\n SpecialEventType2["REVENUE"] = "revenue_amount";\n })(SpecialEventType || (SpecialEventType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/logger.js\n var LogLevel;\n (function(LogLevel2) {\n LogLevel2[LogLevel2["None"] = 0] = "None";\n LogLevel2[LogLevel2["Error"] = 1] = "Error";\n LogLevel2[LogLevel2["Warn"] = 2] = "Warn";\n LogLevel2[LogLevel2["Verbose"] = 3] = "Verbose";\n LogLevel2[LogLevel2["Debug"] = 4] = "Debug";\n })(LogLevel || (LogLevel = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/plugin.js\n var PluginType;\n (function(PluginType2) {\n PluginType2["BEFORE"] = "before";\n PluginType2["ENRICHMENT"] = "enrichment";\n PluginType2["DESTINATION"] = "destination";\n })(PluginType || (PluginType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/server-zone.js\n var ServerZone;\n (function(ServerZone2) {\n ServerZone2["US"] = "US";\n ServerZone2["EU"] = "EU";\n ServerZone2["STAGING"] = "STAGING";\n })(ServerZone || (ServerZone = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/status.js\n var Status;\n (function(Status2) {\n Status2["Unknown"] = "unknown";\n Status2["Skipped"] = "skipped";\n Status2["Success"] = "success";\n Status2["RateLimit"] = "rate_limit";\n Status2["PayloadTooLarge"] = "payload_too_large";\n Status2["Invalid"] = "invalid";\n Status2["Failed"] = "failed";\n Status2["Timeout"] = "Timeout";\n Status2["SystemError"] = "SystemError";\n })(Status || (Status = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/transport.js\n var TransportType;\n (function(TransportType2) {\n TransportType2["XHR"] = "xhr";\n TransportType2["SendBeacon"] = "beacon";\n TransportType2["Fetch"] = "fetch";\n })(TransportType || (TransportType = {}));\n\n // node_modules/@amplitude/analytics-core/lib/esm/constants.js\n var UNSET_VALUE = "-";\n var AMPLITUDE_PREFIX = "AMP";\n var STORAGE_PREFIX = "".concat(AMPLITUDE_PREFIX, "_unsent");\n var AMPLITUDE_SERVER_URL = "https://api2.amplitude.com/2/httpapi";\n var EU_AMPLITUDE_SERVER_URL = "https://api.eu.amplitude.com/2/httpapi";\n var AMPLITUDE_BATCH_SERVER_URL = "https://api2.amplitude.com/batch";\n var EU_AMPLITUDE_BATCH_SERVER_URL = "https://api.eu.amplitude.com/batch";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js\n var MAX_PROPERTY_KEYS = 1e3;\n var isValidObject = function(properties) {\n if (Object.keys(properties).length > MAX_PROPERTY_KEYS) {\n return false;\n }\n for (var key in properties) {\n var value = properties[key];\n if (!isValidProperties(key, value))\n return false;\n }\n return true;\n };\n var isValidProperties = function(property, value) {\n var e_1, _a;\n if (typeof property !== "string")\n return false;\n if (Array.isArray(value)) {\n var isValid = true;\n try {\n for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {\n var valueElement = value_1_1.value;\n if (Array.isArray(valueElement)) {\n return false;\n } else if (typeof valueElement === "object") {\n isValid = isValid && isValidObject(valueElement);\n } else if (!["number", "string"].includes(typeof valueElement)) {\n return false;\n }\n if (!isValid) {\n return false;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n } else if (value === null || value === void 0) {\n return false;\n } else if (typeof value === "object") {\n return isValidObject(value);\n } else if (!["number", "string", "boolean"].includes(typeof value)) {\n return false;\n }\n return true;\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/identify.js\n var Identify = (\n /** @class */\n (function() {\n function Identify2() {\n this._propertySet = /* @__PURE__ */ new Set();\n this._properties = {};\n }\n Identify2.prototype.getUserProperties = function() {\n return __assign({}, this._properties);\n };\n Identify2.prototype.set = function(property, value) {\n this._safeSet(IdentifyOperation.SET, property, value);\n return this;\n };\n Identify2.prototype.setOnce = function(property, value) {\n this._safeSet(IdentifyOperation.SET_ONCE, property, value);\n return this;\n };\n Identify2.prototype.append = function(property, value) {\n this._safeSet(IdentifyOperation.APPEND, property, value);\n return this;\n };\n Identify2.prototype.prepend = function(property, value) {\n this._safeSet(IdentifyOperation.PREPEND, property, value);\n return this;\n };\n Identify2.prototype.postInsert = function(property, value) {\n this._safeSet(IdentifyOperation.POSTINSERT, property, value);\n return this;\n };\n Identify2.prototype.preInsert = function(property, value) {\n this._safeSet(IdentifyOperation.PREINSERT, property, value);\n return this;\n };\n Identify2.prototype.remove = function(property, value) {\n this._safeSet(IdentifyOperation.REMOVE, property, value);\n return this;\n };\n Identify2.prototype.add = function(property, value) {\n this._safeSet(IdentifyOperation.ADD, property, value);\n return this;\n };\n Identify2.prototype.unset = function(property) {\n this._safeSet(IdentifyOperation.UNSET, property, UNSET_VALUE);\n return this;\n };\n Identify2.prototype.clearAll = function() {\n this._properties = {};\n this._properties[IdentifyOperation.CLEAR_ALL] = UNSET_VALUE;\n return this;\n };\n Identify2.prototype._safeSet = function(operation, property, value) {\n if (this._validate(operation, property, value)) {\n var userPropertyMap = this._properties[operation];\n if (userPropertyMap === void 0) {\n userPropertyMap = {};\n this._properties[operation] = userPropertyMap;\n }\n userPropertyMap[property] = value;\n this._propertySet.add(property);\n return true;\n }\n return false;\n };\n Identify2.prototype._validate = function(operation, property, value) {\n if (this._properties[IdentifyOperation.CLEAR_ALL] !== void 0) {\n return false;\n }\n if (this._propertySet.has(property)) {\n return false;\n }\n if (operation === IdentifyOperation.ADD) {\n return typeof value === "number";\n }\n if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {\n return isValidProperties(property, value);\n }\n return true;\n };\n return Identify2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js\n var createTrackEvent = function(eventInput, eventProperties, eventOptions) {\n var baseEvent = typeof eventInput === "string" ? { event_type: eventInput } : eventInput;\n return __assign(__assign(__assign({}, baseEvent), eventOptions), eventProperties && { event_properties: eventProperties });\n };\n var createIdentifyEvent = function(identify2, eventOptions) {\n var identifyEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties() });\n return identifyEvent;\n };\n var createGroupIdentifyEvent = function(groupType, groupName, identify2, eventOptions) {\n var _a;\n var groupIdentify2 = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.GROUP_IDENTIFY, group_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupIdentify2;\n };\n var createGroupEvent = function(groupType, groupName, eventOptions) {\n var _a;\n var identify2 = new Identify();\n identify2.set(groupType, groupName);\n var groupEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupEvent;\n };\n var createRevenueEvent = function(revenue2, eventOptions) {\n return __assign(__assign({}, eventOptions), { event_type: SpecialEventType.REVENUE, event_properties: revenue2.getEventProperties() });\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js\n var buildResult = function(event, code, message) {\n if (code === void 0) {\n code = 0;\n }\n if (message === void 0) {\n message = Status.Unknown;\n }\n return { event, code, message };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/timeline.js\n var Timeline = (\n /** @class */\n (function() {\n function Timeline2(client) {\n this.client = client;\n this.queue = [];\n this.applying = false;\n this.plugins = [];\n }\n Timeline2.prototype.register = function(plugin, config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, plugin.setup(config, this.client)];\n case 1:\n _a.sent();\n this.plugins.push(plugin);\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.deregister = function(pluginName, config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var index, plugin;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n index = this.plugins.findIndex(function(plugin2) {\n return plugin2.name === pluginName;\n });\n if (index === -1) {\n config.loggerProvider.warn("Plugin with name ".concat(pluginName, " does not exist, skipping deregistration"));\n return [\n 2\n /*return*/\n ];\n }\n plugin = this.plugins[index];\n this.plugins.splice(index, 1);\n return [4, (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin)];\n case 1:\n _b.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.reset = function(client) {\n this.applying = false;\n var plugins = this.plugins;\n plugins.map(function(plugin) {\n var _a;\n return (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin);\n });\n this.plugins = [];\n this.client = client;\n };\n Timeline2.prototype.push = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n _this.queue.push([event, resolve]);\n _this.scheduleApply(0);\n });\n };\n Timeline2.prototype.scheduleApply = function(timeout) {\n var _this = this;\n if (this.applying)\n return;\n this.applying = true;\n setTimeout(function() {\n void _this.apply(_this.queue.shift()).then(function() {\n _this.applying = false;\n if (_this.queue.length > 0) {\n _this.scheduleApply(0);\n }\n });\n }, timeout);\n };\n Timeline2.prototype.apply = function(item) {\n return __awaiter(this, void 0, void 0, function() {\n var _a, event, _b, resolve, before, before_1, before_1_1, plugin, e, e_1_1, enrichment, enrichment_1, enrichment_1_1, plugin, e, e_2_1, destination, executeDestinations;\n var e_1, _c, e_2, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n if (!item) {\n return [\n 2\n /*return*/\n ];\n }\n _a = __read(item, 1), event = _a[0];\n _b = __read(item, 2), resolve = _b[1];\n before = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.BEFORE;\n });\n _e.label = 1;\n case 1:\n _e.trys.push([1, 6, 7, 8]);\n before_1 = __values(before), before_1_1 = before_1.next();\n _e.label = 2;\n case 2:\n if (!!before_1_1.done) return [3, 5];\n plugin = before_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 3:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 4;\n case 4:\n before_1_1 = before_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (before_1_1 && !before_1_1.done && (_c = before_1.return)) _c.call(before_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n enrichment = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.ENRICHMENT;\n });\n _e.label = 9;\n case 9:\n _e.trys.push([9, 14, 15, 16]);\n enrichment_1 = __values(enrichment), enrichment_1_1 = enrichment_1.next();\n _e.label = 10;\n case 10:\n if (!!enrichment_1_1.done) return [3, 13];\n plugin = enrichment_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 11:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 12;\n case 12:\n enrichment_1_1 = enrichment_1.next();\n return [3, 10];\n case 13:\n return [3, 16];\n case 14:\n e_2_1 = _e.sent();\n e_2 = { error: e_2_1 };\n return [3, 16];\n case 15:\n try {\n if (enrichment_1_1 && !enrichment_1_1.done && (_d = enrichment_1.return)) _d.call(enrichment_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 16:\n destination = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin2) {\n var eventClone = __assign({}, event);\n return plugin2.execute(eventClone).catch(function(e2) {\n return buildResult(eventClone, 0, String(e2));\n });\n });\n void Promise.all(executeDestinations).then(function(_a2) {\n var _b2 = __read(_a2, 1), result = _b2[0];\n resolve(result);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.flush = function() {\n return __awaiter(this, void 0, void 0, function() {\n var queue, destination, executeDestinations;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n queue = this.queue;\n this.queue = [];\n return [4, Promise.all(queue.map(function(item) {\n return _this.apply(item);\n }))];\n case 1:\n _a.sent();\n destination = this.plugins.filter(function(plugin) {\n return plugin.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin) {\n return plugin.flush && plugin.flush();\n });\n return [4, Promise.all(executeDestinations)];\n case 2:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return Timeline2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/messages.js\n var SUCCESS_MESSAGE = "Event tracked successfully";\n var UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";\n var MAX_RETRIES_EXCEEDED_MESSAGE = "Event rejected due to exceeded retry count";\n var OPT_OUT_MESSAGE = "Event skipped due to optOut config";\n var MISSING_API_KEY_MESSAGE = "Event rejected due to missing API key";\n var INVALID_API_KEY = "Invalid API key";\n var CLIENT_NOT_INITIALIZED = "Client not initialized";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js\n var returnWrapper = function(awaitable) {\n return {\n promise: awaitable || Promise.resolve()\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/core-client.js\n var AmplitudeCore = (\n /** @class */\n (function() {\n function AmplitudeCore2(name) {\n if (name === void 0) {\n name = "$default";\n }\n this.initializing = false;\n this.q = [];\n this.dispatchQ = [];\n this.logEvent = this.track.bind(this);\n this.timeline = new Timeline(this);\n this.name = name;\n }\n AmplitudeCore2.prototype._init = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n this.config = config;\n this.timeline.reset(this);\n return [4, this.runQueuedFunctions("q")];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.runQueuedFunctions = function(queueName) {\n return __awaiter(this, void 0, void 0, function() {\n var queuedFunctions, queuedFunctions_1, queuedFunctions_1_1, queuedFunction, e_1_1;\n var e_1, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n queuedFunctions = this[queueName];\n this[queueName] = [];\n _b.label = 1;\n case 1:\n _b.trys.push([1, 6, 7, 8]);\n queuedFunctions_1 = __values(queuedFunctions), queuedFunctions_1_1 = queuedFunctions_1.next();\n _b.label = 2;\n case 2:\n if (!!queuedFunctions_1_1.done) return [3, 5];\n queuedFunction = queuedFunctions_1_1.value;\n return [4, queuedFunction()];\n case 3:\n _b.sent();\n _b.label = 4;\n case 4:\n queuedFunctions_1_1 = queuedFunctions_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _b.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (queuedFunctions_1_1 && !queuedFunctions_1_1.done && (_a = queuedFunctions_1.return)) _a.call(queuedFunctions_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.track = function(eventInput, eventProperties, eventOptions) {\n var event = createTrackEvent(eventInput, eventProperties, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.identify = function(identify2, eventOptions) {\n var event = createIdentifyEvent(identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n var event = createGroupIdentifyEvent(groupType, groupName, identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.setGroup = function(groupType, groupName, eventOptions) {\n var event = createGroupEvent(groupType, groupName, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.revenue = function(revenue2, eventOptions) {\n var event = createRevenueEvent(revenue2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.add = function(plugin) {\n if (!this.config) {\n this.q.push(this.add.bind(this, plugin));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.register(plugin, this.config));\n };\n AmplitudeCore2.prototype.remove = function(pluginName) {\n if (!this.config) {\n this.q.push(this.remove.bind(this, pluginName));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.deregister(pluginName, this.config));\n };\n AmplitudeCore2.prototype.dispatchWithCallback = function(event, callback) {\n if (!this.config) {\n return callback(buildResult(event, 0, CLIENT_NOT_INITIALIZED));\n }\n void this.process(event).then(callback);\n };\n AmplitudeCore2.prototype.dispatch = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n if (!this.config) {\n return [2, new Promise(function(resolve) {\n _this.dispatchQ.push(_this.dispatchWithCallback.bind(_this, event, resolve));\n })];\n }\n return [2, this.process(event)];\n });\n });\n };\n AmplitudeCore2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var result, e_2, message, result;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n if (this.config.optOut) {\n return [2, buildResult(event, 0, OPT_OUT_MESSAGE)];\n }\n return [4, this.timeline.push(event)];\n case 1:\n result = _a.sent();\n result.code === 200 ? this.config.loggerProvider.log(result.message) : this.config.loggerProvider.error(result.message);\n return [2, result];\n case 2:\n e_2 = _a.sent();\n this.config.loggerProvider.error(e_2);\n message = String(e_2);\n result = buildResult(event, 0, message);\n return [2, result];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.setOptOut = function(optOut) {\n if (!this.config) {\n this.q.push(this.setOptOut.bind(this, Boolean(optOut)));\n return;\n }\n this.config.optOut = Boolean(optOut);\n };\n AmplitudeCore2.prototype.flush = function() {\n return returnWrapper(this.timeline.flush());\n };\n return AmplitudeCore2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/revenue.js\n var Revenue = (\n /** @class */\n (function() {\n function Revenue2() {\n this.productId = "";\n this.quantity = 1;\n this.price = 0;\n }\n Revenue2.prototype.setProductId = function(productId) {\n this.productId = productId;\n return this;\n };\n Revenue2.prototype.setQuantity = function(quantity) {\n if (quantity > 0) {\n this.quantity = quantity;\n }\n return this;\n };\n Revenue2.prototype.setPrice = function(price) {\n this.price = price;\n return this;\n };\n Revenue2.prototype.setRevenueType = function(revenueType) {\n this.revenueType = revenueType;\n return this;\n };\n Revenue2.prototype.setCurrency = function(currency) {\n this.currency = currency;\n return this;\n };\n Revenue2.prototype.setRevenue = function(revenue2) {\n this.revenue = revenue2;\n return this;\n };\n Revenue2.prototype.setEventProperties = function(properties) {\n if (isValidObject(properties)) {\n this.properties = properties;\n }\n return this;\n };\n Revenue2.prototype.getEventProperties = function() {\n var eventProperties = this.properties ? __assign({}, this.properties) : {};\n eventProperties[RevenueProperty.REVENUE_PRODUCT_ID] = this.productId;\n eventProperties[RevenueProperty.REVENUE_QUANTITY] = this.quantity;\n eventProperties[RevenueProperty.REVENUE_PRICE] = this.price;\n eventProperties[RevenueProperty.REVENUE_TYPE] = this.revenueType;\n eventProperties[RevenueProperty.REVENUE_CURRENCY] = this.currency;\n eventProperties[RevenueProperty.REVENUE] = this.revenue;\n return eventProperties;\n };\n return Revenue2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js\n var chunk = function(arr, size) {\n var chunkSize = Math.max(size, 1);\n return arr.reduce(function(chunks, element, index) {\n var chunkIndex = Math.floor(index / chunkSize);\n if (!chunks[chunkIndex]) {\n chunks[chunkIndex] = [];\n }\n chunks[chunkIndex].push(element);\n return chunks;\n }, []);\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/logger.js\n var PREFIX = "Amplitude Logger ";\n var Logger = (\n /** @class */\n (function() {\n function Logger2() {\n this.logLevel = LogLevel.None;\n }\n Logger2.prototype.disable = function() {\n this.logLevel = LogLevel.None;\n };\n Logger2.prototype.enable = function(logLevel) {\n if (logLevel === void 0) {\n logLevel = LogLevel.Warn;\n }\n this.logLevel = logLevel;\n };\n Logger2.prototype.log = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Verbose) {\n return;\n }\n console.log("".concat(PREFIX, "[Log]: ").concat(args.join(" ")));\n };\n Logger2.prototype.warn = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Warn) {\n return;\n }\n console.warn("".concat(PREFIX, "[Warn]: ").concat(args.join(" ")));\n };\n Logger2.prototype.error = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Error) {\n return;\n }\n console.error("".concat(PREFIX, "[Error]: ").concat(args.join(" ")));\n };\n Logger2.prototype.debug = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Debug) {\n return;\n }\n console.log("".concat(PREFIX, "[Debug]: ").concat(args.join(" ")));\n };\n return Logger2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/config.js\n var getDefaultConfig = function() {\n return {\n flushMaxRetries: 12,\n flushQueueSize: 200,\n flushIntervalMillis: 1e4,\n instanceName: "$default_instance",\n logLevel: LogLevel.Warn,\n loggerProvider: new Logger(),\n optOut: false,\n serverUrl: AMPLITUDE_SERVER_URL,\n serverZone: ServerZone.US,\n useBatch: false\n };\n };\n var Config = (\n /** @class */\n (function() {\n function Config2(options) {\n var _a, _b, _c, _d;\n this._optOut = false;\n var defaultConfig = getDefaultConfig();\n this.apiKey = options.apiKey;\n this.flushIntervalMillis = (_a = options.flushIntervalMillis) !== null && _a !== void 0 ? _a : defaultConfig.flushIntervalMillis;\n this.flushMaxRetries = options.flushMaxRetries || defaultConfig.flushMaxRetries;\n this.flushQueueSize = options.flushQueueSize || defaultConfig.flushQueueSize;\n this.instanceName = options.instanceName || defaultConfig.instanceName;\n this.loggerProvider = options.loggerProvider || defaultConfig.loggerProvider;\n this.logLevel = (_b = options.logLevel) !== null && _b !== void 0 ? _b : defaultConfig.logLevel;\n this.minIdLength = options.minIdLength;\n this.plan = options.plan;\n this.ingestionMetadata = options.ingestionMetadata;\n this.optOut = (_c = options.optOut) !== null && _c !== void 0 ? _c : defaultConfig.optOut;\n this.serverUrl = options.serverUrl;\n this.serverZone = options.serverZone || defaultConfig.serverZone;\n this.storageProvider = options.storageProvider;\n this.transportProvider = options.transportProvider;\n this.useBatch = (_d = options.useBatch) !== null && _d !== void 0 ? _d : defaultConfig.useBatch;\n this.loggerProvider.enable(this.logLevel);\n var serverConfig = createServerConfig(options.serverUrl, options.serverZone, options.useBatch);\n this.serverZone = serverConfig.serverZone;\n this.serverUrl = serverConfig.serverUrl;\n }\n Object.defineProperty(Config2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n this._optOut = optOut;\n },\n enumerable: false,\n configurable: true\n });\n return Config2;\n })()\n );\n var getServerUrl = function(serverZone, useBatch) {\n if (serverZone === ServerZone.EU) {\n return useBatch ? EU_AMPLITUDE_BATCH_SERVER_URL : EU_AMPLITUDE_SERVER_URL;\n }\n return useBatch ? AMPLITUDE_BATCH_SERVER_URL : AMPLITUDE_SERVER_URL;\n };\n var createServerConfig = function(serverUrl, serverZone, useBatch) {\n if (serverUrl === void 0) {\n serverUrl = "";\n }\n if (serverZone === void 0) {\n serverZone = getDefaultConfig().serverZone;\n }\n if (useBatch === void 0) {\n useBatch = getDefaultConfig().useBatch;\n }\n if (serverUrl) {\n return { serverUrl, serverZone: void 0 };\n }\n var _serverZone = ["US", "EU"].includes(serverZone) ? serverZone : getDefaultConfig().serverZone;\n return {\n serverZone: _serverZone,\n serverUrl: getServerUrl(_serverZone, useBatch)\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js\n function getErrorMessage(error) {\n if (error instanceof Error)\n return error.message;\n return String(error);\n }\n function getResponseBodyString(res) {\n var responseBodyString = "";\n try {\n if ("body" in res) {\n responseBodyString = JSON.stringify(res.body);\n }\n } catch (_a) {\n }\n return responseBodyString;\n }\n var Destination = (\n /** @class */\n (function() {\n function Destination2() {\n this.name = "amplitude";\n this.type = PluginType.DESTINATION;\n this.retryTimeout = 1e3;\n this.throttleTimeout = 3e4;\n this.storageKey = "";\n this.scheduled = null;\n this.queue = [];\n }\n Destination2.prototype.setup = function(config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var unsent;\n var _this = this;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n this.config = config;\n this.storageKey = "".concat(STORAGE_PREFIX, "_").concat(this.config.apiKey.substring(0, 10));\n return [4, (_a = this.config.storageProvider) === null || _a === void 0 ? void 0 : _a.get(this.storageKey)];\n case 1:\n unsent = _b.sent();\n this.saveEvents();\n if (unsent && unsent.length > 0) {\n void Promise.all(unsent.map(function(event) {\n return _this.execute(event);\n })).catch();\n }\n return [2, Promise.resolve(void 0)];\n }\n });\n });\n };\n Destination2.prototype.execute = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n var context = {\n event,\n attempts: 0,\n callback: function(result) {\n return resolve(result);\n },\n timeout: 0\n };\n void _this.addToQueue(context);\n });\n };\n Destination2.prototype.addToQueue = function() {\n var _this = this;\n var list = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n list[_i] = arguments[_i];\n }\n var tryable = list.filter(function(context) {\n if (context.attempts < _this.config.flushMaxRetries) {\n context.attempts += 1;\n return true;\n }\n void _this.fulfillRequest([context], 500, MAX_RETRIES_EXCEEDED_MESSAGE);\n return false;\n });\n tryable.forEach(function(context) {\n _this.queue = _this.queue.concat(context);\n if (context.timeout === 0) {\n _this.schedule(_this.config.flushIntervalMillis);\n return;\n }\n setTimeout(function() {\n context.timeout = 0;\n _this.schedule(0);\n }, context.timeout);\n });\n this.saveEvents();\n };\n Destination2.prototype.schedule = function(timeout) {\n var _this = this;\n if (this.scheduled)\n return;\n this.scheduled = setTimeout(function() {\n void _this.flush(true).then(function() {\n if (_this.queue.length > 0) {\n _this.schedule(timeout);\n }\n });\n }, timeout);\n };\n Destination2.prototype.flush = function(useRetry) {\n if (useRetry === void 0) {\n useRetry = false;\n }\n return __awaiter(this, void 0, void 0, function() {\n var list, later, batches;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n list = [];\n later = [];\n this.queue.forEach(function(context) {\n return context.timeout === 0 ? list.push(context) : later.push(context);\n });\n this.queue = later;\n if (this.scheduled) {\n clearTimeout(this.scheduled);\n this.scheduled = null;\n }\n batches = chunk(list, this.config.flushQueueSize);\n return [4, Promise.all(batches.map(function(batch) {\n return _this.send(batch, useRetry);\n }))];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.send = function(list, useRetry) {\n if (useRetry === void 0) {\n useRetry = true;\n }\n return __awaiter(this, void 0, void 0, function() {\n var payload, serverUrl, res, e_1, errorMessage;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (!this.config.apiKey) {\n return [2, this.fulfillRequest(list, 400, MISSING_API_KEY_MESSAGE)];\n }\n payload = {\n api_key: this.config.apiKey,\n events: list.map(function(context) {\n var _a2 = context.event, extra = _a2.extra, eventWithoutExtra = __rest(_a2, ["extra"]);\n return eventWithoutExtra;\n }),\n options: {\n min_id_length: this.config.minIdLength\n }\n };\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n serverUrl = createServerConfig(this.config.serverUrl, this.config.serverZone, this.config.useBatch).serverUrl;\n return [4, this.config.transportProvider.send(serverUrl, payload)];\n case 2:\n res = _a.sent();\n if (res === null) {\n this.fulfillRequest(list, 0, UNEXPECTED_ERROR_MESSAGE);\n return [\n 2\n /*return*/\n ];\n }\n if (!useRetry) {\n if ("body" in res) {\n this.fulfillRequest(list, res.statusCode, "".concat(res.status, ": ").concat(getResponseBodyString(res)));\n } else {\n this.fulfillRequest(list, res.statusCode, res.status);\n }\n return [\n 2\n /*return*/\n ];\n }\n this.handleResponse(res, list);\n return [3, 4];\n case 3:\n e_1 = _a.sent();\n this.config.loggerProvider.error(e_1);\n errorMessage = getErrorMessage(e_1);\n this.fulfillRequest(list, 0, errorMessage);\n return [3, 4];\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.handleResponse = function(res, list) {\n var status = res.status;\n switch (status) {\n case Status.Success: {\n this.handleSuccessResponse(res, list);\n break;\n }\n case Status.Invalid: {\n this.handleInvalidResponse(res, list);\n break;\n }\n case Status.PayloadTooLarge: {\n this.handlePayloadTooLargeResponse(res, list);\n break;\n }\n case Status.RateLimit: {\n this.handleRateLimitResponse(res, list);\n break;\n }\n default: {\n this.config.loggerProvider.warn(`{code: 0, error: "Status \'`.concat(status, "\' provided for ").concat(list.length, \' events"}\'));\n this.handleOtherResponse(list);\n break;\n }\n }\n };\n Destination2.prototype.handleSuccessResponse = function(res, list) {\n this.fulfillRequest(list, res.statusCode, SUCCESS_MESSAGE);\n };\n Destination2.prototype.handleInvalidResponse = function(res, list) {\n var _this = this;\n if (res.body.missingField || res.body.error.startsWith(INVALID_API_KEY)) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n var dropIndex = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.values(res.body.eventsWithInvalidFields)), false), __read(Object.values(res.body.eventsWithMissingFields)), false), __read(Object.values(res.body.eventsWithInvalidIdLengths)), false), __read(res.body.silencedEvents), false).flat();\n var dropIndexSet = new Set(dropIndex);\n var retry = list.filter(function(context, index) {\n if (dropIndexSet.has(index)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handlePayloadTooLargeResponse = function(res, list) {\n if (list.length === 1) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n this.config.loggerProvider.warn(getResponseBodyString(res));\n this.config.flushQueueSize /= 2;\n this.addToQueue.apply(this, __spreadArray([], __read(list), false));\n };\n Destination2.prototype.handleRateLimitResponse = function(res, list) {\n var _this = this;\n var dropUserIds = Object.keys(res.body.exceededDailyQuotaUsers);\n var dropDeviceIds = Object.keys(res.body.exceededDailyQuotaDevices);\n var throttledIndex = res.body.throttledEvents;\n var dropUserIdsSet = new Set(dropUserIds);\n var dropDeviceIdsSet = new Set(dropDeviceIds);\n var throttledIndexSet = new Set(throttledIndex);\n var retry = list.filter(function(context, index) {\n if (context.event.user_id && dropUserIdsSet.has(context.event.user_id) || context.event.device_id && dropDeviceIdsSet.has(context.event.device_id)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n if (throttledIndexSet.has(index)) {\n context.timeout = _this.throttleTimeout;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handleOtherResponse = function(list) {\n var _this = this;\n this.addToQueue.apply(this, __spreadArray([], __read(list.map(function(context) {\n context.timeout = context.attempts * _this.retryTimeout;\n return context;\n })), false));\n };\n Destination2.prototype.fulfillRequest = function(list, code, message) {\n this.saveEvents();\n list.forEach(function(context) {\n return context.callback(buildResult(context.event, code, message));\n });\n };\n Destination2.prototype.saveEvents = function() {\n if (!this.config.storageProvider) {\n return;\n }\n var events = Array.from(this.queue.map(function(context) {\n return context.event;\n }));\n void this.config.storageProvider.set(this.storageKey, events);\n };\n return Destination2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js\n var getStacktrace = function(ignoreDepth) {\n if (ignoreDepth === void 0) {\n ignoreDepth = 0;\n }\n var trace = new Error().stack || "";\n return trace.split("\\n").slice(2 + ignoreDepth).map(function(text) {\n return text.trim();\n });\n };\n var getClientLogConfig = function(client) {\n return function() {\n var _a = __assign({}, client.config), logger = _a.loggerProvider, logLevel = _a.logLevel;\n return {\n logger,\n logLevel\n };\n };\n };\n var getValueByStringPath = function(obj, path) {\n var e_1, _a;\n path = path.replace(/\\[(\\w+)\\]/g, ".$1");\n path = path.replace(/^\\./, "");\n try {\n for (var _b = __values(path.split(".")), _c = _b.next(); !_c.done; _c = _b.next()) {\n var attr = _c.value;\n if (attr in obj) {\n obj = obj[attr];\n } else {\n return;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n return obj;\n };\n var getClientStates = function(client, paths) {\n return function() {\n var e_2, _a;\n var res = {};\n try {\n for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {\n var path = paths_1_1.value;\n res[path] = getValueByStringPath(client, path);\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n return res;\n };\n };\n var debugWrapper = function(fn, fnName, getLogConfig, getStates, fnContext) {\n if (fnContext === void 0) {\n fnContext = null;\n }\n return function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = getLogConfig(), logger = _a.logger, logLevel = _a.logLevel;\n if (logLevel && logLevel < LogLevel.Debug || !logLevel || !logger) {\n return fn.apply(fnContext, args);\n }\n var debugContext = {\n type: "invoke public method",\n name: fnName,\n args,\n stacktrace: getStacktrace(1),\n time: {\n start: (/* @__PURE__ */ new Date()).toISOString()\n },\n states: {}\n };\n if (getStates && debugContext.states) {\n debugContext.states.before = getStates();\n }\n var result = fn.apply(fnContext, args);\n if (result && result.promise) {\n result.promise.then(function() {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n });\n } else {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n }\n return result;\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js\n var UUID = function(a) {\n return a ? (\n // a random number from 0 to 15\n (a ^ // unless b is 8,\n Math.random() * // in which case\n 16 >> // a random number from\n a / 4).toString(16)\n ) : (\n // or otherwise a concatenated string:\n (String(1e7) + // 10000000 +\n String(-1e3) + // -1000 +\n String(-4e3) + // -4000 +\n String(-8e3) + // -80000000 +\n String(-1e11)).replace(\n // replacing\n /[018]/g,\n // zeroes, ones, and eights with\n UUID\n )\n );\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/storage/memory.js\n var MemoryStorage = (\n /** @class */\n (function() {\n function MemoryStorage2() {\n this.memoryStorage = /* @__PURE__ */ new Map();\n }\n MemoryStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, true];\n });\n });\n };\n MemoryStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, this.memoryStorage.get(key)];\n });\n });\n };\n MemoryStorage2.prototype.getRaw = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.get(key)];\n case 1:\n value = _a.sent();\n return [2, value ? JSON.stringify(value) : void 0];\n }\n });\n });\n };\n MemoryStorage2.prototype.set = function(key, value) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.set(key, value);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.delete(key);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.clear();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return MemoryStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/transports/base.js\n var BaseTransport = (\n /** @class */\n (function() {\n function BaseTransport2() {\n }\n BaseTransport2.prototype.send = function(_serverUrl, _payload) {\n return Promise.resolve(null);\n };\n BaseTransport2.prototype.buildResponse = function(responseJSON) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;\n if (typeof responseJSON !== "object") {\n return null;\n }\n var statusCode = responseJSON.code || 0;\n var status = this.buildStatus(statusCode);\n switch (status) {\n case Status.Success:\n return {\n status,\n statusCode,\n body: {\n eventsIngested: (_a = responseJSON.events_ingested) !== null && _a !== void 0 ? _a : 0,\n payloadSizeBytes: (_b = responseJSON.payload_size_bytes) !== null && _b !== void 0 ? _b : 0,\n serverUploadTime: (_c = responseJSON.server_upload_time) !== null && _c !== void 0 ? _c : 0\n }\n };\n case Status.Invalid:\n return {\n status,\n statusCode,\n body: {\n error: (_d = responseJSON.error) !== null && _d !== void 0 ? _d : "",\n missingField: (_e = responseJSON.missing_field) !== null && _e !== void 0 ? _e : "",\n eventsWithInvalidFields: (_f = responseJSON.events_with_invalid_fields) !== null && _f !== void 0 ? _f : {},\n eventsWithMissingFields: (_g = responseJSON.events_with_missing_fields) !== null && _g !== void 0 ? _g : {},\n eventsWithInvalidIdLengths: (_h = responseJSON.events_with_invalid_id_lengths) !== null && _h !== void 0 ? _h : {},\n epsThreshold: (_j = responseJSON.eps_threshold) !== null && _j !== void 0 ? _j : 0,\n exceededDailyQuotaDevices: (_k = responseJSON.exceeded_daily_quota_devices) !== null && _k !== void 0 ? _k : {},\n silencedDevices: (_l = responseJSON.silenced_devices) !== null && _l !== void 0 ? _l : [],\n silencedEvents: (_m = responseJSON.silenced_events) !== null && _m !== void 0 ? _m : [],\n throttledDevices: (_o = responseJSON.throttled_devices) !== null && _o !== void 0 ? _o : {},\n throttledEvents: (_p = responseJSON.throttled_events) !== null && _p !== void 0 ? _p : []\n }\n };\n case Status.PayloadTooLarge:\n return {\n status,\n statusCode,\n body: {\n error: (_q = responseJSON.error) !== null && _q !== void 0 ? _q : ""\n }\n };\n case Status.RateLimit:\n return {\n status,\n statusCode,\n body: {\n error: (_r = responseJSON.error) !== null && _r !== void 0 ? _r : "",\n epsThreshold: (_s = responseJSON.eps_threshold) !== null && _s !== void 0 ? _s : 0,\n throttledDevices: (_t = responseJSON.throttled_devices) !== null && _t !== void 0 ? _t : {},\n throttledUsers: (_u = responseJSON.throttled_users) !== null && _u !== void 0 ? _u : {},\n exceededDailyQuotaDevices: (_v = responseJSON.exceeded_daily_quota_devices) !== null && _v !== void 0 ? _v : {},\n exceededDailyQuotaUsers: (_w = responseJSON.exceeded_daily_quota_users) !== null && _w !== void 0 ? _w : {},\n throttledEvents: (_x = responseJSON.throttled_events) !== null && _x !== void 0 ? _x : []\n }\n };\n case Status.Timeout:\n default:\n return {\n status,\n statusCode\n };\n }\n };\n BaseTransport2.prototype.buildStatus = function(code) {\n if (code >= 200 && code < 300) {\n return Status.Success;\n }\n if (code === 429) {\n return Status.RateLimit;\n }\n if (code === 413) {\n return Status.PayloadTooLarge;\n }\n if (code === 408) {\n return Status.Timeout;\n }\n if (code >= 400 && code < 500) {\n return Status.Invalid;\n }\n if (code >= 500) {\n return Status.Failed;\n }\n return Status.Unknown;\n };\n return BaseTransport2;\n })()\n );\n\n // node_modules/@amplitude/analytics-connector/dist/analytics-connector.esm.js\n var ApplicationContextProviderImpl = (\n /** @class */\n (function() {\n function ApplicationContextProviderImpl2() {\n }\n ApplicationContextProviderImpl2.prototype.getApplicationContext = function() {\n return {\n versionName: this.versionName,\n language: getLanguage(),\n platform: "Web",\n os: void 0,\n deviceModel: void 0\n };\n };\n return ApplicationContextProviderImpl2;\n })()\n );\n var getLanguage = function() {\n return typeof navigator !== "undefined" && (navigator.languages && navigator.languages[0] || navigator.language) || "";\n };\n var EventBridgeImpl = (\n /** @class */\n (function() {\n function EventBridgeImpl2() {\n this.queue = [];\n }\n EventBridgeImpl2.prototype.logEvent = function(event) {\n if (!this.receiver) {\n if (this.queue.length < 512) {\n this.queue.push(event);\n }\n } else {\n this.receiver(event);\n }\n };\n EventBridgeImpl2.prototype.setEventReceiver = function(receiver) {\n this.receiver = receiver;\n if (this.queue.length > 0) {\n this.queue.forEach(function(event) {\n receiver(event);\n });\n this.queue = [];\n }\n };\n return EventBridgeImpl2;\n })()\n );\n var __assign2 = function() {\n __assign2 = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign2.apply(this, arguments);\n };\n function __values2(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read2(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = {\n error\n };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n var isEqual = function(obj1, obj2) {\n var e_1, _a;\n var primitive = ["string", "number", "boolean", "undefined"];\n var typeA = typeof obj1;\n var typeB = typeof obj2;\n if (typeA !== typeB) {\n return false;\n }\n try {\n for (var primitive_1 = __values2(primitive), primitive_1_1 = primitive_1.next(); !primitive_1_1.done; primitive_1_1 = primitive_1.next()) {\n var p = primitive_1_1.value;\n if (p === typeA) {\n return obj1 === obj2;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (primitive_1_1 && !primitive_1_1.done && (_a = primitive_1.return)) _a.call(primitive_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n if (obj1 == null && obj2 == null) {\n return true;\n } else if (obj1 == null || obj2 == null) {\n return false;\n }\n if (obj1.length !== obj2.length) {\n return false;\n }\n var isArrayA = Array.isArray(obj1);\n var isArrayB = Array.isArray(obj2);\n if (isArrayA !== isArrayB) {\n return false;\n }\n if (isArrayA && isArrayB) {\n for (var i = 0; i < obj1.length; i++) {\n if (!isEqual(obj1[i], obj2[i])) {\n return false;\n }\n }\n } else {\n var sorted1 = Object.keys(obj1).sort();\n var sorted2 = Object.keys(obj2).sort();\n if (!isEqual(sorted1, sorted2)) {\n return false;\n }\n var result_1 = true;\n Object.keys(obj1).forEach(function(key) {\n if (!isEqual(obj1[key], obj2[key])) {\n result_1 = false;\n }\n });\n return result_1;\n }\n return true;\n };\n var ID_OP_SET = "$set";\n var ID_OP_UNSET = "$unset";\n var ID_OP_CLEAR_ALL = "$clearAll";\n if (!Object.entries) {\n Object.entries = function(obj) {\n var ownProps = Object.keys(obj);\n var i = ownProps.length;\n var resArray = new Array(i);\n while (i--) {\n resArray[i] = [ownProps[i], obj[ownProps[i]]];\n }\n return resArray;\n };\n }\n var IdentityStoreImpl = (\n /** @class */\n (function() {\n function IdentityStoreImpl2() {\n this.identity = { userProperties: {} };\n this.listeners = /* @__PURE__ */ new Set();\n }\n IdentityStoreImpl2.prototype.editIdentity = function() {\n var self2 = this;\n var actingUserProperties = __assign2({}, this.identity.userProperties);\n var actingIdentity = __assign2(__assign2({}, this.identity), { userProperties: actingUserProperties });\n return {\n setUserId: function(userId) {\n actingIdentity.userId = userId;\n return this;\n },\n setDeviceId: function(deviceId) {\n actingIdentity.deviceId = deviceId;\n return this;\n },\n setUserProperties: function(userProperties) {\n actingIdentity.userProperties = userProperties;\n return this;\n },\n setOptOut: function(optOut) {\n actingIdentity.optOut = optOut;\n return this;\n },\n updateUserProperties: function(actions) {\n var e_1, _a, e_2, _b, e_3, _c;\n var actingProperties = actingIdentity.userProperties || {};\n try {\n for (var _d = __values2(Object.entries(actions)), _e = _d.next(); !_e.done; _e = _d.next()) {\n var _f = __read2(_e.value, 2), action = _f[0], properties = _f[1];\n switch (action) {\n case ID_OP_SET:\n try {\n for (var _g = (e_2 = void 0, __values2(Object.entries(properties))), _h = _g.next(); !_h.done; _h = _g.next()) {\n var _j = __read2(_h.value, 2), key = _j[0], value = _j[1];\n actingProperties[key] = value;\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (_h && !_h.done && (_b = _g.return)) _b.call(_g);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n break;\n case ID_OP_UNSET:\n try {\n for (var _k = (e_3 = void 0, __values2(Object.keys(properties))), _l = _k.next(); !_l.done; _l = _k.next()) {\n var key = _l.value;\n delete actingProperties[key];\n }\n } catch (e_3_1) {\n e_3 = { error: e_3_1 };\n } finally {\n try {\n if (_l && !_l.done && (_c = _k.return)) _c.call(_k);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n break;\n case ID_OP_CLEAR_ALL:\n actingProperties = {};\n break;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n actingIdentity.userProperties = actingProperties;\n return this;\n },\n commit: function() {\n self2.setIdentity(actingIdentity);\n return this;\n }\n };\n };\n IdentityStoreImpl2.prototype.getIdentity = function() {\n return __assign2({}, this.identity);\n };\n IdentityStoreImpl2.prototype.setIdentity = function(identity) {\n var originalIdentity = __assign2({}, this.identity);\n this.identity = __assign2({}, identity);\n if (!isEqual(originalIdentity, this.identity)) {\n this.listeners.forEach(function(listener) {\n listener(identity);\n });\n }\n };\n IdentityStoreImpl2.prototype.addIdentityListener = function(listener) {\n this.listeners.add(listener);\n };\n IdentityStoreImpl2.prototype.removeIdentityListener = function(listener) {\n this.listeners.delete(listener);\n };\n return IdentityStoreImpl2;\n })()\n );\n var safeGlobal = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self;\n var AnalyticsConnector = (\n /** @class */\n (function() {\n function AnalyticsConnector2() {\n this.identityStore = new IdentityStoreImpl();\n this.eventBridge = new EventBridgeImpl();\n this.applicationContextProvider = new ApplicationContextProviderImpl();\n }\n AnalyticsConnector2.getInstance = function(instanceName) {\n if (!safeGlobal["analyticsConnectorInstances"]) {\n safeGlobal["analyticsConnectorInstances"] = {};\n }\n if (!safeGlobal["analyticsConnectorInstances"][instanceName]) {\n safeGlobal["analyticsConnectorInstances"][instanceName] = new AnalyticsConnector2();\n }\n return safeGlobal["analyticsConnectorInstances"][instanceName];\n };\n return AnalyticsConnector2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/analytics-connector.js\n var getAnalyticsConnector = function(instanceName) {\n if (instanceName === void 0) {\n instanceName = "$default_instance";\n }\n return AnalyticsConnector.getInstance(instanceName);\n };\n var setConnectorUserId = function(userId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setUserId(userId).commit();\n };\n var setConnectorDeviceId = function(deviceId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setDeviceId(deviceId).commit();\n };\n var setConnectorOptOut = function(optOut, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setOptOut(optOut).commit();\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/global-scope.js\n var getGlobalScope = function() {\n if (typeof globalThis !== "undefined") {\n return globalThis;\n }\n if (typeof window !== "undefined") {\n return window;\n }\n if (typeof self !== "undefined") {\n return self;\n }\n if (typeof global !== "undefined") {\n return global;\n }\n return void 0;\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/query-params.js\n var getQueryParams = function() {\n var _a;\n var globalScope = getGlobalScope();\n if (!((_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.location) === null || _a === void 0 ? void 0 : _a.search)) {\n return {};\n }\n var pairs = globalScope.location.search.substring(1).split("&").filter(Boolean);\n var params = pairs.reduce(function(acc, curr) {\n var query = curr.split("=", 2);\n var key = tryDecodeURIComponent(query[0]);\n var value = tryDecodeURIComponent(query[1]);\n if (!value) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n return params;\n };\n var tryDecodeURIComponent = function(value) {\n if (value === void 0) {\n value = "";\n }\n try {\n return decodeURIComponent(value);\n } catch (_a) {\n return "";\n }\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/constants.js\n var UTM_CAMPAIGN = "utm_campaign";\n var UTM_CONTENT = "utm_content";\n var UTM_ID = "utm_id";\n var UTM_MEDIUM = "utm_medium";\n var UTM_SOURCE = "utm_source";\n var UTM_TERM = "utm_term";\n var DCLID = "dclid";\n var FBCLID = "fbclid";\n var GBRAID = "gbraid";\n var GCLID = "gclid";\n var KO_CLICK_ID = "ko_click_id";\n var LI_FAT_ID = "li_fat_id";\n var MSCLKID = "msclkid";\n var RDT_CID = "rtd_cid";\n var TTCLID = "ttclid";\n var TWCLID = "twclid";\n var WBRAID = "wbraid";\n var BASE_CAMPAIGN = {\n utm_campaign: void 0,\n utm_content: void 0,\n utm_id: void 0,\n utm_medium: void 0,\n utm_source: void 0,\n utm_term: void 0,\n referrer: void 0,\n referring_domain: void 0,\n dclid: void 0,\n gbraid: void 0,\n gclid: void 0,\n fbclid: void 0,\n ko_click_id: void 0,\n li_fat_id: void 0,\n msclkid: void 0,\n rtd_cid: void 0,\n ttclid: void 0,\n twclid: void 0,\n wbraid: void 0\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/campaign-parser.js\n var CampaignParser = (\n /** @class */\n (function() {\n function CampaignParser2() {\n }\n CampaignParser2.prototype.parse = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, __assign(__assign(__assign(__assign({}, BASE_CAMPAIGN), this.getUtmParam()), this.getReferrer()), this.getClickIds())];\n });\n });\n };\n CampaignParser2.prototype.getUtmParam = function() {\n var params = getQueryParams();\n var utmCampaign = params[UTM_CAMPAIGN];\n var utmContent = params[UTM_CONTENT];\n var utmId = params[UTM_ID];\n var utmMedium = params[UTM_MEDIUM];\n var utmSource = params[UTM_SOURCE];\n var utmTerm = params[UTM_TERM];\n return {\n utm_campaign: utmCampaign,\n utm_content: utmContent,\n utm_id: utmId,\n utm_medium: utmMedium,\n utm_source: utmSource,\n utm_term: utmTerm\n };\n };\n CampaignParser2.prototype.getReferrer = function() {\n var _a, _b;\n var data = {\n referrer: void 0,\n referring_domain: void 0\n };\n try {\n data.referrer = document.referrer || void 0;\n data.referring_domain = (_b = (_a = data.referrer) === null || _a === void 0 ? void 0 : _a.split("/")[2]) !== null && _b !== void 0 ? _b : void 0;\n } catch (_c) {\n }\n return data;\n };\n CampaignParser2.prototype.getClickIds = function() {\n var _a;\n var params = getQueryParams();\n return _a = {}, _a[DCLID] = params[DCLID], _a[FBCLID] = params[FBCLID], _a[GBRAID] = params[GBRAID], _a[GCLID] = params[GCLID], _a[KO_CLICK_ID] = params[KO_CLICK_ID], _a[LI_FAT_ID] = params[LI_FAT_ID], _a[MSCLKID] = params[MSCLKID], _a[RDT_CID] = params[RDT_CID], _a[TTCLID] = params[TTCLID], _a[TWCLID] = params[TWCLID], _a[WBRAID] = params[WBRAID], _a;\n };\n return CampaignParser2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/cookie-name.js\n var getCookieName = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var getOldCookieName = function(apiKey) {\n return "".concat(AMPLITUDE_PREFIX.toLowerCase(), "_").concat(apiKey.substring(0, 6));\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/default-tracking.js\n var isFileDownloadTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.fileDownloads) {\n return true;\n }\n return false;\n };\n var isFormInteractionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.formInteractions) {\n return true;\n }\n return false;\n };\n var isPageViewTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if ((defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) === true || (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) && typeof defaultTracking.pageViews === "object") {\n return true;\n }\n return false;\n };\n var isSessionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.sessions) {\n return true;\n }\n return false;\n };\n var getPageViewTrackingConfig = function(config) {\n var _a;\n var trackOn = ((_a = config.attribution) === null || _a === void 0 ? void 0 : _a.trackPageViews) ? "attribution" : function() {\n return false;\n };\n var trackHistoryChanges = void 0;\n var eventType = "Page View";\n var isDefaultPageViewTrackingEnabled = isPageViewTrackingEnabled(config.defaultTracking);\n if (isDefaultPageViewTrackingEnabled) {\n trackOn = void 0;\n eventType = void 0;\n if (config.defaultTracking && typeof config.defaultTracking === "object" && config.defaultTracking.pageViews && typeof config.defaultTracking.pageViews === "object") {\n if ("trackOn" in config.defaultTracking.pageViews) {\n trackOn = config.defaultTracking.pageViews.trackOn;\n }\n if ("trackHistoryChanges" in config.defaultTracking.pageViews) {\n trackHistoryChanges = config.defaultTracking.pageViews.trackHistoryChanges;\n }\n if ("eventType" in config.defaultTracking.pageViews && config.defaultTracking.pageViews.eventType) {\n eventType = config.defaultTracking.pageViews.eventType;\n }\n }\n }\n return {\n trackOn,\n trackHistoryChanges,\n eventType\n };\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/language.js\n var getLanguage2 = function() {\n var _a, _b, _c, _d;\n if (typeof navigator === "undefined")\n return "";\n var userLanguage = navigator.userLanguage;\n return (_d = (_c = (_b = (_a = navigator.languages) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : navigator.language) !== null && _c !== void 0 ? _c : userLanguage) !== null && _d !== void 0 ? _d : "";\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/plugins/identity.js\n var IdentityEventSender = (\n /** @class */\n (function() {\n function IdentityEventSender2() {\n this.name = "identity";\n this.type = PluginType.BEFORE;\n this.identityStore = getAnalyticsConnector().identityStore;\n }\n IdentityEventSender2.prototype.execute = function(context) {\n return __awaiter(this, void 0, void 0, function() {\n var userProperties;\n return __generator(this, function(_a) {\n userProperties = context.user_properties;\n if (userProperties) {\n this.identityStore.editIdentity().updateUserProperties(userProperties).commit();\n }\n return [2, context];\n });\n });\n };\n IdentityEventSender2.prototype.setup = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (config.instanceName) {\n this.identityStore = getAnalyticsConnector(config.instanceName).identityStore;\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return IdentityEventSender2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/storage/cookie.js\n var CookieStorage = (\n /** @class */\n (function() {\n function CookieStorage2(options) {\n this.options = __assign({}, options);\n }\n CookieStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var testStrorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n CookieStorage2.testValue = String(Date.now());\n testStrorage = new CookieStorage2(this.options);\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStrorage.set(testKey, CookieStorage2.testValue)];\n case 2:\n _b.sent();\n return [4, testStrorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === CookieStorage2.testValue];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStrorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.getRaw(key)];\n case 1:\n value = _a.sent();\n if (!value) {\n return [2, void 0];\n }\n try {\n try {\n value = decodeURIComponent(atob(value));\n } catch (_b) {\n }\n return [2, JSON.parse(value)];\n } catch (_c) {\n return [2, void 0];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var globalScope, cookie, match;\n return __generator(this, function(_b) {\n globalScope = getGlobalScope();\n cookie = (_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.document.cookie.split("; ")) !== null && _a !== void 0 ? _a : [];\n match = cookie.find(function(c) {\n return c.indexOf(key + "=") === 0;\n });\n if (!match) {\n return [2, void 0];\n }\n return [2, match.substring(key.length + 1)];\n });\n });\n };\n CookieStorage2.prototype.set = function(key, value) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var expirationDays, expires, expireDate, date, str, globalScope;\n return __generator(this, function(_b) {\n try {\n expirationDays = (_a = this.options.expirationDays) !== null && _a !== void 0 ? _a : 0;\n expires = value !== null ? expirationDays : -1;\n expireDate = void 0;\n if (expires) {\n date = /* @__PURE__ */ new Date();\n date.setTime(date.getTime() + expires * 24 * 60 * 60 * 1e3);\n expireDate = date;\n }\n str = "".concat(key, "=").concat(btoa(encodeURIComponent(JSON.stringify(value))));\n if (expireDate) {\n str += "; expires=".concat(expireDate.toUTCString());\n }\n str += "; path=/";\n if (this.options.domain) {\n str += "; domain=".concat(this.options.domain);\n }\n if (this.options.secure) {\n str += "; Secure";\n }\n if (this.options.sameSite) {\n str += "; SameSite=".concat(this.options.sameSite);\n }\n globalScope = getGlobalScope();\n if (globalScope) {\n globalScope.document.cookie = str;\n }\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n CookieStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.set(key, null)];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return CookieStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/transports/fetch.js\n var FetchTransport = (\n /** @class */\n (function(_super) {\n __extends(FetchTransport2, _super);\n function FetchTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FetchTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var options, response, responseText;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (typeof fetch === "undefined") {\n throw new Error("FetchTransport is not supported");\n }\n options = {\n headers: {\n "Content-Type": "application/json",\n Accept: "*/*"\n },\n body: JSON.stringify(payload),\n method: "POST"\n };\n return [4, fetch(serverUrl, options)];\n case 1:\n response = _a.sent();\n return [4, response.text()];\n case 2:\n responseText = _a.sent();\n try {\n return [2, this.buildResponse(JSON.parse(responseText))];\n } catch (_b) {\n return [2, this.buildResponse({ code: response.status })];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return FetchTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/utils.js\n var omitUndefined = function(input) {\n var obj = {};\n for (var key in input) {\n var val = input[key];\n if (val) {\n obj[key] = val;\n }\n }\n return obj;\n };\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/page-view-tracking.js\n var pageViewTrackingPlugin = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var globalScope = getGlobalScope();\n var loggerProvider = void 0;\n var pushState;\n var _a = __read(args, 2), clientOrOptions = _a[0], configOrUndefined = _a[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var createPageViewEvent = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a2;\n var _b;\n var _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n _b = {\n event_type: (_c = options.eventType) !== null && _c !== void 0 ? _c : "Page View"\n };\n _a2 = [{}];\n return [4, getCampaignParams()];\n case 1:\n return [2, (_b.event_properties = __assign.apply(void 0, [__assign.apply(void 0, _a2.concat([_d.sent()])), { page_domain: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.hostname || ""\n ), page_location: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href || ""\n ), page_path: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.pathname || ""\n ), page_title: (\n /* istanbul ignore next */\n typeof document !== "undefined" && document.title || ""\n ), page_url: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href.split("?")[0] || ""\n ) }]), _b)];\n }\n });\n });\n };\n var shouldTrackOnPageLoad = function() {\n return typeof options.trackOn === "undefined" || typeof options.trackOn === "function" && options.trackOn();\n };\n var previousURL = typeof location !== "undefined" ? location.href : null;\n var trackHistoryPageView = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var newURL, shouldTrackPageView, _a2, _b, _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n newURL = location.href;\n shouldTrackPageView = shouldTrackHistoryPageView(options.trackHistoryChanges, newURL, previousURL || "") && shouldTrackOnPageLoad();\n previousURL = newURL;\n if (!shouldTrackPageView) return [3, 4];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Tracking page view event");\n if (!(amplitude === null || amplitude === void 0)) return [3, 1];\n _a2 = void 0;\n return [3, 3];\n case 1:\n _c = (_b = amplitude).track;\n return [4, createPageViewEvent()];\n case 2:\n _a2 = _c.apply(_b, [_d.sent()]);\n _d.label = 3;\n case 3:\n _a2;\n _d.label = 4;\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n var trackHistoryPageViewWrapper = function() {\n void trackHistoryPageView();\n };\n var plugin = {\n name: "page-view-tracking",\n type: PluginType.ENRICHMENT,\n setup: function(config, client) {\n return __awaiter(void 0, void 0, void 0, function() {\n var receivedType, _a2, _b;\n var _c, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n loggerProvider = config.loggerProvider;\n loggerProvider.log("Installing @amplitude/plugin-page-view-tracking-browser");\n options.trackOn = ((_c = config.attribution) === null || _c === void 0 ? void 0 : _c.trackPageViews) ? "attribution" : options.trackOn;\n if (!client && ((_d = config.attribution) === null || _d === void 0 ? void 0 : _d.trackPageViews)) {\n loggerProvider.warn("@amplitude/plugin-page-view-tracking-browser overrides page view tracking behavior defined in @amplitude/analytics-browser. Resolve by disabling page view tracking in @amplitude/analytics-browser.");\n config.attribution.trackPageViews = false;\n }\n if (options.trackHistoryChanges && globalScope) {\n globalScope.addEventListener("popstate", trackHistoryPageViewWrapper);\n pushState = globalScope.history.pushState;\n globalScope.history.pushState = new Proxy(globalScope.history.pushState, {\n apply: function(target, thisArg, _a3) {\n var _b2 = __read(_a3, 3), state = _b2[0], unused = _b2[1], url = _b2[2];\n target.apply(thisArg, [state, unused, url]);\n void trackHistoryPageView();\n }\n });\n }\n if (!shouldTrackOnPageLoad()) return [3, 2];\n loggerProvider.log("Tracking page view event");\n _b = (_a2 = amplitude).track;\n return [4, createPageViewEvent()];\n case 1:\n _b.apply(_a2, [_e.sent()]);\n _e.label = 2;\n case 2:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n var pageViewEvent;\n return __generator(this, function(_a2) {\n switch (_a2.label) {\n case 0:\n if (!(options.trackOn === "attribution" && isCampaignEvent(event))) return [3, 2];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Enriching campaign event to page view event with campaign parameters");\n return [4, createPageViewEvent()];\n case 1:\n pageViewEvent = _a2.sent();\n event.event_type = pageViewEvent.event_type;\n event.event_properties = __assign(__assign({}, event.event_properties), pageViewEvent.event_properties);\n _a2.label = 2;\n case 2:\n return [2, event];\n }\n });\n });\n },\n teardown: function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n if (globalScope) {\n globalScope.removeEventListener("popstate", trackHistoryPageViewWrapper);\n if (pushState) {\n globalScope.history.pushState = pushState;\n }\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n }\n };\n plugin.__trackHistoryPageView = trackHistoryPageView;\n return plugin;\n };\n var getCampaignParams = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _a = omitUndefined;\n return [4, new CampaignParser().parse()];\n case 1:\n return [2, _a.apply(void 0, [_b.sent()])];\n }\n });\n });\n };\n var isCampaignEvent = function(event) {\n if (event.event_type === "$identify" && event.user_properties) {\n var properties = event.user_properties;\n var $set = properties[IdentifyOperation.SET] || {};\n var $unset = properties[IdentifyOperation.UNSET] || {};\n var userProperties_1 = __spreadArray(__spreadArray([], __read(Object.keys($set)), false), __read(Object.keys($unset)), false);\n return Object.keys(BASE_CAMPAIGN).every(function(value) {\n return userProperties_1.includes(value);\n });\n }\n return false;\n };\n var shouldTrackHistoryPageView = function(trackingOption, newURL, oldURL) {\n switch (trackingOption) {\n case "pathOnly":\n return newURL.split("?")[0] !== oldURL.split("?")[0];\n default:\n return newURL !== oldURL;\n }\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/helpers.js\n var getStorageKey = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var domainWithoutSubdomain = function(domain) {\n var parts = domain.split(".");\n if (parts.length <= 2) {\n return domain;\n }\n return parts.slice(parts.length - 2, parts.length).join(".");\n };\n var isNewCampaign = function(current, previous, options) {\n var _a;\n var referrer = current.referrer, referring_domain = current.referring_domain, currentCampaign = __rest(current, ["referrer", "referring_domain"]);\n var _b = previous || {}, _previous_referrer = _b.referrer, prevReferringDomain = _b.referring_domain, previousCampaign = __rest(_b, ["referrer", "referring_domain"]);\n if (current.referring_domain && ((_a = options.excludeReferrers) === null || _a === void 0 ? void 0 : _a.includes(current.referring_domain))) {\n return false;\n }\n var hasNewCampaign = JSON.stringify(currentCampaign) !== JSON.stringify(previousCampaign);\n var hasNewDomain = domainWithoutSubdomain(referring_domain || "") !== domainWithoutSubdomain(prevReferringDomain || "");\n return !previous || hasNewCampaign || hasNewDomain;\n };\n var createCampaignEvent = function(campaign, options) {\n var campaignParameters = __assign(__assign({}, BASE_CAMPAIGN), campaign);\n var identifyEvent = Object.entries(campaignParameters).reduce(function(identify2, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n identify2.setOnce("initial_".concat(key), (_b = value !== null && value !== void 0 ? value : options.initialEmptyValue) !== null && _b !== void 0 ? _b : "EMPTY");\n if (value) {\n return identify2.set(key, value);\n }\n return identify2.unset(key);\n }, new Identify());\n return createIdentifyEvent(identifyEvent);\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/web-attribution.js\n var webAttributionPlugin = function() {\n var _this = this;\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var _b = __read(args, 2), clientOrOptions = _b[0], configOrUndefined = _b[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var excludeReferrers = (_a = options.excludeReferrers) !== null && _a !== void 0 ? _a : [];\n if (typeof location !== "undefined") {\n excludeReferrers.unshift(location.hostname);\n }\n options = __assign(__assign({ disabled: false, initialEmptyValue: "EMPTY", resetSessionOnNewCampaign: false }, options), { excludeReferrers });\n var plugin = {\n name: "web-attribution",\n type: PluginType.BEFORE,\n setup: function(config, client) {\n var _a2;\n return __awaiter(this, void 0, void 0, function() {\n var receivedType, storage, storageKey, _b2, currentCampaign, previousCampaign, pluginEnabledOverride, campaignEvent;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n if (options.disabled) {\n config.loggerProvider.log("@amplitude/plugin-web-attribution-browser is disabled. Attribution is not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n config.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser.");\n if (!client && !((_a2 = config.attribution) === null || _a2 === void 0 ? void 0 : _a2.disabled)) {\n config.loggerProvider.warn("@amplitude/plugin-web-attribution-browser overrides web attribution behavior defined in @amplitude/analytics-browser. Resolve by disabling web attribution tracking in @amplitude/analytics-browser.");\n config.attribution = {\n disabled: true\n };\n }\n storage = config.cookieStorage;\n storageKey = getStorageKey(config.apiKey, "MKTG");\n return [4, Promise.all([\n new CampaignParser().parse(),\n storage.get(storageKey)\n ])];\n case 1:\n _b2 = __read.apply(void 0, [_c.sent(), 2]), currentCampaign = _b2[0], previousCampaign = _b2[1];\n pluginEnabledOverride = this.__pluginEnabledOverride;\n if (pluginEnabledOverride !== null && pluginEnabledOverride !== void 0 ? pluginEnabledOverride : isNewCampaign(currentCampaign, previousCampaign, options)) {\n if (options.resetSessionOnNewCampaign) {\n amplitude.setSessionId(Date.now());\n config.loggerProvider.log("Created a new session for new campaign.");\n }\n config.loggerProvider.log("Tracking attribution.");\n campaignEvent = createCampaignEvent(currentCampaign, options);\n amplitude.track(campaignEvent);\n void storage.set(storageKey, currentCampaign);\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(_this, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n return [2, event];\n });\n });\n }\n };\n plugin.__pluginEnabledOverride = void 0;\n return plugin;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/storage/local-storage.js\n var MAX_ARRAY_LENGTH = 1e3;\n var LocalStorage = (\n /** @class */\n (function() {\n function LocalStorage2(config) {\n this.loggerProvider = config === null || config === void 0 ? void 0 : config.loggerProvider;\n }\n LocalStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var random, testStorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n random = String(Date.now());\n testStorage = new LocalStorage2();\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStorage.set(testKey, random)];\n case 2:\n _b.sent();\n return [4, testStorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === random];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [4, this.getRaw(key)];\n case 1:\n value = _b.sent();\n if (!value) {\n return [2, void 0];\n }\n return [2, JSON.parse(value)];\n case 2:\n _a = _b.sent();\n return [2, void 0];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n return [2, ((_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.getItem(key)) || void 0];\n });\n });\n };\n LocalStorage2.prototype.set = function(key, value) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var isExceededArraySize, serializedValue, droppedEventsCount;\n return __generator(this, function(_c) {\n isExceededArraySize = Array.isArray(value) && value.length > MAX_ARRAY_LENGTH;\n try {\n serializedValue = isExceededArraySize ? JSON.stringify(value.slice(0, MAX_ARRAY_LENGTH)) : JSON.stringify(value);\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.setItem(key, serializedValue);\n } catch (_d) {\n }\n if (isExceededArraySize) {\n droppedEventsCount = value.length - MAX_ARRAY_LENGTH;\n (_b = this.loggerProvider) === null || _b === void 0 ? void 0 : _b.error("Failed to save ".concat(droppedEventsCount, " events because the queue length exceeded ").concat(MAX_ARRAY_LENGTH, "."));\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.remove = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.removeItem(key);\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.reset = function() {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.clear();\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return LocalStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/xhr.js\n var XHRTransport = (\n /** @class */\n (function(_super) {\n __extends(XHRTransport2, _super);\n function XHRTransport2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.state = {\n done: 4\n };\n return _this;\n }\n XHRTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n if (typeof XMLHttpRequest === "undefined") {\n reject(new Error("XHRTransport is not supported."));\n }\n var xhr = new XMLHttpRequest();\n xhr.open("POST", serverUrl, true);\n xhr.onreadystatechange = function() {\n if (xhr.readyState === _this.state.done) {\n try {\n var responsePayload = xhr.responseText;\n var parsedResponsePayload = JSON.parse(responsePayload);\n var result = _this.buildResponse(parsedResponsePayload);\n resolve(result);\n } catch (e) {\n reject(e);\n }\n }\n };\n xhr.setRequestHeader("Content-Type", "application/json");\n xhr.setRequestHeader("Accept", "*/*");\n xhr.send(JSON.stringify(payload));\n })];\n });\n });\n };\n return XHRTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/send-beacon.js\n var SendBeaconTransport = (\n /** @class */\n (function(_super) {\n __extends(SendBeaconTransport2, _super);\n function SendBeaconTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SendBeaconTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n var globalScope = getGlobalScope();\n if (!(globalScope === null || globalScope === void 0 ? void 0 : globalScope.navigator.sendBeacon)) {\n throw new Error("SendBeaconTransport is not supported");\n }\n try {\n var data = JSON.stringify(payload);\n var success = globalScope.navigator.sendBeacon(serverUrl, JSON.stringify(payload));\n if (success) {\n return resolve(_this.buildResponse({\n code: 200,\n events_ingested: payload.events.length,\n payload_size_bytes: data.length,\n server_upload_time: Date.now()\n }));\n }\n return resolve(_this.buildResponse({ code: 500 }));\n } catch (e) {\n reject(e);\n }\n })];\n });\n });\n };\n return SendBeaconTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/config.js\n var getDefaultConfig2 = function() {\n var cookieStorage = new MemoryStorage();\n var trackingOptions = {\n deviceManufacturer: true,\n deviceModel: true,\n ipAddress: true,\n language: true,\n osName: true,\n osVersion: true,\n platform: true\n };\n return {\n cookieExpiration: 365,\n cookieSameSite: "Lax",\n cookieSecure: false,\n cookieStorage,\n cookieUpgrade: true,\n disableCookies: false,\n domain: "",\n sessionTimeout: 30 * 60 * 1e3,\n trackingOptions,\n transportProvider: new FetchTransport()\n };\n };\n var BrowserConfig = (\n /** @class */\n (function(_super) {\n __extends(BrowserConfig2, _super);\n function BrowserConfig2(apiKey, options) {\n var _this = this;\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n var defaultConfig = getDefaultConfig2();\n _this = _super.call(this, __assign(__assign({ flushIntervalMillis: 1e3, flushMaxRetries: 5, flushQueueSize: 30, transportProvider: defaultConfig.transportProvider }, options), { apiKey })) || this;\n _this._optOut = false;\n _this.cookieStorage = (_a = options === null || options === void 0 ? void 0 : options.cookieStorage) !== null && _a !== void 0 ? _a : defaultConfig.cookieStorage;\n _this.deviceId = options === null || options === void 0 ? void 0 : options.deviceId;\n _this.lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n _this.lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n _this.optOut = Boolean(options === null || options === void 0 ? void 0 : options.optOut);\n _this.sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n _this.userId = options === null || options === void 0 ? void 0 : options.userId;\n _this.appVersion = options === null || options === void 0 ? void 0 : options.appVersion;\n _this.attribution = options === null || options === void 0 ? void 0 : options.attribution;\n _this.cookieExpiration = (_b = options === null || options === void 0 ? void 0 : options.cookieExpiration) !== null && _b !== void 0 ? _b : defaultConfig.cookieExpiration;\n _this.cookieSameSite = (_c = options === null || options === void 0 ? void 0 : options.cookieSameSite) !== null && _c !== void 0 ? _c : defaultConfig.cookieSameSite;\n _this.cookieSecure = (_d = options === null || options === void 0 ? void 0 : options.cookieSecure) !== null && _d !== void 0 ? _d : defaultConfig.cookieSecure;\n _this.cookieUpgrade = (_e = options === null || options === void 0 ? void 0 : options.cookieUpgrade) !== null && _e !== void 0 ? _e : defaultConfig.cookieUpgrade;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.disableCookies = (_f = options === null || options === void 0 ? void 0 : options.disableCookies) !== null && _f !== void 0 ? _f : defaultConfig.disableCookies;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.domain = (_g = options === null || options === void 0 ? void 0 : options.domain) !== null && _g !== void 0 ? _g : defaultConfig.domain;\n _this.partnerId = options === null || options === void 0 ? void 0 : options.partnerId;\n _this.sessionTimeout = (_h = options === null || options === void 0 ? void 0 : options.sessionTimeout) !== null && _h !== void 0 ? _h : defaultConfig.sessionTimeout;\n _this.trackingOptions = (_j = options === null || options === void 0 ? void 0 : options.trackingOptions) !== null && _j !== void 0 ? _j : defaultConfig.trackingOptions;\n return _this;\n }\n Object.defineProperty(BrowserConfig2.prototype, "deviceId", {\n get: function() {\n return this._deviceId;\n },\n set: function(deviceId) {\n if (this._deviceId !== deviceId) {\n this._deviceId = deviceId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "userId", {\n get: function() {\n return this._userId;\n },\n set: function(userId) {\n if (this._userId !== userId) {\n this._userId = userId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "sessionId", {\n get: function() {\n return this._sessionId;\n },\n set: function(sessionId) {\n if (this._sessionId !== sessionId) {\n this._sessionId = sessionId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n if (this._optOut !== optOut) {\n this._optOut = optOut;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventTime", {\n get: function() {\n return this._lastEventTime;\n },\n set: function(lastEventTime) {\n if (this._lastEventTime !== lastEventTime) {\n this._lastEventTime = lastEventTime;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventId", {\n get: function() {\n return this._lastEventId;\n },\n set: function(lastEventId) {\n if (this._lastEventId !== lastEventId) {\n this._lastEventId = lastEventId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n BrowserConfig2.prototype.updateStorage = function() {\n var _a;\n var cache = {\n deviceId: this._deviceId,\n userId: this._userId,\n sessionId: this._sessionId,\n optOut: this._optOut,\n lastEventTime: this._lastEventTime,\n lastEventId: this._lastEventId\n };\n void ((_a = this.cookieStorage) === null || _a === void 0 ? void 0 : _a.set(getCookieName(this.apiKey), cache));\n };\n return BrowserConfig2;\n })(Config)\n );\n var useBrowserConfig = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var defaultConfig, deviceId, lastEventId, lastEventTime, optOut, sessionId, userId, cookieStorage, domain, _a, _b, _c;\n var _d;\n var _e, _f;\n return __generator(this, function(_g) {\n switch (_g.label) {\n case 0:\n defaultConfig = getDefaultConfig2();\n deviceId = (_e = options === null || options === void 0 ? void 0 : options.deviceId) !== null && _e !== void 0 ? _e : UUID();\n lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n optOut = options === null || options === void 0 ? void 0 : options.optOut;\n sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n userId = options === null || options === void 0 ? void 0 : options.userId;\n cookieStorage = options === null || options === void 0 ? void 0 : options.cookieStorage;\n domain = options === null || options === void 0 ? void 0 : options.domain;\n _a = BrowserConfig.bind;\n _b = [void 0, apiKey];\n _c = [__assign({}, options)];\n _d = { cookieStorage, deviceId, domain, lastEventId, lastEventTime, optOut, sessionId };\n return [4, createEventsStorage(options)];\n case 1:\n return [2, new (_a.apply(BrowserConfig, _b.concat([__assign.apply(void 0, _c.concat([(_d.storageProvider = _g.sent(), _d.trackingOptions = __assign(__assign({}, defaultConfig.trackingOptions), options === null || options === void 0 ? void 0 : options.trackingOptions), _d.transportProvider = (_f = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _f !== void 0 ? _f : createTransport(options === null || options === void 0 ? void 0 : options.transport), _d.userId = userId, _d)]))])))()];\n }\n });\n });\n };\n var createCookieStorage = function(overrides, baseConfig) {\n if (baseConfig === void 0) {\n baseConfig = getDefaultConfig2();\n }\n return __awaiter(void 0, void 0, void 0, function() {\n var options, cookieStorage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n options = __assign(__assign({}, baseConfig), overrides);\n cookieStorage = overrides === null || overrides === void 0 ? void 0 : overrides.cookieStorage;\n _a = !cookieStorage;\n if (_a) return [3, 2];\n return [4, cookieStorage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (_a) {\n return [2, createFlexibleStorage(options)];\n }\n return [2, cookieStorage];\n }\n });\n });\n };\n var createFlexibleStorage = function(options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n storage = new CookieStorage({\n domain: options.domain,\n expirationDays: options.cookieExpiration,\n sameSite: options.cookieSameSite,\n secure: options.cookieSecure\n });\n _a = options.disableCookies;\n if (_a) return [3, 2];\n return [4, storage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (!_a) return [3, 4];\n storage = new LocalStorage();\n return [4, storage.isEnabled()];\n case 3:\n if (!_b.sent()) {\n storage = new MemoryStorage();\n }\n _b.label = 4;\n case 4:\n return [2, storage];\n }\n });\n });\n };\n var createEventsStorage = function(overrides) {\n return __awaiter(void 0, void 0, void 0, function() {\n var hasStorageProviderProperty, loggerProvider, _a, _b, storage, _c, e_1_1;\n var e_1, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n hasStorageProviderProperty = overrides && Object.prototype.hasOwnProperty.call(overrides, "storageProvider");\n loggerProvider = overrides && overrides.loggerProvider;\n if (!(!hasStorageProviderProperty || overrides.storageProvider)) return [3, 9];\n _e.label = 1;\n case 1:\n _e.trys.push([1, 7, 8, 9]);\n _a = __values([overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider, new LocalStorage({ loggerProvider })]), _b = _a.next();\n _e.label = 2;\n case 2:\n if (!!_b.done) return [3, 6];\n storage = _b.value;\n _c = storage;\n if (!_c) return [3, 4];\n return [4, storage.isEnabled()];\n case 3:\n _c = _e.sent();\n _e.label = 4;\n case 4:\n if (_c) {\n return [2, storage];\n }\n _e.label = 5;\n case 5:\n _b = _a.next();\n return [3, 2];\n case 6:\n return [3, 9];\n case 7:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 9];\n case 8:\n try {\n if (_b && !_b.done && (_d = _a.return)) _d.call(_a);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 9:\n return [2, void 0];\n }\n });\n });\n };\n var createTransport = function(transport) {\n if (transport === TransportType.XHR) {\n return new XHRTransport();\n }\n if (transport === TransportType.SendBeacon) {\n return new SendBeaconTransport();\n }\n return getDefaultConfig2().transportProvider;\n };\n var getTopLevelDomain = function(url) {\n return __awaiter(void 0, void 0, void 0, function() {\n var host, parts, levels, storageKey, i, i, domain, options, storage, value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, new CookieStorage().isEnabled()];\n case 1:\n if (!_a.sent() || !url && typeof location === "undefined") {\n return [2, ""];\n }\n host = url !== null && url !== void 0 ? url : location.hostname;\n parts = host.split(".");\n levels = [];\n storageKey = "AMP_TLDTEST";\n for (i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join("."));\n }\n i = 0;\n _a.label = 2;\n case 2:\n if (!(i < levels.length)) return [3, 7];\n domain = levels[i];\n options = { domain: "." + domain };\n storage = new CookieStorage(options);\n return [4, storage.set(storageKey, 1)];\n case 3:\n _a.sent();\n return [4, storage.get(storageKey)];\n case 4:\n value = _a.sent();\n if (!value) return [3, 6];\n return [4, storage.remove(storageKey)];\n case 5:\n _a.sent();\n return [2, "." + domain];\n case 6:\n i++;\n return [3, 2];\n case 7:\n return [2, ""];\n }\n });\n });\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/constants.js\n var DEFAULT_EVENT_PREFIX = "[Amplitude]";\n var DEFAULT_PAGE_VIEW_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Page Viewed");\n var DEFAULT_FORM_START_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Started");\n var DEFAULT_FORM_SUBMIT_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Submitted");\n var DEFAULT_FILE_DOWNLOAD_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " File Downloaded");\n var DEFAULT_SESSION_START_EVENT = "session_start";\n var DEFAULT_SESSION_END_EVENT = "session_end";\n var FILE_EXTENSION = "".concat(DEFAULT_EVENT_PREFIX, " File Extension");\n var FILE_NAME = "".concat(DEFAULT_EVENT_PREFIX, " File Name");\n var LINK_ID = "".concat(DEFAULT_EVENT_PREFIX, " Link ID");\n var LINK_TEXT = "".concat(DEFAULT_EVENT_PREFIX, " Link Text");\n var LINK_URL = "".concat(DEFAULT_EVENT_PREFIX, " Link URL");\n var FORM_ID = "".concat(DEFAULT_EVENT_PREFIX, " Form ID");\n var FORM_NAME = "".concat(DEFAULT_EVENT_PREFIX, " Form Name");\n var FORM_DESTINATION = "".concat(DEFAULT_EVENT_PREFIX, " Form Destination");\n\n // node_modules/@amplitude/analytics-browser/lib/esm/cookie-migration/index.js\n var parseLegacyCookies = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, oldCookieName, cookies, _a, deviceId, userId, optOut, sessionId, lastEventTime, lastEventId;\n var _b;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n return [4, createCookieStorage(options)];\n case 1:\n storage = _c.sent();\n oldCookieName = getOldCookieName(apiKey);\n return [4, storage.getRaw(oldCookieName)];\n case 2:\n cookies = _c.sent();\n if (!cookies) {\n return [2, {\n optOut: false\n }];\n }\n if (!((_b = options.cookieUpgrade) !== null && _b !== void 0 ? _b : getDefaultConfig2().cookieUpgrade)) return [3, 4];\n return [4, storage.remove(oldCookieName)];\n case 3:\n _c.sent();\n _c.label = 4;\n case 4:\n _a = __read(cookies.split("."), 6), deviceId = _a[0], userId = _a[1], optOut = _a[2], sessionId = _a[3], lastEventTime = _a[4], lastEventId = _a[5];\n return [2, {\n deviceId,\n userId: decode(userId),\n sessionId: parseTime(sessionId),\n lastEventId: parseTime(lastEventId),\n lastEventTime: parseTime(lastEventTime),\n optOut: Boolean(optOut)\n }];\n }\n });\n });\n };\n var parseTime = function(num) {\n var integer = parseInt(num, 32);\n if (isNaN(integer)) {\n return void 0;\n }\n return integer;\n };\n var decode = function(value) {\n if (!atob || !escape || !value) {\n return void 0;\n }\n try {\n return decodeURIComponent(escape(atob(value)));\n } catch (_a) {\n return void 0;\n }\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var import_ua_parser_js = __toESM(require_ua_parser());\n\n // node_modules/@amplitude/analytics-browser/lib/esm/version.js\n var VERSION = "1.13.4";\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var BROWSER_PLATFORM = "Web";\n var IP_ADDRESS = "$remote";\n var Context = (\n /** @class */\n (function() {\n function Context2() {\n this.name = "context";\n this.type = PluginType.BEFORE;\n this.library = "amplitude-ts/".concat(VERSION);\n if (typeof navigator !== "undefined") {\n this.userAgent = navigator.userAgent;\n }\n this.uaResult = new import_ua_parser_js.default(this.userAgent).getResult();\n }\n Context2.prototype.setup = function(config) {\n this.config = config;\n return Promise.resolve(void 0);\n };\n Context2.prototype.execute = function(context) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var time, osName, osVersion, deviceModel, deviceVendor, lastEventId, nextEventId, event;\n return __generator(this, function(_c) {\n time = (/* @__PURE__ */ new Date()).getTime();\n osName = this.uaResult.browser.name;\n osVersion = this.uaResult.browser.version;\n deviceModel = this.uaResult.device.model || this.uaResult.os.name;\n deviceVendor = this.uaResult.device.vendor;\n lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n nextEventId = (_b = context.event_id) !== null && _b !== void 0 ? _b : lastEventId + 1;\n this.config.lastEventId = nextEventId;\n if (!context.time) {\n this.config.lastEventTime = time;\n }\n event = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ user_id: this.config.userId, device_id: this.config.deviceId, session_id: this.config.sessionId, time }, this.config.appVersion && { app_version: this.config.appVersion }), this.config.trackingOptions.platform && { platform: BROWSER_PLATFORM }), this.config.trackingOptions.osName && { os_name: osName }), this.config.trackingOptions.osVersion && { os_version: osVersion }), this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor }), this.config.trackingOptions.deviceModel && { device_model: deviceModel }), this.config.trackingOptions.language && { language: getLanguage2() }), this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }), { insert_id: UUID(), partner_id: this.config.partnerId, plan: this.config.plan }), this.config.ingestionMetadata && {\n ingestion_metadata: {\n source_name: this.config.ingestionMetadata.sourceName,\n source_version: this.config.ingestionMetadata.sourceVersion\n }\n }), context), { event_id: nextEventId, library: this.library, user_agent: this.userAgent });\n return [2, event];\n });\n });\n };\n return Context2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/default-page-view-event-enrichment.js\n var eventPropertyMap = {\n page_domain: "".concat(DEFAULT_EVENT_PREFIX, " Page Domain"),\n page_location: "".concat(DEFAULT_EVENT_PREFIX, " Page Location"),\n page_path: "".concat(DEFAULT_EVENT_PREFIX, " Page Path"),\n page_title: "".concat(DEFAULT_EVENT_PREFIX, " Page Title"),\n page_url: "".concat(DEFAULT_EVENT_PREFIX, " Page URL")\n };\n var defaultPageViewEventEnrichment = function() {\n var name = "@amplitude/plugin-default-page-view-event-enrichment-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, void 0];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (event.event_type === DEFAULT_PAGE_VIEW_EVENT && event.event_properties) {\n event.event_properties = Object.entries(event.event_properties).reduce(function(acc, _a2) {\n var _b = __read(_a2, 2), key = _b[0], value = _b[1];\n var transformedPropertyName = eventPropertyMap[key];\n if (transformedPropertyName) {\n acc[transformedPropertyName] = value;\n } else {\n acc[key] = value;\n }\n return acc;\n }, {});\n }\n return [2, event];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/file-download-tracking.js\n var fileDownloadTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-file-download-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFileDownloadListener, ext, links;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFileDownloadListener = function(a) {\n var url;\n try {\n url = new URL(a.href, window.location.href);\n } catch (_a2) {\n return;\n }\n var result = ext.exec(url.href);\n var fileExtension = result === null || result === void 0 ? void 0 : result[1];\n if (fileExtension) {\n addEventListener(a, "click", function() {\n var _a2;\n if (fileExtension) {\n amplitude.track(DEFAULT_FILE_DOWNLOAD_EVENT, (_a2 = {}, _a2[FILE_EXTENSION] = fileExtension, _a2[FILE_NAME] = url.pathname, _a2[LINK_ID] = a.id, _a2[LINK_TEXT] = a.text, _a2[LINK_URL] = a.href, _a2));\n }\n });\n }\n };\n ext = /\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;\n links = Array.from(document.getElementsByTagName("a"));\n links.forEach(addFileDownloadListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "A") {\n addFileDownloadListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("a")).map(addFileDownloadListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/form-interaction-tracking.js\n var formInteractionTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-form-interaction-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFormInteractionListener, forms;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFormInteractionListener = function(form) {\n var hasFormChanged = false;\n addEventListener(form, "change", function() {\n var _a2;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n hasFormChanged = true;\n });\n addEventListener(form, "submit", function() {\n var _a2, _b;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n amplitude.track(DEFAULT_FORM_SUBMIT_EVENT, (_b = {}, _b[FORM_ID] = form.id, _b[FORM_NAME] = form.name, _b[FORM_DESTINATION] = form.action, _b));\n hasFormChanged = false;\n });\n };\n forms = Array.from(document.getElementsByTagName("form"));\n forms.forEach(addFormInteractionListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "FORM") {\n addFormInteractionListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("form")).map(addFormInteractionListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/utils/snippet-helper.js\n var convertProxyObjectToRealObject = function(instance, queue) {\n for (var i = 0; i < queue.length; i++) {\n var _a = queue[i], name_1 = _a.name, args = _a.args, resolve = _a.resolve;\n var fn = instance && instance[name_1];\n if (typeof fn === "function") {\n var result = fn.apply(instance, args);\n if (typeof resolve === "function") {\n resolve(result === null || result === void 0 ? void 0 : result.promise);\n }\n }\n }\n return instance;\n };\n var isInstanceProxy = function(instance) {\n var instanceProxy = instance;\n return instanceProxy && instanceProxy._q !== void 0;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client.js\n var AmplitudeBrowser = (\n /** @class */\n (function(_super) {\n __extends(AmplitudeBrowser2, _super);\n function AmplitudeBrowser2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AmplitudeBrowser2.prototype.init = function(apiKey, userId, options) {\n if (apiKey === void 0) {\n apiKey = "";\n }\n return returnWrapper(this._init(__assign(__assign({}, options), { userId, apiKey })));\n };\n AmplitudeBrowser2.prototype._init = function(options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _r, _s, _t, _u, _v, _w;\n return __awaiter(this, void 0, void 0, function() {\n var _x, _y, _z, legacyCookies, cookieStorage, previousCookies, queryParams, deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, browserOptions, isNewSession, connector, webAttribution, pageViewTrackingOptions;\n var _this = this;\n return __generator(this, function(_0) {\n switch (_0.label) {\n case 0:\n if (this.initializing) {\n return [\n 2\n /*return*/\n ];\n }\n this.initializing = true;\n _x = options;\n if (!options.disableCookies) return [3, 1];\n _y = "";\n return [3, 5];\n case 1:\n if (!((_a = options.domain) !== null && _a !== void 0)) return [3, 2];\n _z = _a;\n return [3, 4];\n case 2:\n return [4, getTopLevelDomain()];\n case 3:\n _z = _0.sent();\n _0.label = 4;\n case 4:\n _y = _z;\n _0.label = 5;\n case 5:\n _x.domain = _y;\n return [4, parseLegacyCookies(options.apiKey, options)];\n case 6:\n legacyCookies = _0.sent();\n return [4, createCookieStorage(options)];\n case 7:\n cookieStorage = _0.sent();\n return [4, cookieStorage.get(getCookieName(options.apiKey))];\n case 8:\n previousCookies = _0.sent();\n queryParams = getQueryParams();\n deviceId = (_d = (_c = (_b = options.deviceId) !== null && _b !== void 0 ? _b : queryParams.deviceId) !== null && _c !== void 0 ? _c : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _d !== void 0 ? _d : legacyCookies.deviceId;\n sessionId = (_e = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.sessionId) !== null && _e !== void 0 ? _e : legacyCookies.sessionId;\n optOut = (_g = (_f = options.optOut) !== null && _f !== void 0 ? _f : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.optOut) !== null && _g !== void 0 ? _g : legacyCookies.optOut;\n lastEventId = (_h = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventId) !== null && _h !== void 0 ? _h : legacyCookies.lastEventId;\n lastEventTime = (_j = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventTime) !== null && _j !== void 0 ? _j : legacyCookies.lastEventTime;\n userId = (_l = (_k = options.userId) !== null && _k !== void 0 ? _k : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _l !== void 0 ? _l : legacyCookies.userId;\n this.previousSessionDeviceId = (_m = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _m !== void 0 ? _m : legacyCookies.deviceId;\n this.previousSessionUserId = (_o = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _o !== void 0 ? _o : legacyCookies.userId;\n return [4, useBrowserConfig(options.apiKey, __assign(__assign({}, options), { deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, cookieStorage }))];\n case 9:\n browserOptions = _0.sent();\n return [4, _super.prototype._init.call(this, browserOptions)];\n case 10:\n _0.sent();\n isNewSession = false;\n if (\n // user has never sent an event\n !this.config.lastEventTime || // user has no previous session ID\n !this.config.sessionId || // has sent an event and has previous session but expired\n this.config.lastEventTime && Date.now() - this.config.lastEventTime > this.config.sessionTimeout\n ) {\n this.setSessionId((_r = (_p = options.sessionId) !== null && _p !== void 0 ? _p : this.config.sessionId) !== null && _r !== void 0 ? _r : Date.now());\n isNewSession = true;\n }\n connector = getAnalyticsConnector(options.instanceName);\n connector.identityStore.setIdentity({\n userId: this.config.userId,\n deviceId: this.config.deviceId\n });\n return [4, this.add(new Destination()).promise];\n case 11:\n _0.sent();\n return [4, this.add(new Context()).promise];\n case 12:\n _0.sent();\n return [4, this.add(new IdentityEventSender()).promise];\n case 13:\n _0.sent();\n if (!isFileDownloadTrackingEnabled(this.config.defaultTracking)) return [3, 15];\n return [4, this.add(fileDownloadTracking()).promise];\n case 14:\n _0.sent();\n _0.label = 15;\n case 15:\n if (!isFormInteractionTrackingEnabled(this.config.defaultTracking)) return [3, 17];\n return [4, this.add(formInteractionTracking()).promise];\n case 16:\n _0.sent();\n _0.label = 17;\n case 17:\n if (!!((_s = this.config.attribution) === null || _s === void 0 ? void 0 : _s.disabled)) return [3, 19];\n webAttribution = webAttributionPlugin({\n excludeReferrers: (_t = this.config.attribution) === null || _t === void 0 ? void 0 : _t.excludeReferrers,\n initialEmptyValue: (_u = this.config.attribution) === null || _u === void 0 ? void 0 : _u.initialEmptyValue,\n resetSessionOnNewCampaign: (_v = this.config.attribution) === null || _v === void 0 ? void 0 : _v.resetSessionOnNewCampaign\n });\n webAttribution.__pluginEnabledOverride = isNewSession || ((_w = this.config.attribution) === null || _w === void 0 ? void 0 : _w.trackNewCampaigns) ? void 0 : false;\n return [4, this.add(webAttribution).promise];\n case 18:\n _0.sent();\n _0.label = 19;\n case 19:\n pageViewTrackingOptions = getPageViewTrackingConfig(this.config);\n pageViewTrackingOptions.eventType = pageViewTrackingOptions.eventType || DEFAULT_PAGE_VIEW_EVENT;\n return [4, this.add(pageViewTrackingPlugin(pageViewTrackingOptions)).promise];\n case 20:\n _0.sent();\n return [4, this.add(defaultPageViewEventEnrichment()).promise];\n case 21:\n _0.sent();\n this.initializing = false;\n return [4, this.runQueuedFunctions("dispatchQ")];\n case 22:\n _0.sent();\n connector.eventBridge.setEventReceiver(function(event) {\n void _this.track(event.eventType, event.eventProperties);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeBrowser2.prototype.getUserId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.userId;\n };\n AmplitudeBrowser2.prototype.setUserId = function(userId) {\n if (!this.config) {\n this.q.push(this.setUserId.bind(this, userId));\n return;\n }\n if (userId !== this.config.userId || userId === void 0) {\n this.config.userId = userId;\n setConnectorUserId(userId, this.config.instanceName);\n }\n };\n AmplitudeBrowser2.prototype.getDeviceId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.deviceId;\n };\n AmplitudeBrowser2.prototype.setDeviceId = function(deviceId) {\n if (!this.config) {\n this.q.push(this.setDeviceId.bind(this, deviceId));\n return;\n }\n this.config.deviceId = deviceId;\n setConnectorDeviceId(deviceId, this.config.instanceName);\n };\n AmplitudeBrowser2.prototype.setOptOut = function(optOut) {\n setConnectorOptOut(optOut, this.config.instanceName);\n _super.prototype.setOptOut.call(this, optOut);\n };\n AmplitudeBrowser2.prototype.reset = function() {\n this.setDeviceId(UUID());\n this.setUserId(void 0);\n };\n AmplitudeBrowser2.prototype.getSessionId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.sessionId;\n };\n AmplitudeBrowser2.prototype.setSessionId = function(sessionId) {\n var _a;\n if (!this.config) {\n this.q.push(this.setSessionId.bind(this, sessionId));\n return;\n }\n if (sessionId === this.config.sessionId) {\n return;\n }\n var previousSessionId = this.getSessionId();\n var lastEventTime = this.config.lastEventTime;\n var lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n this.config.sessionId = sessionId;\n this.config.lastEventTime = void 0;\n if (isSessionTrackingEnabled(this.config.defaultTracking)) {\n if (previousSessionId && lastEventTime) {\n this.track(DEFAULT_SESSION_END_EVENT, void 0, {\n device_id: this.previousSessionDeviceId,\n event_id: ++lastEventId,\n session_id: previousSessionId,\n time: lastEventTime + 1,\n user_id: this.previousSessionUserId\n });\n }\n this.config.lastEventTime = this.config.sessionId;\n this.track(DEFAULT_SESSION_START_EVENT, void 0, {\n event_id: ++lastEventId,\n session_id: this.config.sessionId,\n time: this.config.lastEventTime\n });\n }\n this.previousSessionDeviceId = this.config.deviceId;\n this.previousSessionUserId = this.config.userId;\n };\n AmplitudeBrowser2.prototype.extendSession = function() {\n if (!this.config) {\n this.q.push(this.extendSession.bind(this));\n return;\n }\n this.config.lastEventTime = Date.now();\n };\n AmplitudeBrowser2.prototype.setTransport = function(transport) {\n if (!this.config) {\n this.q.push(this.setTransport.bind(this, transport));\n return;\n }\n this.config.transportProvider = createTransport(transport);\n };\n AmplitudeBrowser2.prototype.identify = function(identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.user_id) {\n this.setUserId(eventOptions.user_id);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.device_id) {\n this.setDeviceId(eventOptions.device_id);\n }\n return _super.prototype.identify.call(this, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return _super.prototype.groupIdentify.call(this, groupType, groupName, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.revenue = function(revenue2, eventOptions) {\n if (isInstanceProxy(revenue2)) {\n var queue = revenue2._q;\n revenue2._q = [];\n revenue2 = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return _super.prototype.revenue.call(this, revenue2, eventOptions);\n };\n AmplitudeBrowser2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var currentTime, lastEventTime, timeSinceLastEvent;\n return __generator(this, function(_a) {\n currentTime = Date.now();\n lastEventTime = this.config.lastEventTime || Date.now();\n timeSinceLastEvent = currentTime - lastEventTime;\n if (event.event_type !== DEFAULT_SESSION_START_EVENT && event.event_type !== DEFAULT_SESSION_END_EVENT && (!event.session_id || event.session_id === this.getSessionId()) && timeSinceLastEvent > this.config.sessionTimeout) {\n this.setSessionId(currentTime);\n }\n return [2, _super.prototype.process.call(this, event)];\n });\n });\n };\n return AmplitudeBrowser2;\n })(AmplitudeCore)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client-factory.js\n var createInstance = function() {\n var client = new AmplitudeBrowser();\n return {\n init: debugWrapper(client.init.bind(client), "init", getClientLogConfig(client), getClientStates(client, ["config"])),\n add: debugWrapper(client.add.bind(client), "add", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n remove: debugWrapper(client.remove.bind(client), "remove", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n track: debugWrapper(client.track.bind(client), "track", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n logEvent: debugWrapper(client.logEvent.bind(client), "logEvent", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n identify: debugWrapper(client.identify.bind(client), "identify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n groupIdentify: debugWrapper(client.groupIdentify.bind(client), "groupIdentify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n setGroup: debugWrapper(client.setGroup.bind(client), "setGroup", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n revenue: debugWrapper(client.revenue.bind(client), "revenue", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n flush: debugWrapper(client.flush.bind(client), "flush", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n getUserId: debugWrapper(client.getUserId.bind(client), "getUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n setUserId: debugWrapper(client.setUserId.bind(client), "setUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n getDeviceId: debugWrapper(client.getDeviceId.bind(client), "getDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n setDeviceId: debugWrapper(client.setDeviceId.bind(client), "setDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n reset: debugWrapper(client.reset.bind(client), "reset", getClientLogConfig(client), getClientStates(client, ["config", "config.userId", "config.deviceId"])),\n getSessionId: debugWrapper(client.getSessionId.bind(client), "getSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n setSessionId: debugWrapper(client.setSessionId.bind(client), "setSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n extendSession: debugWrapper(client.extendSession.bind(client), "extendSession", getClientLogConfig(client), getClientStates(client, ["config"])),\n setOptOut: debugWrapper(client.setOptOut.bind(client), "setOptOut", getClientLogConfig(client), getClientStates(client, ["config"])),\n setTransport: debugWrapper(client.setTransport.bind(client), "setTransport", getClientLogConfig(client), getClientStates(client, ["config"]))\n };\n };\n var browser_client_factory_default = createInstance();\n\n // node_modules/@amplitude/analytics-browser/lib/esm/index.js\n var add = browser_client_factory_default.add;\n var extendSession = browser_client_factory_default.extendSession;\n var flush = browser_client_factory_default.flush;\n var getDeviceId = browser_client_factory_default.getDeviceId;\n var getSessionId = browser_client_factory_default.getSessionId;\n var getUserId = browser_client_factory_default.getUserId;\n var groupIdentify = browser_client_factory_default.groupIdentify;\n var identify = browser_client_factory_default.identify;\n var init = browser_client_factory_default.init;\n var logEvent = browser_client_factory_default.logEvent;\n var remove = browser_client_factory_default.remove;\n var reset = browser_client_factory_default.reset;\n var revenue = browser_client_factory_default.revenue;\n var setDeviceId = browser_client_factory_default.setDeviceId;\n var setGroup = browser_client_factory_default.setGroup;\n var setOptOut = browser_client_factory_default.setOptOut;\n var setSessionId = browser_client_factory_default.setSessionId;\n var setTransport = browser_client_factory_default.setTransport;\n var setUserId = browser_client_factory_default.setUserId;\n var track = browser_client_factory_default.track;\n\n // packages/dev-tools/client/tracking.ts\n var dispatch = (eventName) => {\n window.dispatchEvent(\n new CustomEvent(`builderdevtools`, { detail: { eventName } })\n );\n };\n async function loadUserDataFromLocal() {\n return apiLocalConfig();\n }\n var initTracking = async () => {\n const url = new URL(window.location.href);\n const hash = url.hash;\n const userIdHash = `#${CONNECTED_USER_ID_QS}=`;\n const uniqueId = Math.random().toString(36).substring(2, 15);\n const localConfig = await loadUserDataFromLocal();\n init("f1d2eb79aecd01b28c8a371ea5d1751c", localConfig?.userId || uniqueId, {\n logLevel: esm_exports.LogLevel.None,\n serverUrl: AMPLITUDE_PROXY_URL,\n flushIntervalMillis: 500\n });\n const identifyObj = new Identify();\n identify(identifyObj, {\n device_id: localConfig?.deviceId,\n user_id: localConfig?.userId || uniqueId\n });\n let builderUserId = `anonymous`;\n if (hash.startsWith(userIdHash)) {\n builderUserId = hash.slice(userIdHash.length);\n if (builderUserId) {\n setBuilderUserId(builderUserId);\n url.hash = "";\n window.history.replaceState({}, "", url.href);\n }\n }\n dispatch("init");\n };\n var setBuilderUserId = (builderUserId) => {\n if (typeof builderUserId === "string" && builderUserId.length > 0) {\n const t = getTracking();\n setTracking({\n ...t,\n builderUserId\n });\n }\n };\n var getTracking = () => {\n const ls = localStorage.getItem(TRACKING_KEY);\n if (ls) {\n try {\n let t = JSON.parse(ls);\n if (!t.ctas || typeof t.ctas !== "object") {\n t = setTracking({\n ...t,\n ctas: {}\n });\n }\n if (t.menuOpenedTs) {\n t = setTracking({\n ...t,\n ctas: {\n ...t.ctas,\n menuOpened: t.menuOpenedTs\n }\n });\n delete t.menuOpenedTs;\n }\n return t;\n } catch (e) {\n console.error(e);\n }\n }\n return setTracking({\n firstVisitTs: Date.now(),\n ctas: {},\n builderUserId: ""\n });\n };\n var setTracking = (t) => {\n try {\n localStorage.setItem(TRACKING_KEY, JSON.stringify(t));\n } catch (e) {\n console.error(e);\n }\n return t;\n };\n var hasCTA = (ctaName) => {\n const t = getTracking();\n return !!t.ctas[ctaName];\n };\n var setCTA = (ctaName) => {\n const t = getTracking();\n return setTracking({\n ...t,\n ctas: {\n ...t.ctas,\n [ctaName]: Date.now()\n }\n });\n };\n var TRACKING_KEY = "builderDevtools";\n\n // packages/dev-tools/client/menu/pages/component-input.ts\n function initComponentInputSection(shadow) {\n initRegisterInput(shadow);\n initComponentOpenSource(shadow);\n initComponentInputName(shadow);\n initComponentInputType(shadow);\n }\n function initRegisterInput(shadow) {\n const inputReg = shadow.getElementById("input-register");\n inputReg.addEventListener("change", async (ev) => {\n ev.stopPropagation();\n const inputName = shadow.getElementById("input-name");\n const nav = shadow.querySelector(".nav-cmp-input");\n nav.classList.add("input-loading");\n nav.classList.remove("input-enabled");\n const cmpId = inputName.dataset.id;\n const propName = inputName.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name: propName,\n registerInput: inputReg.checked\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentInput(shadow, cmpId, propName);\n renderComponentDetail(shadow, cmpId);\n nav.classList.remove("input-loading");\n });\n }\n function initComponentOpenSource(shadow) {\n const openSourceBtn = shadow.getElementById(\n "input-open-source"\n );\n openSourceBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmp = APP_STATE.components.find((c) => c.id === target?.dataset.id);\n if (cmp) {\n apiLaunchEditor({ filePath: cmp.filePath });\n }\n });\n }\n function initComponentInputName(shadow) {\n const inputName = shadow.getElementById("input-name");\n const inputWrapper = inputName.closest(".ui-text-input");\n let initInputName = "";\n let savedTmr;\n inputName.addEventListener("focus", (ev) => {\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n ev.stopPropagation();\n initInputName = inputName.value;\n });\n inputName.addEventListener("blur", async (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (inputName.value !== initInputName) {\n if (inputName.value.trim().length < 3) {\n inputName.value = initInputName;\n return;\n }\n inputWrapper.classList.add("saved");\n savedTmr = setTimeout(() => {\n inputWrapper.classList.remove("saved");\n }, 3e3);\n const cmpId = inputName.dataset.id;\n const name = inputName.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name,\n friendlyName: inputName.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n renderComponentInput(shadow, cmpId, name);\n }\n });\n inputName.addEventListener("keyup", (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (ev.key === "Escape") {\n inputName.value = initInputName;\n inputName.blur();\n } else if (ev.key === "Enter") {\n inputName.blur();\n }\n });\n }\n function initComponentInputType(shadow) {\n const inputType = shadow.getElementById("input-type");\n inputType.addEventListener("change", async (ev) => {\n ev.stopPropagation();\n const cmpId = inputType.dataset.id;\n const name = inputType.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name,\n type: inputType.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n renderComponentInput(shadow, cmpId, name);\n });\n }\n function renderComponentInput(shadow, cmpId, propName) {\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (!cmp) {\n return null;\n }\n const regInput = cmp.inputs.find((i) => i.name === propName);\n if (!regInput) {\n return null;\n }\n const nav = shadow.querySelector(".nav-cmp-input");\n if (regInput.isRegistered) {\n nav.classList.add("input-enabled");\n } else {\n nav.classList.remove("input-enabled");\n }\n const inputReg = shadow.getElementById("input-register");\n inputReg.checked = !!regInput.isRegistered;\n const title = shadow.getElementById("cmp-input-title");\n title.innerText = cmp.name + ": " + (regInput.friendlyName || regInput.name);\n const openSource = shadow.getElementById("input-open-source");\n openSource.innerText = `Open ${cmp.displayFilePath}`;\n openSource.dataset.id = cmp.id;\n const propNameText = shadow.getElementById("cmp-prop-name");\n propNameText.innerText = regInput.name;\n const propType = shadow.getElementById("cmp-prop-type");\n propType.innerText = getPrimitiveType(regInput.type);\n const inputName = shadow.getElementById("input-name");\n inputName.dataset.id = cmp.id;\n inputName.dataset.prop = regInput.name;\n inputName.value = regInput.friendlyName || regInput.name;\n renderInputTypeSelect(shadow, cmp, regInput);\n return regInput;\n }\n function renderInputTypeSelect(shadow, cmp, cmpInput) {\n const typeSelect = shadow.getElementById("input-type");\n typeSelect.dataset.id = cmp.id;\n typeSelect.dataset.prop = cmpInput.name;\n typeSelect.innerHTML = "";\n const inputType = cmpInput.type;\n const isString = STRING_TYPES.includes(inputType);\n const isNumber = NUMBER_TYPES.includes(inputType);\n const isBoolean = BOOLEAN_TYPES.includes(inputType);\n const isArray = ARRAY_TYPES.includes(inputType);\n const isObject = OBJECT_TYPES.includes(inputType);\n INPUT_TYPES.forEach((t) => {\n const option = document.createElement("option");\n option.value = t.value;\n option.innerText = t.text;\n option.disabled = STRING_TYPES.includes(t.value) && !isString || NUMBER_TYPES.includes(t.value) && !isNumber || BOOLEAN_TYPES.includes(t.value) && !isBoolean || ARRAY_TYPES.includes(t.value) && !isArray || OBJECT_TYPES.includes(t.value) && !isObject;\n typeSelect.appendChild(option);\n });\n typeSelect.value = inputType;\n }\n\n // packages/dev-tools/client/menu/pages/component-detail.ts\n function initComponentDetailSection(shadow) {\n initRegisterComponent(shadow);\n initComponentName(shadow);\n initComponentOpenSource2(shadow);\n initComponentInputList(shadow);\n initInputReload(shadow);\n }\n function initRegisterComponent(shadow) {\n const cmpReg = shadow.getElementById("cmp-register");\n cmpReg.addEventListener("change", (ev) => {\n ev.stopPropagation();\n loadComponentDetail(shadow, "update");\n });\n }\n async function loadComponentDetail(shadow, opt) {\n const cmpDetail = shadow.querySelector(".nav-cmp-detail");\n const cmpError = shadow.getElementById("cmp-error");\n const cmpReg = shadow.getElementById("cmp-register");\n const regSwitchLabel = cmpReg.closest(".ui-switch");\n cmpDetail.classList.remove("cmp-enabled");\n if (cmpReg.checked) {\n cmpDetail.classList.add("cmp-loading");\n }\n try {\n const cmpId = cmpReg.dataset.id;\n let registry;\n if (opt === "load") {\n registry = await apiLoadComponent({ cmpId });\n } else if (cmpReg.checked) {\n registry = await apiRegisterComponent({ cmpId });\n dispatch("registryUpdate");\n track("interaction", {\n type: "click",\n name: "register component",\n detail: cmpId\n });\n } else {\n registry = await apiUnregisterComponent({ cmpId });\n dispatch("registryUpdate");\n track("interaction", {\n type: "click",\n name: "unregister component",\n detail: cmpId\n });\n }\n updateAppState(registry);\n renderComponentList(shadow);\n const cmp = renderComponentDetail(shadow, cmpId);\n if (opt === "update" && cmp) {\n if (cmpReg.checked) {\n cmpDetail.classList.add("cmp-enabled");\n showToast(\n shadow,\n `<strong>${cmp.name}</strong> is now registered in <strong>${APP_STATE.registryDisplayPath}</strong> and available for use in the Builder Visual Editor`\n );\n } else {\n showToast(\n shadow,\n `<strong>${cmp.name}</strong> has been unregistered from <strong>${APP_STATE.registryDisplayPath}</strong> and removed from the Builder Visual Editor`\n );\n }\n }\n } catch (e) {\n console.error(e);\n cmpError.innerHTML = `<p class="error">Error loading components</p><p class="error">${e.message || e}</p>`;\n regSwitchLabel.style.display = "none";\n }\n cmpDetail.classList.remove("cmp-loading");\n }\n function initComponentName(shadow) {\n const cmpName = shadow.getElementById("cmp-name");\n const inputWrapper = cmpName.closest(".ui-text-input");\n let initComponentName2 = "";\n let savedTmr;\n cmpName.addEventListener("focus", (ev) => {\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n ev.stopPropagation();\n initComponentName2 = cmpName.value;\n });\n cmpName.addEventListener("blur", async (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (cmpName.value !== initComponentName2) {\n if (cmpName.value.trim().length < 3) {\n cmpName.value = initComponentName2;\n return;\n }\n inputWrapper.classList.add("saved");\n savedTmr = setTimeout(() => {\n inputWrapper.classList.remove("saved");\n }, 3e3);\n const cmpId = cmpName.dataset.id;\n const registry = await apiSetComponentInfo({\n cmpId,\n name: cmpName.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n }\n });\n cmpName.addEventListener("keyup", (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (ev.key === "Escape") {\n cmpName.value = initComponentName2;\n cmpName.blur();\n } else if (ev.key === "Enter") {\n cmpName.blur();\n }\n });\n }\n function renderComponentDetail(shadow, cmpId) {\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (!cmp) {\n return null;\n }\n const cmpReg = shadow.getElementById("cmp-register");\n const cmpError = shadow.getElementById("cmp-error");\n const regSwitchLabel = cmpReg.closest(".ui-switch");\n regSwitchLabel.style.display = "";\n cmpError.innerHTML = "";\n cmpReg.dataset.id = cmp.id;\n cmpReg.checked = !!cmp.isRegistered;\n const cmpDetail = shadow.querySelector(".nav-cmp-detail");\n if (cmp.isRegistered) {\n cmpDetail.classList.add("cmp-enabled");\n } else {\n cmpDetail.classList.remove("cmp-enabled");\n }\n const cmpName = shadow.getElementById("cmp-name");\n cmpName.dataset.id = cmp.id;\n cmpName.value = cmp.name;\n const openSource = shadow.getElementById("cmp-open-source");\n openSource.innerText = `Open ${cmp.displayFilePath}`;\n openSource.dataset.id = cmp.id;\n const title = shadow.getElementById("cmp-detail-title");\n title.innerText = `${cmp.name} Component`;\n renderComponentDetailInputs(shadow, cmp);\n return cmp;\n }\n function initComponentOpenSource2(shadow) {\n const openSourceBtn = shadow.getElementById(\n "cmp-open-source"\n );\n openSourceBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmp = APP_STATE.components.find((c) => c.id === target?.dataset.id);\n if (cmp) {\n apiLaunchEditor({ filePath: cmp.filePath });\n track("interaction", {\n type: "click",\n name: "open component source file",\n detail: cmp.filePath\n });\n }\n });\n }\n function initInputReload(shadow) {\n const reloadBtn = shadow.getElementById(\n "btn-inputs-reload"\n );\n reloadBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n loadComponentDetail(shadow, "load");\n });\n }\n function initComponentInputList(shadow) {\n const cmpInputList = shadow.getElementById(\n "cmp-detail-inputs"\n );\n cmpInputList.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const button = target?.closest("button");\n const cmpId = button?.dataset.id;\n const propName = button?.dataset.propName;\n const cmpInput = renderComponentInput(shadow, cmpId, propName);\n if (cmpInput) {\n goToSection(shadow, "nav-cmp-input");\n }\n });\n }\n function renderComponentDetailInputs(shadow, cmp) {\n const cmpInputList = shadow.getElementById(\n "cmp-detail-inputs"\n );\n const filteredInputList = cmp.inputs.filter((input) => !input.hideFromUI);\n if (filteredInputList.length > 0) {\n cmpInputList.innerHTML = "";\n filteredInputList.forEach((input) => {\n cmpInputList.appendChild(renderComponentDetailInputItem(cmp, input));\n });\n } else {\n cmpInputList.innerHTML = `<p class="cmp-inputs-empty">${cmp.name} component does not have any props</p>`;\n }\n }\n function renderComponentDetailInputItem(cmp, cmpInput) {\n const item = document.createElement("button");\n item.dataset.id = cmp.id;\n item.dataset.propName = cmpInput.name;\n item.className = "cmp-input-item nav-list-item";\n if (!cmpInput.isRegistered) {\n item.classList.add("cmp-input-item-unregistered");\n }\n const itemIcon = document.createElement("span");\n const type = getPrimitiveType(cmpInput.type);\n itemIcon.className = `nav-list-item-icon input-icon input-icon-${type}`;\n item.appendChild(itemIcon);\n const itemName = document.createElement("span");\n itemName.innerText = cmpInput.friendlyName || cmpInput.name;\n item.appendChild(itemName);\n const itemNote = document.createElement("span");\n itemNote.className = "nav-list-item-note";\n itemNote.innerText = cmpInput.type;\n item.appendChild(itemNote);\n return item;\n }\n\n // packages/dev-tools/client/menu/pages/component-list.ts\n function initComponentListSection(shadow) {\n const openRegistryFile = shadow.getElementById("open-builder-registry");\n openRegistryFile.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n apiLaunchEditor({ filePath: APP_STATE.registryPath, line: 1, column: 1 });\n });\n const cmpList = shadow.getElementById("cmp-list");\n cmpList.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmpId = target?.dataset.id;\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (cmp) {\n const cmpDetail = shadow.querySelector(\n ".nav-cmp-detail .section-content"\n );\n cmpDetail.scrollTop = 0;\n renderComponentDetail(shadow, cmp.id);\n goToSection(shadow, "nav-cmp-detail");\n if (cmp.isRegistered) {\n loadComponentDetail(shadow, "load");\n }\n }\n });\n const searchInput = shadow.getElementById(\n "component-search"\n );\n const clearSearchButton = shadow.getElementById(\n "clear-search"\n );\n searchInput?.addEventListener("input", (event) => {\n const searchTerm = event.target.value.toLowerCase();\n const filteredComponents = searchTerm ? APP_STATE.components.filter(\n (component) => component.name.toLowerCase().includes(searchTerm) || component.displayFilePath?.toLowerCase().includes(searchTerm)\n ) : APP_STATE.components;\n renderComponentList(shadow, filteredComponents);\n clearSearchButton.style.display = searchTerm ? "flex" : "none";\n });\n clearSearchButton?.addEventListener("click", () => {\n searchInput.value = "";\n renderComponentList(shadow);\n clearSearchButton.style.display = "none";\n });\n searchInput?.addEventListener("keydown", (event) => {\n if (event.key === "Escape") {\n searchInput.value = "";\n renderComponentList(shadow);\n clearSearchButton.style.display = "none";\n }\n });\n }\n function loadComponentsSection(shadow) {\n const loadRegistry = apiRegistry();\n renderComponents(shadow, loadRegistry);\n }\n async function renderComponents(shadow, loadRegistry) {\n const cmpList = shadow.getElementById("cmp-list");\n const cmpListSection = shadow.querySelector(".nav-cmp-list");\n cmpListSection.classList.add("nav-loading");\n const openRegistryFile = shadow.getElementById("open-builder-registry");\n try {\n const registry = await loadRegistry;\n updateAppState(registry);\n renderComponentList(shadow);\n if (APP_STATE.registryDisplayPath) {\n openRegistryFile.innerText = "Open " + registry.registryDisplayPath;\n } else {\n openRegistryFile.innerText = "";\n }\n } catch (e) {\n cmpList.innerHTML = `<p class="error">Error loading components</p><p class="error">${e.message || e}</p>`;\n console.error(e);\n }\n cmpListSection.classList.remove("nav-loading");\n }\n function renderComponentList(shadow, filteredComponents) {\n const cmpList = shadow.getElementById("cmp-list");\n cmpList.innerHTML = "";\n const componentsToRender = filteredComponents || APP_STATE.components;\n const registered = componentsToRender.filter((c) => c.isRegistered);\n const unregistered = componentsToRender.filter((c) => !c.isRegistered);\n if (filteredComponents && filteredComponents.length === 0) {\n const noResults = document.createElement("p");\n noResults.className = "no-results";\n noResults.innerText = "No matching components found";\n cmpList.appendChild(noResults);\n return;\n }\n renderComponentListSection(cmpList, "Registered Components", registered);\n renderComponentListSection(cmpList, "Unregistered Components", unregistered);\n }\n function renderComponentListSection(cmpList, listTitle, cmps) {\n if (cmps.length > 0) {\n const cmpsTitle = document.createElement("h4");\n cmpsTitle.innerText = listTitle;\n cmpList.appendChild(cmpsTitle);\n cmps.forEach((c) => {\n cmpList.appendChild(renderComponentListItem(c));\n });\n }\n }\n function renderComponentListItem(cmp) {\n const searchTerm = document.getElementById("component-search")?.value.toLowerCase();\n const item = document.createElement("button");\n item.dataset.id = cmp.id;\n item.className = "cmp-item nav-list-item";\n if (cmp.isRegistered) {\n item.classList.add("registered");\n }\n const itemIcon = document.createElement("span");\n itemIcon.className = "nav-list-item-icon";\n if (cmp.image) {\n itemIcon.style.backgroundImage = `url(${cmp.image})`;\n }\n item.appendChild(itemIcon);\n const itemName = document.createElement("span");\n itemName.className = "nav-list-item-name";\n itemName.innerHTML = highlightMatches(cmp.name, searchTerm);\n item.appendChild(itemName);\n const itemNote = document.createElement("span");\n itemNote.className = "nav-list-item-note";\n itemNote.innerHTML = highlightMatches(cmp.displayFilePath || "", searchTerm);\n item.appendChild(itemNote);\n return item;\n }\n function highlightMatches(text, searchTerm) {\n if (!searchTerm) return text;\n const regex = new RegExp(`(${searchTerm})`, "gi");\n return text.replace(regex, \'<span class="search-highlight">$1</span>\');\n }\n\n // packages/dev-tools/client/menu/toggle/menu-toggle.ts\n var initMenuToggle = (shadow) => {\n shadow.querySelector(".menu-toggle").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, true);\n });\n shadow.getElementById("close").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n });\n shadow.getElementById("hit").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n });\n initBackButtons(shadow);\n shadow.addEventListener("click", (ev) => ev.stopPropagation());\n checkCTAs(shadow);\n };\n var openMenu = (shadow, openDevToolsMenu) => {\n if (openDevToolsMenu) {\n document.body.classList.add("builder-no-scroll");\n shadow.host.classList.add("show-builder-menu");\n dispatch("menuOpen");\n setCTA("menuOpened");\n track("interaction", {\n type: "click",\n name: "open dev-tools menu"\n });\n } else {\n document.body.classList.remove("builder-no-scroll");\n shadow.host.classList.remove("show-builder-menu");\n dispatch("menuClose");\n setTimeout(() => {\n goToSection(shadow, "nav-home");\n }, 300);\n }\n apiDevToolsEnabled(openDevToolsMenu);\n };\n var checkCTAs = (shadow) => {\n if (!hasCTA("menuOpened")) {\n menuToggleToolTipCta(shadow);\n return;\n }\n const t = getTracking();\n const minutesSinceFirstVisit = (Date.now() - t.firstVisitTs) / 1e3 / 60;\n if (minutesSinceFirstVisit < 10) {\n return;\n }\n if (!hasCTA("feedback")) {\n setCTA("feedback");\n feedbackToolTipCta(shadow);\n return;\n }\n };\n var menuToggleToolTipCta = (shadow) => {\n const tooltip = document.createElement("a");\n tooltip.classList.add("menu-toggle-tooltip");\n tooltip.href = `#open-dev-tools`;\n tooltip.innerHTML = `\n <div class="menu-toggle-tooltip-content">\n <h3>Open Builder Devtools</h3>\n <p>Start registering your components</p>\n </div>\n `;\n shadow.appendChild(tooltip);\n setTimeout(() => {\n tooltip.classList.add("menu-toggle-tooltip-show");\n tooltip.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n tooltip.classList.remove("menu-toggle-tooltip-show");\n openMenu(shadow, true);\n });\n }, 1e3);\n };\n var feedbackToolTipCta = (shadow) => {\n const tooltip = document.createElement("a");\n tooltip.classList.add("menu-toggle-tooltip");\n tooltip.href = `https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform`;\n tooltip.target = "_blank";\n tooltip.innerHTML = `\n <div class="menu-toggle-tooltip-content">\n <h3>How\'s Devtools working for you?</h3>\n <p>We\'d love your feedback!</p>\n </div>\n `;\n shadow.appendChild(tooltip);\n setTimeout(() => {\n tooltip.classList.add("menu-toggle-tooltip-show");\n tooltip.addEventListener("click", () => {\n tooltip.classList.remove("menu-toggle-tooltip-show");\n });\n }, 1e3);\n };\n\n // packages/dev-tools/client/menu/pages/home.ts\n function initHomeSection(shadow) {\n const goToBuilder = shadow.getElementById("go-to-builder");\n goToBuilder.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(getEditorUrl(), "builder");\n });\n const componentsLink = shadow.getElementById("components-link");\n componentsLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const cmpList = shadow.querySelector(\n ".nav-cmp-list .section-content"\n );\n cmpList.scrollTop = 0;\n goToSection(shadow, "nav-cmp-list");\n loadComponentsSection(shadow);\n });\n const settingsLink = shadow.getElementById("settings-link");\n settingsLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n goToSection(shadow, "nav-settings");\n });\n const addPageLink = shadow.getElementById("add-page-link");\n addPageLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(getBuilderContentUrl(), "builder");\n });\n const importFromFigma = shadow.getElementById("import-from-figma");\n importFromFigma.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(\n "https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more"\n );\n });\n }\n\n // packages/dev-tools/client/menu/pages/settings.ts\n function initSettingsSection(shadow) {\n const s = shadow.getElementById("enable-edit");\n s.addEventListener("change", (ev) => {\n ev.stopPropagation();\n enableEdit(s.checked);\n });\n s.checked = isEditEnabled();\n enableEdit(s.checked);\n }\n\n // packages/dev-tools/client/menu/index.ts\n var BuilderDevToolsMenu = class extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = `<style>/* packages/dev-tools/client/common.css */\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n:host {\n --background-color: rgba(40, 40, 40, 1);\n --primary-color: rgba(72, 161, 255, 1);\n --primary-color-subdued: rgb(72, 161, 255, 0.6);\n --primary-color-highlight: rgb(126, 188, 255);\n --primary-contrast-color: white;\n --edit-color: #1d74e2;\n --edit-color-highlight: #1c6bd1;\n --edit-color-alpha: rgb(72, 161, 255, 0.15);\n --error-color: #ff2b55;\n --text-color: white;\n --text-color-highlight: white;\n --border-color: #454545;\n --button-background-color-hover: rgba(255, 255, 255, 0.1);\n --menu-width: 320px;\n --transition-time: 150ms;\n --font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n "Noto Sans",\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n font-family: var(--font-family);\n line-height: 1.6;\n}\nbutton {\n cursor: pointer;\n color: var(--text-color);\n -webkit-tap-highlight-color: transparent;\n}\ninput,\nselect,\nbutton {\n font-family: var(--font-family);\n}\n\n/* packages/dev-tools/client/menu/toggle/menu-toggle.css */\n.menu-toggle {\n position: absolute;\n right: 0;\n bottom: 0;\n pointer-events: auto;\n padding: 8px;\n background: transparent;\n border: none;\n appearance: none;\n}\n.menu-toggle div {\n position: relative;\n width: 64px;\n height: 64px;\n pointer-events: none;\n border-radius: 50%;\n background: black;\n border: 1px solid white;\n box-shadow: rgba(0, 0, 0, 33%) 0px 0 8px;\n}\n.menu-toggle:hover div {\n background-color: var(--background-color);\n border: 1px solid rgb(220, 220, 220);\n}\n.menu-toggle svg {\n position: absolute;\n top: 15px;\n left: 15px;\n width: 33px;\n height: 32px;\n}\ndiv.highlight-bg {\n position: absolute;\n top: -1px;\n left: -1px;\n background-color: rgb(26, 26, 26);\n pointer-events: none;\n transition: all 400ms ease-out;\n opacity: 0;\n}\n.menu-toggle-highlight-no-transition div.highlight-bg {\n transition: none;\n}\n.menu-toggle-highlight div.highlight-bg {\n opacity: 1;\n}\n.menu-toggle-tooltip {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 382px;\n height: 72px;\n padding: 0;\n text-align: left;\n appearance: none;\n background-color: transparent;\n border: none;\n pointer-events: none;\n transform: translate3d(320px, 0, 0);\n opacity: 0;\n transition: all 150ms ease-in-out;\n color: white;\n}\n.menu-toggle-tooltip.menu-toggle-tooltip-show {\n pointer-events: auto;\n opacity: 1;\n transform: translate3d(0, 0, 0);\n}\n.menu-toggle-tooltip-content {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 10px;\n right: 95px;\n padding: 8px 12px;\n background-color: var(--primary-color);\n box-shadow: rgba(0, 0, 0, 33%) 0px 0 20px;\n border-radius: 2px;\n}\n.menu-toggle-tooltip-content::before {\n content: "";\n position: absolute;\n bottom: 15px;\n right: -6px;\n width: 30px;\n height: 30px;\n background-color: var(--primary-color);\n transform: rotate(45deg);\n}\n.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,\n.menu-toggle-tooltip:hover .menu-toggle-tooltip-content::before {\n background-color: var(--primary-color-highlight);\n}\n.menu-toggle-tooltip-content h3 {\n margin: 0;\n font-size: 16px;\n}\n.menu-toggle-tooltip-content p {\n margin: 0;\n font-size: 12px;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-page.css */\nsection {\n position: absolute;\n display: grid;\n grid-template-rows: 64px auto 64px;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n pointer-events: none;\n}\n.section-content {\n margin: 0;\n padding: 0 0 10px 0;\n font-weight: 300;\n transform: translate3d(105%, 0, 0);\n transition: transform var(--transition-time) ease-in-out;\n overflow-y: auto;\n}\n.section-content .error {\n color: var(--error-color);\n font-weight: bold;\n}\nsection a {\n text-decoration: none;\n color: var(--text-color);\n}\nsection h3,\nsection p {\n margin-left: 16px;\n margin-right: 16px;\n}\n.info {\n font-size: 12px;\n}\nul.list {\n list-style: none;\n padding: 0;\n margin: 0;\n}\nul.list li {\n display: block;\n padding: 0;\n margin: 0;\n}\nul.list a,\nul.list button {\n display: grid;\n grid-template-columns: 24px auto;\n grid-gap: 16px;\n padding: 12px;\n margin: 8px 0;\n border: none;\n background: transparent;\n appearance: none;\n width: 100%;\n font-weight: 300;\n text-align: left;\n text-decoration: none;\n color: var(--text-color);\n}\nul.list a:hover,\nul.list button:hover {\n text-decoration: none;\n color: var(--text-color);\n background-color: var(--button-background-color-hover);\n}\nul.list a span,\nul.list button span {\n display: block;\n font-size: 16px;\n font-weight: 500;\n line-height: 1.5;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-header.css */\nheader {\n position: relative;\n display: grid;\n grid-template-columns: 44px 1fr;\n gap: 8px;\n padding-left: 8px;\n border-bottom: 1px solid var(--border-color);\n transition: opacity var(--transition-time) ease-in-out;\n opacity: 0;\n pointer-events: none;\n}\nheader > div {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.nav-home header > div {\n margin-right: 56px;\n}\nheader h2 {\n margin: 7px 0 0 0;\n font-size: 18px;\n font-weight: 500;\n line-height: 1.5;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p {\n margin: 2px 0 0 0;\n font-size: 12px;\n font-weight: 300;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p button {\n display: block;\n margin: 0;\n padding: 0;\n width: 100%;\n text-align: left;\n font-size: 12px;\n font-weight: 300;\n text-decoration: none;\n appearance: none;\n text-align: left;\n background-color: transparent;\n border: none;\n color: var(--primary-color);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p button:hover {\n text-decoration: underline;\n color: var(--primary-color);\n}\n.builder-logo {\n margin: 12px 0 0 8px;\n}\n#close {\n display: block;\n position: absolute;\n appearance: none;\n background: transparent;\n border: none;\n border-radius: 50%;\n margin: 0;\n padding: 0;\n right: 4px;\n top: 8px;\n width: 48px;\n height: 48px;\n z-index: 1;\n opacity: 0.7;\n}\n#close:hover {\n opacity: 1;\n background-color: var(--button-background-color-hover);\n}\n#close svg {\n position: absolute;\n top: 12px;\n left: 12px;\n width: 24px;\n height: 24px;\n fill: currentColor;\n pointer-events: none;\n}\n.back-button {\n position: relative;\n display: block;\n margin: 7px 0 0 -2px;\n width: 48px;\n height: 48px;\n background: transparent;\n border: none;\n appearance: none;\n border-radius: 50%;\n}\n.back-button:hover {\n background-color: var(--button-background-color-hover);\n}\n.back-button svg {\n position: absolute;\n top: 12px;\n left: 12px;\n width: 24px;\n height: 24px;\n fill: currentColor;\n pointer-events: none;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-footer.css */\nfooter {\n border-top: 1px solid var(--border-color);\n transition: opacity var(--transition-time) ease-in-out;\n opacity: 0;\n pointer-events: none;\n}\nsection.nav-cmp-list {\n grid-template-rows: 64px auto 120px;\n}\nfooter a {\n text-decoration: underline;\n color: var(--primary-color);\n}\nfooter a:hover {\n color: var(--primary-color);\n text-decoration: none;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-nav-list.css */\n.nav-list {\n padding: 2px 0;\n}\n.nav-loading {\n pointer-events: none;\n}\n.nav-loading-icon {\n position: absolute;\n display: inline-block;\n top: 170px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.nav-loading .nav-loading-icon {\n opacity: 0.5;\n}\n.nav-list h4 {\n margin: 8px 8px 8px 10px;\n font-size: 14px;\n font-weight: 600;\n}\n.nav-list .nav-list-item + h4 {\n margin-top: 30px;\n}\n.nav-list-item {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 8px;\n position: relative;\n margin: 2px 0;\n padding: 8px 28px 8px 46px;\n width: 100%;\n font-size: 14px;\n font-weight: 300;\n text-align: left;\n border: none;\n background: transparent;\n appearance: none;\n}\n.nav-list-item:hover {\n background-color: var(--button-background-color-hover);\n}\n.nav-list-item-icon {\n position: absolute;\n top: 4px;\n left: 10px;\n width: 24px;\n height: 24px;\n object-fit: contain;\n filter: invert(100%);\n background-size: 24px 24px;\n background-repeat: no-repeat;\n background-position: center center;\n}\n.nav-list-item span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n pointer-events: none;\n}\n.nav-list-item::after {\n display: block;\n position: absolute;\n content: "";\n background-image: url(\'data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>\');\n background-repeat: no-repeat;\n background-position: 12px 9px;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n pointer-events: none;\n}\n.nav-list-item-note {\n opacity: 0;\n font-size: 12px;\n padding-top: 1px;\n text-align: right;\n}\n.nav-list-item:hover .nav-list-item-note {\n opacity: 0.5;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-select.css */\n.ui-select {\n display: block;\n margin: 8px 0 16px 0;\n padding: 8px 16px 8px 16px;\n cursor: pointer;\n}\n.ui-select h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-select p {\n margin: 8px 0 8px 0;\n font-size: 12px;\n font-weight: 300;\n}\n.ui-select .select {\n position: relative;\n margin: 8px 0 8px 0;\n border-radius: 4px;\n padding: 0;\n line-height: 1.1;\n overflow: hidden;\n border: 1px solid var(--border-color);\n}\n.ui-select select {\n appearance: none;\n background-color: transparent;\n border: none;\n outline: none;\n padding: 8px 32px 8px 8px;\n margin: 0;\n width: 100%;\n font-size: 14px;\n cursor: pointer;\n text-overflow: ellipsis;\n opacity: 0.6;\n color: var(--text-color);\n}\n.ui-select .select::after {\n content: "";\n top: 6px;\n right: 5px;\n width: 24px;\n height: 24px;\n position: absolute;\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>\');\n background-repeat: no-repeat;\n background-position: center;\n pointer-events: none;\n opacity: 0.6;\n}\n.ui-select .select:hover {\n border-color: var(--primary-color-subdued);\n}\n.ui-text-input .select:focus-within {\n border-color: var(--primary-color);\n}\n.ui-text-input .select:focus-within select {\n opacity: 1;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-spinner.css */\n.spinner:after {\n content: " ";\n display: block;\n width: 32px;\n height: 32px;\n margin: 0 auto;\n pointer-events: auto;\n border-radius: 50%;\n border: 3px solid var(--text-color);\n border-color: var(--text-color) transparent var(--text-color) transparent;\n animation: spinner 750ms linear infinite;\n}\n@keyframes spinner {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n/* packages/dev-tools/client/menu/ui/ui-switch.css */\n.ui-switch {\n display: grid;\n grid-template-columns: auto 48px;\n grid-gap: 20px;\n margin: 8px 0 16px 0;\n padding: 8px 0 8px 16px;\n cursor: pointer;\n}\n.ui-switch > * {\n pointer-events: none;\n}\n.ui-switch input {\n display: none;\n visibility: hidden;\n}\n.ui-switch .switcher {\n display: inline-block;\n border-radius: 100px;\n width: 35px;\n height: 14px;\n background-color: #ccc;\n position: relative;\n top: 6px;\n vertical-align: middle;\n cursor: pointer;\n}\n.ui-switch input[type=checkbox]:checked + .switcher {\n background-color: var(--primary-color-subdued);\n}\n.ui-switch .switcher:before {\n content: "";\n display: block;\n width: 20px;\n height: 20px;\n background-color: var(--text-color);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n position: absolute;\n top: -3px;\n left: 0;\n margin-right: 0;\n transition: all 150ms;\n}\n.ui-switch input[type=checkbox]:checked + .switcher:before {\n left: 100%;\n margin-left: -20px;\n background-color: var(--primary-color);\n}\n.ui-switch h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-switch p {\n margin: 4px 0 0 0;\n font-size: 12px;\n font-weight: 300;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-text-input.css */\n.ui-text-input {\n display: block;\n margin: 8px 0 16px 0;\n padding: 8px 16px 8px 16px;\n cursor: pointer;\n}\n.ui-text-input h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-text-input p {\n margin: 8px 0 8px 0;\n font-size: 12px;\n font-weight: 300;\n}\n.ui-text-input .input {\n position: relative;\n margin: 8px 0 8px 0;\n border: 1px solid var(--border-color);\n border-radius: 4px;\n background: transparent;\n padding: 2px;\n overflow: hidden;\n}\n.ui-text-input input {\n display: block;\n width: 235px;\n font-size: 14px;\n border: none;\n background: transparent;\n padding: 6px;\n appearance: none;\n color: var(--text-color);\n opacity: 0.6;\n outline: none;\n}\n.ui-text-input .input:hover {\n border-color: var(--primary-color-subdued);\n}\n.ui-text-input .input:focus-within {\n border-color: var(--primary-color);\n}\n.ui-text-input .input:focus-within input {\n opacity: 1;\n}\n.ui-text-input .input::after {\n content: "";\n position: absolute;\n top: 5px;\n right: 14px;\n width: 8px;\n height: 17px;\n border: 2px solid rgba(51, 181, 51, 1);\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n opacity: 0;\n transition: opacity 80ms ease-in-out;\n pointer-events: none;\n}\n.ui-text-input.saved .input::after {\n opacity: 1;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-toast.css */\n.ui-toast {\n position: fixed;\n bottom: 8px;\n left: 8px;\n right: 8px;\n padding: 6px 12px;\n font-size: 14px;\n border-radius: 4px;\n transform: translate3d(0, 150%, 0);\n opacity: 0;\n transition: all var(--transition-time) ease-in-out;\n background-color: var(--primary-color-subdued);\n color: var(--text-color);\n pointer-events: none;\n}\n.ui-toast.ui-toast-show {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n pointer-events: auto;\n}\n\n/* packages/dev-tools/client/menu/nav.css */\n[data-view=nav-home] .nav-home .section-content,\n[data-view=nav-cmp-list] .nav-cmp-list .section-content,\n[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,\n[data-view=nav-cmp-input] .nav-cmp-input .section-content,\n[data-view=nav-settings] .nav-settings .section-content {\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n}\n[data-view=nav-home] .nav-home header,\n[data-view=nav-home] .nav-home footer,\n[data-view=nav-cmp-list] .nav-cmp-list header,\n[data-view=nav-cmp-list] .nav-cmp-list footer,\n[data-view=nav-cmp-detail] .nav-cmp-detail header,\n[data-view=nav-cmp-detail] .nav-cmp-detail footer,\n[data-view=nav-cmp-input] .nav-cmp-input header,\n[data-view=nav-cmp-input] .nav-cmp-input footer,\n[data-view=nav-settings] .nav-settings header,\n[data-view=nav-settings] .nav-settings footer {\n opacity: 1;\n pointer-events: auto;\n}\n[data-view=nav-cmp-list] .nav-home .section-content,\n[data-view=nav-cmp-detail] .nav-home .section-content,\n[data-view=nav-cmp-detail] .nav-cmp-list .section-content,\n[data-view=nav-cmp-input] .nav-home .section-content,\n[data-view=nav-cmp-input] .nav-cmp-list .section-content,\n[data-view=nav-cmp-input] .nav-cmp-detail .section-content,\n[data-view=nav-settings] .nav-home .section-content {\n transform: translate3d(-105%, 0, 0);\n}\n\n/* packages/dev-tools/client/menu/pages/component-list.css */\n.cmp-item .nav-list-item-icon {\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>\');\n opacity: 0.3;\n}\n.cmp-item.registered .nav-list-item-icon {\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>\');\n opacity: 0.8;\n}\n.search-highlight {\n background-color: var(--primary-color-alpha);\n padding: 0 2px;\n border-radius: 2px;\n font-weight: 500;\n}\n.search-container {\n position: sticky;\n top: 0;\n z-index: 10;\n padding: 12px 16px;\n background: var(--background-color);\n border-bottom: 1px solid var(--border-color);\n}\n.search-input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n}\n.search-icon {\n position: absolute;\n left: 12px;\n color: var(--text-color-secondary);\n pointer-events: none;\n}\n.component-search-input {\n width: 100%;\n height: 36px;\n padding: 8px 36px;\n border: 1px solid var(--border-color);\n border-radius: 6px;\n background: var(--input-background);\n color: var(--text-color);\n font-size: 14px;\n transition: border-color 0.2s, box-shadow 0.2s;\n}\n.component-search-input:focus {\n outline: none;\n border-color: var(--primary-color);\n box-shadow: 0 0 0 2px var(--primary-color-alpha);\n}\n.component-search-input::placeholder {\n color: var(--text-color-tertiary);\n}\n.clear-search-button {\n position: absolute;\n right: 8px;\n padding: 4px;\n color: var(--text-color-secondary);\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s, background-color 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.clear-search-button:hover {\n background-color: var(--hover-color);\n}\n.component-search-input:not(:placeholder-shown) + .clear-search-button {\n opacity: 1;\n}\n.no-results {\n padding: 32px 16px;\n text-align: center;\n color: var(--text-color-secondary);\n font-size: 14px;\n}\n\n/* packages/dev-tools/client/menu/pages/component-detail.css */\n#cmp-detail {\n position: relative;\n}\n.cmp-loading {\n pointer-events: none !important;\n}\n.cmp-loading-icon {\n position: absolute;\n display: inline-block;\n top: 170px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.cmp-loading .cmp-loading-icon {\n opacity: 0.5;\n}\n.cmp-cover {\n position: absolute;\n top: 160px;\n left: 0;\n width: 100%;\n height: 100vh;\n background: var(--background-color);\n transform: translate3d(0, 0, 0);\n pointer-events: none;\n display: none;\n}\n[data-view=nav-cmp-detail] .cmp-cover {\n display: block;\n pointer-events: auto;\n}\n.cmp-enabled .cmp-cover {\n transform: translate3d(0, 105%, 0);\n pointer-events: none;\n}\n.section-ready .cmp-cover {\n transition: all var(--transition-time) ease-in-out;\n}\n.cmp-detail-inputs-container {\n margin: 8px 0 16px 0;\n padding: 0;\n}\n.cmp-detail-inputs-container h3 {\n margin: 0 0 6px 0;\n padding-left: 16px;\n padding-right: 8px;\n font-size: 14px;\n font-weight: 500;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.cmp-detail-inputs-reload {\n font-weight: 300;\n font-size: 0.9em;\n text-decoration: none;\n appearance: none;\n text-align: left;\n background-color: transparent;\n border: none;\n color: var(--primary-color);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.cmp-detail-inputs-reload:hover {\n text-decoration: underline;\n color: var(--primary-color);\n}\n.cmp-detail-inputs-container .cmp-inputs-empty {\n padding: 0;\n margin-top: 12px;\n font-size: 12px;\n font-weight: 300;\n opacity: 0.5;\n font-style: italic;\n}\n.cmp-detail-inputs-container .nav-list-item-icon {\n opacity: 0.8;\n background-size: 20px 20px;\n background-position: 4px center;\n}\n.input-icon {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>\');\n}\n.input-icon-array {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>\');\n}\n.input-icon-boolean {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>\');\n}\n.input-icon-number {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>\');\n}\n.input-icon-object {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>\');\n}\n.input-icon-string {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>\');\n}\n.cmp-input-item-unregistered {\n opacity: 0.4;\n}\n.cmp-input-item-unregistered .input-icon::after {\n content: "";\n position: absolute;\n top: 11px;\n left: 4px;\n width: 20px;\n height: 2px;\n background-color: black;\n transform: rotate(-45deg);\n}\n\n/* packages/dev-tools/client/menu/pages/component-input.css */\n.cmp-prop-info {\n border-bottom: 1px solid var(--border-color);\n}\n.cmp-input-readonly {\n margin: 16px 0;\n padding: 0 16px;\n display: grid;\n grid-template-columns: 50% 50%;\n gap: 12px;\n}\n.cmp-input-readonly h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.cmp-input-readonly span {\n margin-top: 2px;\n font-size: 12px;\n font-weight: 300;\n opacity: 0.8;\n}\n.cmp-input-detail {\n margin: 16px 0;\n}\n.cmp-input-detail a {\n color: var(--primary-color);\n text-decoration: none;\n}\n.cmp-input-detail a:hover {\n text-decoration: underline;\n}\n.input-cover {\n position: absolute;\n top: 175px;\n left: 0;\n width: 100%;\n height: 100%;\n background: var(--background-color);\n transform: translate3d(0, 0, 0);\n transition: all var(--transition-time) ease-in-out;\n pointer-events: auto;\n}\n.input-enabled .input-cover {\n transform: translate3d(0, 105%, 0);\n pointer-events: none;\n}\n.input-loading-icon {\n position: absolute;\n display: inline-block;\n top: 190px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.input-loading .input-loading-icon {\n opacity: 0.5;\n}\n\n/* packages/dev-tools/client/menu/menu.css */\n:host {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 2147483646;\n user-select: none;\n pointer-events: none;\n color: var(--text-color);\n}\naside {\n position: absolute;\n top: 0;\n right: 0;\n width: var(--menu-width);\n height: 100%;\n transform: translate3d(105%, 0, 0);\n transition: transform var(--transition-time) ease-in-out;\n background: var(--background-color);\n box-shadow: #000000c9 5px 0 20px;\n overflow: hidden;\n z-index: 1;\n}\n:host(.show-builder-menu) aside {\n pointer-events: auto;\n transform: translate3d(0, 0, 0);\n}\n#hit {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: none;\n}\n:host(.show-builder-menu) #hit {\n display: block;\n pointer-events: auto;\n}\n#version {\n position: absolute;\n bottom: 6px;\n right: 6px;\n font-size: 8px;\n color: #9b9b9b;\n}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder\'s selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder\'s Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder\'s Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>`;\n initMenuToggle(shadow);\n initHomeSection(shadow);\n initComponentListSection(shadow);\n initComponentDetailSection(shadow);\n initComponentInputSection(shadow);\n initSettingsSection(shadow);\n this.setAttribute("aria-hidden", "true");\n shadow.getElementById("version").textContent = "v1.18.14-dev.202511251124.4f45e4b71";\n }\n highlightOpener() {\n const menuToggle = this.shadowRoot.querySelector(".menu-toggle");\n menuToggle.classList.add("menu-toggle-highlight");\n menuToggle.classList.add("menu-toggle-highlight-no-transition");\n setTimeout(() => {\n menuToggle.classList.remove("menu-toggle-highlight-no-transition");\n setTimeout(() => {\n menuToggle.classList.remove("menu-toggle-highlight");\n }, 20);\n }, 20);\n }\n };\n\n // packages/dev-tools/client/setup-ui/overview.ts\n var STEP_CSS = `<style>/* packages/dev-tools/client/setup-ui/styles.css */\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\nhtml,\nbody,\n:host {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n z-index: 2147483646;\n margin: 0;\n padding: 0;\n line-height: 1.8;\n font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n "Noto Sans",\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n background-color: rgba(37, 37, 37, 1);\n color: white;\n transition: opacity 250ms ease-in-out;\n}\n:host([aria-hidden="true"]) {\n opacity: 0;\n pointer-events: none;\n}\nmain {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n}\nh1 {\n margin-top: 0;\n font-size: 24px;\n font-weight: 300;\n line-height: 1.4;\n}\np {\n margin: 20px 0;\n font-weight: 300;\n}\nbutton {\n cursor: pointer;\n}\naside {\n position: absolute;\n top: 0;\n left: 0;\n width: 350px;\n height: 100vh;\n padding: 60px 0 0 50px;\n background-color: rgba(18, 18, 18, 1);\n}\naside ul {\n margin: 30px 0 0 0px;\n padding: 0;\n list-style: none;\n}\naside li {\n position: relative;\n margin: 0;\n padding: 20px 10px;\n font-weight: 300;\n}\naside li.highlight {\n color: rgba(72, 161, 255, 1);\n}\naside li.active {\n font-weight: 700;\n}\naside li .circle {\n position: absolute;\n top: 20px;\n left: 10px;\n width: 24px;\n height: 24px;\n border: 3px solid white;\n border-radius: 50%;\n font-size: 14px;\n}\naside li.highlight .circle {\n border-color: rgba(72, 161, 255, 1);\n}\naside li.active .circle::after {\n content: "";\n position: absolute;\n top: 3px;\n left: 3px;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle {\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle::after {\n content: "";\n position: absolute;\n top: 2px;\n left: 6px;\n width: 6px;\n height: 13px;\n border: 3px solid black;\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n}\naside li .line {\n position: absolute;\n top: 44px;\n left: 21px;\n width: 3px;\n height: 45px;\n background-color: white;\n}\naside li.completed .line {\n background-color: rgba(72, 161, 255, 1);\n}\naside li span {\n display: block;\n margin-left: 44px;\n}\nnav {\n margin-top: 30px;\n}\nsection {\n position: absolute;\n top: 135px;\n left: 350px;\n padding: 0 80px 0 140px;\n transition: opacity 150ms ease-in-out;\n}\nsection[aria-hidden=true] {\n pointer-events: none;\n opacity: 0;\n}\nsection h1,\nsection p {\n min-width: 300px;\n max-width: 600px;\n}\n.button {\n position: relative;\n display: inline-block;\n color: white;\n background-color: rgba(72, 161, 255, 1);\n border-radius: 4px;\n text-decoration: none;\n padding: 10px 40px 10px 20px;\n white-space: nowrap;\n}\n.button:hover {\n background-color: rgba(72, 161, 255, 0.85);\n}\n#button-icon {\n position: absolute;\n top: 1px;\n right: 5px;\n bottom: 0;\n width: 30px;\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>\');\n background-repeat: no-repeat;\n background-position: center;\n background-size: 24px 24px;\n}\n.button[aria-disabled=true] {\n opacity: 0.9;\n background-color: rgba(255, 255, 255, 0.3);\n pointer-events: none;\n padding-right: 60px;\n}\n.button[aria-disabled=true] #button-icon {\n top: 21px;\n right: 29px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background: white;\n color: white;\n animation: dot-flashing 0.5s infinite linear alternate;\n animation-delay: 0.25s;\n}\n.button[aria-disabled=true] #button-icon::before,\n.button[aria-disabled=true] #button-icon::after {\n content: "";\n display: inline-block;\n position: absolute;\n top: 0;\n}\n.button[aria-disabled=true] #button-icon::before {\n left: -12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0s;\n}\n.button[aria-disabled=true] #button-icon::after {\n left: 12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0.5s;\n}\n@keyframes dot-flashing {\n 0% {\n background-color: white;\n }\n 50%, 100% {\n background-color: rgba(255, 255, 255, 0.3);\n }\n}\n.logo {\n margin-left: 9px;\n background: url(\'data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>\');\n background-repeat: no-repeat;\n width: 150px;\n height: 32px;\n}\n@media (max-width: 840px) {\n aside {\n width: 250px;\n padding: 60px 0 0 20px;\n }\n section {\n left: 250px;\n padding: 0 80px;\n }\n}\n@media (max-width: 590px) {\n aside {\n width: 230px;\n padding: 60px 0 0 10px;\n }\n section {\n left: 230px;\n padding: 0 40px;\n }\n}\n#modified-files-message a {\n color: #cbcbcb;\n font-weight: 300;\n text-decoration: underline;\n}\n#modified-files-message a:hover {\n color: white;\n text-decoration: none;\n}\n#restart-warning {\n border-radius: 4px;\n padding: 8px 16px;\n border: 1px solid #fd6b3c;\n background: rgba(253, 107, 60, 0.1);\n}\n#react-router-steps {\n margin: 0px;\n margin-bottom: 5px;\n padding: 0px 20px;\n}\n#need-help {\n color: #48a1ff;\n text-decoration: none;\n}\n#router-message {\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #48a1ff;\n}\n#router-finish-button {\n margin-top: 12px;\n}\n#router-checkbox-div {\n display: flex;\n align-items: center;\n}\n#router-checkbox {\n margin-right: 10px;\n width: 15px;\n height: 15px;\n}\n#success-title {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n#success-title .check-icon {\n display: inline-block;\n width: 24px;\n height: 24px;\n border: 2px solid #28a745;\n border-radius: 50%;\n position: relative;\n}\n#success-title .check-icon::before {\n content: "";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 6px;\n height: 12px;\n border: solid #28a745;\n border-width: 0 2px 2px 0;\n transform: translate(-50%, -60%) rotate(45deg);\n}\n</style>`;\n var BuilderOverviewStep = class extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = STEP_CSS + `<main>\n <aside>\n <div class="logo"></div>\n\n <ul>\n <li class="highlight active">\n <div class="circle"></div>\n <div class="line"></div>\n <span>Connect Builder.io</span>\n </li>\n <li>\n <div class="circle"></div>\n <div class="line"></div>\n <span>Update App</span>\n </li>\n <li>\n <div class="circle"></div>\n <span>Setup Complete</span>\n </li>\n </ul>\n </aside>\n\n <section>\n <h1>Integrate Builder.io with your project</h1>\n\n <p>\n First, let\'s connect to your Builder.io space to continue with the\n integration\n </p>\n\n <nav>\n <a class="button next-step" href="#">\n <span id="button-text">Get Started</span>\n <span id="button-icon"></span>\n </a>\n </nav>\n </section>\n</main>\n`;\n setBuilderHead();\n const authPath = new URL(BUILDER_AUTH_CONNECT_PATH, DEV_TOOLS_URL);\n authPath.searchParams.set(PREVIEW_URL_QS, location.href);\n const nextStepLinks = shadow.querySelectorAll(".next-step");\n for (const nextStepLink of nextStepLinks) {\n nextStepLink.setAttribute("href", authPath.href);\n }\n track("overview step viewed");\n }\n };\n var setBuilderHead = () => {\n let favicon = document.head.querySelector(\n "link[rel=\'icon\'], link[rel=\'icon shortcut\']"\n );\n if (favicon) {\n favicon.href = "https://cdn.builder.io/favicon.ico";\n favicon.removeAttribute("type");\n } else {\n favicon = document.createElement("link");\n favicon.rel = "icon";\n favicon.href = "https://cdn.builder.io/favicon.ico";\n document.head.appendChild(favicon);\n }\n };\n\n // packages/dev-tools/client/setup-ui/index.ts\n var checkBuilderIntegration = async () => {\n const validatedBuilder = await apiValidateBuilder();\n if (!validatedBuilder.isValid) {\n showOverviewStep();\n }\n };\n var showOverviewStep = () => {\n if (!customElements.get("builder-dev-tools-overview")) {\n customElements.define("builder-dev-tools-overview", BuilderOverviewStep);\n }\n let overview = document.querySelector(\n "builder-dev-tools-overview"\n );\n if (!overview) {\n overview = document.createElement(\n "builder-dev-tools-overview"\n );\n overview.setAttribute("aria-hidden", "true");\n document.body.appendChild(overview);\n }\n setTimeout(() => {\n overview.removeAttribute("aria-hidden");\n }, 32);\n };\n\n // packages/dev-tools/client/index.ts\n var initDevToolsApp = () => {\n try {\n if (!customElements.get("builder-dev-tools-edit")) {\n customElements.define(\n "builder-dev-tools-edit",\n BuilderDevToolsEditButton\n );\n }\n if (!customElements.get("builder-dev-tools-menu")) {\n customElements.define("builder-dev-tools-menu", BuilderDevToolsMenu);\n }\n let menu = document.querySelector("builder-dev-tools-menu");\n if (!menu) {\n menu = document.createElement("builder-dev-tools-menu");\n menu.setAttribute("data-version", "1.18.14-dev.202511251124.4f45e4b71");\n document.body.appendChild(menu);\n }\n let editButton = document.querySelector("builder-dev-tools-edit");\n if (!editButton) {\n editButton = document.createElement("builder-dev-tools-edit");\n document.body.appendChild(editButton);\n }\n let builderStyles = document.getElementById("builder-dev-tools-style");\n if (!builderStyles) {\n builderStyles = document.createElement("style");\n builderStyles.id = "builder-dev-tools-style";\n builderStyles.innerHTML = `.builder-no-scroll{overflow:hidden !important}`;\n document.head.appendChild(builderStyles);\n }\n checkBuilderIntegration();\n initTracking();\n } catch (e) {\n console.error("Builder Devtools:", e);\n }\n };\n if (window.location === window.parent.location) {\n console.debug(`Builder.io Devtools v${"1.18.14-dev.202511251124.4f45e4b71"}`);\n initDevToolsApp();\n }\n})();');
|
|
62588
|
+
return updateClientRuntimeVariables(ctx, '"use strict";\n(() => {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. "__esModule" has not been set), then set\n // "default" to the CommonJS "module.exports" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,\n mod\n ));\n\n // node_modules/@amplitude/ua-parser-js/src/ua-parser.js\n var require_ua_parser = __commonJS({\n "node_modules/@amplitude/ua-parser-js/src/ua-parser.js"(exports, module) {\n (function(window2, undefined2) {\n "use strict";\n var LIBVERSION = "0.7.33", EMPTY = "", UNKNOWN = "?", FUNC_TYPE = "function", UNDEF_TYPE = "undefined", OBJ_TYPE = "object", STR_TYPE = "string", MAJOR = "major", MODEL = "model", NAME = "name", TYPE = "type", VENDOR = "vendor", VERSION2 = "version", ARCHITECTURE = "architecture", CONSOLE = "console", MOBILE = "mobile", TABLET = "tablet", SMARTTV = "smarttv", WEARABLE = "wearable", EMBEDDED = "embedded", UA_MAX_LENGTH = 350;\n var AMAZON = "Amazon", APPLE = "Apple", ASUS = "ASUS", BLACKBERRY = "BlackBerry", BROWSER = "Browser", CHROME = "Chrome", EDGE = "Edge", FIREFOX = "Firefox", GOOGLE = "Google", HUAWEI = "Huawei", LG = "LG", MICROSOFT = "Microsoft", MOTOROLA = "Motorola", OPERA = "Opera", SAMSUNG = "Samsung", SHARP = "Sharp", SONY = "Sony", XIAOMI = "Xiaomi", ZEBRA = "Zebra", FACEBOOK = "Facebook";\n var extend = function(regexes2, extensions) {\n var mergedRegexes = {};\n for (var i in regexes2) {\n if (extensions[i] && extensions[i].length % 2 === 0) {\n mergedRegexes[i] = extensions[i].concat(regexes2[i]);\n } else {\n mergedRegexes[i] = regexes2[i];\n }\n }\n return mergedRegexes;\n }, enumerize = function(arr) {\n var enums = {};\n for (var i = 0; i < arr.length; i++) {\n enums[arr[i].toUpperCase()] = arr[i];\n }\n return enums;\n }, has = function(str1, str2) {\n return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;\n }, lowerize = function(str) {\n return str.toLowerCase();\n }, majorize = function(version) {\n return typeof version === STR_TYPE ? version.replace(/[^\\d\\.]/g, EMPTY).split(".")[0] : undefined2;\n }, trim = function(str, len) {\n if (typeof str === STR_TYPE) {\n str = str.replace(/^\\s\\s*/, EMPTY);\n return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);\n }\n };\n var rgxMapper = function(ua, arrays) {\n var i = 0, j, k, p, q, matches, match;\n while (i < arrays.length && !matches) {\n var regex = arrays[i], props = arrays[i + 1];\n j = k = 0;\n while (j < regex.length && !matches) {\n matches = regex[j++].exec(ua);\n if (!!matches) {\n for (p = 0; p < props.length; p++) {\n match = matches[++k];\n q = props[p];\n if (typeof q === OBJ_TYPE && q.length > 0) {\n if (q.length === 2) {\n if (typeof q[1] == FUNC_TYPE) {\n this[q[0]] = q[1].call(this, match);\n } else {\n this[q[0]] = q[1];\n }\n } else if (q.length === 3) {\n if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {\n this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined2;\n } else {\n this[q[0]] = match ? match.replace(q[1], q[2]) : undefined2;\n }\n } else if (q.length === 4) {\n this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined2;\n }\n } else {\n this[q] = match ? match : undefined2;\n }\n }\n }\n }\n i += 2;\n }\n }, strMapper = function(str, map) {\n for (var i in map) {\n if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {\n for (var j = 0; j < map[i].length; j++) {\n if (has(map[i][j], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n } else if (has(map[i], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n return str;\n };\n var oldSafariMap = {\n "1.0": "/8",\n 1.2: "/1",\n 1.3: "/3",\n "2.0": "/412",\n "2.0.2": "/416",\n "2.0.3": "/417",\n "2.0.4": "/419",\n "?": "/"\n }, windowsVersionMap = {\n ME: "4.90",\n "NT 3.11": "NT3.51",\n "NT 4.0": "NT4.0",\n 2e3: "NT 5.0",\n XP: ["NT 5.1", "NT 5.2"],\n Vista: "NT 6.0",\n 7: "NT 6.1",\n 8: "NT 6.2",\n 8.1: "NT 6.3",\n 10: ["NT 6.4", "NT 10.0"],\n RT: "ARM"\n };\n var regexes = {\n browser: [\n [\n /\\b(?:crmo|crios)\\/([\\w\\.]+)/i\n // Chrome for Android/iOS\n ],\n [VERSION2, [NAME, "Chrome"]],\n [\n /edg(?:e|ios|a)?\\/([\\w\\.]+)/i\n // Microsoft Edge\n ],\n [VERSION2, [NAME, "Edge"]],\n [\n // Presto based\n /(opera mini)\\/([-\\w\\.]+)/i,\n // Opera Mini\n /(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,\n // Opera Mobi/Tablet\n /(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i\n // Opera\n ],\n [NAME, VERSION2],\n [\n /opios[\\/ ]+([\\w\\.]+)/i\n // Opera mini on iphone >= 8.0\n ],\n [VERSION2, [NAME, OPERA + " Mini"]],\n [\n /\\bopr\\/([\\w\\.]+)/i\n // Opera Webkit\n ],\n [VERSION2, [NAME, OPERA]],\n [\n // Mixed\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,\n // Lunascape/Maxthon/Netfront/Jasmine/Blazer\n // Trident based\n /(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,\n // Avant/IEMobile/SlimBrowser\n /(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,\n // Baidu Browser\n /(?:ms|\\()(ie) ([\\w\\.]+)/i,\n // Internet Explorer\n // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon\n /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,\n // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ\n /(weibo)__([\\d\\.]+)/i\n // Weibo\n ],\n [NAME, VERSION2],\n [\n /(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i\n // UCBrowser\n ],\n [VERSION2, [NAME, "UC" + BROWSER]],\n [\n /microm.+\\bqbcore\\/([\\w\\.]+)/i,\n // WeChat Desktop for Windows Built-in Browser\n /\\bqbcore\\/([\\w\\.]+).+microm/i\n ],\n [VERSION2, [NAME, "WeChat(Win) Desktop"]],\n [\n /micromessenger\\/([\\w\\.]+)/i\n // WeChat\n ],\n [VERSION2, [NAME, "WeChat"]],\n [\n /konqueror\\/([\\w\\.]+)/i\n // Konqueror\n ],\n [VERSION2, [NAME, "Konqueror"]],\n [\n /trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i\n // IE11\n ],\n [VERSION2, [NAME, "IE"]],\n [\n /yabrowser\\/([\\w\\.]+)/i\n // Yandex\n ],\n [VERSION2, [NAME, "Yandex"]],\n [\n /(avast|avg)\\/([\\w\\.]+)/i\n // Avast/AVG Secure Browser\n ],\n [[NAME, /(.+)/, "$1 Secure " + BROWSER], VERSION2],\n [\n /\\bfocus\\/([\\w\\.]+)/i\n // Firefox Focus\n ],\n [VERSION2, [NAME, FIREFOX + " Focus"]],\n [\n /\\bopt\\/([\\w\\.]+)/i\n // Opera Touch\n ],\n [VERSION2, [NAME, OPERA + " Touch"]],\n [\n /coc_coc\\w+\\/([\\w\\.]+)/i\n // Coc Coc Browser\n ],\n [VERSION2, [NAME, "Coc Coc"]],\n [\n /dolfin\\/([\\w\\.]+)/i\n // Dolphin\n ],\n [VERSION2, [NAME, "Dolphin"]],\n [\n /coast\\/([\\w\\.]+)/i\n // Opera Coast\n ],\n [VERSION2, [NAME, OPERA + " Coast"]],\n [\n /miuibrowser\\/([\\w\\.]+)/i\n // MIUI Browser\n ],\n [VERSION2, [NAME, "MIUI " + BROWSER]],\n [\n /fxios\\/([-\\w\\.]+)/i\n // Firefox for iOS\n ],\n [VERSION2, [NAME, FIREFOX]],\n [\n /\\bqihu|(qi?ho?o?|360)browser/i\n // 360\n ],\n [[NAME, "360 " + BROWSER]],\n [/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],\n [[NAME, /(.+)/, "$1 " + BROWSER], VERSION2],\n [\n // Oculus/Samsung/Sailfish/Huawei Browser\n /(comodo_dragon)\\/([\\w\\.]+)/i\n // Comodo Dragon\n ],\n [[NAME, /_/g, " "], VERSION2],\n [\n /(electron)\\/([\\w\\.]+) safari/i,\n // Electron-based App\n /(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,\n // Tesla\n /m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i\n // QQBrowser/Baidu App/2345 Browser\n ],\n [NAME, VERSION2],\n [\n /(metasr)[\\/ ]?([\\w\\.]+)/i,\n // SouGouBrowser\n /(lbbrowser)/i,\n // LieBao Browser\n /\\[(linkedin)app\\]/i\n // LinkedIn App for iOS & Android\n ],\n [NAME],\n [\n // WebView\n /((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i\n // Facebook App for iOS & Android\n ],\n [[NAME, FACEBOOK], VERSION2],\n [\n /safari (line)\\/([\\w\\.]+)/i,\n // Line App for iOS\n /\\b(line)\\/([\\w\\.]+)\\/iab/i,\n // Line App for Android\n /(chromium|instagram)[\\/ ]([-\\w\\.]+)/i\n // Chromium/Instagram\n ],\n [NAME, VERSION2],\n [\n /\\bgsa\\/([\\w\\.]+) .*safari\\//i\n // Google Search Appliance on iOS\n ],\n [VERSION2, [NAME, "GSA"]],\n [\n /headlesschrome(?:\\/([\\w\\.]+)| )/i\n // Chrome Headless\n ],\n [VERSION2, [NAME, CHROME + " Headless"]],\n [\n / wv\\).+(chrome)\\/([\\w\\.]+)/i\n // Chrome WebView\n ],\n [[NAME, CHROME + " WebView"], VERSION2],\n [\n /droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i\n // Android Browser\n ],\n [VERSION2, [NAME, "Android " + BROWSER]],\n [\n /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i\n // Chrome/OmniWeb/Arora/Tizen/Nokia\n ],\n [NAME, VERSION2],\n [\n /version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i\n // Mobile Safari\n ],\n [VERSION2, [NAME, "Mobile Safari"]],\n [\n /version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i\n // Safari & Safari Mobile\n ],\n [VERSION2, NAME],\n [\n /webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i\n // Safari < 3.0\n ],\n [NAME, [VERSION2, strMapper, oldSafariMap]],\n [/(webkit|khtml)\\/([\\w\\.]+)/i],\n [NAME, VERSION2],\n [\n // Gecko based\n /(navigator|netscape\\d?)\\/([-\\w\\.]+)/i\n // Netscape\n ],\n [[NAME, "Netscape"], VERSION2],\n [\n /mobile vr; rv:([\\w\\.]+)\\).+firefox/i\n // Firefox Reality\n ],\n [VERSION2, [NAME, FIREFOX + " Reality"]],\n [\n /ekiohf.+(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(swiftfox)/i,\n // Swiftfox\n /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,\n // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar\n /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,\n // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix\n /(firefox)\\/([\\w\\.]+)/i,\n // Other Firefox-based\n /(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,\n // Mozilla\n // Other\n /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,\n // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser\n /(links) \\(([\\w\\.]+)/i\n // Links\n ],\n [NAME, VERSION2],\n [\n /(cobalt)\\/([\\w\\.]+)/i\n // Cobalt\n ],\n [NAME, [VERSION2, /master.|lts./, ""]]\n ],\n cpu: [\n [\n /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i\n // AMD64 (x64)\n ],\n [[ARCHITECTURE, "amd64"]],\n [\n /(ia32(?=;))/i\n // IA32 (quicktime)\n ],\n [[ARCHITECTURE, lowerize]],\n [\n /((?:i[346]|x)86)[;\\)]/i\n // IA32 (x86)\n ],\n [[ARCHITECTURE, "ia32"]],\n [\n /\\b(aarch64|arm(v?8e?l?|_?64))\\b/i\n // ARM64\n ],\n [[ARCHITECTURE, "arm64"]],\n [\n /\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i\n // ARMHF\n ],\n [[ARCHITECTURE, "armhf"]],\n [\n // PocketPC mistakenly identified as PowerPC\n /windows (ce|mobile); ppc;/i\n ],\n [[ARCHITECTURE, "arm"]],\n [\n /((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i\n // PowerPC\n ],\n [[ARCHITECTURE, /ower/, EMPTY, lowerize]],\n [\n /(sun4\\w)[;\\)]/i\n // SPARC\n ],\n [[ARCHITECTURE, "sparc"]],\n [\n /((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i\n // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC\n ],\n [[ARCHITECTURE, lowerize]]\n ],\n device: [\n [\n //////////////////////////\n // MOBILES & TABLETS\n // Ordered by popularity\n /////////////////////////\n // Samsung\n /\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]],\n [\n /\\b((?:s[cgp]h|gt|sm)-\\w+|galaxy nexus)/i,\n /samsung[- ]([-\\w]+)/i,\n /sec-(sgh\\w+)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]],\n [\n // Apple\n /((ipod|iphone)\\d+,\\d+)/i\n // iPod/iPhone model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /(ipad\\d+,\\d+)/i\n // iPad model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [\n /\\((ip(?:hone|od)[\\w ]*);/i\n // iPod/iPhone\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /\\((ipad);[-\\w\\),; ]+apple/i,\n // iPad\n /applecoremedia\\/[\\w\\.]+ \\((ipad)/i,\n /\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [/(macintosh);/i],\n [MODEL, [VENDOR, APPLE]],\n [\n // Huawei\n /\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]],\n [\n /(?:huawei|honor)([-\\w ]+)[;\\)]/i,\n /\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]],\n [\n // Xiaomi\n /\\b(poco[\\w ]+)(?: bui|\\))/i,\n // Xiaomi POCO\n /\\b; (\\w+) build\\/hm\\1/i,\n // Xiaomi Hongmi \'numeric\' models\n /\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,\n // Xiaomi Hongmi\n /\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,\n // Xiaomi Redmi\n /\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i\n // Xiaomi Mi\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, MOBILE]\n ],\n [\n /\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i\n // Mi Pad tablets\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, TABLET]\n ],\n [\n // OPPO\n /; (\\w+) bui.+ oppo/i,\n /\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i\n ],\n [MODEL, [VENDOR, "OPPO"], [TYPE, MOBILE]],\n [\n // Vivo\n /vivo (\\w+)(?: bui|\\))/i,\n /\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i\n ],\n [MODEL, [VENDOR, "Vivo"], [TYPE, MOBILE]],\n [\n // Realme\n /\\b(rmx[12]\\d{3})(?: bui|;|\\))/i\n ],\n [MODEL, [VENDOR, "Realme"], [TYPE, MOBILE]],\n [\n // Motorola\n /\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,\n /\\bmot(?:orola)?[- ](\\w*)/i,\n /((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i\n ],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]],\n [/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]],\n [\n // LG\n /((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, TABLET]],\n [\n /(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,\n /\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,\n /\\blg-?([\\d\\w]+) bui/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, MOBILE]],\n [\n // Lenovo\n /(ideatab[-\\w ]+)/i,\n /lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i\n ],\n [MODEL, [VENDOR, "Lenovo"], [TYPE, TABLET]],\n [\n // Nokia\n /(?:maemo|nokia).*(n900|lumia \\d+)/i,\n /nokia[-_ ]?([-\\w\\.]*)/i\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, "Nokia"],\n [TYPE, MOBILE]\n ],\n [\n // Google\n /(pixel c)\\b/i\n // Google Pixel C\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]],\n [\n /droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i\n // Google Pixel\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]],\n [\n // Sony\n /droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i\n ],\n [MODEL, [VENDOR, SONY], [TYPE, MOBILE]],\n [/sony tablet [ps]/i, /\\b(?:sony)?sgp\\w+(?: bui|\\))/i],\n [\n [MODEL, "Xperia Tablet"],\n [VENDOR, SONY],\n [TYPE, TABLET]\n ],\n [\n // OnePlus\n / (kb2005|in20[12]5|be20[12][59])\\b/i,\n /(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i\n ],\n [MODEL, [VENDOR, "OnePlus"], [TYPE, MOBILE]],\n [\n // Amazon\n /(alexa)webm/i,\n /(kf[a-z]{2}wi)( bui|\\))/i,\n // Kindle Fire without Silk\n /(kf[a-z]+)( bui|\\)).+silk\\//i\n // Kindle Fire HD\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]],\n [\n /((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i\n // Fire Phone\n ],\n [\n [MODEL, /(.+)/g, "Fire Phone $1"],\n [VENDOR, AMAZON],\n [TYPE, MOBILE]\n ],\n [\n // BlackBerry\n /(playbook);[-\\w\\),; ]+(rim)/i\n // BlackBerry PlayBook\n ],\n [MODEL, VENDOR, [TYPE, TABLET]],\n [\n /\\b((?:bb[a-f]|st[hv])100-\\d)/i,\n /\\(bb10; (\\w+)/i\n // BlackBerry 10\n ],\n [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]],\n [\n // Asus\n /(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i\n ],\n [MODEL, [VENDOR, ASUS], [TYPE, TABLET]],\n [/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],\n [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]],\n [\n // HTC\n /(nexus 9)/i\n // HTC Nexus 9\n ],\n [MODEL, [VENDOR, "HTC"], [TYPE, TABLET]],\n [\n /(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,\n // HTC\n // ZTE\n /(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,\n /(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\\w]*)/i\n // Alcatel/GeeksPhone/Nexian/Panasonic/Sony\n ],\n [VENDOR, [MODEL, /_/g, " "], [TYPE, MOBILE]],\n [\n // Acer\n /droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i\n ],\n [MODEL, [VENDOR, "Acer"], [TYPE, TABLET]],\n [\n // Meizu\n /droid.+; (m[1-5] note) bui/i,\n /\\bmz-([-\\w]{2,})/i\n ],\n [MODEL, [VENDOR, "Meizu"], [TYPE, MOBILE]],\n [\n // Sharp\n /\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]],\n [\n // MIXED\n /(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,\n // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron\n /(hp) ([\\w ]+\\w)/i,\n // HP iPAQ\n /(asus)-?(\\w+)/i,\n // Asus\n /(microsoft); (lumia[\\w ]+)/i,\n // Microsoft Lumia\n /(lenovo)[-_ ]?([-\\w]+)/i,\n // Lenovo\n /(jolla)/i,\n // Jolla\n /(oppo) ?([\\w ]+) bui/i\n // OPPO\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(archos) (gamepad2?)/i,\n // Archos\n /(hp).+(touchpad(?!.+tablet)|tablet)/i,\n // HP TouchPad\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(nook)[\\w ]+build\\/(\\w+)/i,\n // Nook\n /(dell) (strea[kpr\\d ]*[\\dko])/i,\n // Dell Streak\n /(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,\n // Le Pan Tablets\n /(trinity)[- ]*(t\\d{3}) bui/i,\n // Trinity Tablets\n /(gigaset)[- ]+(q\\w{1,9}) bui/i,\n // Gigaset Tablets\n /(vodafone) ([\\w ]+)(?:\\)| bui)/i\n // Vodafone\n ],\n [VENDOR, MODEL, [TYPE, TABLET]],\n [\n /(surface duo)/i\n // Surface Duo\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]],\n [\n /droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i\n // Fairphone\n ],\n [MODEL, [VENDOR, "Fairphone"], [TYPE, MOBILE]],\n [\n /(u304aa)/i\n // AT&T\n ],\n [MODEL, [VENDOR, "AT&T"], [TYPE, MOBILE]],\n [\n /\\bsie-(\\w*)/i\n // Siemens\n ],\n [MODEL, [VENDOR, "Siemens"], [TYPE, MOBILE]],\n [\n /\\b(rct\\w+) b/i\n // RCA Tablets\n ],\n [MODEL, [VENDOR, "RCA"], [TYPE, TABLET]],\n [\n /\\b(venue[\\d ]{2,7}) b/i\n // Dell Venue Tablets\n ],\n [MODEL, [VENDOR, "Dell"], [TYPE, TABLET]],\n [\n /\\b(q(?:mv|ta)\\w+) b/i\n // Verizon Tablet\n ],\n [MODEL, [VENDOR, "Verizon"], [TYPE, TABLET]],\n [\n /\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i\n // Barnes & Noble Tablet\n ],\n [MODEL, [VENDOR, "Barnes & Noble"], [TYPE, TABLET]],\n [/\\b(tm\\d{3}\\w+) b/i],\n [MODEL, [VENDOR, "NuVision"], [TYPE, TABLET]],\n [\n /\\b(k88) b/i\n // ZTE K Series Tablet\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, TABLET]],\n [\n /\\b(nx\\d{3}j) b/i\n // ZTE Nubia\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, MOBILE]],\n [\n /\\b(gen\\d{3}) b.+49h/i\n // Swiss GEN Mobile\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, MOBILE]],\n [\n /\\b(zur\\d{3}) b/i\n // Swiss ZUR Tablet\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, TABLET]],\n [\n /\\b((zeki)?tb.*\\b) b/i\n // Zeki Tablets\n ],\n [MODEL, [VENDOR, "Zeki"], [TYPE, TABLET]],\n [\n /\\b([yr]\\d{2}) b/i,\n /\\b(dragon[- ]+touch |dt)(\\w{5}) b/i\n // Dragon Touch Tablet\n ],\n [[VENDOR, "Dragon Touch"], MODEL, [TYPE, TABLET]],\n [\n /\\b(ns-?\\w{0,9}) b/i\n // Insignia Tablets\n ],\n [MODEL, [VENDOR, "Insignia"], [TYPE, TABLET]],\n [\n /\\b((nxa|next)-?\\w{0,9}) b/i\n // NextBook Tablets\n ],\n [MODEL, [VENDOR, "NextBook"], [TYPE, TABLET]],\n [\n /\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i\n // Voice Xtreme Phones\n ],\n [[VENDOR, "Voice"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(lvtel\\-)?(v1[12]) b/i\n // LvTel Phones\n ],\n [[VENDOR, "LvTel"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(ph-1) /i\n // Essential PH-1\n ],\n [MODEL, [VENDOR, "Essential"], [TYPE, MOBILE]],\n [\n /\\b(v(100md|700na|7011|917g).*\\b) b/i\n // Envizen Tablets\n ],\n [MODEL, [VENDOR, "Envizen"], [TYPE, TABLET]],\n [\n /\\b(trio[-\\w\\. ]+) b/i\n // MachSpeed Tablets\n ],\n [MODEL, [VENDOR, "MachSpeed"], [TYPE, TABLET]],\n [\n /\\btu_(1491) b/i\n // Rotor Tablets\n ],\n [MODEL, [VENDOR, "Rotor"], [TYPE, TABLET]],\n [\n /(shield[\\w ]+) b/i\n // Nvidia Shield Tablets\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, TABLET]],\n [\n /(sprint) (\\w+)/i\n // Sprint Phones\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(kin\\.[onetw]{3})/i\n // Microsoft Kin\n ],\n [\n [MODEL, /\\./g, " "],\n [VENDOR, MICROSOFT],\n [TYPE, MOBILE]\n ],\n [\n /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i\n // Zebra\n ],\n [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]],\n [/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]],\n [\n ///////////////////\n // CONSOLES\n ///////////////////\n /(ouya)/i,\n // Ouya\n /(nintendo) ([wids3utch]+)/i\n // Nintendo\n ],\n [VENDOR, MODEL, [TYPE, CONSOLE]],\n [\n /droid.+; (shield) bui/i\n // Nvidia\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, CONSOLE]],\n [\n /(playstation [345portablevi]+)/i\n // Playstation\n ],\n [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]],\n [\n /\\b(xbox(?: one)?(?!; xbox))[\\); ]/i\n // Microsoft Xbox\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]],\n [\n ///////////////////\n // SMARTTVS\n ///////////////////\n /smart-tv.+(samsung)/i\n // Samsung\n ],\n [VENDOR, [TYPE, SMARTTV]],\n [/hbbtv.+maple;(\\d+)/i],\n [\n [MODEL, /^/, "SmartTV"],\n [VENDOR, SAMSUNG],\n [TYPE, SMARTTV]\n ],\n [\n /(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i\n // LG SmartTV\n ],\n [\n [VENDOR, LG],\n [TYPE, SMARTTV]\n ],\n [\n /(apple) ?tv/i\n // Apple TV\n ],\n [VENDOR, [MODEL, APPLE + " TV"], [TYPE, SMARTTV]],\n [\n /crkey/i\n // Google Chromecast\n ],\n [\n [MODEL, CHROME + "cast"],\n [VENDOR, GOOGLE],\n [TYPE, SMARTTV]\n ],\n [\n /droid.+aft(\\w)( bui|\\))/i\n // Fire TV\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]],\n [\n /\\(dtv[\\);].+(aquos)/i,\n /(aquos-tv[\\w ]+)\\)/i\n // Sharp\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],\n [\n /(bravia[\\w ]+)( bui|\\))/i\n // Sony\n ],\n [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]],\n [\n /(mitv-\\w{5}) bui/i\n // Xiaomi\n ],\n [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]],\n [\n /\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,\n // Roku\n /hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w ]*; *(\\w[^;]*);([^;]*)/i\n // HbbTV devices\n ],\n [\n [VENDOR, trim],\n [MODEL, trim],\n [TYPE, SMARTTV]\n ],\n [\n /\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i\n // SmartTV from Unidentified Vendors\n ],\n [[TYPE, SMARTTV]],\n [\n ///////////////////\n // WEARABLES\n ///////////////////\n /((pebble))app/i\n // Pebble\n ],\n [VENDOR, MODEL, [TYPE, WEARABLE]],\n [\n /droid.+; (glass) \\d/i\n // Google Glass\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]],\n [/droid.+; (wt63?0{2,3})\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]],\n [\n /(quest( 2)?)/i\n // Oculus Quest\n ],\n [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]],\n [\n ///////////////////\n // EMBEDDED\n ///////////////////\n /(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i\n // Tesla\n ],\n [VENDOR, [TYPE, EMBEDDED]],\n [\n ////////////////////\n // MIXED (GENERIC)\n ///////////////////\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i\n // Android Phones from Unidentified Vendors\n ],\n [MODEL, [TYPE, MOBILE]],\n [\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i\n // Android Tablets from Unidentified Vendors\n ],\n [MODEL, [TYPE, TABLET]],\n [\n /\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i\n // Unidentifiable Tablet\n ],\n [[TYPE, TABLET]],\n [\n /(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i\n // Unidentifiable Mobile\n ],\n [[TYPE, MOBILE]],\n [\n /(android[-\\w\\. ]{0,9});.+buil/i\n // Generic Android Device\n ],\n [MODEL, [VENDOR, "Generic"]]\n ],\n engine: [\n [\n /windows.+ edge\\/([\\w\\.]+)/i\n // EdgeHTML\n ],\n [VERSION2, [NAME, EDGE + "HTML"]],\n [\n /webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i\n // Blink\n ],\n [VERSION2, [NAME, "Blink"]],\n [\n /(presto)\\/([\\w\\.]+)/i,\n // Presto\n /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,\n // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna\n /ekioh(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,\n // KHTML/Tasman/Links\n /(icab)[\\/ ]([23]\\.[\\d\\.]+)/i\n // iCab\n ],\n [NAME, VERSION2],\n [\n /rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i\n // Gecko\n ],\n [VERSION2, NAME]\n ],\n os: [\n [\n // Windows\n /microsoft (windows) (vista|xp)/i\n // Windows (iTunes)\n ],\n [NAME, VERSION2],\n [\n /(windows) nt 6\\.2; (arm)/i,\n // Windows RT\n /(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,\n // Windows Phone\n /(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i\n ],\n [NAME, [VERSION2, strMapper, windowsVersionMap]],\n [/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],\n [\n [NAME, "Windows"],\n [VERSION2, strMapper, windowsVersionMap]\n ],\n [\n // iOS/macOS\n /ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,\n // iOS\n /cfnetwork\\/.+darwin/i\n ],\n [\n [VERSION2, /_/g, "."],\n [NAME, "iOS"]\n ],\n [\n /(mac os x) ?([\\w\\. ]*)/i,\n /(macintosh|mac_powerpc\\b)(?!.+haiku)/i\n // Mac OS\n ],\n [\n [NAME, "Mac OS"],\n [VERSION2, /_/g, "."]\n ],\n [\n // Mobile OSes\n /droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i\n // Android-x86/HarmonyOS\n ],\n [VERSION2, NAME],\n [\n // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS\n /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,\n /(blackberry)\\w*\\/([\\w\\.]*)/i,\n // Blackberry\n /(tizen|kaios)[\\/ ]([\\w\\.]+)/i,\n // Tizen/KaiOS\n /\\((series40);/i\n // Series 40\n ],\n [NAME, VERSION2],\n [\n /\\(bb(10);/i\n // BlackBerry 10\n ],\n [VERSION2, [NAME, BLACKBERRY]],\n [\n /(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i\n // Symbian\n ],\n [VERSION2, [NAME, "Symbian"]],\n [\n /mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i\n // Firefox OS\n ],\n [VERSION2, [NAME, FIREFOX + " OS"]],\n [\n /web0s;.+rt(tv)/i,\n /\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i\n // WebOS\n ],\n [VERSION2, [NAME, "webOS"]],\n [\n // Google Chromecast\n /crkey\\/([\\d\\.]+)/i\n // Google Chromecast\n ],\n [VERSION2, [NAME, CHROME + "cast"]],\n [\n /(cros) [\\w]+ ([\\w\\.]+\\w)/i\n // Chromium OS\n ],\n [[NAME, "Chromium OS"], VERSION2],\n [\n // Console\n /(nintendo|playstation) ([wids345portablevuch]+)/i,\n // Nintendo/Playstation\n /(xbox); +xbox ([^\\);]+)/i,\n // Microsoft Xbox (360, One, X, S, Series X, Series S)\n // Other\n /\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,\n // Joli/Palm\n /(mint)[\\/\\(\\) ]?(\\w*)/i,\n // Mint\n /(mageia|vectorlinux)[; ]/i,\n // Mageia/VectorLinux\n /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,\n // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire\n /(hurd|linux) ?([\\w\\.]*)/i,\n // Hurd/Linux\n /(gnu) ?([\\w\\.]*)/i,\n // GNU\n /\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,\n // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly\n /(haiku) (\\w+)/i\n // Haiku\n ],\n [NAME, VERSION2],\n [\n /(sunos) ?([\\w\\.\\d]*)/i\n // Solaris\n ],\n [[NAME, "Solaris"], VERSION2],\n [\n /((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,\n // Solaris\n /(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,\n // AIX\n /\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,\n // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX\n /(unix) ?([\\w\\.]*)/i\n // UNIX\n ],\n [NAME, VERSION2]\n ]\n };\n var UAParser2 = function(ua, extensions) {\n if (typeof ua === OBJ_TYPE) {\n extensions = ua;\n ua = undefined2;\n }\n if (!(this instanceof UAParser2)) {\n return new UAParser2(ua, extensions).getResult();\n }\n var _ua = ua || (typeof window2 !== UNDEF_TYPE && window2.navigator && window2.navigator.userAgent ? window2.navigator.userAgent : EMPTY);\n var _rgxmap = extensions ? extend(regexes, extensions) : regexes;\n this.getBrowser = function() {\n var _browser = {};\n _browser[NAME] = undefined2;\n _browser[VERSION2] = undefined2;\n rgxMapper.call(_browser, _ua, _rgxmap.browser);\n _browser.major = majorize(_browser.version);\n return _browser;\n };\n this.getCPU = function() {\n var _cpu = {};\n _cpu[ARCHITECTURE] = undefined2;\n rgxMapper.call(_cpu, _ua, _rgxmap.cpu);\n return _cpu;\n };\n this.getDevice = function() {\n var _device = {};\n _device[VENDOR] = undefined2;\n _device[MODEL] = undefined2;\n _device[TYPE] = undefined2;\n rgxMapper.call(_device, _ua, _rgxmap.device);\n return _device;\n };\n this.getEngine = function() {\n var _engine = {};\n _engine[NAME] = undefined2;\n _engine[VERSION2] = undefined2;\n rgxMapper.call(_engine, _ua, _rgxmap.engine);\n return _engine;\n };\n this.getOS = function() {\n var _os = {};\n _os[NAME] = undefined2;\n _os[VERSION2] = undefined2;\n rgxMapper.call(_os, _ua, _rgxmap.os);\n return _os;\n };\n this.getResult = function() {\n return {\n ua: this.getUA(),\n browser: this.getBrowser(),\n engine: this.getEngine(),\n os: this.getOS(),\n device: this.getDevice(),\n cpu: this.getCPU()\n };\n };\n this.getUA = function() {\n return _ua;\n };\n this.setUA = function(ua2) {\n _ua = typeof ua2 === STR_TYPE && ua2.length > UA_MAX_LENGTH ? trim(ua2, UA_MAX_LENGTH) : ua2;\n return this;\n };\n this.setUA(_ua);\n return this;\n };\n UAParser2.VERSION = LIBVERSION;\n UAParser2.BROWSER = enumerize([NAME, VERSION2, MAJOR]);\n UAParser2.CPU = enumerize([ARCHITECTURE]);\n UAParser2.DEVICE = enumerize([\n MODEL,\n VENDOR,\n TYPE,\n CONSOLE,\n MOBILE,\n SMARTTV,\n TABLET,\n WEARABLE,\n EMBEDDED\n ]);\n UAParser2.ENGINE = UAParser2.OS = enumerize([NAME, VERSION2]);\n if (typeof exports !== UNDEF_TYPE) {\n if (typeof module !== UNDEF_TYPE && module.exports) {\n exports = module.exports = UAParser2;\n }\n exports.UAParser = UAParser2;\n } else {\n if (typeof define === FUNC_TYPE && define.amd) {\n define(function() {\n return UAParser2;\n });\n } else if (typeof window2 !== UNDEF_TYPE) {\n window2.UAParser = UAParser2;\n }\n }\n var $ = typeof window2 !== UNDEF_TYPE && (window2.jQuery || window2.Zepto);\n if ($ && !$.ua) {\n var parser = new UAParser2();\n $.ua = parser.getResult();\n $.ua.get = function() {\n return parser.getUA();\n };\n $.ua.set = function(ua) {\n parser.setUA(ua);\n var result = parser.getResult();\n for (var prop in result) {\n $.ua[prop] = result[prop];\n }\n };\n }\n })(typeof window === "object" ? window : exports);\n }\n });\n\n // packages/dev-tools/client/utils.ts\n var goToSection = (shadow, view) => {\n closeToasts(shadow);\n const aside = shadow.querySelector("aside");\n aside.dataset.view = view;\n aside.classList.remove("section-ready");\n setTimeout(() => {\n aside.classList.add("section-ready");\n }, 200);\n };\n var initBackButtons = (shadow) => {\n Array.from(shadow.querySelectorAll(".back-button")).forEach((elm) => {\n elm.addEventListener("click", (ev) => {\n closeToasts(shadow);\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n goToSection(shadow, target?.dataset.back || "nav-home");\n });\n });\n };\n var showToast = (shadow, html) => {\n closeToasts(shadow);\n const aside = shadow.querySelector("aside");\n const toast = document.createElement("div");\n toast.className = `ui-toast`;\n toast.innerHTML = html;\n aside.appendChild(toast);\n setTimeout(() => {\n toast.classList.add("ui-toast-show");\n setTimeout(() => {\n toast.classList.remove("ui-toast-show");\n setTimeout(() => {\n toast.remove();\n }, 500);\n }, 4e3);\n }, 30);\n };\n var closeToasts = (shadow) => {\n const aside = shadow.querySelector("aside");\n const existing = Array.from(aside.querySelectorAll(".ui-toast"));\n existing.forEach((el) => {\n el.classList.remove("ui-toast-show");\n });\n };\n var isEditEnabled = () => {\n const key = getDisableEditKey();\n return localStorage.getItem(key) !== "true";\n };\n var enableEdit = (enable) => {\n const key = getDisableEditKey();\n if (enable) {\n localStorage.removeItem(key);\n } else {\n localStorage.setItem(key, "true");\n }\n };\n var getDisableEditKey = () => getLocalStorageKey("disableEdit");\n var getLocalStorageKey = (name) => `builder.__LOCAL_APP_ID__.${name}`;\n var getEditorUrl = () => {\n const contentElm = document.body.querySelector("[builder-content-id]");\n const contentId = contentElm?.getAttribute("builder-content-id");\n return getBuilderContentUrl(contentId);\n };\n var getBuilderContentUrl = (contentId, blockId) => {\n let pathname = "/content";\n if (contentId) {\n pathname += "/" + contentId + "/edit";\n }\n const url = new URL(pathname, "https://builder.io");\n if (contentId && blockId) {\n url.searchParams.set("selectedBlock", blockId);\n }\n const previewUrl = new URL(location.pathname, location.href);\n url.searchParams.set("overridePreviewUrl", previewUrl.href);\n return url.href;\n };\n var DEV_TOOLS_URL = "__DEV_TOOLS_URL__";\n var APP_STATE = {\n components: [],\n registryPath: "",\n registryDisplayPath: "",\n frameworks: [],\n dependencies: [],\n publicApiKey: void 0,\n devToolsVersion: ""\n };\n var updateAppState = (registry) => {\n APP_STATE.components = registry.components;\n APP_STATE.registryPath = registry.registryPath;\n APP_STATE.registryDisplayPath = registry.registryDisplayPath;\n APP_STATE.dependencies = registry.dependencies;\n APP_STATE.publicApiKey = registry.publicApiKey;\n };\n\n // packages/dev-tools/client/edit-button/document-listeners.ts\n function initDocumentListeners(editButton) {\n let lastBlockId = null;\n const menu = document.querySelector(\n "builder-dev-tools-menu"\n );\n const hideEditButton = () => {\n editButton.hide();\n };\n const onPointerOver = (ev) => {\n const hoverElm = ev.target;\n if (!hoverElm) {\n hideEditButton();\n return;\n }\n if (hoverElm.closest("builder-dev-tools-edit")) {\n return;\n }\n const contentElm = hoverElm.closest("[builder-content-id]");\n const blockElm = hoverElm.closest("[builder-id]");\n if (!contentElm || !blockElm) {\n editButton.hide();\n return;\n }\n const blockId = editButton.show(contentElm, blockElm);\n if (!blockId || blockId === lastBlockId) {\n return;\n }\n menu.highlightOpener();\n lastBlockId = blockId;\n };\n document.addEventListener("pointerover", onPointerOver, { passive: true });\n document.addEventListener("pointerleave", hideEditButton, {\n passive: true\n });\n document.addEventListener("pointercancel", hideEditButton, {\n passive: true\n });\n document.addEventListener("visibilitychange", hideEditButton, {\n passive: true\n });\n window.addEventListener("popstate", hideEditButton, { passive: true });\n const originalPushState = history.pushState;\n history.pushState = function(...args) {\n editButton.hide();\n originalPushState.apply(this, args);\n };\n const originalReplaceState = history.replaceState;\n history.replaceState = function(...args) {\n editButton.hide();\n originalReplaceState.apply(this, args);\n };\n }\n\n // packages/dev-tools/client/edit-button/index.ts\n var BuilderDevToolsEditButton = class extends HTMLElement {\n openInBuilder = null;\n block = null;\n constructor() {\n super();\n }\n connectedCallback() {\n this.setAttribute("aria-hidden", "true");\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = \'<style>/* packages/dev-tools/client/common.css */\\n*,\\n*::before,\\n*::after {\\n box-sizing: border-box;\\n}\\n:host {\\n --background-color: rgba(40, 40, 40, 1);\\n --primary-color: rgba(72, 161, 255, 1);\\n --primary-color-subdued: rgb(72, 161, 255, 0.6);\\n --primary-color-highlight: rgb(126, 188, 255);\\n --primary-contrast-color: white;\\n --edit-color: #1d74e2;\\n --edit-color-highlight: #1c6bd1;\\n --edit-color-alpha: rgb(72, 161, 255, 0.15);\\n --error-color: #ff2b55;\\n --text-color: white;\\n --text-color-highlight: white;\\n --border-color: #454545;\\n --button-background-color-hover: rgba(255, 255, 255, 0.1);\\n --menu-width: 320px;\\n --transition-time: 150ms;\\n --font-family:\\n ui-sans-serif,\\n system-ui,\\n -apple-system,\\n BlinkMacSystemFont,\\n "Segoe UI",\\n Roboto,\\n "Helvetica Neue",\\n Arial,\\n "Noto Sans",\\n sans-serif,\\n "Apple Color Emoji",\\n "Segoe UI Emoji",\\n "Segoe UI Symbol",\\n "Noto Color Emoji";\\n font-family: var(--font-family);\\n line-height: 1.6;\\n}\\nbutton {\\n cursor: pointer;\\n color: var(--text-color);\\n -webkit-tap-highlight-color: transparent;\\n}\\ninput,\\nselect,\\nbutton {\\n font-family: var(--font-family);\\n}\\n\\n/* packages/dev-tools/client/edit-button/edit-button.css */\\n:host {\\n display: none;\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n z-index: 2147483646;\\n user-select: none;\\n pointer-events: none;\\n color: var(--text-color);\\n}\\n#content-highlight,\\n#block {\\n position: absolute;\\n}\\n#content-highlight {\\n border: 3px solid var(--primary-color);\\n background-color: var(--primary-color-alpha);\\n}\\na {\\n position: absolute;\\n top: -33px;\\n left: 0;\\n display: block;\\n padding: 5px 10px 8px 10px;\\n pointer-events: auto;\\n z-index: 100;\\n text-decoration: none;\\n}\\na:hover {\\n text-decoration: none;\\n}\\na span {\\n display: block;\\n padding: 3px 6px;\\n font-size: 10px;\\n font-weight: 300;\\n border-radius: 3px;\\n text-align: center;\\n text-decoration: none;\\n pointer-events: none;\\n background-color: var(--edit-color);\\n color: var(--text-color);\\n white-space: nowrap;\\n}\\na:hover span {\\n background-color: var(--edit-color-highlight);\\n}\\na:hover ~ .outline {\\n border-color: var(--edit-color-highlight);\\n}\\n#open-in-editor {\\n display: none;\\n}\\n.outline {\\n position: absolute;\\n top: 0;\\n left: 0;\\n width: 100%;\\n height: 100%;\\n border: 1px solid var(--edit-color);\\n background-color: var(--edit-color-alpha);\\n}</style><div id="block"> <a id="open-in-builder" target="builder"><span>Open In Builder</span></a> <a id="open-in-editor" href="#open-in-editor"><span>Open In Editor</span></a> <div class="outline"></div> </div>\';\n this.openInBuilder = shadow.getElementById(\n "open-in-builder"\n );\n this.block = shadow.getElementById("block");\n initDocumentListeners(this);\n }\n show(contentElm, blockElm) {\n if (!isEditEnabled()) {\n this.hide();\n return null;\n }\n const contentId = contentElm.getAttribute("builder-content-id");\n const blockId = blockElm.getAttribute("builder-id");\n if (!contentId || !blockId) {\n this.hide();\n return null;\n }\n const block = this.block;\n const openInBuilder = this.openInBuilder;\n const builderRect = blockElm.getBoundingClientRect();\n block.style.top = builderRect.top + window.scrollY - 1 + "px";\n block.style.left = builderRect.left + window.scrollX + "px";\n block.style.width = builderRect.width + "px";\n block.style.height = builderRect.height + 1 + "px";\n const openInBuilderRect = openInBuilder.getBoundingClientRect();\n if (openInBuilderRect.width > builderRect.width) {\n const diff = openInBuilderRect.width - builderRect.width;\n openInBuilder.style.left = diff / 2 * -1 + "px";\n } else {\n openInBuilder.style.left = "";\n }\n openInBuilder.href = getBuilderContentUrl(contentId, blockId);\n this.style.display = "block";\n return blockId;\n }\n hide() {\n this.style.display = "";\n }\n };\n\n // packages/dev-tools/common/constants.ts\n var PREVIEW_URL_QS = `preview-url`;\n var CONNECTED_USER_ID_QS = "_b-uid";\n var BUILDER_AUTH_CONNECT_PATH = "/~builder-connect";\n var DEV_TOOLS_API_PATH = "/~builder-dev-tools";\n var AMPLITUDE_PROXY_URL = "https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";\n\n // packages/dev-tools/client/client-api.ts\n var apiValidateBuilder = () => apiFetch({\n type: "validateBuilder"\n });\n var apiLaunchEditor = (file) => apiFetch({\n type: "launchEditor",\n data: file\n });\n var apiRegistry = (opts) => apiFetch({\n type: "getRegistry",\n data: opts\n });\n var apiLoadComponent = (opts) => apiFetch({\n type: "loadComponent",\n data: opts\n });\n var apiRegisterComponent = (opts) => apiFetch({\n type: "registerComponent",\n data: opts\n });\n var apiSetComponentInfo = (opts) => apiFetch({\n type: "setComponentInfo",\n data: opts\n });\n var apiSetComponentInput = (opts) => apiFetch({\n type: "setComponentInput",\n data: opts\n });\n var apiUnregisterComponent = (opts) => apiFetch({\n type: "unregisterComponent",\n data: opts\n });\n var apiDevToolsEnabled = (enabled) => apiFetch({\n type: "enableDevTools",\n data: { enabled }\n });\n var apiLocalConfig = () => apiFetch({ type: "localConfig" });\n var apiFetch = async (data) => {\n const url = new URL(DEV_TOOLS_API_PATH, DEV_TOOLS_URL);\n let rsp;\n try {\n rsp = await fetch(url, {\n method: "POST",\n body: JSON.stringify(data)\n });\n } catch (e) {\n console.error(`Devtools Fetch Error, ${url.href}`, e);\n throw new Error(`Builder Devtools Fetch Error`);\n }\n const contentType = rsp.headers.get("content-type") || "";\n if (contentType.includes("application/json")) {\n const r = await rsp.json();\n if (rsp.ok) {\n return r.data;\n }\n if (Array.isArray(r.errors) && r.errors.length > 0) {\n r.errors.forEach((e) => console.error(e));\n throw new Error(`Builder Devtools Fetch Error: ${r.errors[0]}`);\n }\n }\n throw new Error(\n `Builder Devtools Fetch Error: ${rsp.status}, ${await rsp.text()}`\n );\n };\n\n // packages/dev-tools/common/ast/component-input-types.ts\n var INPUT_TYPES = [\n { value: "boolean", text: "boolean" },\n { value: "color", text: "color (provides a color in hex or rgb)" },\n { value: "date", text: "date (same format as the Date constructor)" },\n { value: "email", text: "email" },\n { value: "file", text: "file (uploads a file and provides a url)" },\n { value: "list", text: "list (collection of items)" },\n { value: "longText", text: "longText (multiline text editor)" },\n { value: "number", text: "number" },\n { value: "object", text: "object (set of specific names and values)" },\n { value: "richText", text: "richText (provides value as html)" },\n { value: "string", text: "string" }\n ];\n var STRING_TYPES = [\n "color",\n "date",\n "email",\n "file",\n "longText",\n "richText",\n "string"\n ];\n var NUMBER_TYPES = ["number"];\n var BOOLEAN_TYPES = ["boolean"];\n var ARRAY_TYPES = ["list"];\n var OBJECT_TYPES = ["object"];\n function getPrimitiveType(t) {\n if (STRING_TYPES.includes(t)) {\n return "string";\n } else if (NUMBER_TYPES.includes(t)) {\n return "number";\n } else if (BOOLEAN_TYPES.includes(t)) {\n return "boolean";\n } else if (ARRAY_TYPES.includes(t)) {\n return "array";\n } else if (OBJECT_TYPES.includes(t)) {\n return "object";\n } else {\n return "string";\n }\n }\n var PROP_BLACKLIST = new Set(\n [\n "about",\n "accessKey",\n "accessKeyLabel",\n "asChild",\n "autoCapitalize",\n "autoCorrect",\n "autoFocus",\n "autoSave",\n "blur",\n "contentEditable",\n "contextMenu",\n "dangerouslySetInnerHTML",\n "datatype",\n "defaultChecked",\n "defaultValue",\n "dir",\n "draggable",\n "enterKeyHint",\n "focus",\n "form",\n "formAction",\n "formEncType",\n "formMethod",\n "formNoValidate",\n "formTarget",\n "inlist",\n "innerText",\n "inputMode",\n "is",\n "isContentEditable",\n "itemID",\n "itemProp",\n "itemRef",\n "itemScope",\n "itemType",\n "lang",\n "nonce",\n "offsetHeight",\n "offsetLeft",\n "offsetTop",\n "offsetWidth",\n "outerText",\n "prefix",\n "property",\n "radioGroup",\n "rel",\n "resource",\n "results",\n "rev",\n "role",\n "security",\n "slot",\n "spellCheck",\n "suppressContentEditableWarning",\n "suppressHydrationWarning",\n "tabIndex",\n "translate",\n "typeof",\n "unselectable",\n "vocab"\n ].map((s) => s.toLowerCase())\n );\n\n // node_modules/tslib/tslib.es6.mjs\n var extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {\n d2.__proto__ = b2;\n } || function(d2, b2) {\n for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];\n };\n return extendStatics(d, b);\n };\n function __extends(d, b) {\n if (typeof b !== "function" && b !== null)\n throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n }\n var __assign = function() {\n __assign = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === "function")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n }\n function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function(resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function(resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator["throw"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n }\n function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() {\n if (t[0] & 1) throw t[1];\n return t[1];\n }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);\n return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([n, v]);\n };\n }\n function step(op) {\n if (f) throw new TypeError("Generator is already executing.");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return { value: op[1], done: false };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return { value: op[0] ? op[1] : void 0, done: true };\n }\n }\n function __values(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = { error };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n }\n\n // node_modules/@amplitude/analytics-types/lib/esm/index.js\n var esm_exports = {};\n __export(esm_exports, {\n IdentifyOperation: () => IdentifyOperation,\n LogLevel: () => LogLevel,\n PluginType: () => PluginType,\n RevenueProperty: () => RevenueProperty,\n ServerZone: () => ServerZone,\n SpecialEventType: () => SpecialEventType,\n Status: () => Status,\n TransportType: () => TransportType\n });\n\n // node_modules/@amplitude/analytics-types/lib/esm/event.js\n var IdentifyOperation;\n (function(IdentifyOperation2) {\n IdentifyOperation2["SET"] = "$set";\n IdentifyOperation2["SET_ONCE"] = "$setOnce";\n IdentifyOperation2["ADD"] = "$add";\n IdentifyOperation2["APPEND"] = "$append";\n IdentifyOperation2["PREPEND"] = "$prepend";\n IdentifyOperation2["REMOVE"] = "$remove";\n IdentifyOperation2["PREINSERT"] = "$preInsert";\n IdentifyOperation2["POSTINSERT"] = "$postInsert";\n IdentifyOperation2["UNSET"] = "$unset";\n IdentifyOperation2["CLEAR_ALL"] = "$clearAll";\n })(IdentifyOperation || (IdentifyOperation = {}));\n var RevenueProperty;\n (function(RevenueProperty2) {\n RevenueProperty2["REVENUE_PRODUCT_ID"] = "$productId";\n RevenueProperty2["REVENUE_QUANTITY"] = "$quantity";\n RevenueProperty2["REVENUE_PRICE"] = "$price";\n RevenueProperty2["REVENUE_TYPE"] = "$revenueType";\n RevenueProperty2["REVENUE_CURRENCY"] = "$currency";\n RevenueProperty2["REVENUE"] = "$revenue";\n })(RevenueProperty || (RevenueProperty = {}));\n var SpecialEventType;\n (function(SpecialEventType2) {\n SpecialEventType2["IDENTIFY"] = "$identify";\n SpecialEventType2["GROUP_IDENTIFY"] = "$groupidentify";\n SpecialEventType2["REVENUE"] = "revenue_amount";\n })(SpecialEventType || (SpecialEventType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/logger.js\n var LogLevel;\n (function(LogLevel2) {\n LogLevel2[LogLevel2["None"] = 0] = "None";\n LogLevel2[LogLevel2["Error"] = 1] = "Error";\n LogLevel2[LogLevel2["Warn"] = 2] = "Warn";\n LogLevel2[LogLevel2["Verbose"] = 3] = "Verbose";\n LogLevel2[LogLevel2["Debug"] = 4] = "Debug";\n })(LogLevel || (LogLevel = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/plugin.js\n var PluginType;\n (function(PluginType2) {\n PluginType2["BEFORE"] = "before";\n PluginType2["ENRICHMENT"] = "enrichment";\n PluginType2["DESTINATION"] = "destination";\n })(PluginType || (PluginType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/server-zone.js\n var ServerZone;\n (function(ServerZone2) {\n ServerZone2["US"] = "US";\n ServerZone2["EU"] = "EU";\n ServerZone2["STAGING"] = "STAGING";\n })(ServerZone || (ServerZone = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/status.js\n var Status;\n (function(Status2) {\n Status2["Unknown"] = "unknown";\n Status2["Skipped"] = "skipped";\n Status2["Success"] = "success";\n Status2["RateLimit"] = "rate_limit";\n Status2["PayloadTooLarge"] = "payload_too_large";\n Status2["Invalid"] = "invalid";\n Status2["Failed"] = "failed";\n Status2["Timeout"] = "Timeout";\n Status2["SystemError"] = "SystemError";\n })(Status || (Status = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/transport.js\n var TransportType;\n (function(TransportType2) {\n TransportType2["XHR"] = "xhr";\n TransportType2["SendBeacon"] = "beacon";\n TransportType2["Fetch"] = "fetch";\n })(TransportType || (TransportType = {}));\n\n // node_modules/@amplitude/analytics-core/lib/esm/constants.js\n var UNSET_VALUE = "-";\n var AMPLITUDE_PREFIX = "AMP";\n var STORAGE_PREFIX = "".concat(AMPLITUDE_PREFIX, "_unsent");\n var AMPLITUDE_SERVER_URL = "https://api2.amplitude.com/2/httpapi";\n var EU_AMPLITUDE_SERVER_URL = "https://api.eu.amplitude.com/2/httpapi";\n var AMPLITUDE_BATCH_SERVER_URL = "https://api2.amplitude.com/batch";\n var EU_AMPLITUDE_BATCH_SERVER_URL = "https://api.eu.amplitude.com/batch";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js\n var MAX_PROPERTY_KEYS = 1e3;\n var isValidObject = function(properties) {\n if (Object.keys(properties).length > MAX_PROPERTY_KEYS) {\n return false;\n }\n for (var key in properties) {\n var value = properties[key];\n if (!isValidProperties(key, value))\n return false;\n }\n return true;\n };\n var isValidProperties = function(property, value) {\n var e_1, _a;\n if (typeof property !== "string")\n return false;\n if (Array.isArray(value)) {\n var isValid = true;\n try {\n for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {\n var valueElement = value_1_1.value;\n if (Array.isArray(valueElement)) {\n return false;\n } else if (typeof valueElement === "object") {\n isValid = isValid && isValidObject(valueElement);\n } else if (!["number", "string"].includes(typeof valueElement)) {\n return false;\n }\n if (!isValid) {\n return false;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n } else if (value === null || value === void 0) {\n return false;\n } else if (typeof value === "object") {\n return isValidObject(value);\n } else if (!["number", "string", "boolean"].includes(typeof value)) {\n return false;\n }\n return true;\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/identify.js\n var Identify = (\n /** @class */\n (function() {\n function Identify2() {\n this._propertySet = /* @__PURE__ */ new Set();\n this._properties = {};\n }\n Identify2.prototype.getUserProperties = function() {\n return __assign({}, this._properties);\n };\n Identify2.prototype.set = function(property, value) {\n this._safeSet(IdentifyOperation.SET, property, value);\n return this;\n };\n Identify2.prototype.setOnce = function(property, value) {\n this._safeSet(IdentifyOperation.SET_ONCE, property, value);\n return this;\n };\n Identify2.prototype.append = function(property, value) {\n this._safeSet(IdentifyOperation.APPEND, property, value);\n return this;\n };\n Identify2.prototype.prepend = function(property, value) {\n this._safeSet(IdentifyOperation.PREPEND, property, value);\n return this;\n };\n Identify2.prototype.postInsert = function(property, value) {\n this._safeSet(IdentifyOperation.POSTINSERT, property, value);\n return this;\n };\n Identify2.prototype.preInsert = function(property, value) {\n this._safeSet(IdentifyOperation.PREINSERT, property, value);\n return this;\n };\n Identify2.prototype.remove = function(property, value) {\n this._safeSet(IdentifyOperation.REMOVE, property, value);\n return this;\n };\n Identify2.prototype.add = function(property, value) {\n this._safeSet(IdentifyOperation.ADD, property, value);\n return this;\n };\n Identify2.prototype.unset = function(property) {\n this._safeSet(IdentifyOperation.UNSET, property, UNSET_VALUE);\n return this;\n };\n Identify2.prototype.clearAll = function() {\n this._properties = {};\n this._properties[IdentifyOperation.CLEAR_ALL] = UNSET_VALUE;\n return this;\n };\n Identify2.prototype._safeSet = function(operation, property, value) {\n if (this._validate(operation, property, value)) {\n var userPropertyMap = this._properties[operation];\n if (userPropertyMap === void 0) {\n userPropertyMap = {};\n this._properties[operation] = userPropertyMap;\n }\n userPropertyMap[property] = value;\n this._propertySet.add(property);\n return true;\n }\n return false;\n };\n Identify2.prototype._validate = function(operation, property, value) {\n if (this._properties[IdentifyOperation.CLEAR_ALL] !== void 0) {\n return false;\n }\n if (this._propertySet.has(property)) {\n return false;\n }\n if (operation === IdentifyOperation.ADD) {\n return typeof value === "number";\n }\n if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {\n return isValidProperties(property, value);\n }\n return true;\n };\n return Identify2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js\n var createTrackEvent = function(eventInput, eventProperties, eventOptions) {\n var baseEvent = typeof eventInput === "string" ? { event_type: eventInput } : eventInput;\n return __assign(__assign(__assign({}, baseEvent), eventOptions), eventProperties && { event_properties: eventProperties });\n };\n var createIdentifyEvent = function(identify2, eventOptions) {\n var identifyEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties() });\n return identifyEvent;\n };\n var createGroupIdentifyEvent = function(groupType, groupName, identify2, eventOptions) {\n var _a;\n var groupIdentify2 = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.GROUP_IDENTIFY, group_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupIdentify2;\n };\n var createGroupEvent = function(groupType, groupName, eventOptions) {\n var _a;\n var identify2 = new Identify();\n identify2.set(groupType, groupName);\n var groupEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupEvent;\n };\n var createRevenueEvent = function(revenue2, eventOptions) {\n return __assign(__assign({}, eventOptions), { event_type: SpecialEventType.REVENUE, event_properties: revenue2.getEventProperties() });\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js\n var buildResult = function(event, code, message) {\n if (code === void 0) {\n code = 0;\n }\n if (message === void 0) {\n message = Status.Unknown;\n }\n return { event, code, message };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/timeline.js\n var Timeline = (\n /** @class */\n (function() {\n function Timeline2(client) {\n this.client = client;\n this.queue = [];\n this.applying = false;\n this.plugins = [];\n }\n Timeline2.prototype.register = function(plugin, config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, plugin.setup(config, this.client)];\n case 1:\n _a.sent();\n this.plugins.push(plugin);\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.deregister = function(pluginName, config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var index, plugin;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n index = this.plugins.findIndex(function(plugin2) {\n return plugin2.name === pluginName;\n });\n if (index === -1) {\n config.loggerProvider.warn("Plugin with name ".concat(pluginName, " does not exist, skipping deregistration"));\n return [\n 2\n /*return*/\n ];\n }\n plugin = this.plugins[index];\n this.plugins.splice(index, 1);\n return [4, (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin)];\n case 1:\n _b.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.reset = function(client) {\n this.applying = false;\n var plugins = this.plugins;\n plugins.map(function(plugin) {\n var _a;\n return (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin);\n });\n this.plugins = [];\n this.client = client;\n };\n Timeline2.prototype.push = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n _this.queue.push([event, resolve]);\n _this.scheduleApply(0);\n });\n };\n Timeline2.prototype.scheduleApply = function(timeout) {\n var _this = this;\n if (this.applying)\n return;\n this.applying = true;\n setTimeout(function() {\n void _this.apply(_this.queue.shift()).then(function() {\n _this.applying = false;\n if (_this.queue.length > 0) {\n _this.scheduleApply(0);\n }\n });\n }, timeout);\n };\n Timeline2.prototype.apply = function(item) {\n return __awaiter(this, void 0, void 0, function() {\n var _a, event, _b, resolve, before, before_1, before_1_1, plugin, e, e_1_1, enrichment, enrichment_1, enrichment_1_1, plugin, e, e_2_1, destination, executeDestinations;\n var e_1, _c, e_2, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n if (!item) {\n return [\n 2\n /*return*/\n ];\n }\n _a = __read(item, 1), event = _a[0];\n _b = __read(item, 2), resolve = _b[1];\n before = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.BEFORE;\n });\n _e.label = 1;\n case 1:\n _e.trys.push([1, 6, 7, 8]);\n before_1 = __values(before), before_1_1 = before_1.next();\n _e.label = 2;\n case 2:\n if (!!before_1_1.done) return [3, 5];\n plugin = before_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 3:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 4;\n case 4:\n before_1_1 = before_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (before_1_1 && !before_1_1.done && (_c = before_1.return)) _c.call(before_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n enrichment = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.ENRICHMENT;\n });\n _e.label = 9;\n case 9:\n _e.trys.push([9, 14, 15, 16]);\n enrichment_1 = __values(enrichment), enrichment_1_1 = enrichment_1.next();\n _e.label = 10;\n case 10:\n if (!!enrichment_1_1.done) return [3, 13];\n plugin = enrichment_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 11:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 12;\n case 12:\n enrichment_1_1 = enrichment_1.next();\n return [3, 10];\n case 13:\n return [3, 16];\n case 14:\n e_2_1 = _e.sent();\n e_2 = { error: e_2_1 };\n return [3, 16];\n case 15:\n try {\n if (enrichment_1_1 && !enrichment_1_1.done && (_d = enrichment_1.return)) _d.call(enrichment_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 16:\n destination = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin2) {\n var eventClone = __assign({}, event);\n return plugin2.execute(eventClone).catch(function(e2) {\n return buildResult(eventClone, 0, String(e2));\n });\n });\n void Promise.all(executeDestinations).then(function(_a2) {\n var _b2 = __read(_a2, 1), result = _b2[0];\n resolve(result);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.flush = function() {\n return __awaiter(this, void 0, void 0, function() {\n var queue, destination, executeDestinations;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n queue = this.queue;\n this.queue = [];\n return [4, Promise.all(queue.map(function(item) {\n return _this.apply(item);\n }))];\n case 1:\n _a.sent();\n destination = this.plugins.filter(function(plugin) {\n return plugin.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin) {\n return plugin.flush && plugin.flush();\n });\n return [4, Promise.all(executeDestinations)];\n case 2:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return Timeline2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/messages.js\n var SUCCESS_MESSAGE = "Event tracked successfully";\n var UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";\n var MAX_RETRIES_EXCEEDED_MESSAGE = "Event rejected due to exceeded retry count";\n var OPT_OUT_MESSAGE = "Event skipped due to optOut config";\n var MISSING_API_KEY_MESSAGE = "Event rejected due to missing API key";\n var INVALID_API_KEY = "Invalid API key";\n var CLIENT_NOT_INITIALIZED = "Client not initialized";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js\n var returnWrapper = function(awaitable) {\n return {\n promise: awaitable || Promise.resolve()\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/core-client.js\n var AmplitudeCore = (\n /** @class */\n (function() {\n function AmplitudeCore2(name) {\n if (name === void 0) {\n name = "$default";\n }\n this.initializing = false;\n this.q = [];\n this.dispatchQ = [];\n this.logEvent = this.track.bind(this);\n this.timeline = new Timeline(this);\n this.name = name;\n }\n AmplitudeCore2.prototype._init = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n this.config = config;\n this.timeline.reset(this);\n return [4, this.runQueuedFunctions("q")];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.runQueuedFunctions = function(queueName) {\n return __awaiter(this, void 0, void 0, function() {\n var queuedFunctions, queuedFunctions_1, queuedFunctions_1_1, queuedFunction, e_1_1;\n var e_1, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n queuedFunctions = this[queueName];\n this[queueName] = [];\n _b.label = 1;\n case 1:\n _b.trys.push([1, 6, 7, 8]);\n queuedFunctions_1 = __values(queuedFunctions), queuedFunctions_1_1 = queuedFunctions_1.next();\n _b.label = 2;\n case 2:\n if (!!queuedFunctions_1_1.done) return [3, 5];\n queuedFunction = queuedFunctions_1_1.value;\n return [4, queuedFunction()];\n case 3:\n _b.sent();\n _b.label = 4;\n case 4:\n queuedFunctions_1_1 = queuedFunctions_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _b.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (queuedFunctions_1_1 && !queuedFunctions_1_1.done && (_a = queuedFunctions_1.return)) _a.call(queuedFunctions_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.track = function(eventInput, eventProperties, eventOptions) {\n var event = createTrackEvent(eventInput, eventProperties, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.identify = function(identify2, eventOptions) {\n var event = createIdentifyEvent(identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n var event = createGroupIdentifyEvent(groupType, groupName, identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.setGroup = function(groupType, groupName, eventOptions) {\n var event = createGroupEvent(groupType, groupName, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.revenue = function(revenue2, eventOptions) {\n var event = createRevenueEvent(revenue2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.add = function(plugin) {\n if (!this.config) {\n this.q.push(this.add.bind(this, plugin));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.register(plugin, this.config));\n };\n AmplitudeCore2.prototype.remove = function(pluginName) {\n if (!this.config) {\n this.q.push(this.remove.bind(this, pluginName));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.deregister(pluginName, this.config));\n };\n AmplitudeCore2.prototype.dispatchWithCallback = function(event, callback) {\n if (!this.config) {\n return callback(buildResult(event, 0, CLIENT_NOT_INITIALIZED));\n }\n void this.process(event).then(callback);\n };\n AmplitudeCore2.prototype.dispatch = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n if (!this.config) {\n return [2, new Promise(function(resolve) {\n _this.dispatchQ.push(_this.dispatchWithCallback.bind(_this, event, resolve));\n })];\n }\n return [2, this.process(event)];\n });\n });\n };\n AmplitudeCore2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var result, e_2, message, result;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n if (this.config.optOut) {\n return [2, buildResult(event, 0, OPT_OUT_MESSAGE)];\n }\n return [4, this.timeline.push(event)];\n case 1:\n result = _a.sent();\n result.code === 200 ? this.config.loggerProvider.log(result.message) : this.config.loggerProvider.error(result.message);\n return [2, result];\n case 2:\n e_2 = _a.sent();\n this.config.loggerProvider.error(e_2);\n message = String(e_2);\n result = buildResult(event, 0, message);\n return [2, result];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.setOptOut = function(optOut) {\n if (!this.config) {\n this.q.push(this.setOptOut.bind(this, Boolean(optOut)));\n return;\n }\n this.config.optOut = Boolean(optOut);\n };\n AmplitudeCore2.prototype.flush = function() {\n return returnWrapper(this.timeline.flush());\n };\n return AmplitudeCore2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/revenue.js\n var Revenue = (\n /** @class */\n (function() {\n function Revenue2() {\n this.productId = "";\n this.quantity = 1;\n this.price = 0;\n }\n Revenue2.prototype.setProductId = function(productId) {\n this.productId = productId;\n return this;\n };\n Revenue2.prototype.setQuantity = function(quantity) {\n if (quantity > 0) {\n this.quantity = quantity;\n }\n return this;\n };\n Revenue2.prototype.setPrice = function(price) {\n this.price = price;\n return this;\n };\n Revenue2.prototype.setRevenueType = function(revenueType) {\n this.revenueType = revenueType;\n return this;\n };\n Revenue2.prototype.setCurrency = function(currency) {\n this.currency = currency;\n return this;\n };\n Revenue2.prototype.setRevenue = function(revenue2) {\n this.revenue = revenue2;\n return this;\n };\n Revenue2.prototype.setEventProperties = function(properties) {\n if (isValidObject(properties)) {\n this.properties = properties;\n }\n return this;\n };\n Revenue2.prototype.getEventProperties = function() {\n var eventProperties = this.properties ? __assign({}, this.properties) : {};\n eventProperties[RevenueProperty.REVENUE_PRODUCT_ID] = this.productId;\n eventProperties[RevenueProperty.REVENUE_QUANTITY] = this.quantity;\n eventProperties[RevenueProperty.REVENUE_PRICE] = this.price;\n eventProperties[RevenueProperty.REVENUE_TYPE] = this.revenueType;\n eventProperties[RevenueProperty.REVENUE_CURRENCY] = this.currency;\n eventProperties[RevenueProperty.REVENUE] = this.revenue;\n return eventProperties;\n };\n return Revenue2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js\n var chunk = function(arr, size) {\n var chunkSize = Math.max(size, 1);\n return arr.reduce(function(chunks, element, index) {\n var chunkIndex = Math.floor(index / chunkSize);\n if (!chunks[chunkIndex]) {\n chunks[chunkIndex] = [];\n }\n chunks[chunkIndex].push(element);\n return chunks;\n }, []);\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/logger.js\n var PREFIX = "Amplitude Logger ";\n var Logger = (\n /** @class */\n (function() {\n function Logger2() {\n this.logLevel = LogLevel.None;\n }\n Logger2.prototype.disable = function() {\n this.logLevel = LogLevel.None;\n };\n Logger2.prototype.enable = function(logLevel) {\n if (logLevel === void 0) {\n logLevel = LogLevel.Warn;\n }\n this.logLevel = logLevel;\n };\n Logger2.prototype.log = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Verbose) {\n return;\n }\n console.log("".concat(PREFIX, "[Log]: ").concat(args.join(" ")));\n };\n Logger2.prototype.warn = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Warn) {\n return;\n }\n console.warn("".concat(PREFIX, "[Warn]: ").concat(args.join(" ")));\n };\n Logger2.prototype.error = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Error) {\n return;\n }\n console.error("".concat(PREFIX, "[Error]: ").concat(args.join(" ")));\n };\n Logger2.prototype.debug = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Debug) {\n return;\n }\n console.log("".concat(PREFIX, "[Debug]: ").concat(args.join(" ")));\n };\n return Logger2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/config.js\n var getDefaultConfig = function() {\n return {\n flushMaxRetries: 12,\n flushQueueSize: 200,\n flushIntervalMillis: 1e4,\n instanceName: "$default_instance",\n logLevel: LogLevel.Warn,\n loggerProvider: new Logger(),\n optOut: false,\n serverUrl: AMPLITUDE_SERVER_URL,\n serverZone: ServerZone.US,\n useBatch: false\n };\n };\n var Config = (\n /** @class */\n (function() {\n function Config2(options) {\n var _a, _b, _c, _d;\n this._optOut = false;\n var defaultConfig = getDefaultConfig();\n this.apiKey = options.apiKey;\n this.flushIntervalMillis = (_a = options.flushIntervalMillis) !== null && _a !== void 0 ? _a : defaultConfig.flushIntervalMillis;\n this.flushMaxRetries = options.flushMaxRetries || defaultConfig.flushMaxRetries;\n this.flushQueueSize = options.flushQueueSize || defaultConfig.flushQueueSize;\n this.instanceName = options.instanceName || defaultConfig.instanceName;\n this.loggerProvider = options.loggerProvider || defaultConfig.loggerProvider;\n this.logLevel = (_b = options.logLevel) !== null && _b !== void 0 ? _b : defaultConfig.logLevel;\n this.minIdLength = options.minIdLength;\n this.plan = options.plan;\n this.ingestionMetadata = options.ingestionMetadata;\n this.optOut = (_c = options.optOut) !== null && _c !== void 0 ? _c : defaultConfig.optOut;\n this.serverUrl = options.serverUrl;\n this.serverZone = options.serverZone || defaultConfig.serverZone;\n this.storageProvider = options.storageProvider;\n this.transportProvider = options.transportProvider;\n this.useBatch = (_d = options.useBatch) !== null && _d !== void 0 ? _d : defaultConfig.useBatch;\n this.loggerProvider.enable(this.logLevel);\n var serverConfig = createServerConfig(options.serverUrl, options.serverZone, options.useBatch);\n this.serverZone = serverConfig.serverZone;\n this.serverUrl = serverConfig.serverUrl;\n }\n Object.defineProperty(Config2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n this._optOut = optOut;\n },\n enumerable: false,\n configurable: true\n });\n return Config2;\n })()\n );\n var getServerUrl = function(serverZone, useBatch) {\n if (serverZone === ServerZone.EU) {\n return useBatch ? EU_AMPLITUDE_BATCH_SERVER_URL : EU_AMPLITUDE_SERVER_URL;\n }\n return useBatch ? AMPLITUDE_BATCH_SERVER_URL : AMPLITUDE_SERVER_URL;\n };\n var createServerConfig = function(serverUrl, serverZone, useBatch) {\n if (serverUrl === void 0) {\n serverUrl = "";\n }\n if (serverZone === void 0) {\n serverZone = getDefaultConfig().serverZone;\n }\n if (useBatch === void 0) {\n useBatch = getDefaultConfig().useBatch;\n }\n if (serverUrl) {\n return { serverUrl, serverZone: void 0 };\n }\n var _serverZone = ["US", "EU"].includes(serverZone) ? serverZone : getDefaultConfig().serverZone;\n return {\n serverZone: _serverZone,\n serverUrl: getServerUrl(_serverZone, useBatch)\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js\n function getErrorMessage(error) {\n if (error instanceof Error)\n return error.message;\n return String(error);\n }\n function getResponseBodyString(res) {\n var responseBodyString = "";\n try {\n if ("body" in res) {\n responseBodyString = JSON.stringify(res.body);\n }\n } catch (_a) {\n }\n return responseBodyString;\n }\n var Destination = (\n /** @class */\n (function() {\n function Destination2() {\n this.name = "amplitude";\n this.type = PluginType.DESTINATION;\n this.retryTimeout = 1e3;\n this.throttleTimeout = 3e4;\n this.storageKey = "";\n this.scheduled = null;\n this.queue = [];\n }\n Destination2.prototype.setup = function(config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var unsent;\n var _this = this;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n this.config = config;\n this.storageKey = "".concat(STORAGE_PREFIX, "_").concat(this.config.apiKey.substring(0, 10));\n return [4, (_a = this.config.storageProvider) === null || _a === void 0 ? void 0 : _a.get(this.storageKey)];\n case 1:\n unsent = _b.sent();\n this.saveEvents();\n if (unsent && unsent.length > 0) {\n void Promise.all(unsent.map(function(event) {\n return _this.execute(event);\n })).catch();\n }\n return [2, Promise.resolve(void 0)];\n }\n });\n });\n };\n Destination2.prototype.execute = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n var context = {\n event,\n attempts: 0,\n callback: function(result) {\n return resolve(result);\n },\n timeout: 0\n };\n void _this.addToQueue(context);\n });\n };\n Destination2.prototype.addToQueue = function() {\n var _this = this;\n var list = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n list[_i] = arguments[_i];\n }\n var tryable = list.filter(function(context) {\n if (context.attempts < _this.config.flushMaxRetries) {\n context.attempts += 1;\n return true;\n }\n void _this.fulfillRequest([context], 500, MAX_RETRIES_EXCEEDED_MESSAGE);\n return false;\n });\n tryable.forEach(function(context) {\n _this.queue = _this.queue.concat(context);\n if (context.timeout === 0) {\n _this.schedule(_this.config.flushIntervalMillis);\n return;\n }\n setTimeout(function() {\n context.timeout = 0;\n _this.schedule(0);\n }, context.timeout);\n });\n this.saveEvents();\n };\n Destination2.prototype.schedule = function(timeout) {\n var _this = this;\n if (this.scheduled)\n return;\n this.scheduled = setTimeout(function() {\n void _this.flush(true).then(function() {\n if (_this.queue.length > 0) {\n _this.schedule(timeout);\n }\n });\n }, timeout);\n };\n Destination2.prototype.flush = function(useRetry) {\n if (useRetry === void 0) {\n useRetry = false;\n }\n return __awaiter(this, void 0, void 0, function() {\n var list, later, batches;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n list = [];\n later = [];\n this.queue.forEach(function(context) {\n return context.timeout === 0 ? list.push(context) : later.push(context);\n });\n this.queue = later;\n if (this.scheduled) {\n clearTimeout(this.scheduled);\n this.scheduled = null;\n }\n batches = chunk(list, this.config.flushQueueSize);\n return [4, Promise.all(batches.map(function(batch) {\n return _this.send(batch, useRetry);\n }))];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.send = function(list, useRetry) {\n if (useRetry === void 0) {\n useRetry = true;\n }\n return __awaiter(this, void 0, void 0, function() {\n var payload, serverUrl, res, e_1, errorMessage;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (!this.config.apiKey) {\n return [2, this.fulfillRequest(list, 400, MISSING_API_KEY_MESSAGE)];\n }\n payload = {\n api_key: this.config.apiKey,\n events: list.map(function(context) {\n var _a2 = context.event, extra = _a2.extra, eventWithoutExtra = __rest(_a2, ["extra"]);\n return eventWithoutExtra;\n }),\n options: {\n min_id_length: this.config.minIdLength\n }\n };\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n serverUrl = createServerConfig(this.config.serverUrl, this.config.serverZone, this.config.useBatch).serverUrl;\n return [4, this.config.transportProvider.send(serverUrl, payload)];\n case 2:\n res = _a.sent();\n if (res === null) {\n this.fulfillRequest(list, 0, UNEXPECTED_ERROR_MESSAGE);\n return [\n 2\n /*return*/\n ];\n }\n if (!useRetry) {\n if ("body" in res) {\n this.fulfillRequest(list, res.statusCode, "".concat(res.status, ": ").concat(getResponseBodyString(res)));\n } else {\n this.fulfillRequest(list, res.statusCode, res.status);\n }\n return [\n 2\n /*return*/\n ];\n }\n this.handleResponse(res, list);\n return [3, 4];\n case 3:\n e_1 = _a.sent();\n this.config.loggerProvider.error(e_1);\n errorMessage = getErrorMessage(e_1);\n this.fulfillRequest(list, 0, errorMessage);\n return [3, 4];\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.handleResponse = function(res, list) {\n var status = res.status;\n switch (status) {\n case Status.Success: {\n this.handleSuccessResponse(res, list);\n break;\n }\n case Status.Invalid: {\n this.handleInvalidResponse(res, list);\n break;\n }\n case Status.PayloadTooLarge: {\n this.handlePayloadTooLargeResponse(res, list);\n break;\n }\n case Status.RateLimit: {\n this.handleRateLimitResponse(res, list);\n break;\n }\n default: {\n this.config.loggerProvider.warn(`{code: 0, error: "Status \'`.concat(status, "\' provided for ").concat(list.length, \' events"}\'));\n this.handleOtherResponse(list);\n break;\n }\n }\n };\n Destination2.prototype.handleSuccessResponse = function(res, list) {\n this.fulfillRequest(list, res.statusCode, SUCCESS_MESSAGE);\n };\n Destination2.prototype.handleInvalidResponse = function(res, list) {\n var _this = this;\n if (res.body.missingField || res.body.error.startsWith(INVALID_API_KEY)) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n var dropIndex = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.values(res.body.eventsWithInvalidFields)), false), __read(Object.values(res.body.eventsWithMissingFields)), false), __read(Object.values(res.body.eventsWithInvalidIdLengths)), false), __read(res.body.silencedEvents), false).flat();\n var dropIndexSet = new Set(dropIndex);\n var retry = list.filter(function(context, index) {\n if (dropIndexSet.has(index)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handlePayloadTooLargeResponse = function(res, list) {\n if (list.length === 1) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n this.config.loggerProvider.warn(getResponseBodyString(res));\n this.config.flushQueueSize /= 2;\n this.addToQueue.apply(this, __spreadArray([], __read(list), false));\n };\n Destination2.prototype.handleRateLimitResponse = function(res, list) {\n var _this = this;\n var dropUserIds = Object.keys(res.body.exceededDailyQuotaUsers);\n var dropDeviceIds = Object.keys(res.body.exceededDailyQuotaDevices);\n var throttledIndex = res.body.throttledEvents;\n var dropUserIdsSet = new Set(dropUserIds);\n var dropDeviceIdsSet = new Set(dropDeviceIds);\n var throttledIndexSet = new Set(throttledIndex);\n var retry = list.filter(function(context, index) {\n if (context.event.user_id && dropUserIdsSet.has(context.event.user_id) || context.event.device_id && dropDeviceIdsSet.has(context.event.device_id)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n if (throttledIndexSet.has(index)) {\n context.timeout = _this.throttleTimeout;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handleOtherResponse = function(list) {\n var _this = this;\n this.addToQueue.apply(this, __spreadArray([], __read(list.map(function(context) {\n context.timeout = context.attempts * _this.retryTimeout;\n return context;\n })), false));\n };\n Destination2.prototype.fulfillRequest = function(list, code, message) {\n this.saveEvents();\n list.forEach(function(context) {\n return context.callback(buildResult(context.event, code, message));\n });\n };\n Destination2.prototype.saveEvents = function() {\n if (!this.config.storageProvider) {\n return;\n }\n var events = Array.from(this.queue.map(function(context) {\n return context.event;\n }));\n void this.config.storageProvider.set(this.storageKey, events);\n };\n return Destination2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js\n var getStacktrace = function(ignoreDepth) {\n if (ignoreDepth === void 0) {\n ignoreDepth = 0;\n }\n var trace = new Error().stack || "";\n return trace.split("\\n").slice(2 + ignoreDepth).map(function(text) {\n return text.trim();\n });\n };\n var getClientLogConfig = function(client) {\n return function() {\n var _a = __assign({}, client.config), logger = _a.loggerProvider, logLevel = _a.logLevel;\n return {\n logger,\n logLevel\n };\n };\n };\n var getValueByStringPath = function(obj, path) {\n var e_1, _a;\n path = path.replace(/\\[(\\w+)\\]/g, ".$1");\n path = path.replace(/^\\./, "");\n try {\n for (var _b = __values(path.split(".")), _c = _b.next(); !_c.done; _c = _b.next()) {\n var attr = _c.value;\n if (attr in obj) {\n obj = obj[attr];\n } else {\n return;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n return obj;\n };\n var getClientStates = function(client, paths) {\n return function() {\n var e_2, _a;\n var res = {};\n try {\n for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {\n var path = paths_1_1.value;\n res[path] = getValueByStringPath(client, path);\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n return res;\n };\n };\n var debugWrapper = function(fn, fnName, getLogConfig, getStates, fnContext) {\n if (fnContext === void 0) {\n fnContext = null;\n }\n return function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = getLogConfig(), logger = _a.logger, logLevel = _a.logLevel;\n if (logLevel && logLevel < LogLevel.Debug || !logLevel || !logger) {\n return fn.apply(fnContext, args);\n }\n var debugContext = {\n type: "invoke public method",\n name: fnName,\n args,\n stacktrace: getStacktrace(1),\n time: {\n start: (/* @__PURE__ */ new Date()).toISOString()\n },\n states: {}\n };\n if (getStates && debugContext.states) {\n debugContext.states.before = getStates();\n }\n var result = fn.apply(fnContext, args);\n if (result && result.promise) {\n result.promise.then(function() {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n });\n } else {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n }\n return result;\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js\n var UUID = function(a) {\n return a ? (\n // a random number from 0 to 15\n (a ^ // unless b is 8,\n Math.random() * // in which case\n 16 >> // a random number from\n a / 4).toString(16)\n ) : (\n // or otherwise a concatenated string:\n (String(1e7) + // 10000000 +\n String(-1e3) + // -1000 +\n String(-4e3) + // -4000 +\n String(-8e3) + // -80000000 +\n String(-1e11)).replace(\n // replacing\n /[018]/g,\n // zeroes, ones, and eights with\n UUID\n )\n );\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/storage/memory.js\n var MemoryStorage = (\n /** @class */\n (function() {\n function MemoryStorage2() {\n this.memoryStorage = /* @__PURE__ */ new Map();\n }\n MemoryStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, true];\n });\n });\n };\n MemoryStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, this.memoryStorage.get(key)];\n });\n });\n };\n MemoryStorage2.prototype.getRaw = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.get(key)];\n case 1:\n value = _a.sent();\n return [2, value ? JSON.stringify(value) : void 0];\n }\n });\n });\n };\n MemoryStorage2.prototype.set = function(key, value) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.set(key, value);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.delete(key);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.clear();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return MemoryStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/transports/base.js\n var BaseTransport = (\n /** @class */\n (function() {\n function BaseTransport2() {\n }\n BaseTransport2.prototype.send = function(_serverUrl, _payload) {\n return Promise.resolve(null);\n };\n BaseTransport2.prototype.buildResponse = function(responseJSON) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;\n if (typeof responseJSON !== "object") {\n return null;\n }\n var statusCode = responseJSON.code || 0;\n var status = this.buildStatus(statusCode);\n switch (status) {\n case Status.Success:\n return {\n status,\n statusCode,\n body: {\n eventsIngested: (_a = responseJSON.events_ingested) !== null && _a !== void 0 ? _a : 0,\n payloadSizeBytes: (_b = responseJSON.payload_size_bytes) !== null && _b !== void 0 ? _b : 0,\n serverUploadTime: (_c = responseJSON.server_upload_time) !== null && _c !== void 0 ? _c : 0\n }\n };\n case Status.Invalid:\n return {\n status,\n statusCode,\n body: {\n error: (_d = responseJSON.error) !== null && _d !== void 0 ? _d : "",\n missingField: (_e = responseJSON.missing_field) !== null && _e !== void 0 ? _e : "",\n eventsWithInvalidFields: (_f = responseJSON.events_with_invalid_fields) !== null && _f !== void 0 ? _f : {},\n eventsWithMissingFields: (_g = responseJSON.events_with_missing_fields) !== null && _g !== void 0 ? _g : {},\n eventsWithInvalidIdLengths: (_h = responseJSON.events_with_invalid_id_lengths) !== null && _h !== void 0 ? _h : {},\n epsThreshold: (_j = responseJSON.eps_threshold) !== null && _j !== void 0 ? _j : 0,\n exceededDailyQuotaDevices: (_k = responseJSON.exceeded_daily_quota_devices) !== null && _k !== void 0 ? _k : {},\n silencedDevices: (_l = responseJSON.silenced_devices) !== null && _l !== void 0 ? _l : [],\n silencedEvents: (_m = responseJSON.silenced_events) !== null && _m !== void 0 ? _m : [],\n throttledDevices: (_o = responseJSON.throttled_devices) !== null && _o !== void 0 ? _o : {},\n throttledEvents: (_p = responseJSON.throttled_events) !== null && _p !== void 0 ? _p : []\n }\n };\n case Status.PayloadTooLarge:\n return {\n status,\n statusCode,\n body: {\n error: (_q = responseJSON.error) !== null && _q !== void 0 ? _q : ""\n }\n };\n case Status.RateLimit:\n return {\n status,\n statusCode,\n body: {\n error: (_r = responseJSON.error) !== null && _r !== void 0 ? _r : "",\n epsThreshold: (_s = responseJSON.eps_threshold) !== null && _s !== void 0 ? _s : 0,\n throttledDevices: (_t = responseJSON.throttled_devices) !== null && _t !== void 0 ? _t : {},\n throttledUsers: (_u = responseJSON.throttled_users) !== null && _u !== void 0 ? _u : {},\n exceededDailyQuotaDevices: (_v = responseJSON.exceeded_daily_quota_devices) !== null && _v !== void 0 ? _v : {},\n exceededDailyQuotaUsers: (_w = responseJSON.exceeded_daily_quota_users) !== null && _w !== void 0 ? _w : {},\n throttledEvents: (_x = responseJSON.throttled_events) !== null && _x !== void 0 ? _x : []\n }\n };\n case Status.Timeout:\n default:\n return {\n status,\n statusCode\n };\n }\n };\n BaseTransport2.prototype.buildStatus = function(code) {\n if (code >= 200 && code < 300) {\n return Status.Success;\n }\n if (code === 429) {\n return Status.RateLimit;\n }\n if (code === 413) {\n return Status.PayloadTooLarge;\n }\n if (code === 408) {\n return Status.Timeout;\n }\n if (code >= 400 && code < 500) {\n return Status.Invalid;\n }\n if (code >= 500) {\n return Status.Failed;\n }\n return Status.Unknown;\n };\n return BaseTransport2;\n })()\n );\n\n // node_modules/@amplitude/analytics-connector/dist/analytics-connector.esm.js\n var ApplicationContextProviderImpl = (\n /** @class */\n (function() {\n function ApplicationContextProviderImpl2() {\n }\n ApplicationContextProviderImpl2.prototype.getApplicationContext = function() {\n return {\n versionName: this.versionName,\n language: getLanguage(),\n platform: "Web",\n os: void 0,\n deviceModel: void 0\n };\n };\n return ApplicationContextProviderImpl2;\n })()\n );\n var getLanguage = function() {\n return typeof navigator !== "undefined" && (navigator.languages && navigator.languages[0] || navigator.language) || "";\n };\n var EventBridgeImpl = (\n /** @class */\n (function() {\n function EventBridgeImpl2() {\n this.queue = [];\n }\n EventBridgeImpl2.prototype.logEvent = function(event) {\n if (!this.receiver) {\n if (this.queue.length < 512) {\n this.queue.push(event);\n }\n } else {\n this.receiver(event);\n }\n };\n EventBridgeImpl2.prototype.setEventReceiver = function(receiver) {\n this.receiver = receiver;\n if (this.queue.length > 0) {\n this.queue.forEach(function(event) {\n receiver(event);\n });\n this.queue = [];\n }\n };\n return EventBridgeImpl2;\n })()\n );\n var __assign2 = function() {\n __assign2 = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign2.apply(this, arguments);\n };\n function __values2(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read2(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = {\n error\n };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n var isEqual = function(obj1, obj2) {\n var e_1, _a;\n var primitive = ["string", "number", "boolean", "undefined"];\n var typeA = typeof obj1;\n var typeB = typeof obj2;\n if (typeA !== typeB) {\n return false;\n }\n try {\n for (var primitive_1 = __values2(primitive), primitive_1_1 = primitive_1.next(); !primitive_1_1.done; primitive_1_1 = primitive_1.next()) {\n var p = primitive_1_1.value;\n if (p === typeA) {\n return obj1 === obj2;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (primitive_1_1 && !primitive_1_1.done && (_a = primitive_1.return)) _a.call(primitive_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n if (obj1 == null && obj2 == null) {\n return true;\n } else if (obj1 == null || obj2 == null) {\n return false;\n }\n if (obj1.length !== obj2.length) {\n return false;\n }\n var isArrayA = Array.isArray(obj1);\n var isArrayB = Array.isArray(obj2);\n if (isArrayA !== isArrayB) {\n return false;\n }\n if (isArrayA && isArrayB) {\n for (var i = 0; i < obj1.length; i++) {\n if (!isEqual(obj1[i], obj2[i])) {\n return false;\n }\n }\n } else {\n var sorted1 = Object.keys(obj1).sort();\n var sorted2 = Object.keys(obj2).sort();\n if (!isEqual(sorted1, sorted2)) {\n return false;\n }\n var result_1 = true;\n Object.keys(obj1).forEach(function(key) {\n if (!isEqual(obj1[key], obj2[key])) {\n result_1 = false;\n }\n });\n return result_1;\n }\n return true;\n };\n var ID_OP_SET = "$set";\n var ID_OP_UNSET = "$unset";\n var ID_OP_CLEAR_ALL = "$clearAll";\n if (!Object.entries) {\n Object.entries = function(obj) {\n var ownProps = Object.keys(obj);\n var i = ownProps.length;\n var resArray = new Array(i);\n while (i--) {\n resArray[i] = [ownProps[i], obj[ownProps[i]]];\n }\n return resArray;\n };\n }\n var IdentityStoreImpl = (\n /** @class */\n (function() {\n function IdentityStoreImpl2() {\n this.identity = { userProperties: {} };\n this.listeners = /* @__PURE__ */ new Set();\n }\n IdentityStoreImpl2.prototype.editIdentity = function() {\n var self2 = this;\n var actingUserProperties = __assign2({}, this.identity.userProperties);\n var actingIdentity = __assign2(__assign2({}, this.identity), { userProperties: actingUserProperties });\n return {\n setUserId: function(userId) {\n actingIdentity.userId = userId;\n return this;\n },\n setDeviceId: function(deviceId) {\n actingIdentity.deviceId = deviceId;\n return this;\n },\n setUserProperties: function(userProperties) {\n actingIdentity.userProperties = userProperties;\n return this;\n },\n setOptOut: function(optOut) {\n actingIdentity.optOut = optOut;\n return this;\n },\n updateUserProperties: function(actions) {\n var e_1, _a, e_2, _b, e_3, _c;\n var actingProperties = actingIdentity.userProperties || {};\n try {\n for (var _d = __values2(Object.entries(actions)), _e = _d.next(); !_e.done; _e = _d.next()) {\n var _f = __read2(_e.value, 2), action = _f[0], properties = _f[1];\n switch (action) {\n case ID_OP_SET:\n try {\n for (var _g = (e_2 = void 0, __values2(Object.entries(properties))), _h = _g.next(); !_h.done; _h = _g.next()) {\n var _j = __read2(_h.value, 2), key = _j[0], value = _j[1];\n actingProperties[key] = value;\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (_h && !_h.done && (_b = _g.return)) _b.call(_g);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n break;\n case ID_OP_UNSET:\n try {\n for (var _k = (e_3 = void 0, __values2(Object.keys(properties))), _l = _k.next(); !_l.done; _l = _k.next()) {\n var key = _l.value;\n delete actingProperties[key];\n }\n } catch (e_3_1) {\n e_3 = { error: e_3_1 };\n } finally {\n try {\n if (_l && !_l.done && (_c = _k.return)) _c.call(_k);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n break;\n case ID_OP_CLEAR_ALL:\n actingProperties = {};\n break;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n actingIdentity.userProperties = actingProperties;\n return this;\n },\n commit: function() {\n self2.setIdentity(actingIdentity);\n return this;\n }\n };\n };\n IdentityStoreImpl2.prototype.getIdentity = function() {\n return __assign2({}, this.identity);\n };\n IdentityStoreImpl2.prototype.setIdentity = function(identity) {\n var originalIdentity = __assign2({}, this.identity);\n this.identity = __assign2({}, identity);\n if (!isEqual(originalIdentity, this.identity)) {\n this.listeners.forEach(function(listener) {\n listener(identity);\n });\n }\n };\n IdentityStoreImpl2.prototype.addIdentityListener = function(listener) {\n this.listeners.add(listener);\n };\n IdentityStoreImpl2.prototype.removeIdentityListener = function(listener) {\n this.listeners.delete(listener);\n };\n return IdentityStoreImpl2;\n })()\n );\n var safeGlobal = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self;\n var AnalyticsConnector = (\n /** @class */\n (function() {\n function AnalyticsConnector2() {\n this.identityStore = new IdentityStoreImpl();\n this.eventBridge = new EventBridgeImpl();\n this.applicationContextProvider = new ApplicationContextProviderImpl();\n }\n AnalyticsConnector2.getInstance = function(instanceName) {\n if (!safeGlobal["analyticsConnectorInstances"]) {\n safeGlobal["analyticsConnectorInstances"] = {};\n }\n if (!safeGlobal["analyticsConnectorInstances"][instanceName]) {\n safeGlobal["analyticsConnectorInstances"][instanceName] = new AnalyticsConnector2();\n }\n return safeGlobal["analyticsConnectorInstances"][instanceName];\n };\n return AnalyticsConnector2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/analytics-connector.js\n var getAnalyticsConnector = function(instanceName) {\n if (instanceName === void 0) {\n instanceName = "$default_instance";\n }\n return AnalyticsConnector.getInstance(instanceName);\n };\n var setConnectorUserId = function(userId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setUserId(userId).commit();\n };\n var setConnectorDeviceId = function(deviceId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setDeviceId(deviceId).commit();\n };\n var setConnectorOptOut = function(optOut, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setOptOut(optOut).commit();\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/global-scope.js\n var getGlobalScope = function() {\n if (typeof globalThis !== "undefined") {\n return globalThis;\n }\n if (typeof window !== "undefined") {\n return window;\n }\n if (typeof self !== "undefined") {\n return self;\n }\n if (typeof global !== "undefined") {\n return global;\n }\n return void 0;\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/query-params.js\n var getQueryParams = function() {\n var _a;\n var globalScope = getGlobalScope();\n if (!((_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.location) === null || _a === void 0 ? void 0 : _a.search)) {\n return {};\n }\n var pairs = globalScope.location.search.substring(1).split("&").filter(Boolean);\n var params = pairs.reduce(function(acc, curr) {\n var query = curr.split("=", 2);\n var key = tryDecodeURIComponent(query[0]);\n var value = tryDecodeURIComponent(query[1]);\n if (!value) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n return params;\n };\n var tryDecodeURIComponent = function(value) {\n if (value === void 0) {\n value = "";\n }\n try {\n return decodeURIComponent(value);\n } catch (_a) {\n return "";\n }\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/constants.js\n var UTM_CAMPAIGN = "utm_campaign";\n var UTM_CONTENT = "utm_content";\n var UTM_ID = "utm_id";\n var UTM_MEDIUM = "utm_medium";\n var UTM_SOURCE = "utm_source";\n var UTM_TERM = "utm_term";\n var DCLID = "dclid";\n var FBCLID = "fbclid";\n var GBRAID = "gbraid";\n var GCLID = "gclid";\n var KO_CLICK_ID = "ko_click_id";\n var LI_FAT_ID = "li_fat_id";\n var MSCLKID = "msclkid";\n var RDT_CID = "rtd_cid";\n var TTCLID = "ttclid";\n var TWCLID = "twclid";\n var WBRAID = "wbraid";\n var BASE_CAMPAIGN = {\n utm_campaign: void 0,\n utm_content: void 0,\n utm_id: void 0,\n utm_medium: void 0,\n utm_source: void 0,\n utm_term: void 0,\n referrer: void 0,\n referring_domain: void 0,\n dclid: void 0,\n gbraid: void 0,\n gclid: void 0,\n fbclid: void 0,\n ko_click_id: void 0,\n li_fat_id: void 0,\n msclkid: void 0,\n rtd_cid: void 0,\n ttclid: void 0,\n twclid: void 0,\n wbraid: void 0\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/campaign-parser.js\n var CampaignParser = (\n /** @class */\n (function() {\n function CampaignParser2() {\n }\n CampaignParser2.prototype.parse = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, __assign(__assign(__assign(__assign({}, BASE_CAMPAIGN), this.getUtmParam()), this.getReferrer()), this.getClickIds())];\n });\n });\n };\n CampaignParser2.prototype.getUtmParam = function() {\n var params = getQueryParams();\n var utmCampaign = params[UTM_CAMPAIGN];\n var utmContent = params[UTM_CONTENT];\n var utmId = params[UTM_ID];\n var utmMedium = params[UTM_MEDIUM];\n var utmSource = params[UTM_SOURCE];\n var utmTerm = params[UTM_TERM];\n return {\n utm_campaign: utmCampaign,\n utm_content: utmContent,\n utm_id: utmId,\n utm_medium: utmMedium,\n utm_source: utmSource,\n utm_term: utmTerm\n };\n };\n CampaignParser2.prototype.getReferrer = function() {\n var _a, _b;\n var data = {\n referrer: void 0,\n referring_domain: void 0\n };\n try {\n data.referrer = document.referrer || void 0;\n data.referring_domain = (_b = (_a = data.referrer) === null || _a === void 0 ? void 0 : _a.split("/")[2]) !== null && _b !== void 0 ? _b : void 0;\n } catch (_c) {\n }\n return data;\n };\n CampaignParser2.prototype.getClickIds = function() {\n var _a;\n var params = getQueryParams();\n return _a = {}, _a[DCLID] = params[DCLID], _a[FBCLID] = params[FBCLID], _a[GBRAID] = params[GBRAID], _a[GCLID] = params[GCLID], _a[KO_CLICK_ID] = params[KO_CLICK_ID], _a[LI_FAT_ID] = params[LI_FAT_ID], _a[MSCLKID] = params[MSCLKID], _a[RDT_CID] = params[RDT_CID], _a[TTCLID] = params[TTCLID], _a[TWCLID] = params[TWCLID], _a[WBRAID] = params[WBRAID], _a;\n };\n return CampaignParser2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/cookie-name.js\n var getCookieName = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var getOldCookieName = function(apiKey) {\n return "".concat(AMPLITUDE_PREFIX.toLowerCase(), "_").concat(apiKey.substring(0, 6));\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/default-tracking.js\n var isFileDownloadTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.fileDownloads) {\n return true;\n }\n return false;\n };\n var isFormInteractionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.formInteractions) {\n return true;\n }\n return false;\n };\n var isPageViewTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if ((defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) === true || (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) && typeof defaultTracking.pageViews === "object") {\n return true;\n }\n return false;\n };\n var isSessionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.sessions) {\n return true;\n }\n return false;\n };\n var getPageViewTrackingConfig = function(config) {\n var _a;\n var trackOn = ((_a = config.attribution) === null || _a === void 0 ? void 0 : _a.trackPageViews) ? "attribution" : function() {\n return false;\n };\n var trackHistoryChanges = void 0;\n var eventType = "Page View";\n var isDefaultPageViewTrackingEnabled = isPageViewTrackingEnabled(config.defaultTracking);\n if (isDefaultPageViewTrackingEnabled) {\n trackOn = void 0;\n eventType = void 0;\n if (config.defaultTracking && typeof config.defaultTracking === "object" && config.defaultTracking.pageViews && typeof config.defaultTracking.pageViews === "object") {\n if ("trackOn" in config.defaultTracking.pageViews) {\n trackOn = config.defaultTracking.pageViews.trackOn;\n }\n if ("trackHistoryChanges" in config.defaultTracking.pageViews) {\n trackHistoryChanges = config.defaultTracking.pageViews.trackHistoryChanges;\n }\n if ("eventType" in config.defaultTracking.pageViews && config.defaultTracking.pageViews.eventType) {\n eventType = config.defaultTracking.pageViews.eventType;\n }\n }\n }\n return {\n trackOn,\n trackHistoryChanges,\n eventType\n };\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/language.js\n var getLanguage2 = function() {\n var _a, _b, _c, _d;\n if (typeof navigator === "undefined")\n return "";\n var userLanguage = navigator.userLanguage;\n return (_d = (_c = (_b = (_a = navigator.languages) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : navigator.language) !== null && _c !== void 0 ? _c : userLanguage) !== null && _d !== void 0 ? _d : "";\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/plugins/identity.js\n var IdentityEventSender = (\n /** @class */\n (function() {\n function IdentityEventSender2() {\n this.name = "identity";\n this.type = PluginType.BEFORE;\n this.identityStore = getAnalyticsConnector().identityStore;\n }\n IdentityEventSender2.prototype.execute = function(context) {\n return __awaiter(this, void 0, void 0, function() {\n var userProperties;\n return __generator(this, function(_a) {\n userProperties = context.user_properties;\n if (userProperties) {\n this.identityStore.editIdentity().updateUserProperties(userProperties).commit();\n }\n return [2, context];\n });\n });\n };\n IdentityEventSender2.prototype.setup = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (config.instanceName) {\n this.identityStore = getAnalyticsConnector(config.instanceName).identityStore;\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return IdentityEventSender2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/storage/cookie.js\n var CookieStorage = (\n /** @class */\n (function() {\n function CookieStorage2(options) {\n this.options = __assign({}, options);\n }\n CookieStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var testStrorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n CookieStorage2.testValue = String(Date.now());\n testStrorage = new CookieStorage2(this.options);\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStrorage.set(testKey, CookieStorage2.testValue)];\n case 2:\n _b.sent();\n return [4, testStrorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === CookieStorage2.testValue];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStrorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.getRaw(key)];\n case 1:\n value = _a.sent();\n if (!value) {\n return [2, void 0];\n }\n try {\n try {\n value = decodeURIComponent(atob(value));\n } catch (_b) {\n }\n return [2, JSON.parse(value)];\n } catch (_c) {\n return [2, void 0];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var globalScope, cookie, match;\n return __generator(this, function(_b) {\n globalScope = getGlobalScope();\n cookie = (_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.document.cookie.split("; ")) !== null && _a !== void 0 ? _a : [];\n match = cookie.find(function(c) {\n return c.indexOf(key + "=") === 0;\n });\n if (!match) {\n return [2, void 0];\n }\n return [2, match.substring(key.length + 1)];\n });\n });\n };\n CookieStorage2.prototype.set = function(key, value) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var expirationDays, expires, expireDate, date, str, globalScope;\n return __generator(this, function(_b) {\n try {\n expirationDays = (_a = this.options.expirationDays) !== null && _a !== void 0 ? _a : 0;\n expires = value !== null ? expirationDays : -1;\n expireDate = void 0;\n if (expires) {\n date = /* @__PURE__ */ new Date();\n date.setTime(date.getTime() + expires * 24 * 60 * 60 * 1e3);\n expireDate = date;\n }\n str = "".concat(key, "=").concat(btoa(encodeURIComponent(JSON.stringify(value))));\n if (expireDate) {\n str += "; expires=".concat(expireDate.toUTCString());\n }\n str += "; path=/";\n if (this.options.domain) {\n str += "; domain=".concat(this.options.domain);\n }\n if (this.options.secure) {\n str += "; Secure";\n }\n if (this.options.sameSite) {\n str += "; SameSite=".concat(this.options.sameSite);\n }\n globalScope = getGlobalScope();\n if (globalScope) {\n globalScope.document.cookie = str;\n }\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n CookieStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.set(key, null)];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return CookieStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/transports/fetch.js\n var FetchTransport = (\n /** @class */\n (function(_super) {\n __extends(FetchTransport2, _super);\n function FetchTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FetchTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var options, response, responseText;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (typeof fetch === "undefined") {\n throw new Error("FetchTransport is not supported");\n }\n options = {\n headers: {\n "Content-Type": "application/json",\n Accept: "*/*"\n },\n body: JSON.stringify(payload),\n method: "POST"\n };\n return [4, fetch(serverUrl, options)];\n case 1:\n response = _a.sent();\n return [4, response.text()];\n case 2:\n responseText = _a.sent();\n try {\n return [2, this.buildResponse(JSON.parse(responseText))];\n } catch (_b) {\n return [2, this.buildResponse({ code: response.status })];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return FetchTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/utils.js\n var omitUndefined = function(input) {\n var obj = {};\n for (var key in input) {\n var val = input[key];\n if (val) {\n obj[key] = val;\n }\n }\n return obj;\n };\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/page-view-tracking.js\n var pageViewTrackingPlugin = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var globalScope = getGlobalScope();\n var loggerProvider = void 0;\n var pushState;\n var _a = __read(args, 2), clientOrOptions = _a[0], configOrUndefined = _a[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var createPageViewEvent = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a2;\n var _b;\n var _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n _b = {\n event_type: (_c = options.eventType) !== null && _c !== void 0 ? _c : "Page View"\n };\n _a2 = [{}];\n return [4, getCampaignParams()];\n case 1:\n return [2, (_b.event_properties = __assign.apply(void 0, [__assign.apply(void 0, _a2.concat([_d.sent()])), { page_domain: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.hostname || ""\n ), page_location: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href || ""\n ), page_path: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.pathname || ""\n ), page_title: (\n /* istanbul ignore next */\n typeof document !== "undefined" && document.title || ""\n ), page_url: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href.split("?")[0] || ""\n ) }]), _b)];\n }\n });\n });\n };\n var shouldTrackOnPageLoad = function() {\n return typeof options.trackOn === "undefined" || typeof options.trackOn === "function" && options.trackOn();\n };\n var previousURL = typeof location !== "undefined" ? location.href : null;\n var trackHistoryPageView = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var newURL, shouldTrackPageView, _a2, _b, _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n newURL = location.href;\n shouldTrackPageView = shouldTrackHistoryPageView(options.trackHistoryChanges, newURL, previousURL || "") && shouldTrackOnPageLoad();\n previousURL = newURL;\n if (!shouldTrackPageView) return [3, 4];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Tracking page view event");\n if (!(amplitude === null || amplitude === void 0)) return [3, 1];\n _a2 = void 0;\n return [3, 3];\n case 1:\n _c = (_b = amplitude).track;\n return [4, createPageViewEvent()];\n case 2:\n _a2 = _c.apply(_b, [_d.sent()]);\n _d.label = 3;\n case 3:\n _a2;\n _d.label = 4;\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n var trackHistoryPageViewWrapper = function() {\n void trackHistoryPageView();\n };\n var plugin = {\n name: "page-view-tracking",\n type: PluginType.ENRICHMENT,\n setup: function(config, client) {\n return __awaiter(void 0, void 0, void 0, function() {\n var receivedType, _a2, _b;\n var _c, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n loggerProvider = config.loggerProvider;\n loggerProvider.log("Installing @amplitude/plugin-page-view-tracking-browser");\n options.trackOn = ((_c = config.attribution) === null || _c === void 0 ? void 0 : _c.trackPageViews) ? "attribution" : options.trackOn;\n if (!client && ((_d = config.attribution) === null || _d === void 0 ? void 0 : _d.trackPageViews)) {\n loggerProvider.warn("@amplitude/plugin-page-view-tracking-browser overrides page view tracking behavior defined in @amplitude/analytics-browser. Resolve by disabling page view tracking in @amplitude/analytics-browser.");\n config.attribution.trackPageViews = false;\n }\n if (options.trackHistoryChanges && globalScope) {\n globalScope.addEventListener("popstate", trackHistoryPageViewWrapper);\n pushState = globalScope.history.pushState;\n globalScope.history.pushState = new Proxy(globalScope.history.pushState, {\n apply: function(target, thisArg, _a3) {\n var _b2 = __read(_a3, 3), state = _b2[0], unused = _b2[1], url = _b2[2];\n target.apply(thisArg, [state, unused, url]);\n void trackHistoryPageView();\n }\n });\n }\n if (!shouldTrackOnPageLoad()) return [3, 2];\n loggerProvider.log("Tracking page view event");\n _b = (_a2 = amplitude).track;\n return [4, createPageViewEvent()];\n case 1:\n _b.apply(_a2, [_e.sent()]);\n _e.label = 2;\n case 2:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n var pageViewEvent;\n return __generator(this, function(_a2) {\n switch (_a2.label) {\n case 0:\n if (!(options.trackOn === "attribution" && isCampaignEvent(event))) return [3, 2];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Enriching campaign event to page view event with campaign parameters");\n return [4, createPageViewEvent()];\n case 1:\n pageViewEvent = _a2.sent();\n event.event_type = pageViewEvent.event_type;\n event.event_properties = __assign(__assign({}, event.event_properties), pageViewEvent.event_properties);\n _a2.label = 2;\n case 2:\n return [2, event];\n }\n });\n });\n },\n teardown: function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n if (globalScope) {\n globalScope.removeEventListener("popstate", trackHistoryPageViewWrapper);\n if (pushState) {\n globalScope.history.pushState = pushState;\n }\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n }\n };\n plugin.__trackHistoryPageView = trackHistoryPageView;\n return plugin;\n };\n var getCampaignParams = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _a = omitUndefined;\n return [4, new CampaignParser().parse()];\n case 1:\n return [2, _a.apply(void 0, [_b.sent()])];\n }\n });\n });\n };\n var isCampaignEvent = function(event) {\n if (event.event_type === "$identify" && event.user_properties) {\n var properties = event.user_properties;\n var $set = properties[IdentifyOperation.SET] || {};\n var $unset = properties[IdentifyOperation.UNSET] || {};\n var userProperties_1 = __spreadArray(__spreadArray([], __read(Object.keys($set)), false), __read(Object.keys($unset)), false);\n return Object.keys(BASE_CAMPAIGN).every(function(value) {\n return userProperties_1.includes(value);\n });\n }\n return false;\n };\n var shouldTrackHistoryPageView = function(trackingOption, newURL, oldURL) {\n switch (trackingOption) {\n case "pathOnly":\n return newURL.split("?")[0] !== oldURL.split("?")[0];\n default:\n return newURL !== oldURL;\n }\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/helpers.js\n var getStorageKey = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var domainWithoutSubdomain = function(domain) {\n var parts = domain.split(".");\n if (parts.length <= 2) {\n return domain;\n }\n return parts.slice(parts.length - 2, parts.length).join(".");\n };\n var isNewCampaign = function(current, previous, options) {\n var _a;\n var referrer = current.referrer, referring_domain = current.referring_domain, currentCampaign = __rest(current, ["referrer", "referring_domain"]);\n var _b = previous || {}, _previous_referrer = _b.referrer, prevReferringDomain = _b.referring_domain, previousCampaign = __rest(_b, ["referrer", "referring_domain"]);\n if (current.referring_domain && ((_a = options.excludeReferrers) === null || _a === void 0 ? void 0 : _a.includes(current.referring_domain))) {\n return false;\n }\n var hasNewCampaign = JSON.stringify(currentCampaign) !== JSON.stringify(previousCampaign);\n var hasNewDomain = domainWithoutSubdomain(referring_domain || "") !== domainWithoutSubdomain(prevReferringDomain || "");\n return !previous || hasNewCampaign || hasNewDomain;\n };\n var createCampaignEvent = function(campaign, options) {\n var campaignParameters = __assign(__assign({}, BASE_CAMPAIGN), campaign);\n var identifyEvent = Object.entries(campaignParameters).reduce(function(identify2, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n identify2.setOnce("initial_".concat(key), (_b = value !== null && value !== void 0 ? value : options.initialEmptyValue) !== null && _b !== void 0 ? _b : "EMPTY");\n if (value) {\n return identify2.set(key, value);\n }\n return identify2.unset(key);\n }, new Identify());\n return createIdentifyEvent(identifyEvent);\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/web-attribution.js\n var webAttributionPlugin = function() {\n var _this = this;\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var _b = __read(args, 2), clientOrOptions = _b[0], configOrUndefined = _b[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var excludeReferrers = (_a = options.excludeReferrers) !== null && _a !== void 0 ? _a : [];\n if (typeof location !== "undefined") {\n excludeReferrers.unshift(location.hostname);\n }\n options = __assign(__assign({ disabled: false, initialEmptyValue: "EMPTY", resetSessionOnNewCampaign: false }, options), { excludeReferrers });\n var plugin = {\n name: "web-attribution",\n type: PluginType.BEFORE,\n setup: function(config, client) {\n var _a2;\n return __awaiter(this, void 0, void 0, function() {\n var receivedType, storage, storageKey, _b2, currentCampaign, previousCampaign, pluginEnabledOverride, campaignEvent;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n if (options.disabled) {\n config.loggerProvider.log("@amplitude/plugin-web-attribution-browser is disabled. Attribution is not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n config.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser.");\n if (!client && !((_a2 = config.attribution) === null || _a2 === void 0 ? void 0 : _a2.disabled)) {\n config.loggerProvider.warn("@amplitude/plugin-web-attribution-browser overrides web attribution behavior defined in @amplitude/analytics-browser. Resolve by disabling web attribution tracking in @amplitude/analytics-browser.");\n config.attribution = {\n disabled: true\n };\n }\n storage = config.cookieStorage;\n storageKey = getStorageKey(config.apiKey, "MKTG");\n return [4, Promise.all([\n new CampaignParser().parse(),\n storage.get(storageKey)\n ])];\n case 1:\n _b2 = __read.apply(void 0, [_c.sent(), 2]), currentCampaign = _b2[0], previousCampaign = _b2[1];\n pluginEnabledOverride = this.__pluginEnabledOverride;\n if (pluginEnabledOverride !== null && pluginEnabledOverride !== void 0 ? pluginEnabledOverride : isNewCampaign(currentCampaign, previousCampaign, options)) {\n if (options.resetSessionOnNewCampaign) {\n amplitude.setSessionId(Date.now());\n config.loggerProvider.log("Created a new session for new campaign.");\n }\n config.loggerProvider.log("Tracking attribution.");\n campaignEvent = createCampaignEvent(currentCampaign, options);\n amplitude.track(campaignEvent);\n void storage.set(storageKey, currentCampaign);\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(_this, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n return [2, event];\n });\n });\n }\n };\n plugin.__pluginEnabledOverride = void 0;\n return plugin;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/storage/local-storage.js\n var MAX_ARRAY_LENGTH = 1e3;\n var LocalStorage = (\n /** @class */\n (function() {\n function LocalStorage2(config) {\n this.loggerProvider = config === null || config === void 0 ? void 0 : config.loggerProvider;\n }\n LocalStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var random, testStorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n random = String(Date.now());\n testStorage = new LocalStorage2();\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStorage.set(testKey, random)];\n case 2:\n _b.sent();\n return [4, testStorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === random];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [4, this.getRaw(key)];\n case 1:\n value = _b.sent();\n if (!value) {\n return [2, void 0];\n }\n return [2, JSON.parse(value)];\n case 2:\n _a = _b.sent();\n return [2, void 0];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n return [2, ((_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.getItem(key)) || void 0];\n });\n });\n };\n LocalStorage2.prototype.set = function(key, value) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var isExceededArraySize, serializedValue, droppedEventsCount;\n return __generator(this, function(_c) {\n isExceededArraySize = Array.isArray(value) && value.length > MAX_ARRAY_LENGTH;\n try {\n serializedValue = isExceededArraySize ? JSON.stringify(value.slice(0, MAX_ARRAY_LENGTH)) : JSON.stringify(value);\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.setItem(key, serializedValue);\n } catch (_d) {\n }\n if (isExceededArraySize) {\n droppedEventsCount = value.length - MAX_ARRAY_LENGTH;\n (_b = this.loggerProvider) === null || _b === void 0 ? void 0 : _b.error("Failed to save ".concat(droppedEventsCount, " events because the queue length exceeded ").concat(MAX_ARRAY_LENGTH, "."));\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.remove = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.removeItem(key);\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.reset = function() {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.clear();\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return LocalStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/xhr.js\n var XHRTransport = (\n /** @class */\n (function(_super) {\n __extends(XHRTransport2, _super);\n function XHRTransport2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.state = {\n done: 4\n };\n return _this;\n }\n XHRTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n if (typeof XMLHttpRequest === "undefined") {\n reject(new Error("XHRTransport is not supported."));\n }\n var xhr = new XMLHttpRequest();\n xhr.open("POST", serverUrl, true);\n xhr.onreadystatechange = function() {\n if (xhr.readyState === _this.state.done) {\n try {\n var responsePayload = xhr.responseText;\n var parsedResponsePayload = JSON.parse(responsePayload);\n var result = _this.buildResponse(parsedResponsePayload);\n resolve(result);\n } catch (e) {\n reject(e);\n }\n }\n };\n xhr.setRequestHeader("Content-Type", "application/json");\n xhr.setRequestHeader("Accept", "*/*");\n xhr.send(JSON.stringify(payload));\n })];\n });\n });\n };\n return XHRTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/send-beacon.js\n var SendBeaconTransport = (\n /** @class */\n (function(_super) {\n __extends(SendBeaconTransport2, _super);\n function SendBeaconTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SendBeaconTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n var globalScope = getGlobalScope();\n if (!(globalScope === null || globalScope === void 0 ? void 0 : globalScope.navigator.sendBeacon)) {\n throw new Error("SendBeaconTransport is not supported");\n }\n try {\n var data = JSON.stringify(payload);\n var success = globalScope.navigator.sendBeacon(serverUrl, JSON.stringify(payload));\n if (success) {\n return resolve(_this.buildResponse({\n code: 200,\n events_ingested: payload.events.length,\n payload_size_bytes: data.length,\n server_upload_time: Date.now()\n }));\n }\n return resolve(_this.buildResponse({ code: 500 }));\n } catch (e) {\n reject(e);\n }\n })];\n });\n });\n };\n return SendBeaconTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/config.js\n var getDefaultConfig2 = function() {\n var cookieStorage = new MemoryStorage();\n var trackingOptions = {\n deviceManufacturer: true,\n deviceModel: true,\n ipAddress: true,\n language: true,\n osName: true,\n osVersion: true,\n platform: true\n };\n return {\n cookieExpiration: 365,\n cookieSameSite: "Lax",\n cookieSecure: false,\n cookieStorage,\n cookieUpgrade: true,\n disableCookies: false,\n domain: "",\n sessionTimeout: 30 * 60 * 1e3,\n trackingOptions,\n transportProvider: new FetchTransport()\n };\n };\n var BrowserConfig = (\n /** @class */\n (function(_super) {\n __extends(BrowserConfig2, _super);\n function BrowserConfig2(apiKey, options) {\n var _this = this;\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n var defaultConfig = getDefaultConfig2();\n _this = _super.call(this, __assign(__assign({ flushIntervalMillis: 1e3, flushMaxRetries: 5, flushQueueSize: 30, transportProvider: defaultConfig.transportProvider }, options), { apiKey })) || this;\n _this._optOut = false;\n _this.cookieStorage = (_a = options === null || options === void 0 ? void 0 : options.cookieStorage) !== null && _a !== void 0 ? _a : defaultConfig.cookieStorage;\n _this.deviceId = options === null || options === void 0 ? void 0 : options.deviceId;\n _this.lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n _this.lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n _this.optOut = Boolean(options === null || options === void 0 ? void 0 : options.optOut);\n _this.sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n _this.userId = options === null || options === void 0 ? void 0 : options.userId;\n _this.appVersion = options === null || options === void 0 ? void 0 : options.appVersion;\n _this.attribution = options === null || options === void 0 ? void 0 : options.attribution;\n _this.cookieExpiration = (_b = options === null || options === void 0 ? void 0 : options.cookieExpiration) !== null && _b !== void 0 ? _b : defaultConfig.cookieExpiration;\n _this.cookieSameSite = (_c = options === null || options === void 0 ? void 0 : options.cookieSameSite) !== null && _c !== void 0 ? _c : defaultConfig.cookieSameSite;\n _this.cookieSecure = (_d = options === null || options === void 0 ? void 0 : options.cookieSecure) !== null && _d !== void 0 ? _d : defaultConfig.cookieSecure;\n _this.cookieUpgrade = (_e = options === null || options === void 0 ? void 0 : options.cookieUpgrade) !== null && _e !== void 0 ? _e : defaultConfig.cookieUpgrade;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.disableCookies = (_f = options === null || options === void 0 ? void 0 : options.disableCookies) !== null && _f !== void 0 ? _f : defaultConfig.disableCookies;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.domain = (_g = options === null || options === void 0 ? void 0 : options.domain) !== null && _g !== void 0 ? _g : defaultConfig.domain;\n _this.partnerId = options === null || options === void 0 ? void 0 : options.partnerId;\n _this.sessionTimeout = (_h = options === null || options === void 0 ? void 0 : options.sessionTimeout) !== null && _h !== void 0 ? _h : defaultConfig.sessionTimeout;\n _this.trackingOptions = (_j = options === null || options === void 0 ? void 0 : options.trackingOptions) !== null && _j !== void 0 ? _j : defaultConfig.trackingOptions;\n return _this;\n }\n Object.defineProperty(BrowserConfig2.prototype, "deviceId", {\n get: function() {\n return this._deviceId;\n },\n set: function(deviceId) {\n if (this._deviceId !== deviceId) {\n this._deviceId = deviceId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "userId", {\n get: function() {\n return this._userId;\n },\n set: function(userId) {\n if (this._userId !== userId) {\n this._userId = userId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "sessionId", {\n get: function() {\n return this._sessionId;\n },\n set: function(sessionId) {\n if (this._sessionId !== sessionId) {\n this._sessionId = sessionId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n if (this._optOut !== optOut) {\n this._optOut = optOut;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventTime", {\n get: function() {\n return this._lastEventTime;\n },\n set: function(lastEventTime) {\n if (this._lastEventTime !== lastEventTime) {\n this._lastEventTime = lastEventTime;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventId", {\n get: function() {\n return this._lastEventId;\n },\n set: function(lastEventId) {\n if (this._lastEventId !== lastEventId) {\n this._lastEventId = lastEventId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n BrowserConfig2.prototype.updateStorage = function() {\n var _a;\n var cache = {\n deviceId: this._deviceId,\n userId: this._userId,\n sessionId: this._sessionId,\n optOut: this._optOut,\n lastEventTime: this._lastEventTime,\n lastEventId: this._lastEventId\n };\n void ((_a = this.cookieStorage) === null || _a === void 0 ? void 0 : _a.set(getCookieName(this.apiKey), cache));\n };\n return BrowserConfig2;\n })(Config)\n );\n var useBrowserConfig = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var defaultConfig, deviceId, lastEventId, lastEventTime, optOut, sessionId, userId, cookieStorage, domain, _a, _b, _c;\n var _d;\n var _e, _f;\n return __generator(this, function(_g) {\n switch (_g.label) {\n case 0:\n defaultConfig = getDefaultConfig2();\n deviceId = (_e = options === null || options === void 0 ? void 0 : options.deviceId) !== null && _e !== void 0 ? _e : UUID();\n lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n optOut = options === null || options === void 0 ? void 0 : options.optOut;\n sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n userId = options === null || options === void 0 ? void 0 : options.userId;\n cookieStorage = options === null || options === void 0 ? void 0 : options.cookieStorage;\n domain = options === null || options === void 0 ? void 0 : options.domain;\n _a = BrowserConfig.bind;\n _b = [void 0, apiKey];\n _c = [__assign({}, options)];\n _d = { cookieStorage, deviceId, domain, lastEventId, lastEventTime, optOut, sessionId };\n return [4, createEventsStorage(options)];\n case 1:\n return [2, new (_a.apply(BrowserConfig, _b.concat([__assign.apply(void 0, _c.concat([(_d.storageProvider = _g.sent(), _d.trackingOptions = __assign(__assign({}, defaultConfig.trackingOptions), options === null || options === void 0 ? void 0 : options.trackingOptions), _d.transportProvider = (_f = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _f !== void 0 ? _f : createTransport(options === null || options === void 0 ? void 0 : options.transport), _d.userId = userId, _d)]))])))()];\n }\n });\n });\n };\n var createCookieStorage = function(overrides, baseConfig) {\n if (baseConfig === void 0) {\n baseConfig = getDefaultConfig2();\n }\n return __awaiter(void 0, void 0, void 0, function() {\n var options, cookieStorage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n options = __assign(__assign({}, baseConfig), overrides);\n cookieStorage = overrides === null || overrides === void 0 ? void 0 : overrides.cookieStorage;\n _a = !cookieStorage;\n if (_a) return [3, 2];\n return [4, cookieStorage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (_a) {\n return [2, createFlexibleStorage(options)];\n }\n return [2, cookieStorage];\n }\n });\n });\n };\n var createFlexibleStorage = function(options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n storage = new CookieStorage({\n domain: options.domain,\n expirationDays: options.cookieExpiration,\n sameSite: options.cookieSameSite,\n secure: options.cookieSecure\n });\n _a = options.disableCookies;\n if (_a) return [3, 2];\n return [4, storage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (!_a) return [3, 4];\n storage = new LocalStorage();\n return [4, storage.isEnabled()];\n case 3:\n if (!_b.sent()) {\n storage = new MemoryStorage();\n }\n _b.label = 4;\n case 4:\n return [2, storage];\n }\n });\n });\n };\n var createEventsStorage = function(overrides) {\n return __awaiter(void 0, void 0, void 0, function() {\n var hasStorageProviderProperty, loggerProvider, _a, _b, storage, _c, e_1_1;\n var e_1, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n hasStorageProviderProperty = overrides && Object.prototype.hasOwnProperty.call(overrides, "storageProvider");\n loggerProvider = overrides && overrides.loggerProvider;\n if (!(!hasStorageProviderProperty || overrides.storageProvider)) return [3, 9];\n _e.label = 1;\n case 1:\n _e.trys.push([1, 7, 8, 9]);\n _a = __values([overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider, new LocalStorage({ loggerProvider })]), _b = _a.next();\n _e.label = 2;\n case 2:\n if (!!_b.done) return [3, 6];\n storage = _b.value;\n _c = storage;\n if (!_c) return [3, 4];\n return [4, storage.isEnabled()];\n case 3:\n _c = _e.sent();\n _e.label = 4;\n case 4:\n if (_c) {\n return [2, storage];\n }\n _e.label = 5;\n case 5:\n _b = _a.next();\n return [3, 2];\n case 6:\n return [3, 9];\n case 7:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 9];\n case 8:\n try {\n if (_b && !_b.done && (_d = _a.return)) _d.call(_a);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 9:\n return [2, void 0];\n }\n });\n });\n };\n var createTransport = function(transport) {\n if (transport === TransportType.XHR) {\n return new XHRTransport();\n }\n if (transport === TransportType.SendBeacon) {\n return new SendBeaconTransport();\n }\n return getDefaultConfig2().transportProvider;\n };\n var getTopLevelDomain = function(url) {\n return __awaiter(void 0, void 0, void 0, function() {\n var host, parts, levels, storageKey, i, i, domain, options, storage, value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, new CookieStorage().isEnabled()];\n case 1:\n if (!_a.sent() || !url && typeof location === "undefined") {\n return [2, ""];\n }\n host = url !== null && url !== void 0 ? url : location.hostname;\n parts = host.split(".");\n levels = [];\n storageKey = "AMP_TLDTEST";\n for (i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join("."));\n }\n i = 0;\n _a.label = 2;\n case 2:\n if (!(i < levels.length)) return [3, 7];\n domain = levels[i];\n options = { domain: "." + domain };\n storage = new CookieStorage(options);\n return [4, storage.set(storageKey, 1)];\n case 3:\n _a.sent();\n return [4, storage.get(storageKey)];\n case 4:\n value = _a.sent();\n if (!value) return [3, 6];\n return [4, storage.remove(storageKey)];\n case 5:\n _a.sent();\n return [2, "." + domain];\n case 6:\n i++;\n return [3, 2];\n case 7:\n return [2, ""];\n }\n });\n });\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/constants.js\n var DEFAULT_EVENT_PREFIX = "[Amplitude]";\n var DEFAULT_PAGE_VIEW_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Page Viewed");\n var DEFAULT_FORM_START_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Started");\n var DEFAULT_FORM_SUBMIT_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Submitted");\n var DEFAULT_FILE_DOWNLOAD_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " File Downloaded");\n var DEFAULT_SESSION_START_EVENT = "session_start";\n var DEFAULT_SESSION_END_EVENT = "session_end";\n var FILE_EXTENSION = "".concat(DEFAULT_EVENT_PREFIX, " File Extension");\n var FILE_NAME = "".concat(DEFAULT_EVENT_PREFIX, " File Name");\n var LINK_ID = "".concat(DEFAULT_EVENT_PREFIX, " Link ID");\n var LINK_TEXT = "".concat(DEFAULT_EVENT_PREFIX, " Link Text");\n var LINK_URL = "".concat(DEFAULT_EVENT_PREFIX, " Link URL");\n var FORM_ID = "".concat(DEFAULT_EVENT_PREFIX, " Form ID");\n var FORM_NAME = "".concat(DEFAULT_EVENT_PREFIX, " Form Name");\n var FORM_DESTINATION = "".concat(DEFAULT_EVENT_PREFIX, " Form Destination");\n\n // node_modules/@amplitude/analytics-browser/lib/esm/cookie-migration/index.js\n var parseLegacyCookies = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, oldCookieName, cookies, _a, deviceId, userId, optOut, sessionId, lastEventTime, lastEventId;\n var _b;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n return [4, createCookieStorage(options)];\n case 1:\n storage = _c.sent();\n oldCookieName = getOldCookieName(apiKey);\n return [4, storage.getRaw(oldCookieName)];\n case 2:\n cookies = _c.sent();\n if (!cookies) {\n return [2, {\n optOut: false\n }];\n }\n if (!((_b = options.cookieUpgrade) !== null && _b !== void 0 ? _b : getDefaultConfig2().cookieUpgrade)) return [3, 4];\n return [4, storage.remove(oldCookieName)];\n case 3:\n _c.sent();\n _c.label = 4;\n case 4:\n _a = __read(cookies.split("."), 6), deviceId = _a[0], userId = _a[1], optOut = _a[2], sessionId = _a[3], lastEventTime = _a[4], lastEventId = _a[5];\n return [2, {\n deviceId,\n userId: decode(userId),\n sessionId: parseTime(sessionId),\n lastEventId: parseTime(lastEventId),\n lastEventTime: parseTime(lastEventTime),\n optOut: Boolean(optOut)\n }];\n }\n });\n });\n };\n var parseTime = function(num) {\n var integer = parseInt(num, 32);\n if (isNaN(integer)) {\n return void 0;\n }\n return integer;\n };\n var decode = function(value) {\n if (!atob || !escape || !value) {\n return void 0;\n }\n try {\n return decodeURIComponent(escape(atob(value)));\n } catch (_a) {\n return void 0;\n }\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var import_ua_parser_js = __toESM(require_ua_parser());\n\n // node_modules/@amplitude/analytics-browser/lib/esm/version.js\n var VERSION = "1.13.4";\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var BROWSER_PLATFORM = "Web";\n var IP_ADDRESS = "$remote";\n var Context = (\n /** @class */\n (function() {\n function Context2() {\n this.name = "context";\n this.type = PluginType.BEFORE;\n this.library = "amplitude-ts/".concat(VERSION);\n if (typeof navigator !== "undefined") {\n this.userAgent = navigator.userAgent;\n }\n this.uaResult = new import_ua_parser_js.default(this.userAgent).getResult();\n }\n Context2.prototype.setup = function(config) {\n this.config = config;\n return Promise.resolve(void 0);\n };\n Context2.prototype.execute = function(context) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var time, osName, osVersion, deviceModel, deviceVendor, lastEventId, nextEventId, event;\n return __generator(this, function(_c) {\n time = (/* @__PURE__ */ new Date()).getTime();\n osName = this.uaResult.browser.name;\n osVersion = this.uaResult.browser.version;\n deviceModel = this.uaResult.device.model || this.uaResult.os.name;\n deviceVendor = this.uaResult.device.vendor;\n lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n nextEventId = (_b = context.event_id) !== null && _b !== void 0 ? _b : lastEventId + 1;\n this.config.lastEventId = nextEventId;\n if (!context.time) {\n this.config.lastEventTime = time;\n }\n event = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ user_id: this.config.userId, device_id: this.config.deviceId, session_id: this.config.sessionId, time }, this.config.appVersion && { app_version: this.config.appVersion }), this.config.trackingOptions.platform && { platform: BROWSER_PLATFORM }), this.config.trackingOptions.osName && { os_name: osName }), this.config.trackingOptions.osVersion && { os_version: osVersion }), this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor }), this.config.trackingOptions.deviceModel && { device_model: deviceModel }), this.config.trackingOptions.language && { language: getLanguage2() }), this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }), { insert_id: UUID(), partner_id: this.config.partnerId, plan: this.config.plan }), this.config.ingestionMetadata && {\n ingestion_metadata: {\n source_name: this.config.ingestionMetadata.sourceName,\n source_version: this.config.ingestionMetadata.sourceVersion\n }\n }), context), { event_id: nextEventId, library: this.library, user_agent: this.userAgent });\n return [2, event];\n });\n });\n };\n return Context2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/default-page-view-event-enrichment.js\n var eventPropertyMap = {\n page_domain: "".concat(DEFAULT_EVENT_PREFIX, " Page Domain"),\n page_location: "".concat(DEFAULT_EVENT_PREFIX, " Page Location"),\n page_path: "".concat(DEFAULT_EVENT_PREFIX, " Page Path"),\n page_title: "".concat(DEFAULT_EVENT_PREFIX, " Page Title"),\n page_url: "".concat(DEFAULT_EVENT_PREFIX, " Page URL")\n };\n var defaultPageViewEventEnrichment = function() {\n var name = "@amplitude/plugin-default-page-view-event-enrichment-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, void 0];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (event.event_type === DEFAULT_PAGE_VIEW_EVENT && event.event_properties) {\n event.event_properties = Object.entries(event.event_properties).reduce(function(acc, _a2) {\n var _b = __read(_a2, 2), key = _b[0], value = _b[1];\n var transformedPropertyName = eventPropertyMap[key];\n if (transformedPropertyName) {\n acc[transformedPropertyName] = value;\n } else {\n acc[key] = value;\n }\n return acc;\n }, {});\n }\n return [2, event];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/file-download-tracking.js\n var fileDownloadTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-file-download-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFileDownloadListener, ext, links;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFileDownloadListener = function(a) {\n var url;\n try {\n url = new URL(a.href, window.location.href);\n } catch (_a2) {\n return;\n }\n var result = ext.exec(url.href);\n var fileExtension = result === null || result === void 0 ? void 0 : result[1];\n if (fileExtension) {\n addEventListener(a, "click", function() {\n var _a2;\n if (fileExtension) {\n amplitude.track(DEFAULT_FILE_DOWNLOAD_EVENT, (_a2 = {}, _a2[FILE_EXTENSION] = fileExtension, _a2[FILE_NAME] = url.pathname, _a2[LINK_ID] = a.id, _a2[LINK_TEXT] = a.text, _a2[LINK_URL] = a.href, _a2));\n }\n });\n }\n };\n ext = /\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;\n links = Array.from(document.getElementsByTagName("a"));\n links.forEach(addFileDownloadListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "A") {\n addFileDownloadListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("a")).map(addFileDownloadListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/form-interaction-tracking.js\n var formInteractionTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-form-interaction-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFormInteractionListener, forms;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFormInteractionListener = function(form) {\n var hasFormChanged = false;\n addEventListener(form, "change", function() {\n var _a2;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n hasFormChanged = true;\n });\n addEventListener(form, "submit", function() {\n var _a2, _b;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n amplitude.track(DEFAULT_FORM_SUBMIT_EVENT, (_b = {}, _b[FORM_ID] = form.id, _b[FORM_NAME] = form.name, _b[FORM_DESTINATION] = form.action, _b));\n hasFormChanged = false;\n });\n };\n forms = Array.from(document.getElementsByTagName("form"));\n forms.forEach(addFormInteractionListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "FORM") {\n addFormInteractionListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("form")).map(addFormInteractionListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/utils/snippet-helper.js\n var convertProxyObjectToRealObject = function(instance, queue) {\n for (var i = 0; i < queue.length; i++) {\n var _a = queue[i], name_1 = _a.name, args = _a.args, resolve = _a.resolve;\n var fn = instance && instance[name_1];\n if (typeof fn === "function") {\n var result = fn.apply(instance, args);\n if (typeof resolve === "function") {\n resolve(result === null || result === void 0 ? void 0 : result.promise);\n }\n }\n }\n return instance;\n };\n var isInstanceProxy = function(instance) {\n var instanceProxy = instance;\n return instanceProxy && instanceProxy._q !== void 0;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client.js\n var AmplitudeBrowser = (\n /** @class */\n (function(_super) {\n __extends(AmplitudeBrowser2, _super);\n function AmplitudeBrowser2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AmplitudeBrowser2.prototype.init = function(apiKey, userId, options) {\n if (apiKey === void 0) {\n apiKey = "";\n }\n return returnWrapper(this._init(__assign(__assign({}, options), { userId, apiKey })));\n };\n AmplitudeBrowser2.prototype._init = function(options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _r, _s, _t, _u, _v, _w;\n return __awaiter(this, void 0, void 0, function() {\n var _x, _y, _z, legacyCookies, cookieStorage, previousCookies, queryParams, deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, browserOptions, isNewSession, connector, webAttribution, pageViewTrackingOptions;\n var _this = this;\n return __generator(this, function(_0) {\n switch (_0.label) {\n case 0:\n if (this.initializing) {\n return [\n 2\n /*return*/\n ];\n }\n this.initializing = true;\n _x = options;\n if (!options.disableCookies) return [3, 1];\n _y = "";\n return [3, 5];\n case 1:\n if (!((_a = options.domain) !== null && _a !== void 0)) return [3, 2];\n _z = _a;\n return [3, 4];\n case 2:\n return [4, getTopLevelDomain()];\n case 3:\n _z = _0.sent();\n _0.label = 4;\n case 4:\n _y = _z;\n _0.label = 5;\n case 5:\n _x.domain = _y;\n return [4, parseLegacyCookies(options.apiKey, options)];\n case 6:\n legacyCookies = _0.sent();\n return [4, createCookieStorage(options)];\n case 7:\n cookieStorage = _0.sent();\n return [4, cookieStorage.get(getCookieName(options.apiKey))];\n case 8:\n previousCookies = _0.sent();\n queryParams = getQueryParams();\n deviceId = (_d = (_c = (_b = options.deviceId) !== null && _b !== void 0 ? _b : queryParams.deviceId) !== null && _c !== void 0 ? _c : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _d !== void 0 ? _d : legacyCookies.deviceId;\n sessionId = (_e = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.sessionId) !== null && _e !== void 0 ? _e : legacyCookies.sessionId;\n optOut = (_g = (_f = options.optOut) !== null && _f !== void 0 ? _f : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.optOut) !== null && _g !== void 0 ? _g : legacyCookies.optOut;\n lastEventId = (_h = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventId) !== null && _h !== void 0 ? _h : legacyCookies.lastEventId;\n lastEventTime = (_j = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventTime) !== null && _j !== void 0 ? _j : legacyCookies.lastEventTime;\n userId = (_l = (_k = options.userId) !== null && _k !== void 0 ? _k : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _l !== void 0 ? _l : legacyCookies.userId;\n this.previousSessionDeviceId = (_m = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _m !== void 0 ? _m : legacyCookies.deviceId;\n this.previousSessionUserId = (_o = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _o !== void 0 ? _o : legacyCookies.userId;\n return [4, useBrowserConfig(options.apiKey, __assign(__assign({}, options), { deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, cookieStorage }))];\n case 9:\n browserOptions = _0.sent();\n return [4, _super.prototype._init.call(this, browserOptions)];\n case 10:\n _0.sent();\n isNewSession = false;\n if (\n // user has never sent an event\n !this.config.lastEventTime || // user has no previous session ID\n !this.config.sessionId || // has sent an event and has previous session but expired\n this.config.lastEventTime && Date.now() - this.config.lastEventTime > this.config.sessionTimeout\n ) {\n this.setSessionId((_r = (_p = options.sessionId) !== null && _p !== void 0 ? _p : this.config.sessionId) !== null && _r !== void 0 ? _r : Date.now());\n isNewSession = true;\n }\n connector = getAnalyticsConnector(options.instanceName);\n connector.identityStore.setIdentity({\n userId: this.config.userId,\n deviceId: this.config.deviceId\n });\n return [4, this.add(new Destination()).promise];\n case 11:\n _0.sent();\n return [4, this.add(new Context()).promise];\n case 12:\n _0.sent();\n return [4, this.add(new IdentityEventSender()).promise];\n case 13:\n _0.sent();\n if (!isFileDownloadTrackingEnabled(this.config.defaultTracking)) return [3, 15];\n return [4, this.add(fileDownloadTracking()).promise];\n case 14:\n _0.sent();\n _0.label = 15;\n case 15:\n if (!isFormInteractionTrackingEnabled(this.config.defaultTracking)) return [3, 17];\n return [4, this.add(formInteractionTracking()).promise];\n case 16:\n _0.sent();\n _0.label = 17;\n case 17:\n if (!!((_s = this.config.attribution) === null || _s === void 0 ? void 0 : _s.disabled)) return [3, 19];\n webAttribution = webAttributionPlugin({\n excludeReferrers: (_t = this.config.attribution) === null || _t === void 0 ? void 0 : _t.excludeReferrers,\n initialEmptyValue: (_u = this.config.attribution) === null || _u === void 0 ? void 0 : _u.initialEmptyValue,\n resetSessionOnNewCampaign: (_v = this.config.attribution) === null || _v === void 0 ? void 0 : _v.resetSessionOnNewCampaign\n });\n webAttribution.__pluginEnabledOverride = isNewSession || ((_w = this.config.attribution) === null || _w === void 0 ? void 0 : _w.trackNewCampaigns) ? void 0 : false;\n return [4, this.add(webAttribution).promise];\n case 18:\n _0.sent();\n _0.label = 19;\n case 19:\n pageViewTrackingOptions = getPageViewTrackingConfig(this.config);\n pageViewTrackingOptions.eventType = pageViewTrackingOptions.eventType || DEFAULT_PAGE_VIEW_EVENT;\n return [4, this.add(pageViewTrackingPlugin(pageViewTrackingOptions)).promise];\n case 20:\n _0.sent();\n return [4, this.add(defaultPageViewEventEnrichment()).promise];\n case 21:\n _0.sent();\n this.initializing = false;\n return [4, this.runQueuedFunctions("dispatchQ")];\n case 22:\n _0.sent();\n connector.eventBridge.setEventReceiver(function(event) {\n void _this.track(event.eventType, event.eventProperties);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeBrowser2.prototype.getUserId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.userId;\n };\n AmplitudeBrowser2.prototype.setUserId = function(userId) {\n if (!this.config) {\n this.q.push(this.setUserId.bind(this, userId));\n return;\n }\n if (userId !== this.config.userId || userId === void 0) {\n this.config.userId = userId;\n setConnectorUserId(userId, this.config.instanceName);\n }\n };\n AmplitudeBrowser2.prototype.getDeviceId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.deviceId;\n };\n AmplitudeBrowser2.prototype.setDeviceId = function(deviceId) {\n if (!this.config) {\n this.q.push(this.setDeviceId.bind(this, deviceId));\n return;\n }\n this.config.deviceId = deviceId;\n setConnectorDeviceId(deviceId, this.config.instanceName);\n };\n AmplitudeBrowser2.prototype.setOptOut = function(optOut) {\n setConnectorOptOut(optOut, this.config.instanceName);\n _super.prototype.setOptOut.call(this, optOut);\n };\n AmplitudeBrowser2.prototype.reset = function() {\n this.setDeviceId(UUID());\n this.setUserId(void 0);\n };\n AmplitudeBrowser2.prototype.getSessionId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.sessionId;\n };\n AmplitudeBrowser2.prototype.setSessionId = function(sessionId) {\n var _a;\n if (!this.config) {\n this.q.push(this.setSessionId.bind(this, sessionId));\n return;\n }\n if (sessionId === this.config.sessionId) {\n return;\n }\n var previousSessionId = this.getSessionId();\n var lastEventTime = this.config.lastEventTime;\n var lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n this.config.sessionId = sessionId;\n this.config.lastEventTime = void 0;\n if (isSessionTrackingEnabled(this.config.defaultTracking)) {\n if (previousSessionId && lastEventTime) {\n this.track(DEFAULT_SESSION_END_EVENT, void 0, {\n device_id: this.previousSessionDeviceId,\n event_id: ++lastEventId,\n session_id: previousSessionId,\n time: lastEventTime + 1,\n user_id: this.previousSessionUserId\n });\n }\n this.config.lastEventTime = this.config.sessionId;\n this.track(DEFAULT_SESSION_START_EVENT, void 0, {\n event_id: ++lastEventId,\n session_id: this.config.sessionId,\n time: this.config.lastEventTime\n });\n }\n this.previousSessionDeviceId = this.config.deviceId;\n this.previousSessionUserId = this.config.userId;\n };\n AmplitudeBrowser2.prototype.extendSession = function() {\n if (!this.config) {\n this.q.push(this.extendSession.bind(this));\n return;\n }\n this.config.lastEventTime = Date.now();\n };\n AmplitudeBrowser2.prototype.setTransport = function(transport) {\n if (!this.config) {\n this.q.push(this.setTransport.bind(this, transport));\n return;\n }\n this.config.transportProvider = createTransport(transport);\n };\n AmplitudeBrowser2.prototype.identify = function(identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.user_id) {\n this.setUserId(eventOptions.user_id);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.device_id) {\n this.setDeviceId(eventOptions.device_id);\n }\n return _super.prototype.identify.call(this, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return _super.prototype.groupIdentify.call(this, groupType, groupName, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.revenue = function(revenue2, eventOptions) {\n if (isInstanceProxy(revenue2)) {\n var queue = revenue2._q;\n revenue2._q = [];\n revenue2 = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return _super.prototype.revenue.call(this, revenue2, eventOptions);\n };\n AmplitudeBrowser2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var currentTime, lastEventTime, timeSinceLastEvent;\n return __generator(this, function(_a) {\n currentTime = Date.now();\n lastEventTime = this.config.lastEventTime || Date.now();\n timeSinceLastEvent = currentTime - lastEventTime;\n if (event.event_type !== DEFAULT_SESSION_START_EVENT && event.event_type !== DEFAULT_SESSION_END_EVENT && (!event.session_id || event.session_id === this.getSessionId()) && timeSinceLastEvent > this.config.sessionTimeout) {\n this.setSessionId(currentTime);\n }\n return [2, _super.prototype.process.call(this, event)];\n });\n });\n };\n return AmplitudeBrowser2;\n })(AmplitudeCore)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client-factory.js\n var createInstance = function() {\n var client = new AmplitudeBrowser();\n return {\n init: debugWrapper(client.init.bind(client), "init", getClientLogConfig(client), getClientStates(client, ["config"])),\n add: debugWrapper(client.add.bind(client), "add", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n remove: debugWrapper(client.remove.bind(client), "remove", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n track: debugWrapper(client.track.bind(client), "track", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n logEvent: debugWrapper(client.logEvent.bind(client), "logEvent", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n identify: debugWrapper(client.identify.bind(client), "identify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n groupIdentify: debugWrapper(client.groupIdentify.bind(client), "groupIdentify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n setGroup: debugWrapper(client.setGroup.bind(client), "setGroup", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n revenue: debugWrapper(client.revenue.bind(client), "revenue", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n flush: debugWrapper(client.flush.bind(client), "flush", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n getUserId: debugWrapper(client.getUserId.bind(client), "getUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n setUserId: debugWrapper(client.setUserId.bind(client), "setUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n getDeviceId: debugWrapper(client.getDeviceId.bind(client), "getDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n setDeviceId: debugWrapper(client.setDeviceId.bind(client), "setDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n reset: debugWrapper(client.reset.bind(client), "reset", getClientLogConfig(client), getClientStates(client, ["config", "config.userId", "config.deviceId"])),\n getSessionId: debugWrapper(client.getSessionId.bind(client), "getSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n setSessionId: debugWrapper(client.setSessionId.bind(client), "setSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n extendSession: debugWrapper(client.extendSession.bind(client), "extendSession", getClientLogConfig(client), getClientStates(client, ["config"])),\n setOptOut: debugWrapper(client.setOptOut.bind(client), "setOptOut", getClientLogConfig(client), getClientStates(client, ["config"])),\n setTransport: debugWrapper(client.setTransport.bind(client), "setTransport", getClientLogConfig(client), getClientStates(client, ["config"]))\n };\n };\n var browser_client_factory_default = createInstance();\n\n // node_modules/@amplitude/analytics-browser/lib/esm/index.js\n var add = browser_client_factory_default.add;\n var extendSession = browser_client_factory_default.extendSession;\n var flush = browser_client_factory_default.flush;\n var getDeviceId = browser_client_factory_default.getDeviceId;\n var getSessionId = browser_client_factory_default.getSessionId;\n var getUserId = browser_client_factory_default.getUserId;\n var groupIdentify = browser_client_factory_default.groupIdentify;\n var identify = browser_client_factory_default.identify;\n var init = browser_client_factory_default.init;\n var logEvent = browser_client_factory_default.logEvent;\n var remove = browser_client_factory_default.remove;\n var reset = browser_client_factory_default.reset;\n var revenue = browser_client_factory_default.revenue;\n var setDeviceId = browser_client_factory_default.setDeviceId;\n var setGroup = browser_client_factory_default.setGroup;\n var setOptOut = browser_client_factory_default.setOptOut;\n var setSessionId = browser_client_factory_default.setSessionId;\n var setTransport = browser_client_factory_default.setTransport;\n var setUserId = browser_client_factory_default.setUserId;\n var track = browser_client_factory_default.track;\n\n // packages/dev-tools/client/tracking.ts\n var dispatch = (eventName) => {\n window.dispatchEvent(\n new CustomEvent(`builderdevtools`, { detail: { eventName } })\n );\n };\n async function loadUserDataFromLocal() {\n return apiLocalConfig();\n }\n var initTracking = async () => {\n const url = new URL(window.location.href);\n const hash = url.hash;\n const userIdHash = `#${CONNECTED_USER_ID_QS}=`;\n const uniqueId = Math.random().toString(36).substring(2, 15);\n const localConfig = await loadUserDataFromLocal();\n init("f1d2eb79aecd01b28c8a371ea5d1751c", localConfig?.userId || uniqueId, {\n logLevel: esm_exports.LogLevel.None,\n serverUrl: AMPLITUDE_PROXY_URL,\n flushIntervalMillis: 500\n });\n const identifyObj = new Identify();\n identify(identifyObj, {\n device_id: localConfig?.deviceId,\n user_id: localConfig?.userId || uniqueId\n });\n let builderUserId = `anonymous`;\n if (hash.startsWith(userIdHash)) {\n builderUserId = hash.slice(userIdHash.length);\n if (builderUserId) {\n setBuilderUserId(builderUserId);\n url.hash = "";\n window.history.replaceState({}, "", url.href);\n }\n }\n dispatch("init");\n };\n var setBuilderUserId = (builderUserId) => {\n if (typeof builderUserId === "string" && builderUserId.length > 0) {\n const t = getTracking();\n setTracking({\n ...t,\n builderUserId\n });\n }\n };\n var getTracking = () => {\n const ls = localStorage.getItem(TRACKING_KEY);\n if (ls) {\n try {\n let t = JSON.parse(ls);\n if (!t.ctas || typeof t.ctas !== "object") {\n t = setTracking({\n ...t,\n ctas: {}\n });\n }\n if (t.menuOpenedTs) {\n t = setTracking({\n ...t,\n ctas: {\n ...t.ctas,\n menuOpened: t.menuOpenedTs\n }\n });\n delete t.menuOpenedTs;\n }\n return t;\n } catch (e) {\n console.error(e);\n }\n }\n return setTracking({\n firstVisitTs: Date.now(),\n ctas: {},\n builderUserId: ""\n });\n };\n var setTracking = (t) => {\n try {\n localStorage.setItem(TRACKING_KEY, JSON.stringify(t));\n } catch (e) {\n console.error(e);\n }\n return t;\n };\n var hasCTA = (ctaName) => {\n const t = getTracking();\n return !!t.ctas[ctaName];\n };\n var setCTA = (ctaName) => {\n const t = getTracking();\n return setTracking({\n ...t,\n ctas: {\n ...t.ctas,\n [ctaName]: Date.now()\n }\n });\n };\n var TRACKING_KEY = "builderDevtools";\n\n // packages/dev-tools/client/menu/pages/component-input.ts\n function initComponentInputSection(shadow) {\n initRegisterInput(shadow);\n initComponentOpenSource(shadow);\n initComponentInputName(shadow);\n initComponentInputType(shadow);\n }\n function initRegisterInput(shadow) {\n const inputReg = shadow.getElementById("input-register");\n inputReg.addEventListener("change", async (ev) => {\n ev.stopPropagation();\n const inputName = shadow.getElementById("input-name");\n const nav = shadow.querySelector(".nav-cmp-input");\n nav.classList.add("input-loading");\n nav.classList.remove("input-enabled");\n const cmpId = inputName.dataset.id;\n const propName = inputName.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name: propName,\n registerInput: inputReg.checked\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentInput(shadow, cmpId, propName);\n renderComponentDetail(shadow, cmpId);\n nav.classList.remove("input-loading");\n });\n }\n function initComponentOpenSource(shadow) {\n const openSourceBtn = shadow.getElementById(\n "input-open-source"\n );\n openSourceBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmp = APP_STATE.components.find((c) => c.id === target?.dataset.id);\n if (cmp) {\n apiLaunchEditor({ filePath: cmp.filePath });\n }\n });\n }\n function initComponentInputName(shadow) {\n const inputName = shadow.getElementById("input-name");\n const inputWrapper = inputName.closest(".ui-text-input");\n let initInputName = "";\n let savedTmr;\n inputName.addEventListener("focus", (ev) => {\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n ev.stopPropagation();\n initInputName = inputName.value;\n });\n inputName.addEventListener("blur", async (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (inputName.value !== initInputName) {\n if (inputName.value.trim().length < 3) {\n inputName.value = initInputName;\n return;\n }\n inputWrapper.classList.add("saved");\n savedTmr = setTimeout(() => {\n inputWrapper.classList.remove("saved");\n }, 3e3);\n const cmpId = inputName.dataset.id;\n const name = inputName.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name,\n friendlyName: inputName.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n renderComponentInput(shadow, cmpId, name);\n }\n });\n inputName.addEventListener("keyup", (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (ev.key === "Escape") {\n inputName.value = initInputName;\n inputName.blur();\n } else if (ev.key === "Enter") {\n inputName.blur();\n }\n });\n }\n function initComponentInputType(shadow) {\n const inputType = shadow.getElementById("input-type");\n inputType.addEventListener("change", async (ev) => {\n ev.stopPropagation();\n const cmpId = inputType.dataset.id;\n const name = inputType.dataset.prop;\n const registry = await apiSetComponentInput({\n cmpId,\n name,\n type: inputType.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n renderComponentInput(shadow, cmpId, name);\n });\n }\n function renderComponentInput(shadow, cmpId, propName) {\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (!cmp) {\n return null;\n }\n const regInput = cmp.inputs.find((i) => i.name === propName);\n if (!regInput) {\n return null;\n }\n const nav = shadow.querySelector(".nav-cmp-input");\n if (regInput.isRegistered) {\n nav.classList.add("input-enabled");\n } else {\n nav.classList.remove("input-enabled");\n }\n const inputReg = shadow.getElementById("input-register");\n inputReg.checked = !!regInput.isRegistered;\n const title = shadow.getElementById("cmp-input-title");\n title.innerText = cmp.name + ": " + (regInput.friendlyName || regInput.name);\n const openSource = shadow.getElementById("input-open-source");\n openSource.innerText = `Open ${cmp.displayFilePath}`;\n openSource.dataset.id = cmp.id;\n const propNameText = shadow.getElementById("cmp-prop-name");\n propNameText.innerText = regInput.name;\n const propType = shadow.getElementById("cmp-prop-type");\n propType.innerText = getPrimitiveType(regInput.type);\n const inputName = shadow.getElementById("input-name");\n inputName.dataset.id = cmp.id;\n inputName.dataset.prop = regInput.name;\n inputName.value = regInput.friendlyName || regInput.name;\n renderInputTypeSelect(shadow, cmp, regInput);\n return regInput;\n }\n function renderInputTypeSelect(shadow, cmp, cmpInput) {\n const typeSelect = shadow.getElementById("input-type");\n typeSelect.dataset.id = cmp.id;\n typeSelect.dataset.prop = cmpInput.name;\n typeSelect.innerHTML = "";\n const inputType = cmpInput.type;\n const isString = STRING_TYPES.includes(inputType);\n const isNumber = NUMBER_TYPES.includes(inputType);\n const isBoolean = BOOLEAN_TYPES.includes(inputType);\n const isArray = ARRAY_TYPES.includes(inputType);\n const isObject = OBJECT_TYPES.includes(inputType);\n INPUT_TYPES.forEach((t) => {\n const option = document.createElement("option");\n option.value = t.value;\n option.innerText = t.text;\n option.disabled = STRING_TYPES.includes(t.value) && !isString || NUMBER_TYPES.includes(t.value) && !isNumber || BOOLEAN_TYPES.includes(t.value) && !isBoolean || ARRAY_TYPES.includes(t.value) && !isArray || OBJECT_TYPES.includes(t.value) && !isObject;\n typeSelect.appendChild(option);\n });\n typeSelect.value = inputType;\n }\n\n // packages/dev-tools/client/menu/pages/component-detail.ts\n function initComponentDetailSection(shadow) {\n initRegisterComponent(shadow);\n initComponentName(shadow);\n initComponentOpenSource2(shadow);\n initComponentInputList(shadow);\n initInputReload(shadow);\n }\n function initRegisterComponent(shadow) {\n const cmpReg = shadow.getElementById("cmp-register");\n cmpReg.addEventListener("change", (ev) => {\n ev.stopPropagation();\n loadComponentDetail(shadow, "update");\n });\n }\n async function loadComponentDetail(shadow, opt) {\n const cmpDetail = shadow.querySelector(".nav-cmp-detail");\n const cmpError = shadow.getElementById("cmp-error");\n const cmpReg = shadow.getElementById("cmp-register");\n const regSwitchLabel = cmpReg.closest(".ui-switch");\n cmpDetail.classList.remove("cmp-enabled");\n if (cmpReg.checked) {\n cmpDetail.classList.add("cmp-loading");\n }\n try {\n const cmpId = cmpReg.dataset.id;\n let registry;\n if (opt === "load") {\n registry = await apiLoadComponent({ cmpId });\n } else if (cmpReg.checked) {\n registry = await apiRegisterComponent({ cmpId });\n dispatch("registryUpdate");\n track("interaction", {\n type: "click",\n name: "register component",\n detail: cmpId\n });\n } else {\n registry = await apiUnregisterComponent({ cmpId });\n dispatch("registryUpdate");\n track("interaction", {\n type: "click",\n name: "unregister component",\n detail: cmpId\n });\n }\n updateAppState(registry);\n renderComponentList(shadow);\n const cmp = renderComponentDetail(shadow, cmpId);\n if (opt === "update" && cmp) {\n if (cmpReg.checked) {\n cmpDetail.classList.add("cmp-enabled");\n showToast(\n shadow,\n `<strong>${cmp.name}</strong> is now registered in <strong>${APP_STATE.registryDisplayPath}</strong> and available for use in the Builder Visual Editor`\n );\n } else {\n showToast(\n shadow,\n `<strong>${cmp.name}</strong> has been unregistered from <strong>${APP_STATE.registryDisplayPath}</strong> and removed from the Builder Visual Editor`\n );\n }\n }\n } catch (e) {\n console.error(e);\n cmpError.innerHTML = `<p class="error">Error loading components</p><p class="error">${e.message || e}</p>`;\n regSwitchLabel.style.display = "none";\n }\n cmpDetail.classList.remove("cmp-loading");\n }\n function initComponentName(shadow) {\n const cmpName = shadow.getElementById("cmp-name");\n const inputWrapper = cmpName.closest(".ui-text-input");\n let initComponentName2 = "";\n let savedTmr;\n cmpName.addEventListener("focus", (ev) => {\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n ev.stopPropagation();\n initComponentName2 = cmpName.value;\n });\n cmpName.addEventListener("blur", async (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (cmpName.value !== initComponentName2) {\n if (cmpName.value.trim().length < 3) {\n cmpName.value = initComponentName2;\n return;\n }\n inputWrapper.classList.add("saved");\n savedTmr = setTimeout(() => {\n inputWrapper.classList.remove("saved");\n }, 3e3);\n const cmpId = cmpName.dataset.id;\n const registry = await apiSetComponentInfo({\n cmpId,\n name: cmpName.value\n });\n dispatch("registryUpdate");\n updateAppState(registry);\n renderComponentList(shadow);\n renderComponentDetail(shadow, cmpId);\n }\n });\n cmpName.addEventListener("keyup", (ev) => {\n ev.stopPropagation();\n clearTimeout(savedTmr);\n inputWrapper.classList.remove("saved");\n if (ev.key === "Escape") {\n cmpName.value = initComponentName2;\n cmpName.blur();\n } else if (ev.key === "Enter") {\n cmpName.blur();\n }\n });\n }\n function renderComponentDetail(shadow, cmpId) {\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (!cmp) {\n return null;\n }\n const cmpReg = shadow.getElementById("cmp-register");\n const cmpError = shadow.getElementById("cmp-error");\n const regSwitchLabel = cmpReg.closest(".ui-switch");\n regSwitchLabel.style.display = "";\n cmpError.innerHTML = "";\n cmpReg.dataset.id = cmp.id;\n cmpReg.checked = !!cmp.isRegistered;\n const cmpDetail = shadow.querySelector(".nav-cmp-detail");\n if (cmp.isRegistered) {\n cmpDetail.classList.add("cmp-enabled");\n } else {\n cmpDetail.classList.remove("cmp-enabled");\n }\n const cmpName = shadow.getElementById("cmp-name");\n cmpName.dataset.id = cmp.id;\n cmpName.value = cmp.name;\n const openSource = shadow.getElementById("cmp-open-source");\n openSource.innerText = `Open ${cmp.displayFilePath}`;\n openSource.dataset.id = cmp.id;\n const title = shadow.getElementById("cmp-detail-title");\n title.innerText = `${cmp.name} Component`;\n renderComponentDetailInputs(shadow, cmp);\n return cmp;\n }\n function initComponentOpenSource2(shadow) {\n const openSourceBtn = shadow.getElementById(\n "cmp-open-source"\n );\n openSourceBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmp = APP_STATE.components.find((c) => c.id === target?.dataset.id);\n if (cmp) {\n apiLaunchEditor({ filePath: cmp.filePath });\n track("interaction", {\n type: "click",\n name: "open component source file",\n detail: cmp.filePath\n });\n }\n });\n }\n function initInputReload(shadow) {\n const reloadBtn = shadow.getElementById(\n "btn-inputs-reload"\n );\n reloadBtn.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n loadComponentDetail(shadow, "load");\n });\n }\n function initComponentInputList(shadow) {\n const cmpInputList = shadow.getElementById(\n "cmp-detail-inputs"\n );\n cmpInputList.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const button = target?.closest("button");\n const cmpId = button?.dataset.id;\n const propName = button?.dataset.propName;\n const cmpInput = renderComponentInput(shadow, cmpId, propName);\n if (cmpInput) {\n goToSection(shadow, "nav-cmp-input");\n }\n });\n }\n function renderComponentDetailInputs(shadow, cmp) {\n const cmpInputList = shadow.getElementById(\n "cmp-detail-inputs"\n );\n const filteredInputList = cmp.inputs.filter((input) => !input.hideFromUI);\n if (filteredInputList.length > 0) {\n cmpInputList.innerHTML = "";\n filteredInputList.forEach((input) => {\n cmpInputList.appendChild(renderComponentDetailInputItem(cmp, input));\n });\n } else {\n cmpInputList.innerHTML = `<p class="cmp-inputs-empty">${cmp.name} component does not have any props</p>`;\n }\n }\n function renderComponentDetailInputItem(cmp, cmpInput) {\n const item = document.createElement("button");\n item.dataset.id = cmp.id;\n item.dataset.propName = cmpInput.name;\n item.className = "cmp-input-item nav-list-item";\n if (!cmpInput.isRegistered) {\n item.classList.add("cmp-input-item-unregistered");\n }\n const itemIcon = document.createElement("span");\n const type = getPrimitiveType(cmpInput.type);\n itemIcon.className = `nav-list-item-icon input-icon input-icon-${type}`;\n item.appendChild(itemIcon);\n const itemName = document.createElement("span");\n itemName.innerText = cmpInput.friendlyName || cmpInput.name;\n item.appendChild(itemName);\n const itemNote = document.createElement("span");\n itemNote.className = "nav-list-item-note";\n itemNote.innerText = cmpInput.type;\n item.appendChild(itemNote);\n return item;\n }\n\n // packages/dev-tools/client/menu/pages/component-list.ts\n function initComponentListSection(shadow) {\n const openRegistryFile = shadow.getElementById("open-builder-registry");\n openRegistryFile.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n apiLaunchEditor({ filePath: APP_STATE.registryPath, line: 1, column: 1 });\n });\n const cmpList = shadow.getElementById("cmp-list");\n cmpList.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const target = ev.target;\n const cmpId = target?.dataset.id;\n const cmp = APP_STATE.components.find((c) => c.id === cmpId);\n if (cmp) {\n const cmpDetail = shadow.querySelector(\n ".nav-cmp-detail .section-content"\n );\n cmpDetail.scrollTop = 0;\n renderComponentDetail(shadow, cmp.id);\n goToSection(shadow, "nav-cmp-detail");\n if (cmp.isRegistered) {\n loadComponentDetail(shadow, "load");\n }\n }\n });\n const searchInput = shadow.getElementById(\n "component-search"\n );\n const clearSearchButton = shadow.getElementById(\n "clear-search"\n );\n searchInput?.addEventListener("input", (event) => {\n const searchTerm = event.target.value.toLowerCase();\n const filteredComponents = searchTerm ? APP_STATE.components.filter(\n (component) => component.name.toLowerCase().includes(searchTerm) || component.displayFilePath?.toLowerCase().includes(searchTerm)\n ) : APP_STATE.components;\n renderComponentList(shadow, filteredComponents);\n clearSearchButton.style.display = searchTerm ? "flex" : "none";\n });\n clearSearchButton?.addEventListener("click", () => {\n searchInput.value = "";\n renderComponentList(shadow);\n clearSearchButton.style.display = "none";\n });\n searchInput?.addEventListener("keydown", (event) => {\n if (event.key === "Escape") {\n searchInput.value = "";\n renderComponentList(shadow);\n clearSearchButton.style.display = "none";\n }\n });\n }\n function loadComponentsSection(shadow) {\n const loadRegistry = apiRegistry();\n renderComponents(shadow, loadRegistry);\n }\n async function renderComponents(shadow, loadRegistry) {\n const cmpList = shadow.getElementById("cmp-list");\n const cmpListSection = shadow.querySelector(".nav-cmp-list");\n cmpListSection.classList.add("nav-loading");\n const openRegistryFile = shadow.getElementById("open-builder-registry");\n try {\n const registry = await loadRegistry;\n updateAppState(registry);\n renderComponentList(shadow);\n if (APP_STATE.registryDisplayPath) {\n openRegistryFile.innerText = "Open " + registry.registryDisplayPath;\n } else {\n openRegistryFile.innerText = "";\n }\n } catch (e) {\n cmpList.innerHTML = `<p class="error">Error loading components</p><p class="error">${e.message || e}</p>`;\n console.error(e);\n }\n cmpListSection.classList.remove("nav-loading");\n }\n function renderComponentList(shadow, filteredComponents) {\n const cmpList = shadow.getElementById("cmp-list");\n cmpList.innerHTML = "";\n const componentsToRender = filteredComponents || APP_STATE.components;\n const registered = componentsToRender.filter((c) => c.isRegistered);\n const unregistered = componentsToRender.filter((c) => !c.isRegistered);\n if (filteredComponents && filteredComponents.length === 0) {\n const noResults = document.createElement("p");\n noResults.className = "no-results";\n noResults.innerText = "No matching components found";\n cmpList.appendChild(noResults);\n return;\n }\n renderComponentListSection(cmpList, "Registered Components", registered);\n renderComponentListSection(cmpList, "Unregistered Components", unregistered);\n }\n function renderComponentListSection(cmpList, listTitle, cmps) {\n if (cmps.length > 0) {\n const cmpsTitle = document.createElement("h4");\n cmpsTitle.innerText = listTitle;\n cmpList.appendChild(cmpsTitle);\n cmps.forEach((c) => {\n cmpList.appendChild(renderComponentListItem(c));\n });\n }\n }\n function renderComponentListItem(cmp) {\n const searchTerm = document.getElementById("component-search")?.value.toLowerCase();\n const item = document.createElement("button");\n item.dataset.id = cmp.id;\n item.className = "cmp-item nav-list-item";\n if (cmp.isRegistered) {\n item.classList.add("registered");\n }\n const itemIcon = document.createElement("span");\n itemIcon.className = "nav-list-item-icon";\n if (cmp.image) {\n itemIcon.style.backgroundImage = `url(${cmp.image})`;\n }\n item.appendChild(itemIcon);\n const itemName = document.createElement("span");\n itemName.className = "nav-list-item-name";\n itemName.innerHTML = highlightMatches(cmp.name, searchTerm);\n item.appendChild(itemName);\n const itemNote = document.createElement("span");\n itemNote.className = "nav-list-item-note";\n itemNote.innerHTML = highlightMatches(cmp.displayFilePath || "", searchTerm);\n item.appendChild(itemNote);\n return item;\n }\n function highlightMatches(text, searchTerm) {\n if (!searchTerm) return text;\n const regex = new RegExp(`(${searchTerm})`, "gi");\n return text.replace(regex, \'<span class="search-highlight">$1</span>\');\n }\n\n // packages/dev-tools/client/menu/toggle/menu-toggle.ts\n var initMenuToggle = (shadow) => {\n shadow.querySelector(".menu-toggle").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, true);\n });\n shadow.getElementById("close").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n });\n shadow.getElementById("hit").addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n });\n initBackButtons(shadow);\n shadow.addEventListener("click", (ev) => ev.stopPropagation());\n checkCTAs(shadow);\n };\n var openMenu = (shadow, openDevToolsMenu) => {\n if (openDevToolsMenu) {\n document.body.classList.add("builder-no-scroll");\n shadow.host.classList.add("show-builder-menu");\n dispatch("menuOpen");\n setCTA("menuOpened");\n track("interaction", {\n type: "click",\n name: "open dev-tools menu"\n });\n } else {\n document.body.classList.remove("builder-no-scroll");\n shadow.host.classList.remove("show-builder-menu");\n dispatch("menuClose");\n setTimeout(() => {\n goToSection(shadow, "nav-home");\n }, 300);\n }\n apiDevToolsEnabled(openDevToolsMenu);\n };\n var checkCTAs = (shadow) => {\n if (!hasCTA("menuOpened")) {\n menuToggleToolTipCta(shadow);\n return;\n }\n const t = getTracking();\n const minutesSinceFirstVisit = (Date.now() - t.firstVisitTs) / 1e3 / 60;\n if (minutesSinceFirstVisit < 10) {\n return;\n }\n if (!hasCTA("feedback")) {\n setCTA("feedback");\n feedbackToolTipCta(shadow);\n return;\n }\n };\n var menuToggleToolTipCta = (shadow) => {\n const tooltip = document.createElement("a");\n tooltip.classList.add("menu-toggle-tooltip");\n tooltip.href = `#open-dev-tools`;\n tooltip.innerHTML = `\n <div class="menu-toggle-tooltip-content">\n <h3>Open Builder Devtools</h3>\n <p>Start registering your components</p>\n </div>\n `;\n shadow.appendChild(tooltip);\n setTimeout(() => {\n tooltip.classList.add("menu-toggle-tooltip-show");\n tooltip.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n tooltip.classList.remove("menu-toggle-tooltip-show");\n openMenu(shadow, true);\n });\n }, 1e3);\n };\n var feedbackToolTipCta = (shadow) => {\n const tooltip = document.createElement("a");\n tooltip.classList.add("menu-toggle-tooltip");\n tooltip.href = `https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform`;\n tooltip.target = "_blank";\n tooltip.innerHTML = `\n <div class="menu-toggle-tooltip-content">\n <h3>How\'s Devtools working for you?</h3>\n <p>We\'d love your feedback!</p>\n </div>\n `;\n shadow.appendChild(tooltip);\n setTimeout(() => {\n tooltip.classList.add("menu-toggle-tooltip-show");\n tooltip.addEventListener("click", () => {\n tooltip.classList.remove("menu-toggle-tooltip-show");\n });\n }, 1e3);\n };\n\n // packages/dev-tools/client/menu/pages/home.ts\n function initHomeSection(shadow) {\n const goToBuilder = shadow.getElementById("go-to-builder");\n goToBuilder.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(getEditorUrl(), "builder");\n });\n const componentsLink = shadow.getElementById("components-link");\n componentsLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n const cmpList = shadow.querySelector(\n ".nav-cmp-list .section-content"\n );\n cmpList.scrollTop = 0;\n goToSection(shadow, "nav-cmp-list");\n loadComponentsSection(shadow);\n });\n const settingsLink = shadow.getElementById("settings-link");\n settingsLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n goToSection(shadow, "nav-settings");\n });\n const addPageLink = shadow.getElementById("add-page-link");\n addPageLink.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(getBuilderContentUrl(), "builder");\n });\n const importFromFigma = shadow.getElementById("import-from-figma");\n importFromFigma.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n openMenu(shadow, false);\n window.open(\n "https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more"\n );\n });\n }\n\n // packages/dev-tools/client/menu/pages/settings.ts\n function initSettingsSection(shadow) {\n const s = shadow.getElementById("enable-edit");\n s.addEventListener("change", (ev) => {\n ev.stopPropagation();\n enableEdit(s.checked);\n });\n s.checked = isEditEnabled();\n enableEdit(s.checked);\n }\n\n // packages/dev-tools/client/menu/index.ts\n var BuilderDevToolsMenu = class extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = `<style>/* packages/dev-tools/client/common.css */\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n:host {\n --background-color: rgba(40, 40, 40, 1);\n --primary-color: rgba(72, 161, 255, 1);\n --primary-color-subdued: rgb(72, 161, 255, 0.6);\n --primary-color-highlight: rgb(126, 188, 255);\n --primary-contrast-color: white;\n --edit-color: #1d74e2;\n --edit-color-highlight: #1c6bd1;\n --edit-color-alpha: rgb(72, 161, 255, 0.15);\n --error-color: #ff2b55;\n --text-color: white;\n --text-color-highlight: white;\n --border-color: #454545;\n --button-background-color-hover: rgba(255, 255, 255, 0.1);\n --menu-width: 320px;\n --transition-time: 150ms;\n --font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n "Noto Sans",\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n font-family: var(--font-family);\n line-height: 1.6;\n}\nbutton {\n cursor: pointer;\n color: var(--text-color);\n -webkit-tap-highlight-color: transparent;\n}\ninput,\nselect,\nbutton {\n font-family: var(--font-family);\n}\n\n/* packages/dev-tools/client/menu/toggle/menu-toggle.css */\n.menu-toggle {\n position: absolute;\n right: 0;\n bottom: 0;\n pointer-events: auto;\n padding: 8px;\n background: transparent;\n border: none;\n appearance: none;\n}\n.menu-toggle div {\n position: relative;\n width: 64px;\n height: 64px;\n pointer-events: none;\n border-radius: 50%;\n background: black;\n border: 1px solid white;\n box-shadow: rgba(0, 0, 0, 33%) 0px 0 8px;\n}\n.menu-toggle:hover div {\n background-color: var(--background-color);\n border: 1px solid rgb(220, 220, 220);\n}\n.menu-toggle svg {\n position: absolute;\n top: 15px;\n left: 15px;\n width: 33px;\n height: 32px;\n}\ndiv.highlight-bg {\n position: absolute;\n top: -1px;\n left: -1px;\n background-color: rgb(26, 26, 26);\n pointer-events: none;\n transition: all 400ms ease-out;\n opacity: 0;\n}\n.menu-toggle-highlight-no-transition div.highlight-bg {\n transition: none;\n}\n.menu-toggle-highlight div.highlight-bg {\n opacity: 1;\n}\n.menu-toggle-tooltip {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 382px;\n height: 72px;\n padding: 0;\n text-align: left;\n appearance: none;\n background-color: transparent;\n border: none;\n pointer-events: none;\n transform: translate3d(320px, 0, 0);\n opacity: 0;\n transition: all 150ms ease-in-out;\n color: white;\n}\n.menu-toggle-tooltip.menu-toggle-tooltip-show {\n pointer-events: auto;\n opacity: 1;\n transform: translate3d(0, 0, 0);\n}\n.menu-toggle-tooltip-content {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 10px;\n right: 95px;\n padding: 8px 12px;\n background-color: var(--primary-color);\n box-shadow: rgba(0, 0, 0, 33%) 0px 0 20px;\n border-radius: 2px;\n}\n.menu-toggle-tooltip-content::before {\n content: "";\n position: absolute;\n bottom: 15px;\n right: -6px;\n width: 30px;\n height: 30px;\n background-color: var(--primary-color);\n transform: rotate(45deg);\n}\n.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,\n.menu-toggle-tooltip:hover .menu-toggle-tooltip-content::before {\n background-color: var(--primary-color-highlight);\n}\n.menu-toggle-tooltip-content h3 {\n margin: 0;\n font-size: 16px;\n}\n.menu-toggle-tooltip-content p {\n margin: 0;\n font-size: 12px;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-page.css */\nsection {\n position: absolute;\n display: grid;\n grid-template-rows: 64px auto 64px;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n pointer-events: none;\n}\n.section-content {\n margin: 0;\n padding: 0 0 10px 0;\n font-weight: 300;\n transform: translate3d(105%, 0, 0);\n transition: transform var(--transition-time) ease-in-out;\n overflow-y: auto;\n}\n.section-content .error {\n color: var(--error-color);\n font-weight: bold;\n}\nsection a {\n text-decoration: none;\n color: var(--text-color);\n}\nsection h3,\nsection p {\n margin-left: 16px;\n margin-right: 16px;\n}\n.info {\n font-size: 12px;\n}\nul.list {\n list-style: none;\n padding: 0;\n margin: 0;\n}\nul.list li {\n display: block;\n padding: 0;\n margin: 0;\n}\nul.list a,\nul.list button {\n display: grid;\n grid-template-columns: 24px auto;\n grid-gap: 16px;\n padding: 12px;\n margin: 8px 0;\n border: none;\n background: transparent;\n appearance: none;\n width: 100%;\n font-weight: 300;\n text-align: left;\n text-decoration: none;\n color: var(--text-color);\n}\nul.list a:hover,\nul.list button:hover {\n text-decoration: none;\n color: var(--text-color);\n background-color: var(--button-background-color-hover);\n}\nul.list a span,\nul.list button span {\n display: block;\n font-size: 16px;\n font-weight: 500;\n line-height: 1.5;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-header.css */\nheader {\n position: relative;\n display: grid;\n grid-template-columns: 44px 1fr;\n gap: 8px;\n padding-left: 8px;\n border-bottom: 1px solid var(--border-color);\n transition: opacity var(--transition-time) ease-in-out;\n opacity: 0;\n pointer-events: none;\n}\nheader > div {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.nav-home header > div {\n margin-right: 56px;\n}\nheader h2 {\n margin: 7px 0 0 0;\n font-size: 18px;\n font-weight: 500;\n line-height: 1.5;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p {\n margin: 2px 0 0 0;\n font-size: 12px;\n font-weight: 300;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p button {\n display: block;\n margin: 0;\n padding: 0;\n width: 100%;\n text-align: left;\n font-size: 12px;\n font-weight: 300;\n text-decoration: none;\n appearance: none;\n text-align: left;\n background-color: transparent;\n border: none;\n color: var(--primary-color);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\nheader p button:hover {\n text-decoration: underline;\n color: var(--primary-color);\n}\n.builder-logo {\n margin: 12px 0 0 8px;\n}\n#close {\n display: block;\n position: absolute;\n appearance: none;\n background: transparent;\n border: none;\n border-radius: 50%;\n margin: 0;\n padding: 0;\n right: 4px;\n top: 8px;\n width: 48px;\n height: 48px;\n z-index: 1;\n opacity: 0.7;\n}\n#close:hover {\n opacity: 1;\n background-color: var(--button-background-color-hover);\n}\n#close svg {\n position: absolute;\n top: 12px;\n left: 12px;\n width: 24px;\n height: 24px;\n fill: currentColor;\n pointer-events: none;\n}\n.back-button {\n position: relative;\n display: block;\n margin: 7px 0 0 -2px;\n width: 48px;\n height: 48px;\n background: transparent;\n border: none;\n appearance: none;\n border-radius: 50%;\n}\n.back-button:hover {\n background-color: var(--button-background-color-hover);\n}\n.back-button svg {\n position: absolute;\n top: 12px;\n left: 12px;\n width: 24px;\n height: 24px;\n fill: currentColor;\n pointer-events: none;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-footer.css */\nfooter {\n border-top: 1px solid var(--border-color);\n transition: opacity var(--transition-time) ease-in-out;\n opacity: 0;\n pointer-events: none;\n}\nsection.nav-cmp-list {\n grid-template-rows: 64px auto 120px;\n}\nfooter a {\n text-decoration: underline;\n color: var(--primary-color);\n}\nfooter a:hover {\n color: var(--primary-color);\n text-decoration: none;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-nav-list.css */\n.nav-list {\n padding: 2px 0;\n}\n.nav-loading {\n pointer-events: none;\n}\n.nav-loading-icon {\n position: absolute;\n display: inline-block;\n top: 170px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.nav-loading .nav-loading-icon {\n opacity: 0.5;\n}\n.nav-list h4 {\n margin: 8px 8px 8px 10px;\n font-size: 14px;\n font-weight: 600;\n}\n.nav-list .nav-list-item + h4 {\n margin-top: 30px;\n}\n.nav-list-item {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 8px;\n position: relative;\n margin: 2px 0;\n padding: 8px 28px 8px 46px;\n width: 100%;\n font-size: 14px;\n font-weight: 300;\n text-align: left;\n border: none;\n background: transparent;\n appearance: none;\n}\n.nav-list-item:hover {\n background-color: var(--button-background-color-hover);\n}\n.nav-list-item-icon {\n position: absolute;\n top: 4px;\n left: 10px;\n width: 24px;\n height: 24px;\n object-fit: contain;\n filter: invert(100%);\n background-size: 24px 24px;\n background-repeat: no-repeat;\n background-position: center center;\n}\n.nav-list-item span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n pointer-events: none;\n}\n.nav-list-item::after {\n display: block;\n position: absolute;\n content: "";\n background-image: url(\'data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>\');\n background-repeat: no-repeat;\n background-position: 12px 9px;\n top: 0;\n right: 0;\n width: 32px;\n height: 32px;\n pointer-events: none;\n}\n.nav-list-item-note {\n opacity: 0;\n font-size: 12px;\n padding-top: 1px;\n text-align: right;\n}\n.nav-list-item:hover .nav-list-item-note {\n opacity: 0.5;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-select.css */\n.ui-select {\n display: block;\n margin: 8px 0 16px 0;\n padding: 8px 16px 8px 16px;\n cursor: pointer;\n}\n.ui-select h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-select p {\n margin: 8px 0 8px 0;\n font-size: 12px;\n font-weight: 300;\n}\n.ui-select .select {\n position: relative;\n margin: 8px 0 8px 0;\n border-radius: 4px;\n padding: 0;\n line-height: 1.1;\n overflow: hidden;\n border: 1px solid var(--border-color);\n}\n.ui-select select {\n appearance: none;\n background-color: transparent;\n border: none;\n outline: none;\n padding: 8px 32px 8px 8px;\n margin: 0;\n width: 100%;\n font-size: 14px;\n cursor: pointer;\n text-overflow: ellipsis;\n opacity: 0.6;\n color: var(--text-color);\n}\n.ui-select .select::after {\n content: "";\n top: 6px;\n right: 5px;\n width: 24px;\n height: 24px;\n position: absolute;\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>\');\n background-repeat: no-repeat;\n background-position: center;\n pointer-events: none;\n opacity: 0.6;\n}\n.ui-select .select:hover {\n border-color: var(--primary-color-subdued);\n}\n.ui-text-input .select:focus-within {\n border-color: var(--primary-color);\n}\n.ui-text-input .select:focus-within select {\n opacity: 1;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-spinner.css */\n.spinner:after {\n content: " ";\n display: block;\n width: 32px;\n height: 32px;\n margin: 0 auto;\n pointer-events: auto;\n border-radius: 50%;\n border: 3px solid var(--text-color);\n border-color: var(--text-color) transparent var(--text-color) transparent;\n animation: spinner 750ms linear infinite;\n}\n@keyframes spinner {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n\n/* packages/dev-tools/client/menu/ui/ui-switch.css */\n.ui-switch {\n display: grid;\n grid-template-columns: auto 48px;\n grid-gap: 20px;\n margin: 8px 0 16px 0;\n padding: 8px 0 8px 16px;\n cursor: pointer;\n}\n.ui-switch > * {\n pointer-events: none;\n}\n.ui-switch input {\n display: none;\n visibility: hidden;\n}\n.ui-switch .switcher {\n display: inline-block;\n border-radius: 100px;\n width: 35px;\n height: 14px;\n background-color: #ccc;\n position: relative;\n top: 6px;\n vertical-align: middle;\n cursor: pointer;\n}\n.ui-switch input[type=checkbox]:checked + .switcher {\n background-color: var(--primary-color-subdued);\n}\n.ui-switch .switcher:before {\n content: "";\n display: block;\n width: 20px;\n height: 20px;\n background-color: var(--text-color);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);\n border-radius: 50%;\n position: absolute;\n top: -3px;\n left: 0;\n margin-right: 0;\n transition: all 150ms;\n}\n.ui-switch input[type=checkbox]:checked + .switcher:before {\n left: 100%;\n margin-left: -20px;\n background-color: var(--primary-color);\n}\n.ui-switch h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-switch p {\n margin: 4px 0 0 0;\n font-size: 12px;\n font-weight: 300;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-text-input.css */\n.ui-text-input {\n display: block;\n margin: 8px 0 16px 0;\n padding: 8px 16px 8px 16px;\n cursor: pointer;\n}\n.ui-text-input h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.ui-text-input p {\n margin: 8px 0 8px 0;\n font-size: 12px;\n font-weight: 300;\n}\n.ui-text-input .input {\n position: relative;\n margin: 8px 0 8px 0;\n border: 1px solid var(--border-color);\n border-radius: 4px;\n background: transparent;\n padding: 2px;\n overflow: hidden;\n}\n.ui-text-input input {\n display: block;\n width: 235px;\n font-size: 14px;\n border: none;\n background: transparent;\n padding: 6px;\n appearance: none;\n color: var(--text-color);\n opacity: 0.6;\n outline: none;\n}\n.ui-text-input .input:hover {\n border-color: var(--primary-color-subdued);\n}\n.ui-text-input .input:focus-within {\n border-color: var(--primary-color);\n}\n.ui-text-input .input:focus-within input {\n opacity: 1;\n}\n.ui-text-input .input::after {\n content: "";\n position: absolute;\n top: 5px;\n right: 14px;\n width: 8px;\n height: 17px;\n border: 2px solid rgba(51, 181, 51, 1);\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n opacity: 0;\n transition: opacity 80ms ease-in-out;\n pointer-events: none;\n}\n.ui-text-input.saved .input::after {\n opacity: 1;\n}\n\n/* packages/dev-tools/client/menu/ui/ui-toast.css */\n.ui-toast {\n position: fixed;\n bottom: 8px;\n left: 8px;\n right: 8px;\n padding: 6px 12px;\n font-size: 14px;\n border-radius: 4px;\n transform: translate3d(0, 150%, 0);\n opacity: 0;\n transition: all var(--transition-time) ease-in-out;\n background-color: var(--primary-color-subdued);\n color: var(--text-color);\n pointer-events: none;\n}\n.ui-toast.ui-toast-show {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n pointer-events: auto;\n}\n\n/* packages/dev-tools/client/menu/nav.css */\n[data-view=nav-home] .nav-home .section-content,\n[data-view=nav-cmp-list] .nav-cmp-list .section-content,\n[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,\n[data-view=nav-cmp-input] .nav-cmp-input .section-content,\n[data-view=nav-settings] .nav-settings .section-content {\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n}\n[data-view=nav-home] .nav-home header,\n[data-view=nav-home] .nav-home footer,\n[data-view=nav-cmp-list] .nav-cmp-list header,\n[data-view=nav-cmp-list] .nav-cmp-list footer,\n[data-view=nav-cmp-detail] .nav-cmp-detail header,\n[data-view=nav-cmp-detail] .nav-cmp-detail footer,\n[data-view=nav-cmp-input] .nav-cmp-input header,\n[data-view=nav-cmp-input] .nav-cmp-input footer,\n[data-view=nav-settings] .nav-settings header,\n[data-view=nav-settings] .nav-settings footer {\n opacity: 1;\n pointer-events: auto;\n}\n[data-view=nav-cmp-list] .nav-home .section-content,\n[data-view=nav-cmp-detail] .nav-home .section-content,\n[data-view=nav-cmp-detail] .nav-cmp-list .section-content,\n[data-view=nav-cmp-input] .nav-home .section-content,\n[data-view=nav-cmp-input] .nav-cmp-list .section-content,\n[data-view=nav-cmp-input] .nav-cmp-detail .section-content,\n[data-view=nav-settings] .nav-home .section-content {\n transform: translate3d(-105%, 0, 0);\n}\n\n/* packages/dev-tools/client/menu/pages/component-list.css */\n.cmp-item .nav-list-item-icon {\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>\');\n opacity: 0.3;\n}\n.cmp-item.registered .nav-list-item-icon {\n background-image: url(\'data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>\');\n opacity: 0.8;\n}\n.search-highlight {\n background-color: var(--primary-color-alpha);\n padding: 0 2px;\n border-radius: 2px;\n font-weight: 500;\n}\n.search-container {\n position: sticky;\n top: 0;\n z-index: 10;\n padding: 12px 16px;\n background: var(--background-color);\n border-bottom: 1px solid var(--border-color);\n}\n.search-input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n}\n.search-icon {\n position: absolute;\n left: 12px;\n color: var(--text-color-secondary);\n pointer-events: none;\n}\n.component-search-input {\n width: 100%;\n height: 36px;\n padding: 8px 36px;\n border: 1px solid var(--border-color);\n border-radius: 6px;\n background: var(--input-background);\n color: var(--text-color);\n font-size: 14px;\n transition: border-color 0.2s, box-shadow 0.2s;\n}\n.component-search-input:focus {\n outline: none;\n border-color: var(--primary-color);\n box-shadow: 0 0 0 2px var(--primary-color-alpha);\n}\n.component-search-input::placeholder {\n color: var(--text-color-tertiary);\n}\n.clear-search-button {\n position: absolute;\n right: 8px;\n padding: 4px;\n color: var(--text-color-secondary);\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s, background-color 0.2s;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.clear-search-button:hover {\n background-color: var(--hover-color);\n}\n.component-search-input:not(:placeholder-shown) + .clear-search-button {\n opacity: 1;\n}\n.no-results {\n padding: 32px 16px;\n text-align: center;\n color: var(--text-color-secondary);\n font-size: 14px;\n}\n\n/* packages/dev-tools/client/menu/pages/component-detail.css */\n#cmp-detail {\n position: relative;\n}\n.cmp-loading {\n pointer-events: none !important;\n}\n.cmp-loading-icon {\n position: absolute;\n display: inline-block;\n top: 170px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.cmp-loading .cmp-loading-icon {\n opacity: 0.5;\n}\n.cmp-cover {\n position: absolute;\n top: 160px;\n left: 0;\n width: 100%;\n height: 100vh;\n background: var(--background-color);\n transform: translate3d(0, 0, 0);\n pointer-events: none;\n display: none;\n}\n[data-view=nav-cmp-detail] .cmp-cover {\n display: block;\n pointer-events: auto;\n}\n.cmp-enabled .cmp-cover {\n transform: translate3d(0, 105%, 0);\n pointer-events: none;\n}\n.section-ready .cmp-cover {\n transition: all var(--transition-time) ease-in-out;\n}\n.cmp-detail-inputs-container {\n margin: 8px 0 16px 0;\n padding: 0;\n}\n.cmp-detail-inputs-container h3 {\n margin: 0 0 6px 0;\n padding-left: 16px;\n padding-right: 8px;\n font-size: 14px;\n font-weight: 500;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.cmp-detail-inputs-reload {\n font-weight: 300;\n font-size: 0.9em;\n text-decoration: none;\n appearance: none;\n text-align: left;\n background-color: transparent;\n border: none;\n color: var(--primary-color);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.cmp-detail-inputs-reload:hover {\n text-decoration: underline;\n color: var(--primary-color);\n}\n.cmp-detail-inputs-container .cmp-inputs-empty {\n padding: 0;\n margin-top: 12px;\n font-size: 12px;\n font-weight: 300;\n opacity: 0.5;\n font-style: italic;\n}\n.cmp-detail-inputs-container .nav-list-item-icon {\n opacity: 0.8;\n background-size: 20px 20px;\n background-position: 4px center;\n}\n.input-icon {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>\');\n}\n.input-icon-array {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>\');\n}\n.input-icon-boolean {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>\');\n}\n.input-icon-number {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>\');\n}\n.input-icon-object {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>\');\n}\n.input-icon-string {\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>\');\n}\n.cmp-input-item-unregistered {\n opacity: 0.4;\n}\n.cmp-input-item-unregistered .input-icon::after {\n content: "";\n position: absolute;\n top: 11px;\n left: 4px;\n width: 20px;\n height: 2px;\n background-color: black;\n transform: rotate(-45deg);\n}\n\n/* packages/dev-tools/client/menu/pages/component-input.css */\n.cmp-prop-info {\n border-bottom: 1px solid var(--border-color);\n}\n.cmp-input-readonly {\n margin: 16px 0;\n padding: 0 16px;\n display: grid;\n grid-template-columns: 50% 50%;\n gap: 12px;\n}\n.cmp-input-readonly h3 {\n margin: 0;\n font-size: 14px;\n font-weight: 500;\n}\n.cmp-input-readonly span {\n margin-top: 2px;\n font-size: 12px;\n font-weight: 300;\n opacity: 0.8;\n}\n.cmp-input-detail {\n margin: 16px 0;\n}\n.cmp-input-detail a {\n color: var(--primary-color);\n text-decoration: none;\n}\n.cmp-input-detail a:hover {\n text-decoration: underline;\n}\n.input-cover {\n position: absolute;\n top: 175px;\n left: 0;\n width: 100%;\n height: 100%;\n background: var(--background-color);\n transform: translate3d(0, 0, 0);\n transition: all var(--transition-time) ease-in-out;\n pointer-events: auto;\n}\n.input-enabled .input-cover {\n transform: translate3d(0, 105%, 0);\n pointer-events: none;\n}\n.input-loading-icon {\n position: absolute;\n display: inline-block;\n top: 190px;\n left: 0;\n width: 100%;\n transform: translate3d(0, 0, 0);\n pointer-events: auto;\n opacity: 0;\n transition: all 50ms ease-in-out;\n transition-delay: 50ms;\n pointer-events: none;\n}\n.input-loading .input-loading-icon {\n opacity: 0.5;\n}\n\n/* packages/dev-tools/client/menu/menu.css */\n:host {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 2147483646;\n user-select: none;\n pointer-events: none;\n color: var(--text-color);\n}\naside {\n position: absolute;\n top: 0;\n right: 0;\n width: var(--menu-width);\n height: 100%;\n transform: translate3d(105%, 0, 0);\n transition: transform var(--transition-time) ease-in-out;\n background: var(--background-color);\n box-shadow: #000000c9 5px 0 20px;\n overflow: hidden;\n z-index: 1;\n}\n:host(.show-builder-menu) aside {\n pointer-events: auto;\n transform: translate3d(0, 0, 0);\n}\n#hit {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: none;\n}\n:host(.show-builder-menu) #hit {\n display: block;\n pointer-events: auto;\n}\n#version {\n position: absolute;\n bottom: 6px;\n right: 6px;\n font-size: 8px;\n color: #9b9b9b;\n}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder\'s selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder\'s Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder\'s Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>`;\n initMenuToggle(shadow);\n initHomeSection(shadow);\n initComponentListSection(shadow);\n initComponentDetailSection(shadow);\n initComponentInputSection(shadow);\n initSettingsSection(shadow);\n this.setAttribute("aria-hidden", "true");\n shadow.getElementById("version").textContent = "v1.18.14-dev.202511251716.8d6784f55";\n }\n highlightOpener() {\n const menuToggle = this.shadowRoot.querySelector(".menu-toggle");\n menuToggle.classList.add("menu-toggle-highlight");\n menuToggle.classList.add("menu-toggle-highlight-no-transition");\n setTimeout(() => {\n menuToggle.classList.remove("menu-toggle-highlight-no-transition");\n setTimeout(() => {\n menuToggle.classList.remove("menu-toggle-highlight");\n }, 20);\n }, 20);\n }\n };\n\n // packages/dev-tools/client/setup-ui/overview.ts\n var STEP_CSS = `<style>/* packages/dev-tools/client/setup-ui/styles.css */\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\nhtml,\nbody,\n:host {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n z-index: 2147483646;\n margin: 0;\n padding: 0;\n line-height: 1.8;\n font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n "Noto Sans",\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n background-color: rgba(37, 37, 37, 1);\n color: white;\n transition: opacity 250ms ease-in-out;\n}\n:host([aria-hidden="true"]) {\n opacity: 0;\n pointer-events: none;\n}\nmain {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n}\nh1 {\n margin-top: 0;\n font-size: 24px;\n font-weight: 300;\n line-height: 1.4;\n}\np {\n margin: 20px 0;\n font-weight: 300;\n}\nbutton {\n cursor: pointer;\n}\naside {\n position: absolute;\n top: 0;\n left: 0;\n width: 350px;\n height: 100vh;\n padding: 60px 0 0 50px;\n background-color: rgba(18, 18, 18, 1);\n}\naside ul {\n margin: 30px 0 0 0px;\n padding: 0;\n list-style: none;\n}\naside li {\n position: relative;\n margin: 0;\n padding: 20px 10px;\n font-weight: 300;\n}\naside li.highlight {\n color: rgba(72, 161, 255, 1);\n}\naside li.active {\n font-weight: 700;\n}\naside li .circle {\n position: absolute;\n top: 20px;\n left: 10px;\n width: 24px;\n height: 24px;\n border: 3px solid white;\n border-radius: 50%;\n font-size: 14px;\n}\naside li.highlight .circle {\n border-color: rgba(72, 161, 255, 1);\n}\naside li.active .circle::after {\n content: "";\n position: absolute;\n top: 3px;\n left: 3px;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle {\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle::after {\n content: "";\n position: absolute;\n top: 2px;\n left: 6px;\n width: 6px;\n height: 13px;\n border: 3px solid black;\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n}\naside li .line {\n position: absolute;\n top: 44px;\n left: 21px;\n width: 3px;\n height: 45px;\n background-color: white;\n}\naside li.completed .line {\n background-color: rgba(72, 161, 255, 1);\n}\naside li span {\n display: block;\n margin-left: 44px;\n}\nnav {\n margin-top: 30px;\n}\nsection {\n position: absolute;\n top: 135px;\n left: 350px;\n padding: 0 80px 0 140px;\n transition: opacity 150ms ease-in-out;\n}\nsection[aria-hidden=true] {\n pointer-events: none;\n opacity: 0;\n}\nsection h1,\nsection p {\n min-width: 300px;\n max-width: 600px;\n}\n.button {\n position: relative;\n display: inline-block;\n color: white;\n background-color: rgba(72, 161, 255, 1);\n border-radius: 4px;\n text-decoration: none;\n padding: 10px 40px 10px 20px;\n white-space: nowrap;\n}\n.button:hover {\n background-color: rgba(72, 161, 255, 0.85);\n}\n#button-icon {\n position: absolute;\n top: 1px;\n right: 5px;\n bottom: 0;\n width: 30px;\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>\');\n background-repeat: no-repeat;\n background-position: center;\n background-size: 24px 24px;\n}\n.button[aria-disabled=true] {\n opacity: 0.9;\n background-color: rgba(255, 255, 255, 0.3);\n pointer-events: none;\n padding-right: 60px;\n}\n.button[aria-disabled=true] #button-icon {\n top: 21px;\n right: 29px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background: white;\n color: white;\n animation: dot-flashing 0.5s infinite linear alternate;\n animation-delay: 0.25s;\n}\n.button[aria-disabled=true] #button-icon::before,\n.button[aria-disabled=true] #button-icon::after {\n content: "";\n display: inline-block;\n position: absolute;\n top: 0;\n}\n.button[aria-disabled=true] #button-icon::before {\n left: -12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0s;\n}\n.button[aria-disabled=true] #button-icon::after {\n left: 12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0.5s;\n}\n@keyframes dot-flashing {\n 0% {\n background-color: white;\n }\n 50%, 100% {\n background-color: rgba(255, 255, 255, 0.3);\n }\n}\n.logo {\n margin-left: 9px;\n background: url(\'data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>\');\n background-repeat: no-repeat;\n width: 150px;\n height: 32px;\n}\n@media (max-width: 840px) {\n aside {\n width: 250px;\n padding: 60px 0 0 20px;\n }\n section {\n left: 250px;\n padding: 0 80px;\n }\n}\n@media (max-width: 590px) {\n aside {\n width: 230px;\n padding: 60px 0 0 10px;\n }\n section {\n left: 230px;\n padding: 0 40px;\n }\n}\n#modified-files-message a {\n color: #cbcbcb;\n font-weight: 300;\n text-decoration: underline;\n}\n#modified-files-message a:hover {\n color: white;\n text-decoration: none;\n}\n#restart-warning {\n border-radius: 4px;\n padding: 8px 16px;\n border: 1px solid #fd6b3c;\n background: rgba(253, 107, 60, 0.1);\n}\n#react-router-steps {\n margin: 0px;\n margin-bottom: 5px;\n padding: 0px 20px;\n}\n#need-help {\n color: #48a1ff;\n text-decoration: none;\n}\n#router-message {\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #48a1ff;\n}\n#router-finish-button {\n margin-top: 12px;\n}\n#router-checkbox-div {\n display: flex;\n align-items: center;\n}\n#router-checkbox {\n margin-right: 10px;\n width: 15px;\n height: 15px;\n}\n#success-title {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n#success-title .check-icon {\n display: inline-block;\n width: 24px;\n height: 24px;\n border: 2px solid #28a745;\n border-radius: 50%;\n position: relative;\n}\n#success-title .check-icon::before {\n content: "";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 6px;\n height: 12px;\n border: solid #28a745;\n border-width: 0 2px 2px 0;\n transform: translate(-50%, -60%) rotate(45deg);\n}\n</style>`;\n var BuilderOverviewStep = class extends HTMLElement {\n constructor() {\n super();\n }\n connectedCallback() {\n const shadow = this.attachShadow({ mode: "open" });\n shadow.innerHTML = STEP_CSS + `<main>\n <aside>\n <div class="logo"></div>\n\n <ul>\n <li class="highlight active">\n <div class="circle"></div>\n <div class="line"></div>\n <span>Connect Builder.io</span>\n </li>\n <li>\n <div class="circle"></div>\n <div class="line"></div>\n <span>Update App</span>\n </li>\n <li>\n <div class="circle"></div>\n <span>Setup Complete</span>\n </li>\n </ul>\n </aside>\n\n <section>\n <h1>Integrate Builder.io with your project</h1>\n\n <p>\n First, let\'s connect to your Builder.io space to continue with the\n integration\n </p>\n\n <nav>\n <a class="button next-step" href="#">\n <span id="button-text">Get Started</span>\n <span id="button-icon"></span>\n </a>\n </nav>\n </section>\n</main>\n`;\n setBuilderHead();\n const authPath = new URL(BUILDER_AUTH_CONNECT_PATH, DEV_TOOLS_URL);\n authPath.searchParams.set(PREVIEW_URL_QS, location.href);\n const nextStepLinks = shadow.querySelectorAll(".next-step");\n for (const nextStepLink of nextStepLinks) {\n nextStepLink.setAttribute("href", authPath.href);\n }\n track("overview step viewed");\n }\n };\n var setBuilderHead = () => {\n let favicon = document.head.querySelector(\n "link[rel=\'icon\'], link[rel=\'icon shortcut\']"\n );\n if (favicon) {\n favicon.href = "https://cdn.builder.io/favicon.ico";\n favicon.removeAttribute("type");\n } else {\n favicon = document.createElement("link");\n favicon.rel = "icon";\n favicon.href = "https://cdn.builder.io/favicon.ico";\n document.head.appendChild(favicon);\n }\n };\n\n // packages/dev-tools/client/setup-ui/index.ts\n var checkBuilderIntegration = async () => {\n const validatedBuilder = await apiValidateBuilder();\n if (!validatedBuilder.isValid) {\n showOverviewStep();\n }\n };\n var showOverviewStep = () => {\n if (!customElements.get("builder-dev-tools-overview")) {\n customElements.define("builder-dev-tools-overview", BuilderOverviewStep);\n }\n let overview = document.querySelector(\n "builder-dev-tools-overview"\n );\n if (!overview) {\n overview = document.createElement(\n "builder-dev-tools-overview"\n );\n overview.setAttribute("aria-hidden", "true");\n document.body.appendChild(overview);\n }\n setTimeout(() => {\n overview.removeAttribute("aria-hidden");\n }, 32);\n };\n\n // packages/dev-tools/client/index.ts\n var initDevToolsApp = () => {\n try {\n if (!customElements.get("builder-dev-tools-edit")) {\n customElements.define(\n "builder-dev-tools-edit",\n BuilderDevToolsEditButton\n );\n }\n if (!customElements.get("builder-dev-tools-menu")) {\n customElements.define("builder-dev-tools-menu", BuilderDevToolsMenu);\n }\n let menu = document.querySelector("builder-dev-tools-menu");\n if (!menu) {\n menu = document.createElement("builder-dev-tools-menu");\n menu.setAttribute("data-version", "1.18.14-dev.202511251716.8d6784f55");\n document.body.appendChild(menu);\n }\n let editButton = document.querySelector("builder-dev-tools-edit");\n if (!editButton) {\n editButton = document.createElement("builder-dev-tools-edit");\n document.body.appendChild(editButton);\n }\n let builderStyles = document.getElementById("builder-dev-tools-style");\n if (!builderStyles) {\n builderStyles = document.createElement("style");\n builderStyles.id = "builder-dev-tools-style";\n builderStyles.innerHTML = `.builder-no-scroll{overflow:hidden !important}`;\n document.head.appendChild(builderStyles);\n }\n checkBuilderIntegration();\n initTracking();\n } catch (e) {\n console.error("Builder Devtools:", e);\n }\n };\n if (window.location === window.parent.location) {\n console.debug(`Builder.io Devtools v${"1.18.14-dev.202511251716.8d6784f55"}`);\n initDevToolsApp();\n }\n})();');
|
|
62589
62589
|
}
|
|
62590
62590
|
async function getConnectedStepHtml(ctx) {
|
|
62591
62591
|
return updateClientRuntimeVariables(ctx, '<!doctype html>\n<html lang="en" dir="ltr">\n <head>\n <meta charset="utf-8" />\n <script>\n (function (window) {\n if (window.location !== window.top.location) {\n window.top.location = window.location;\n }\n })(this);\n </script>\n <title>Successfully Connected With Builder.io</title>\n <style>/* packages/dev-tools/client/setup-ui/styles.css */\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\nhtml,\nbody,\n:host {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n z-index: 2147483646;\n margin: 0;\n padding: 0;\n line-height: 1.8;\n font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n Roboto,\n "Helvetica Neue",\n Arial,\n "Noto Sans",\n sans-serif,\n "Apple Color Emoji",\n "Segoe UI Emoji",\n "Segoe UI Symbol",\n "Noto Color Emoji";\n background-color: rgba(37, 37, 37, 1);\n color: white;\n transition: opacity 250ms ease-in-out;\n}\n:host([aria-hidden="true"]) {\n opacity: 0;\n pointer-events: none;\n}\nmain {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100vh;\n}\nh1 {\n margin-top: 0;\n font-size: 24px;\n font-weight: 300;\n line-height: 1.4;\n}\np {\n margin: 20px 0;\n font-weight: 300;\n}\nbutton {\n cursor: pointer;\n}\naside {\n position: absolute;\n top: 0;\n left: 0;\n width: 350px;\n height: 100vh;\n padding: 60px 0 0 50px;\n background-color: rgba(18, 18, 18, 1);\n}\naside ul {\n margin: 30px 0 0 0px;\n padding: 0;\n list-style: none;\n}\naside li {\n position: relative;\n margin: 0;\n padding: 20px 10px;\n font-weight: 300;\n}\naside li.highlight {\n color: rgba(72, 161, 255, 1);\n}\naside li.active {\n font-weight: 700;\n}\naside li .circle {\n position: absolute;\n top: 20px;\n left: 10px;\n width: 24px;\n height: 24px;\n border: 3px solid white;\n border-radius: 50%;\n font-size: 14px;\n}\naside li.highlight .circle {\n border-color: rgba(72, 161, 255, 1);\n}\naside li.active .circle::after {\n content: "";\n position: absolute;\n top: 3px;\n left: 3px;\n width: 12px;\n height: 12px;\n border-radius: 50%;\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle {\n background-color: rgba(72, 161, 255, 1);\n}\naside li.completed .circle::after {\n content: "";\n position: absolute;\n top: 2px;\n left: 6px;\n width: 6px;\n height: 13px;\n border: 3px solid black;\n border-top: none;\n border-left: none;\n transform: rotate(45deg);\n}\naside li .line {\n position: absolute;\n top: 44px;\n left: 21px;\n width: 3px;\n height: 45px;\n background-color: white;\n}\naside li.completed .line {\n background-color: rgba(72, 161, 255, 1);\n}\naside li span {\n display: block;\n margin-left: 44px;\n}\nnav {\n margin-top: 30px;\n}\nsection {\n position: absolute;\n top: 135px;\n left: 350px;\n padding: 0 80px 0 140px;\n transition: opacity 150ms ease-in-out;\n}\nsection[aria-hidden=true] {\n pointer-events: none;\n opacity: 0;\n}\nsection h1,\nsection p {\n min-width: 300px;\n max-width: 600px;\n}\n.button {\n position: relative;\n display: inline-block;\n color: white;\n background-color: rgba(72, 161, 255, 1);\n border-radius: 4px;\n text-decoration: none;\n padding: 10px 40px 10px 20px;\n white-space: nowrap;\n}\n.button:hover {\n background-color: rgba(72, 161, 255, 0.85);\n}\n#button-icon {\n position: absolute;\n top: 1px;\n right: 5px;\n bottom: 0;\n width: 30px;\n background-image: url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>\');\n background-repeat: no-repeat;\n background-position: center;\n background-size: 24px 24px;\n}\n.button[aria-disabled=true] {\n opacity: 0.9;\n background-color: rgba(255, 255, 255, 0.3);\n pointer-events: none;\n padding-right: 60px;\n}\n.button[aria-disabled=true] #button-icon {\n top: 21px;\n right: 29px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background: white;\n color: white;\n animation: dot-flashing 0.5s infinite linear alternate;\n animation-delay: 0.25s;\n}\n.button[aria-disabled=true] #button-icon::before,\n.button[aria-disabled=true] #button-icon::after {\n content: "";\n display: inline-block;\n position: absolute;\n top: 0;\n}\n.button[aria-disabled=true] #button-icon::before {\n left: -12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0s;\n}\n.button[aria-disabled=true] #button-icon::after {\n left: 12px;\n width: 8px;\n height: 8px;\n border-radius: 4px;\n background-color: white;\n color: white;\n animation: dot-flashing 0.5s infinite alternate;\n animation-delay: 0.5s;\n}\n@keyframes dot-flashing {\n 0% {\n background-color: white;\n }\n 50%, 100% {\n background-color: rgba(255, 255, 255, 0.3);\n }\n}\n.logo {\n margin-left: 9px;\n background: url(\'data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>\');\n background-repeat: no-repeat;\n width: 150px;\n height: 32px;\n}\n@media (max-width: 840px) {\n aside {\n width: 250px;\n padding: 60px 0 0 20px;\n }\n section {\n left: 250px;\n padding: 0 80px;\n }\n}\n@media (max-width: 590px) {\n aside {\n width: 230px;\n padding: 60px 0 0 10px;\n }\n section {\n left: 230px;\n padding: 0 40px;\n }\n}\n#modified-files-message a {\n color: #cbcbcb;\n font-weight: 300;\n text-decoration: underline;\n}\n#modified-files-message a:hover {\n color: white;\n text-decoration: none;\n}\n#restart-warning {\n border-radius: 4px;\n padding: 8px 16px;\n border: 1px solid #fd6b3c;\n background: rgba(253, 107, 60, 0.1);\n}\n#react-router-steps {\n margin: 0px;\n margin-bottom: 5px;\n padding: 0px 20px;\n}\n#need-help {\n color: #48a1ff;\n text-decoration: none;\n}\n#router-message {\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #48a1ff;\n}\n#router-finish-button {\n margin-top: 12px;\n}\n#router-checkbox-div {\n display: flex;\n align-items: center;\n}\n#router-checkbox {\n margin-right: 10px;\n width: 15px;\n height: 15px;\n}\n#success-title {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n#success-title .check-icon {\n display: inline-block;\n width: 24px;\n height: 24px;\n border: 2px solid #28a745;\n border-radius: 50%;\n position: relative;\n}\n#success-title .check-icon::before {\n content: "";\n position: absolute;\n top: 50%;\n left: 50%;\n width: 6px;\n height: 12px;\n border: solid #28a745;\n border-width: 0 2px 2px 0;\n transform: translate(-50%, -60%) rotate(45deg);\n}\n</style>\n <link rel="icon shortcut" href="https://cdn.builder.io/favicon.ico" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n </head>\n <body>\n <main>\n <aside>\n <div class="logo"></div>\n\n <ul>\n <li class="highlight completed">\n <div class="circle"></div>\n <div class="line"></div>\n <span>Connect Builder.io</span>\n </li>\n <li id="step-update-app" class="highlight active">\n <div class="circle"></div>\n <div class="line"></div>\n <span>Update App</span>\n </li>\n <li id="step-setup-complete">\n <div class="circle"></div>\n <span>Setup Complete</span>\n </li>\n </ul>\n </aside>\n\n <section id="updating" aria-hidden="false">\n <h1>Updating App to include Builder.io</h1>\n <p>\n We\'re making some updates so Builder can be used within this\n project.<br />\n This usually takes less than a minute to complete.\n </p>\n\n <nav>\n <p>\n <a id="completing" class="button" aria-disabled="true" href="#">\n <span id="button-text">Updating</span>\n <span id="button-icon"></span>\n </a>\n </p>\n </nav>\n </section>\n\n <section id="success" aria-hidden="true">\n <h1 id="success-title">\n Connection Successful\n <div class="check-icon"></div>\n </h1>\n\n <p>\n Your project is now ready to work with Builder! You can close this tab\n and return to Builder or your development project to continue.\n </p>\n\n <div id="modified-files-message" hidden>\n <p>\n We\'ve made a few updates to your app to help integrate Builder.io:\n </p>\n <ul id="modified-files-list"></ul>\n </div>\n\n <p id="restart-warning" hidden>\n Please restart the dev server to ensure the changes take effect, then\n reload this page.\n </p>\n\n <div id="router-message" hidden>\n <!-- Route message for react -->\n <div id="react-message-section" hidden>\n <span\n >Next, add the following path and component in your React app\n routing setup</span\n >\n <ol id="react-router-steps">\n <li>\n Update path to <strong>\'/builder-demo\'</strong> or\n <strong>\'/*\'</strong>\n </li>\n <li>\n Add <strong>\'BuilderPage\'</strong> component from\n <code>builder-page</code> file\n </li>\n </ol>\n </div>\n\n <!-- Route message for angular -->\n <div id="angular-message-section" hidden>\n <span\n >Next, add the following path for Builder page in your Angular\n routes</span\n >\n <ol id="angular-router-steps">\n <li>\n Update path to <strong>\'builder-demo\'</strong> or\n <strong>\'**\'</strong>\n </li>\n <li>\n Add <strong>\'BuilderPage\'</strong> component from\n <code>builder-page.component</code> file\n </li>\n </ol>\n </div>\n\n <a id="need-help" href="#" hidden>\n <span id="help-text">Need help?</span>\n <span id="help-icon"></span>\n </a>\n <div id="router-checkbox-div"></div>\n </div>\n <div id="router-finish-button" hidden>\n <a class="button next-step" href="#">\n <span id="button-text">Finish</span>\n <span id="button-icon"></span>\n </a>\n </div>\n\n <nav id="go-to-app" hidden>\n <p hidden>Your new app is ready for Builder content! Let\'s go!</p>\n <p>\n <a class="button next-step" href="#">\n <span id="button-text">Go</span>\n <span id="button-icon"></span>\n </a>\n </p>\n </nav>\n </section>\n\n <section id="error" aria-hidden="true">\n <h1>Oops!</h1>\n <p>Looks like we tripped up on an issue!</p>\n <ul id="error-messages"></ul>\n </section>\n\n <section id="restart-server" aria-hidden="true">\n <h1>Please Restart Your Dev Server</h1>\n <p>\n We\'ve made updates to your application, please restart your dev server\n to ensure the changes take effect.\n </p>\n <p>\n <a id="completing" class="button" aria-disabled="true" href="#">\n <span id="button-text">Please restart your dev server</span>\n <span id="button-icon"></span>\n </a>\n </p>\n </section>\n </main>\n <script>"use strict";\n(() => {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. "__esModule" has not been set), then set\n // "default" to the CommonJS "module.exports" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,\n mod\n ));\n\n // node_modules/@amplitude/ua-parser-js/src/ua-parser.js\n var require_ua_parser = __commonJS({\n "node_modules/@amplitude/ua-parser-js/src/ua-parser.js"(exports, module) {\n (function(window2, undefined2) {\n "use strict";\n var LIBVERSION = "0.7.33", EMPTY = "", UNKNOWN = "?", FUNC_TYPE = "function", UNDEF_TYPE = "undefined", OBJ_TYPE = "object", STR_TYPE = "string", MAJOR = "major", MODEL = "model", NAME = "name", TYPE = "type", VENDOR = "vendor", VERSION2 = "version", ARCHITECTURE = "architecture", CONSOLE = "console", MOBILE = "mobile", TABLET = "tablet", SMARTTV = "smarttv", WEARABLE = "wearable", EMBEDDED = "embedded", UA_MAX_LENGTH = 350;\n var AMAZON = "Amazon", APPLE = "Apple", ASUS = "ASUS", BLACKBERRY = "BlackBerry", BROWSER = "Browser", CHROME = "Chrome", EDGE = "Edge", FIREFOX = "Firefox", GOOGLE = "Google", HUAWEI = "Huawei", LG = "LG", MICROSOFT = "Microsoft", MOTOROLA = "Motorola", OPERA = "Opera", SAMSUNG = "Samsung", SHARP = "Sharp", SONY = "Sony", XIAOMI = "Xiaomi", ZEBRA = "Zebra", FACEBOOK = "Facebook";\n var extend = function(regexes2, extensions) {\n var mergedRegexes = {};\n for (var i in regexes2) {\n if (extensions[i] && extensions[i].length % 2 === 0) {\n mergedRegexes[i] = extensions[i].concat(regexes2[i]);\n } else {\n mergedRegexes[i] = regexes2[i];\n }\n }\n return mergedRegexes;\n }, enumerize = function(arr) {\n var enums = {};\n for (var i = 0; i < arr.length; i++) {\n enums[arr[i].toUpperCase()] = arr[i];\n }\n return enums;\n }, has = function(str1, str2) {\n return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;\n }, lowerize = function(str) {\n return str.toLowerCase();\n }, majorize = function(version) {\n return typeof version === STR_TYPE ? version.replace(/[^\\d\\.]/g, EMPTY).split(".")[0] : undefined2;\n }, trim = function(str, len) {\n if (typeof str === STR_TYPE) {\n str = str.replace(/^\\s\\s*/, EMPTY);\n return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);\n }\n };\n var rgxMapper = function(ua, arrays) {\n var i = 0, j, k, p, q, matches, match;\n while (i < arrays.length && !matches) {\n var regex = arrays[i], props = arrays[i + 1];\n j = k = 0;\n while (j < regex.length && !matches) {\n matches = regex[j++].exec(ua);\n if (!!matches) {\n for (p = 0; p < props.length; p++) {\n match = matches[++k];\n q = props[p];\n if (typeof q === OBJ_TYPE && q.length > 0) {\n if (q.length === 2) {\n if (typeof q[1] == FUNC_TYPE) {\n this[q[0]] = q[1].call(this, match);\n } else {\n this[q[0]] = q[1];\n }\n } else if (q.length === 3) {\n if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {\n this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined2;\n } else {\n this[q[0]] = match ? match.replace(q[1], q[2]) : undefined2;\n }\n } else if (q.length === 4) {\n this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined2;\n }\n } else {\n this[q] = match ? match : undefined2;\n }\n }\n }\n }\n i += 2;\n }\n }, strMapper = function(str, map) {\n for (var i in map) {\n if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {\n for (var j = 0; j < map[i].length; j++) {\n if (has(map[i][j], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n } else if (has(map[i], str)) {\n return i === UNKNOWN ? undefined2 : i;\n }\n }\n return str;\n };\n var oldSafariMap = {\n "1.0": "/8",\n 1.2: "/1",\n 1.3: "/3",\n "2.0": "/412",\n "2.0.2": "/416",\n "2.0.3": "/417",\n "2.0.4": "/419",\n "?": "/"\n }, windowsVersionMap = {\n ME: "4.90",\n "NT 3.11": "NT3.51",\n "NT 4.0": "NT4.0",\n 2e3: "NT 5.0",\n XP: ["NT 5.1", "NT 5.2"],\n Vista: "NT 6.0",\n 7: "NT 6.1",\n 8: "NT 6.2",\n 8.1: "NT 6.3",\n 10: ["NT 6.4", "NT 10.0"],\n RT: "ARM"\n };\n var regexes = {\n browser: [\n [\n /\\b(?:crmo|crios)\\/([\\w\\.]+)/i\n // Chrome for Android/iOS\n ],\n [VERSION2, [NAME, "Chrome"]],\n [\n /edg(?:e|ios|a)?\\/([\\w\\.]+)/i\n // Microsoft Edge\n ],\n [VERSION2, [NAME, "Edge"]],\n [\n // Presto based\n /(opera mini)\\/([-\\w\\.]+)/i,\n // Opera Mini\n /(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,\n // Opera Mobi/Tablet\n /(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i\n // Opera\n ],\n [NAME, VERSION2],\n [\n /opios[\\/ ]+([\\w\\.]+)/i\n // Opera mini on iphone >= 8.0\n ],\n [VERSION2, [NAME, OPERA + " Mini"]],\n [\n /\\bopr\\/([\\w\\.]+)/i\n // Opera Webkit\n ],\n [VERSION2, [NAME, OPERA]],\n [\n // Mixed\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,\n // Lunascape/Maxthon/Netfront/Jasmine/Blazer\n // Trident based\n /(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,\n // Avant/IEMobile/SlimBrowser\n /(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,\n // Baidu Browser\n /(?:ms|\\()(ie) ([\\w\\.]+)/i,\n // Internet Explorer\n // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon\n /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,\n // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ\n /(weibo)__([\\d\\.]+)/i\n // Weibo\n ],\n [NAME, VERSION2],\n [\n /(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i\n // UCBrowser\n ],\n [VERSION2, [NAME, "UC" + BROWSER]],\n [\n /microm.+\\bqbcore\\/([\\w\\.]+)/i,\n // WeChat Desktop for Windows Built-in Browser\n /\\bqbcore\\/([\\w\\.]+).+microm/i\n ],\n [VERSION2, [NAME, "WeChat(Win) Desktop"]],\n [\n /micromessenger\\/([\\w\\.]+)/i\n // WeChat\n ],\n [VERSION2, [NAME, "WeChat"]],\n [\n /konqueror\\/([\\w\\.]+)/i\n // Konqueror\n ],\n [VERSION2, [NAME, "Konqueror"]],\n [\n /trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i\n // IE11\n ],\n [VERSION2, [NAME, "IE"]],\n [\n /yabrowser\\/([\\w\\.]+)/i\n // Yandex\n ],\n [VERSION2, [NAME, "Yandex"]],\n [\n /(avast|avg)\\/([\\w\\.]+)/i\n // Avast/AVG Secure Browser\n ],\n [[NAME, /(.+)/, "$1 Secure " + BROWSER], VERSION2],\n [\n /\\bfocus\\/([\\w\\.]+)/i\n // Firefox Focus\n ],\n [VERSION2, [NAME, FIREFOX + " Focus"]],\n [\n /\\bopt\\/([\\w\\.]+)/i\n // Opera Touch\n ],\n [VERSION2, [NAME, OPERA + " Touch"]],\n [\n /coc_coc\\w+\\/([\\w\\.]+)/i\n // Coc Coc Browser\n ],\n [VERSION2, [NAME, "Coc Coc"]],\n [\n /dolfin\\/([\\w\\.]+)/i\n // Dolphin\n ],\n [VERSION2, [NAME, "Dolphin"]],\n [\n /coast\\/([\\w\\.]+)/i\n // Opera Coast\n ],\n [VERSION2, [NAME, OPERA + " Coast"]],\n [\n /miuibrowser\\/([\\w\\.]+)/i\n // MIUI Browser\n ],\n [VERSION2, [NAME, "MIUI " + BROWSER]],\n [\n /fxios\\/([-\\w\\.]+)/i\n // Firefox for iOS\n ],\n [VERSION2, [NAME, FIREFOX]],\n [\n /\\bqihu|(qi?ho?o?|360)browser/i\n // 360\n ],\n [[NAME, "360 " + BROWSER]],\n [/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],\n [[NAME, /(.+)/, "$1 " + BROWSER], VERSION2],\n [\n // Oculus/Samsung/Sailfish/Huawei Browser\n /(comodo_dragon)\\/([\\w\\.]+)/i\n // Comodo Dragon\n ],\n [[NAME, /_/g, " "], VERSION2],\n [\n /(electron)\\/([\\w\\.]+) safari/i,\n // Electron-based App\n /(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,\n // Tesla\n /m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i\n // QQBrowser/Baidu App/2345 Browser\n ],\n [NAME, VERSION2],\n [\n /(metasr)[\\/ ]?([\\w\\.]+)/i,\n // SouGouBrowser\n /(lbbrowser)/i,\n // LieBao Browser\n /\\[(linkedin)app\\]/i\n // LinkedIn App for iOS & Android\n ],\n [NAME],\n [\n // WebView\n /((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i\n // Facebook App for iOS & Android\n ],\n [[NAME, FACEBOOK], VERSION2],\n [\n /safari (line)\\/([\\w\\.]+)/i,\n // Line App for iOS\n /\\b(line)\\/([\\w\\.]+)\\/iab/i,\n // Line App for Android\n /(chromium|instagram)[\\/ ]([-\\w\\.]+)/i\n // Chromium/Instagram\n ],\n [NAME, VERSION2],\n [\n /\\bgsa\\/([\\w\\.]+) .*safari\\//i\n // Google Search Appliance on iOS\n ],\n [VERSION2, [NAME, "GSA"]],\n [\n /headlesschrome(?:\\/([\\w\\.]+)| )/i\n // Chrome Headless\n ],\n [VERSION2, [NAME, CHROME + " Headless"]],\n [\n / wv\\).+(chrome)\\/([\\w\\.]+)/i\n // Chrome WebView\n ],\n [[NAME, CHROME + " WebView"], VERSION2],\n [\n /droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i\n // Android Browser\n ],\n [VERSION2, [NAME, "Android " + BROWSER]],\n [\n /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i\n // Chrome/OmniWeb/Arora/Tizen/Nokia\n ],\n [NAME, VERSION2],\n [\n /version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i\n // Mobile Safari\n ],\n [VERSION2, [NAME, "Mobile Safari"]],\n [\n /version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i\n // Safari & Safari Mobile\n ],\n [VERSION2, NAME],\n [\n /webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i\n // Safari < 3.0\n ],\n [NAME, [VERSION2, strMapper, oldSafariMap]],\n [/(webkit|khtml)\\/([\\w\\.]+)/i],\n [NAME, VERSION2],\n [\n // Gecko based\n /(navigator|netscape\\d?)\\/([-\\w\\.]+)/i\n // Netscape\n ],\n [[NAME, "Netscape"], VERSION2],\n [\n /mobile vr; rv:([\\w\\.]+)\\).+firefox/i\n // Firefox Reality\n ],\n [VERSION2, [NAME, FIREFOX + " Reality"]],\n [\n /ekiohf.+(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(swiftfox)/i,\n // Swiftfox\n /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,\n // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar\n /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,\n // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix\n /(firefox)\\/([\\w\\.]+)/i,\n // Other Firefox-based\n /(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,\n // Mozilla\n // Other\n /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,\n // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser\n /(links) \\(([\\w\\.]+)/i\n // Links\n ],\n [NAME, VERSION2],\n [\n /(cobalt)\\/([\\w\\.]+)/i\n // Cobalt\n ],\n [NAME, [VERSION2, /master.|lts./, ""]]\n ],\n cpu: [\n [\n /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i\n // AMD64 (x64)\n ],\n [[ARCHITECTURE, "amd64"]],\n [\n /(ia32(?=;))/i\n // IA32 (quicktime)\n ],\n [[ARCHITECTURE, lowerize]],\n [\n /((?:i[346]|x)86)[;\\)]/i\n // IA32 (x86)\n ],\n [[ARCHITECTURE, "ia32"]],\n [\n /\\b(aarch64|arm(v?8e?l?|_?64))\\b/i\n // ARM64\n ],\n [[ARCHITECTURE, "arm64"]],\n [\n /\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i\n // ARMHF\n ],\n [[ARCHITECTURE, "armhf"]],\n [\n // PocketPC mistakenly identified as PowerPC\n /windows (ce|mobile); ppc;/i\n ],\n [[ARCHITECTURE, "arm"]],\n [\n /((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i\n // PowerPC\n ],\n [[ARCHITECTURE, /ower/, EMPTY, lowerize]],\n [\n /(sun4\\w)[;\\)]/i\n // SPARC\n ],\n [[ARCHITECTURE, "sparc"]],\n [\n /((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i\n // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC\n ],\n [[ARCHITECTURE, lowerize]]\n ],\n device: [\n [\n //////////////////////////\n // MOBILES & TABLETS\n // Ordered by popularity\n /////////////////////////\n // Samsung\n /\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]],\n [\n /\\b((?:s[cgp]h|gt|sm)-\\w+|galaxy nexus)/i,\n /samsung[- ]([-\\w]+)/i,\n /sec-(sgh\\w+)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]],\n [\n // Apple\n /((ipod|iphone)\\d+,\\d+)/i\n // iPod/iPhone model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /(ipad\\d+,\\d+)/i\n // iPad model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [\n /\\((ip(?:hone|od)[\\w ]*);/i\n // iPod/iPhone\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /\\((ipad);[-\\w\\),; ]+apple/i,\n // iPad\n /applecoremedia\\/[\\w\\.]+ \\((ipad)/i,\n /\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [/(macintosh);/i],\n [MODEL, [VENDOR, APPLE]],\n [\n // Huawei\n /\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]],\n [\n /(?:huawei|honor)([-\\w ]+)[;\\)]/i,\n /\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]],\n [\n // Xiaomi\n /\\b(poco[\\w ]+)(?: bui|\\))/i,\n // Xiaomi POCO\n /\\b; (\\w+) build\\/hm\\1/i,\n // Xiaomi Hongmi \'numeric\' models\n /\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,\n // Xiaomi Hongmi\n /\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,\n // Xiaomi Redmi\n /\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i\n // Xiaomi Mi\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, MOBILE]\n ],\n [\n /\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i\n // Mi Pad tablets\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, XIAOMI],\n [TYPE, TABLET]\n ],\n [\n // OPPO\n /; (\\w+) bui.+ oppo/i,\n /\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i\n ],\n [MODEL, [VENDOR, "OPPO"], [TYPE, MOBILE]],\n [\n // Vivo\n /vivo (\\w+)(?: bui|\\))/i,\n /\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i\n ],\n [MODEL, [VENDOR, "Vivo"], [TYPE, MOBILE]],\n [\n // Realme\n /\\b(rmx[12]\\d{3})(?: bui|;|\\))/i\n ],\n [MODEL, [VENDOR, "Realme"], [TYPE, MOBILE]],\n [\n // Motorola\n /\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,\n /\\bmot(?:orola)?[- ](\\w*)/i,\n /((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i\n ],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]],\n [/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]],\n [\n // LG\n /((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, TABLET]],\n [\n /(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,\n /\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,\n /\\blg-?([\\d\\w]+) bui/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, MOBILE]],\n [\n // Lenovo\n /(ideatab[-\\w ]+)/i,\n /lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i\n ],\n [MODEL, [VENDOR, "Lenovo"], [TYPE, TABLET]],\n [\n // Nokia\n /(?:maemo|nokia).*(n900|lumia \\d+)/i,\n /nokia[-_ ]?([-\\w\\.]*)/i\n ],\n [\n [MODEL, /_/g, " "],\n [VENDOR, "Nokia"],\n [TYPE, MOBILE]\n ],\n [\n // Google\n /(pixel c)\\b/i\n // Google Pixel C\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]],\n [\n /droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i\n // Google Pixel\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]],\n [\n // Sony\n /droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i\n ],\n [MODEL, [VENDOR, SONY], [TYPE, MOBILE]],\n [/sony tablet [ps]/i, /\\b(?:sony)?sgp\\w+(?: bui|\\))/i],\n [\n [MODEL, "Xperia Tablet"],\n [VENDOR, SONY],\n [TYPE, TABLET]\n ],\n [\n // OnePlus\n / (kb2005|in20[12]5|be20[12][59])\\b/i,\n /(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i\n ],\n [MODEL, [VENDOR, "OnePlus"], [TYPE, MOBILE]],\n [\n // Amazon\n /(alexa)webm/i,\n /(kf[a-z]{2}wi)( bui|\\))/i,\n // Kindle Fire without Silk\n /(kf[a-z]+)( bui|\\)).+silk\\//i\n // Kindle Fire HD\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]],\n [\n /((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i\n // Fire Phone\n ],\n [\n [MODEL, /(.+)/g, "Fire Phone $1"],\n [VENDOR, AMAZON],\n [TYPE, MOBILE]\n ],\n [\n // BlackBerry\n /(playbook);[-\\w\\),; ]+(rim)/i\n // BlackBerry PlayBook\n ],\n [MODEL, VENDOR, [TYPE, TABLET]],\n [\n /\\b((?:bb[a-f]|st[hv])100-\\d)/i,\n /\\(bb10; (\\w+)/i\n // BlackBerry 10\n ],\n [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]],\n [\n // Asus\n /(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i\n ],\n [MODEL, [VENDOR, ASUS], [TYPE, TABLET]],\n [/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],\n [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]],\n [\n // HTC\n /(nexus 9)/i\n // HTC Nexus 9\n ],\n [MODEL, [VENDOR, "HTC"], [TYPE, TABLET]],\n [\n /(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,\n // HTC\n // ZTE\n /(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,\n /(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\\w]*)/i\n // Alcatel/GeeksPhone/Nexian/Panasonic/Sony\n ],\n [VENDOR, [MODEL, /_/g, " "], [TYPE, MOBILE]],\n [\n // Acer\n /droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i\n ],\n [MODEL, [VENDOR, "Acer"], [TYPE, TABLET]],\n [\n // Meizu\n /droid.+; (m[1-5] note) bui/i,\n /\\bmz-([-\\w]{2,})/i\n ],\n [MODEL, [VENDOR, "Meizu"], [TYPE, MOBILE]],\n [\n // Sharp\n /\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]],\n [\n // MIXED\n /(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,\n // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron\n /(hp) ([\\w ]+\\w)/i,\n // HP iPAQ\n /(asus)-?(\\w+)/i,\n // Asus\n /(microsoft); (lumia[\\w ]+)/i,\n // Microsoft Lumia\n /(lenovo)[-_ ]?([-\\w]+)/i,\n // Lenovo\n /(jolla)/i,\n // Jolla\n /(oppo) ?([\\w ]+) bui/i\n // OPPO\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(archos) (gamepad2?)/i,\n // Archos\n /(hp).+(touchpad(?!.+tablet)|tablet)/i,\n // HP TouchPad\n /(kindle)\\/([\\w\\.]+)/i,\n // Kindle\n /(nook)[\\w ]+build\\/(\\w+)/i,\n // Nook\n /(dell) (strea[kpr\\d ]*[\\dko])/i,\n // Dell Streak\n /(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,\n // Le Pan Tablets\n /(trinity)[- ]*(t\\d{3}) bui/i,\n // Trinity Tablets\n /(gigaset)[- ]+(q\\w{1,9}) bui/i,\n // Gigaset Tablets\n /(vodafone) ([\\w ]+)(?:\\)| bui)/i\n // Vodafone\n ],\n [VENDOR, MODEL, [TYPE, TABLET]],\n [\n /(surface duo)/i\n // Surface Duo\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]],\n [\n /droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i\n // Fairphone\n ],\n [MODEL, [VENDOR, "Fairphone"], [TYPE, MOBILE]],\n [\n /(u304aa)/i\n // AT&T\n ],\n [MODEL, [VENDOR, "AT&T"], [TYPE, MOBILE]],\n [\n /\\bsie-(\\w*)/i\n // Siemens\n ],\n [MODEL, [VENDOR, "Siemens"], [TYPE, MOBILE]],\n [\n /\\b(rct\\w+) b/i\n // RCA Tablets\n ],\n [MODEL, [VENDOR, "RCA"], [TYPE, TABLET]],\n [\n /\\b(venue[\\d ]{2,7}) b/i\n // Dell Venue Tablets\n ],\n [MODEL, [VENDOR, "Dell"], [TYPE, TABLET]],\n [\n /\\b(q(?:mv|ta)\\w+) b/i\n // Verizon Tablet\n ],\n [MODEL, [VENDOR, "Verizon"], [TYPE, TABLET]],\n [\n /\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i\n // Barnes & Noble Tablet\n ],\n [MODEL, [VENDOR, "Barnes & Noble"], [TYPE, TABLET]],\n [/\\b(tm\\d{3}\\w+) b/i],\n [MODEL, [VENDOR, "NuVision"], [TYPE, TABLET]],\n [\n /\\b(k88) b/i\n // ZTE K Series Tablet\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, TABLET]],\n [\n /\\b(nx\\d{3}j) b/i\n // ZTE Nubia\n ],\n [MODEL, [VENDOR, "ZTE"], [TYPE, MOBILE]],\n [\n /\\b(gen\\d{3}) b.+49h/i\n // Swiss GEN Mobile\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, MOBILE]],\n [\n /\\b(zur\\d{3}) b/i\n // Swiss ZUR Tablet\n ],\n [MODEL, [VENDOR, "Swiss"], [TYPE, TABLET]],\n [\n /\\b((zeki)?tb.*\\b) b/i\n // Zeki Tablets\n ],\n [MODEL, [VENDOR, "Zeki"], [TYPE, TABLET]],\n [\n /\\b([yr]\\d{2}) b/i,\n /\\b(dragon[- ]+touch |dt)(\\w{5}) b/i\n // Dragon Touch Tablet\n ],\n [[VENDOR, "Dragon Touch"], MODEL, [TYPE, TABLET]],\n [\n /\\b(ns-?\\w{0,9}) b/i\n // Insignia Tablets\n ],\n [MODEL, [VENDOR, "Insignia"], [TYPE, TABLET]],\n [\n /\\b((nxa|next)-?\\w{0,9}) b/i\n // NextBook Tablets\n ],\n [MODEL, [VENDOR, "NextBook"], [TYPE, TABLET]],\n [\n /\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i\n // Voice Xtreme Phones\n ],\n [[VENDOR, "Voice"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(lvtel\\-)?(v1[12]) b/i\n // LvTel Phones\n ],\n [[VENDOR, "LvTel"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(ph-1) /i\n // Essential PH-1\n ],\n [MODEL, [VENDOR, "Essential"], [TYPE, MOBILE]],\n [\n /\\b(v(100md|700na|7011|917g).*\\b) b/i\n // Envizen Tablets\n ],\n [MODEL, [VENDOR, "Envizen"], [TYPE, TABLET]],\n [\n /\\b(trio[-\\w\\. ]+) b/i\n // MachSpeed Tablets\n ],\n [MODEL, [VENDOR, "MachSpeed"], [TYPE, TABLET]],\n [\n /\\btu_(1491) b/i\n // Rotor Tablets\n ],\n [MODEL, [VENDOR, "Rotor"], [TYPE, TABLET]],\n [\n /(shield[\\w ]+) b/i\n // Nvidia Shield Tablets\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, TABLET]],\n [\n /(sprint) (\\w+)/i\n // Sprint Phones\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(kin\\.[onetw]{3})/i\n // Microsoft Kin\n ],\n [\n [MODEL, /\\./g, " "],\n [VENDOR, MICROSOFT],\n [TYPE, MOBILE]\n ],\n [\n /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i\n // Zebra\n ],\n [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]],\n [/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]],\n [\n ///////////////////\n // CONSOLES\n ///////////////////\n /(ouya)/i,\n // Ouya\n /(nintendo) ([wids3utch]+)/i\n // Nintendo\n ],\n [VENDOR, MODEL, [TYPE, CONSOLE]],\n [\n /droid.+; (shield) bui/i\n // Nvidia\n ],\n [MODEL, [VENDOR, "Nvidia"], [TYPE, CONSOLE]],\n [\n /(playstation [345portablevi]+)/i\n // Playstation\n ],\n [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]],\n [\n /\\b(xbox(?: one)?(?!; xbox))[\\); ]/i\n // Microsoft Xbox\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]],\n [\n ///////////////////\n // SMARTTVS\n ///////////////////\n /smart-tv.+(samsung)/i\n // Samsung\n ],\n [VENDOR, [TYPE, SMARTTV]],\n [/hbbtv.+maple;(\\d+)/i],\n [\n [MODEL, /^/, "SmartTV"],\n [VENDOR, SAMSUNG],\n [TYPE, SMARTTV]\n ],\n [\n /(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i\n // LG SmartTV\n ],\n [\n [VENDOR, LG],\n [TYPE, SMARTTV]\n ],\n [\n /(apple) ?tv/i\n // Apple TV\n ],\n [VENDOR, [MODEL, APPLE + " TV"], [TYPE, SMARTTV]],\n [\n /crkey/i\n // Google Chromecast\n ],\n [\n [MODEL, CHROME + "cast"],\n [VENDOR, GOOGLE],\n [TYPE, SMARTTV]\n ],\n [\n /droid.+aft(\\w)( bui|\\))/i\n // Fire TV\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]],\n [\n /\\(dtv[\\);].+(aquos)/i,\n /(aquos-tv[\\w ]+)\\)/i\n // Sharp\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],\n [\n /(bravia[\\w ]+)( bui|\\))/i\n // Sony\n ],\n [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]],\n [\n /(mitv-\\w{5}) bui/i\n // Xiaomi\n ],\n [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]],\n [\n /\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,\n // Roku\n /hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w ]*; *(\\w[^;]*);([^;]*)/i\n // HbbTV devices\n ],\n [\n [VENDOR, trim],\n [MODEL, trim],\n [TYPE, SMARTTV]\n ],\n [\n /\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i\n // SmartTV from Unidentified Vendors\n ],\n [[TYPE, SMARTTV]],\n [\n ///////////////////\n // WEARABLES\n ///////////////////\n /((pebble))app/i\n // Pebble\n ],\n [VENDOR, MODEL, [TYPE, WEARABLE]],\n [\n /droid.+; (glass) \\d/i\n // Google Glass\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]],\n [/droid.+; (wt63?0{2,3})\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]],\n [\n /(quest( 2)?)/i\n // Oculus Quest\n ],\n [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]],\n [\n ///////////////////\n // EMBEDDED\n ///////////////////\n /(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i\n // Tesla\n ],\n [VENDOR, [TYPE, EMBEDDED]],\n [\n ////////////////////\n // MIXED (GENERIC)\n ///////////////////\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i\n // Android Phones from Unidentified Vendors\n ],\n [MODEL, [TYPE, MOBILE]],\n [\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i\n // Android Tablets from Unidentified Vendors\n ],\n [MODEL, [TYPE, TABLET]],\n [\n /\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i\n // Unidentifiable Tablet\n ],\n [[TYPE, TABLET]],\n [\n /(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i\n // Unidentifiable Mobile\n ],\n [[TYPE, MOBILE]],\n [\n /(android[-\\w\\. ]{0,9});.+buil/i\n // Generic Android Device\n ],\n [MODEL, [VENDOR, "Generic"]]\n ],\n engine: [\n [\n /windows.+ edge\\/([\\w\\.]+)/i\n // EdgeHTML\n ],\n [VERSION2, [NAME, EDGE + "HTML"]],\n [\n /webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i\n // Blink\n ],\n [VERSION2, [NAME, "Blink"]],\n [\n /(presto)\\/([\\w\\.]+)/i,\n // Presto\n /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,\n // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna\n /ekioh(flow)\\/([\\w\\.]+)/i,\n // Flow\n /(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,\n // KHTML/Tasman/Links\n /(icab)[\\/ ]([23]\\.[\\d\\.]+)/i\n // iCab\n ],\n [NAME, VERSION2],\n [\n /rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i\n // Gecko\n ],\n [VERSION2, NAME]\n ],\n os: [\n [\n // Windows\n /microsoft (windows) (vista|xp)/i\n // Windows (iTunes)\n ],\n [NAME, VERSION2],\n [\n /(windows) nt 6\\.2; (arm)/i,\n // Windows RT\n /(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,\n // Windows Phone\n /(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i\n ],\n [NAME, [VERSION2, strMapper, windowsVersionMap]],\n [/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],\n [\n [NAME, "Windows"],\n [VERSION2, strMapper, windowsVersionMap]\n ],\n [\n // iOS/macOS\n /ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,\n // iOS\n /cfnetwork\\/.+darwin/i\n ],\n [\n [VERSION2, /_/g, "."],\n [NAME, "iOS"]\n ],\n [\n /(mac os x) ?([\\w\\. ]*)/i,\n /(macintosh|mac_powerpc\\b)(?!.+haiku)/i\n // Mac OS\n ],\n [\n [NAME, "Mac OS"],\n [VERSION2, /_/g, "."]\n ],\n [\n // Mobile OSes\n /droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i\n // Android-x86/HarmonyOS\n ],\n [VERSION2, NAME],\n [\n // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS\n /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,\n /(blackberry)\\w*\\/([\\w\\.]*)/i,\n // Blackberry\n /(tizen|kaios)[\\/ ]([\\w\\.]+)/i,\n // Tizen/KaiOS\n /\\((series40);/i\n // Series 40\n ],\n [NAME, VERSION2],\n [\n /\\(bb(10);/i\n // BlackBerry 10\n ],\n [VERSION2, [NAME, BLACKBERRY]],\n [\n /(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i\n // Symbian\n ],\n [VERSION2, [NAME, "Symbian"]],\n [\n /mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i\n // Firefox OS\n ],\n [VERSION2, [NAME, FIREFOX + " OS"]],\n [\n /web0s;.+rt(tv)/i,\n /\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i\n // WebOS\n ],\n [VERSION2, [NAME, "webOS"]],\n [\n // Google Chromecast\n /crkey\\/([\\d\\.]+)/i\n // Google Chromecast\n ],\n [VERSION2, [NAME, CHROME + "cast"]],\n [\n /(cros) [\\w]+ ([\\w\\.]+\\w)/i\n // Chromium OS\n ],\n [[NAME, "Chromium OS"], VERSION2],\n [\n // Console\n /(nintendo|playstation) ([wids345portablevuch]+)/i,\n // Nintendo/Playstation\n /(xbox); +xbox ([^\\);]+)/i,\n // Microsoft Xbox (360, One, X, S, Series X, Series S)\n // Other\n /\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,\n // Joli/Palm\n /(mint)[\\/\\(\\) ]?(\\w*)/i,\n // Mint\n /(mageia|vectorlinux)[; ]/i,\n // Mageia/VectorLinux\n /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,\n // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire\n /(hurd|linux) ?([\\w\\.]*)/i,\n // Hurd/Linux\n /(gnu) ?([\\w\\.]*)/i,\n // GNU\n /\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,\n // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly\n /(haiku) (\\w+)/i\n // Haiku\n ],\n [NAME, VERSION2],\n [\n /(sunos) ?([\\w\\.\\d]*)/i\n // Solaris\n ],\n [[NAME, "Solaris"], VERSION2],\n [\n /((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,\n // Solaris\n /(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,\n // AIX\n /\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,\n // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX\n /(unix) ?([\\w\\.]*)/i\n // UNIX\n ],\n [NAME, VERSION2]\n ]\n };\n var UAParser2 = function(ua, extensions) {\n if (typeof ua === OBJ_TYPE) {\n extensions = ua;\n ua = undefined2;\n }\n if (!(this instanceof UAParser2)) {\n return new UAParser2(ua, extensions).getResult();\n }\n var _ua = ua || (typeof window2 !== UNDEF_TYPE && window2.navigator && window2.navigator.userAgent ? window2.navigator.userAgent : EMPTY);\n var _rgxmap = extensions ? extend(regexes, extensions) : regexes;\n this.getBrowser = function() {\n var _browser = {};\n _browser[NAME] = undefined2;\n _browser[VERSION2] = undefined2;\n rgxMapper.call(_browser, _ua, _rgxmap.browser);\n _browser.major = majorize(_browser.version);\n return _browser;\n };\n this.getCPU = function() {\n var _cpu = {};\n _cpu[ARCHITECTURE] = undefined2;\n rgxMapper.call(_cpu, _ua, _rgxmap.cpu);\n return _cpu;\n };\n this.getDevice = function() {\n var _device = {};\n _device[VENDOR] = undefined2;\n _device[MODEL] = undefined2;\n _device[TYPE] = undefined2;\n rgxMapper.call(_device, _ua, _rgxmap.device);\n return _device;\n };\n this.getEngine = function() {\n var _engine = {};\n _engine[NAME] = undefined2;\n _engine[VERSION2] = undefined2;\n rgxMapper.call(_engine, _ua, _rgxmap.engine);\n return _engine;\n };\n this.getOS = function() {\n var _os = {};\n _os[NAME] = undefined2;\n _os[VERSION2] = undefined2;\n rgxMapper.call(_os, _ua, _rgxmap.os);\n return _os;\n };\n this.getResult = function() {\n return {\n ua: this.getUA(),\n browser: this.getBrowser(),\n engine: this.getEngine(),\n os: this.getOS(),\n device: this.getDevice(),\n cpu: this.getCPU()\n };\n };\n this.getUA = function() {\n return _ua;\n };\n this.setUA = function(ua2) {\n _ua = typeof ua2 === STR_TYPE && ua2.length > UA_MAX_LENGTH ? trim(ua2, UA_MAX_LENGTH) : ua2;\n return this;\n };\n this.setUA(_ua);\n return this;\n };\n UAParser2.VERSION = LIBVERSION;\n UAParser2.BROWSER = enumerize([NAME, VERSION2, MAJOR]);\n UAParser2.CPU = enumerize([ARCHITECTURE]);\n UAParser2.DEVICE = enumerize([\n MODEL,\n VENDOR,\n TYPE,\n CONSOLE,\n MOBILE,\n SMARTTV,\n TABLET,\n WEARABLE,\n EMBEDDED\n ]);\n UAParser2.ENGINE = UAParser2.OS = enumerize([NAME, VERSION2]);\n if (typeof exports !== UNDEF_TYPE) {\n if (typeof module !== UNDEF_TYPE && module.exports) {\n exports = module.exports = UAParser2;\n }\n exports.UAParser = UAParser2;\n } else {\n if (typeof define === FUNC_TYPE && define.amd) {\n define(function() {\n return UAParser2;\n });\n } else if (typeof window2 !== UNDEF_TYPE) {\n window2.UAParser = UAParser2;\n }\n }\n var $ = typeof window2 !== UNDEF_TYPE && (window2.jQuery || window2.Zepto);\n if ($ && !$.ua) {\n var parser = new UAParser2();\n $.ua = parser.getResult();\n $.ua.get = function() {\n return parser.getUA();\n };\n $.ua.set = function(ua) {\n parser.setUA(ua);\n var result = parser.getResult();\n for (var prop in result) {\n $.ua[prop] = result[prop];\n }\n };\n }\n })(typeof window === "object" ? window : exports);\n }\n });\n\n // packages/dev-tools/common/constants.ts\n var PUBLIC_API_KEY_QS = `api-key`;\n var PRIVATE_AUTH_KEY_QS = `p-key`;\n var PREVIEW_URL_QS = `preview-url`;\n var USER_ID_QS = `user-id`;\n var CONNECTED_USER_ID_QS = "_b-uid";\n var FRAMEWORK_QS = `framework`;\n var PLATFORM_QS = `platform`;\n var NODE_VERSION_QS = `node`;\n var DEV_TOOLS_API_PATH = "/~builder-dev-tools";\n var SPACE_KIND_QS = `kind`;\n\n // packages/dev-tools/client/utils.ts\n var DEV_TOOLS_URL = "__DEV_TOOLS_URL__";\n\n // packages/dev-tools/client/client-api.ts\n var apiConnectBuilder = (publicApiKey, privateAuthKey, kind) => apiFetch({\n type: "connectBuilder",\n data: {\n publicApiKey,\n privateAuthKey,\n kind\n }\n });\n var apiValidateBuilder = () => apiFetch({\n type: "validateBuilder"\n });\n var apiLaunchEditor = (file) => apiFetch({\n type: "launchEditor",\n data: file\n });\n var apiFetch = async (data) => {\n const url = new URL(DEV_TOOLS_API_PATH, DEV_TOOLS_URL);\n let rsp;\n try {\n rsp = await fetch(url, {\n method: "POST",\n body: JSON.stringify(data)\n });\n } catch (e) {\n console.error(`Devtools Fetch Error, ${url.href}`, e);\n throw new Error(`Builder Devtools Fetch Error`);\n }\n const contentType = rsp.headers.get("content-type") || "";\n if (contentType.includes("application/json")) {\n const r = await rsp.json();\n if (rsp.ok) {\n return r.data;\n }\n if (Array.isArray(r.errors) && r.errors.length > 0) {\n r.errors.forEach((e) => console.error(e));\n throw new Error(`Builder Devtools Fetch Error: ${r.errors[0]}`);\n }\n }\n throw new Error(\n `Builder Devtools Fetch Error: ${rsp.status}, ${await rsp.text()}`\n );\n };\n\n // node_modules/tslib/tslib.es6.mjs\n var extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {\n d2.__proto__ = b2;\n } || function(d2, b2) {\n for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];\n };\n return extendStatics(d, b);\n };\n function __extends(d, b) {\n if (typeof b !== "function" && b !== null)\n throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n }\n var __assign = function() {\n __assign = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n };\n function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === "function")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n }\n function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function(resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function(resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator["throw"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n }\n function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() {\n if (t[0] & 1) throw t[1];\n return t[1];\n }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);\n return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {\n return this;\n }), g;\n function verb(n) {\n return function(v) {\n return step([n, v]);\n };\n }\n function step(op) {\n if (f) throw new TypeError("Generator is already executing.");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return { value: op[1], done: false };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return { value: op[0] ? op[1] : void 0, done: true };\n }\n }\n function __values(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = { error };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n }\n\n // node_modules/@amplitude/analytics-types/lib/esm/event.js\n var IdentifyOperation;\n (function(IdentifyOperation2) {\n IdentifyOperation2["SET"] = "$set";\n IdentifyOperation2["SET_ONCE"] = "$setOnce";\n IdentifyOperation2["ADD"] = "$add";\n IdentifyOperation2["APPEND"] = "$append";\n IdentifyOperation2["PREPEND"] = "$prepend";\n IdentifyOperation2["REMOVE"] = "$remove";\n IdentifyOperation2["PREINSERT"] = "$preInsert";\n IdentifyOperation2["POSTINSERT"] = "$postInsert";\n IdentifyOperation2["UNSET"] = "$unset";\n IdentifyOperation2["CLEAR_ALL"] = "$clearAll";\n })(IdentifyOperation || (IdentifyOperation = {}));\n var RevenueProperty;\n (function(RevenueProperty2) {\n RevenueProperty2["REVENUE_PRODUCT_ID"] = "$productId";\n RevenueProperty2["REVENUE_QUANTITY"] = "$quantity";\n RevenueProperty2["REVENUE_PRICE"] = "$price";\n RevenueProperty2["REVENUE_TYPE"] = "$revenueType";\n RevenueProperty2["REVENUE_CURRENCY"] = "$currency";\n RevenueProperty2["REVENUE"] = "$revenue";\n })(RevenueProperty || (RevenueProperty = {}));\n var SpecialEventType;\n (function(SpecialEventType2) {\n SpecialEventType2["IDENTIFY"] = "$identify";\n SpecialEventType2["GROUP_IDENTIFY"] = "$groupidentify";\n SpecialEventType2["REVENUE"] = "revenue_amount";\n })(SpecialEventType || (SpecialEventType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/logger.js\n var LogLevel;\n (function(LogLevel2) {\n LogLevel2[LogLevel2["None"] = 0] = "None";\n LogLevel2[LogLevel2["Error"] = 1] = "Error";\n LogLevel2[LogLevel2["Warn"] = 2] = "Warn";\n LogLevel2[LogLevel2["Verbose"] = 3] = "Verbose";\n LogLevel2[LogLevel2["Debug"] = 4] = "Debug";\n })(LogLevel || (LogLevel = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/plugin.js\n var PluginType;\n (function(PluginType2) {\n PluginType2["BEFORE"] = "before";\n PluginType2["ENRICHMENT"] = "enrichment";\n PluginType2["DESTINATION"] = "destination";\n })(PluginType || (PluginType = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/server-zone.js\n var ServerZone;\n (function(ServerZone2) {\n ServerZone2["US"] = "US";\n ServerZone2["EU"] = "EU";\n ServerZone2["STAGING"] = "STAGING";\n })(ServerZone || (ServerZone = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/status.js\n var Status;\n (function(Status2) {\n Status2["Unknown"] = "unknown";\n Status2["Skipped"] = "skipped";\n Status2["Success"] = "success";\n Status2["RateLimit"] = "rate_limit";\n Status2["PayloadTooLarge"] = "payload_too_large";\n Status2["Invalid"] = "invalid";\n Status2["Failed"] = "failed";\n Status2["Timeout"] = "Timeout";\n Status2["SystemError"] = "SystemError";\n })(Status || (Status = {}));\n\n // node_modules/@amplitude/analytics-types/lib/esm/transport.js\n var TransportType;\n (function(TransportType2) {\n TransportType2["XHR"] = "xhr";\n TransportType2["SendBeacon"] = "beacon";\n TransportType2["Fetch"] = "fetch";\n })(TransportType || (TransportType = {}));\n\n // node_modules/@amplitude/analytics-core/lib/esm/constants.js\n var UNSET_VALUE = "-";\n var AMPLITUDE_PREFIX = "AMP";\n var STORAGE_PREFIX = "".concat(AMPLITUDE_PREFIX, "_unsent");\n var AMPLITUDE_SERVER_URL = "https://api2.amplitude.com/2/httpapi";\n var EU_AMPLITUDE_SERVER_URL = "https://api.eu.amplitude.com/2/httpapi";\n var AMPLITUDE_BATCH_SERVER_URL = "https://api2.amplitude.com/batch";\n var EU_AMPLITUDE_BATCH_SERVER_URL = "https://api.eu.amplitude.com/batch";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js\n var MAX_PROPERTY_KEYS = 1e3;\n var isValidObject = function(properties) {\n if (Object.keys(properties).length > MAX_PROPERTY_KEYS) {\n return false;\n }\n for (var key in properties) {\n var value = properties[key];\n if (!isValidProperties(key, value))\n return false;\n }\n return true;\n };\n var isValidProperties = function(property, value) {\n var e_1, _a;\n if (typeof property !== "string")\n return false;\n if (Array.isArray(value)) {\n var isValid = true;\n try {\n for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {\n var valueElement = value_1_1.value;\n if (Array.isArray(valueElement)) {\n return false;\n } else if (typeof valueElement === "object") {\n isValid = isValid && isValidObject(valueElement);\n } else if (!["number", "string"].includes(typeof valueElement)) {\n return false;\n }\n if (!isValid) {\n return false;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n } else if (value === null || value === void 0) {\n return false;\n } else if (typeof value === "object") {\n return isValidObject(value);\n } else if (!["number", "string", "boolean"].includes(typeof value)) {\n return false;\n }\n return true;\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/identify.js\n var Identify = (\n /** @class */\n (function() {\n function Identify2() {\n this._propertySet = /* @__PURE__ */ new Set();\n this._properties = {};\n }\n Identify2.prototype.getUserProperties = function() {\n return __assign({}, this._properties);\n };\n Identify2.prototype.set = function(property, value) {\n this._safeSet(IdentifyOperation.SET, property, value);\n return this;\n };\n Identify2.prototype.setOnce = function(property, value) {\n this._safeSet(IdentifyOperation.SET_ONCE, property, value);\n return this;\n };\n Identify2.prototype.append = function(property, value) {\n this._safeSet(IdentifyOperation.APPEND, property, value);\n return this;\n };\n Identify2.prototype.prepend = function(property, value) {\n this._safeSet(IdentifyOperation.PREPEND, property, value);\n return this;\n };\n Identify2.prototype.postInsert = function(property, value) {\n this._safeSet(IdentifyOperation.POSTINSERT, property, value);\n return this;\n };\n Identify2.prototype.preInsert = function(property, value) {\n this._safeSet(IdentifyOperation.PREINSERT, property, value);\n return this;\n };\n Identify2.prototype.remove = function(property, value) {\n this._safeSet(IdentifyOperation.REMOVE, property, value);\n return this;\n };\n Identify2.prototype.add = function(property, value) {\n this._safeSet(IdentifyOperation.ADD, property, value);\n return this;\n };\n Identify2.prototype.unset = function(property) {\n this._safeSet(IdentifyOperation.UNSET, property, UNSET_VALUE);\n return this;\n };\n Identify2.prototype.clearAll = function() {\n this._properties = {};\n this._properties[IdentifyOperation.CLEAR_ALL] = UNSET_VALUE;\n return this;\n };\n Identify2.prototype._safeSet = function(operation, property, value) {\n if (this._validate(operation, property, value)) {\n var userPropertyMap = this._properties[operation];\n if (userPropertyMap === void 0) {\n userPropertyMap = {};\n this._properties[operation] = userPropertyMap;\n }\n userPropertyMap[property] = value;\n this._propertySet.add(property);\n return true;\n }\n return false;\n };\n Identify2.prototype._validate = function(operation, property, value) {\n if (this._properties[IdentifyOperation.CLEAR_ALL] !== void 0) {\n return false;\n }\n if (this._propertySet.has(property)) {\n return false;\n }\n if (operation === IdentifyOperation.ADD) {\n return typeof value === "number";\n }\n if (operation !== IdentifyOperation.UNSET && operation !== IdentifyOperation.REMOVE) {\n return isValidProperties(property, value);\n }\n return true;\n };\n return Identify2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js\n var createTrackEvent = function(eventInput, eventProperties, eventOptions) {\n var baseEvent = typeof eventInput === "string" ? { event_type: eventInput } : eventInput;\n return __assign(__assign(__assign({}, baseEvent), eventOptions), eventProperties && { event_properties: eventProperties });\n };\n var createIdentifyEvent = function(identify2, eventOptions) {\n var identifyEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties() });\n return identifyEvent;\n };\n var createGroupIdentifyEvent = function(groupType, groupName, identify2, eventOptions) {\n var _a;\n var groupIdentify2 = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.GROUP_IDENTIFY, group_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupIdentify2;\n };\n var createGroupEvent = function(groupType, groupName, eventOptions) {\n var _a;\n var identify2 = new Identify();\n identify2.set(groupType, groupName);\n var groupEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify2.getUserProperties(), groups: (_a = {}, _a[groupType] = groupName, _a) });\n return groupEvent;\n };\n var createRevenueEvent = function(revenue2, eventOptions) {\n return __assign(__assign({}, eventOptions), { event_type: SpecialEventType.REVENUE, event_properties: revenue2.getEventProperties() });\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js\n var buildResult = function(event, code, message) {\n if (code === void 0) {\n code = 0;\n }\n if (message === void 0) {\n message = Status.Unknown;\n }\n return { event, code, message };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/timeline.js\n var Timeline = (\n /** @class */\n (function() {\n function Timeline2(client) {\n this.client = client;\n this.queue = [];\n this.applying = false;\n this.plugins = [];\n }\n Timeline2.prototype.register = function(plugin, config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, plugin.setup(config, this.client)];\n case 1:\n _a.sent();\n this.plugins.push(plugin);\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.deregister = function(pluginName, config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var index, plugin;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n index = this.plugins.findIndex(function(plugin2) {\n return plugin2.name === pluginName;\n });\n if (index === -1) {\n config.loggerProvider.warn("Plugin with name ".concat(pluginName, " does not exist, skipping deregistration"));\n return [\n 2\n /*return*/\n ];\n }\n plugin = this.plugins[index];\n this.plugins.splice(index, 1);\n return [4, (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin)];\n case 1:\n _b.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.reset = function(client) {\n this.applying = false;\n var plugins = this.plugins;\n plugins.map(function(plugin) {\n var _a;\n return (_a = plugin.teardown) === null || _a === void 0 ? void 0 : _a.call(plugin);\n });\n this.plugins = [];\n this.client = client;\n };\n Timeline2.prototype.push = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n _this.queue.push([event, resolve]);\n _this.scheduleApply(0);\n });\n };\n Timeline2.prototype.scheduleApply = function(timeout) {\n var _this = this;\n if (this.applying)\n return;\n this.applying = true;\n setTimeout(function() {\n void _this.apply(_this.queue.shift()).then(function() {\n _this.applying = false;\n if (_this.queue.length > 0) {\n _this.scheduleApply(0);\n }\n });\n }, timeout);\n };\n Timeline2.prototype.apply = function(item) {\n return __awaiter(this, void 0, void 0, function() {\n var _a, event, _b, resolve, before, before_1, before_1_1, plugin, e, e_1_1, enrichment, enrichment_1, enrichment_1_1, plugin, e, e_2_1, destination, executeDestinations;\n var e_1, _c, e_2, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n if (!item) {\n return [\n 2\n /*return*/\n ];\n }\n _a = __read(item, 1), event = _a[0];\n _b = __read(item, 2), resolve = _b[1];\n before = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.BEFORE;\n });\n _e.label = 1;\n case 1:\n _e.trys.push([1, 6, 7, 8]);\n before_1 = __values(before), before_1_1 = before_1.next();\n _e.label = 2;\n case 2:\n if (!!before_1_1.done) return [3, 5];\n plugin = before_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 3:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 4;\n case 4:\n before_1_1 = before_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (before_1_1 && !before_1_1.done && (_c = before_1.return)) _c.call(before_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n enrichment = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.ENRICHMENT;\n });\n _e.label = 9;\n case 9:\n _e.trys.push([9, 14, 15, 16]);\n enrichment_1 = __values(enrichment), enrichment_1_1 = enrichment_1.next();\n _e.label = 10;\n case 10:\n if (!!enrichment_1_1.done) return [3, 13];\n plugin = enrichment_1_1.value;\n return [4, plugin.execute(__assign({}, event))];\n case 11:\n e = _e.sent();\n if (e === null) {\n resolve({ event, code: 0, message: "" });\n return [\n 2\n /*return*/\n ];\n } else {\n event = e;\n }\n _e.label = 12;\n case 12:\n enrichment_1_1 = enrichment_1.next();\n return [3, 10];\n case 13:\n return [3, 16];\n case 14:\n e_2_1 = _e.sent();\n e_2 = { error: e_2_1 };\n return [3, 16];\n case 15:\n try {\n if (enrichment_1_1 && !enrichment_1_1.done && (_d = enrichment_1.return)) _d.call(enrichment_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 16:\n destination = this.plugins.filter(function(plugin2) {\n return plugin2.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin2) {\n var eventClone = __assign({}, event);\n return plugin2.execute(eventClone).catch(function(e2) {\n return buildResult(eventClone, 0, String(e2));\n });\n });\n void Promise.all(executeDestinations).then(function(_a2) {\n var _b2 = __read(_a2, 1), result = _b2[0];\n resolve(result);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Timeline2.prototype.flush = function() {\n return __awaiter(this, void 0, void 0, function() {\n var queue, destination, executeDestinations;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n queue = this.queue;\n this.queue = [];\n return [4, Promise.all(queue.map(function(item) {\n return _this.apply(item);\n }))];\n case 1:\n _a.sent();\n destination = this.plugins.filter(function(plugin) {\n return plugin.type === PluginType.DESTINATION;\n });\n executeDestinations = destination.map(function(plugin) {\n return plugin.flush && plugin.flush();\n });\n return [4, Promise.all(executeDestinations)];\n case 2:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return Timeline2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/messages.js\n var SUCCESS_MESSAGE = "Event tracked successfully";\n var UNEXPECTED_ERROR_MESSAGE = "Unexpected error occurred";\n var MAX_RETRIES_EXCEEDED_MESSAGE = "Event rejected due to exceeded retry count";\n var OPT_OUT_MESSAGE = "Event skipped due to optOut config";\n var MISSING_API_KEY_MESSAGE = "Event rejected due to missing API key";\n var INVALID_API_KEY = "Invalid API key";\n var CLIENT_NOT_INITIALIZED = "Client not initialized";\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js\n var returnWrapper = function(awaitable) {\n return {\n promise: awaitable || Promise.resolve()\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/core-client.js\n var AmplitudeCore = (\n /** @class */\n (function() {\n function AmplitudeCore2(name) {\n if (name === void 0) {\n name = "$default";\n }\n this.initializing = false;\n this.q = [];\n this.dispatchQ = [];\n this.logEvent = this.track.bind(this);\n this.timeline = new Timeline(this);\n this.name = name;\n }\n AmplitudeCore2.prototype._init = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n this.config = config;\n this.timeline.reset(this);\n return [4, this.runQueuedFunctions("q")];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.runQueuedFunctions = function(queueName) {\n return __awaiter(this, void 0, void 0, function() {\n var queuedFunctions, queuedFunctions_1, queuedFunctions_1_1, queuedFunction, e_1_1;\n var e_1, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n queuedFunctions = this[queueName];\n this[queueName] = [];\n _b.label = 1;\n case 1:\n _b.trys.push([1, 6, 7, 8]);\n queuedFunctions_1 = __values(queuedFunctions), queuedFunctions_1_1 = queuedFunctions_1.next();\n _b.label = 2;\n case 2:\n if (!!queuedFunctions_1_1.done) return [3, 5];\n queuedFunction = queuedFunctions_1_1.value;\n return [4, queuedFunction()];\n case 3:\n _b.sent();\n _b.label = 4;\n case 4:\n queuedFunctions_1_1 = queuedFunctions_1.next();\n return [3, 2];\n case 5:\n return [3, 8];\n case 6:\n e_1_1 = _b.sent();\n e_1 = { error: e_1_1 };\n return [3, 8];\n case 7:\n try {\n if (queuedFunctions_1_1 && !queuedFunctions_1_1.done && (_a = queuedFunctions_1.return)) _a.call(queuedFunctions_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 8:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.track = function(eventInput, eventProperties, eventOptions) {\n var event = createTrackEvent(eventInput, eventProperties, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.identify = function(identify2, eventOptions) {\n var event = createIdentifyEvent(identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n var event = createGroupIdentifyEvent(groupType, groupName, identify2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.setGroup = function(groupType, groupName, eventOptions) {\n var event = createGroupEvent(groupType, groupName, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.revenue = function(revenue2, eventOptions) {\n var event = createRevenueEvent(revenue2, eventOptions);\n return returnWrapper(this.dispatch(event));\n };\n AmplitudeCore2.prototype.add = function(plugin) {\n if (!this.config) {\n this.q.push(this.add.bind(this, plugin));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.register(plugin, this.config));\n };\n AmplitudeCore2.prototype.remove = function(pluginName) {\n if (!this.config) {\n this.q.push(this.remove.bind(this, pluginName));\n return returnWrapper();\n }\n return returnWrapper(this.timeline.deregister(pluginName, this.config));\n };\n AmplitudeCore2.prototype.dispatchWithCallback = function(event, callback) {\n if (!this.config) {\n return callback(buildResult(event, 0, CLIENT_NOT_INITIALIZED));\n }\n void this.process(event).then(callback);\n };\n AmplitudeCore2.prototype.dispatch = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n if (!this.config) {\n return [2, new Promise(function(resolve) {\n _this.dispatchQ.push(_this.dispatchWithCallback.bind(_this, event, resolve));\n })];\n }\n return [2, this.process(event)];\n });\n });\n };\n AmplitudeCore2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var result, e_2, message, result;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n if (this.config.optOut) {\n return [2, buildResult(event, 0, OPT_OUT_MESSAGE)];\n }\n return [4, this.timeline.push(event)];\n case 1:\n result = _a.sent();\n result.code === 200 ? this.config.loggerProvider.log(result.message) : this.config.loggerProvider.error(result.message);\n return [2, result];\n case 2:\n e_2 = _a.sent();\n this.config.loggerProvider.error(e_2);\n message = String(e_2);\n result = buildResult(event, 0, message);\n return [2, result];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeCore2.prototype.setOptOut = function(optOut) {\n if (!this.config) {\n this.q.push(this.setOptOut.bind(this, Boolean(optOut)));\n return;\n }\n this.config.optOut = Boolean(optOut);\n };\n AmplitudeCore2.prototype.flush = function() {\n return returnWrapper(this.timeline.flush());\n };\n return AmplitudeCore2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/revenue.js\n var Revenue = (\n /** @class */\n (function() {\n function Revenue2() {\n this.productId = "";\n this.quantity = 1;\n this.price = 0;\n }\n Revenue2.prototype.setProductId = function(productId) {\n this.productId = productId;\n return this;\n };\n Revenue2.prototype.setQuantity = function(quantity) {\n if (quantity > 0) {\n this.quantity = quantity;\n }\n return this;\n };\n Revenue2.prototype.setPrice = function(price) {\n this.price = price;\n return this;\n };\n Revenue2.prototype.setRevenueType = function(revenueType) {\n this.revenueType = revenueType;\n return this;\n };\n Revenue2.prototype.setCurrency = function(currency) {\n this.currency = currency;\n return this;\n };\n Revenue2.prototype.setRevenue = function(revenue2) {\n this.revenue = revenue2;\n return this;\n };\n Revenue2.prototype.setEventProperties = function(properties) {\n if (isValidObject(properties)) {\n this.properties = properties;\n }\n return this;\n };\n Revenue2.prototype.getEventProperties = function() {\n var eventProperties = this.properties ? __assign({}, this.properties) : {};\n eventProperties[RevenueProperty.REVENUE_PRODUCT_ID] = this.productId;\n eventProperties[RevenueProperty.REVENUE_QUANTITY] = this.quantity;\n eventProperties[RevenueProperty.REVENUE_PRICE] = this.price;\n eventProperties[RevenueProperty.REVENUE_TYPE] = this.revenueType;\n eventProperties[RevenueProperty.REVENUE_CURRENCY] = this.currency;\n eventProperties[RevenueProperty.REVENUE] = this.revenue;\n return eventProperties;\n };\n return Revenue2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js\n var chunk = function(arr, size) {\n var chunkSize = Math.max(size, 1);\n return arr.reduce(function(chunks, element, index) {\n var chunkIndex = Math.floor(index / chunkSize);\n if (!chunks[chunkIndex]) {\n chunks[chunkIndex] = [];\n }\n chunks[chunkIndex].push(element);\n return chunks;\n }, []);\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/logger.js\n var PREFIX = "Amplitude Logger ";\n var Logger = (\n /** @class */\n (function() {\n function Logger2() {\n this.logLevel = LogLevel.None;\n }\n Logger2.prototype.disable = function() {\n this.logLevel = LogLevel.None;\n };\n Logger2.prototype.enable = function(logLevel) {\n if (logLevel === void 0) {\n logLevel = LogLevel.Warn;\n }\n this.logLevel = logLevel;\n };\n Logger2.prototype.log = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Verbose) {\n return;\n }\n console.log("".concat(PREFIX, "[Log]: ").concat(args.join(" ")));\n };\n Logger2.prototype.warn = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Warn) {\n return;\n }\n console.warn("".concat(PREFIX, "[Warn]: ").concat(args.join(" ")));\n };\n Logger2.prototype.error = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Error) {\n return;\n }\n console.error("".concat(PREFIX, "[Error]: ").concat(args.join(" ")));\n };\n Logger2.prototype.debug = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (this.logLevel < LogLevel.Debug) {\n return;\n }\n console.log("".concat(PREFIX, "[Debug]: ").concat(args.join(" ")));\n };\n return Logger2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/config.js\n var getDefaultConfig = function() {\n return {\n flushMaxRetries: 12,\n flushQueueSize: 200,\n flushIntervalMillis: 1e4,\n instanceName: "$default_instance",\n logLevel: LogLevel.Warn,\n loggerProvider: new Logger(),\n optOut: false,\n serverUrl: AMPLITUDE_SERVER_URL,\n serverZone: ServerZone.US,\n useBatch: false\n };\n };\n var Config = (\n /** @class */\n (function() {\n function Config2(options) {\n var _a, _b, _c, _d;\n this._optOut = false;\n var defaultConfig = getDefaultConfig();\n this.apiKey = options.apiKey;\n this.flushIntervalMillis = (_a = options.flushIntervalMillis) !== null && _a !== void 0 ? _a : defaultConfig.flushIntervalMillis;\n this.flushMaxRetries = options.flushMaxRetries || defaultConfig.flushMaxRetries;\n this.flushQueueSize = options.flushQueueSize || defaultConfig.flushQueueSize;\n this.instanceName = options.instanceName || defaultConfig.instanceName;\n this.loggerProvider = options.loggerProvider || defaultConfig.loggerProvider;\n this.logLevel = (_b = options.logLevel) !== null && _b !== void 0 ? _b : defaultConfig.logLevel;\n this.minIdLength = options.minIdLength;\n this.plan = options.plan;\n this.ingestionMetadata = options.ingestionMetadata;\n this.optOut = (_c = options.optOut) !== null && _c !== void 0 ? _c : defaultConfig.optOut;\n this.serverUrl = options.serverUrl;\n this.serverZone = options.serverZone || defaultConfig.serverZone;\n this.storageProvider = options.storageProvider;\n this.transportProvider = options.transportProvider;\n this.useBatch = (_d = options.useBatch) !== null && _d !== void 0 ? _d : defaultConfig.useBatch;\n this.loggerProvider.enable(this.logLevel);\n var serverConfig = createServerConfig(options.serverUrl, options.serverZone, options.useBatch);\n this.serverZone = serverConfig.serverZone;\n this.serverUrl = serverConfig.serverUrl;\n }\n Object.defineProperty(Config2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n this._optOut = optOut;\n },\n enumerable: false,\n configurable: true\n });\n return Config2;\n })()\n );\n var getServerUrl = function(serverZone, useBatch) {\n if (serverZone === ServerZone.EU) {\n return useBatch ? EU_AMPLITUDE_BATCH_SERVER_URL : EU_AMPLITUDE_SERVER_URL;\n }\n return useBatch ? AMPLITUDE_BATCH_SERVER_URL : AMPLITUDE_SERVER_URL;\n };\n var createServerConfig = function(serverUrl, serverZone, useBatch) {\n if (serverUrl === void 0) {\n serverUrl = "";\n }\n if (serverZone === void 0) {\n serverZone = getDefaultConfig().serverZone;\n }\n if (useBatch === void 0) {\n useBatch = getDefaultConfig().useBatch;\n }\n if (serverUrl) {\n return { serverUrl, serverZone: void 0 };\n }\n var _serverZone = ["US", "EU"].includes(serverZone) ? serverZone : getDefaultConfig().serverZone;\n return {\n serverZone: _serverZone,\n serverUrl: getServerUrl(_serverZone, useBatch)\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js\n function getErrorMessage(error) {\n if (error instanceof Error)\n return error.message;\n return String(error);\n }\n function getResponseBodyString(res) {\n var responseBodyString = "";\n try {\n if ("body" in res) {\n responseBodyString = JSON.stringify(res.body);\n }\n } catch (_a) {\n }\n return responseBodyString;\n }\n var Destination = (\n /** @class */\n (function() {\n function Destination2() {\n this.name = "amplitude";\n this.type = PluginType.DESTINATION;\n this.retryTimeout = 1e3;\n this.throttleTimeout = 3e4;\n this.storageKey = "";\n this.scheduled = null;\n this.queue = [];\n }\n Destination2.prototype.setup = function(config) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var unsent;\n var _this = this;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n this.config = config;\n this.storageKey = "".concat(STORAGE_PREFIX, "_").concat(this.config.apiKey.substring(0, 10));\n return [4, (_a = this.config.storageProvider) === null || _a === void 0 ? void 0 : _a.get(this.storageKey)];\n case 1:\n unsent = _b.sent();\n this.saveEvents();\n if (unsent && unsent.length > 0) {\n void Promise.all(unsent.map(function(event) {\n return _this.execute(event);\n })).catch();\n }\n return [2, Promise.resolve(void 0)];\n }\n });\n });\n };\n Destination2.prototype.execute = function(event) {\n var _this = this;\n return new Promise(function(resolve) {\n var context = {\n event,\n attempts: 0,\n callback: function(result) {\n return resolve(result);\n },\n timeout: 0\n };\n void _this.addToQueue(context);\n });\n };\n Destination2.prototype.addToQueue = function() {\n var _this = this;\n var list = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n list[_i] = arguments[_i];\n }\n var tryable = list.filter(function(context) {\n if (context.attempts < _this.config.flushMaxRetries) {\n context.attempts += 1;\n return true;\n }\n void _this.fulfillRequest([context], 500, MAX_RETRIES_EXCEEDED_MESSAGE);\n return false;\n });\n tryable.forEach(function(context) {\n _this.queue = _this.queue.concat(context);\n if (context.timeout === 0) {\n _this.schedule(_this.config.flushIntervalMillis);\n return;\n }\n setTimeout(function() {\n context.timeout = 0;\n _this.schedule(0);\n }, context.timeout);\n });\n this.saveEvents();\n };\n Destination2.prototype.schedule = function(timeout) {\n var _this = this;\n if (this.scheduled)\n return;\n this.scheduled = setTimeout(function() {\n void _this.flush(true).then(function() {\n if (_this.queue.length > 0) {\n _this.schedule(timeout);\n }\n });\n }, timeout);\n };\n Destination2.prototype.flush = function(useRetry) {\n if (useRetry === void 0) {\n useRetry = false;\n }\n return __awaiter(this, void 0, void 0, function() {\n var list, later, batches;\n var _this = this;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n list = [];\n later = [];\n this.queue.forEach(function(context) {\n return context.timeout === 0 ? list.push(context) : later.push(context);\n });\n this.queue = later;\n if (this.scheduled) {\n clearTimeout(this.scheduled);\n this.scheduled = null;\n }\n batches = chunk(list, this.config.flushQueueSize);\n return [4, Promise.all(batches.map(function(batch) {\n return _this.send(batch, useRetry);\n }))];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.send = function(list, useRetry) {\n if (useRetry === void 0) {\n useRetry = true;\n }\n return __awaiter(this, void 0, void 0, function() {\n var payload, serverUrl, res, e_1, errorMessage;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (!this.config.apiKey) {\n return [2, this.fulfillRequest(list, 400, MISSING_API_KEY_MESSAGE)];\n }\n payload = {\n api_key: this.config.apiKey,\n events: list.map(function(context) {\n var _a2 = context.event, extra = _a2.extra, eventWithoutExtra = __rest(_a2, ["extra"]);\n return eventWithoutExtra;\n }),\n options: {\n min_id_length: this.config.minIdLength\n }\n };\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n serverUrl = createServerConfig(this.config.serverUrl, this.config.serverZone, this.config.useBatch).serverUrl;\n return [4, this.config.transportProvider.send(serverUrl, payload)];\n case 2:\n res = _a.sent();\n if (res === null) {\n this.fulfillRequest(list, 0, UNEXPECTED_ERROR_MESSAGE);\n return [\n 2\n /*return*/\n ];\n }\n if (!useRetry) {\n if ("body" in res) {\n this.fulfillRequest(list, res.statusCode, "".concat(res.status, ": ").concat(getResponseBodyString(res)));\n } else {\n this.fulfillRequest(list, res.statusCode, res.status);\n }\n return [\n 2\n /*return*/\n ];\n }\n this.handleResponse(res, list);\n return [3, 4];\n case 3:\n e_1 = _a.sent();\n this.config.loggerProvider.error(e_1);\n errorMessage = getErrorMessage(e_1);\n this.fulfillRequest(list, 0, errorMessage);\n return [3, 4];\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n Destination2.prototype.handleResponse = function(res, list) {\n var status = res.status;\n switch (status) {\n case Status.Success: {\n this.handleSuccessResponse(res, list);\n break;\n }\n case Status.Invalid: {\n this.handleInvalidResponse(res, list);\n break;\n }\n case Status.PayloadTooLarge: {\n this.handlePayloadTooLargeResponse(res, list);\n break;\n }\n case Status.RateLimit: {\n this.handleRateLimitResponse(res, list);\n break;\n }\n default: {\n this.config.loggerProvider.warn(`{code: 0, error: "Status \'`.concat(status, "\' provided for ").concat(list.length, \' events"}\'));\n this.handleOtherResponse(list);\n break;\n }\n }\n };\n Destination2.prototype.handleSuccessResponse = function(res, list) {\n this.fulfillRequest(list, res.statusCode, SUCCESS_MESSAGE);\n };\n Destination2.prototype.handleInvalidResponse = function(res, list) {\n var _this = this;\n if (res.body.missingField || res.body.error.startsWith(INVALID_API_KEY)) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n var dropIndex = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.values(res.body.eventsWithInvalidFields)), false), __read(Object.values(res.body.eventsWithMissingFields)), false), __read(Object.values(res.body.eventsWithInvalidIdLengths)), false), __read(res.body.silencedEvents), false).flat();\n var dropIndexSet = new Set(dropIndex);\n var retry = list.filter(function(context, index) {\n if (dropIndexSet.has(index)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handlePayloadTooLargeResponse = function(res, list) {\n if (list.length === 1) {\n this.fulfillRequest(list, res.statusCode, res.body.error);\n return;\n }\n this.config.loggerProvider.warn(getResponseBodyString(res));\n this.config.flushQueueSize /= 2;\n this.addToQueue.apply(this, __spreadArray([], __read(list), false));\n };\n Destination2.prototype.handleRateLimitResponse = function(res, list) {\n var _this = this;\n var dropUserIds = Object.keys(res.body.exceededDailyQuotaUsers);\n var dropDeviceIds = Object.keys(res.body.exceededDailyQuotaDevices);\n var throttledIndex = res.body.throttledEvents;\n var dropUserIdsSet = new Set(dropUserIds);\n var dropDeviceIdsSet = new Set(dropDeviceIds);\n var throttledIndexSet = new Set(throttledIndex);\n var retry = list.filter(function(context, index) {\n if (context.event.user_id && dropUserIdsSet.has(context.event.user_id) || context.event.device_id && dropDeviceIdsSet.has(context.event.device_id)) {\n _this.fulfillRequest([context], res.statusCode, res.body.error);\n return;\n }\n if (throttledIndexSet.has(index)) {\n context.timeout = _this.throttleTimeout;\n }\n return true;\n });\n if (retry.length > 0) {\n this.config.loggerProvider.warn(getResponseBodyString(res));\n }\n this.addToQueue.apply(this, __spreadArray([], __read(retry), false));\n };\n Destination2.prototype.handleOtherResponse = function(list) {\n var _this = this;\n this.addToQueue.apply(this, __spreadArray([], __read(list.map(function(context) {\n context.timeout = context.attempts * _this.retryTimeout;\n return context;\n })), false));\n };\n Destination2.prototype.fulfillRequest = function(list, code, message) {\n this.saveEvents();\n list.forEach(function(context) {\n return context.callback(buildResult(context.event, code, message));\n });\n };\n Destination2.prototype.saveEvents = function() {\n if (!this.config.storageProvider) {\n return;\n }\n var events = Array.from(this.queue.map(function(context) {\n return context.event;\n }));\n void this.config.storageProvider.set(this.storageKey, events);\n };\n return Destination2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js\n var getStacktrace = function(ignoreDepth) {\n if (ignoreDepth === void 0) {\n ignoreDepth = 0;\n }\n var trace = new Error().stack || "";\n return trace.split("\\n").slice(2 + ignoreDepth).map(function(text) {\n return text.trim();\n });\n };\n var getClientLogConfig = function(client) {\n return function() {\n var _a = __assign({}, client.config), logger = _a.loggerProvider, logLevel = _a.logLevel;\n return {\n logger,\n logLevel\n };\n };\n };\n var getValueByStringPath = function(obj, path) {\n var e_1, _a;\n path = path.replace(/\\[(\\w+)\\]/g, ".$1");\n path = path.replace(/^\\./, "");\n try {\n for (var _b = __values(path.split(".")), _c = _b.next(); !_c.done; _c = _b.next()) {\n var attr = _c.value;\n if (attr in obj) {\n obj = obj[attr];\n } else {\n return;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n return obj;\n };\n var getClientStates = function(client, paths) {\n return function() {\n var e_2, _a;\n var res = {};\n try {\n for (var paths_1 = __values(paths), paths_1_1 = paths_1.next(); !paths_1_1.done; paths_1_1 = paths_1.next()) {\n var path = paths_1_1.value;\n res[path] = getValueByStringPath(client, path);\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (paths_1_1 && !paths_1_1.done && (_a = paths_1.return)) _a.call(paths_1);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n return res;\n };\n };\n var debugWrapper = function(fn, fnName, getLogConfig, getStates, fnContext) {\n if (fnContext === void 0) {\n fnContext = null;\n }\n return function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var _a = getLogConfig(), logger = _a.logger, logLevel = _a.logLevel;\n if (logLevel && logLevel < LogLevel.Debug || !logLevel || !logger) {\n return fn.apply(fnContext, args);\n }\n var debugContext = {\n type: "invoke public method",\n name: fnName,\n args,\n stacktrace: getStacktrace(1),\n time: {\n start: (/* @__PURE__ */ new Date()).toISOString()\n },\n states: {}\n };\n if (getStates && debugContext.states) {\n debugContext.states.before = getStates();\n }\n var result = fn.apply(fnContext, args);\n if (result && result.promise) {\n result.promise.then(function() {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n });\n } else {\n if (getStates && debugContext.states) {\n debugContext.states.after = getStates();\n }\n if (debugContext.time) {\n debugContext.time.end = (/* @__PURE__ */ new Date()).toISOString();\n }\n logger.debug(JSON.stringify(debugContext, null, 2));\n }\n return result;\n };\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js\n var UUID = function(a) {\n return a ? (\n // a random number from 0 to 15\n (a ^ // unless b is 8,\n Math.random() * // in which case\n 16 >> // a random number from\n a / 4).toString(16)\n ) : (\n // or otherwise a concatenated string:\n (String(1e7) + // 10000000 +\n String(-1e3) + // -1000 +\n String(-4e3) + // -4000 +\n String(-8e3) + // -80000000 +\n String(-1e11)).replace(\n // replacing\n /[018]/g,\n // zeroes, ones, and eights with\n UUID\n )\n );\n };\n\n // node_modules/@amplitude/analytics-core/lib/esm/storage/memory.js\n var MemoryStorage = (\n /** @class */\n (function() {\n function MemoryStorage2() {\n this.memoryStorage = /* @__PURE__ */ new Map();\n }\n MemoryStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, true];\n });\n });\n };\n MemoryStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, this.memoryStorage.get(key)];\n });\n });\n };\n MemoryStorage2.prototype.getRaw = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.get(key)];\n case 1:\n value = _a.sent();\n return [2, value ? JSON.stringify(value) : void 0];\n }\n });\n });\n };\n MemoryStorage2.prototype.set = function(key, value) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.set(key, value);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.delete(key);\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n MemoryStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n this.memoryStorage.clear();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return MemoryStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-core/lib/esm/transports/base.js\n var BaseTransport = (\n /** @class */\n (function() {\n function BaseTransport2() {\n }\n BaseTransport2.prototype.send = function(_serverUrl, _payload) {\n return Promise.resolve(null);\n };\n BaseTransport2.prototype.buildResponse = function(responseJSON) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;\n if (typeof responseJSON !== "object") {\n return null;\n }\n var statusCode = responseJSON.code || 0;\n var status = this.buildStatus(statusCode);\n switch (status) {\n case Status.Success:\n return {\n status,\n statusCode,\n body: {\n eventsIngested: (_a = responseJSON.events_ingested) !== null && _a !== void 0 ? _a : 0,\n payloadSizeBytes: (_b = responseJSON.payload_size_bytes) !== null && _b !== void 0 ? _b : 0,\n serverUploadTime: (_c = responseJSON.server_upload_time) !== null && _c !== void 0 ? _c : 0\n }\n };\n case Status.Invalid:\n return {\n status,\n statusCode,\n body: {\n error: (_d = responseJSON.error) !== null && _d !== void 0 ? _d : "",\n missingField: (_e = responseJSON.missing_field) !== null && _e !== void 0 ? _e : "",\n eventsWithInvalidFields: (_f = responseJSON.events_with_invalid_fields) !== null && _f !== void 0 ? _f : {},\n eventsWithMissingFields: (_g = responseJSON.events_with_missing_fields) !== null && _g !== void 0 ? _g : {},\n eventsWithInvalidIdLengths: (_h = responseJSON.events_with_invalid_id_lengths) !== null && _h !== void 0 ? _h : {},\n epsThreshold: (_j = responseJSON.eps_threshold) !== null && _j !== void 0 ? _j : 0,\n exceededDailyQuotaDevices: (_k = responseJSON.exceeded_daily_quota_devices) !== null && _k !== void 0 ? _k : {},\n silencedDevices: (_l = responseJSON.silenced_devices) !== null && _l !== void 0 ? _l : [],\n silencedEvents: (_m = responseJSON.silenced_events) !== null && _m !== void 0 ? _m : [],\n throttledDevices: (_o = responseJSON.throttled_devices) !== null && _o !== void 0 ? _o : {},\n throttledEvents: (_p = responseJSON.throttled_events) !== null && _p !== void 0 ? _p : []\n }\n };\n case Status.PayloadTooLarge:\n return {\n status,\n statusCode,\n body: {\n error: (_q = responseJSON.error) !== null && _q !== void 0 ? _q : ""\n }\n };\n case Status.RateLimit:\n return {\n status,\n statusCode,\n body: {\n error: (_r = responseJSON.error) !== null && _r !== void 0 ? _r : "",\n epsThreshold: (_s = responseJSON.eps_threshold) !== null && _s !== void 0 ? _s : 0,\n throttledDevices: (_t = responseJSON.throttled_devices) !== null && _t !== void 0 ? _t : {},\n throttledUsers: (_u = responseJSON.throttled_users) !== null && _u !== void 0 ? _u : {},\n exceededDailyQuotaDevices: (_v = responseJSON.exceeded_daily_quota_devices) !== null && _v !== void 0 ? _v : {},\n exceededDailyQuotaUsers: (_w = responseJSON.exceeded_daily_quota_users) !== null && _w !== void 0 ? _w : {},\n throttledEvents: (_x = responseJSON.throttled_events) !== null && _x !== void 0 ? _x : []\n }\n };\n case Status.Timeout:\n default:\n return {\n status,\n statusCode\n };\n }\n };\n BaseTransport2.prototype.buildStatus = function(code) {\n if (code >= 200 && code < 300) {\n return Status.Success;\n }\n if (code === 429) {\n return Status.RateLimit;\n }\n if (code === 413) {\n return Status.PayloadTooLarge;\n }\n if (code === 408) {\n return Status.Timeout;\n }\n if (code >= 400 && code < 500) {\n return Status.Invalid;\n }\n if (code >= 500) {\n return Status.Failed;\n }\n return Status.Unknown;\n };\n return BaseTransport2;\n })()\n );\n\n // node_modules/@amplitude/analytics-connector/dist/analytics-connector.esm.js\n var ApplicationContextProviderImpl = (\n /** @class */\n (function() {\n function ApplicationContextProviderImpl2() {\n }\n ApplicationContextProviderImpl2.prototype.getApplicationContext = function() {\n return {\n versionName: this.versionName,\n language: getLanguage(),\n platform: "Web",\n os: void 0,\n deviceModel: void 0\n };\n };\n return ApplicationContextProviderImpl2;\n })()\n );\n var getLanguage = function() {\n return typeof navigator !== "undefined" && (navigator.languages && navigator.languages[0] || navigator.language) || "";\n };\n var EventBridgeImpl = (\n /** @class */\n (function() {\n function EventBridgeImpl2() {\n this.queue = [];\n }\n EventBridgeImpl2.prototype.logEvent = function(event) {\n if (!this.receiver) {\n if (this.queue.length < 512) {\n this.queue.push(event);\n }\n } else {\n this.receiver(event);\n }\n };\n EventBridgeImpl2.prototype.setEventReceiver = function(receiver) {\n this.receiver = receiver;\n if (this.queue.length > 0) {\n this.queue.forEach(function(event) {\n receiver(event);\n });\n this.queue = [];\n }\n };\n return EventBridgeImpl2;\n })()\n );\n var __assign2 = function() {\n __assign2 = Object.assign || function __assign3(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign2.apply(this, arguments);\n };\n function __values2(o) {\n var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === "number") return {\n next: function() {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");\n }\n function __read2(o, n) {\n var m = typeof Symbol === "function" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = {\n error\n };\n } finally {\n try {\n if (r && !r.done && (m = i["return"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n }\n var isEqual = function(obj1, obj2) {\n var e_1, _a;\n var primitive = ["string", "number", "boolean", "undefined"];\n var typeA = typeof obj1;\n var typeB = typeof obj2;\n if (typeA !== typeB) {\n return false;\n }\n try {\n for (var primitive_1 = __values2(primitive), primitive_1_1 = primitive_1.next(); !primitive_1_1.done; primitive_1_1 = primitive_1.next()) {\n var p = primitive_1_1.value;\n if (p === typeA) {\n return obj1 === obj2;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (primitive_1_1 && !primitive_1_1.done && (_a = primitive_1.return)) _a.call(primitive_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n if (obj1 == null && obj2 == null) {\n return true;\n } else if (obj1 == null || obj2 == null) {\n return false;\n }\n if (obj1.length !== obj2.length) {\n return false;\n }\n var isArrayA = Array.isArray(obj1);\n var isArrayB = Array.isArray(obj2);\n if (isArrayA !== isArrayB) {\n return false;\n }\n if (isArrayA && isArrayB) {\n for (var i = 0; i < obj1.length; i++) {\n if (!isEqual(obj1[i], obj2[i])) {\n return false;\n }\n }\n } else {\n var sorted1 = Object.keys(obj1).sort();\n var sorted2 = Object.keys(obj2).sort();\n if (!isEqual(sorted1, sorted2)) {\n return false;\n }\n var result_1 = true;\n Object.keys(obj1).forEach(function(key) {\n if (!isEqual(obj1[key], obj2[key])) {\n result_1 = false;\n }\n });\n return result_1;\n }\n return true;\n };\n var ID_OP_SET = "$set";\n var ID_OP_UNSET = "$unset";\n var ID_OP_CLEAR_ALL = "$clearAll";\n if (!Object.entries) {\n Object.entries = function(obj) {\n var ownProps = Object.keys(obj);\n var i = ownProps.length;\n var resArray = new Array(i);\n while (i--) {\n resArray[i] = [ownProps[i], obj[ownProps[i]]];\n }\n return resArray;\n };\n }\n var IdentityStoreImpl = (\n /** @class */\n (function() {\n function IdentityStoreImpl2() {\n this.identity = { userProperties: {} };\n this.listeners = /* @__PURE__ */ new Set();\n }\n IdentityStoreImpl2.prototype.editIdentity = function() {\n var self2 = this;\n var actingUserProperties = __assign2({}, this.identity.userProperties);\n var actingIdentity = __assign2(__assign2({}, this.identity), { userProperties: actingUserProperties });\n return {\n setUserId: function(userId) {\n actingIdentity.userId = userId;\n return this;\n },\n setDeviceId: function(deviceId) {\n actingIdentity.deviceId = deviceId;\n return this;\n },\n setUserProperties: function(userProperties) {\n actingIdentity.userProperties = userProperties;\n return this;\n },\n setOptOut: function(optOut) {\n actingIdentity.optOut = optOut;\n return this;\n },\n updateUserProperties: function(actions) {\n var e_1, _a, e_2, _b, e_3, _c;\n var actingProperties = actingIdentity.userProperties || {};\n try {\n for (var _d = __values2(Object.entries(actions)), _e = _d.next(); !_e.done; _e = _d.next()) {\n var _f = __read2(_e.value, 2), action = _f[0], properties = _f[1];\n switch (action) {\n case ID_OP_SET:\n try {\n for (var _g = (e_2 = void 0, __values2(Object.entries(properties))), _h = _g.next(); !_h.done; _h = _g.next()) {\n var _j = __read2(_h.value, 2), key = _j[0], value = _j[1];\n actingProperties[key] = value;\n }\n } catch (e_2_1) {\n e_2 = { error: e_2_1 };\n } finally {\n try {\n if (_h && !_h.done && (_b = _g.return)) _b.call(_g);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n break;\n case ID_OP_UNSET:\n try {\n for (var _k = (e_3 = void 0, __values2(Object.keys(properties))), _l = _k.next(); !_l.done; _l = _k.next()) {\n var key = _l.value;\n delete actingProperties[key];\n }\n } catch (e_3_1) {\n e_3 = { error: e_3_1 };\n } finally {\n try {\n if (_l && !_l.done && (_c = _k.return)) _c.call(_k);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n break;\n case ID_OP_CLEAR_ALL:\n actingProperties = {};\n break;\n }\n }\n } catch (e_1_1) {\n e_1 = { error: e_1_1 };\n } finally {\n try {\n if (_e && !_e.done && (_a = _d.return)) _a.call(_d);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n actingIdentity.userProperties = actingProperties;\n return this;\n },\n commit: function() {\n self2.setIdentity(actingIdentity);\n return this;\n }\n };\n };\n IdentityStoreImpl2.prototype.getIdentity = function() {\n return __assign2({}, this.identity);\n };\n IdentityStoreImpl2.prototype.setIdentity = function(identity) {\n var originalIdentity = __assign2({}, this.identity);\n this.identity = __assign2({}, identity);\n if (!isEqual(originalIdentity, this.identity)) {\n this.listeners.forEach(function(listener) {\n listener(identity);\n });\n }\n };\n IdentityStoreImpl2.prototype.addIdentityListener = function(listener) {\n this.listeners.add(listener);\n };\n IdentityStoreImpl2.prototype.removeIdentityListener = function(listener) {\n this.listeners.delete(listener);\n };\n return IdentityStoreImpl2;\n })()\n );\n var safeGlobal = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : self;\n var AnalyticsConnector = (\n /** @class */\n (function() {\n function AnalyticsConnector2() {\n this.identityStore = new IdentityStoreImpl();\n this.eventBridge = new EventBridgeImpl();\n this.applicationContextProvider = new ApplicationContextProviderImpl();\n }\n AnalyticsConnector2.getInstance = function(instanceName) {\n if (!safeGlobal["analyticsConnectorInstances"]) {\n safeGlobal["analyticsConnectorInstances"] = {};\n }\n if (!safeGlobal["analyticsConnectorInstances"][instanceName]) {\n safeGlobal["analyticsConnectorInstances"][instanceName] = new AnalyticsConnector2();\n }\n return safeGlobal["analyticsConnectorInstances"][instanceName];\n };\n return AnalyticsConnector2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/analytics-connector.js\n var getAnalyticsConnector = function(instanceName) {\n if (instanceName === void 0) {\n instanceName = "$default_instance";\n }\n return AnalyticsConnector.getInstance(instanceName);\n };\n var setConnectorUserId = function(userId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setUserId(userId).commit();\n };\n var setConnectorDeviceId = function(deviceId, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setDeviceId(deviceId).commit();\n };\n var setConnectorOptOut = function(optOut, instanceName) {\n getAnalyticsConnector(instanceName).identityStore.editIdentity().setOptOut(optOut).commit();\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/global-scope.js\n var getGlobalScope = function() {\n if (typeof globalThis !== "undefined") {\n return globalThis;\n }\n if (typeof window !== "undefined") {\n return window;\n }\n if (typeof self !== "undefined") {\n return self;\n }\n if (typeof global !== "undefined") {\n return global;\n }\n return void 0;\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/query-params.js\n var getQueryParams = function() {\n var _a;\n var globalScope = getGlobalScope();\n if (!((_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.location) === null || _a === void 0 ? void 0 : _a.search)) {\n return {};\n }\n var pairs = globalScope.location.search.substring(1).split("&").filter(Boolean);\n var params = pairs.reduce(function(acc, curr) {\n var query = curr.split("=", 2);\n var key = tryDecodeURIComponent(query[0]);\n var value = tryDecodeURIComponent(query[1]);\n if (!value) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n return params;\n };\n var tryDecodeURIComponent = function(value) {\n if (value === void 0) {\n value = "";\n }\n try {\n return decodeURIComponent(value);\n } catch (_a) {\n return "";\n }\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/constants.js\n var UTM_CAMPAIGN = "utm_campaign";\n var UTM_CONTENT = "utm_content";\n var UTM_ID = "utm_id";\n var UTM_MEDIUM = "utm_medium";\n var UTM_SOURCE = "utm_source";\n var UTM_TERM = "utm_term";\n var DCLID = "dclid";\n var FBCLID = "fbclid";\n var GBRAID = "gbraid";\n var GCLID = "gclid";\n var KO_CLICK_ID = "ko_click_id";\n var LI_FAT_ID = "li_fat_id";\n var MSCLKID = "msclkid";\n var RDT_CID = "rtd_cid";\n var TTCLID = "ttclid";\n var TWCLID = "twclid";\n var WBRAID = "wbraid";\n var BASE_CAMPAIGN = {\n utm_campaign: void 0,\n utm_content: void 0,\n utm_id: void 0,\n utm_medium: void 0,\n utm_source: void 0,\n utm_term: void 0,\n referrer: void 0,\n referring_domain: void 0,\n dclid: void 0,\n gbraid: void 0,\n gclid: void 0,\n fbclid: void 0,\n ko_click_id: void 0,\n li_fat_id: void 0,\n msclkid: void 0,\n rtd_cid: void 0,\n ttclid: void 0,\n twclid: void 0,\n wbraid: void 0\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/attribution/campaign-parser.js\n var CampaignParser = (\n /** @class */\n (function() {\n function CampaignParser2() {\n }\n CampaignParser2.prototype.parse = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, __assign(__assign(__assign(__assign({}, BASE_CAMPAIGN), this.getUtmParam()), this.getReferrer()), this.getClickIds())];\n });\n });\n };\n CampaignParser2.prototype.getUtmParam = function() {\n var params = getQueryParams();\n var utmCampaign = params[UTM_CAMPAIGN];\n var utmContent = params[UTM_CONTENT];\n var utmId = params[UTM_ID];\n var utmMedium = params[UTM_MEDIUM];\n var utmSource = params[UTM_SOURCE];\n var utmTerm = params[UTM_TERM];\n return {\n utm_campaign: utmCampaign,\n utm_content: utmContent,\n utm_id: utmId,\n utm_medium: utmMedium,\n utm_source: utmSource,\n utm_term: utmTerm\n };\n };\n CampaignParser2.prototype.getReferrer = function() {\n var _a, _b;\n var data = {\n referrer: void 0,\n referring_domain: void 0\n };\n try {\n data.referrer = document.referrer || void 0;\n data.referring_domain = (_b = (_a = data.referrer) === null || _a === void 0 ? void 0 : _a.split("/")[2]) !== null && _b !== void 0 ? _b : void 0;\n } catch (_c) {\n }\n return data;\n };\n CampaignParser2.prototype.getClickIds = function() {\n var _a;\n var params = getQueryParams();\n return _a = {}, _a[DCLID] = params[DCLID], _a[FBCLID] = params[FBCLID], _a[GBRAID] = params[GBRAID], _a[GCLID] = params[GCLID], _a[KO_CLICK_ID] = params[KO_CLICK_ID], _a[LI_FAT_ID] = params[LI_FAT_ID], _a[MSCLKID] = params[MSCLKID], _a[RDT_CID] = params[RDT_CID], _a[TTCLID] = params[TTCLID], _a[TWCLID] = params[TWCLID], _a[WBRAID] = params[WBRAID], _a;\n };\n return CampaignParser2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/cookie-name.js\n var getCookieName = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var getOldCookieName = function(apiKey) {\n return "".concat(AMPLITUDE_PREFIX.toLowerCase(), "_").concat(apiKey.substring(0, 6));\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/default-tracking.js\n var isFileDownloadTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.fileDownloads) {\n return true;\n }\n return false;\n };\n var isFormInteractionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.formInteractions) {\n return true;\n }\n return false;\n };\n var isPageViewTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if ((defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) === true || (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.pageViews) && typeof defaultTracking.pageViews === "object") {\n return true;\n }\n return false;\n };\n var isSessionTrackingEnabled = function(defaultTracking) {\n if (typeof defaultTracking === "boolean") {\n return defaultTracking;\n }\n if (defaultTracking === null || defaultTracking === void 0 ? void 0 : defaultTracking.sessions) {\n return true;\n }\n return false;\n };\n var getPageViewTrackingConfig = function(config) {\n var _a;\n var trackOn = ((_a = config.attribution) === null || _a === void 0 ? void 0 : _a.trackPageViews) ? "attribution" : function() {\n return false;\n };\n var trackHistoryChanges = void 0;\n var eventType = "Page View";\n var isDefaultPageViewTrackingEnabled = isPageViewTrackingEnabled(config.defaultTracking);\n if (isDefaultPageViewTrackingEnabled) {\n trackOn = void 0;\n eventType = void 0;\n if (config.defaultTracking && typeof config.defaultTracking === "object" && config.defaultTracking.pageViews && typeof config.defaultTracking.pageViews === "object") {\n if ("trackOn" in config.defaultTracking.pageViews) {\n trackOn = config.defaultTracking.pageViews.trackOn;\n }\n if ("trackHistoryChanges" in config.defaultTracking.pageViews) {\n trackHistoryChanges = config.defaultTracking.pageViews.trackHistoryChanges;\n }\n if ("eventType" in config.defaultTracking.pageViews && config.defaultTracking.pageViews.eventType) {\n eventType = config.defaultTracking.pageViews.eventType;\n }\n }\n }\n return {\n trackOn,\n trackHistoryChanges,\n eventType\n };\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/language.js\n var getLanguage2 = function() {\n var _a, _b, _c, _d;\n if (typeof navigator === "undefined")\n return "";\n var userLanguage = navigator.userLanguage;\n return (_d = (_c = (_b = (_a = navigator.languages) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : navigator.language) !== null && _c !== void 0 ? _c : userLanguage) !== null && _d !== void 0 ? _d : "";\n };\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/plugins/identity.js\n var IdentityEventSender = (\n /** @class */\n (function() {\n function IdentityEventSender2() {\n this.name = "identity";\n this.type = PluginType.BEFORE;\n this.identityStore = getAnalyticsConnector().identityStore;\n }\n IdentityEventSender2.prototype.execute = function(context) {\n return __awaiter(this, void 0, void 0, function() {\n var userProperties;\n return __generator(this, function(_a) {\n userProperties = context.user_properties;\n if (userProperties) {\n this.identityStore.editIdentity().updateUserProperties(userProperties).commit();\n }\n return [2, context];\n });\n });\n };\n IdentityEventSender2.prototype.setup = function(config) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (config.instanceName) {\n this.identityStore = getAnalyticsConnector(config.instanceName).identityStore;\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return IdentityEventSender2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/storage/cookie.js\n var CookieStorage = (\n /** @class */\n (function() {\n function CookieStorage2(options) {\n this.options = __assign({}, options);\n }\n CookieStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var testStrorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n CookieStorage2.testValue = String(Date.now());\n testStrorage = new CookieStorage2(this.options);\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStrorage.set(testKey, CookieStorage2.testValue)];\n case 2:\n _b.sent();\n return [4, testStrorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === CookieStorage2.testValue];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStrorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.getRaw(key)];\n case 1:\n value = _a.sent();\n if (!value) {\n return [2, void 0];\n }\n try {\n try {\n value = decodeURIComponent(atob(value));\n } catch (_b) {\n }\n return [2, JSON.parse(value)];\n } catch (_c) {\n return [2, void 0];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var globalScope, cookie, match;\n return __generator(this, function(_b) {\n globalScope = getGlobalScope();\n cookie = (_a = globalScope === null || globalScope === void 0 ? void 0 : globalScope.document.cookie.split("; ")) !== null && _a !== void 0 ? _a : [];\n match = cookie.find(function(c) {\n return c.indexOf(key + "=") === 0;\n });\n if (!match) {\n return [2, void 0];\n }\n return [2, match.substring(key.length + 1)];\n });\n });\n };\n CookieStorage2.prototype.set = function(key, value) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n var expirationDays, expires, expireDate, date, str, globalScope;\n return __generator(this, function(_b) {\n try {\n expirationDays = (_a = this.options.expirationDays) !== null && _a !== void 0 ? _a : 0;\n expires = value !== null ? expirationDays : -1;\n expireDate = void 0;\n if (expires) {\n date = /* @__PURE__ */ new Date();\n date.setTime(date.getTime() + expires * 24 * 60 * 60 * 1e3);\n expireDate = date;\n }\n str = "".concat(key, "=").concat(btoa(encodeURIComponent(JSON.stringify(value))));\n if (expireDate) {\n str += "; expires=".concat(expireDate.toUTCString());\n }\n str += "; path=/";\n if (this.options.domain) {\n str += "; domain=".concat(this.options.domain);\n }\n if (this.options.secure) {\n str += "; Secure";\n }\n if (this.options.sameSite) {\n str += "; SameSite=".concat(this.options.sameSite);\n }\n globalScope = getGlobalScope();\n if (globalScope) {\n globalScope.document.cookie = str;\n }\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n CookieStorage2.prototype.remove = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, this.set(key, null)];\n case 1:\n _a.sent();\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n CookieStorage2.prototype.reset = function() {\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return CookieStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-client-common/lib/esm/transports/fetch.js\n var FetchTransport = (\n /** @class */\n (function(_super) {\n __extends(FetchTransport2, _super);\n function FetchTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FetchTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var options, response, responseText;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n if (typeof fetch === "undefined") {\n throw new Error("FetchTransport is not supported");\n }\n options = {\n headers: {\n "Content-Type": "application/json",\n Accept: "*/*"\n },\n body: JSON.stringify(payload),\n method: "POST"\n };\n return [4, fetch(serverUrl, options)];\n case 1:\n response = _a.sent();\n return [4, response.text()];\n case 2:\n responseText = _a.sent();\n try {\n return [2, this.buildResponse(JSON.parse(responseText))];\n } catch (_b) {\n return [2, this.buildResponse({ code: response.status })];\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n return FetchTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/utils.js\n var omitUndefined = function(input) {\n var obj = {};\n for (var key in input) {\n var val = input[key];\n if (val) {\n obj[key] = val;\n }\n }\n return obj;\n };\n\n // node_modules/@amplitude/plugin-page-view-tracking-browser/lib/esm/page-view-tracking.js\n var pageViewTrackingPlugin = function() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var globalScope = getGlobalScope();\n var loggerProvider = void 0;\n var pushState;\n var _a = __read(args, 2), clientOrOptions = _a[0], configOrUndefined = _a[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var createPageViewEvent = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a2;\n var _b;\n var _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n _b = {\n event_type: (_c = options.eventType) !== null && _c !== void 0 ? _c : "Page View"\n };\n _a2 = [{}];\n return [4, getCampaignParams()];\n case 1:\n return [2, (_b.event_properties = __assign.apply(void 0, [__assign.apply(void 0, _a2.concat([_d.sent()])), { page_domain: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.hostname || ""\n ), page_location: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href || ""\n ), page_path: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.pathname || ""\n ), page_title: (\n /* istanbul ignore next */\n typeof document !== "undefined" && document.title || ""\n ), page_url: (\n /* istanbul ignore next */\n typeof location !== "undefined" && location.href.split("?")[0] || ""\n ) }]), _b)];\n }\n });\n });\n };\n var shouldTrackOnPageLoad = function() {\n return typeof options.trackOn === "undefined" || typeof options.trackOn === "function" && options.trackOn();\n };\n var previousURL = typeof location !== "undefined" ? location.href : null;\n var trackHistoryPageView = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var newURL, shouldTrackPageView, _a2, _b, _c;\n return __generator(this, function(_d) {\n switch (_d.label) {\n case 0:\n newURL = location.href;\n shouldTrackPageView = shouldTrackHistoryPageView(options.trackHistoryChanges, newURL, previousURL || "") && shouldTrackOnPageLoad();\n previousURL = newURL;\n if (!shouldTrackPageView) return [3, 4];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Tracking page view event");\n if (!(amplitude === null || amplitude === void 0)) return [3, 1];\n _a2 = void 0;\n return [3, 3];\n case 1:\n _c = (_b = amplitude).track;\n return [4, createPageViewEvent()];\n case 2:\n _a2 = _c.apply(_b, [_d.sent()]);\n _d.label = 3;\n case 3:\n _a2;\n _d.label = 4;\n case 4:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n var trackHistoryPageViewWrapper = function() {\n void trackHistoryPageView();\n };\n var plugin = {\n name: "page-view-tracking",\n type: PluginType.ENRICHMENT,\n setup: function(config, client) {\n return __awaiter(void 0, void 0, void 0, function() {\n var receivedType, _a2, _b;\n var _c, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n loggerProvider = config.loggerProvider;\n loggerProvider.log("Installing @amplitude/plugin-page-view-tracking-browser");\n options.trackOn = ((_c = config.attribution) === null || _c === void 0 ? void 0 : _c.trackPageViews) ? "attribution" : options.trackOn;\n if (!client && ((_d = config.attribution) === null || _d === void 0 ? void 0 : _d.trackPageViews)) {\n loggerProvider.warn("@amplitude/plugin-page-view-tracking-browser overrides page view tracking behavior defined in @amplitude/analytics-browser. Resolve by disabling page view tracking in @amplitude/analytics-browser.");\n config.attribution.trackPageViews = false;\n }\n if (options.trackHistoryChanges && globalScope) {\n globalScope.addEventListener("popstate", trackHistoryPageViewWrapper);\n pushState = globalScope.history.pushState;\n globalScope.history.pushState = new Proxy(globalScope.history.pushState, {\n apply: function(target, thisArg, _a3) {\n var _b2 = __read(_a3, 3), state = _b2[0], unused = _b2[1], url = _b2[2];\n target.apply(thisArg, [state, unused, url]);\n void trackHistoryPageView();\n }\n });\n }\n if (!shouldTrackOnPageLoad()) return [3, 2];\n loggerProvider.log("Tracking page view event");\n _b = (_a2 = amplitude).track;\n return [4, createPageViewEvent()];\n case 1:\n _b.apply(_a2, [_e.sent()]);\n _e.label = 2;\n case 2:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n var pageViewEvent;\n return __generator(this, function(_a2) {\n switch (_a2.label) {\n case 0:\n if (!(options.trackOn === "attribution" && isCampaignEvent(event))) return [3, 2];\n loggerProvider === null || loggerProvider === void 0 ? void 0 : loggerProvider.log("Enriching campaign event to page view event with campaign parameters");\n return [4, createPageViewEvent()];\n case 1:\n pageViewEvent = _a2.sent();\n event.event_type = pageViewEvent.event_type;\n event.event_properties = __assign(__assign({}, event.event_properties), pageViewEvent.event_properties);\n _a2.label = 2;\n case 2:\n return [2, event];\n }\n });\n });\n },\n teardown: function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n if (globalScope) {\n globalScope.removeEventListener("popstate", trackHistoryPageViewWrapper);\n if (pushState) {\n globalScope.history.pushState = pushState;\n }\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n }\n };\n plugin.__trackHistoryPageView = trackHistoryPageView;\n return plugin;\n };\n var getCampaignParams = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n var _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _a = omitUndefined;\n return [4, new CampaignParser().parse()];\n case 1:\n return [2, _a.apply(void 0, [_b.sent()])];\n }\n });\n });\n };\n var isCampaignEvent = function(event) {\n if (event.event_type === "$identify" && event.user_properties) {\n var properties = event.user_properties;\n var $set = properties[IdentifyOperation.SET] || {};\n var $unset = properties[IdentifyOperation.UNSET] || {};\n var userProperties_1 = __spreadArray(__spreadArray([], __read(Object.keys($set)), false), __read(Object.keys($unset)), false);\n return Object.keys(BASE_CAMPAIGN).every(function(value) {\n return userProperties_1.includes(value);\n });\n }\n return false;\n };\n var shouldTrackHistoryPageView = function(trackingOption, newURL, oldURL) {\n switch (trackingOption) {\n case "pathOnly":\n return newURL.split("?")[0] !== oldURL.split("?")[0];\n default:\n return newURL !== oldURL;\n }\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/helpers.js\n var getStorageKey = function(apiKey, postKey, limit) {\n if (postKey === void 0) {\n postKey = "";\n }\n if (limit === void 0) {\n limit = 10;\n }\n return [AMPLITUDE_PREFIX, postKey, apiKey.substring(0, limit)].filter(Boolean).join("_");\n };\n var domainWithoutSubdomain = function(domain) {\n var parts = domain.split(".");\n if (parts.length <= 2) {\n return domain;\n }\n return parts.slice(parts.length - 2, parts.length).join(".");\n };\n var isNewCampaign = function(current, previous, options) {\n var _a;\n var referrer = current.referrer, referring_domain = current.referring_domain, currentCampaign = __rest(current, ["referrer", "referring_domain"]);\n var _b = previous || {}, _previous_referrer = _b.referrer, prevReferringDomain = _b.referring_domain, previousCampaign = __rest(_b, ["referrer", "referring_domain"]);\n if (current.referring_domain && ((_a = options.excludeReferrers) === null || _a === void 0 ? void 0 : _a.includes(current.referring_domain))) {\n return false;\n }\n var hasNewCampaign = JSON.stringify(currentCampaign) !== JSON.stringify(previousCampaign);\n var hasNewDomain = domainWithoutSubdomain(referring_domain || "") !== domainWithoutSubdomain(prevReferringDomain || "");\n return !previous || hasNewCampaign || hasNewDomain;\n };\n var createCampaignEvent = function(campaign, options) {\n var campaignParameters = __assign(__assign({}, BASE_CAMPAIGN), campaign);\n var identifyEvent = Object.entries(campaignParameters).reduce(function(identify2, _a) {\n var _b;\n var _c = __read(_a, 2), key = _c[0], value = _c[1];\n identify2.setOnce("initial_".concat(key), (_b = value !== null && value !== void 0 ? value : options.initialEmptyValue) !== null && _b !== void 0 ? _b : "EMPTY");\n if (value) {\n return identify2.set(key, value);\n }\n return identify2.unset(key);\n }, new Identify());\n return createIdentifyEvent(identifyEvent);\n };\n\n // node_modules/@amplitude/plugin-web-attribution-browser/lib/esm/web-attribution.js\n var webAttributionPlugin = function() {\n var _this = this;\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var amplitude;\n var options = {};\n var _b = __read(args, 2), clientOrOptions = _b[0], configOrUndefined = _b[1];\n if (clientOrOptions && "init" in clientOrOptions) {\n amplitude = clientOrOptions;\n if (configOrUndefined) {\n options = configOrUndefined;\n }\n } else if (clientOrOptions) {\n options = clientOrOptions;\n }\n var excludeReferrers = (_a = options.excludeReferrers) !== null && _a !== void 0 ? _a : [];\n if (typeof location !== "undefined") {\n excludeReferrers.unshift(location.hostname);\n }\n options = __assign(__assign({ disabled: false, initialEmptyValue: "EMPTY", resetSessionOnNewCampaign: false }, options), { excludeReferrers });\n var plugin = {\n name: "web-attribution",\n type: PluginType.BEFORE,\n setup: function(config, client) {\n var _a2;\n return __awaiter(this, void 0, void 0, function() {\n var receivedType, storage, storageKey, _b2, currentCampaign, previousCampaign, pluginEnabledOverride, campaignEvent;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n amplitude = amplitude !== null && amplitude !== void 0 ? amplitude : client;\n if (!amplitude) {\n receivedType = clientOrOptions ? "Options" : "undefined";\n config.loggerProvider.error("Argument of type \'".concat(receivedType, "\' is not assignable to parameter of type \'BrowserClient\'."));\n return [\n 2\n /*return*/\n ];\n }\n if (options.disabled) {\n config.loggerProvider.log("@amplitude/plugin-web-attribution-browser is disabled. Attribution is not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n config.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser.");\n if (!client && !((_a2 = config.attribution) === null || _a2 === void 0 ? void 0 : _a2.disabled)) {\n config.loggerProvider.warn("@amplitude/plugin-web-attribution-browser overrides web attribution behavior defined in @amplitude/analytics-browser. Resolve by disabling web attribution tracking in @amplitude/analytics-browser.");\n config.attribution = {\n disabled: true\n };\n }\n storage = config.cookieStorage;\n storageKey = getStorageKey(config.apiKey, "MKTG");\n return [4, Promise.all([\n new CampaignParser().parse(),\n storage.get(storageKey)\n ])];\n case 1:\n _b2 = __read.apply(void 0, [_c.sent(), 2]), currentCampaign = _b2[0], previousCampaign = _b2[1];\n pluginEnabledOverride = this.__pluginEnabledOverride;\n if (pluginEnabledOverride !== null && pluginEnabledOverride !== void 0 ? pluginEnabledOverride : isNewCampaign(currentCampaign, previousCampaign, options)) {\n if (options.resetSessionOnNewCampaign) {\n amplitude.setSessionId(Date.now());\n config.loggerProvider.log("Created a new session for new campaign.");\n }\n config.loggerProvider.log("Tracking attribution.");\n campaignEvent = createCampaignEvent(currentCampaign, options);\n amplitude.track(campaignEvent);\n void storage.set(storageKey, currentCampaign);\n }\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n },\n execute: function(event) {\n return __awaiter(_this, void 0, void 0, function() {\n return __generator(this, function(_a2) {\n return [2, event];\n });\n });\n }\n };\n plugin.__pluginEnabledOverride = void 0;\n return plugin;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/storage/local-storage.js\n var MAX_ARRAY_LENGTH = 1e3;\n var LocalStorage = (\n /** @class */\n (function() {\n function LocalStorage2(config) {\n this.loggerProvider = config === null || config === void 0 ? void 0 : config.loggerProvider;\n }\n LocalStorage2.prototype.isEnabled = function() {\n return __awaiter(this, void 0, void 0, function() {\n var random, testStorage, testKey, value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n if (!getGlobalScope()) {\n return [2, false];\n }\n random = String(Date.now());\n testStorage = new LocalStorage2();\n testKey = "AMP_TEST";\n _b.label = 1;\n case 1:\n _b.trys.push([1, 4, 5, 7]);\n return [4, testStorage.set(testKey, random)];\n case 2:\n _b.sent();\n return [4, testStorage.get(testKey)];\n case 3:\n value = _b.sent();\n return [2, value === random];\n case 4:\n _a = _b.sent();\n return [2, false];\n case 5:\n return [4, testStorage.remove(testKey)];\n case 6:\n _b.sent();\n return [\n 7\n /*endfinally*/\n ];\n case 7:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.get = function(key) {\n return __awaiter(this, void 0, void 0, function() {\n var value, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [4, this.getRaw(key)];\n case 1:\n value = _b.sent();\n if (!value) {\n return [2, void 0];\n }\n return [2, JSON.parse(value)];\n case 2:\n _a = _b.sent();\n return [2, void 0];\n case 3:\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n LocalStorage2.prototype.getRaw = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n return [2, ((_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.getItem(key)) || void 0];\n });\n });\n };\n LocalStorage2.prototype.set = function(key, value) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var isExceededArraySize, serializedValue, droppedEventsCount;\n return __generator(this, function(_c) {\n isExceededArraySize = Array.isArray(value) && value.length > MAX_ARRAY_LENGTH;\n try {\n serializedValue = isExceededArraySize ? JSON.stringify(value.slice(0, MAX_ARRAY_LENGTH)) : JSON.stringify(value);\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.setItem(key, serializedValue);\n } catch (_d) {\n }\n if (isExceededArraySize) {\n droppedEventsCount = value.length - MAX_ARRAY_LENGTH;\n (_b = this.loggerProvider) === null || _b === void 0 ? void 0 : _b.error("Failed to save ".concat(droppedEventsCount, " events because the queue length exceeded ").concat(MAX_ARRAY_LENGTH, "."));\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.remove = function(key) {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.removeItem(key);\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n LocalStorage2.prototype.reset = function() {\n var _a;\n return __awaiter(this, void 0, void 0, function() {\n return __generator(this, function(_b) {\n try {\n (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.localStorage.clear();\n } catch (_c) {\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return LocalStorage2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/xhr.js\n var XHRTransport = (\n /** @class */\n (function(_super) {\n __extends(XHRTransport2, _super);\n function XHRTransport2() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.state = {\n done: 4\n };\n return _this;\n }\n XHRTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n if (typeof XMLHttpRequest === "undefined") {\n reject(new Error("XHRTransport is not supported."));\n }\n var xhr = new XMLHttpRequest();\n xhr.open("POST", serverUrl, true);\n xhr.onreadystatechange = function() {\n if (xhr.readyState === _this.state.done) {\n try {\n var responsePayload = xhr.responseText;\n var parsedResponsePayload = JSON.parse(responsePayload);\n var result = _this.buildResponse(parsedResponsePayload);\n resolve(result);\n } catch (e) {\n reject(e);\n }\n }\n };\n xhr.setRequestHeader("Content-Type", "application/json");\n xhr.setRequestHeader("Accept", "*/*");\n xhr.send(JSON.stringify(payload));\n })];\n });\n });\n };\n return XHRTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/transports/send-beacon.js\n var SendBeaconTransport = (\n /** @class */\n (function(_super) {\n __extends(SendBeaconTransport2, _super);\n function SendBeaconTransport2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SendBeaconTransport2.prototype.send = function(serverUrl, payload) {\n return __awaiter(this, void 0, void 0, function() {\n var _this = this;\n return __generator(this, function(_a) {\n return [2, new Promise(function(resolve, reject) {\n var globalScope = getGlobalScope();\n if (!(globalScope === null || globalScope === void 0 ? void 0 : globalScope.navigator.sendBeacon)) {\n throw new Error("SendBeaconTransport is not supported");\n }\n try {\n var data = JSON.stringify(payload);\n var success = globalScope.navigator.sendBeacon(serverUrl, JSON.stringify(payload));\n if (success) {\n return resolve(_this.buildResponse({\n code: 200,\n events_ingested: payload.events.length,\n payload_size_bytes: data.length,\n server_upload_time: Date.now()\n }));\n }\n return resolve(_this.buildResponse({ code: 500 }));\n } catch (e) {\n reject(e);\n }\n })];\n });\n });\n };\n return SendBeaconTransport2;\n })(BaseTransport)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/config.js\n var getDefaultConfig2 = function() {\n var cookieStorage = new MemoryStorage();\n var trackingOptions = {\n deviceManufacturer: true,\n deviceModel: true,\n ipAddress: true,\n language: true,\n osName: true,\n osVersion: true,\n platform: true\n };\n return {\n cookieExpiration: 365,\n cookieSameSite: "Lax",\n cookieSecure: false,\n cookieStorage,\n cookieUpgrade: true,\n disableCookies: false,\n domain: "",\n sessionTimeout: 30 * 60 * 1e3,\n trackingOptions,\n transportProvider: new FetchTransport()\n };\n };\n var BrowserConfig = (\n /** @class */\n (function(_super) {\n __extends(BrowserConfig2, _super);\n function BrowserConfig2(apiKey, options) {\n var _this = this;\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n var defaultConfig = getDefaultConfig2();\n _this = _super.call(this, __assign(__assign({ flushIntervalMillis: 1e3, flushMaxRetries: 5, flushQueueSize: 30, transportProvider: defaultConfig.transportProvider }, options), { apiKey })) || this;\n _this._optOut = false;\n _this.cookieStorage = (_a = options === null || options === void 0 ? void 0 : options.cookieStorage) !== null && _a !== void 0 ? _a : defaultConfig.cookieStorage;\n _this.deviceId = options === null || options === void 0 ? void 0 : options.deviceId;\n _this.lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n _this.lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n _this.optOut = Boolean(options === null || options === void 0 ? void 0 : options.optOut);\n _this.sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n _this.userId = options === null || options === void 0 ? void 0 : options.userId;\n _this.appVersion = options === null || options === void 0 ? void 0 : options.appVersion;\n _this.attribution = options === null || options === void 0 ? void 0 : options.attribution;\n _this.cookieExpiration = (_b = options === null || options === void 0 ? void 0 : options.cookieExpiration) !== null && _b !== void 0 ? _b : defaultConfig.cookieExpiration;\n _this.cookieSameSite = (_c = options === null || options === void 0 ? void 0 : options.cookieSameSite) !== null && _c !== void 0 ? _c : defaultConfig.cookieSameSite;\n _this.cookieSecure = (_d = options === null || options === void 0 ? void 0 : options.cookieSecure) !== null && _d !== void 0 ? _d : defaultConfig.cookieSecure;\n _this.cookieUpgrade = (_e = options === null || options === void 0 ? void 0 : options.cookieUpgrade) !== null && _e !== void 0 ? _e : defaultConfig.cookieUpgrade;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.disableCookies = (_f = options === null || options === void 0 ? void 0 : options.disableCookies) !== null && _f !== void 0 ? _f : defaultConfig.disableCookies;\n _this.defaultTracking = options === null || options === void 0 ? void 0 : options.defaultTracking;\n _this.domain = (_g = options === null || options === void 0 ? void 0 : options.domain) !== null && _g !== void 0 ? _g : defaultConfig.domain;\n _this.partnerId = options === null || options === void 0 ? void 0 : options.partnerId;\n _this.sessionTimeout = (_h = options === null || options === void 0 ? void 0 : options.sessionTimeout) !== null && _h !== void 0 ? _h : defaultConfig.sessionTimeout;\n _this.trackingOptions = (_j = options === null || options === void 0 ? void 0 : options.trackingOptions) !== null && _j !== void 0 ? _j : defaultConfig.trackingOptions;\n return _this;\n }\n Object.defineProperty(BrowserConfig2.prototype, "deviceId", {\n get: function() {\n return this._deviceId;\n },\n set: function(deviceId) {\n if (this._deviceId !== deviceId) {\n this._deviceId = deviceId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "userId", {\n get: function() {\n return this._userId;\n },\n set: function(userId) {\n if (this._userId !== userId) {\n this._userId = userId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "sessionId", {\n get: function() {\n return this._sessionId;\n },\n set: function(sessionId) {\n if (this._sessionId !== sessionId) {\n this._sessionId = sessionId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "optOut", {\n get: function() {\n return this._optOut;\n },\n set: function(optOut) {\n if (this._optOut !== optOut) {\n this._optOut = optOut;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventTime", {\n get: function() {\n return this._lastEventTime;\n },\n set: function(lastEventTime) {\n if (this._lastEventTime !== lastEventTime) {\n this._lastEventTime = lastEventTime;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BrowserConfig2.prototype, "lastEventId", {\n get: function() {\n return this._lastEventId;\n },\n set: function(lastEventId) {\n if (this._lastEventId !== lastEventId) {\n this._lastEventId = lastEventId;\n this.updateStorage();\n }\n },\n enumerable: false,\n configurable: true\n });\n BrowserConfig2.prototype.updateStorage = function() {\n var _a;\n var cache = {\n deviceId: this._deviceId,\n userId: this._userId,\n sessionId: this._sessionId,\n optOut: this._optOut,\n lastEventTime: this._lastEventTime,\n lastEventId: this._lastEventId\n };\n void ((_a = this.cookieStorage) === null || _a === void 0 ? void 0 : _a.set(getCookieName(this.apiKey), cache));\n };\n return BrowserConfig2;\n })(Config)\n );\n var useBrowserConfig = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var defaultConfig, deviceId, lastEventId, lastEventTime, optOut, sessionId, userId, cookieStorage, domain, _a, _b, _c;\n var _d;\n var _e, _f;\n return __generator(this, function(_g) {\n switch (_g.label) {\n case 0:\n defaultConfig = getDefaultConfig2();\n deviceId = (_e = options === null || options === void 0 ? void 0 : options.deviceId) !== null && _e !== void 0 ? _e : UUID();\n lastEventId = options === null || options === void 0 ? void 0 : options.lastEventId;\n lastEventTime = options === null || options === void 0 ? void 0 : options.lastEventTime;\n optOut = options === null || options === void 0 ? void 0 : options.optOut;\n sessionId = options === null || options === void 0 ? void 0 : options.sessionId;\n userId = options === null || options === void 0 ? void 0 : options.userId;\n cookieStorage = options === null || options === void 0 ? void 0 : options.cookieStorage;\n domain = options === null || options === void 0 ? void 0 : options.domain;\n _a = BrowserConfig.bind;\n _b = [void 0, apiKey];\n _c = [__assign({}, options)];\n _d = { cookieStorage, deviceId, domain, lastEventId, lastEventTime, optOut, sessionId };\n return [4, createEventsStorage(options)];\n case 1:\n return [2, new (_a.apply(BrowserConfig, _b.concat([__assign.apply(void 0, _c.concat([(_d.storageProvider = _g.sent(), _d.trackingOptions = __assign(__assign({}, defaultConfig.trackingOptions), options === null || options === void 0 ? void 0 : options.trackingOptions), _d.transportProvider = (_f = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _f !== void 0 ? _f : createTransport(options === null || options === void 0 ? void 0 : options.transport), _d.userId = userId, _d)]))])))()];\n }\n });\n });\n };\n var createCookieStorage = function(overrides, baseConfig) {\n if (baseConfig === void 0) {\n baseConfig = getDefaultConfig2();\n }\n return __awaiter(void 0, void 0, void 0, function() {\n var options, cookieStorage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n options = __assign(__assign({}, baseConfig), overrides);\n cookieStorage = overrides === null || overrides === void 0 ? void 0 : overrides.cookieStorage;\n _a = !cookieStorage;\n if (_a) return [3, 2];\n return [4, cookieStorage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (_a) {\n return [2, createFlexibleStorage(options)];\n }\n return [2, cookieStorage];\n }\n });\n });\n };\n var createFlexibleStorage = function(options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, _a;\n return __generator(this, function(_b) {\n switch (_b.label) {\n case 0:\n storage = new CookieStorage({\n domain: options.domain,\n expirationDays: options.cookieExpiration,\n sameSite: options.cookieSameSite,\n secure: options.cookieSecure\n });\n _a = options.disableCookies;\n if (_a) return [3, 2];\n return [4, storage.isEnabled()];\n case 1:\n _a = !_b.sent();\n _b.label = 2;\n case 2:\n if (!_a) return [3, 4];\n storage = new LocalStorage();\n return [4, storage.isEnabled()];\n case 3:\n if (!_b.sent()) {\n storage = new MemoryStorage();\n }\n _b.label = 4;\n case 4:\n return [2, storage];\n }\n });\n });\n };\n var createEventsStorage = function(overrides) {\n return __awaiter(void 0, void 0, void 0, function() {\n var hasStorageProviderProperty, loggerProvider, _a, _b, storage, _c, e_1_1;\n var e_1, _d;\n return __generator(this, function(_e) {\n switch (_e.label) {\n case 0:\n hasStorageProviderProperty = overrides && Object.prototype.hasOwnProperty.call(overrides, "storageProvider");\n loggerProvider = overrides && overrides.loggerProvider;\n if (!(!hasStorageProviderProperty || overrides.storageProvider)) return [3, 9];\n _e.label = 1;\n case 1:\n _e.trys.push([1, 7, 8, 9]);\n _a = __values([overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider, new LocalStorage({ loggerProvider })]), _b = _a.next();\n _e.label = 2;\n case 2:\n if (!!_b.done) return [3, 6];\n storage = _b.value;\n _c = storage;\n if (!_c) return [3, 4];\n return [4, storage.isEnabled()];\n case 3:\n _c = _e.sent();\n _e.label = 4;\n case 4:\n if (_c) {\n return [2, storage];\n }\n _e.label = 5;\n case 5:\n _b = _a.next();\n return [3, 2];\n case 6:\n return [3, 9];\n case 7:\n e_1_1 = _e.sent();\n e_1 = { error: e_1_1 };\n return [3, 9];\n case 8:\n try {\n if (_b && !_b.done && (_d = _a.return)) _d.call(_a);\n } finally {\n if (e_1) throw e_1.error;\n }\n return [\n 7\n /*endfinally*/\n ];\n case 9:\n return [2, void 0];\n }\n });\n });\n };\n var createTransport = function(transport) {\n if (transport === TransportType.XHR) {\n return new XHRTransport();\n }\n if (transport === TransportType.SendBeacon) {\n return new SendBeaconTransport();\n }\n return getDefaultConfig2().transportProvider;\n };\n var getTopLevelDomain = function(url) {\n return __awaiter(void 0, void 0, void 0, function() {\n var host, parts, levels, storageKey, i, i, domain, options, storage, value;\n return __generator(this, function(_a) {\n switch (_a.label) {\n case 0:\n return [4, new CookieStorage().isEnabled()];\n case 1:\n if (!_a.sent() || !url && typeof location === "undefined") {\n return [2, ""];\n }\n host = url !== null && url !== void 0 ? url : location.hostname;\n parts = host.split(".");\n levels = [];\n storageKey = "AMP_TLDTEST";\n for (i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join("."));\n }\n i = 0;\n _a.label = 2;\n case 2:\n if (!(i < levels.length)) return [3, 7];\n domain = levels[i];\n options = { domain: "." + domain };\n storage = new CookieStorage(options);\n return [4, storage.set(storageKey, 1)];\n case 3:\n _a.sent();\n return [4, storage.get(storageKey)];\n case 4:\n value = _a.sent();\n if (!value) return [3, 6];\n return [4, storage.remove(storageKey)];\n case 5:\n _a.sent();\n return [2, "." + domain];\n case 6:\n i++;\n return [3, 2];\n case 7:\n return [2, ""];\n }\n });\n });\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/constants.js\n var DEFAULT_EVENT_PREFIX = "[Amplitude]";\n var DEFAULT_PAGE_VIEW_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Page Viewed");\n var DEFAULT_FORM_START_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Started");\n var DEFAULT_FORM_SUBMIT_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " Form Submitted");\n var DEFAULT_FILE_DOWNLOAD_EVENT = "".concat(DEFAULT_EVENT_PREFIX, " File Downloaded");\n var DEFAULT_SESSION_START_EVENT = "session_start";\n var DEFAULT_SESSION_END_EVENT = "session_end";\n var FILE_EXTENSION = "".concat(DEFAULT_EVENT_PREFIX, " File Extension");\n var FILE_NAME = "".concat(DEFAULT_EVENT_PREFIX, " File Name");\n var LINK_ID = "".concat(DEFAULT_EVENT_PREFIX, " Link ID");\n var LINK_TEXT = "".concat(DEFAULT_EVENT_PREFIX, " Link Text");\n var LINK_URL = "".concat(DEFAULT_EVENT_PREFIX, " Link URL");\n var FORM_ID = "".concat(DEFAULT_EVENT_PREFIX, " Form ID");\n var FORM_NAME = "".concat(DEFAULT_EVENT_PREFIX, " Form Name");\n var FORM_DESTINATION = "".concat(DEFAULT_EVENT_PREFIX, " Form Destination");\n\n // node_modules/@amplitude/analytics-browser/lib/esm/cookie-migration/index.js\n var parseLegacyCookies = function(apiKey, options) {\n return __awaiter(void 0, void 0, void 0, function() {\n var storage, oldCookieName, cookies, _a, deviceId, userId, optOut, sessionId, lastEventTime, lastEventId;\n var _b;\n return __generator(this, function(_c) {\n switch (_c.label) {\n case 0:\n return [4, createCookieStorage(options)];\n case 1:\n storage = _c.sent();\n oldCookieName = getOldCookieName(apiKey);\n return [4, storage.getRaw(oldCookieName)];\n case 2:\n cookies = _c.sent();\n if (!cookies) {\n return [2, {\n optOut: false\n }];\n }\n if (!((_b = options.cookieUpgrade) !== null && _b !== void 0 ? _b : getDefaultConfig2().cookieUpgrade)) return [3, 4];\n return [4, storage.remove(oldCookieName)];\n case 3:\n _c.sent();\n _c.label = 4;\n case 4:\n _a = __read(cookies.split("."), 6), deviceId = _a[0], userId = _a[1], optOut = _a[2], sessionId = _a[3], lastEventTime = _a[4], lastEventId = _a[5];\n return [2, {\n deviceId,\n userId: decode(userId),\n sessionId: parseTime(sessionId),\n lastEventId: parseTime(lastEventId),\n lastEventTime: parseTime(lastEventTime),\n optOut: Boolean(optOut)\n }];\n }\n });\n });\n };\n var parseTime = function(num) {\n var integer = parseInt(num, 32);\n if (isNaN(integer)) {\n return void 0;\n }\n return integer;\n };\n var decode = function(value) {\n if (!atob || !escape || !value) {\n return void 0;\n }\n try {\n return decodeURIComponent(escape(atob(value)));\n } catch (_a) {\n return void 0;\n }\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var import_ua_parser_js = __toESM(require_ua_parser());\n\n // node_modules/@amplitude/analytics-browser/lib/esm/version.js\n var VERSION = "1.13.4";\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/context.js\n var BROWSER_PLATFORM = "Web";\n var IP_ADDRESS = "$remote";\n var Context = (\n /** @class */\n (function() {\n function Context2() {\n this.name = "context";\n this.type = PluginType.BEFORE;\n this.library = "amplitude-ts/".concat(VERSION);\n if (typeof navigator !== "undefined") {\n this.userAgent = navigator.userAgent;\n }\n this.uaResult = new import_ua_parser_js.default(this.userAgent).getResult();\n }\n Context2.prototype.setup = function(config) {\n this.config = config;\n return Promise.resolve(void 0);\n };\n Context2.prototype.execute = function(context) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function() {\n var time, osName, osVersion, deviceModel, deviceVendor, lastEventId, nextEventId, event;\n return __generator(this, function(_c) {\n time = (/* @__PURE__ */ new Date()).getTime();\n osName = this.uaResult.browser.name;\n osVersion = this.uaResult.browser.version;\n deviceModel = this.uaResult.device.model || this.uaResult.os.name;\n deviceVendor = this.uaResult.device.vendor;\n lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n nextEventId = (_b = context.event_id) !== null && _b !== void 0 ? _b : lastEventId + 1;\n this.config.lastEventId = nextEventId;\n if (!context.time) {\n this.config.lastEventTime = time;\n }\n event = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ user_id: this.config.userId, device_id: this.config.deviceId, session_id: this.config.sessionId, time }, this.config.appVersion && { app_version: this.config.appVersion }), this.config.trackingOptions.platform && { platform: BROWSER_PLATFORM }), this.config.trackingOptions.osName && { os_name: osName }), this.config.trackingOptions.osVersion && { os_version: osVersion }), this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor }), this.config.trackingOptions.deviceModel && { device_model: deviceModel }), this.config.trackingOptions.language && { language: getLanguage2() }), this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS }), { insert_id: UUID(), partner_id: this.config.partnerId, plan: this.config.plan }), this.config.ingestionMetadata && {\n ingestion_metadata: {\n source_name: this.config.ingestionMetadata.sourceName,\n source_version: this.config.ingestionMetadata.sourceVersion\n }\n }), context), { event_id: nextEventId, library: this.library, user_agent: this.userAgent });\n return [2, event];\n });\n });\n };\n return Context2;\n })()\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/default-page-view-event-enrichment.js\n var eventPropertyMap = {\n page_domain: "".concat(DEFAULT_EVENT_PREFIX, " Page Domain"),\n page_location: "".concat(DEFAULT_EVENT_PREFIX, " Page Location"),\n page_path: "".concat(DEFAULT_EVENT_PREFIX, " Page Path"),\n page_title: "".concat(DEFAULT_EVENT_PREFIX, " Page Title"),\n page_url: "".concat(DEFAULT_EVENT_PREFIX, " Page URL")\n };\n var defaultPageViewEventEnrichment = function() {\n var name = "@amplitude/plugin-default-page-view-event-enrichment-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, void 0];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n if (event.event_type === DEFAULT_PAGE_VIEW_EVENT && event.event_properties) {\n event.event_properties = Object.entries(event.event_properties).reduce(function(acc, _a2) {\n var _b = __read(_a2, 2), key = _b[0], value = _b[1];\n var transformedPropertyName = eventPropertyMap[key];\n if (transformedPropertyName) {\n acc[transformedPropertyName] = value;\n } else {\n acc[key] = value;\n }\n return acc;\n }, {});\n }\n return [2, event];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/file-download-tracking.js\n var fileDownloadTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-file-download-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFileDownloadListener, ext, links;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFileDownloadListener = function(a) {\n var url;\n try {\n url = new URL(a.href, window.location.href);\n } catch (_a2) {\n return;\n }\n var result = ext.exec(url.href);\n var fileExtension = result === null || result === void 0 ? void 0 : result[1];\n if (fileExtension) {\n addEventListener(a, "click", function() {\n var _a2;\n if (fileExtension) {\n amplitude.track(DEFAULT_FILE_DOWNLOAD_EVENT, (_a2 = {}, _a2[FILE_EXTENSION] = fileExtension, _a2[FILE_NAME] = url.pathname, _a2[LINK_ID] = a.id, _a2[LINK_TEXT] = a.text, _a2[LINK_URL] = a.href, _a2));\n }\n });\n }\n };\n ext = /\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;\n links = Array.from(document.getElementsByTagName("a"));\n links.forEach(addFileDownloadListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "A") {\n addFileDownloadListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("a")).map(addFileDownloadListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/plugins/form-interaction-tracking.js\n var formInteractionTracking = function() {\n var observer;\n var eventListeners = [];\n var addEventListener = function(element, type2, handler) {\n element.addEventListener(type2, handler);\n eventListeners.push({\n element,\n type: type2,\n handler\n });\n };\n var removeClickListeners = function() {\n eventListeners.forEach(function(_a) {\n var element = _a.element, type2 = _a.type, handler = _a.handler;\n element === null || element === void 0 ? void 0 : element.removeEventListener(type2, handler);\n });\n eventListeners = [];\n };\n var name = "@amplitude/plugin-form-interaction-tracking-browser";\n var type = PluginType.ENRICHMENT;\n var setup = function(config, amplitude) {\n return __awaiter(void 0, void 0, void 0, function() {\n var addFormInteractionListener, forms;\n return __generator(this, function(_a) {\n if (!amplitude) {\n config.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");\n return [\n 2\n /*return*/\n ];\n }\n if (typeof document === "undefined") {\n return [\n 2\n /*return*/\n ];\n }\n addFormInteractionListener = function(form) {\n var hasFormChanged = false;\n addEventListener(form, "change", function() {\n var _a2;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n hasFormChanged = true;\n });\n addEventListener(form, "submit", function() {\n var _a2, _b;\n if (!hasFormChanged) {\n amplitude.track(DEFAULT_FORM_START_EVENT, (_a2 = {}, _a2[FORM_ID] = form.id, _a2[FORM_NAME] = form.name, _a2[FORM_DESTINATION] = form.action, _a2));\n }\n amplitude.track(DEFAULT_FORM_SUBMIT_EVENT, (_b = {}, _b[FORM_ID] = form.id, _b[FORM_NAME] = form.name, _b[FORM_DESTINATION] = form.action, _b));\n hasFormChanged = false;\n });\n };\n forms = Array.from(document.getElementsByTagName("form"));\n forms.forEach(addFormInteractionListener);\n if (typeof MutationObserver !== "undefined") {\n observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function(node) {\n if (node.nodeName === "FORM") {\n addFormInteractionListener(node);\n }\n if ("querySelectorAll" in node && typeof node.querySelectorAll === "function") {\n Array.from(node.querySelectorAll("form")).map(addFormInteractionListener);\n }\n });\n });\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n var execute = function(event) {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n return [2, event];\n });\n });\n };\n var teardown = function() {\n return __awaiter(void 0, void 0, void 0, function() {\n return __generator(this, function(_a) {\n observer === null || observer === void 0 ? void 0 : observer.disconnect();\n removeClickListeners();\n return [\n 2\n /*return*/\n ];\n });\n });\n };\n return {\n name,\n type,\n setup,\n execute,\n teardown\n };\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/utils/snippet-helper.js\n var convertProxyObjectToRealObject = function(instance, queue) {\n for (var i = 0; i < queue.length; i++) {\n var _a = queue[i], name_1 = _a.name, args = _a.args, resolve = _a.resolve;\n var fn = instance && instance[name_1];\n if (typeof fn === "function") {\n var result = fn.apply(instance, args);\n if (typeof resolve === "function") {\n resolve(result === null || result === void 0 ? void 0 : result.promise);\n }\n }\n }\n return instance;\n };\n var isInstanceProxy = function(instance) {\n var instanceProxy = instance;\n return instanceProxy && instanceProxy._q !== void 0;\n };\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client.js\n var AmplitudeBrowser = (\n /** @class */\n (function(_super) {\n __extends(AmplitudeBrowser2, _super);\n function AmplitudeBrowser2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AmplitudeBrowser2.prototype.init = function(apiKey, userId, options) {\n if (apiKey === void 0) {\n apiKey = "";\n }\n return returnWrapper(this._init(__assign(__assign({}, options), { userId, apiKey })));\n };\n AmplitudeBrowser2.prototype._init = function(options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _r, _s, _t, _u, _v, _w;\n return __awaiter(this, void 0, void 0, function() {\n var _x, _y, _z, legacyCookies, cookieStorage, previousCookies, queryParams, deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, browserOptions, isNewSession, connector, webAttribution, pageViewTrackingOptions;\n var _this = this;\n return __generator(this, function(_0) {\n switch (_0.label) {\n case 0:\n if (this.initializing) {\n return [\n 2\n /*return*/\n ];\n }\n this.initializing = true;\n _x = options;\n if (!options.disableCookies) return [3, 1];\n _y = "";\n return [3, 5];\n case 1:\n if (!((_a = options.domain) !== null && _a !== void 0)) return [3, 2];\n _z = _a;\n return [3, 4];\n case 2:\n return [4, getTopLevelDomain()];\n case 3:\n _z = _0.sent();\n _0.label = 4;\n case 4:\n _y = _z;\n _0.label = 5;\n case 5:\n _x.domain = _y;\n return [4, parseLegacyCookies(options.apiKey, options)];\n case 6:\n legacyCookies = _0.sent();\n return [4, createCookieStorage(options)];\n case 7:\n cookieStorage = _0.sent();\n return [4, cookieStorage.get(getCookieName(options.apiKey))];\n case 8:\n previousCookies = _0.sent();\n queryParams = getQueryParams();\n deviceId = (_d = (_c = (_b = options.deviceId) !== null && _b !== void 0 ? _b : queryParams.deviceId) !== null && _c !== void 0 ? _c : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _d !== void 0 ? _d : legacyCookies.deviceId;\n sessionId = (_e = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.sessionId) !== null && _e !== void 0 ? _e : legacyCookies.sessionId;\n optOut = (_g = (_f = options.optOut) !== null && _f !== void 0 ? _f : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.optOut) !== null && _g !== void 0 ? _g : legacyCookies.optOut;\n lastEventId = (_h = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventId) !== null && _h !== void 0 ? _h : legacyCookies.lastEventId;\n lastEventTime = (_j = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.lastEventTime) !== null && _j !== void 0 ? _j : legacyCookies.lastEventTime;\n userId = (_l = (_k = options.userId) !== null && _k !== void 0 ? _k : previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _l !== void 0 ? _l : legacyCookies.userId;\n this.previousSessionDeviceId = (_m = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.deviceId) !== null && _m !== void 0 ? _m : legacyCookies.deviceId;\n this.previousSessionUserId = (_o = previousCookies === null || previousCookies === void 0 ? void 0 : previousCookies.userId) !== null && _o !== void 0 ? _o : legacyCookies.userId;\n return [4, useBrowserConfig(options.apiKey, __assign(__assign({}, options), { deviceId, sessionId, optOut, lastEventId, lastEventTime, userId, cookieStorage }))];\n case 9:\n browserOptions = _0.sent();\n return [4, _super.prototype._init.call(this, browserOptions)];\n case 10:\n _0.sent();\n isNewSession = false;\n if (\n // user has never sent an event\n !this.config.lastEventTime || // user has no previous session ID\n !this.config.sessionId || // has sent an event and has previous session but expired\n this.config.lastEventTime && Date.now() - this.config.lastEventTime > this.config.sessionTimeout\n ) {\n this.setSessionId((_r = (_p = options.sessionId) !== null && _p !== void 0 ? _p : this.config.sessionId) !== null && _r !== void 0 ? _r : Date.now());\n isNewSession = true;\n }\n connector = getAnalyticsConnector(options.instanceName);\n connector.identityStore.setIdentity({\n userId: this.config.userId,\n deviceId: this.config.deviceId\n });\n return [4, this.add(new Destination()).promise];\n case 11:\n _0.sent();\n return [4, this.add(new Context()).promise];\n case 12:\n _0.sent();\n return [4, this.add(new IdentityEventSender()).promise];\n case 13:\n _0.sent();\n if (!isFileDownloadTrackingEnabled(this.config.defaultTracking)) return [3, 15];\n return [4, this.add(fileDownloadTracking()).promise];\n case 14:\n _0.sent();\n _0.label = 15;\n case 15:\n if (!isFormInteractionTrackingEnabled(this.config.defaultTracking)) return [3, 17];\n return [4, this.add(formInteractionTracking()).promise];\n case 16:\n _0.sent();\n _0.label = 17;\n case 17:\n if (!!((_s = this.config.attribution) === null || _s === void 0 ? void 0 : _s.disabled)) return [3, 19];\n webAttribution = webAttributionPlugin({\n excludeReferrers: (_t = this.config.attribution) === null || _t === void 0 ? void 0 : _t.excludeReferrers,\n initialEmptyValue: (_u = this.config.attribution) === null || _u === void 0 ? void 0 : _u.initialEmptyValue,\n resetSessionOnNewCampaign: (_v = this.config.attribution) === null || _v === void 0 ? void 0 : _v.resetSessionOnNewCampaign\n });\n webAttribution.__pluginEnabledOverride = isNewSession || ((_w = this.config.attribution) === null || _w === void 0 ? void 0 : _w.trackNewCampaigns) ? void 0 : false;\n return [4, this.add(webAttribution).promise];\n case 18:\n _0.sent();\n _0.label = 19;\n case 19:\n pageViewTrackingOptions = getPageViewTrackingConfig(this.config);\n pageViewTrackingOptions.eventType = pageViewTrackingOptions.eventType || DEFAULT_PAGE_VIEW_EVENT;\n return [4, this.add(pageViewTrackingPlugin(pageViewTrackingOptions)).promise];\n case 20:\n _0.sent();\n return [4, this.add(defaultPageViewEventEnrichment()).promise];\n case 21:\n _0.sent();\n this.initializing = false;\n return [4, this.runQueuedFunctions("dispatchQ")];\n case 22:\n _0.sent();\n connector.eventBridge.setEventReceiver(function(event) {\n void _this.track(event.eventType, event.eventProperties);\n });\n return [\n 2\n /*return*/\n ];\n }\n });\n });\n };\n AmplitudeBrowser2.prototype.getUserId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.userId;\n };\n AmplitudeBrowser2.prototype.setUserId = function(userId) {\n if (!this.config) {\n this.q.push(this.setUserId.bind(this, userId));\n return;\n }\n if (userId !== this.config.userId || userId === void 0) {\n this.config.userId = userId;\n setConnectorUserId(userId, this.config.instanceName);\n }\n };\n AmplitudeBrowser2.prototype.getDeviceId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.deviceId;\n };\n AmplitudeBrowser2.prototype.setDeviceId = function(deviceId) {\n if (!this.config) {\n this.q.push(this.setDeviceId.bind(this, deviceId));\n return;\n }\n this.config.deviceId = deviceId;\n setConnectorDeviceId(deviceId, this.config.instanceName);\n };\n AmplitudeBrowser2.prototype.setOptOut = function(optOut) {\n setConnectorOptOut(optOut, this.config.instanceName);\n _super.prototype.setOptOut.call(this, optOut);\n };\n AmplitudeBrowser2.prototype.reset = function() {\n this.setDeviceId(UUID());\n this.setUserId(void 0);\n };\n AmplitudeBrowser2.prototype.getSessionId = function() {\n var _a;\n return (_a = this.config) === null || _a === void 0 ? void 0 : _a.sessionId;\n };\n AmplitudeBrowser2.prototype.setSessionId = function(sessionId) {\n var _a;\n if (!this.config) {\n this.q.push(this.setSessionId.bind(this, sessionId));\n return;\n }\n if (sessionId === this.config.sessionId) {\n return;\n }\n var previousSessionId = this.getSessionId();\n var lastEventTime = this.config.lastEventTime;\n var lastEventId = (_a = this.config.lastEventId) !== null && _a !== void 0 ? _a : -1;\n this.config.sessionId = sessionId;\n this.config.lastEventTime = void 0;\n if (isSessionTrackingEnabled(this.config.defaultTracking)) {\n if (previousSessionId && lastEventTime) {\n this.track(DEFAULT_SESSION_END_EVENT, void 0, {\n device_id: this.previousSessionDeviceId,\n event_id: ++lastEventId,\n session_id: previousSessionId,\n time: lastEventTime + 1,\n user_id: this.previousSessionUserId\n });\n }\n this.config.lastEventTime = this.config.sessionId;\n this.track(DEFAULT_SESSION_START_EVENT, void 0, {\n event_id: ++lastEventId,\n session_id: this.config.sessionId,\n time: this.config.lastEventTime\n });\n }\n this.previousSessionDeviceId = this.config.deviceId;\n this.previousSessionUserId = this.config.userId;\n };\n AmplitudeBrowser2.prototype.extendSession = function() {\n if (!this.config) {\n this.q.push(this.extendSession.bind(this));\n return;\n }\n this.config.lastEventTime = Date.now();\n };\n AmplitudeBrowser2.prototype.setTransport = function(transport) {\n if (!this.config) {\n this.q.push(this.setTransport.bind(this, transport));\n return;\n }\n this.config.transportProvider = createTransport(transport);\n };\n AmplitudeBrowser2.prototype.identify = function(identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.user_id) {\n this.setUserId(eventOptions.user_id);\n }\n if (eventOptions === null || eventOptions === void 0 ? void 0 : eventOptions.device_id) {\n this.setDeviceId(eventOptions.device_id);\n }\n return _super.prototype.identify.call(this, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.groupIdentify = function(groupType, groupName, identify2, eventOptions) {\n if (isInstanceProxy(identify2)) {\n var queue = identify2._q;\n identify2._q = [];\n identify2 = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return _super.prototype.groupIdentify.call(this, groupType, groupName, identify2, eventOptions);\n };\n AmplitudeBrowser2.prototype.revenue = function(revenue2, eventOptions) {\n if (isInstanceProxy(revenue2)) {\n var queue = revenue2._q;\n revenue2._q = [];\n revenue2 = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return _super.prototype.revenue.call(this, revenue2, eventOptions);\n };\n AmplitudeBrowser2.prototype.process = function(event) {\n return __awaiter(this, void 0, void 0, function() {\n var currentTime, lastEventTime, timeSinceLastEvent;\n return __generator(this, function(_a) {\n currentTime = Date.now();\n lastEventTime = this.config.lastEventTime || Date.now();\n timeSinceLastEvent = currentTime - lastEventTime;\n if (event.event_type !== DEFAULT_SESSION_START_EVENT && event.event_type !== DEFAULT_SESSION_END_EVENT && (!event.session_id || event.session_id === this.getSessionId()) && timeSinceLastEvent > this.config.sessionTimeout) {\n this.setSessionId(currentTime);\n }\n return [2, _super.prototype.process.call(this, event)];\n });\n });\n };\n return AmplitudeBrowser2;\n })(AmplitudeCore)\n );\n\n // node_modules/@amplitude/analytics-browser/lib/esm/browser-client-factory.js\n var createInstance = function() {\n var client = new AmplitudeBrowser();\n return {\n init: debugWrapper(client.init.bind(client), "init", getClientLogConfig(client), getClientStates(client, ["config"])),\n add: debugWrapper(client.add.bind(client), "add", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n remove: debugWrapper(client.remove.bind(client), "remove", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.plugins"])),\n track: debugWrapper(client.track.bind(client), "track", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n logEvent: debugWrapper(client.logEvent.bind(client), "logEvent", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n identify: debugWrapper(client.identify.bind(client), "identify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n groupIdentify: debugWrapper(client.groupIdentify.bind(client), "groupIdentify", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n setGroup: debugWrapper(client.setGroup.bind(client), "setGroup", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n revenue: debugWrapper(client.revenue.bind(client), "revenue", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n flush: debugWrapper(client.flush.bind(client), "flush", getClientLogConfig(client), getClientStates(client, ["config.apiKey", "timeline.queue.length"])),\n getUserId: debugWrapper(client.getUserId.bind(client), "getUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n setUserId: debugWrapper(client.setUserId.bind(client), "setUserId", getClientLogConfig(client), getClientStates(client, ["config", "config.userId"])),\n getDeviceId: debugWrapper(client.getDeviceId.bind(client), "getDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n setDeviceId: debugWrapper(client.setDeviceId.bind(client), "setDeviceId", getClientLogConfig(client), getClientStates(client, ["config", "config.deviceId"])),\n reset: debugWrapper(client.reset.bind(client), "reset", getClientLogConfig(client), getClientStates(client, ["config", "config.userId", "config.deviceId"])),\n getSessionId: debugWrapper(client.getSessionId.bind(client), "getSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n setSessionId: debugWrapper(client.setSessionId.bind(client), "setSessionId", getClientLogConfig(client), getClientStates(client, ["config"])),\n extendSession: debugWrapper(client.extendSession.bind(client), "extendSession", getClientLogConfig(client), getClientStates(client, ["config"])),\n setOptOut: debugWrapper(client.setOptOut.bind(client), "setOptOut", getClientLogConfig(client), getClientStates(client, ["config"])),\n setTransport: debugWrapper(client.setTransport.bind(client), "setTransport", getClientLogConfig(client), getClientStates(client, ["config"]))\n };\n };\n var browser_client_factory_default = createInstance();\n\n // node_modules/@amplitude/analytics-browser/lib/esm/index.js\n var add = browser_client_factory_default.add;\n var extendSession = browser_client_factory_default.extendSession;\n var flush = browser_client_factory_default.flush;\n var getDeviceId = browser_client_factory_default.getDeviceId;\n var getSessionId = browser_client_factory_default.getSessionId;\n var getUserId = browser_client_factory_default.getUserId;\n var groupIdentify = browser_client_factory_default.groupIdentify;\n var identify = browser_client_factory_default.identify;\n var init = browser_client_factory_default.init;\n var logEvent = browser_client_factory_default.logEvent;\n var remove = browser_client_factory_default.remove;\n var reset = browser_client_factory_default.reset;\n var revenue = browser_client_factory_default.revenue;\n var setDeviceId = browser_client_factory_default.setDeviceId;\n var setGroup = browser_client_factory_default.setGroup;\n var setOptOut = browser_client_factory_default.setOptOut;\n var setSessionId = browser_client_factory_default.setSessionId;\n var setTransport = browser_client_factory_default.setTransport;\n var setUserId = browser_client_factory_default.setUserId;\n var track = browser_client_factory_default.track;\n\n // packages/dev-tools/client/setup-ui/connected.ts\n var showSection = (sectionId, delay) => {\n setTimeout(() => {\n const sections = Array.from(document.querySelectorAll("section"));\n for (const section of sections) {\n section.setAttribute("aria-hidden", String(section.id !== sectionId));\n }\n }, delay);\n };\n var showSuccess = (confetti) => {\n showSection("success", 500);\n if (confetti) {\n celebrate();\n }\n setTimeout(stepViewContent, 500);\n };\n var stepViewContent = () => {\n const stepUpdateApp = document.getElementById("step-update-app");\n stepUpdateApp.className = "highlight completed";\n const stepViewContent2 = document.getElementById("step-setup-complete");\n stepViewContent2.className = "highlight active";\n };\n var showErrors = (errors = []) => {\n showSection("error", 500);\n const msgsUl = document.getElementById("error-messages");\n msgsUl.innerHTML = "";\n for (const error of errors) {\n const li = document.createElement("li");\n li.textContent = error;\n msgsUl.appendChild(li);\n }\n document.title = `Error Connecting`;\n };\n var showRestartServer = () => {\n showSection("restart-server", 500);\n document.title = `Restart Dev Server`;\n };\n var init2 = async () => {\n const pageUrl = new URL(location.href);\n const previewUrl = pageUrl.searchParams.get(PREVIEW_URL_QS);\n const publicApiKey = pageUrl.searchParams.get(PUBLIC_API_KEY_QS);\n const privateAuthKey = pageUrl.searchParams.get(PRIVATE_AUTH_KEY_QS);\n const builderUserId = pageUrl.searchParams.get(USER_ID_QS);\n const framework = pageUrl.searchParams.get(FRAMEWORK_QS) || "unknown";\n const platform = pageUrl.searchParams.get(PLATFORM_QS);\n const nodeVersion = pageUrl.searchParams.get(NODE_VERSION_QS);\n const spaceKind = pageUrl.searchParams.get(SPACE_KIND_QS) || null;\n try {\n console.info(\n `framework: ${framework}, platform: ${platform}, node: ${nodeVersion}`\n );\n const cleanedUrl = new URL(location.pathname, location.origin);\n if (publicApiKey) {\n setGroup("organization", publicApiKey);\n setGroup("space", publicApiKey);\n }\n if (!previewUrl) {\n window.history.replaceState({}, "", cleanedUrl.href);\n showErrors(["Missing preview url"]);\n track("integration failed", {\n url: cleanedUrl.href,\n message: "missing preview url",\n framework\n });\n return;\n }\n cleanedUrl.searchParams.set(PREVIEW_URL_QS, previewUrl);\n cleanedUrl.searchParams.set(USER_ID_QS, builderUserId);\n window.history.replaceState({}, "", cleanedUrl.href);\n if (publicApiKey && privateAuthKey) {\n let connectedAttempts = 0;\n const checkConnected = async () => {\n connectedAttempts++;\n try {\n const connectedBuilder = await apiConnectBuilder(\n publicApiKey,\n privateAuthKey,\n spaceKind\n );\n if (connectedBuilder.success) {\n const appLinkUrl = updateAppLinkUrl(\n previewUrl,\n connectedBuilder.pathname,\n builderUserId\n );\n track("site integrated", {\n url: appLinkUrl,\n position: framework\n });\n if (connectedBuilder.modifiedFiles.length > 0) {\n const ul = document.getElementById("modified-files-list");\n connectedBuilder.modifiedFiles.forEach((m) => {\n const li = document.createElement("li");\n const a = document.createElement("a");\n a.textContent = m.displayFilePath || m.filePath;\n a.href = `~launch#${m.displayFilePath}`;\n a.addEventListener("click", (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n apiLaunchEditor({\n filePath: m.filePath\n });\n });\n li.appendChild(a);\n ul.appendChild(li);\n });\n const modifiedFilesMessage = document.getElementById(\n "modified-files-message"\n );\n modifiedFilesMessage.removeAttribute("hidden");\n }\n if (spaceKind !== "vcp" && (connectedBuilder.platform.os === "win32" || framework === "@remix-run/react")) {\n const restartWarning = document.getElementById("restart-warning");\n restartWarning.removeAttribute("hidden");\n } else if (spaceKind !== "vcp" && (framework === "react" || framework === "@angular/core")) {\n const routeMessage = document.getElementById("router-message");\n routeMessage.removeAttribute("hidden");\n if (framework === "@angular/core") {\n track("angular framework", {});\n const angularRouterMessageSection = document.getElementById(\n "angular-message-section"\n );\n angularRouterMessageSection?.removeAttribute("hidden");\n }\n if (framework === "react") {\n track("react framework", {});\n const reactRouterMessageSection = document.getElementById(\n "react-message-section"\n );\n reactRouterMessageSection?.removeAttribute("hidden");\n }\n const routeCheckboxDiv = document.getElementById(\n "router-checkbox-div"\n );\n const routeCheckbox = document.createElement("input");\n routeCheckbox.type = "checkbox";\n routeCheckbox.id = "router-checkbox";\n const label = document.createElement("label");\n label.htmlFor = "router-checkbox";\n label.textContent = `I\'ve updated my router files`;\n routeCheckboxDiv.appendChild(routeCheckbox);\n routeCheckboxDiv.appendChild(label);\n const finishButton = document.getElementById(\n "router-finish-button"\n );\n routeCheckbox.addEventListener("change", function() {\n if (routeCheckbox.checked) {\n finishButton.removeAttribute("hidden");\n } else {\n finishButton.setAttribute("hidden", "true");\n }\n });\n } else {\n const goToApp = document.getElementById("go-to-app");\n goToApp.removeAttribute("hidden");\n if (spaceKind !== "vcp") {\n const firstParagraph = goToApp.querySelector("p");\n if (firstParagraph) {\n firstParagraph.removeAttribute("hidden");\n }\n const buttonText = goToApp.querySelector("#button-text");\n if (buttonText) {\n buttonText.textContent = "Go to your app";\n }\n }\n }\n setTimeout(() => {\n showSuccess(true);\n }, 500);\n } else {\n track("integration failed", {\n path: connectedBuilder.pathname,\n message: "error connecting to Builder.io",\n position: framework\n });\n showErrors([`Error connecting to Builder.io`]);\n }\n } catch (e) {\n const err = String(e.message || e);\n if (err.includes("Fetch Error")) {\n if (connectedAttempts > 3) {\n showRestartServer();\n }\n setTimeout(checkConnected, 1e3);\n } else {\n showErrors([err]);\n }\n }\n };\n checkConnected();\n } else {\n const validatedBuilder = await apiValidateBuilder();\n if (validatedBuilder.isValid) {\n updateAppLinkUrl(previewUrl, validatedBuilder.pathname, builderUserId);\n const goToApp = document.getElementById("go-to-app");\n goToApp.removeAttribute("hidden");\n showSuccess(false);\n } else {\n showErrors([`Error connecting to Builder.io`]);\n }\n }\n } catch (e) {\n track("integration failed", {\n message: "uncaught error",\n details: String(e),\n position: JSON.stringify({ framework, platform, nodeVersion })\n });\n console.error("integrationFailed", e);\n const err = String(e);\n if (err.includes("Fetch Error")) {\n showRestartServer();\n } else {\n showErrors([err]);\n }\n }\n };\n var updateAppLinkUrl = (previewUrl, pathname, builderUserId) => {\n const appUrl = new URL(pathname, previewUrl);\n if (builderUserId) {\n appUrl.hash = `${CONNECTED_USER_ID_QS}=${builderUserId}`;\n }\n const nextStepLinks = document.querySelectorAll(".next-step");\n for (const nextStepLink of nextStepLinks) {\n nextStepLink.setAttribute("href", appUrl.href);\n }\n console.debug("App Url", appUrl.href);\n return appUrl.href;\n };\n var loadConfetti = () => {\n return new Promise((resolve, reject) => {\n if (globalThis.confetti) {\n return resolve(globalThis.confetti);\n }\n const script = document.createElement("script");\n script.src = "https://cdn.jsdelivr.net/npm/canvas-confetti@1.5.1/dist/confetti.browser.min.js";\n script.onload = () => resolve(globalThis.confetti);\n script.onerror = reject;\n document.head.appendChild(script);\n script.remove();\n });\n };\n var celebrate = async () => {\n const defaults = {\n spread: 360,\n ticks: 50,\n gravity: 0,\n decay: 0.95,\n startVelocity: 30,\n colors: ["19b4f4", "a97ff2", "fd6b3c", "ffffff"]\n };\n const confettiPromise = loadConfetti();\n const shoot = async () => {\n const buttonIcon = document.getElementById("button-icon");\n const iconRect = buttonIcon.getBoundingClientRect();\n const iconX = window.scrollX + iconRect.left;\n const iconY = window.scrollY + iconRect.top;\n const origin = {\n x: iconX / window.innerWidth,\n y: iconY / window.innerHeight\n };\n const confetti = await confettiPromise;\n confetti({\n ...defaults,\n origin,\n scalar: 1.2\n });\n confetti({\n ...defaults,\n origin,\n scalar: 0.75\n });\n };\n setTimeout(shoot, 500);\n setTimeout(shoot, 650);\n setTimeout(shoot, 800);\n setTimeout(shoot, 950);\n };\n init2();\n})();\n</script>\n </body>\n</html>\n');
|
|
@@ -63437,6 +63437,25 @@ function getIgnorePatterns(basePath) {
|
|
|
63437
63437
|
return ig.ignores(normalizedPath);
|
|
63438
63438
|
};
|
|
63439
63439
|
}
|
|
63440
|
+
function getIgnorePatternsArray(basePath) {
|
|
63441
|
+
const patterns = [...IGNORE_PATTERNS];
|
|
63442
|
+
function tryReadIgnoreFile(path11) {
|
|
63443
|
+
try {
|
|
63444
|
+
const ignorePath = (0, import_node_path6.resolve)(basePath, path11);
|
|
63445
|
+
if ((0, import_node_fs8.existsSync)(ignorePath)) {
|
|
63446
|
+
const content = (0, import_node_fs8.readFileSync)(ignorePath, "utf8");
|
|
63447
|
+
const lines = content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
63448
|
+
patterns.push(...lines);
|
|
63449
|
+
}
|
|
63450
|
+
} catch (error) {
|
|
63451
|
+
console.debug(`No ${path11} found or error reading it:`, error);
|
|
63452
|
+
}
|
|
63453
|
+
}
|
|
63454
|
+
for (const ignoreFile of IGNORE_FILES) {
|
|
63455
|
+
tryReadIgnoreFile(ignoreFile);
|
|
63456
|
+
}
|
|
63457
|
+
return patterns;
|
|
63458
|
+
}
|
|
63440
63459
|
function watchDirectory(basePath, syncInfo, onChange) {
|
|
63441
63460
|
const ig = getIgnorePatterns(basePath);
|
|
63442
63461
|
const watcher = import_chokidar.default.watch(basePath, {
|
|
@@ -64673,6 +64692,259 @@ var init_env_substitution = __esm({
|
|
|
64673
64692
|
}
|
|
64674
64693
|
});
|
|
64675
64694
|
|
|
64695
|
+
// packages/dev-tools/cli/utils/gif-generator.ts
|
|
64696
|
+
async function generateGifFromImages(images, options = {}) {
|
|
64697
|
+
const { sys: sys2 } = options;
|
|
64698
|
+
try {
|
|
64699
|
+
if (images.length === 0) {
|
|
64700
|
+
return null;
|
|
64701
|
+
}
|
|
64702
|
+
const ffmpegAvailable = await GifGenerator.checkFfmpegAvailable();
|
|
64703
|
+
if (!ffmpegAvailable) {
|
|
64704
|
+
console.warn(
|
|
64705
|
+
"ffmpeg is not available. Skipping GIF generation. Install ffmpeg to enable this feature."
|
|
64706
|
+
);
|
|
64707
|
+
return null;
|
|
64708
|
+
}
|
|
64709
|
+
const generator = new GifGenerator();
|
|
64710
|
+
generator.addImages(images);
|
|
64711
|
+
return await generator.generateGif(options);
|
|
64712
|
+
} catch (error) {
|
|
64713
|
+
const errorMessage = `GIF generation failed (non-critical): ${error instanceof Error ? error.message : String(error)}`;
|
|
64714
|
+
console.warn(errorMessage);
|
|
64715
|
+
if (sys2?.Sentry && error instanceof Error) {
|
|
64716
|
+
sys2.Sentry.captureException(error, {
|
|
64717
|
+
level: "warning",
|
|
64718
|
+
tags: {
|
|
64719
|
+
component: "gif-generator",
|
|
64720
|
+
operation: "generateGifFromImages"
|
|
64721
|
+
}
|
|
64722
|
+
});
|
|
64723
|
+
}
|
|
64724
|
+
return null;
|
|
64725
|
+
}
|
|
64726
|
+
}
|
|
64727
|
+
var import_child_process, import_fs12, import_os, import_path2, GifGenerator;
|
|
64728
|
+
var init_gif_generator = __esm({
|
|
64729
|
+
"packages/dev-tools/cli/utils/gif-generator.ts"() {
|
|
64730
|
+
"use strict";
|
|
64731
|
+
import_child_process = require("child_process");
|
|
64732
|
+
import_fs12 = require("fs");
|
|
64733
|
+
import_os = require("os");
|
|
64734
|
+
import_path2 = require("path");
|
|
64735
|
+
GifGenerator = class _GifGenerator {
|
|
64736
|
+
frames = [];
|
|
64737
|
+
tmpDir = null;
|
|
64738
|
+
static ffmpegAvailable = null;
|
|
64739
|
+
/**
|
|
64740
|
+
* Check if ffmpeg is available on the system
|
|
64741
|
+
*/
|
|
64742
|
+
static async checkFfmpegAvailable() {
|
|
64743
|
+
if (_GifGenerator.ffmpegAvailable !== null) {
|
|
64744
|
+
return _GifGenerator.ffmpegAvailable;
|
|
64745
|
+
}
|
|
64746
|
+
return new Promise((resolve3) => {
|
|
64747
|
+
const process8 = (0, import_child_process.spawn)("ffmpeg", ["-version"]);
|
|
64748
|
+
let resolved = false;
|
|
64749
|
+
process8.on("error", () => {
|
|
64750
|
+
if (!resolved) {
|
|
64751
|
+
resolved = true;
|
|
64752
|
+
_GifGenerator.ffmpegAvailable = false;
|
|
64753
|
+
resolve3(false);
|
|
64754
|
+
}
|
|
64755
|
+
});
|
|
64756
|
+
process8.on("close", (code) => {
|
|
64757
|
+
if (!resolved) {
|
|
64758
|
+
resolved = true;
|
|
64759
|
+
_GifGenerator.ffmpegAvailable = code === 0;
|
|
64760
|
+
resolve3(code === 0);
|
|
64761
|
+
}
|
|
64762
|
+
});
|
|
64763
|
+
setTimeout(() => {
|
|
64764
|
+
if (!resolved) {
|
|
64765
|
+
resolved = true;
|
|
64766
|
+
process8.kill();
|
|
64767
|
+
_GifGenerator.ffmpegAvailable = false;
|
|
64768
|
+
resolve3(false);
|
|
64769
|
+
}
|
|
64770
|
+
}, 5e3);
|
|
64771
|
+
});
|
|
64772
|
+
}
|
|
64773
|
+
/**
|
|
64774
|
+
* Add an image frame to the GIF
|
|
64775
|
+
* @param image ContentMessageItemImage with base64 source
|
|
64776
|
+
*/
|
|
64777
|
+
addImage(image) {
|
|
64778
|
+
if (image.source.type === "base64") {
|
|
64779
|
+
this.frames.push(image);
|
|
64780
|
+
}
|
|
64781
|
+
}
|
|
64782
|
+
/**
|
|
64783
|
+
* Add multiple image frames to the GIF
|
|
64784
|
+
* @param images Array of ContentMessageItemImage with base64 sources
|
|
64785
|
+
*/
|
|
64786
|
+
addImages(images) {
|
|
64787
|
+
for (const image of images) {
|
|
64788
|
+
this.addImage(image);
|
|
64789
|
+
}
|
|
64790
|
+
}
|
|
64791
|
+
/**
|
|
64792
|
+
* Get the number of frames added
|
|
64793
|
+
*/
|
|
64794
|
+
getFrameCount() {
|
|
64795
|
+
return this.frames.length;
|
|
64796
|
+
}
|
|
64797
|
+
/**
|
|
64798
|
+
* Clear all frames
|
|
64799
|
+
*/
|
|
64800
|
+
clearFrames() {
|
|
64801
|
+
this.frames = [];
|
|
64802
|
+
}
|
|
64803
|
+
/**
|
|
64804
|
+
* Generate the GIF from the added frames
|
|
64805
|
+
* @param options Generation options
|
|
64806
|
+
* @returns Path to the generated GIF file
|
|
64807
|
+
*/
|
|
64808
|
+
async generateGif(options = {}) {
|
|
64809
|
+
const {
|
|
64810
|
+
framerate = 1,
|
|
64811
|
+
outputPath = (0, import_path2.join)((0, import_os.tmpdir)(), `gif-${Date.now()}.gif`),
|
|
64812
|
+
cleanup = true
|
|
64813
|
+
} = options;
|
|
64814
|
+
if (this.frames.length === 0) {
|
|
64815
|
+
throw new Error("No frames added to generate GIF");
|
|
64816
|
+
}
|
|
64817
|
+
const ffmpegAvailable = await _GifGenerator.checkFfmpegAvailable();
|
|
64818
|
+
if (!ffmpegAvailable) {
|
|
64819
|
+
throw new Error(
|
|
64820
|
+
"ffmpeg is not available on this system. Please install ffmpeg to generate GIFs."
|
|
64821
|
+
);
|
|
64822
|
+
}
|
|
64823
|
+
this.tmpDir = (0, import_path2.join)((0, import_os.tmpdir)(), `gif-frames-${Date.now()}`);
|
|
64824
|
+
await import_fs12.promises.mkdir(this.tmpDir, { recursive: true });
|
|
64825
|
+
try {
|
|
64826
|
+
await this.#writeFramesToDisk();
|
|
64827
|
+
await this.#runFfmpeg(framerate, outputPath);
|
|
64828
|
+
return outputPath;
|
|
64829
|
+
} finally {
|
|
64830
|
+
if (cleanup && this.tmpDir) {
|
|
64831
|
+
await this.#cleanup();
|
|
64832
|
+
}
|
|
64833
|
+
}
|
|
64834
|
+
}
|
|
64835
|
+
/**
|
|
64836
|
+
* Write all frames to disk as individual image files
|
|
64837
|
+
*/
|
|
64838
|
+
async #writeFramesToDisk() {
|
|
64839
|
+
if (!this.tmpDir) {
|
|
64840
|
+
throw new Error("Temporary directory not initialized");
|
|
64841
|
+
}
|
|
64842
|
+
const writePromises = this.frames.map(async (frame, index) => {
|
|
64843
|
+
if (frame.source.type !== "base64") {
|
|
64844
|
+
throw new Error("Only base64 image sources are supported");
|
|
64845
|
+
}
|
|
64846
|
+
const extension = this.#getExtensionFromMediaType(
|
|
64847
|
+
frame.source.media_type
|
|
64848
|
+
);
|
|
64849
|
+
const framePath = (0, import_path2.join)(
|
|
64850
|
+
this.tmpDir,
|
|
64851
|
+
`frame-${String(index).padStart(5, "0")}.${extension}`
|
|
64852
|
+
);
|
|
64853
|
+
const buffer = Buffer.from(frame.source.data, "base64");
|
|
64854
|
+
await import_fs12.promises.writeFile(framePath, buffer);
|
|
64855
|
+
});
|
|
64856
|
+
await Promise.all(writePromises);
|
|
64857
|
+
}
|
|
64858
|
+
/**
|
|
64859
|
+
* Get file extension from media type
|
|
64860
|
+
*/
|
|
64861
|
+
#getExtensionFromMediaType(mediaType) {
|
|
64862
|
+
switch (mediaType) {
|
|
64863
|
+
case "image/webp":
|
|
64864
|
+
return "webp";
|
|
64865
|
+
case "image/png":
|
|
64866
|
+
return "png";
|
|
64867
|
+
case "image/jpeg":
|
|
64868
|
+
return "jpg";
|
|
64869
|
+
case "image/gif":
|
|
64870
|
+
return "gif";
|
|
64871
|
+
default:
|
|
64872
|
+
return "png";
|
|
64873
|
+
}
|
|
64874
|
+
}
|
|
64875
|
+
/**
|
|
64876
|
+
* Run ffmpeg to generate the GIF
|
|
64877
|
+
*/
|
|
64878
|
+
async #runFfmpeg(framerate, outputPath) {
|
|
64879
|
+
if (!this.tmpDir) {
|
|
64880
|
+
throw new Error("Temporary directory not initialized");
|
|
64881
|
+
}
|
|
64882
|
+
return new Promise((resolve3, reject) => {
|
|
64883
|
+
const firstFrame = this.frames[0];
|
|
64884
|
+
if (firstFrame.source.type !== "base64") {
|
|
64885
|
+
reject(new Error("Only base64 image sources are supported"));
|
|
64886
|
+
return;
|
|
64887
|
+
}
|
|
64888
|
+
const extension = this.#getExtensionFromMediaType(
|
|
64889
|
+
firstFrame.source.media_type
|
|
64890
|
+
);
|
|
64891
|
+
const inputPattern = (0, import_path2.join)(this.tmpDir, `frame-%05d.${extension}`);
|
|
64892
|
+
const args = [
|
|
64893
|
+
"-framerate",
|
|
64894
|
+
String(framerate),
|
|
64895
|
+
"-i",
|
|
64896
|
+
inputPattern,
|
|
64897
|
+
"-y",
|
|
64898
|
+
// Overwrite output file if it exists
|
|
64899
|
+
outputPath
|
|
64900
|
+
];
|
|
64901
|
+
const ffmpegProcess = (0, import_child_process.spawn)("ffmpeg", args);
|
|
64902
|
+
let stderr = "";
|
|
64903
|
+
ffmpegProcess.stderr.on("data", (data) => {
|
|
64904
|
+
stderr += data.toString();
|
|
64905
|
+
});
|
|
64906
|
+
ffmpegProcess.on("error", (error) => {
|
|
64907
|
+
reject(
|
|
64908
|
+
new Error(`Failed to spawn ffmpeg: ${error.message}
|
|
64909
|
+
${stderr}`)
|
|
64910
|
+
);
|
|
64911
|
+
});
|
|
64912
|
+
ffmpegProcess.on("close", (code) => {
|
|
64913
|
+
if (code === 0) {
|
|
64914
|
+
resolve3();
|
|
64915
|
+
} else {
|
|
64916
|
+
reject(
|
|
64917
|
+
new Error(`ffmpeg exited with code ${code}
|
|
64918
|
+
Stderr: ${stderr}`)
|
|
64919
|
+
);
|
|
64920
|
+
}
|
|
64921
|
+
});
|
|
64922
|
+
});
|
|
64923
|
+
}
|
|
64924
|
+
/**
|
|
64925
|
+
* Cleanup temporary directory and frames
|
|
64926
|
+
*/
|
|
64927
|
+
async #cleanup() {
|
|
64928
|
+
if (!this.tmpDir) {
|
|
64929
|
+
return;
|
|
64930
|
+
}
|
|
64931
|
+
try {
|
|
64932
|
+
await import_fs12.promises.rm(this.tmpDir, { recursive: true, force: true });
|
|
64933
|
+
this.tmpDir = null;
|
|
64934
|
+
} catch (error) {
|
|
64935
|
+
console.warn(`Failed to cleanup temporary directory: ${error}`);
|
|
64936
|
+
}
|
|
64937
|
+
}
|
|
64938
|
+
/**
|
|
64939
|
+
* Manually cleanup if needed (useful for non-cleanup mode)
|
|
64940
|
+
*/
|
|
64941
|
+
async cleanup() {
|
|
64942
|
+
await this.#cleanup();
|
|
64943
|
+
}
|
|
64944
|
+
};
|
|
64945
|
+
}
|
|
64946
|
+
});
|
|
64947
|
+
|
|
64676
64948
|
// packages/vcp-common/backoff.ts
|
|
64677
64949
|
function wait(ms) {
|
|
64678
64950
|
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
@@ -65773,7 +66045,7 @@ var require_tree_kill = __commonJS({
|
|
|
65773
66045
|
"node_modules/@magda/tree-kill/index.js"(exports2, module2) {
|
|
65774
66046
|
"use strict";
|
|
65775
66047
|
var childProcess = require("child_process");
|
|
65776
|
-
var
|
|
66048
|
+
var spawn5 = childProcess.spawn;
|
|
65777
66049
|
var exec5 = childProcess.exec;
|
|
65778
66050
|
module2.exports = function(pid, signal, callback) {
|
|
65779
66051
|
if (typeof signal === "function" && callback === void 0) {
|
|
@@ -65808,7 +66080,7 @@ var require_tree_kill = __commonJS({
|
|
|
65808
66080
|
// break;
|
|
65809
66081
|
default:
|
|
65810
66082
|
buildProcessTree(pid, tree, pidsToProcess, function(parentPid) {
|
|
65811
|
-
return
|
|
66083
|
+
return spawn5("ps", ["-o", "pid", "--no-headers", "--ppid", parentPid]);
|
|
65812
66084
|
}, function() {
|
|
65813
66085
|
killAll(tree, signal, callback);
|
|
65814
66086
|
});
|
|
@@ -66502,7 +66774,7 @@ function renderFileTree(options) {
|
|
|
66502
66774
|
children: /* @__PURE__ */ new Map(),
|
|
66503
66775
|
isFile: false
|
|
66504
66776
|
};
|
|
66505
|
-
paths.map((path11) => (0,
|
|
66777
|
+
paths.map((path11) => (0, import_path3.normalize)(path11).replace(/\\/g, "/")).filter((path11) => path11 !== "." && path11 !== "..").sort().forEach((path11) => {
|
|
66506
66778
|
let current = root;
|
|
66507
66779
|
const parts = path11.split("/").filter((part) => part !== "" && part !== "." && part !== "..");
|
|
66508
66780
|
const isDirectory2 = path11.endsWith("/");
|
|
@@ -66652,11 +66924,11 @@ function renderFileTree(options) {
|
|
|
66652
66924
|
}
|
|
66653
66925
|
return renderNode(root);
|
|
66654
66926
|
}
|
|
66655
|
-
var
|
|
66927
|
+
var import_path3;
|
|
66656
66928
|
var init_file_tree = __esm({
|
|
66657
66929
|
"packages/vcp-common/file-tree.ts"() {
|
|
66658
66930
|
"use strict";
|
|
66659
|
-
|
|
66931
|
+
import_path3 = require("path");
|
|
66660
66932
|
}
|
|
66661
66933
|
});
|
|
66662
66934
|
|
|
@@ -66828,7 +67100,7 @@ function wrapCommandWithEnvCapture(options) {
|
|
|
66828
67100
|
};
|
|
66829
67101
|
}
|
|
66830
67102
|
async function parseEnvFile2(filePath) {
|
|
66831
|
-
const content = await
|
|
67103
|
+
const content = await import_fs13.default.promises.readFile(filePath, "utf-8");
|
|
66832
67104
|
return parseEnvContent2(content);
|
|
66833
67105
|
}
|
|
66834
67106
|
function parseEnvContent2(content) {
|
|
@@ -66852,15 +67124,15 @@ function parseEnvContent2(content) {
|
|
|
66852
67124
|
}
|
|
66853
67125
|
async function cleanupEnvFile(filePath) {
|
|
66854
67126
|
try {
|
|
66855
|
-
await
|
|
67127
|
+
await import_fs13.default.promises.unlink(filePath);
|
|
66856
67128
|
} catch (err) {
|
|
66857
67129
|
}
|
|
66858
67130
|
}
|
|
66859
|
-
var
|
|
67131
|
+
var import_fs13;
|
|
66860
67132
|
var init_env_capture = __esm({
|
|
66861
67133
|
"packages/dev-tools/cli/utils/env-capture.ts"() {
|
|
66862
67134
|
"use strict";
|
|
66863
|
-
|
|
67135
|
+
import_fs13 = __toESM(require("fs"), 1);
|
|
66864
67136
|
init_process_tracker();
|
|
66865
67137
|
}
|
|
66866
67138
|
});
|
|
@@ -73011,13 +73283,13 @@ function trackedSpawn({
|
|
|
73011
73283
|
windowsHide: options.windowsHide !== void 0 ? options.windowsHide : true
|
|
73012
73284
|
} : process.platform === "win32" ? { windowsHide: true } : void 0;
|
|
73013
73285
|
if (args !== void 0 && spawnOptions !== void 0) {
|
|
73014
|
-
proc = (0,
|
|
73286
|
+
proc = (0, import_child_process2.spawn)(command, args, spawnOptions);
|
|
73015
73287
|
} else if (args !== void 0) {
|
|
73016
|
-
proc = (0,
|
|
73288
|
+
proc = (0, import_child_process2.spawn)(command, args);
|
|
73017
73289
|
} else if (spawnOptions !== void 0) {
|
|
73018
|
-
proc = (0,
|
|
73290
|
+
proc = (0, import_child_process2.spawn)(command, spawnOptions);
|
|
73019
73291
|
} else {
|
|
73020
|
-
proc = (0,
|
|
73292
|
+
proc = (0, import_child_process2.spawn)(command);
|
|
73021
73293
|
}
|
|
73022
73294
|
processTracker.track(proc);
|
|
73023
73295
|
return proc;
|
|
@@ -73152,16 +73424,16 @@ async function killProcess(sys2, procOrPid, abortSignal, timeout = 5e3) {
|
|
|
73152
73424
|
}
|
|
73153
73425
|
}
|
|
73154
73426
|
}
|
|
73155
|
-
var
|
|
73427
|
+
var import_child_process2, import_tree_kill, import_fs14, import_os2, Sentry7, import_path4, ProcessTracker, processTracker, tempFolder, getTempFolder, cleanupTempFolder, isMultiLineCommand, createTempScript, getTempScriptPath, getCommandWithShellArgs, checkIsDevCommandProcess;
|
|
73156
73428
|
var init_process_tracker = __esm({
|
|
73157
73429
|
"packages/dev-tools/cli/utils/process-tracker.ts"() {
|
|
73158
73430
|
"use strict";
|
|
73159
|
-
|
|
73431
|
+
import_child_process2 = require("child_process");
|
|
73160
73432
|
import_tree_kill = __toESM(require_tree_kill(), 1);
|
|
73161
|
-
|
|
73162
|
-
|
|
73433
|
+
import_fs14 = __toESM(require("fs"), 1);
|
|
73434
|
+
import_os2 = __toESM(require("os"), 1);
|
|
73163
73435
|
Sentry7 = __toESM(require("@sentry/node"), 1);
|
|
73164
|
-
|
|
73436
|
+
import_path4 = __toESM(require("path"), 1);
|
|
73165
73437
|
init_code_tools();
|
|
73166
73438
|
ProcessTracker = class {
|
|
73167
73439
|
processes = /* @__PURE__ */ new Set();
|
|
@@ -73240,15 +73512,15 @@ var init_process_tracker = __esm({
|
|
|
73240
73512
|
processTracker = new ProcessTracker();
|
|
73241
73513
|
getTempFolder = () => {
|
|
73242
73514
|
if (!tempFolder) {
|
|
73243
|
-
tempFolder =
|
|
73244
|
-
|
|
73515
|
+
tempFolder = import_path4.default.join(import_os2.default.tmpdir(), "shell-scripts");
|
|
73516
|
+
import_fs14.default.mkdirSync(tempFolder, { recursive: true });
|
|
73245
73517
|
}
|
|
73246
73518
|
return tempFolder;
|
|
73247
73519
|
};
|
|
73248
73520
|
cleanupTempFolder = () => {
|
|
73249
73521
|
try {
|
|
73250
73522
|
if (tempFolder) {
|
|
73251
|
-
|
|
73523
|
+
import_fs14.default.rmdirSync(tempFolder, { recursive: true });
|
|
73252
73524
|
tempFolder = void 0;
|
|
73253
73525
|
return true;
|
|
73254
73526
|
}
|
|
@@ -73293,7 +73565,7 @@ ${command}`;
|
|
|
73293
73565
|
}
|
|
73294
73566
|
const scriptPath = getTempScriptPath(scriptExtension);
|
|
73295
73567
|
try {
|
|
73296
|
-
|
|
73568
|
+
import_fs14.default.writeFileSync(scriptPath, scriptContent, { mode: 493 });
|
|
73297
73569
|
return scriptPath;
|
|
73298
73570
|
} catch (error) {
|
|
73299
73571
|
throw new Error(`Failed to create temporary script: ${error}`);
|
|
@@ -73303,7 +73575,7 @@ ${command}`;
|
|
|
73303
73575
|
const tempDir = getTempFolder();
|
|
73304
73576
|
const timestamp = Date.now();
|
|
73305
73577
|
const random = Math.random().toString(36).substring(2, 8);
|
|
73306
|
-
return
|
|
73578
|
+
return import_path4.default.join(tempDir, `builder_temp_${timestamp}_${random}${extension}`);
|
|
73307
73579
|
};
|
|
73308
73580
|
getCommandWithShellArgs = (command, shell2) => {
|
|
73309
73581
|
if (isMultiLineCommand(command)) {
|
|
@@ -74493,16 +74765,16 @@ function parseAIBranchName(branchName) {
|
|
|
74493
74765
|
function computeAIBranchName(featureBranch, sessionId) {
|
|
74494
74766
|
return `ai_${featureBranch}_${sessionId}`.trim();
|
|
74495
74767
|
}
|
|
74496
|
-
var
|
|
74768
|
+
var import_path5, isInRemoteContainer, getVolumePath, getAndParseGitRepoInfo;
|
|
74497
74769
|
var init_helpers = __esm({
|
|
74498
74770
|
"packages/dev-tools/cli/launch/helpers.ts"() {
|
|
74499
74771
|
"use strict";
|
|
74500
|
-
|
|
74772
|
+
import_path5 = __toESM(require("path"), 1);
|
|
74501
74773
|
isInRemoteContainer = () => {
|
|
74502
74774
|
return process.env.FLY_APP_NAME !== void 0;
|
|
74503
74775
|
};
|
|
74504
74776
|
getVolumePath = (fusionConfig) => {
|
|
74505
|
-
return
|
|
74777
|
+
return import_path5.default.resolve(process.cwd(), fusionConfig.workingDirectory ?? ".");
|
|
74506
74778
|
};
|
|
74507
74779
|
getAndParseGitRepoInfo = async ({
|
|
74508
74780
|
sys: sys2,
|
|
@@ -86809,12 +87081,12 @@ var require_dist2 = __commonJS({
|
|
|
86809
87081
|
throw new Error(`Unknown format "${name2}"`);
|
|
86810
87082
|
return f;
|
|
86811
87083
|
};
|
|
86812
|
-
function addFormats(ajv, list,
|
|
87084
|
+
function addFormats(ajv, list, fs14, exportName) {
|
|
86813
87085
|
var _a;
|
|
86814
87086
|
var _b;
|
|
86815
87087
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
86816
87088
|
for (const f of list)
|
|
86817
|
-
ajv.addFormat(f,
|
|
87089
|
+
ajv.addFormat(f, fs14[f]);
|
|
86818
87090
|
}
|
|
86819
87091
|
module2.exports = exports2 = formatsPlugin;
|
|
86820
87092
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -87153,7 +87425,7 @@ var require_windows = __commonJS({
|
|
|
87153
87425
|
"node_modules/isexe/windows.js"(exports2, module2) {
|
|
87154
87426
|
module2.exports = isexe;
|
|
87155
87427
|
isexe.sync = sync;
|
|
87156
|
-
var
|
|
87428
|
+
var fs14 = require("fs");
|
|
87157
87429
|
function checkPathExt(path11, options) {
|
|
87158
87430
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
87159
87431
|
if (!pathext) {
|
|
@@ -87178,12 +87450,12 @@ var require_windows = __commonJS({
|
|
|
87178
87450
|
return checkPathExt(path11, options);
|
|
87179
87451
|
}
|
|
87180
87452
|
function isexe(path11, options, cb) {
|
|
87181
|
-
|
|
87453
|
+
fs14.stat(path11, function(er, stat2) {
|
|
87182
87454
|
cb(er, er ? false : checkStat(stat2, path11, options));
|
|
87183
87455
|
});
|
|
87184
87456
|
}
|
|
87185
87457
|
function sync(path11, options) {
|
|
87186
|
-
return checkStat(
|
|
87458
|
+
return checkStat(fs14.statSync(path11), path11, options);
|
|
87187
87459
|
}
|
|
87188
87460
|
}
|
|
87189
87461
|
});
|
|
@@ -87193,14 +87465,14 @@ var require_mode = __commonJS({
|
|
|
87193
87465
|
"node_modules/isexe/mode.js"(exports2, module2) {
|
|
87194
87466
|
module2.exports = isexe;
|
|
87195
87467
|
isexe.sync = sync;
|
|
87196
|
-
var
|
|
87468
|
+
var fs14 = require("fs");
|
|
87197
87469
|
function isexe(path11, options, cb) {
|
|
87198
|
-
|
|
87470
|
+
fs14.stat(path11, function(er, stat2) {
|
|
87199
87471
|
cb(er, er ? false : checkStat(stat2, options));
|
|
87200
87472
|
});
|
|
87201
87473
|
}
|
|
87202
87474
|
function sync(path11, options) {
|
|
87203
|
-
return checkStat(
|
|
87475
|
+
return checkStat(fs14.statSync(path11), options);
|
|
87204
87476
|
}
|
|
87205
87477
|
function checkStat(stat2, options) {
|
|
87206
87478
|
return stat2.isFile() && checkMode(stat2, options);
|
|
@@ -87224,7 +87496,7 @@ var require_mode = __commonJS({
|
|
|
87224
87496
|
// node_modules/isexe/index.js
|
|
87225
87497
|
var require_isexe = __commonJS({
|
|
87226
87498
|
"node_modules/isexe/index.js"(exports2, module2) {
|
|
87227
|
-
var
|
|
87499
|
+
var fs14 = require("fs");
|
|
87228
87500
|
var core;
|
|
87229
87501
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
87230
87502
|
core = require_windows();
|
|
@@ -87488,16 +87760,16 @@ var require_shebang_command = __commonJS({
|
|
|
87488
87760
|
var require_readShebang = __commonJS({
|
|
87489
87761
|
"node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
|
|
87490
87762
|
"use strict";
|
|
87491
|
-
var
|
|
87763
|
+
var fs14 = require("fs");
|
|
87492
87764
|
var shebangCommand = require_shebang_command();
|
|
87493
87765
|
function readShebang(command) {
|
|
87494
87766
|
const size = 150;
|
|
87495
87767
|
const buffer = Buffer.alloc(size);
|
|
87496
87768
|
let fd;
|
|
87497
87769
|
try {
|
|
87498
|
-
fd =
|
|
87499
|
-
|
|
87500
|
-
|
|
87770
|
+
fd = fs14.openSync(command, "r");
|
|
87771
|
+
fs14.readSync(fd, buffer, 0, size, 0);
|
|
87772
|
+
fs14.closeSync(fd);
|
|
87501
87773
|
} catch (e2) {
|
|
87502
87774
|
}
|
|
87503
87775
|
return shebangCommand(buffer.toString());
|
|
@@ -87625,7 +87897,7 @@ var require_cross_spawn = __commonJS({
|
|
|
87625
87897
|
var cp = require("child_process");
|
|
87626
87898
|
var parse3 = require_parse4();
|
|
87627
87899
|
var enoent = require_enoent();
|
|
87628
|
-
function
|
|
87900
|
+
function spawn5(command, args, options) {
|
|
87629
87901
|
const parsed = parse3(command, args, options);
|
|
87630
87902
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
87631
87903
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -87637,8 +87909,8 @@ var require_cross_spawn = __commonJS({
|
|
|
87637
87909
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
87638
87910
|
return result;
|
|
87639
87911
|
}
|
|
87640
|
-
module2.exports =
|
|
87641
|
-
module2.exports.spawn =
|
|
87912
|
+
module2.exports = spawn5;
|
|
87913
|
+
module2.exports.spawn = spawn5;
|
|
87642
87914
|
module2.exports.sync = spawnSync2;
|
|
87643
87915
|
module2.exports._parse = parse3;
|
|
87644
87916
|
module2.exports._enoent = enoent;
|
|
@@ -87919,7 +88191,7 @@ var require_package = __commonJS({
|
|
|
87919
88191
|
// node_modules/dotenv/lib/main.js
|
|
87920
88192
|
var require_main = __commonJS({
|
|
87921
88193
|
"node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
87922
|
-
var
|
|
88194
|
+
var fs14 = require("fs");
|
|
87923
88195
|
var path11 = require("path");
|
|
87924
88196
|
var os7 = require("os");
|
|
87925
88197
|
var crypto7 = require("crypto");
|
|
@@ -88048,7 +88320,7 @@ var require_main = __commonJS({
|
|
|
88048
88320
|
}
|
|
88049
88321
|
}
|
|
88050
88322
|
try {
|
|
88051
|
-
const parsed = DotenvModule.parse(
|
|
88323
|
+
const parsed = DotenvModule.parse(fs14.readFileSync(dotenvPath, { encoding }));
|
|
88052
88324
|
let processEnv = process.env;
|
|
88053
88325
|
if (options && options.processEnv != null) {
|
|
88054
88326
|
processEnv = options.processEnv;
|
|
@@ -88067,7 +88339,7 @@ var require_main = __commonJS({
|
|
|
88067
88339
|
if (_dotenvKey(options).length === 0) {
|
|
88068
88340
|
return DotenvModule.configDotenv(options);
|
|
88069
88341
|
}
|
|
88070
|
-
if (!
|
|
88342
|
+
if (!fs14.existsSync(vaultPath)) {
|
|
88071
88343
|
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
88072
88344
|
return DotenvModule.configDotenv(options);
|
|
88073
88345
|
}
|
|
@@ -90061,6 +90333,7 @@ var init_codegen3 = __esm({
|
|
|
90061
90333
|
init_fetch();
|
|
90062
90334
|
import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
90063
90335
|
init_env_substitution();
|
|
90336
|
+
init_gif_generator();
|
|
90064
90337
|
init_errors();
|
|
90065
90338
|
init_backup();
|
|
90066
90339
|
import_prettier4 = __toESM(require("prettier"), 1);
|
|
@@ -90088,6 +90361,7 @@ var init_codegen3 = __esm({
|
|
|
90088
90361
|
init_dev_server_orchestrator();
|
|
90089
90362
|
init_codegen_utils();
|
|
90090
90363
|
init_process_tracker();
|
|
90364
|
+
init_terminal_buffer();
|
|
90091
90365
|
init_agent_parser();
|
|
90092
90366
|
DEFAULT_MAX_COMPLETIONS2 = 30;
|
|
90093
90367
|
NOT_BAD_ERRORS = [
|
|
@@ -90158,6 +90432,8 @@ var init_codegen3 = __esm({
|
|
|
90158
90432
|
#lastGitUpdateTime = 0;
|
|
90159
90433
|
#userTurnCreditsUsed = 0;
|
|
90160
90434
|
#hasPlanToApply = false;
|
|
90435
|
+
#proxyOrigin;
|
|
90436
|
+
#proxyDst;
|
|
90161
90437
|
#pendingPromises = [];
|
|
90162
90438
|
#lastSuccessfulBackupRef;
|
|
90163
90439
|
#pendingFormating = /* @__PURE__ */ new Set();
|
|
@@ -90195,6 +90471,10 @@ var init_codegen3 = __esm({
|
|
|
90195
90471
|
this.#branchName = options.fusionConfig?.branchName;
|
|
90196
90472
|
this.#featureBranch = options.fusionConfig?.featureBranch;
|
|
90197
90473
|
this.#aiBranch = options.fusionConfig?.aiBranch;
|
|
90474
|
+
this.#proxyOrigin = options.fusionConfig?.proxyOrigin;
|
|
90475
|
+
if (process.env.FLY_APP_NAME) {
|
|
90476
|
+
this.#proxyDst = `https://${process.env.FLY_APP_NAME}.fly.dev/`;
|
|
90477
|
+
}
|
|
90198
90478
|
const filterDisabledTools = (tools2) => {
|
|
90199
90479
|
return tools2.filter(
|
|
90200
90480
|
(tool) => !this.#fusionConfig?.disabledTools?.includes(tool)
|
|
@@ -92241,6 +92521,157 @@ ${logs}
|
|
|
92241
92521
|
});
|
|
92242
92522
|
return truncateArray(filteredFiles, truncate);
|
|
92243
92523
|
}
|
|
92524
|
+
async searchFiles(options) {
|
|
92525
|
+
const {
|
|
92526
|
+
query,
|
|
92527
|
+
caseInsensitive = true,
|
|
92528
|
+
includeGlob,
|
|
92529
|
+
excludeGlob,
|
|
92530
|
+
maxResults = 1e3,
|
|
92531
|
+
contextBefore = 0,
|
|
92532
|
+
contextAfter = 0
|
|
92533
|
+
} = options;
|
|
92534
|
+
const rgPath = await getRipgrepExecutable(this.#sys);
|
|
92535
|
+
const args = [
|
|
92536
|
+
"--path-separator",
|
|
92537
|
+
"/",
|
|
92538
|
+
"--json",
|
|
92539
|
+
"--line-number",
|
|
92540
|
+
"--column",
|
|
92541
|
+
"--max-columns",
|
|
92542
|
+
"500"
|
|
92543
|
+
];
|
|
92544
|
+
if (caseInsensitive) {
|
|
92545
|
+
args.push("-i");
|
|
92546
|
+
}
|
|
92547
|
+
if (contextBefore > 0) {
|
|
92548
|
+
args.push("-B", contextBefore.toString());
|
|
92549
|
+
}
|
|
92550
|
+
if (contextAfter > 0) {
|
|
92551
|
+
args.push("-A", contextAfter.toString());
|
|
92552
|
+
}
|
|
92553
|
+
if (includeGlob) {
|
|
92554
|
+
args.push("--glob", includeGlob);
|
|
92555
|
+
}
|
|
92556
|
+
if (excludeGlob) {
|
|
92557
|
+
args.push("--glob", `!${excludeGlob}`);
|
|
92558
|
+
}
|
|
92559
|
+
const ignorePatterns = getIgnorePatternsArray(this.#bashWorkingDirectory);
|
|
92560
|
+
ignorePatterns.forEach((pattern) => {
|
|
92561
|
+
const glob = pattern.startsWith("!") ? pattern : `!${pattern}`;
|
|
92562
|
+
args.push("--glob", glob);
|
|
92563
|
+
});
|
|
92564
|
+
const ADDITIONAL_EXCLUDE = [
|
|
92565
|
+
"!**/build/**",
|
|
92566
|
+
"!**/*.min.js",
|
|
92567
|
+
"!**/*.min.css",
|
|
92568
|
+
"!**/*.map"
|
|
92569
|
+
];
|
|
92570
|
+
ADDITIONAL_EXCLUDE.forEach((glob) => {
|
|
92571
|
+
args.push("--glob", glob);
|
|
92572
|
+
});
|
|
92573
|
+
args.push("--", query);
|
|
92574
|
+
return new Promise((resolve3) => {
|
|
92575
|
+
const child = trackedSpawn({
|
|
92576
|
+
command: rgPath,
|
|
92577
|
+
args,
|
|
92578
|
+
options: {
|
|
92579
|
+
env: process.env,
|
|
92580
|
+
cwd: this.#bashWorkingDirectory,
|
|
92581
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
92582
|
+
}
|
|
92583
|
+
});
|
|
92584
|
+
const outputBuffer = new TerminalBuffer(5e4);
|
|
92585
|
+
child.stdout.on("data", (data) => {
|
|
92586
|
+
outputBuffer.write(data.toString());
|
|
92587
|
+
});
|
|
92588
|
+
child.on("error", () => {
|
|
92589
|
+
resolve3({
|
|
92590
|
+
matches: [],
|
|
92591
|
+
totalMatches: 0,
|
|
92592
|
+
filesWithMatches: 0,
|
|
92593
|
+
truncated: false
|
|
92594
|
+
});
|
|
92595
|
+
});
|
|
92596
|
+
child.on("close", (code) => {
|
|
92597
|
+
if (code !== 0) {
|
|
92598
|
+
resolve3({
|
|
92599
|
+
matches: [],
|
|
92600
|
+
totalMatches: 0,
|
|
92601
|
+
filesWithMatches: 0,
|
|
92602
|
+
truncated: false
|
|
92603
|
+
});
|
|
92604
|
+
} else {
|
|
92605
|
+
const matches = [];
|
|
92606
|
+
const filesSet = /* @__PURE__ */ new Set();
|
|
92607
|
+
const output = outputBuffer.getContent();
|
|
92608
|
+
const lines = output.split("\n");
|
|
92609
|
+
let currentFilePath = null;
|
|
92610
|
+
let currentLineNumber = null;
|
|
92611
|
+
for (const line of lines) {
|
|
92612
|
+
if (line.trim()) {
|
|
92613
|
+
try {
|
|
92614
|
+
const jsonLine = JSON.parse(line);
|
|
92615
|
+
if (jsonLine.type === "match") {
|
|
92616
|
+
const filePath = jsonLine.data.path.text;
|
|
92617
|
+
const lineNumber = jsonLine.data.line_number;
|
|
92618
|
+
const lineContent = jsonLine.data.lines.text.trimEnd();
|
|
92619
|
+
const submatches = jsonLine.data.submatches || [];
|
|
92620
|
+
let columnStart;
|
|
92621
|
+
let columnEnd;
|
|
92622
|
+
if (submatches.length > 0) {
|
|
92623
|
+
columnStart = submatches[0].start;
|
|
92624
|
+
columnEnd = submatches[0].end;
|
|
92625
|
+
}
|
|
92626
|
+
filesSet.add(filePath);
|
|
92627
|
+
currentFilePath = filePath;
|
|
92628
|
+
currentLineNumber = lineNumber;
|
|
92629
|
+
const match = {
|
|
92630
|
+
filePath,
|
|
92631
|
+
lineNumber,
|
|
92632
|
+
lineContent,
|
|
92633
|
+
columnStart,
|
|
92634
|
+
columnEnd,
|
|
92635
|
+
contextBefore: [],
|
|
92636
|
+
contextAfter: []
|
|
92637
|
+
};
|
|
92638
|
+
matches.push(match);
|
|
92639
|
+
if (matches.length >= maxResults) {
|
|
92640
|
+
break;
|
|
92641
|
+
}
|
|
92642
|
+
} else if (jsonLine.type === "context") {
|
|
92643
|
+
const contextLineNumber = jsonLine.data.line_number;
|
|
92644
|
+
const contextLineContent = jsonLine.data.lines.text.trimEnd();
|
|
92645
|
+
if (currentFilePath && currentLineNumber) {
|
|
92646
|
+
if (contextLineNumber < currentLineNumber) {
|
|
92647
|
+
const lastMatch = matches[matches.length - 1];
|
|
92648
|
+
if (lastMatch && lastMatch.filePath === currentFilePath && lastMatch.lineNumber === currentLineNumber) {
|
|
92649
|
+
lastMatch.contextBefore.push(contextLineContent);
|
|
92650
|
+
}
|
|
92651
|
+
} else if (contextLineNumber > currentLineNumber) {
|
|
92652
|
+
const lastMatch = matches[matches.length - 1];
|
|
92653
|
+
if (lastMatch && lastMatch.filePath === currentFilePath && lastMatch.lineNumber === currentLineNumber) {
|
|
92654
|
+
lastMatch.contextAfter.push(contextLineContent);
|
|
92655
|
+
}
|
|
92656
|
+
}
|
|
92657
|
+
}
|
|
92658
|
+
}
|
|
92659
|
+
} catch (error) {
|
|
92660
|
+
continue;
|
|
92661
|
+
}
|
|
92662
|
+
}
|
|
92663
|
+
}
|
|
92664
|
+
const truncated = matches.length >= maxResults;
|
|
92665
|
+
resolve3({
|
|
92666
|
+
matches,
|
|
92667
|
+
totalMatches: matches.length,
|
|
92668
|
+
filesWithMatches: filesSet.size,
|
|
92669
|
+
truncated
|
|
92670
|
+
});
|
|
92671
|
+
}
|
|
92672
|
+
});
|
|
92673
|
+
});
|
|
92674
|
+
}
|
|
92244
92675
|
async collectRepoMetrics(opts = {}) {
|
|
92245
92676
|
const { collectRepoMetrics: collectRepoMetrics2 } = await Promise.resolve().then(() => (init_repo_metrics(), repo_metrics_exports));
|
|
92246
92677
|
let rootPath = this.#gitWorkingDirectory;
|
|
@@ -92833,7 +93264,8 @@ ${logs}
|
|
|
92833
93264
|
"chrome-devtools-mcp@latest",
|
|
92834
93265
|
"--wsEndpoint",
|
|
92835
93266
|
wsUrl,
|
|
92836
|
-
"--categoryEmulation=false"
|
|
93267
|
+
"--categoryEmulation=false",
|
|
93268
|
+
"--viewport=1280x720"
|
|
92837
93269
|
]
|
|
92838
93270
|
};
|
|
92839
93271
|
}
|
|
@@ -92862,6 +93294,7 @@ ${logs}
|
|
|
92862
93294
|
let importantFiles = {
|
|
92863
93295
|
important_files: []
|
|
92864
93296
|
};
|
|
93297
|
+
const collectedImages = [];
|
|
92865
93298
|
const disconnect = agentSession.connectToEventLoop(false, (step) => {
|
|
92866
93299
|
if (step.type === "tool_result" && step.result.tool_name === "SetImportantFiles" && typeof step.result.content === "string") {
|
|
92867
93300
|
importantFiles = JSON.parse(
|
|
@@ -92870,6 +93303,18 @@ ${logs}
|
|
|
92870
93303
|
} else if (onStep) {
|
|
92871
93304
|
onStep(step, subagent_type);
|
|
92872
93305
|
}
|
|
93306
|
+
try {
|
|
93307
|
+
if (step.type === "tool_result") {
|
|
93308
|
+
const content = step.result.content;
|
|
93309
|
+
if (Array.isArray(content)) {
|
|
93310
|
+
const images = content.filter(
|
|
93311
|
+
(item) => item.type === "image" && item.source.type === "base64"
|
|
93312
|
+
);
|
|
93313
|
+
collectedImages.push(...images);
|
|
93314
|
+
}
|
|
93315
|
+
}
|
|
93316
|
+
} catch {
|
|
93317
|
+
}
|
|
92873
93318
|
});
|
|
92874
93319
|
const cleanup = async () => {
|
|
92875
93320
|
disconnect();
|
|
@@ -92906,6 +93351,31 @@ ${logs}
|
|
|
92906
93351
|
};
|
|
92907
93352
|
}
|
|
92908
93353
|
const response2 = lastTurn.actions.filter((a) => a.type === "text").map((a) => a.content).join("\n");
|
|
93354
|
+
if (collectedImages.length > 1) {
|
|
93355
|
+
(async () => {
|
|
93356
|
+
try {
|
|
93357
|
+
const gifSessionId = agentSession.getSessionId();
|
|
93358
|
+
const gifDir = `/tmp/gifs`;
|
|
93359
|
+
const gifPath = `${gifDir}/${gifSessionId}.gif`;
|
|
93360
|
+
await import_node_fs15.default.promises.mkdir(gifDir, { recursive: true });
|
|
93361
|
+
const generatedPath = await generateGifFromImages(collectedImages, {
|
|
93362
|
+
framerate: 1,
|
|
93363
|
+
outputPath: gifPath,
|
|
93364
|
+
cleanup: true,
|
|
93365
|
+
sys: this.#sys
|
|
93366
|
+
});
|
|
93367
|
+
if (generatedPath) {
|
|
93368
|
+
console.log(
|
|
93369
|
+
`[${subagent_type}] Generated GIF from ${collectedImages.length} images: ${generatedPath}`
|
|
93370
|
+
);
|
|
93371
|
+
}
|
|
93372
|
+
} catch (err) {
|
|
93373
|
+
console.warn(
|
|
93374
|
+
`[${subagent_type}] Failed to generate GIF (non-critical): ${err instanceof Error ? err.message : String(err)}`
|
|
93375
|
+
);
|
|
93376
|
+
}
|
|
93377
|
+
})();
|
|
93378
|
+
}
|
|
92909
93379
|
return {
|
|
92910
93380
|
success: true,
|
|
92911
93381
|
response: response2,
|
|
@@ -92925,6 +93395,9 @@ ${logs}
|
|
|
92925
93395
|
await cleanup();
|
|
92926
93396
|
}
|
|
92927
93397
|
}
|
|
93398
|
+
setProxyOrigin(proxySrc) {
|
|
93399
|
+
this.#proxyOrigin = proxySrc;
|
|
93400
|
+
}
|
|
92928
93401
|
async #getChromeWSServerURL(signal) {
|
|
92929
93402
|
const credentials = this.#credentials;
|
|
92930
93403
|
const url = new URL(`${apiAirV2Host}/codegen/get-browser-connection`);
|
|
@@ -92945,7 +93418,9 @@ ${logs}
|
|
|
92945
93418
|
body: JSON.stringify({
|
|
92946
93419
|
sessionId: this.getSessionId(),
|
|
92947
93420
|
projectId: this.#projectId,
|
|
92948
|
-
branchName: this.#branchName
|
|
93421
|
+
branchName: this.#branchName,
|
|
93422
|
+
proxyOrigin: this.#proxyOrigin,
|
|
93423
|
+
proxyDst: this.#proxyDst
|
|
92949
93424
|
}),
|
|
92950
93425
|
keepalive: true,
|
|
92951
93426
|
headers,
|
|
@@ -93238,7 +93713,10 @@ ${logs}
|
|
|
93238
93713
|
const onChangeListeners = /* @__PURE__ */ new Set();
|
|
93239
93714
|
const ignoreFilter = getIgnorePatterns(this.#workingDirectory);
|
|
93240
93715
|
const wrappedIgnoreFilter = (absolutePath) => {
|
|
93241
|
-
const relativePath = this.#sys.relative(
|
|
93716
|
+
const relativePath = this.#sys.relative(
|
|
93717
|
+
this.#workingDirectory,
|
|
93718
|
+
absolutePath
|
|
93719
|
+
);
|
|
93242
93720
|
if (!relativePath) {
|
|
93243
93721
|
return false;
|
|
93244
93722
|
}
|
|
@@ -93293,7 +93771,9 @@ ${logs}
|
|
|
93293
93771
|
});
|
|
93294
93772
|
this.#folderWatchers.set(watchId, watcherEntry);
|
|
93295
93773
|
if (this.#debug) {
|
|
93296
|
-
console.log(
|
|
93774
|
+
console.log(
|
|
93775
|
+
`\u{1F4C2} Started watching folders: ${folders.join(", ")} [${watchId}]`
|
|
93776
|
+
);
|
|
93297
93777
|
}
|
|
93298
93778
|
return {
|
|
93299
93779
|
watchId,
|
|
@@ -96259,7 +96739,7 @@ async function getAllDesignSystems(credentials, opts = {}) {
|
|
|
96259
96739
|
}
|
|
96260
96740
|
return designSystems;
|
|
96261
96741
|
}
|
|
96262
|
-
var Sentry9,
|
|
96742
|
+
var Sentry9, import_path6, AGENT_FILE, ICONS_FILE, TOKENS_FILE, INSTALLATION_FILE, REPO_INDEXING_FOLDER, SPACE_SCOPE, ORGANIZATION_SCOPE, GLOBAL_SCOPE, promptForDesignSystemScope, parseDesignSystem, storeComponentDocs, runCodeGen, generateRepoIndexingAclPolicy, getDesignSystemByName, getDesignSystemByNameAndScope, addDesignSystem, updateDesignSystem, checkRepoIndexingFolder;
|
|
96263
96743
|
var init_repo_indexing_utils = __esm({
|
|
96264
96744
|
"packages/dev-tools/cli/repo-indexing/repo-indexing-utils.ts"() {
|
|
96265
96745
|
"use strict";
|
|
@@ -96271,7 +96751,7 @@ var init_repo_indexing_utils = __esm({
|
|
|
96271
96751
|
init_fetch();
|
|
96272
96752
|
init_errors();
|
|
96273
96753
|
init_dist2();
|
|
96274
|
-
|
|
96754
|
+
import_path6 = require("path");
|
|
96275
96755
|
AGENT_FILE = "AGENTS.md";
|
|
96276
96756
|
ICONS_FILE = "icons.mdx";
|
|
96277
96757
|
TOKENS_FILE = "tokens.mdx";
|
|
@@ -96405,7 +96885,7 @@ var init_repo_indexing_utils = __esm({
|
|
|
96405
96885
|
workingDirectory: sys2.cwd(),
|
|
96406
96886
|
...workspaceConfig && { workspace: workspaceConfig }
|
|
96407
96887
|
};
|
|
96408
|
-
if (designSystemPackage && !(0,
|
|
96888
|
+
if (designSystemPackage && !(0, import_path6.isAbsolute)(designSystemPackage)) {
|
|
96409
96889
|
fusionConfig.accessControl?.entries?.push(
|
|
96410
96890
|
{
|
|
96411
96891
|
action: "allow",
|
|
@@ -100354,8 +100834,8 @@ var require_node2 = __commonJS({
|
|
|
100354
100834
|
}
|
|
100355
100835
|
break;
|
|
100356
100836
|
case "FILE":
|
|
100357
|
-
var
|
|
100358
|
-
stream3 = new
|
|
100837
|
+
var fs14 = require("fs");
|
|
100838
|
+
stream3 = new fs14.SyncWriteStream(fd2, { autoClose: false });
|
|
100359
100839
|
stream3._type = "fs";
|
|
100360
100840
|
break;
|
|
100361
100841
|
case "PIPE":
|
|
@@ -116573,8 +117053,8 @@ var require_node3 = __commonJS({
|
|
|
116573
117053
|
}
|
|
116574
117054
|
break;
|
|
116575
117055
|
case "FILE":
|
|
116576
|
-
var
|
|
116577
|
-
stream3 = new
|
|
117056
|
+
var fs14 = require("fs");
|
|
117057
|
+
stream3 = new fs14.SyncWriteStream(fd2, { autoClose: false });
|
|
116578
117058
|
stream3._type = "fs";
|
|
116579
117059
|
break;
|
|
116580
117060
|
case "PIPE":
|
|
@@ -117292,8 +117772,8 @@ var require_node4 = __commonJS({
|
|
|
117292
117772
|
}
|
|
117293
117773
|
break;
|
|
117294
117774
|
case "FILE":
|
|
117295
|
-
var
|
|
117296
|
-
stream3 = new
|
|
117775
|
+
var fs14 = require("fs");
|
|
117776
|
+
stream3 = new fs14.SyncWriteStream(fd2, { autoClose: false });
|
|
117297
117777
|
stream3._type = "fs";
|
|
117298
117778
|
break;
|
|
117299
117779
|
case "PIPE":
|
|
@@ -118185,11 +118665,11 @@ var require_view = __commonJS({
|
|
|
118185
118665
|
"use strict";
|
|
118186
118666
|
var debug2 = require_src5()("express:view");
|
|
118187
118667
|
var path11 = require("path");
|
|
118188
|
-
var
|
|
118668
|
+
var fs14 = require("fs");
|
|
118189
118669
|
var dirname6 = path11.dirname;
|
|
118190
118670
|
var basename = path11.basename;
|
|
118191
118671
|
var extname3 = path11.extname;
|
|
118192
|
-
var
|
|
118672
|
+
var join14 = path11.join;
|
|
118193
118673
|
var resolve3 = path11.resolve;
|
|
118194
118674
|
module2.exports = View;
|
|
118195
118675
|
function View(name2, options) {
|
|
@@ -118237,12 +118717,12 @@ var require_view = __commonJS({
|
|
|
118237
118717
|
};
|
|
118238
118718
|
View.prototype.resolve = function resolve4(dir, file) {
|
|
118239
118719
|
var ext = this.ext;
|
|
118240
|
-
var path12 =
|
|
118720
|
+
var path12 = join14(dir, file);
|
|
118241
118721
|
var stat2 = tryStat(path12);
|
|
118242
118722
|
if (stat2 && stat2.isFile()) {
|
|
118243
118723
|
return path12;
|
|
118244
118724
|
}
|
|
118245
|
-
path12 =
|
|
118725
|
+
path12 = join14(dir, basename(file, ext), "index" + ext);
|
|
118246
118726
|
stat2 = tryStat(path12);
|
|
118247
118727
|
if (stat2 && stat2.isFile()) {
|
|
118248
118728
|
return path12;
|
|
@@ -118251,7 +118731,7 @@ var require_view = __commonJS({
|
|
|
118251
118731
|
function tryStat(path12) {
|
|
118252
118732
|
debug2('stat "%s"', path12);
|
|
118253
118733
|
try {
|
|
118254
|
-
return
|
|
118734
|
+
return fs14.statSync(path12);
|
|
118255
118735
|
} catch (e2) {
|
|
118256
118736
|
return void 0;
|
|
118257
118737
|
}
|
|
@@ -118914,8 +119394,8 @@ var require_node5 = __commonJS({
|
|
|
118914
119394
|
}
|
|
118915
119395
|
break;
|
|
118916
119396
|
case "FILE":
|
|
118917
|
-
var
|
|
118918
|
-
stream3 = new
|
|
119397
|
+
var fs14 = require("fs");
|
|
119398
|
+
stream3 = new fs14.SyncWriteStream(fd2, { autoClose: false });
|
|
118919
119399
|
stream3._type = "fs";
|
|
118920
119400
|
break;
|
|
118921
119401
|
case "PIPE":
|
|
@@ -119102,7 +119582,7 @@ var require_types2 = __commonJS({
|
|
|
119102
119582
|
var require_mime = __commonJS({
|
|
119103
119583
|
"node_modules/send/node_modules/mime/mime.js"(exports2, module2) {
|
|
119104
119584
|
var path11 = require("path");
|
|
119105
|
-
var
|
|
119585
|
+
var fs14 = require("fs");
|
|
119106
119586
|
function Mime() {
|
|
119107
119587
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
119108
119588
|
this.extensions = /* @__PURE__ */ Object.create(null);
|
|
@@ -119123,7 +119603,7 @@ var require_mime = __commonJS({
|
|
|
119123
119603
|
};
|
|
119124
119604
|
Mime.prototype.load = function(file) {
|
|
119125
119605
|
this._loading = file;
|
|
119126
|
-
var map2 = {}, content =
|
|
119606
|
+
var map2 = {}, content = fs14.readFileSync(file, "ascii"), lines = content.split(/[\r\n]+/);
|
|
119127
119607
|
lines.forEach(function(line) {
|
|
119128
119608
|
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
|
|
119129
119609
|
map2[fields.shift()] = fields;
|
|
@@ -119245,7 +119725,7 @@ var require_send = __commonJS({
|
|
|
119245
119725
|
var escapeHtml = require_escape_html();
|
|
119246
119726
|
var etag = require_etag();
|
|
119247
119727
|
var fresh = require_fresh();
|
|
119248
|
-
var
|
|
119728
|
+
var fs14 = require("fs");
|
|
119249
119729
|
var mime = require_mime();
|
|
119250
119730
|
var ms = require_ms();
|
|
119251
119731
|
var onFinished = require_on_finished();
|
|
@@ -119255,7 +119735,7 @@ var require_send = __commonJS({
|
|
|
119255
119735
|
var Stream = require("stream");
|
|
119256
119736
|
var util2 = require("util");
|
|
119257
119737
|
var extname3 = path11.extname;
|
|
119258
|
-
var
|
|
119738
|
+
var join14 = path11.join;
|
|
119259
119739
|
var normalize4 = path11.normalize;
|
|
119260
119740
|
var resolve3 = path11.resolve;
|
|
119261
119741
|
var sep2 = path11.sep;
|
|
@@ -119474,7 +119954,7 @@ var require_send = __commonJS({
|
|
|
119474
119954
|
return res;
|
|
119475
119955
|
}
|
|
119476
119956
|
parts = path12.split(sep2);
|
|
119477
|
-
path12 = normalize4(
|
|
119957
|
+
path12 = normalize4(join14(root, path12));
|
|
119478
119958
|
} else {
|
|
119479
119959
|
if (UP_PATH_REGEXP.test(path12)) {
|
|
119480
119960
|
debug2('malicious path "%s"', path12);
|
|
@@ -119578,7 +120058,7 @@ var require_send = __commonJS({
|
|
|
119578
120058
|
var i = 0;
|
|
119579
120059
|
var self2 = this;
|
|
119580
120060
|
debug2('stat "%s"', path12);
|
|
119581
|
-
|
|
120061
|
+
fs14.stat(path12, function onstat(err, stat2) {
|
|
119582
120062
|
if (err && err.code === "ENOENT" && !extname3(path12) && path12[path12.length - 1] !== sep2) {
|
|
119583
120063
|
return next(err);
|
|
119584
120064
|
}
|
|
@@ -119593,7 +120073,7 @@ var require_send = __commonJS({
|
|
|
119593
120073
|
}
|
|
119594
120074
|
var p2 = path12 + "." + self2._extensions[i++];
|
|
119595
120075
|
debug2('stat "%s"', p2);
|
|
119596
|
-
|
|
120076
|
+
fs14.stat(p2, function(err2, stat2) {
|
|
119597
120077
|
if (err2) return next(err2);
|
|
119598
120078
|
if (stat2.isDirectory()) return next();
|
|
119599
120079
|
self2.emit("file", p2, stat2);
|
|
@@ -119609,9 +120089,9 @@ var require_send = __commonJS({
|
|
|
119609
120089
|
if (err) return self2.onStatError(err);
|
|
119610
120090
|
return self2.error(404);
|
|
119611
120091
|
}
|
|
119612
|
-
var p2 =
|
|
120092
|
+
var p2 = join14(path12, self2._index[i]);
|
|
119613
120093
|
debug2('stat "%s"', p2);
|
|
119614
|
-
|
|
120094
|
+
fs14.stat(p2, function(err2, stat2) {
|
|
119615
120095
|
if (err2) return next(err2);
|
|
119616
120096
|
if (stat2.isDirectory()) return next();
|
|
119617
120097
|
self2.emit("file", p2, stat2);
|
|
@@ -119623,7 +120103,7 @@ var require_send = __commonJS({
|
|
|
119623
120103
|
SendStream.prototype.stream = function stream2(path12, options) {
|
|
119624
120104
|
var self2 = this;
|
|
119625
120105
|
var res = this.res;
|
|
119626
|
-
var stream3 =
|
|
120106
|
+
var stream3 = fs14.createReadStream(path12, options);
|
|
119627
120107
|
this.emit("stream", stream3);
|
|
119628
120108
|
stream3.pipe(res);
|
|
119629
120109
|
function cleanup() {
|
|
@@ -122748,7 +123228,7 @@ var require_constants4 = __commonJS({
|
|
|
122748
123228
|
// node_modules/node-gyp-build/node-gyp-build.js
|
|
122749
123229
|
var require_node_gyp_build = __commonJS({
|
|
122750
123230
|
"node_modules/node-gyp-build/node-gyp-build.js"(exports2, module2) {
|
|
122751
|
-
var
|
|
123231
|
+
var fs14 = require("fs");
|
|
122752
123232
|
var path11 = require("path");
|
|
122753
123233
|
var os7 = require("os");
|
|
122754
123234
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
|
|
@@ -122809,7 +123289,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
122809
123289
|
};
|
|
122810
123290
|
function readdirSync4(dir) {
|
|
122811
123291
|
try {
|
|
122812
|
-
return
|
|
123292
|
+
return fs14.readdirSync(dir);
|
|
122813
123293
|
} catch (err) {
|
|
122814
123294
|
return [];
|
|
122815
123295
|
}
|
|
@@ -122903,7 +123383,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
122903
123383
|
return typeof window !== "undefined" && window.process && window.process.type === "renderer";
|
|
122904
123384
|
}
|
|
122905
123385
|
function isAlpine(platform5) {
|
|
122906
|
-
return platform5 === "linux" &&
|
|
123386
|
+
return platform5 === "linux" && fs14.existsSync("/etc/alpine-release");
|
|
122907
123387
|
}
|
|
122908
123388
|
load.parseTags = parseTags;
|
|
122909
123389
|
load.matchTags = matchTags;
|
|
@@ -128636,7 +129116,7 @@ init_version();
|
|
|
128636
129116
|
init_figma_component();
|
|
128637
129117
|
init_credentials();
|
|
128638
129118
|
init_figma_utils();
|
|
128639
|
-
var
|
|
129119
|
+
var fs11 = __toESM(require("fs/promises"), 1);
|
|
128640
129120
|
var path8 = __toESM(require("path"), 1);
|
|
128641
129121
|
|
|
128642
129122
|
// packages/dev-tools/cli/report/create-vue.txt?raw
|
|
@@ -128994,12 +129474,12 @@ async function resolveComponentData(context, components) {
|
|
|
128994
129474
|
async function downloadFile(url, outputPath) {
|
|
128995
129475
|
const response2 = await fetch(url);
|
|
128996
129476
|
const arrayBuffer = await response2.arrayBuffer();
|
|
128997
|
-
await
|
|
129477
|
+
await fs11.writeFile(outputPath, new Uint8Array(arrayBuffer));
|
|
128998
129478
|
}
|
|
128999
129479
|
async function generateComponentReport(component, baseDir) {
|
|
129000
129480
|
const componentDirName = sanitizeComponentName(component.name);
|
|
129001
129481
|
const componentDir = path8.join(baseDir, componentDirName);
|
|
129002
|
-
await
|
|
129482
|
+
await fs11.mkdir(componentDir, { recursive: true });
|
|
129003
129483
|
const markdown2 = `
|
|
129004
129484
|
# ${component.name}
|
|
129005
129485
|
|
|
@@ -129016,7 +129496,7 @@ ${component.thumbnail_url ? await generateThumbnailSection(component, componentD
|
|
|
129016
129496
|
|
|
129017
129497
|
${component.componentData ? generateComponentDataSection(component) : ""}
|
|
129018
129498
|
`;
|
|
129019
|
-
await
|
|
129499
|
+
await fs11.writeFile(path8.join(componentDir, "README.md"), markdown2, "utf-8");
|
|
129020
129500
|
}
|
|
129021
129501
|
async function generateThumbnailSection(component, componentDir) {
|
|
129022
129502
|
const cleanUrl = new URL(component.thumbnail_url);
|
|
@@ -129109,7 +129589,7 @@ var runFigmaReport = async (sys2, args) => {
|
|
|
129109
129589
|
);
|
|
129110
129590
|
}
|
|
129111
129591
|
const reportsDir = path8.join(process.cwd(), "figma-components");
|
|
129112
|
-
if (await
|
|
129592
|
+
if (await fs11.access(reportsDir).then(() => true).catch(() => false)) {
|
|
129113
129593
|
const shouldMerge = await ye({
|
|
129114
129594
|
message: `Directory ${reportsDir} exists. Would you like to merge with existing files?`,
|
|
129115
129595
|
initialValue: true
|
|
@@ -129120,18 +129600,18 @@ var runFigmaReport = async (sys2, args) => {
|
|
|
129120
129600
|
M2.info("Will merge with existing directory");
|
|
129121
129601
|
} else {
|
|
129122
129602
|
M2.info("Removing existing directory and starting fresh");
|
|
129123
|
-
await
|
|
129603
|
+
await fs11.rm(reportsDir, { recursive: true, force: true });
|
|
129124
129604
|
}
|
|
129125
129605
|
}
|
|
129126
|
-
await
|
|
129127
|
-
await
|
|
129128
|
-
await
|
|
129129
|
-
await
|
|
129606
|
+
await fs11.mkdir(reportsDir, { recursive: true });
|
|
129607
|
+
await fs11.writeFile(path8.join(reportsDir, "MAPPING_GUIDE.md"), guide_default, "utf-8");
|
|
129608
|
+
await fs11.writeFile(path8.join(reportsDir, "MAP_VUE.md"), create_vue_default, "utf-8");
|
|
129609
|
+
await fs11.writeFile(
|
|
129130
129610
|
path8.join(reportsDir, "MAP_ANGULAR.md"),
|
|
129131
129611
|
create_angular_default,
|
|
129132
129612
|
"utf-8"
|
|
129133
129613
|
);
|
|
129134
|
-
await
|
|
129614
|
+
await fs11.writeFile(
|
|
129135
129615
|
path8.join(reportsDir, "MAP_REACT.md"),
|
|
129136
129616
|
create_react_default,
|
|
129137
129617
|
"utf-8"
|
|
@@ -129208,7 +129688,7 @@ var runFigmaReport = async (sys2, args) => {
|
|
|
129208
129688
|
)
|
|
129209
129689
|
}))
|
|
129210
129690
|
};
|
|
129211
|
-
await
|
|
129691
|
+
await fs11.writeFile(
|
|
129212
129692
|
path8.join(reportsDir, "index.json"),
|
|
129213
129693
|
JSON.stringify(indexData, null, 2),
|
|
129214
129694
|
"utf-8"
|
|
@@ -129573,7 +130053,7 @@ init_open();
|
|
|
129573
130053
|
init_config();
|
|
129574
130054
|
|
|
129575
130055
|
// packages/dev-tools/cli/launch/InitStateMachine.ts
|
|
129576
|
-
var
|
|
130056
|
+
var fs12 = __toESM(require("fs"), 1);
|
|
129577
130057
|
var fsPromises3 = __toESM(require("fs/promises"), 1);
|
|
129578
130058
|
var path9 = __toESM(require("path"), 1);
|
|
129579
130059
|
init_process_tracker();
|
|
@@ -129658,12 +130138,12 @@ var InitStateMachine = class {
|
|
|
129658
130138
|
throw new Error("No repository with git enabled found for backup");
|
|
129659
130139
|
}
|
|
129660
130140
|
const repoPath = path9.join(volumePath, mainRepo.path);
|
|
129661
|
-
if (!
|
|
130141
|
+
if (!fs12.existsSync(repoPath)) {
|
|
129662
130142
|
throw new Error(
|
|
129663
130143
|
`Backup mode: Repository directory does not exist at ${repoPath}`
|
|
129664
130144
|
);
|
|
129665
130145
|
}
|
|
129666
|
-
if (!
|
|
130146
|
+
if (!fs12.existsSync(path9.join(repoPath, ".git"))) {
|
|
129667
130147
|
throw new Error(
|
|
129668
130148
|
`Backup mode: Git repository not initialized at ${repoPath}`
|
|
129669
130149
|
);
|
|
@@ -129910,11 +130390,11 @@ var InitStateMachine = class {
|
|
|
129910
130390
|
this.initState.error = void 0;
|
|
129911
130391
|
}
|
|
129912
130392
|
async hasFilesButNoGit(repoPath) {
|
|
129913
|
-
if (
|
|
130393
|
+
if (fs12.existsSync(repoPath)) {
|
|
129914
130394
|
try {
|
|
129915
130395
|
const files = await fsPromises3.readdir(repoPath);
|
|
129916
130396
|
const hasFiles = files.length > 0;
|
|
129917
|
-
const hasGit2 =
|
|
130397
|
+
const hasGit2 = fs12.existsSync(path9.join(repoPath, ".git"));
|
|
129918
130398
|
return hasFiles && !hasGit2;
|
|
129919
130399
|
} catch (error) {
|
|
129920
130400
|
return false;
|
|
@@ -129926,7 +130406,7 @@ var InitStateMachine = class {
|
|
|
129926
130406
|
this.addInitLog("log", "Checking directories", {
|
|
129927
130407
|
step: "check-directories"
|
|
129928
130408
|
});
|
|
129929
|
-
if (!
|
|
130409
|
+
if (!fs12.existsSync(volumePath)) {
|
|
129930
130410
|
await fsPromises3.mkdir(volumePath, { recursive: true });
|
|
129931
130411
|
}
|
|
129932
130412
|
if (volumePath.startsWith("/root")) {
|
|
@@ -129937,7 +130417,7 @@ var InitStateMachine = class {
|
|
|
129937
130417
|
});
|
|
129938
130418
|
for (const repo of repositories) {
|
|
129939
130419
|
const repoPath = path9.join(volumePath, repo.path);
|
|
129940
|
-
if (!
|
|
130420
|
+
if (!fs12.existsSync(repoPath)) {
|
|
129941
130421
|
this.addInitLog("log", `Creating directory: ${repoPath}`, {
|
|
129942
130422
|
step: "create-directories"
|
|
129943
130423
|
});
|
|
@@ -129964,7 +130444,7 @@ var InitStateMachine = class {
|
|
|
129964
130444
|
});
|
|
129965
130445
|
const tempCloningDir = path9.join(volumePath, "temp-cloning");
|
|
129966
130446
|
const removeTempCloningDirIfExists = async () => {
|
|
129967
|
-
if (
|
|
130447
|
+
if (fs12.existsSync(tempCloningDir)) {
|
|
129968
130448
|
this.addInitLog(
|
|
129969
130449
|
"log",
|
|
129970
130450
|
`Removing temp cloning directory: ${tempCloningDir}`,
|
|
@@ -130175,7 +130655,7 @@ var InitStateMachine = class {
|
|
|
130175
130655
|
throw error;
|
|
130176
130656
|
}
|
|
130177
130657
|
}
|
|
130178
|
-
if (process.platform === "win32" &&
|
|
130658
|
+
if (process.platform === "win32" && fs12.existsSync(repoPath)) {
|
|
130179
130659
|
const files = await fsPromises3.readdir(repoPath);
|
|
130180
130660
|
if (files.length > 0) {
|
|
130181
130661
|
const errorMsg = `Target directory ${repoPath} already exists and is not empty. Cannot safely rename.`;
|
|
@@ -130883,7 +131363,7 @@ var InitStateMachine = class {
|
|
|
130883
131363
|
for (const branch of possibleBranches) {
|
|
130884
131364
|
try {
|
|
130885
131365
|
const templatePath = process.env.FUSION_TEMPLATE_DIR && process.env.FUSION_TEMPLATE_DIR.trim().length > 0 ? process.env.FUSION_TEMPLATE_DIR : "/template";
|
|
130886
|
-
if (
|
|
131366
|
+
if (fs12.existsSync(templatePath) && repo.repoName === STARTER_REPO) {
|
|
130887
131367
|
this.addInitLog("log", `Starting copy of template to ${repoPath}`, {
|
|
130888
131368
|
step: "clone-repo"
|
|
130889
131369
|
});
|
|
@@ -130919,7 +131399,7 @@ var InitStateMachine = class {
|
|
|
130919
131399
|
await this.git(gitCloneCommand);
|
|
130920
131400
|
const shouldResetGit = repo.resetGit !== void 0 ? repo.resetGit : EXAMPLE_REPOS.includes(repo.repoName);
|
|
130921
131401
|
if (shouldResetGit && repo.enableGit) {
|
|
130922
|
-
|
|
131402
|
+
fs12.rmSync(path9.join(repoPath, ".git"), {
|
|
130923
131403
|
recursive: true,
|
|
130924
131404
|
force: true
|
|
130925
131405
|
});
|
|
@@ -130950,14 +131430,14 @@ function restoreUserBackup(user) {
|
|
|
130950
131430
|
try {
|
|
130951
131431
|
const userPath = `/${user}`;
|
|
130952
131432
|
const userBackupPath = `/${user}-backup`;
|
|
130953
|
-
if (
|
|
130954
|
-
const files =
|
|
131433
|
+
if (fs12.existsSync(userBackupPath)) {
|
|
131434
|
+
const files = fs12.readdirSync(userBackupPath);
|
|
130955
131435
|
for (const file of files) {
|
|
130956
131436
|
if (!exclude.includes(file)) {
|
|
130957
131437
|
const destination = path9.join(userPath, file);
|
|
130958
|
-
if (!
|
|
131438
|
+
if (!fs12.existsSync(destination)) {
|
|
130959
131439
|
try {
|
|
130960
|
-
|
|
131440
|
+
fs12.cpSync(path9.join(userBackupPath, file), destination, {
|
|
130961
131441
|
recursive: true,
|
|
130962
131442
|
force: true
|
|
130963
131443
|
});
|
|
@@ -131091,7 +131571,7 @@ function createFusionStatusMonitor(sys2, credentials, fusionConfig, sharedState)
|
|
|
131091
131571
|
}
|
|
131092
131572
|
|
|
131093
131573
|
// packages/dev-tools/cli/launch/dry-run-backup.ts
|
|
131094
|
-
var
|
|
131574
|
+
var import_fs19 = require("fs");
|
|
131095
131575
|
var import_promises8 = require("fs/promises");
|
|
131096
131576
|
|
|
131097
131577
|
// packages/dev-tools/cli/launch/grafana.ts
|
|
@@ -131188,10 +131668,10 @@ var _attemptDryRunBackupGit = async ({ sys: sys2, fusionConfig, credentials }, r
|
|
|
131188
131668
|
}
|
|
131189
131669
|
try {
|
|
131190
131670
|
const machineId = process.env.FLY_MACHINE_ID ?? "unknown";
|
|
131191
|
-
if ((0,
|
|
131671
|
+
if ((0, import_fs19.existsSync)(TEST_MARK) && (0, import_fs19.readFileSync)(TEST_MARK, "utf8") === machineId) {
|
|
131192
131672
|
return null;
|
|
131193
131673
|
}
|
|
131194
|
-
(0,
|
|
131674
|
+
(0, import_fs19.writeFileSync)(TEST_MARK, machineId);
|
|
131195
131675
|
M2.info("Attempting dry run backup git");
|
|
131196
131676
|
if (realInitState.currentStep !== "init-success") {
|
|
131197
131677
|
return {
|
|
@@ -131199,10 +131679,10 @@ var _attemptDryRunBackupGit = async ({ sys: sys2, fusionConfig, credentials }, r
|
|
|
131199
131679
|
error: "main-init-failed"
|
|
131200
131680
|
};
|
|
131201
131681
|
}
|
|
131202
|
-
if ((0,
|
|
131682
|
+
if ((0, import_fs19.existsSync)(TEST_WORKING_DIR)) {
|
|
131203
131683
|
await (0, import_promises8.rm)(TEST_WORKING_DIR, { recursive: true, force: true });
|
|
131204
131684
|
}
|
|
131205
|
-
(0,
|
|
131685
|
+
(0, import_fs19.mkdirSync)(TEST_WORKING_DIR, { recursive: true });
|
|
131206
131686
|
const initStateMachine = new InitStateMachine({
|
|
131207
131687
|
sys: sys2,
|
|
131208
131688
|
fusionConfig: {
|
|
@@ -131309,7 +131789,7 @@ init_backup();
|
|
|
131309
131789
|
init_feature_flags();
|
|
131310
131790
|
|
|
131311
131791
|
// packages/dev-tools/cli/utils/lock-file.ts
|
|
131312
|
-
var
|
|
131792
|
+
var fs13 = __toESM(require("fs"), 1);
|
|
131313
131793
|
var path10 = __toESM(require("path"), 1);
|
|
131314
131794
|
init_process_tracker();
|
|
131315
131795
|
async function registerLock(sys2, fusionConfig) {
|
|
@@ -131324,11 +131804,11 @@ async function registerLock(sys2, fusionConfig) {
|
|
|
131324
131804
|
const projectId = fusionConfig.projectId;
|
|
131325
131805
|
const branchId = fusionConfig.branchName;
|
|
131326
131806
|
const port = fusionConfig.fusionServerPort;
|
|
131327
|
-
if (
|
|
131807
|
+
if (fs13.existsSync(lockFilePath)) {
|
|
131328
131808
|
console.log(`Lock file already exists at: ${lockFilePath}`);
|
|
131329
131809
|
let existingLock = null;
|
|
131330
131810
|
try {
|
|
131331
|
-
const content =
|
|
131811
|
+
const content = fs13.readFileSync(lockFilePath, "utf8");
|
|
131332
131812
|
existingLock = JSON.parse(content);
|
|
131333
131813
|
} catch (error) {
|
|
131334
131814
|
console.warn(
|
|
@@ -131343,7 +131823,7 @@ async function registerLock(sys2, fusionConfig) {
|
|
|
131343
131823
|
}
|
|
131344
131824
|
});
|
|
131345
131825
|
try {
|
|
131346
|
-
|
|
131826
|
+
fs13.unlinkSync(lockFilePath);
|
|
131347
131827
|
} catch (unlinkError) {
|
|
131348
131828
|
console.warn(`Failed to remove corrupted lock file:`, unlinkError);
|
|
131349
131829
|
}
|
|
@@ -131364,7 +131844,7 @@ async function registerLock(sys2, fusionConfig) {
|
|
|
131364
131844
|
}
|
|
131365
131845
|
});
|
|
131366
131846
|
try {
|
|
131367
|
-
|
|
131847
|
+
fs13.unlinkSync(lockFilePath);
|
|
131368
131848
|
} catch (error) {
|
|
131369
131849
|
console.warn(`Failed to remove stale lock file:`, error);
|
|
131370
131850
|
}
|
|
@@ -131416,10 +131896,10 @@ async function registerLock(sys2, fusionConfig) {
|
|
|
131416
131896
|
};
|
|
131417
131897
|
try {
|
|
131418
131898
|
const lockDir = path10.dirname(lockFilePath);
|
|
131419
|
-
if (!
|
|
131420
|
-
|
|
131899
|
+
if (!fs13.existsSync(lockDir)) {
|
|
131900
|
+
fs13.mkdirSync(lockDir, { recursive: true });
|
|
131421
131901
|
}
|
|
131422
|
-
|
|
131902
|
+
fs13.writeFileSync(lockFilePath, JSON.stringify(lockData, null, 2), "utf8");
|
|
131423
131903
|
console.log(`Lock file created at: ${lockFilePath}`);
|
|
131424
131904
|
let cleanupCalled = false;
|
|
131425
131905
|
const cleanup = () => {
|
|
@@ -131427,8 +131907,8 @@ async function registerLock(sys2, fusionConfig) {
|
|
|
131427
131907
|
return;
|
|
131428
131908
|
}
|
|
131429
131909
|
try {
|
|
131430
|
-
if (
|
|
131431
|
-
|
|
131910
|
+
if (fs13.existsSync(lockFilePath)) {
|
|
131911
|
+
fs13.unlinkSync(lockFilePath);
|
|
131432
131912
|
console.log(`Lock file removed: ${lockFilePath}`);
|
|
131433
131913
|
}
|
|
131434
131914
|
} catch (error) {
|
|
@@ -132302,6 +132782,54 @@ async function setupLaunchServer({
|
|
|
132302
132782
|
});
|
|
132303
132783
|
}
|
|
132304
132784
|
});
|
|
132785
|
+
builderApiRouter.get("/download-gif/:sessionId", async (req, res) => {
|
|
132786
|
+
try {
|
|
132787
|
+
const sessionId = req.params.sessionId;
|
|
132788
|
+
if (!sessionId || typeof sessionId !== "string") {
|
|
132789
|
+
res.status(400).json({
|
|
132790
|
+
error: "Session ID is required"
|
|
132791
|
+
});
|
|
132792
|
+
return;
|
|
132793
|
+
}
|
|
132794
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(sessionId)) {
|
|
132795
|
+
res.status(400).json({
|
|
132796
|
+
error: "Invalid session ID format"
|
|
132797
|
+
});
|
|
132798
|
+
return;
|
|
132799
|
+
}
|
|
132800
|
+
if (sessionId.length > 128) {
|
|
132801
|
+
res.status(400).json({
|
|
132802
|
+
error: "Session ID too long"
|
|
132803
|
+
});
|
|
132804
|
+
return;
|
|
132805
|
+
}
|
|
132806
|
+
const gifPath = `/tmp/gifs/${sessionId}.gif`;
|
|
132807
|
+
try {
|
|
132808
|
+
await sys2.stat(gifPath);
|
|
132809
|
+
} catch {
|
|
132810
|
+
res.status(404).json({
|
|
132811
|
+
error: "GIF not found for this session"
|
|
132812
|
+
});
|
|
132813
|
+
return;
|
|
132814
|
+
}
|
|
132815
|
+
res.setHeader("Content-Type", "image/gif");
|
|
132816
|
+
res.setHeader(
|
|
132817
|
+
"Content-Disposition",
|
|
132818
|
+
`inline; filename="${sessionId}.gif"`
|
|
132819
|
+
);
|
|
132820
|
+
res.download(gifPath, `${sessionId}.gif`, (err) => {
|
|
132821
|
+
if (err) {
|
|
132822
|
+
sys2.Sentry?.captureException(err);
|
|
132823
|
+
}
|
|
132824
|
+
});
|
|
132825
|
+
} catch (error) {
|
|
132826
|
+
sys2.Sentry?.captureException(error);
|
|
132827
|
+
res.status(500).json({
|
|
132828
|
+
error: "Failed to download GIF",
|
|
132829
|
+
details: error instanceof Error ? error.message : String(error)
|
|
132830
|
+
});
|
|
132831
|
+
}
|
|
132832
|
+
});
|
|
132305
132833
|
if (fusionConfig?.autoBackupGit || fusionConfig.autoShutdown) {
|
|
132306
132834
|
const ONE_HOUR_IN_MINUTES = 60;
|
|
132307
132835
|
const ONE_SECOND_IN_MILLISECONDS = 1e3;
|
|
@@ -132575,8 +133103,10 @@ function setupWebSocketServer({
|
|
|
132575
133103
|
exposeToWebSocketRPC("loadHistory");
|
|
132576
133104
|
exposeToWebSocketRPC("loadMoreTurns");
|
|
132577
133105
|
exposeToWebSocketRPC("getAllFiles");
|
|
133106
|
+
exposeToWebSocketRPC("searchFiles");
|
|
132578
133107
|
exposeToWebSocketRPC("sendFeedback");
|
|
132579
133108
|
exposeToWebSocketRPC("setCustomInstructions");
|
|
133109
|
+
exposeToWebSocketRPC("setProxyOrigin");
|
|
132580
133110
|
exposeToWebSocketRPC("sendMessage");
|
|
132581
133111
|
exposeToWebSocketRPC("configureDevOrchestrator");
|
|
132582
133112
|
exposeToWebSocketRPC("restoreFromCompletionId");
|
|
@@ -134350,15 +134880,15 @@ var deprecateComponents = async (credentials, componentIds) => {
|
|
|
134350
134880
|
};
|
|
134351
134881
|
|
|
134352
134882
|
// packages/dev-tools/cli/repo-indexing/repo-indexing.ts
|
|
134353
|
-
var
|
|
134883
|
+
var import_path8 = require("path");
|
|
134354
134884
|
init_errors();
|
|
134355
134885
|
init_track();
|
|
134356
134886
|
|
|
134357
134887
|
// packages/dev-tools/cli/repo-connect/git-detector.ts
|
|
134358
|
-
var
|
|
134888
|
+
var import_child_process3 = require("child_process");
|
|
134359
134889
|
var import_util4 = require("util");
|
|
134360
|
-
var
|
|
134361
|
-
var execAsync = (0, import_util4.promisify)(
|
|
134890
|
+
var import_path7 = require("path");
|
|
134891
|
+
var execAsync = (0, import_util4.promisify)(import_child_process3.exec);
|
|
134362
134892
|
async function detectGitInfo(sys2) {
|
|
134363
134893
|
const cwd = sys2.cwd();
|
|
134364
134894
|
let gitRoot;
|
|
@@ -134370,7 +134900,7 @@ async function detectGitInfo(sys2) {
|
|
|
134370
134900
|
} catch (error) {
|
|
134371
134901
|
return void 0;
|
|
134372
134902
|
}
|
|
134373
|
-
const relPath = (0,
|
|
134903
|
+
const relPath = (0, import_path7.relative)(gitRoot, cwd);
|
|
134374
134904
|
const recommendedRoot = relPath ? `./${relPath}` : "./";
|
|
134375
134905
|
let originUrl;
|
|
134376
134906
|
try {
|
|
@@ -134768,7 +135298,7 @@ var runRepoIndexing = async (sys2, args) => {
|
|
|
134768
135298
|
}
|
|
134769
135299
|
let s2 = Y2();
|
|
134770
135300
|
if (designSystemPackage) {
|
|
134771
|
-
if ((0,
|
|
135301
|
+
if ((0, import_path8.isAbsolute)(designSystemPackage)) {
|
|
134772
135302
|
validateDirectory(designSystemPackage) || process.exit(1);
|
|
134773
135303
|
workspaceConfig.folders.push({
|
|
134774
135304
|
path: designSystemPackage
|
|
@@ -135402,13 +135932,13 @@ init_credentials();
|
|
|
135402
135932
|
init_fetch();
|
|
135403
135933
|
init_constants2();
|
|
135404
135934
|
init_open();
|
|
135405
|
-
var
|
|
135935
|
+
var import_child_process6 = require("child_process");
|
|
135406
135936
|
var import_util6 = require("util");
|
|
135407
135937
|
|
|
135408
135938
|
// packages/dev-tools/cli/repo-connect/package-detector.ts
|
|
135409
|
-
var
|
|
135939
|
+
var import_child_process4 = require("child_process");
|
|
135410
135940
|
var import_util5 = require("util");
|
|
135411
|
-
var execAsync2 = (0, import_util5.promisify)(
|
|
135941
|
+
var execAsync2 = (0, import_util5.promisify)(import_child_process4.exec);
|
|
135412
135942
|
async function detectPackageVersions() {
|
|
135413
135943
|
const versions = {};
|
|
135414
135944
|
try {
|
|
@@ -135512,8 +136042,8 @@ function formatPackageVersions(versions) {
|
|
|
135512
136042
|
// packages/dev-tools/cli/repo-connect/env-collector.ts
|
|
135513
136043
|
init_dist2();
|
|
135514
136044
|
var import_dotenv8 = __toESM(require_main(), 1);
|
|
135515
|
-
var
|
|
135516
|
-
var
|
|
136045
|
+
var import_path9 = require("path");
|
|
136046
|
+
var import_fs20 = require("fs");
|
|
135517
136047
|
var SYSTEM_ENV_VARS = /* @__PURE__ */ new Set([
|
|
135518
136048
|
"PATH",
|
|
135519
136049
|
"HOME",
|
|
@@ -135672,8 +136202,8 @@ async function loadDotEnvFiles(sys2, gitRoot) {
|
|
|
135672
136202
|
];
|
|
135673
136203
|
const envVars = {};
|
|
135674
136204
|
for (const fileName of dotEnvFiles) {
|
|
135675
|
-
const filePath = (0,
|
|
135676
|
-
if (!(0,
|
|
136205
|
+
const filePath = (0, import_path9.join)(gitRoot, fileName);
|
|
136206
|
+
if (!(0, import_fs20.existsSync)(filePath)) {
|
|
135677
136207
|
continue;
|
|
135678
136208
|
}
|
|
135679
136209
|
try {
|
|
@@ -135815,12 +136345,12 @@ function formatEnvSummary(envVars) {
|
|
|
135815
136345
|
}
|
|
135816
136346
|
|
|
135817
136347
|
// packages/dev-tools/cli/repo-connect/file-collector.ts
|
|
135818
|
-
var
|
|
135819
|
-
var
|
|
136348
|
+
var import_path10 = require("path");
|
|
136349
|
+
var import_os3 = require("os");
|
|
135820
136350
|
init_dist2();
|
|
135821
136351
|
async function collectConfigFiles(sys2, gitRoot) {
|
|
135822
136352
|
const collected = {};
|
|
135823
|
-
const projectNpmrcPath = (0,
|
|
136353
|
+
const projectNpmrcPath = (0, import_path10.join)(gitRoot, ".npmrc");
|
|
135824
136354
|
try {
|
|
135825
136355
|
const content = await sys2.readFile(projectNpmrcPath);
|
|
135826
136356
|
if (content) {
|
|
@@ -135831,7 +136361,7 @@ async function collectConfigFiles(sys2, gitRoot) {
|
|
|
135831
136361
|
}
|
|
135832
136362
|
} catch {
|
|
135833
136363
|
}
|
|
135834
|
-
const userNpmrcPath = (0,
|
|
136364
|
+
const userNpmrcPath = (0, import_path10.join)((0, import_os3.homedir)(), ".npmrc");
|
|
135835
136365
|
try {
|
|
135836
136366
|
const content = await sys2.readFile(userNpmrcPath);
|
|
135837
136367
|
if (content) {
|
|
@@ -135916,7 +136446,7 @@ async function selectFileOverrides(collected) {
|
|
|
135916
136446
|
}
|
|
135917
136447
|
|
|
135918
136448
|
// packages/dev-tools/cli/repo-connect/install-runner.ts
|
|
135919
|
-
var
|
|
136449
|
+
var import_child_process5 = require("child_process");
|
|
135920
136450
|
init_dist2();
|
|
135921
136451
|
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
135922
136452
|
async function runInstallCommand(cwd, initialCommand) {
|
|
@@ -136013,7 +136543,7 @@ function executeCommand(command, cwd) {
|
|
|
136013
136543
|
const parts = command.trim().split(/\s+/);
|
|
136014
136544
|
const cmd = parts[0];
|
|
136015
136545
|
const args = parts.slice(1);
|
|
136016
|
-
const child = (0,
|
|
136546
|
+
const child = (0, import_child_process5.spawn)(cmd, args, {
|
|
136017
136547
|
cwd,
|
|
136018
136548
|
stdio: "inherit",
|
|
136019
136549
|
// Pipe stdout/stderr directly to parent process
|
|
@@ -136034,7 +136564,7 @@ function executeCommand(command, cwd) {
|
|
|
136034
136564
|
}
|
|
136035
136565
|
|
|
136036
136566
|
// packages/dev-tools/cli/repo-connect/repo-connect.ts
|
|
136037
|
-
var execAsync3 = (0, import_util6.promisify)(
|
|
136567
|
+
var execAsync3 = (0, import_util6.promisify)(import_child_process6.exec);
|
|
136038
136568
|
function normalizeRepoUrl(url) {
|
|
136039
136569
|
let normalized = url.replace(/\.git$/, "");
|
|
136040
136570
|
if (normalized.startsWith("git@")) {
|