@reservamos/browser-analytics 1.1.7-alpha.0 → 1.1.7-alpha.1
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/CHANGELOG.md +5 -0
- package/README.md +35 -0
- package/dist/browser-analytics.cjs +3 -3
- package/dist/browser-analytics.cjs.map +1 -1
- package/dist/browser-analytics.d.ts +55 -55
- package/dist/browser-analytics.esm.js +1737 -1477
- package/dist/browser-analytics.esm.js.map +1 -1
- package/dist/browser-analytics.iife.js +3 -3
- package/dist/browser-analytics.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/events/identify/identify.robustness.test.ts +220 -0
- package/src/events/identify/identify.test.ts +6 -4
- package/src/events/identify/identify.ts +84 -42
- package/src/index.ts +2 -0
- package/src/profiles/createAnonymousProfile/createAnonymousProfile.identify.test.ts +56 -0
- package/src/profiles/createAnonymousProfile/createAnonymousProfile.ts +39 -12
- package/src/services/botDetectionRelay.test.ts +127 -0
- package/src/services/botDetectionRelay.ts +64 -0
- package/src/services/fingerprint.test.ts +250 -35
- package/src/services/fingerprint.ts +89 -12
- package/src/services/mixpanel.test.ts +160 -0
- package/src/services/mixpanel.ts +32 -6
- package/src/track.test.ts +156 -0
- package/src/track.ts +24 -5
- package/src/types/botDetection.ts +16 -0
- package/src/util/identifyAttempt.ts +139 -0
|
@@ -190,10 +190,10 @@ class ZodError extends Error {
|
|
|
190
190
|
fieldErrors._errors.push(mapper(issue));
|
|
191
191
|
} else {
|
|
192
192
|
let curr = fieldErrors;
|
|
193
|
-
let
|
|
194
|
-
while (
|
|
195
|
-
const el = issue.path[
|
|
196
|
-
const terminal =
|
|
193
|
+
let i2 = 0;
|
|
194
|
+
while (i2 < issue.path.length) {
|
|
195
|
+
const el = issue.path[i2];
|
|
196
|
+
const terminal = i2 === issue.path.length - 1;
|
|
197
197
|
if (!terminal) {
|
|
198
198
|
curr[el] = curr[el] || { _errors: [] };
|
|
199
199
|
} else {
|
|
@@ -201,7 +201,7 @@ class ZodError extends Error {
|
|
|
201
201
|
curr[el]._errors.push(mapper(issue));
|
|
202
202
|
}
|
|
203
203
|
curr = curr[el];
|
|
204
|
-
|
|
204
|
+
i2++;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
}
|
|
@@ -2047,14 +2047,14 @@ class ZodArray extends ZodType {
|
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
2049
|
if (ctx.common.async) {
|
|
2050
|
-
return Promise.all([...ctx.data].map((item,
|
|
2051
|
-
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path,
|
|
2050
|
+
return Promise.all([...ctx.data].map((item, i2) => {
|
|
2051
|
+
return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
|
|
2052
2052
|
})).then((result2) => {
|
|
2053
2053
|
return ParseStatus.mergeArray(status, result2);
|
|
2054
2054
|
});
|
|
2055
2055
|
}
|
|
2056
|
-
const result = [...ctx.data].map((item,
|
|
2057
|
-
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path,
|
|
2056
|
+
const result = [...ctx.data].map((item, i2) => {
|
|
2057
|
+
return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
|
|
2058
2058
|
});
|
|
2059
2059
|
return ParseStatus.mergeArray(status, result);
|
|
2060
2060
|
}
|
|
@@ -2982,7 +2982,7 @@ class ZodSet extends ZodType {
|
|
|
2982
2982
|
}
|
|
2983
2983
|
return { status: status.value, value: parsedSet };
|
|
2984
2984
|
}
|
|
2985
|
-
const elements = [...ctx.data.values()].map((item,
|
|
2985
|
+
const elements = [...ctx.data.values()].map((item, i2) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i2)));
|
|
2986
2986
|
if (ctx.common.async) {
|
|
2987
2987
|
return Promise.all(elements).then((elements2) => finalizeSet(elements2));
|
|
2988
2988
|
} else {
|
|
@@ -3921,6 +3921,89 @@ const customEventSchema = z.record(
|
|
|
3921
3921
|
z.union([allowedPrimitiveSchema, z.array(allowedPrimitiveSchema)])
|
|
3922
3922
|
);
|
|
3923
3923
|
const eventNameSchema = z.string().min(1, "Event name is required");
|
|
3924
|
+
let environment;
|
|
3925
|
+
let appName;
|
|
3926
|
+
const origin = window.location.origin;
|
|
3927
|
+
const coreAPIConfig = {
|
|
3928
|
+
sandbox: {
|
|
3929
|
+
baseUrl: "https://datalake-api-dev.reservamossaas.com/api",
|
|
3930
|
+
defaultHeaders: {
|
|
3931
|
+
Origin: origin,
|
|
3932
|
+
Authorization: "Bearer 753bf0710dc920a84236d42241d4f487"
|
|
3933
|
+
}
|
|
3934
|
+
},
|
|
3935
|
+
prod: {
|
|
3936
|
+
baseUrl: "https://data-lake.reservamossaas.com/api",
|
|
3937
|
+
defaultHeaders: {
|
|
3938
|
+
Origin: origin,
|
|
3939
|
+
Authorization: "Bearer 753bf0710dc920a84236d42241d4f487"
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3942
|
+
};
|
|
3943
|
+
function setEnvironment(env) {
|
|
3944
|
+
environment = env;
|
|
3945
|
+
}
|
|
3946
|
+
function setAppName(name) {
|
|
3947
|
+
appName = name;
|
|
3948
|
+
}
|
|
3949
|
+
function getCoreAPIConfig() {
|
|
3950
|
+
if (!environment) {
|
|
3951
|
+
throw new Error(
|
|
3952
|
+
"Unable to get core API config, environment not set. Use configService.setEnvironment(environment) to set the environment."
|
|
3953
|
+
);
|
|
3954
|
+
}
|
|
3955
|
+
const config = coreAPIConfig[environment];
|
|
3956
|
+
return {
|
|
3957
|
+
...config,
|
|
3958
|
+
defaultHeaders: {
|
|
3959
|
+
...config.defaultHeaders,
|
|
3960
|
+
...appName ? { "x-app-name": appName } : {}
|
|
3961
|
+
}
|
|
3962
|
+
};
|
|
3963
|
+
}
|
|
3964
|
+
const configService = {
|
|
3965
|
+
setEnvironment,
|
|
3966
|
+
setAppName,
|
|
3967
|
+
getCoreAPIConfig
|
|
3968
|
+
};
|
|
3969
|
+
const BOT_DETECTION_RELAY_PATH = "/v1/fingerprint/bot-detection";
|
|
3970
|
+
const BOT_DETECTION_EVENTS = [
|
|
3971
|
+
"Search",
|
|
3972
|
+
"Payment Attempt",
|
|
3973
|
+
"Purchase Attempt"
|
|
3974
|
+
];
|
|
3975
|
+
function isEnabledFor(eventName) {
|
|
3976
|
+
return BOT_DETECTION_EVENTS.includes(eventName);
|
|
3977
|
+
}
|
|
3978
|
+
async function relay(payload) {
|
|
3979
|
+
var _a;
|
|
3980
|
+
try {
|
|
3981
|
+
const coreApiConfig = configService.getCoreAPIConfig();
|
|
3982
|
+
const response = await fetch(
|
|
3983
|
+
`${coreApiConfig.baseUrl}${BOT_DETECTION_RELAY_PATH}`,
|
|
3984
|
+
{
|
|
3985
|
+
method: "POST",
|
|
3986
|
+
headers: {
|
|
3987
|
+
"Content-Type": "application/json",
|
|
3988
|
+
...((_a = coreApiConfig.defaultHeaders) == null ? void 0 : _a["x-app-name"]) ? { "x-app-name": coreApiConfig.defaultHeaders["x-app-name"] } : {}
|
|
3989
|
+
},
|
|
3990
|
+
body: JSON.stringify(payload),
|
|
3991
|
+
keepalive: true
|
|
3992
|
+
}
|
|
3993
|
+
);
|
|
3994
|
+
if (!response.ok) {
|
|
3995
|
+
throw new Error(
|
|
3996
|
+
`Bot Detection relay failed with status ${response.status}`
|
|
3997
|
+
);
|
|
3998
|
+
}
|
|
3999
|
+
} catch (error) {
|
|
4000
|
+
console.error("Error relaying Fingerprint identification:", error);
|
|
4001
|
+
}
|
|
4002
|
+
}
|
|
4003
|
+
const botDetectionRelayService = {
|
|
4004
|
+
isEnabledFor,
|
|
4005
|
+
relay
|
|
4006
|
+
};
|
|
3924
4007
|
function __awaiter$1(thisArg, _arguments, P2, generator) {
|
|
3925
4008
|
function adopt(value) {
|
|
3926
4009
|
return value instanceof P2 ? value : new P2(function(resolve) {
|
|
@@ -3958,14 +4041,14 @@ function e(e2, t2) {
|
|
|
3958
4041
|
}(e2, t2) ? e2[t2] : void 0;
|
|
3959
4042
|
}
|
|
3960
4043
|
function t$3(e2, t2, n2, r2) {
|
|
3961
|
-
const o2 = document,
|
|
4044
|
+
const o2 = document, i2 = "securitypolicyviolation";
|
|
3962
4045
|
let R2;
|
|
3963
4046
|
const s2 = (t3) => {
|
|
3964
4047
|
const n3 = new URL(e2, location.href), { blockedURI: r3 } = t3;
|
|
3965
4048
|
r3 !== n3.href && r3 !== n3.protocol.slice(0, -1) && r3 !== n3.origin || (R2 = t3, a2());
|
|
3966
4049
|
};
|
|
3967
|
-
o2.addEventListener(
|
|
3968
|
-
const a2 = () => o2.removeEventListener(
|
|
4050
|
+
o2.addEventListener(i2, s2);
|
|
4051
|
+
const a2 = () => o2.removeEventListener(i2, s2);
|
|
3969
4052
|
return Promise.resolve().then(t2).then((e3) => (a2(), e3), (e3) => new Promise((e4) => {
|
|
3970
4053
|
const t3 = new MessageChannel();
|
|
3971
4054
|
t3.port1.onmessage = () => e4(), t3.port2.postMessage(null);
|
|
@@ -4001,26 +4084,26 @@ function V(e2, t2) {
|
|
|
4001
4084
|
return () => Math.random() * Math.min(t4, e4 * Math.pow(2, n4++));
|
|
4002
4085
|
}(100, 3e3), r3 = /* @__PURE__ */ new Set();
|
|
4003
4086
|
return [t3.current(), (e4, o3) => {
|
|
4004
|
-
let
|
|
4087
|
+
let i3;
|
|
4005
4088
|
const R3 = o3 instanceof Error ? o3.message : "";
|
|
4006
|
-
if (R3 === c$3 || R3 === E$1) t3.exclude(),
|
|
4089
|
+
if (R3 === c$3 || R3 === E$1) t3.exclude(), i3 = 0;
|
|
4007
4090
|
else if (R3 === K) t3.exclude();
|
|
4008
4091
|
else if (R3 === M) {
|
|
4009
4092
|
const n4 = Date.now() - e4.getTime() < 50, o4 = t3.current();
|
|
4010
|
-
o4 && n4 && !r3.has(o4) && (r3.add(o4),
|
|
4093
|
+
o4 && n4 && !r3.has(o4) && (r3.add(o4), i3 = 0), t3.postpone();
|
|
4011
4094
|
} else t3.postpone();
|
|
4012
4095
|
const s2 = t3.current();
|
|
4013
|
-
return void 0 === s2 ? void 0 : [s2, null !=
|
|
4096
|
+
return void 0 === s2 ? void 0 : [s2, null != i3 ? i3 : e4.getTime() + n3() - Date.now()];
|
|
4014
4097
|
}];
|
|
4015
4098
|
}(e2);
|
|
4016
|
-
let
|
|
4099
|
+
let i2;
|
|
4017
4100
|
if (void 0 === r2) return Promise.reject(new TypeError("The list of script URL patterns is empty"));
|
|
4018
4101
|
const R2 = (e3) => {
|
|
4019
4102
|
const r3 = /* @__PURE__ */ new Date(), s2 = (t3) => n2.push({ url: e3, startedAt: r3, finishedAt: /* @__PURE__ */ new Date(), error: t3 }), a2 = t2(e3);
|
|
4020
4103
|
return a2.then(() => s2(), s2), a2.catch((e4) => {
|
|
4021
|
-
if (null !=
|
|
4104
|
+
if (null != i2 || (i2 = e4), n2.length >= 5) throw i2;
|
|
4022
4105
|
const t3 = o2(r3, e4);
|
|
4023
|
-
if (!t3) throw
|
|
4106
|
+
if (!t3) throw i2;
|
|
4024
4107
|
const [s3, a3] = t3;
|
|
4025
4108
|
return (c2 = a3, new Promise((e5) => setTimeout(e5, c2))).then(() => R2(s3));
|
|
4026
4109
|
var c2;
|
|
@@ -4031,9 +4114,9 @@ function V(e2, t2) {
|
|
|
4031
4114
|
const k = "https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js", G = k;
|
|
4032
4115
|
function B(t2) {
|
|
4033
4116
|
var n2, r2;
|
|
4034
|
-
const { picked: o2, rest:
|
|
4117
|
+
const { picked: o2, rest: i2 } = function(e2, t3) {
|
|
4035
4118
|
const n3 = {}, r3 = {};
|
|
4036
|
-
for (const [o3,
|
|
4119
|
+
for (const [o3, i3] of Object.entries(e2)) t3.includes(o3) ? n3[o3] = i3 : r3[o3] = i3;
|
|
4037
4120
|
return { picked: n3, rest: r3 };
|
|
4038
4121
|
}(t2, ["scriptUrlPattern", "token", "apiKey"]), R2 = o2.token, s2 = null !== (n2 = o2.apiKey) && void 0 !== n2 ? n2 : R2, a2 = null !== (r2 = e(t2, "scriptUrlPattern")) && void 0 !== r2 ? r2 : k, [c2, E2] = function() {
|
|
4039
4122
|
const e2 = [], t3 = () => {
|
|
@@ -4057,7 +4140,7 @@ function B(t2) {
|
|
|
4057
4140
|
if (e3 instanceof Error && e3.message === K) return new Error(M);
|
|
4058
4141
|
return e3;
|
|
4059
4142
|
}(e2);
|
|
4060
|
-
}).then(([e2, t3]) => (E2(), e2.load({ ...
|
|
4143
|
+
}).then(([e2, t3]) => (E2(), e2.load({ ...i2, ldi: { attempts: t3, visibilityStates: c2 } })));
|
|
4061
4144
|
}
|
|
4062
4145
|
function F(e2) {
|
|
4063
4146
|
return t$3(e2, () => function(e3) {
|
|
@@ -4073,12 +4156,12 @@ function F(e2) {
|
|
|
4073
4156
|
const r2 = document.createElement("script"), o2 = () => {
|
|
4074
4157
|
var e4;
|
|
4075
4158
|
return null === (e4 = r2.parentNode) || void 0 === e4 ? void 0 : e4.removeChild(r2);
|
|
4076
|
-
},
|
|
4159
|
+
}, i2 = document.head || document.getElementsByTagName("head")[0];
|
|
4077
4160
|
r2.onload = () => {
|
|
4078
4161
|
o2(), t2();
|
|
4079
4162
|
}, r2.onerror = () => {
|
|
4080
4163
|
o2(), n2(new Error(M));
|
|
4081
|
-
}, r2.async = true, r2.src = e3,
|
|
4164
|
+
}, r2.async = true, r2.src = e3, i2.appendChild(r2);
|
|
4082
4165
|
});
|
|
4083
4166
|
}(e2), () => {
|
|
4084
4167
|
throw new Error(c$3);
|
|
@@ -4494,1357 +4577,838 @@ class FpjsClient {
|
|
|
4494
4577
|
});
|
|
4495
4578
|
}
|
|
4496
4579
|
}
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4580
|
+
var NodeType;
|
|
4581
|
+
(function(NodeType2) {
|
|
4582
|
+
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
4583
|
+
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
4584
|
+
NodeType2[NodeType2["Element"] = 2] = "Element";
|
|
4585
|
+
NodeType2[NodeType2["Text"] = 3] = "Text";
|
|
4586
|
+
NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
|
|
4587
|
+
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
4588
|
+
})(NodeType || (NodeType = {}));
|
|
4589
|
+
function isElement(n2) {
|
|
4590
|
+
return n2.nodeType === n2.ELEMENT_NODE;
|
|
4591
|
+
}
|
|
4592
|
+
function isShadowRoot(n2) {
|
|
4593
|
+
const host = n2 === null || n2 === void 0 ? void 0 : n2.host;
|
|
4594
|
+
return Boolean((host === null || host === void 0 ? void 0 : host.shadowRoot) === n2);
|
|
4595
|
+
}
|
|
4596
|
+
function isNativeShadowDom(shadowRoot) {
|
|
4597
|
+
return Object.prototype.toString.call(shadowRoot) === "[object ShadowRoot]";
|
|
4598
|
+
}
|
|
4599
|
+
function fixBrowserCompatibilityIssuesInCSS(cssText) {
|
|
4600
|
+
if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
|
|
4601
|
+
cssText = cssText.replace(" background-clip: text;", " -webkit-background-clip: text; background-clip: text;");
|
|
4519
4602
|
}
|
|
4520
|
-
|
|
4521
|
-
const setCachedFingerprint = (fingerprint) => {
|
|
4522
|
-
const {
|
|
4523
|
-
cacheName = DEFAULT_CACHE_NAME,
|
|
4524
|
-
cacheTimeInDays = DEFAULT_CACHE_TIME_IN_DAYS
|
|
4525
|
-
} = window.fingerprintConfig;
|
|
4526
|
-
const cacheData = {
|
|
4527
|
-
fingerprint,
|
|
4528
|
-
expiresAt: getExpirationDate(cacheTimeInDays)
|
|
4529
|
-
};
|
|
4530
|
-
localStorage.setItem(cacheName, JSON.stringify(cacheData));
|
|
4531
|
-
};
|
|
4532
|
-
function buildProxyUrl(url) {
|
|
4533
|
-
return `${url}?${PROXY_QUERY_PARAM}`;
|
|
4603
|
+
return cssText;
|
|
4534
4604
|
}
|
|
4535
|
-
|
|
4536
|
-
const
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4605
|
+
function escapeImportStatement(rule) {
|
|
4606
|
+
const { cssText } = rule;
|
|
4607
|
+
if (cssText.split('"').length < 3)
|
|
4608
|
+
return cssText;
|
|
4609
|
+
const statement = ["@import", `url(${JSON.stringify(rule.href)})`];
|
|
4610
|
+
if (rule.layerName === "") {
|
|
4611
|
+
statement.push(`layer`);
|
|
4612
|
+
} else if (rule.layerName) {
|
|
4613
|
+
statement.push(`layer(${rule.layerName})`);
|
|
4541
4614
|
}
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
window.fpClient = client;
|
|
4615
|
+
if (rule.supportsText) {
|
|
4616
|
+
statement.push(`supports(${rule.supportsText})`);
|
|
4617
|
+
}
|
|
4618
|
+
if (rule.media.length) {
|
|
4619
|
+
statement.push(rule.media.mediaText);
|
|
4620
|
+
}
|
|
4621
|
+
return statement.join(" ") + ";";
|
|
4622
|
+
}
|
|
4623
|
+
function stringifyStylesheet(s2) {
|
|
4552
4624
|
try {
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
fingerprintAgentReady = true;
|
|
4556
|
-
}
|
|
4625
|
+
const rules = s2.rules || s2.cssRules;
|
|
4626
|
+
return rules ? fixBrowserCompatibilityIssuesInCSS(Array.from(rules, stringifyRule).join("")) : null;
|
|
4557
4627
|
} catch (error) {
|
|
4558
|
-
|
|
4559
|
-
|
|
4628
|
+
return null;
|
|
4629
|
+
}
|
|
4630
|
+
}
|
|
4631
|
+
function stringifyRule(rule) {
|
|
4632
|
+
let importStringified;
|
|
4633
|
+
if (isCSSImportRule(rule)) {
|
|
4634
|
+
try {
|
|
4635
|
+
importStringified = stringifyStylesheet(rule.styleSheet) || escapeImportStatement(rule);
|
|
4636
|
+
} catch (error) {
|
|
4560
4637
|
}
|
|
4561
|
-
|
|
4562
|
-
|
|
4638
|
+
} else if (isCSSStyleRule(rule) && rule.selectorText.includes(":")) {
|
|
4639
|
+
return fixSafariColons(rule.cssText);
|
|
4563
4640
|
}
|
|
4641
|
+
return importStringified || rule.cssText;
|
|
4564
4642
|
}
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4643
|
+
function fixSafariColons(cssStringified) {
|
|
4644
|
+
const regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
|
|
4645
|
+
return cssStringified.replace(regex, "$1\\$2");
|
|
4646
|
+
}
|
|
4647
|
+
function isCSSImportRule(rule) {
|
|
4648
|
+
return "styleSheet" in rule;
|
|
4649
|
+
}
|
|
4650
|
+
function isCSSStyleRule(rule) {
|
|
4651
|
+
return "selectorText" in rule;
|
|
4652
|
+
}
|
|
4653
|
+
class Mirror {
|
|
4654
|
+
constructor() {
|
|
4655
|
+
this.idNodeMap = /* @__PURE__ */ new Map();
|
|
4656
|
+
this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
|
|
4657
|
+
}
|
|
4658
|
+
getId(n2) {
|
|
4659
|
+
var _a;
|
|
4660
|
+
if (!n2)
|
|
4661
|
+
return -1;
|
|
4662
|
+
const id = (_a = this.getMeta(n2)) === null || _a === void 0 ? void 0 : _a.id;
|
|
4663
|
+
return id !== null && id !== void 0 ? id : -1;
|
|
4664
|
+
}
|
|
4665
|
+
getNode(id) {
|
|
4666
|
+
return this.idNodeMap.get(id) || null;
|
|
4667
|
+
}
|
|
4668
|
+
getIds() {
|
|
4669
|
+
return Array.from(this.idNodeMap.keys());
|
|
4670
|
+
}
|
|
4671
|
+
getMeta(n2) {
|
|
4672
|
+
return this.nodeMetaMap.get(n2) || null;
|
|
4673
|
+
}
|
|
4674
|
+
removeNodeFromMap(n2) {
|
|
4675
|
+
const id = this.getId(n2);
|
|
4676
|
+
this.idNodeMap.delete(id);
|
|
4677
|
+
if (n2.childNodes) {
|
|
4678
|
+
n2.childNodes.forEach((childNode) => this.removeNodeFromMap(childNode));
|
|
4569
4679
|
}
|
|
4570
|
-
throw new Error("Fingerprint configuration is not initialized.");
|
|
4571
4680
|
}
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
return cachedFingerprint;
|
|
4681
|
+
has(id) {
|
|
4682
|
+
return this.idNodeMap.has(id);
|
|
4575
4683
|
}
|
|
4576
|
-
|
|
4577
|
-
return
|
|
4684
|
+
hasNode(node) {
|
|
4685
|
+
return this.nodeMetaMap.has(node);
|
|
4578
4686
|
}
|
|
4579
|
-
|
|
4580
|
-
const
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4687
|
+
add(n2, meta) {
|
|
4688
|
+
const id = meta.id;
|
|
4689
|
+
this.idNodeMap.set(id, n2);
|
|
4690
|
+
this.nodeMetaMap.set(n2, meta);
|
|
4691
|
+
}
|
|
4692
|
+
replace(id, n2) {
|
|
4693
|
+
const oldNode = this.getNode(id);
|
|
4694
|
+
if (oldNode) {
|
|
4695
|
+
const meta = this.nodeMetaMap.get(oldNode);
|
|
4696
|
+
if (meta)
|
|
4697
|
+
this.nodeMetaMap.set(n2, meta);
|
|
4698
|
+
}
|
|
4699
|
+
this.idNodeMap.set(id, n2);
|
|
4700
|
+
}
|
|
4701
|
+
reset() {
|
|
4702
|
+
this.idNodeMap = /* @__PURE__ */ new Map();
|
|
4703
|
+
this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
|
|
4587
4704
|
}
|
|
4588
4705
|
}
|
|
4589
|
-
function
|
|
4590
|
-
return
|
|
4706
|
+
function createMirror() {
|
|
4707
|
+
return new Mirror();
|
|
4591
4708
|
}
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
purchase: "https://purchases.resertravel.com/api",
|
|
4602
|
-
core: ""
|
|
4603
|
-
},
|
|
4604
|
-
production: {
|
|
4605
|
-
search: "https://search.reservamos.mx/api",
|
|
4606
|
-
purchase: "https://compras.reservamos.mx/api",
|
|
4607
|
-
core: ""
|
|
4608
|
-
}
|
|
4609
|
-
}, s$2 = "sandbox", a$1 = "v2", t$2 = "v1", n$1 = {
|
|
4610
|
-
env: s$2,
|
|
4611
|
-
headers: {},
|
|
4612
|
-
searchUrl: r$1[s$2].search,
|
|
4613
|
-
purchaseUrl: r$1[s$2].purchase,
|
|
4614
|
-
coreUrl: r$1[s$2].core,
|
|
4615
|
-
version: a$1,
|
|
4616
|
-
coreVersion: t$2,
|
|
4617
|
-
apiKey: void 0,
|
|
4618
|
-
userAuthToken: void 0,
|
|
4619
|
-
withCredentials: false
|
|
4620
|
-
};
|
|
4621
|
-
let c$2 = Object.assign({}, n$1);
|
|
4622
|
-
const o$1 = {
|
|
4623
|
-
// UNAUTHORIZED
|
|
4624
|
-
1: {
|
|
4625
|
-
code: 200,
|
|
4626
|
-
message: "Operación no autorizada"
|
|
4627
|
-
}
|
|
4628
|
-
}, s$1 = {
|
|
4629
|
-
// INCORRECT_PARAMS
|
|
4630
|
-
3: {
|
|
4631
|
-
code: 300,
|
|
4632
|
-
message: "Parámetros incorrectos"
|
|
4633
|
-
},
|
|
4634
|
-
// INCORRECT_DATE
|
|
4635
|
-
7: {
|
|
4636
|
-
code: 301,
|
|
4637
|
-
message: "Fecha inválida"
|
|
4638
|
-
}
|
|
4639
|
-
}, r = {
|
|
4640
|
-
// NONEXISTENT_TRIP
|
|
4641
|
-
10: {
|
|
4642
|
-
code: 400,
|
|
4643
|
-
message: "No existe el viaje"
|
|
4644
|
-
},
|
|
4645
|
-
// journey_key_not_found
|
|
4646
|
-
20: {
|
|
4647
|
-
code: 60,
|
|
4648
|
-
message: "No se encontró el viaje"
|
|
4649
|
-
},
|
|
4650
|
-
// sold_out_fare_code
|
|
4651
|
-
21: {
|
|
4652
|
-
code: 60,
|
|
4653
|
-
message: "Tarifa no disponible"
|
|
4654
|
-
},
|
|
4655
|
-
// unavailable_fare_code
|
|
4656
|
-
22: {
|
|
4657
|
-
code: 60,
|
|
4658
|
-
message: "Tarifa no disponible"
|
|
4659
|
-
}
|
|
4660
|
-
}, n = (e2) => ({
|
|
4661
|
-
// INVALID_DISCOUNT
|
|
4662
|
-
11: {
|
|
4663
|
-
code: 500,
|
|
4664
|
-
message: e2
|
|
4665
|
-
},
|
|
4666
|
-
//EXPIRED_DISCOUNT
|
|
4667
|
-
12: {
|
|
4668
|
-
code: 501,
|
|
4669
|
-
message: e2
|
|
4670
|
-
}
|
|
4671
|
-
}), a = {
|
|
4672
|
-
// unavailable_student
|
|
4673
|
-
23: {
|
|
4674
|
-
code: 60,
|
|
4675
|
-
message: "Estudiante no disponible"
|
|
4676
|
-
},
|
|
4677
|
-
// unavailable_teacher
|
|
4678
|
-
24: {
|
|
4679
|
-
code: 60,
|
|
4680
|
-
message: "Profesor no disponible"
|
|
4681
|
-
},
|
|
4682
|
-
// unavailable_minor
|
|
4683
|
-
25: {
|
|
4684
|
-
code: 60,
|
|
4685
|
-
message: "Menor no disponible"
|
|
4686
|
-
},
|
|
4687
|
-
// unavailable_special
|
|
4688
|
-
26: {
|
|
4689
|
-
code: 60,
|
|
4690
|
-
message: "Capacidades diferentes no disponible"
|
|
4691
|
-
},
|
|
4692
|
-
// unavailable_older
|
|
4693
|
-
27: {
|
|
4694
|
-
code: 60,
|
|
4695
|
-
message: "INSEN no disponible"
|
|
4696
|
-
},
|
|
4697
|
-
// unavailable_general
|
|
4698
|
-
28: {
|
|
4699
|
-
code: 60,
|
|
4700
|
-
message: "General no disponible"
|
|
4701
|
-
},
|
|
4702
|
-
// unavailable_unknown
|
|
4703
|
-
29: {
|
|
4704
|
-
code: 60,
|
|
4705
|
-
message: "Error desconocido"
|
|
4706
|
-
}
|
|
4707
|
-
}, c$1 = (e2) => ({
|
|
4708
|
-
30: {
|
|
4709
|
-
code: 30,
|
|
4710
|
-
message: e2
|
|
4711
|
-
}
|
|
4712
|
-
}), d$1 = {
|
|
4713
|
-
50: {
|
|
4714
|
-
code: 50,
|
|
4715
|
-
message: "Unknow Error"
|
|
4716
|
-
}
|
|
4717
|
-
}, i$2 = (e2) => ({
|
|
4718
|
-
...o$1,
|
|
4719
|
-
...s$1,
|
|
4720
|
-
...r,
|
|
4721
|
-
...n(e2),
|
|
4722
|
-
...a,
|
|
4723
|
-
...d$1,
|
|
4724
|
-
...c$1(e2)
|
|
4725
|
-
});
|
|
4726
|
-
class o extends Error {
|
|
4727
|
-
constructor(r2 = -100, s2 = "Unknown error", t2 = null) {
|
|
4728
|
-
super(s2), this.code = r2, this.details = t2, this.stack = new Error().stack;
|
|
4709
|
+
function maskInputValue({ element, maskInputOptions, tagName, type, value, maskInputFn }) {
|
|
4710
|
+
let text = value || "";
|
|
4711
|
+
const actualType = type && toLowerCase(type);
|
|
4712
|
+
if (maskInputOptions[tagName.toLowerCase()] || actualType && maskInputOptions[actualType]) {
|
|
4713
|
+
if (maskInputFn) {
|
|
4714
|
+
text = maskInputFn(text, element);
|
|
4715
|
+
} else {
|
|
4716
|
+
text = "*".repeat(text.length);
|
|
4717
|
+
}
|
|
4729
4718
|
}
|
|
4719
|
+
return text;
|
|
4730
4720
|
}
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
if (t2.ok)
|
|
4734
|
-
return r2;
|
|
4735
|
-
if (e2.includes(t2.status))
|
|
4736
|
-
switch (t2.status) {
|
|
4737
|
-
case 404:
|
|
4738
|
-
throw new o(100, "Not found");
|
|
4739
|
-
case 422:
|
|
4740
|
-
return r2;
|
|
4741
|
-
case 500:
|
|
4742
|
-
throw new o(101, "Server error");
|
|
4743
|
-
default:
|
|
4744
|
-
throw new o();
|
|
4745
|
-
}
|
|
4746
|
-
else
|
|
4747
|
-
throw new o(t2.status, r2.message || t2.statusText, r2);
|
|
4721
|
+
function toLowerCase(str) {
|
|
4722
|
+
return str.toLowerCase();
|
|
4748
4723
|
}
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4724
|
+
const ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__";
|
|
4725
|
+
function is2DCanvasBlank(canvas) {
|
|
4726
|
+
const ctx = canvas.getContext("2d");
|
|
4727
|
+
if (!ctx)
|
|
4728
|
+
return true;
|
|
4729
|
+
const chunkSize = 50;
|
|
4730
|
+
for (let x2 = 0; x2 < canvas.width; x2 += chunkSize) {
|
|
4731
|
+
for (let y2 = 0; y2 < canvas.height; y2 += chunkSize) {
|
|
4732
|
+
const getImageData = ctx.getImageData;
|
|
4733
|
+
const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;
|
|
4734
|
+
const pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x2, y2, Math.min(chunkSize, canvas.width - x2), Math.min(chunkSize, canvas.height - y2)).data.buffer);
|
|
4735
|
+
if (pixelBuffer.some((pixel) => pixel !== 0))
|
|
4736
|
+
return false;
|
|
4737
|
+
}
|
|
4738
|
+
}
|
|
4739
|
+
return true;
|
|
4755
4740
|
}
|
|
4756
|
-
function
|
|
4757
|
-
const
|
|
4758
|
-
|
|
4759
|
-
...n2,
|
|
4760
|
-
[o2]: t2.map((a2) => o2 in a2 && a2[o2]).filter(Boolean)
|
|
4761
|
-
}),
|
|
4762
|
-
{}
|
|
4763
|
-
);
|
|
4764
|
-
return new Headers(r2);
|
|
4741
|
+
function getInputType(element) {
|
|
4742
|
+
const type = element.type;
|
|
4743
|
+
return element.hasAttribute("data-rr-is-password") ? "password" : type ? toLowerCase(type) : null;
|
|
4765
4744
|
}
|
|
4766
|
-
function
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
return s2 && (u3.Authorization = `Token ${r2.apiKey || o2}, Bearer ${s2}`), e2.headers = y(d2, u3), e2.credentials = a2 ? "include" : "omit", typeof e2.body != "string" && (e2.body = JSON.stringify(e2.body)), fetch(t2, e2).then(w).then(l$1).catch(n2);
|
|
4745
|
+
function extractFileExtension(path, baseURL) {
|
|
4746
|
+
var _a;
|
|
4747
|
+
let url;
|
|
4748
|
+
try {
|
|
4749
|
+
url = new URL(path, baseURL !== null && baseURL !== void 0 ? baseURL : window.location.href);
|
|
4750
|
+
} catch (err) {
|
|
4751
|
+
return null;
|
|
4752
|
+
}
|
|
4753
|
+
const regex = /\.([0-9a-z]+)(?:$)/i;
|
|
4754
|
+
const match = url.pathname.match(regex);
|
|
4755
|
+
return (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
|
|
4778
4756
|
}
|
|
4779
|
-
|
|
4780
|
-
|
|
4757
|
+
let _id = 1;
|
|
4758
|
+
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
4759
|
+
const IGNORED_NODE = -2;
|
|
4760
|
+
function genId() {
|
|
4761
|
+
return _id++;
|
|
4781
4762
|
}
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
watch: i,
|
|
4786
|
-
expect: h2,
|
|
4787
|
-
maxRetries: t2 = 30,
|
|
4788
|
-
interval: s2 = 2e3,
|
|
4789
|
-
eachCall: c2 = null
|
|
4790
|
-
}) {
|
|
4791
|
-
this.url = e2, this.watch = i, this.expect = h2 instanceof Array ? h2 : [h2], this.interval = s2, this.maxRetries = t2, this.eachCall = c2 && c2.bind(this), this.aborted = false, this.timers = [], this.execute = this.execute.bind(this), this.executeEachCall = this.executeEachCall.bind(this);
|
|
4763
|
+
function getValidTagName(element) {
|
|
4764
|
+
if (element instanceof HTMLFormElement) {
|
|
4765
|
+
return "form";
|
|
4792
4766
|
}
|
|
4793
|
-
|
|
4794
|
-
|
|
4767
|
+
const processedTagName = toLowerCase(element.tagName);
|
|
4768
|
+
if (tagNameRegex.test(processedTagName)) {
|
|
4769
|
+
return "div";
|
|
4795
4770
|
}
|
|
4796
|
-
|
|
4797
|
-
|
|
4771
|
+
return processedTagName;
|
|
4772
|
+
}
|
|
4773
|
+
function extractOrigin(url) {
|
|
4774
|
+
let origin2 = "";
|
|
4775
|
+
if (url.indexOf("//") > -1) {
|
|
4776
|
+
origin2 = url.split("/").slice(0, 3).join("/");
|
|
4777
|
+
} else {
|
|
4778
|
+
origin2 = url.split("/")[0];
|
|
4798
4779
|
}
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4780
|
+
origin2 = origin2.split("?")[0];
|
|
4781
|
+
return origin2;
|
|
4782
|
+
}
|
|
4783
|
+
let canvasService;
|
|
4784
|
+
let canvasCtx;
|
|
4785
|
+
const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
|
|
4786
|
+
const URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i;
|
|
4787
|
+
const URL_WWW_MATCH = /^www\..*/i;
|
|
4788
|
+
const DATA_URI = /^(data:)([^,]*),(.*)/i;
|
|
4789
|
+
function absoluteToStylesheet(cssText, href) {
|
|
4790
|
+
return (cssText || "").replace(URL_IN_CSS_REF, (origin2, quote1, path1, quote2, path2, path3) => {
|
|
4791
|
+
const filePath = path1 || path2 || path3;
|
|
4792
|
+
const maybeQuote = quote1 || quote2 || "";
|
|
4793
|
+
if (!filePath) {
|
|
4794
|
+
return origin2;
|
|
4795
|
+
}
|
|
4796
|
+
if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {
|
|
4797
|
+
return `url(${maybeQuote}${filePath}${maybeQuote})`;
|
|
4798
|
+
}
|
|
4799
|
+
if (DATA_URI.test(filePath)) {
|
|
4800
|
+
return `url(${maybeQuote}${filePath}${maybeQuote})`;
|
|
4801
|
+
}
|
|
4802
|
+
if (filePath[0] === "/") {
|
|
4803
|
+
return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`;
|
|
4804
|
+
}
|
|
4805
|
+
const stack = href.split("/");
|
|
4806
|
+
const parts = filePath.split("/");
|
|
4807
|
+
stack.pop();
|
|
4808
|
+
for (const part of parts) {
|
|
4809
|
+
if (part === ".") {
|
|
4810
|
+
continue;
|
|
4811
|
+
} else if (part === "..") {
|
|
4812
|
+
stack.pop();
|
|
4813
|
+
} else {
|
|
4814
|
+
stack.push(part);
|
|
4814
4815
|
}
|
|
4815
|
-
}
|
|
4816
|
-
return
|
|
4816
|
+
}
|
|
4817
|
+
return `url(${maybeQuote}${stack.join("/")}${maybeQuote})`;
|
|
4818
|
+
});
|
|
4819
|
+
}
|
|
4820
|
+
const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
4821
|
+
const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
4822
|
+
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
4823
|
+
if (attributeValue.trim() === "") {
|
|
4824
|
+
return attributeValue;
|
|
4817
4825
|
}
|
|
4818
|
-
|
|
4819
|
-
|
|
4826
|
+
let pos = 0;
|
|
4827
|
+
function collectCharacters(regEx) {
|
|
4828
|
+
let chars2;
|
|
4829
|
+
const match = regEx.exec(attributeValue.substring(pos));
|
|
4830
|
+
if (match) {
|
|
4831
|
+
chars2 = match[0];
|
|
4832
|
+
pos += chars2.length;
|
|
4833
|
+
return chars2;
|
|
4834
|
+
}
|
|
4835
|
+
return "";
|
|
4820
4836
|
}
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4837
|
+
const output = [];
|
|
4838
|
+
while (true) {
|
|
4839
|
+
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
4840
|
+
if (pos >= attributeValue.length) {
|
|
4841
|
+
break;
|
|
4842
|
+
}
|
|
4843
|
+
let url = collectCharacters(SRCSET_NOT_SPACES);
|
|
4844
|
+
if (url.slice(-1) === ",") {
|
|
4845
|
+
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
4846
|
+
output.push(url);
|
|
4847
|
+
} else {
|
|
4848
|
+
let descriptorsStr = "";
|
|
4849
|
+
url = absoluteToDoc(doc, url);
|
|
4850
|
+
let inParens = false;
|
|
4851
|
+
while (true) {
|
|
4852
|
+
const c2 = attributeValue.charAt(pos);
|
|
4853
|
+
if (c2 === "") {
|
|
4854
|
+
output.push((url + descriptorsStr).trim());
|
|
4855
|
+
break;
|
|
4856
|
+
} else if (!inParens) {
|
|
4857
|
+
if (c2 === ",") {
|
|
4858
|
+
pos += 1;
|
|
4859
|
+
output.push((url + descriptorsStr).trim());
|
|
4860
|
+
break;
|
|
4861
|
+
} else if (c2 === "(") {
|
|
4862
|
+
inParens = true;
|
|
4863
|
+
}
|
|
4864
|
+
} else {
|
|
4865
|
+
if (c2 === ")") {
|
|
4866
|
+
inParens = false;
|
|
4867
|
+
}
|
|
4868
|
+
}
|
|
4869
|
+
descriptorsStr += c2;
|
|
4870
|
+
pos += 1;
|
|
4871
|
+
}
|
|
4872
|
+
}
|
|
4834
4873
|
}
|
|
4835
|
-
|
|
4836
|
-
|
|
4874
|
+
return output.join(", ");
|
|
4875
|
+
}
|
|
4876
|
+
function absoluteToDoc(doc, attributeValue) {
|
|
4877
|
+
if (!attributeValue || attributeValue.trim() === "") {
|
|
4878
|
+
return attributeValue;
|
|
4837
4879
|
}
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4880
|
+
const a2 = doc.createElement("a");
|
|
4881
|
+
a2.href = attributeValue;
|
|
4882
|
+
return a2.href;
|
|
4883
|
+
}
|
|
4884
|
+
function isSVGElement(el) {
|
|
4885
|
+
return Boolean(el.tagName === "svg" || el.ownerSVGElement);
|
|
4886
|
+
}
|
|
4887
|
+
function getHref() {
|
|
4888
|
+
const a2 = document.createElement("a");
|
|
4889
|
+
a2.href = "";
|
|
4890
|
+
return a2.href;
|
|
4891
|
+
}
|
|
4892
|
+
function transformAttribute(doc, tagName, name, value) {
|
|
4893
|
+
if (!value) {
|
|
4894
|
+
return value;
|
|
4841
4895
|
}
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
})).json();
|
|
4896
|
+
if (name === "src" || name === "href" && !(tagName === "use" && value[0] === "#")) {
|
|
4897
|
+
return absoluteToDoc(doc, value);
|
|
4898
|
+
} else if (name === "xlink:href" && value[0] !== "#") {
|
|
4899
|
+
return absoluteToDoc(doc, value);
|
|
4900
|
+
} else if (name === "background" && (tagName === "table" || tagName === "td" || tagName === "th")) {
|
|
4901
|
+
return absoluteToDoc(doc, value);
|
|
4902
|
+
} else if (name === "srcset") {
|
|
4903
|
+
return getAbsoluteSrcsetString(doc, value);
|
|
4904
|
+
} else if (name === "style") {
|
|
4905
|
+
return absoluteToStylesheet(value, getHref());
|
|
4906
|
+
} else if (tagName === "object" && name === "data") {
|
|
4907
|
+
return absoluteToDoc(doc, value);
|
|
4855
4908
|
}
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4909
|
+
return value;
|
|
4910
|
+
}
|
|
4911
|
+
function ignoreAttribute(tagName, name, _value) {
|
|
4912
|
+
return (tagName === "video" || tagName === "audio") && name === "autoplay";
|
|
4913
|
+
}
|
|
4914
|
+
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
4915
|
+
try {
|
|
4916
|
+
if (typeof blockClass === "string") {
|
|
4917
|
+
if (element.classList.contains(blockClass)) {
|
|
4918
|
+
return true;
|
|
4919
|
+
}
|
|
4920
|
+
} else {
|
|
4921
|
+
for (let eIndex = element.classList.length; eIndex--; ) {
|
|
4922
|
+
const className = element.classList[eIndex];
|
|
4923
|
+
if (blockClass.test(className)) {
|
|
4924
|
+
return true;
|
|
4925
|
+
}
|
|
4926
|
+
}
|
|
4927
|
+
}
|
|
4928
|
+
if (blockSelector) {
|
|
4929
|
+
return element.matches(blockSelector);
|
|
4930
|
+
}
|
|
4931
|
+
} catch (e2) {
|
|
4860
4932
|
}
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4933
|
+
return false;
|
|
4934
|
+
}
|
|
4935
|
+
function classMatchesRegex(node, regex, checkAncestors) {
|
|
4936
|
+
if (!node)
|
|
4937
|
+
return false;
|
|
4938
|
+
if (node.nodeType !== node.ELEMENT_NODE) {
|
|
4939
|
+
if (!checkAncestors)
|
|
4940
|
+
return false;
|
|
4941
|
+
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
4869
4942
|
}
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
...r2 ? { Authorization: r2 } : {}
|
|
4876
|
-
};
|
|
4877
|
-
return (await fetch(a2, {
|
|
4878
|
-
method: "DELETE",
|
|
4879
|
-
headers: u3
|
|
4880
|
-
})).json();
|
|
4943
|
+
for (let eIndex = node.classList.length; eIndex--; ) {
|
|
4944
|
+
const className = node.classList[eIndex];
|
|
4945
|
+
if (regex.test(className)) {
|
|
4946
|
+
return true;
|
|
4947
|
+
}
|
|
4881
4948
|
}
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
delete: b2,
|
|
4886
|
-
setAuthorizationHeader: p2,
|
|
4887
|
-
setConfig: f2,
|
|
4888
|
-
poll: H2
|
|
4889
|
-
};
|
|
4949
|
+
if (!checkAncestors)
|
|
4950
|
+
return false;
|
|
4951
|
+
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
4890
4952
|
}
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4953
|
+
function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors) {
|
|
4954
|
+
try {
|
|
4955
|
+
const el = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement;
|
|
4956
|
+
if (el === null)
|
|
4957
|
+
return false;
|
|
4958
|
+
if (typeof maskTextClass === "string") {
|
|
4959
|
+
if (checkAncestors) {
|
|
4960
|
+
if (el.closest(`.${maskTextClass}`))
|
|
4961
|
+
return true;
|
|
4962
|
+
} else {
|
|
4963
|
+
if (el.classList.contains(maskTextClass))
|
|
4964
|
+
return true;
|
|
4965
|
+
}
|
|
4966
|
+
} else {
|
|
4967
|
+
if (classMatchesRegex(el, maskTextClass, checkAncestors))
|
|
4968
|
+
return true;
|
|
4900
4969
|
}
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
userIdentifier: t2
|
|
4910
|
-
}) {
|
|
4911
|
-
return t$1.get(
|
|
4912
|
-
`trip_recommendations/${e2}/${t2}`
|
|
4913
|
-
);
|
|
4914
|
-
}
|
|
4915
|
-
function i$1(e2) {
|
|
4916
|
-
return t$1.post("seat_recommendations", {
|
|
4917
|
-
body: e2
|
|
4918
|
-
});
|
|
4919
|
-
}
|
|
4920
|
-
function p({
|
|
4921
|
-
distinct_id: e2,
|
|
4922
|
-
...t2
|
|
4923
|
-
}) {
|
|
4924
|
-
return t$1.post(`seat_recommendations/${e2}`, {
|
|
4925
|
-
body: t2
|
|
4926
|
-
});
|
|
4927
|
-
}
|
|
4928
|
-
function u2(e2, t2) {
|
|
4929
|
-
const { start: o2, onEachResponse: r2 } = t2, c2 = `profiles/${e2}`, a2 = {
|
|
4930
|
-
watch: "state",
|
|
4931
|
-
expect: "finished",
|
|
4932
|
-
onEachResponse: r2
|
|
4933
|
-
}, s2 = t$1.poll(c2, a2);
|
|
4934
|
-
return o2 && s2.start(), s2;
|
|
4935
|
-
}
|
|
4936
|
-
async function m(e2) {
|
|
4937
|
-
return t$1.post("profiles", {
|
|
4938
|
-
body: e2
|
|
4939
|
-
});
|
|
4940
|
-
}
|
|
4941
|
-
async function l(e2) {
|
|
4942
|
-
return t$1.post("passengers", {
|
|
4943
|
-
body: e2
|
|
4944
|
-
});
|
|
4945
|
-
}
|
|
4946
|
-
async function f$1(e2) {
|
|
4947
|
-
return t$1.get(
|
|
4948
|
-
`passengers/${e2}`
|
|
4949
|
-
);
|
|
4950
|
-
}
|
|
4951
|
-
async function g(e2, t2) {
|
|
4952
|
-
return t$1.delete(
|
|
4953
|
-
`passengers/${e2}/${t2}`
|
|
4954
|
-
);
|
|
4955
|
-
}
|
|
4956
|
-
const R = {
|
|
4957
|
-
getRecommendedTrips: d,
|
|
4958
|
-
createRecommendedPlaces: m,
|
|
4959
|
-
pollRecommendedPlaces: u2,
|
|
4960
|
-
createRecommendedSeats: i$1,
|
|
4961
|
-
getRecommendedSeats: p,
|
|
4962
|
-
getFrequentPassengers: f$1,
|
|
4963
|
-
createFrequentPassengers: l,
|
|
4964
|
-
deleteFrequentPassenger: g
|
|
4965
|
-
};
|
|
4966
|
-
const f = {
|
|
4967
|
-
setConfig: t$1.setConfig,
|
|
4968
|
-
recommendations: R,
|
|
4969
|
-
profiles: s
|
|
4970
|
-
};
|
|
4971
|
-
let environment;
|
|
4972
|
-
let appName;
|
|
4973
|
-
const origin = window.location.origin;
|
|
4974
|
-
const coreAPIConfig = {
|
|
4975
|
-
sandbox: {
|
|
4976
|
-
baseUrl: "https://datalake-api-dev.reservamossaas.com/api",
|
|
4977
|
-
defaultHeaders: {
|
|
4978
|
-
Origin: origin,
|
|
4979
|
-
Authorization: "Bearer 753bf0710dc920a84236d42241d4f487"
|
|
4980
|
-
}
|
|
4981
|
-
},
|
|
4982
|
-
prod: {
|
|
4983
|
-
baseUrl: "https://data-lake.reservamossaas.com/api",
|
|
4984
|
-
defaultHeaders: {
|
|
4985
|
-
Origin: origin,
|
|
4986
|
-
Authorization: "Bearer 753bf0710dc920a84236d42241d4f487"
|
|
4970
|
+
if (maskTextSelector) {
|
|
4971
|
+
if (checkAncestors) {
|
|
4972
|
+
if (el.closest(maskTextSelector))
|
|
4973
|
+
return true;
|
|
4974
|
+
} else {
|
|
4975
|
+
if (el.matches(maskTextSelector))
|
|
4976
|
+
return true;
|
|
4977
|
+
}
|
|
4987
4978
|
}
|
|
4979
|
+
} catch (e2) {
|
|
4988
4980
|
}
|
|
4989
|
-
|
|
4990
|
-
function setEnvironment(env) {
|
|
4991
|
-
environment = env;
|
|
4992
|
-
}
|
|
4993
|
-
function setAppName(name) {
|
|
4994
|
-
appName = name;
|
|
4995
|
-
}
|
|
4996
|
-
function getCoreAPIConfig() {
|
|
4997
|
-
if (!environment) {
|
|
4998
|
-
throw new Error(
|
|
4999
|
-
"Unable to get core API config, environment not set. Use configService.setEnvironment(environment) to set the environment."
|
|
5000
|
-
);
|
|
5001
|
-
}
|
|
5002
|
-
const config = coreAPIConfig[environment];
|
|
5003
|
-
return {
|
|
5004
|
-
...config,
|
|
5005
|
-
defaultHeaders: {
|
|
5006
|
-
...config.defaultHeaders,
|
|
5007
|
-
...appName ? { "x-app-name": appName } : {}
|
|
5008
|
-
}
|
|
5009
|
-
};
|
|
5010
|
-
}
|
|
5011
|
-
const configService = {
|
|
5012
|
-
setEnvironment,
|
|
5013
|
-
setAppName,
|
|
5014
|
-
getCoreAPIConfig
|
|
5015
|
-
};
|
|
5016
|
-
var NodeType;
|
|
5017
|
-
(function(NodeType2) {
|
|
5018
|
-
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
5019
|
-
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
5020
|
-
NodeType2[NodeType2["Element"] = 2] = "Element";
|
|
5021
|
-
NodeType2[NodeType2["Text"] = 3] = "Text";
|
|
5022
|
-
NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
|
|
5023
|
-
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
5024
|
-
})(NodeType || (NodeType = {}));
|
|
5025
|
-
function isElement(n2) {
|
|
5026
|
-
return n2.nodeType === n2.ELEMENT_NODE;
|
|
5027
|
-
}
|
|
5028
|
-
function isShadowRoot(n2) {
|
|
5029
|
-
const host = n2 === null || n2 === void 0 ? void 0 : n2.host;
|
|
5030
|
-
return Boolean((host === null || host === void 0 ? void 0 : host.shadowRoot) === n2);
|
|
5031
|
-
}
|
|
5032
|
-
function isNativeShadowDom(shadowRoot) {
|
|
5033
|
-
return Object.prototype.toString.call(shadowRoot) === "[object ShadowRoot]";
|
|
4981
|
+
return false;
|
|
5034
4982
|
}
|
|
5035
|
-
function
|
|
5036
|
-
|
|
5037
|
-
|
|
4983
|
+
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
|
|
4984
|
+
const win2 = iframeEl.contentWindow;
|
|
4985
|
+
if (!win2) {
|
|
4986
|
+
return;
|
|
5038
4987
|
}
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
return
|
|
5045
|
-
const statement = ["@import", `url(${JSON.stringify(rule.href)})`];
|
|
5046
|
-
if (rule.layerName === "") {
|
|
5047
|
-
statement.push(`layer`);
|
|
5048
|
-
} else if (rule.layerName) {
|
|
5049
|
-
statement.push(`layer(${rule.layerName})`);
|
|
4988
|
+
let fired = false;
|
|
4989
|
+
let readyState;
|
|
4990
|
+
try {
|
|
4991
|
+
readyState = win2.document.readyState;
|
|
4992
|
+
} catch (error) {
|
|
4993
|
+
return;
|
|
5050
4994
|
}
|
|
5051
|
-
if (
|
|
5052
|
-
|
|
4995
|
+
if (readyState !== "complete") {
|
|
4996
|
+
const timer = setTimeout(() => {
|
|
4997
|
+
if (!fired) {
|
|
4998
|
+
listener();
|
|
4999
|
+
fired = true;
|
|
5000
|
+
}
|
|
5001
|
+
}, iframeLoadTimeout);
|
|
5002
|
+
iframeEl.addEventListener("load", () => {
|
|
5003
|
+
clearTimeout(timer);
|
|
5004
|
+
fired = true;
|
|
5005
|
+
listener();
|
|
5006
|
+
});
|
|
5007
|
+
return;
|
|
5053
5008
|
}
|
|
5054
|
-
|
|
5055
|
-
|
|
5009
|
+
const blankUrl = "about:blank";
|
|
5010
|
+
if (win2.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {
|
|
5011
|
+
setTimeout(listener, 0);
|
|
5012
|
+
return iframeEl.addEventListener("load", listener);
|
|
5056
5013
|
}
|
|
5057
|
-
|
|
5014
|
+
iframeEl.addEventListener("load", listener);
|
|
5058
5015
|
}
|
|
5059
|
-
function
|
|
5016
|
+
function onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {
|
|
5017
|
+
let fired = false;
|
|
5018
|
+
let styleSheetLoaded;
|
|
5060
5019
|
try {
|
|
5061
|
-
|
|
5062
|
-
return rules ? fixBrowserCompatibilityIssuesInCSS(Array.from(rules, stringifyRule).join("")) : null;
|
|
5020
|
+
styleSheetLoaded = link.sheet;
|
|
5063
5021
|
} catch (error) {
|
|
5064
|
-
return
|
|
5022
|
+
return;
|
|
5065
5023
|
}
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
} catch (error) {
|
|
5024
|
+
if (styleSheetLoaded)
|
|
5025
|
+
return;
|
|
5026
|
+
const timer = setTimeout(() => {
|
|
5027
|
+
if (!fired) {
|
|
5028
|
+
listener();
|
|
5029
|
+
fired = true;
|
|
5073
5030
|
}
|
|
5074
|
-
}
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
const regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
|
|
5081
|
-
return cssStringified.replace(regex, "$1\\$2");
|
|
5082
|
-
}
|
|
5083
|
-
function isCSSImportRule(rule) {
|
|
5084
|
-
return "styleSheet" in rule;
|
|
5085
|
-
}
|
|
5086
|
-
function isCSSStyleRule(rule) {
|
|
5087
|
-
return "selectorText" in rule;
|
|
5031
|
+
}, styleSheetLoadTimeout);
|
|
5032
|
+
link.addEventListener("load", () => {
|
|
5033
|
+
clearTimeout(timer);
|
|
5034
|
+
fired = true;
|
|
5035
|
+
listener();
|
|
5036
|
+
});
|
|
5088
5037
|
}
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
if (maskInputFn) {
|
|
5150
|
-
text = maskInputFn(text, element);
|
|
5151
|
-
} else {
|
|
5152
|
-
text = "*".repeat(text.length);
|
|
5153
|
-
}
|
|
5154
|
-
}
|
|
5155
|
-
return text;
|
|
5156
|
-
}
|
|
5157
|
-
function toLowerCase(str) {
|
|
5158
|
-
return str.toLowerCase();
|
|
5159
|
-
}
|
|
5160
|
-
const ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__";
|
|
5161
|
-
function is2DCanvasBlank(canvas) {
|
|
5162
|
-
const ctx = canvas.getContext("2d");
|
|
5163
|
-
if (!ctx)
|
|
5164
|
-
return true;
|
|
5165
|
-
const chunkSize = 50;
|
|
5166
|
-
for (let x2 = 0; x2 < canvas.width; x2 += chunkSize) {
|
|
5167
|
-
for (let y2 = 0; y2 < canvas.height; y2 += chunkSize) {
|
|
5168
|
-
const getImageData = ctx.getImageData;
|
|
5169
|
-
const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;
|
|
5170
|
-
const pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x2, y2, Math.min(chunkSize, canvas.width - x2), Math.min(chunkSize, canvas.height - y2)).data.buffer);
|
|
5171
|
-
if (pixelBuffer.some((pixel) => pixel !== 0))
|
|
5172
|
-
return false;
|
|
5173
|
-
}
|
|
5038
|
+
function serializeNode(n2, options) {
|
|
5039
|
+
const { doc, mirror: mirror2, blockClass, blockSelector, needsMask, inlineStylesheet, maskInputOptions = {}, maskTextFn, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, newlyAddedElement = false } = options;
|
|
5040
|
+
const rootId = getRootId(doc, mirror2);
|
|
5041
|
+
switch (n2.nodeType) {
|
|
5042
|
+
case n2.DOCUMENT_NODE:
|
|
5043
|
+
if (n2.compatMode !== "CSS1Compat") {
|
|
5044
|
+
return {
|
|
5045
|
+
type: NodeType.Document,
|
|
5046
|
+
childNodes: [],
|
|
5047
|
+
compatMode: n2.compatMode
|
|
5048
|
+
};
|
|
5049
|
+
} else {
|
|
5050
|
+
return {
|
|
5051
|
+
type: NodeType.Document,
|
|
5052
|
+
childNodes: []
|
|
5053
|
+
};
|
|
5054
|
+
}
|
|
5055
|
+
case n2.DOCUMENT_TYPE_NODE:
|
|
5056
|
+
return {
|
|
5057
|
+
type: NodeType.DocumentType,
|
|
5058
|
+
name: n2.name,
|
|
5059
|
+
publicId: n2.publicId,
|
|
5060
|
+
systemId: n2.systemId,
|
|
5061
|
+
rootId
|
|
5062
|
+
};
|
|
5063
|
+
case n2.ELEMENT_NODE:
|
|
5064
|
+
return serializeElementNode(n2, {
|
|
5065
|
+
doc,
|
|
5066
|
+
blockClass,
|
|
5067
|
+
blockSelector,
|
|
5068
|
+
inlineStylesheet,
|
|
5069
|
+
maskInputOptions,
|
|
5070
|
+
maskInputFn,
|
|
5071
|
+
dataURLOptions,
|
|
5072
|
+
inlineImages,
|
|
5073
|
+
recordCanvas,
|
|
5074
|
+
keepIframeSrcFn,
|
|
5075
|
+
newlyAddedElement,
|
|
5076
|
+
rootId
|
|
5077
|
+
});
|
|
5078
|
+
case n2.TEXT_NODE:
|
|
5079
|
+
return serializeTextNode(n2, {
|
|
5080
|
+
needsMask,
|
|
5081
|
+
maskTextFn,
|
|
5082
|
+
rootId
|
|
5083
|
+
});
|
|
5084
|
+
case n2.CDATA_SECTION_NODE:
|
|
5085
|
+
return {
|
|
5086
|
+
type: NodeType.CDATA,
|
|
5087
|
+
textContent: "",
|
|
5088
|
+
rootId
|
|
5089
|
+
};
|
|
5090
|
+
case n2.COMMENT_NODE:
|
|
5091
|
+
return {
|
|
5092
|
+
type: NodeType.Comment,
|
|
5093
|
+
textContent: n2.textContent || "",
|
|
5094
|
+
rootId
|
|
5095
|
+
};
|
|
5096
|
+
default:
|
|
5097
|
+
return false;
|
|
5174
5098
|
}
|
|
5175
|
-
return true;
|
|
5176
5099
|
}
|
|
5177
|
-
function
|
|
5178
|
-
|
|
5179
|
-
|
|
5100
|
+
function getRootId(doc, mirror2) {
|
|
5101
|
+
if (!mirror2.hasNode(doc))
|
|
5102
|
+
return void 0;
|
|
5103
|
+
const docId = mirror2.getId(doc);
|
|
5104
|
+
return docId === 1 ? void 0 : docId;
|
|
5180
5105
|
}
|
|
5181
|
-
function
|
|
5106
|
+
function serializeTextNode(n2, options) {
|
|
5182
5107
|
var _a;
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
}
|
|
5199
|
-
function getValidTagName(element) {
|
|
5200
|
-
if (element instanceof HTMLFormElement) {
|
|
5201
|
-
return "form";
|
|
5108
|
+
const { needsMask, maskTextFn, rootId } = options;
|
|
5109
|
+
const parentTagName = n2.parentNode && n2.parentNode.tagName;
|
|
5110
|
+
let textContent = n2.textContent;
|
|
5111
|
+
const isStyle = parentTagName === "STYLE" ? true : void 0;
|
|
5112
|
+
const isScript = parentTagName === "SCRIPT" ? true : void 0;
|
|
5113
|
+
if (isStyle && textContent) {
|
|
5114
|
+
try {
|
|
5115
|
+
if (n2.nextSibling || n2.previousSibling) {
|
|
5116
|
+
} else if ((_a = n2.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {
|
|
5117
|
+
textContent = stringifyStylesheet(n2.parentNode.sheet);
|
|
5118
|
+
}
|
|
5119
|
+
} catch (err) {
|
|
5120
|
+
console.warn(`Cannot get CSS styles from text's parentNode. Error: ${err}`, n2);
|
|
5121
|
+
}
|
|
5122
|
+
textContent = absoluteToStylesheet(textContent, getHref());
|
|
5202
5123
|
}
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
return "div";
|
|
5124
|
+
if (isScript) {
|
|
5125
|
+
textContent = "SCRIPT_PLACEHOLDER";
|
|
5206
5126
|
}
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
function extractOrigin(url) {
|
|
5210
|
-
let origin2 = "";
|
|
5211
|
-
if (url.indexOf("//") > -1) {
|
|
5212
|
-
origin2 = url.split("/").slice(0, 3).join("/");
|
|
5213
|
-
} else {
|
|
5214
|
-
origin2 = url.split("/")[0];
|
|
5127
|
+
if (!isStyle && !isScript && textContent && needsMask) {
|
|
5128
|
+
textContent = maskTextFn ? maskTextFn(textContent, n2.parentElement) : textContent.replace(/[\S]/g, "*");
|
|
5215
5129
|
}
|
|
5216
|
-
|
|
5217
|
-
|
|
5130
|
+
return {
|
|
5131
|
+
type: NodeType.Text,
|
|
5132
|
+
textContent: textContent || "",
|
|
5133
|
+
isStyle,
|
|
5134
|
+
rootId
|
|
5135
|
+
};
|
|
5218
5136
|
}
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
const
|
|
5222
|
-
const
|
|
5223
|
-
|
|
5224
|
-
const
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
if (!filePath) {
|
|
5230
|
-
return origin2;
|
|
5231
|
-
}
|
|
5232
|
-
if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {
|
|
5233
|
-
return `url(${maybeQuote}${filePath}${maybeQuote})`;
|
|
5234
|
-
}
|
|
5235
|
-
if (DATA_URI.test(filePath)) {
|
|
5236
|
-
return `url(${maybeQuote}${filePath}${maybeQuote})`;
|
|
5137
|
+
function serializeElementNode(n2, options) {
|
|
5138
|
+
const { doc, blockClass, blockSelector, inlineStylesheet, maskInputOptions = {}, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, newlyAddedElement = false, rootId } = options;
|
|
5139
|
+
const needBlock = _isBlockedElement(n2, blockClass, blockSelector);
|
|
5140
|
+
const tagName = getValidTagName(n2);
|
|
5141
|
+
let attributes = {};
|
|
5142
|
+
const len = n2.attributes.length;
|
|
5143
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
5144
|
+
const attr = n2.attributes[i2];
|
|
5145
|
+
if (!ignoreAttribute(tagName, attr.name, attr.value)) {
|
|
5146
|
+
attributes[attr.name] = transformAttribute(doc, tagName, toLowerCase(attr.name), attr.value);
|
|
5237
5147
|
}
|
|
5238
|
-
|
|
5239
|
-
|
|
5148
|
+
}
|
|
5149
|
+
if (tagName === "link" && inlineStylesheet) {
|
|
5150
|
+
const stylesheet = Array.from(doc.styleSheets).find((s2) => {
|
|
5151
|
+
return s2.href === n2.href;
|
|
5152
|
+
});
|
|
5153
|
+
let cssText = null;
|
|
5154
|
+
if (stylesheet) {
|
|
5155
|
+
cssText = stringifyStylesheet(stylesheet);
|
|
5240
5156
|
}
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
if (part === ".") {
|
|
5246
|
-
continue;
|
|
5247
|
-
} else if (part === "..") {
|
|
5248
|
-
stack.pop();
|
|
5249
|
-
} else {
|
|
5250
|
-
stack.push(part);
|
|
5251
|
-
}
|
|
5157
|
+
if (cssText) {
|
|
5158
|
+
delete attributes.rel;
|
|
5159
|
+
delete attributes.href;
|
|
5160
|
+
attributes._cssText = absoluteToStylesheet(cssText, stylesheet.href);
|
|
5252
5161
|
}
|
|
5253
|
-
return `url(${maybeQuote}${stack.join("/")}${maybeQuote})`;
|
|
5254
|
-
});
|
|
5255
|
-
}
|
|
5256
|
-
const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
5257
|
-
const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
5258
|
-
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
5259
|
-
if (attributeValue.trim() === "") {
|
|
5260
|
-
return attributeValue;
|
|
5261
5162
|
}
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
if (match) {
|
|
5267
|
-
chars2 = match[0];
|
|
5268
|
-
pos += chars2.length;
|
|
5269
|
-
return chars2;
|
|
5163
|
+
if (tagName === "style" && n2.sheet && !(n2.innerText || n2.textContent || "").trim().length) {
|
|
5164
|
+
const cssText = stringifyStylesheet(n2.sheet);
|
|
5165
|
+
if (cssText) {
|
|
5166
|
+
attributes._cssText = absoluteToStylesheet(cssText, getHref());
|
|
5270
5167
|
}
|
|
5271
|
-
return "";
|
|
5272
5168
|
}
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
if (
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5169
|
+
if (tagName === "input" || tagName === "textarea" || tagName === "select") {
|
|
5170
|
+
const value = n2.value;
|
|
5171
|
+
const checked = n2.checked;
|
|
5172
|
+
if (attributes.type !== "radio" && attributes.type !== "checkbox" && attributes.type !== "submit" && attributes.type !== "button" && value) {
|
|
5173
|
+
attributes.value = maskInputValue({
|
|
5174
|
+
element: n2,
|
|
5175
|
+
type: getInputType(n2),
|
|
5176
|
+
tagName,
|
|
5177
|
+
value,
|
|
5178
|
+
maskInputOptions,
|
|
5179
|
+
maskInputFn
|
|
5180
|
+
});
|
|
5181
|
+
} else if (checked) {
|
|
5182
|
+
attributes.checked = checked;
|
|
5183
|
+
}
|
|
5184
|
+
}
|
|
5185
|
+
if (tagName === "option") {
|
|
5186
|
+
if (n2.selected && !maskInputOptions["select"]) {
|
|
5187
|
+
attributes.selected = true;
|
|
5283
5188
|
} else {
|
|
5284
|
-
|
|
5285
|
-
url = absoluteToDoc(doc, url);
|
|
5286
|
-
let inParens = false;
|
|
5287
|
-
while (true) {
|
|
5288
|
-
const c2 = attributeValue.charAt(pos);
|
|
5289
|
-
if (c2 === "") {
|
|
5290
|
-
output.push((url + descriptorsStr).trim());
|
|
5291
|
-
break;
|
|
5292
|
-
} else if (!inParens) {
|
|
5293
|
-
if (c2 === ",") {
|
|
5294
|
-
pos += 1;
|
|
5295
|
-
output.push((url + descriptorsStr).trim());
|
|
5296
|
-
break;
|
|
5297
|
-
} else if (c2 === "(") {
|
|
5298
|
-
inParens = true;
|
|
5299
|
-
}
|
|
5300
|
-
} else {
|
|
5301
|
-
if (c2 === ")") {
|
|
5302
|
-
inParens = false;
|
|
5303
|
-
}
|
|
5304
|
-
}
|
|
5305
|
-
descriptorsStr += c2;
|
|
5306
|
-
pos += 1;
|
|
5307
|
-
}
|
|
5189
|
+
delete attributes.selected;
|
|
5308
5190
|
}
|
|
5309
5191
|
}
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5192
|
+
if (tagName === "canvas" && recordCanvas) {
|
|
5193
|
+
if (n2.__context === "2d") {
|
|
5194
|
+
if (!is2DCanvasBlank(n2)) {
|
|
5195
|
+
attributes.rr_dataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
5196
|
+
}
|
|
5197
|
+
} else if (!("__context" in n2)) {
|
|
5198
|
+
const canvasDataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
5199
|
+
const blankCanvas = document.createElement("canvas");
|
|
5200
|
+
blankCanvas.width = n2.width;
|
|
5201
|
+
blankCanvas.height = n2.height;
|
|
5202
|
+
const blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
5203
|
+
if (canvasDataURL !== blankCanvasDataURL) {
|
|
5204
|
+
attributes.rr_dataURL = canvasDataURL;
|
|
5205
|
+
}
|
|
5206
|
+
}
|
|
5315
5207
|
}
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5208
|
+
if (tagName === "img" && inlineImages) {
|
|
5209
|
+
if (!canvasService) {
|
|
5210
|
+
canvasService = doc.createElement("canvas");
|
|
5211
|
+
canvasCtx = canvasService.getContext("2d");
|
|
5212
|
+
}
|
|
5213
|
+
const image = n2;
|
|
5214
|
+
const oldValue = image.crossOrigin;
|
|
5215
|
+
image.crossOrigin = "anonymous";
|
|
5216
|
+
const recordInlineImage = () => {
|
|
5217
|
+
image.removeEventListener("load", recordInlineImage);
|
|
5218
|
+
try {
|
|
5219
|
+
canvasService.width = image.naturalWidth;
|
|
5220
|
+
canvasService.height = image.naturalHeight;
|
|
5221
|
+
canvasCtx.drawImage(image, 0, 0);
|
|
5222
|
+
attributes.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
5223
|
+
} catch (err) {
|
|
5224
|
+
console.warn(`Cannot inline img src=${image.currentSrc}! Error: ${err}`);
|
|
5225
|
+
}
|
|
5226
|
+
oldValue ? attributes.crossOrigin = oldValue : image.removeAttribute("crossorigin");
|
|
5227
|
+
};
|
|
5228
|
+
if (image.complete && image.naturalWidth !== 0)
|
|
5229
|
+
recordInlineImage();
|
|
5230
|
+
else
|
|
5231
|
+
image.addEventListener("load", recordInlineImage);
|
|
5331
5232
|
}
|
|
5332
|
-
if (
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
} else if (name === "style") {
|
|
5341
|
-
return absoluteToStylesheet(value, getHref());
|
|
5342
|
-
} else if (tagName === "object" && name === "data") {
|
|
5343
|
-
return absoluteToDoc(doc, value);
|
|
5233
|
+
if (tagName === "audio" || tagName === "video") {
|
|
5234
|
+
const mediaAttributes = attributes;
|
|
5235
|
+
mediaAttributes.rr_mediaState = n2.paused ? "paused" : "played";
|
|
5236
|
+
mediaAttributes.rr_mediaCurrentTime = n2.currentTime;
|
|
5237
|
+
mediaAttributes.rr_mediaPlaybackRate = n2.playbackRate;
|
|
5238
|
+
mediaAttributes.rr_mediaMuted = n2.muted;
|
|
5239
|
+
mediaAttributes.rr_mediaLoop = n2.loop;
|
|
5240
|
+
mediaAttributes.rr_mediaVolume = n2.volume;
|
|
5344
5241
|
}
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
return (tagName === "video" || tagName === "audio") && name === "autoplay";
|
|
5349
|
-
}
|
|
5350
|
-
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
5351
|
-
try {
|
|
5352
|
-
if (typeof blockClass === "string") {
|
|
5353
|
-
if (element.classList.contains(blockClass)) {
|
|
5354
|
-
return true;
|
|
5355
|
-
}
|
|
5356
|
-
} else {
|
|
5357
|
-
for (let eIndex = element.classList.length; eIndex--; ) {
|
|
5358
|
-
const className = element.classList[eIndex];
|
|
5359
|
-
if (blockClass.test(className)) {
|
|
5360
|
-
return true;
|
|
5361
|
-
}
|
|
5362
|
-
}
|
|
5242
|
+
if (!newlyAddedElement) {
|
|
5243
|
+
if (n2.scrollLeft) {
|
|
5244
|
+
attributes.rr_scrollLeft = n2.scrollLeft;
|
|
5363
5245
|
}
|
|
5364
|
-
if (
|
|
5365
|
-
|
|
5246
|
+
if (n2.scrollTop) {
|
|
5247
|
+
attributes.rr_scrollTop = n2.scrollTop;
|
|
5366
5248
|
}
|
|
5367
|
-
} catch (e2) {
|
|
5368
5249
|
}
|
|
5369
|
-
|
|
5370
|
-
}
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
return false;
|
|
5377
|
-
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
5250
|
+
if (needBlock) {
|
|
5251
|
+
const { width, height } = n2.getBoundingClientRect();
|
|
5252
|
+
attributes = {
|
|
5253
|
+
class: attributes.class,
|
|
5254
|
+
rr_width: `${width}px`,
|
|
5255
|
+
rr_height: `${height}px`
|
|
5256
|
+
};
|
|
5378
5257
|
}
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
return true;
|
|
5258
|
+
if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
|
|
5259
|
+
if (!n2.contentDocument) {
|
|
5260
|
+
attributes.rr_src = attributes.src;
|
|
5383
5261
|
}
|
|
5262
|
+
delete attributes.src;
|
|
5384
5263
|
}
|
|
5385
|
-
|
|
5386
|
-
return false;
|
|
5387
|
-
return classMatchesRegex(node.parentNode, regex, checkAncestors);
|
|
5388
|
-
}
|
|
5389
|
-
function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors) {
|
|
5264
|
+
let isCustomElement;
|
|
5390
5265
|
try {
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5266
|
+
if (customElements.get(tagName))
|
|
5267
|
+
isCustomElement = true;
|
|
5268
|
+
} catch (e2) {
|
|
5269
|
+
}
|
|
5270
|
+
return {
|
|
5271
|
+
type: NodeType.Element,
|
|
5272
|
+
tagName,
|
|
5273
|
+
attributes,
|
|
5274
|
+
childNodes: [],
|
|
5275
|
+
isSVG: isSVGElement(n2) || void 0,
|
|
5276
|
+
needBlock,
|
|
5277
|
+
rootId,
|
|
5278
|
+
isCustom: isCustomElement
|
|
5279
|
+
};
|
|
5280
|
+
}
|
|
5281
|
+
function lowerIfExists(maybeAttr) {
|
|
5282
|
+
if (maybeAttr === void 0 || maybeAttr === null) {
|
|
5283
|
+
return "";
|
|
5284
|
+
} else {
|
|
5285
|
+
return maybeAttr.toLowerCase();
|
|
5286
|
+
}
|
|
5287
|
+
}
|
|
5288
|
+
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
5289
|
+
if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
|
|
5290
|
+
return true;
|
|
5291
|
+
} else if (sn.type === NodeType.Element) {
|
|
5292
|
+
if (slimDOMOptions.script && (sn.tagName === "script" || sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
|
|
5293
|
+
return true;
|
|
5294
|
+
} else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) {
|
|
5295
|
+
return true;
|
|
5296
|
+
} else if (sn.tagName === "meta") {
|
|
5297
|
+
if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
5298
|
+
return true;
|
|
5299
|
+
} else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
|
|
5300
|
+
return true;
|
|
5301
|
+
} else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) {
|
|
5302
|
+
return true;
|
|
5303
|
+
} else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
|
|
5304
|
+
return true;
|
|
5305
|
+
} else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === "author" || lowerIfExists(sn.attributes.name) === "generator" || lowerIfExists(sn.attributes.name) === "framework" || lowerIfExists(sn.attributes.name) === "publisher" || lowerIfExists(sn.attributes.name) === "progid" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
5306
|
+
return true;
|
|
5307
|
+
} else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === "google-site-verification" || lowerIfExists(sn.attributes.name) === "yandex-verification" || lowerIfExists(sn.attributes.name) === "csrf-token" || lowerIfExists(sn.attributes.name) === "p:domain_verify" || lowerIfExists(sn.attributes.name) === "verify-v1" || lowerIfExists(sn.attributes.name) === "verification" || lowerIfExists(sn.attributes.name) === "shopify-checkout-api-token")) {
|
|
5404
5308
|
return true;
|
|
5405
|
-
}
|
|
5406
|
-
if (maskTextSelector) {
|
|
5407
|
-
if (checkAncestors) {
|
|
5408
|
-
if (el.closest(maskTextSelector))
|
|
5409
|
-
return true;
|
|
5410
|
-
} else {
|
|
5411
|
-
if (el.matches(maskTextSelector))
|
|
5412
|
-
return true;
|
|
5413
5309
|
}
|
|
5414
5310
|
}
|
|
5415
|
-
} catch (e2) {
|
|
5416
5311
|
}
|
|
5417
5312
|
return false;
|
|
5418
5313
|
}
|
|
5419
|
-
function
|
|
5420
|
-
const
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
try {
|
|
5427
|
-
readyState = win2.document.readyState;
|
|
5428
|
-
} catch (error) {
|
|
5429
|
-
return;
|
|
5430
|
-
}
|
|
5431
|
-
if (readyState !== "complete") {
|
|
5432
|
-
const timer = setTimeout(() => {
|
|
5433
|
-
if (!fired) {
|
|
5434
|
-
listener();
|
|
5435
|
-
fired = true;
|
|
5436
|
-
}
|
|
5437
|
-
}, iframeLoadTimeout);
|
|
5438
|
-
iframeEl.addEventListener("load", () => {
|
|
5439
|
-
clearTimeout(timer);
|
|
5440
|
-
fired = true;
|
|
5441
|
-
listener();
|
|
5442
|
-
});
|
|
5443
|
-
return;
|
|
5444
|
-
}
|
|
5445
|
-
const blankUrl = "about:blank";
|
|
5446
|
-
if (win2.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {
|
|
5447
|
-
setTimeout(listener, 0);
|
|
5448
|
-
return iframeEl.addEventListener("load", listener);
|
|
5449
|
-
}
|
|
5450
|
-
iframeEl.addEventListener("load", listener);
|
|
5451
|
-
}
|
|
5452
|
-
function onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {
|
|
5453
|
-
let fired = false;
|
|
5454
|
-
let styleSheetLoaded;
|
|
5455
|
-
try {
|
|
5456
|
-
styleSheetLoaded = link.sheet;
|
|
5457
|
-
} catch (error) {
|
|
5458
|
-
return;
|
|
5314
|
+
function serializeNodeWithId(n2, options) {
|
|
5315
|
+
const { doc, mirror: mirror2, blockClass, blockSelector, maskTextClass, maskTextSelector, skipChild = false, inlineStylesheet = true, maskInputOptions = {}, maskTextFn, maskInputFn, slimDOMOptions, dataURLOptions = {}, inlineImages = false, recordCanvas = false, onSerialize, onIframeLoad, iframeLoadTimeout = 5e3, onStylesheetLoad, stylesheetLoadTimeout = 5e3, keepIframeSrcFn = () => false, newlyAddedElement = false } = options;
|
|
5316
|
+
let { needsMask } = options;
|
|
5317
|
+
let { preserveWhiteSpace = true } = options;
|
|
5318
|
+
if (!needsMask && n2.childNodes) {
|
|
5319
|
+
const checkAncestors = needsMask === void 0;
|
|
5320
|
+
needsMask = needMaskingText(n2, maskTextClass, maskTextSelector, checkAncestors);
|
|
5459
5321
|
}
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5322
|
+
const _serializedNode = serializeNode(n2, {
|
|
5323
|
+
doc,
|
|
5324
|
+
mirror: mirror2,
|
|
5325
|
+
blockClass,
|
|
5326
|
+
blockSelector,
|
|
5327
|
+
needsMask,
|
|
5328
|
+
inlineStylesheet,
|
|
5329
|
+
maskInputOptions,
|
|
5330
|
+
maskTextFn,
|
|
5331
|
+
maskInputFn,
|
|
5332
|
+
dataURLOptions,
|
|
5333
|
+
inlineImages,
|
|
5334
|
+
recordCanvas,
|
|
5335
|
+
keepIframeSrcFn,
|
|
5336
|
+
newlyAddedElement
|
|
5472
5337
|
});
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
const rootId = getRootId(doc, mirror2);
|
|
5477
|
-
switch (n2.nodeType) {
|
|
5478
|
-
case n2.DOCUMENT_NODE:
|
|
5479
|
-
if (n2.compatMode !== "CSS1Compat") {
|
|
5480
|
-
return {
|
|
5481
|
-
type: NodeType.Document,
|
|
5482
|
-
childNodes: [],
|
|
5483
|
-
compatMode: n2.compatMode
|
|
5484
|
-
};
|
|
5485
|
-
} else {
|
|
5486
|
-
return {
|
|
5487
|
-
type: NodeType.Document,
|
|
5488
|
-
childNodes: []
|
|
5489
|
-
};
|
|
5490
|
-
}
|
|
5491
|
-
case n2.DOCUMENT_TYPE_NODE:
|
|
5492
|
-
return {
|
|
5493
|
-
type: NodeType.DocumentType,
|
|
5494
|
-
name: n2.name,
|
|
5495
|
-
publicId: n2.publicId,
|
|
5496
|
-
systemId: n2.systemId,
|
|
5497
|
-
rootId
|
|
5498
|
-
};
|
|
5499
|
-
case n2.ELEMENT_NODE:
|
|
5500
|
-
return serializeElementNode(n2, {
|
|
5501
|
-
doc,
|
|
5502
|
-
blockClass,
|
|
5503
|
-
blockSelector,
|
|
5504
|
-
inlineStylesheet,
|
|
5505
|
-
maskInputOptions,
|
|
5506
|
-
maskInputFn,
|
|
5507
|
-
dataURLOptions,
|
|
5508
|
-
inlineImages,
|
|
5509
|
-
recordCanvas,
|
|
5510
|
-
keepIframeSrcFn,
|
|
5511
|
-
newlyAddedElement,
|
|
5512
|
-
rootId
|
|
5513
|
-
});
|
|
5514
|
-
case n2.TEXT_NODE:
|
|
5515
|
-
return serializeTextNode(n2, {
|
|
5516
|
-
needsMask,
|
|
5517
|
-
maskTextFn,
|
|
5518
|
-
rootId
|
|
5519
|
-
});
|
|
5520
|
-
case n2.CDATA_SECTION_NODE:
|
|
5521
|
-
return {
|
|
5522
|
-
type: NodeType.CDATA,
|
|
5523
|
-
textContent: "",
|
|
5524
|
-
rootId
|
|
5525
|
-
};
|
|
5526
|
-
case n2.COMMENT_NODE:
|
|
5527
|
-
return {
|
|
5528
|
-
type: NodeType.Comment,
|
|
5529
|
-
textContent: n2.textContent || "",
|
|
5530
|
-
rootId
|
|
5531
|
-
};
|
|
5532
|
-
default:
|
|
5533
|
-
return false;
|
|
5338
|
+
if (!_serializedNode) {
|
|
5339
|
+
console.warn(n2, "not serialized");
|
|
5340
|
+
return null;
|
|
5534
5341
|
}
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
function serializeTextNode(n2, options) {
|
|
5543
|
-
var _a;
|
|
5544
|
-
const { needsMask, maskTextFn, rootId } = options;
|
|
5545
|
-
const parentTagName = n2.parentNode && n2.parentNode.tagName;
|
|
5546
|
-
let textContent = n2.textContent;
|
|
5547
|
-
const isStyle = parentTagName === "STYLE" ? true : void 0;
|
|
5548
|
-
const isScript = parentTagName === "SCRIPT" ? true : void 0;
|
|
5549
|
-
if (isStyle && textContent) {
|
|
5550
|
-
try {
|
|
5551
|
-
if (n2.nextSibling || n2.previousSibling) {
|
|
5552
|
-
} else if ((_a = n2.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {
|
|
5553
|
-
textContent = stringifyStylesheet(n2.parentNode.sheet);
|
|
5554
|
-
}
|
|
5555
|
-
} catch (err) {
|
|
5556
|
-
console.warn(`Cannot get CSS styles from text's parentNode. Error: ${err}`, n2);
|
|
5557
|
-
}
|
|
5558
|
-
textContent = absoluteToStylesheet(textContent, getHref());
|
|
5342
|
+
let id;
|
|
5343
|
+
if (mirror2.hasNode(n2)) {
|
|
5344
|
+
id = mirror2.getId(n2);
|
|
5345
|
+
} else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
|
|
5346
|
+
id = IGNORED_NODE;
|
|
5347
|
+
} else {
|
|
5348
|
+
id = genId();
|
|
5559
5349
|
}
|
|
5560
|
-
|
|
5561
|
-
|
|
5350
|
+
const serializedNode = Object.assign(_serializedNode, { id });
|
|
5351
|
+
mirror2.add(n2, serializedNode);
|
|
5352
|
+
if (id === IGNORED_NODE) {
|
|
5353
|
+
return null;
|
|
5562
5354
|
}
|
|
5563
|
-
if (
|
|
5564
|
-
|
|
5355
|
+
if (onSerialize) {
|
|
5356
|
+
onSerialize(n2);
|
|
5565
5357
|
}
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
function serializeElementNode(n2, options) {
|
|
5574
|
-
const { doc, blockClass, blockSelector, inlineStylesheet, maskInputOptions = {}, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, newlyAddedElement = false, rootId } = options;
|
|
5575
|
-
const needBlock = _isBlockedElement(n2, blockClass, blockSelector);
|
|
5576
|
-
const tagName = getValidTagName(n2);
|
|
5577
|
-
let attributes = {};
|
|
5578
|
-
const len = n2.attributes.length;
|
|
5579
|
-
for (let i = 0; i < len; i++) {
|
|
5580
|
-
const attr = n2.attributes[i];
|
|
5581
|
-
if (!ignoreAttribute(tagName, attr.name, attr.value)) {
|
|
5582
|
-
attributes[attr.name] = transformAttribute(doc, tagName, toLowerCase(attr.name), attr.value);
|
|
5583
|
-
}
|
|
5358
|
+
let recordChild = !skipChild;
|
|
5359
|
+
if (serializedNode.type === NodeType.Element) {
|
|
5360
|
+
recordChild = recordChild && !serializedNode.needBlock;
|
|
5361
|
+
delete serializedNode.needBlock;
|
|
5362
|
+
const shadowRoot = n2.shadowRoot;
|
|
5363
|
+
if (shadowRoot && isNativeShadowDom(shadowRoot))
|
|
5364
|
+
serializedNode.isShadowHost = true;
|
|
5584
5365
|
}
|
|
5585
|
-
if (
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
});
|
|
5589
|
-
let cssText = null;
|
|
5590
|
-
if (stylesheet) {
|
|
5591
|
-
cssText = stringifyStylesheet(stylesheet);
|
|
5366
|
+
if ((serializedNode.type === NodeType.Document || serializedNode.type === NodeType.Element) && recordChild) {
|
|
5367
|
+
if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType.Element && serializedNode.tagName === "head") {
|
|
5368
|
+
preserveWhiteSpace = false;
|
|
5592
5369
|
}
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5370
|
+
const bypassOptions = {
|
|
5371
|
+
doc,
|
|
5372
|
+
mirror: mirror2,
|
|
5373
|
+
blockClass,
|
|
5374
|
+
blockSelector,
|
|
5375
|
+
needsMask,
|
|
5376
|
+
maskTextClass,
|
|
5377
|
+
maskTextSelector,
|
|
5378
|
+
skipChild,
|
|
5379
|
+
inlineStylesheet,
|
|
5380
|
+
maskInputOptions,
|
|
5381
|
+
maskTextFn,
|
|
5382
|
+
maskInputFn,
|
|
5383
|
+
slimDOMOptions,
|
|
5384
|
+
dataURLOptions,
|
|
5385
|
+
inlineImages,
|
|
5386
|
+
recordCanvas,
|
|
5387
|
+
preserveWhiteSpace,
|
|
5388
|
+
onSerialize,
|
|
5389
|
+
onIframeLoad,
|
|
5390
|
+
iframeLoadTimeout,
|
|
5391
|
+
onStylesheetLoad,
|
|
5392
|
+
stylesheetLoadTimeout,
|
|
5393
|
+
keepIframeSrcFn
|
|
5394
|
+
};
|
|
5395
|
+
if (serializedNode.type === NodeType.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
5396
|
+
else {
|
|
5397
|
+
for (const childN of Array.from(n2.childNodes)) {
|
|
5398
|
+
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
5399
|
+
if (serializedChildNode) {
|
|
5400
|
+
serializedNode.childNodes.push(serializedChildNode);
|
|
5401
|
+
}
|
|
5402
|
+
}
|
|
5597
5403
|
}
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
const value = n2.value;
|
|
5607
|
-
const checked = n2.checked;
|
|
5608
|
-
if (attributes.type !== "radio" && attributes.type !== "checkbox" && attributes.type !== "submit" && attributes.type !== "button" && value) {
|
|
5609
|
-
attributes.value = maskInputValue({
|
|
5610
|
-
element: n2,
|
|
5611
|
-
type: getInputType(n2),
|
|
5612
|
-
tagName,
|
|
5613
|
-
value,
|
|
5614
|
-
maskInputOptions,
|
|
5615
|
-
maskInputFn
|
|
5616
|
-
});
|
|
5617
|
-
} else if (checked) {
|
|
5618
|
-
attributes.checked = checked;
|
|
5619
|
-
}
|
|
5620
|
-
}
|
|
5621
|
-
if (tagName === "option") {
|
|
5622
|
-
if (n2.selected && !maskInputOptions["select"]) {
|
|
5623
|
-
attributes.selected = true;
|
|
5624
|
-
} else {
|
|
5625
|
-
delete attributes.selected;
|
|
5626
|
-
}
|
|
5627
|
-
}
|
|
5628
|
-
if (tagName === "canvas" && recordCanvas) {
|
|
5629
|
-
if (n2.__context === "2d") {
|
|
5630
|
-
if (!is2DCanvasBlank(n2)) {
|
|
5631
|
-
attributes.rr_dataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
5632
|
-
}
|
|
5633
|
-
} else if (!("__context" in n2)) {
|
|
5634
|
-
const canvasDataURL = n2.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
5635
|
-
const blankCanvas = document.createElement("canvas");
|
|
5636
|
-
blankCanvas.width = n2.width;
|
|
5637
|
-
blankCanvas.height = n2.height;
|
|
5638
|
-
const blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
5639
|
-
if (canvasDataURL !== blankCanvasDataURL) {
|
|
5640
|
-
attributes.rr_dataURL = canvasDataURL;
|
|
5641
|
-
}
|
|
5642
|
-
}
|
|
5643
|
-
}
|
|
5644
|
-
if (tagName === "img" && inlineImages) {
|
|
5645
|
-
if (!canvasService) {
|
|
5646
|
-
canvasService = doc.createElement("canvas");
|
|
5647
|
-
canvasCtx = canvasService.getContext("2d");
|
|
5648
|
-
}
|
|
5649
|
-
const image = n2;
|
|
5650
|
-
const oldValue = image.crossOrigin;
|
|
5651
|
-
image.crossOrigin = "anonymous";
|
|
5652
|
-
const recordInlineImage = () => {
|
|
5653
|
-
image.removeEventListener("load", recordInlineImage);
|
|
5654
|
-
try {
|
|
5655
|
-
canvasService.width = image.naturalWidth;
|
|
5656
|
-
canvasService.height = image.naturalHeight;
|
|
5657
|
-
canvasCtx.drawImage(image, 0, 0);
|
|
5658
|
-
attributes.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
5659
|
-
} catch (err) {
|
|
5660
|
-
console.warn(`Cannot inline img src=${image.currentSrc}! Error: ${err}`);
|
|
5661
|
-
}
|
|
5662
|
-
oldValue ? attributes.crossOrigin = oldValue : image.removeAttribute("crossorigin");
|
|
5663
|
-
};
|
|
5664
|
-
if (image.complete && image.naturalWidth !== 0)
|
|
5665
|
-
recordInlineImage();
|
|
5666
|
-
else
|
|
5667
|
-
image.addEventListener("load", recordInlineImage);
|
|
5668
|
-
}
|
|
5669
|
-
if (tagName === "audio" || tagName === "video") {
|
|
5670
|
-
const mediaAttributes = attributes;
|
|
5671
|
-
mediaAttributes.rr_mediaState = n2.paused ? "paused" : "played";
|
|
5672
|
-
mediaAttributes.rr_mediaCurrentTime = n2.currentTime;
|
|
5673
|
-
mediaAttributes.rr_mediaPlaybackRate = n2.playbackRate;
|
|
5674
|
-
mediaAttributes.rr_mediaMuted = n2.muted;
|
|
5675
|
-
mediaAttributes.rr_mediaLoop = n2.loop;
|
|
5676
|
-
mediaAttributes.rr_mediaVolume = n2.volume;
|
|
5677
|
-
}
|
|
5678
|
-
if (!newlyAddedElement) {
|
|
5679
|
-
if (n2.scrollLeft) {
|
|
5680
|
-
attributes.rr_scrollLeft = n2.scrollLeft;
|
|
5681
|
-
}
|
|
5682
|
-
if (n2.scrollTop) {
|
|
5683
|
-
attributes.rr_scrollTop = n2.scrollTop;
|
|
5684
|
-
}
|
|
5685
|
-
}
|
|
5686
|
-
if (needBlock) {
|
|
5687
|
-
const { width, height } = n2.getBoundingClientRect();
|
|
5688
|
-
attributes = {
|
|
5689
|
-
class: attributes.class,
|
|
5690
|
-
rr_width: `${width}px`,
|
|
5691
|
-
rr_height: `${height}px`
|
|
5692
|
-
};
|
|
5693
|
-
}
|
|
5694
|
-
if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
|
|
5695
|
-
if (!n2.contentDocument) {
|
|
5696
|
-
attributes.rr_src = attributes.src;
|
|
5697
|
-
}
|
|
5698
|
-
delete attributes.src;
|
|
5699
|
-
}
|
|
5700
|
-
let isCustomElement;
|
|
5701
|
-
try {
|
|
5702
|
-
if (customElements.get(tagName))
|
|
5703
|
-
isCustomElement = true;
|
|
5704
|
-
} catch (e2) {
|
|
5705
|
-
}
|
|
5706
|
-
return {
|
|
5707
|
-
type: NodeType.Element,
|
|
5708
|
-
tagName,
|
|
5709
|
-
attributes,
|
|
5710
|
-
childNodes: [],
|
|
5711
|
-
isSVG: isSVGElement(n2) || void 0,
|
|
5712
|
-
needBlock,
|
|
5713
|
-
rootId,
|
|
5714
|
-
isCustom: isCustomElement
|
|
5715
|
-
};
|
|
5716
|
-
}
|
|
5717
|
-
function lowerIfExists(maybeAttr) {
|
|
5718
|
-
if (maybeAttr === void 0 || maybeAttr === null) {
|
|
5719
|
-
return "";
|
|
5720
|
-
} else {
|
|
5721
|
-
return maybeAttr.toLowerCase();
|
|
5722
|
-
}
|
|
5723
|
-
}
|
|
5724
|
-
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
5725
|
-
if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
|
|
5726
|
-
return true;
|
|
5727
|
-
} else if (sn.type === NodeType.Element) {
|
|
5728
|
-
if (slimDOMOptions.script && (sn.tagName === "script" || sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
|
|
5729
|
-
return true;
|
|
5730
|
-
} else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) {
|
|
5731
|
-
return true;
|
|
5732
|
-
} else if (sn.tagName === "meta") {
|
|
5733
|
-
if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
5734
|
-
return true;
|
|
5735
|
-
} else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
|
|
5736
|
-
return true;
|
|
5737
|
-
} else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) {
|
|
5738
|
-
return true;
|
|
5739
|
-
} else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
|
|
5740
|
-
return true;
|
|
5741
|
-
} else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === "author" || lowerIfExists(sn.attributes.name) === "generator" || lowerIfExists(sn.attributes.name) === "framework" || lowerIfExists(sn.attributes.name) === "publisher" || lowerIfExists(sn.attributes.name) === "progid" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
5742
|
-
return true;
|
|
5743
|
-
} else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === "google-site-verification" || lowerIfExists(sn.attributes.name) === "yandex-verification" || lowerIfExists(sn.attributes.name) === "csrf-token" || lowerIfExists(sn.attributes.name) === "p:domain_verify" || lowerIfExists(sn.attributes.name) === "verify-v1" || lowerIfExists(sn.attributes.name) === "verification" || lowerIfExists(sn.attributes.name) === "shopify-checkout-api-token")) {
|
|
5744
|
-
return true;
|
|
5745
|
-
}
|
|
5746
|
-
}
|
|
5747
|
-
}
|
|
5748
|
-
return false;
|
|
5749
|
-
}
|
|
5750
|
-
function serializeNodeWithId(n2, options) {
|
|
5751
|
-
const { doc, mirror: mirror2, blockClass, blockSelector, maskTextClass, maskTextSelector, skipChild = false, inlineStylesheet = true, maskInputOptions = {}, maskTextFn, maskInputFn, slimDOMOptions, dataURLOptions = {}, inlineImages = false, recordCanvas = false, onSerialize, onIframeLoad, iframeLoadTimeout = 5e3, onStylesheetLoad, stylesheetLoadTimeout = 5e3, keepIframeSrcFn = () => false, newlyAddedElement = false } = options;
|
|
5752
|
-
let { needsMask } = options;
|
|
5753
|
-
let { preserveWhiteSpace = true } = options;
|
|
5754
|
-
if (!needsMask && n2.childNodes) {
|
|
5755
|
-
const checkAncestors = needsMask === void 0;
|
|
5756
|
-
needsMask = needMaskingText(n2, maskTextClass, maskTextSelector, checkAncestors);
|
|
5757
|
-
}
|
|
5758
|
-
const _serializedNode = serializeNode(n2, {
|
|
5759
|
-
doc,
|
|
5760
|
-
mirror: mirror2,
|
|
5761
|
-
blockClass,
|
|
5762
|
-
blockSelector,
|
|
5763
|
-
needsMask,
|
|
5764
|
-
inlineStylesheet,
|
|
5765
|
-
maskInputOptions,
|
|
5766
|
-
maskTextFn,
|
|
5767
|
-
maskInputFn,
|
|
5768
|
-
dataURLOptions,
|
|
5769
|
-
inlineImages,
|
|
5770
|
-
recordCanvas,
|
|
5771
|
-
keepIframeSrcFn,
|
|
5772
|
-
newlyAddedElement
|
|
5773
|
-
});
|
|
5774
|
-
if (!_serializedNode) {
|
|
5775
|
-
console.warn(n2, "not serialized");
|
|
5776
|
-
return null;
|
|
5777
|
-
}
|
|
5778
|
-
let id;
|
|
5779
|
-
if (mirror2.hasNode(n2)) {
|
|
5780
|
-
id = mirror2.getId(n2);
|
|
5781
|
-
} else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
|
|
5782
|
-
id = IGNORED_NODE;
|
|
5783
|
-
} else {
|
|
5784
|
-
id = genId();
|
|
5785
|
-
}
|
|
5786
|
-
const serializedNode = Object.assign(_serializedNode, { id });
|
|
5787
|
-
mirror2.add(n2, serializedNode);
|
|
5788
|
-
if (id === IGNORED_NODE) {
|
|
5789
|
-
return null;
|
|
5790
|
-
}
|
|
5791
|
-
if (onSerialize) {
|
|
5792
|
-
onSerialize(n2);
|
|
5793
|
-
}
|
|
5794
|
-
let recordChild = !skipChild;
|
|
5795
|
-
if (serializedNode.type === NodeType.Element) {
|
|
5796
|
-
recordChild = recordChild && !serializedNode.needBlock;
|
|
5797
|
-
delete serializedNode.needBlock;
|
|
5798
|
-
const shadowRoot = n2.shadowRoot;
|
|
5799
|
-
if (shadowRoot && isNativeShadowDom(shadowRoot))
|
|
5800
|
-
serializedNode.isShadowHost = true;
|
|
5801
|
-
}
|
|
5802
|
-
if ((serializedNode.type === NodeType.Document || serializedNode.type === NodeType.Element) && recordChild) {
|
|
5803
|
-
if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType.Element && serializedNode.tagName === "head") {
|
|
5804
|
-
preserveWhiteSpace = false;
|
|
5805
|
-
}
|
|
5806
|
-
const bypassOptions = {
|
|
5807
|
-
doc,
|
|
5808
|
-
mirror: mirror2,
|
|
5809
|
-
blockClass,
|
|
5810
|
-
blockSelector,
|
|
5811
|
-
needsMask,
|
|
5812
|
-
maskTextClass,
|
|
5813
|
-
maskTextSelector,
|
|
5814
|
-
skipChild,
|
|
5815
|
-
inlineStylesheet,
|
|
5816
|
-
maskInputOptions,
|
|
5817
|
-
maskTextFn,
|
|
5818
|
-
maskInputFn,
|
|
5819
|
-
slimDOMOptions,
|
|
5820
|
-
dataURLOptions,
|
|
5821
|
-
inlineImages,
|
|
5822
|
-
recordCanvas,
|
|
5823
|
-
preserveWhiteSpace,
|
|
5824
|
-
onSerialize,
|
|
5825
|
-
onIframeLoad,
|
|
5826
|
-
iframeLoadTimeout,
|
|
5827
|
-
onStylesheetLoad,
|
|
5828
|
-
stylesheetLoadTimeout,
|
|
5829
|
-
keepIframeSrcFn
|
|
5830
|
-
};
|
|
5831
|
-
if (serializedNode.type === NodeType.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
5832
|
-
else {
|
|
5833
|
-
for (const childN of Array.from(n2.childNodes)) {
|
|
5834
|
-
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
5835
|
-
if (serializedChildNode) {
|
|
5836
|
-
serializedNode.childNodes.push(serializedChildNode);
|
|
5837
|
-
}
|
|
5838
|
-
}
|
|
5839
|
-
}
|
|
5840
|
-
if (isElement(n2) && n2.shadowRoot) {
|
|
5841
|
-
for (const childN of Array.from(n2.shadowRoot.childNodes)) {
|
|
5842
|
-
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
5843
|
-
if (serializedChildNode) {
|
|
5844
|
-
isNativeShadowDom(n2.shadowRoot) && (serializedChildNode.isShadow = true);
|
|
5845
|
-
serializedNode.childNodes.push(serializedChildNode);
|
|
5846
|
-
}
|
|
5847
|
-
}
|
|
5404
|
+
if (isElement(n2) && n2.shadowRoot) {
|
|
5405
|
+
for (const childN of Array.from(n2.shadowRoot.childNodes)) {
|
|
5406
|
+
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
5407
|
+
if (serializedChildNode) {
|
|
5408
|
+
isNativeShadowDom(n2.shadowRoot) && (serializedChildNode.isShadow = true);
|
|
5409
|
+
serializedNode.childNodes.push(serializedChildNode);
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5848
5412
|
}
|
|
5849
5413
|
}
|
|
5850
5414
|
if (n2.parentNode && isShadowRoot(n2.parentNode) && isNativeShadowDom(n2.parentNode)) {
|
|
@@ -7486,8 +7050,8 @@ function initSelectionObserver(param) {
|
|
|
7486
7050
|
collapsed = selection.isCollapsed || false;
|
|
7487
7051
|
const ranges = [];
|
|
7488
7052
|
const count = selection.rangeCount || 0;
|
|
7489
|
-
for (let
|
|
7490
|
-
const range = selection.getRangeAt(
|
|
7053
|
+
for (let i2 = 0; i2 < count; i2++) {
|
|
7054
|
+
const range = selection.getRangeAt(i2);
|
|
7491
7055
|
const { startContainer, startOffset, endContainer, endOffset } = range;
|
|
7492
7056
|
const blocked = isBlocked(startContainer, blockClass, blockSelector, true) || isBlocked(endContainer, blockClass, blockSelector, true);
|
|
7493
7057
|
if (blocked)
|
|
@@ -8017,9 +7581,9 @@ function __rest(s2, e2) {
|
|
|
8017
7581
|
for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
|
|
8018
7582
|
t2[p2] = s2[p2];
|
|
8019
7583
|
if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
|
|
8020
|
-
for (var
|
|
8021
|
-
if (e2.indexOf(p2[
|
|
8022
|
-
t2[p2[
|
|
7584
|
+
for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
|
|
7585
|
+
if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
|
|
7586
|
+
t2[p2[i2]] = s2[p2[i2]];
|
|
8023
7587
|
}
|
|
8024
7588
|
return t2;
|
|
8025
7589
|
}
|
|
@@ -8052,16 +7616,16 @@ function __awaiter(thisArg, _arguments, P2, generator) {
|
|
|
8052
7616
|
}
|
|
8053
7617
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
8054
7618
|
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
8055
|
-
for (var i = 0; i < chars.length; i++) {
|
|
8056
|
-
lookup[chars.charCodeAt(i)] = i;
|
|
7619
|
+
for (var i$2 = 0; i$2 < chars.length; i$2++) {
|
|
7620
|
+
lookup[chars.charCodeAt(i$2)] = i$2;
|
|
8057
7621
|
}
|
|
8058
7622
|
var encode = function(arraybuffer) {
|
|
8059
|
-
var bytes = new Uint8Array(arraybuffer),
|
|
8060
|
-
for (
|
|
8061
|
-
base64 += chars[bytes[
|
|
8062
|
-
base64 += chars[(bytes[
|
|
8063
|
-
base64 += chars[(bytes[
|
|
8064
|
-
base64 += chars[bytes[
|
|
7623
|
+
var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
|
|
7624
|
+
for (i2 = 0; i2 < len; i2 += 3) {
|
|
7625
|
+
base64 += chars[bytes[i2] >> 2];
|
|
7626
|
+
base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
|
|
7627
|
+
base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
|
|
7628
|
+
base64 += chars[bytes[i2 + 2] & 63];
|
|
8065
7629
|
}
|
|
8066
7630
|
if (len % 3 === 2) {
|
|
8067
7631
|
base64 = base64.substring(0, base64.length - 1) + "=";
|
|
@@ -8316,8 +7880,8 @@ function funcToSource(fn, sourcemapArg) {
|
|
|
8316
7880
|
lines.shift();
|
|
8317
7881
|
var blankPrefixLength = lines[0].search(/\S/);
|
|
8318
7882
|
var regex = /(['"])__worker_loader_strict__(['"])/g;
|
|
8319
|
-
for (var
|
|
8320
|
-
lines[
|
|
7883
|
+
for (var i2 = 0, n2 = lines.length; i2 < n2; ++i2) {
|
|
7884
|
+
lines[i2] = lines[i2].substring(blankPrefixLength).replace(regex, "$1use strict$2") + "\n";
|
|
8321
7885
|
}
|
|
8322
7886
|
return lines;
|
|
8323
7887
|
}
|
|
@@ -8381,16 +7945,16 @@ var WorkerFactory = createInlineWorkerFactory(
|
|
|
8381
7945
|
}
|
|
8382
7946
|
var chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
8383
7947
|
var lookup2 = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
8384
|
-
for (var
|
|
8385
|
-
lookup2[chars2.charCodeAt(
|
|
7948
|
+
for (var i2 = 0; i2 < chars2.length; i2++) {
|
|
7949
|
+
lookup2[chars2.charCodeAt(i2)] = i2;
|
|
8386
7950
|
}
|
|
8387
7951
|
var encode2 = function(arraybuffer) {
|
|
8388
|
-
var bytes = new Uint8Array(arraybuffer),
|
|
8389
|
-
for (
|
|
8390
|
-
base64 += chars2[bytes[
|
|
8391
|
-
base64 += chars2[(bytes[
|
|
8392
|
-
base64 += chars2[(bytes[
|
|
8393
|
-
base64 += chars2[bytes[
|
|
7952
|
+
var bytes = new Uint8Array(arraybuffer), i3, len = bytes.length, base64 = "";
|
|
7953
|
+
for (i3 = 0; i3 < len; i3 += 3) {
|
|
7954
|
+
base64 += chars2[bytes[i3] >> 2];
|
|
7955
|
+
base64 += chars2[(bytes[i3] & 3) << 4 | bytes[i3 + 1] >> 4];
|
|
7956
|
+
base64 += chars2[(bytes[i3 + 1] & 15) << 2 | bytes[i3 + 2] >> 6];
|
|
7957
|
+
base64 += chars2[bytes[i3 + 2] & 63];
|
|
8394
7958
|
}
|
|
8395
7959
|
if (len % 3 === 2) {
|
|
8396
7960
|
base64 = base64.substring(0, base64.length - 1) + "=";
|
|
@@ -9273,8 +8837,8 @@ _.each = function(obj, iterator, context) {
|
|
|
9273
8837
|
if (nativeForEach && obj.forEach === nativeForEach) {
|
|
9274
8838
|
obj.forEach(iterator, context);
|
|
9275
8839
|
} else if (obj.length === +obj.length) {
|
|
9276
|
-
for (var
|
|
9277
|
-
if (
|
|
8840
|
+
for (var i2 = 0, l2 = obj.length; i2 < l2; i2++) {
|
|
8841
|
+
if (i2 in obj && iterator.call(context, obj[i2], i2, obj) === breaker) {
|
|
9278
8842
|
return;
|
|
9279
8843
|
}
|
|
9280
8844
|
}
|
|
@@ -9484,7 +9048,7 @@ _.JSONEncode = /* @__PURE__ */ function() {
|
|
|
9484
9048
|
var str = function(key, holder) {
|
|
9485
9049
|
var gap = "";
|
|
9486
9050
|
var indent = " ";
|
|
9487
|
-
var
|
|
9051
|
+
var i2 = 0;
|
|
9488
9052
|
var k2 = "";
|
|
9489
9053
|
var v2 = "";
|
|
9490
9054
|
var length = 0;
|
|
@@ -9510,8 +9074,8 @@ _.JSONEncode = /* @__PURE__ */ function() {
|
|
|
9510
9074
|
partial = [];
|
|
9511
9075
|
if (toString.apply(value2) === "[object Array]") {
|
|
9512
9076
|
length = value2.length;
|
|
9513
|
-
for (
|
|
9514
|
-
partial[
|
|
9077
|
+
for (i2 = 0; i2 < length; i2 += 1) {
|
|
9078
|
+
partial[i2] = str(i2, value2) || "null";
|
|
9515
9079
|
}
|
|
9516
9080
|
v2 = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
|
|
9517
9081
|
gap = mind;
|
|
@@ -9592,7 +9156,7 @@ _.JSONDecode = function() {
|
|
|
9592
9156
|
return number2;
|
|
9593
9157
|
}
|
|
9594
9158
|
}, string = function() {
|
|
9595
|
-
var hex,
|
|
9159
|
+
var hex, i2, string2 = "", uffff;
|
|
9596
9160
|
if (ch === '"') {
|
|
9597
9161
|
while (next()) {
|
|
9598
9162
|
if (ch === '"') {
|
|
@@ -9603,7 +9167,7 @@ _.JSONDecode = function() {
|
|
|
9603
9167
|
next();
|
|
9604
9168
|
if (ch === "u") {
|
|
9605
9169
|
uffff = 0;
|
|
9606
|
-
for (
|
|
9170
|
+
for (i2 = 0; i2 < 4; i2 += 1) {
|
|
9607
9171
|
hex = parseInt(next(), 16);
|
|
9608
9172
|
if (!isFinite(hex)) {
|
|
9609
9173
|
break;
|
|
@@ -9728,22 +9292,22 @@ _.JSONDecode = function() {
|
|
|
9728
9292
|
}();
|
|
9729
9293
|
_.base64Encode = function(data) {
|
|
9730
9294
|
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
9731
|
-
var o1, o2, o3, h1, h2, h3, h4, bits,
|
|
9295
|
+
var o1, o2, o3, h1, h2, h3, h4, bits, i2 = 0, ac = 0, enc = "", tmp_arr = [];
|
|
9732
9296
|
if (!data) {
|
|
9733
9297
|
return data;
|
|
9734
9298
|
}
|
|
9735
9299
|
data = _.utf8Encode(data);
|
|
9736
9300
|
do {
|
|
9737
|
-
o1 = data.charCodeAt(
|
|
9738
|
-
o2 = data.charCodeAt(
|
|
9739
|
-
o3 = data.charCodeAt(
|
|
9301
|
+
o1 = data.charCodeAt(i2++);
|
|
9302
|
+
o2 = data.charCodeAt(i2++);
|
|
9303
|
+
o3 = data.charCodeAt(i2++);
|
|
9740
9304
|
bits = o1 << 16 | o2 << 8 | o3;
|
|
9741
9305
|
h1 = bits >> 18 & 63;
|
|
9742
9306
|
h2 = bits >> 12 & 63;
|
|
9743
9307
|
h3 = bits >> 6 & 63;
|
|
9744
9308
|
h4 = bits & 63;
|
|
9745
9309
|
tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
|
|
9746
|
-
} while (
|
|
9310
|
+
} while (i2 < data.length);
|
|
9747
9311
|
enc = tmp_arr.join("");
|
|
9748
9312
|
switch (data.length % 3) {
|
|
9749
9313
|
case 1:
|
|
@@ -9802,7 +9366,7 @@ _.UUID = /* @__PURE__ */ function() {
|
|
|
9802
9366
|
return Math.random().toString(16).replace(".", "");
|
|
9803
9367
|
};
|
|
9804
9368
|
var UA = function() {
|
|
9805
|
-
var ua = userAgent,
|
|
9369
|
+
var ua = userAgent, i2, ch, buffer = [], ret = 0;
|
|
9806
9370
|
function xor(result, byte_array) {
|
|
9807
9371
|
var j2, tmp = 0;
|
|
9808
9372
|
for (j2 = 0; j2 < byte_array.length; j2++) {
|
|
@@ -9810,8 +9374,8 @@ _.UUID = /* @__PURE__ */ function() {
|
|
|
9810
9374
|
}
|
|
9811
9375
|
return result ^ tmp;
|
|
9812
9376
|
}
|
|
9813
|
-
for (
|
|
9814
|
-
ch = ua.charCodeAt(
|
|
9377
|
+
for (i2 = 0; i2 < ua.length; i2++) {
|
|
9378
|
+
ch = ua.charCodeAt(i2);
|
|
9815
9379
|
buffer.unshift(ch & 255);
|
|
9816
9380
|
if (buffer.length >= 4) {
|
|
9817
9381
|
ret = xor(ret, buffer);
|
|
@@ -9856,10 +9420,10 @@ var BLOCKED_UA_STRS = [
|
|
|
9856
9420
|
"storebot-google"
|
|
9857
9421
|
];
|
|
9858
9422
|
_.isBlockedUA = function(ua) {
|
|
9859
|
-
var
|
|
9423
|
+
var i2;
|
|
9860
9424
|
ua = ua.toLowerCase();
|
|
9861
|
-
for (
|
|
9862
|
-
if (ua.indexOf(BLOCKED_UA_STRS[
|
|
9425
|
+
for (i2 = 0; i2 < BLOCKED_UA_STRS.length; i2++) {
|
|
9426
|
+
if (ua.indexOf(BLOCKED_UA_STRS[i2]) !== -1) {
|
|
9863
9427
|
return true;
|
|
9864
9428
|
}
|
|
9865
9429
|
}
|
|
@@ -9896,8 +9460,8 @@ _.cookie = {
|
|
|
9896
9460
|
get: function(name) {
|
|
9897
9461
|
var nameEQ = name + "=";
|
|
9898
9462
|
var ca = document$1.cookie.split(";");
|
|
9899
|
-
for (var
|
|
9900
|
-
var c2 = ca[
|
|
9463
|
+
for (var i2 = 0; i2 < ca.length; i2++) {
|
|
9464
|
+
var c2 = ca[i2];
|
|
9901
9465
|
while (c2.charAt(0) == " ") {
|
|
9902
9466
|
c2 = c2.substring(1, c2.length);
|
|
9903
9467
|
}
|
|
@@ -10089,10 +9653,10 @@ _.dom_query = /* @__PURE__ */ function() {
|
|
|
10089
9653
|
return [];
|
|
10090
9654
|
}
|
|
10091
9655
|
var tokens = selector.split(" ");
|
|
10092
|
-
var token, bits, tagName, found, foundCount,
|
|
9656
|
+
var token, bits, tagName, found, foundCount, i2, j2, k2, elements, currentContextIndex;
|
|
10093
9657
|
var currentContext = [document$1];
|
|
10094
|
-
for (
|
|
10095
|
-
token = tokens[
|
|
9658
|
+
for (i2 = 0; i2 < tokens.length; i2++) {
|
|
9659
|
+
token = tokens[i2].replace(/^\s+/, "").replace(/\s+$/, "");
|
|
10096
9660
|
if (token.indexOf("#") > -1) {
|
|
10097
9661
|
bits = token.split("#");
|
|
10098
9662
|
tagName = bits[0];
|
|
@@ -10627,7 +10191,7 @@ SharedLock.prototype.withLock = function(lockedCB, errorCB, pid) {
|
|
|
10627
10191
|
pid = errorCB;
|
|
10628
10192
|
errorCB = null;
|
|
10629
10193
|
}
|
|
10630
|
-
var
|
|
10194
|
+
var i2 = pid || (/* @__PURE__ */ new Date()).getTime() + "|" + Math.random();
|
|
10631
10195
|
var startTime = (/* @__PURE__ */ new Date()).getTime();
|
|
10632
10196
|
var key = this.storageKey;
|
|
10633
10197
|
var pollIntervalMS = this.pollIntervalMS;
|
|
@@ -10641,7 +10205,7 @@ SharedLock.prototype.withLock = function(lockedCB, errorCB, pid) {
|
|
|
10641
10205
|
};
|
|
10642
10206
|
var delay = function(cb) {
|
|
10643
10207
|
if ((/* @__PURE__ */ new Date()).getTime() - startTime > timeoutMS) {
|
|
10644
|
-
logger$3.error("Timeout waiting for mutex on " + key + "; clearing lock. [" +
|
|
10208
|
+
logger$3.error("Timeout waiting for mutex on " + key + "; clearing lock. [" + i2 + "]");
|
|
10645
10209
|
storage.removeItem(keyZ);
|
|
10646
10210
|
storage.removeItem(keyY);
|
|
10647
10211
|
loop();
|
|
@@ -10666,11 +10230,11 @@ SharedLock.prototype.withLock = function(lockedCB, errorCB, pid) {
|
|
|
10666
10230
|
};
|
|
10667
10231
|
var getSetY = function() {
|
|
10668
10232
|
var valY = storage.getItem(keyY);
|
|
10669
|
-
if (valY && valY !==
|
|
10233
|
+
if (valY && valY !== i2) {
|
|
10670
10234
|
return false;
|
|
10671
10235
|
} else {
|
|
10672
|
-
storage.setItem(keyY,
|
|
10673
|
-
if (storage.getItem(keyY) ===
|
|
10236
|
+
storage.setItem(keyY, i2);
|
|
10237
|
+
if (storage.getItem(keyY) === i2) {
|
|
10674
10238
|
return true;
|
|
10675
10239
|
} else {
|
|
10676
10240
|
if (!localStorageSupported(storage, true)) {
|
|
@@ -10681,14 +10245,14 @@ SharedLock.prototype.withLock = function(lockedCB, errorCB, pid) {
|
|
|
10681
10245
|
}
|
|
10682
10246
|
};
|
|
10683
10247
|
var loop = function() {
|
|
10684
|
-
storage.setItem(keyX,
|
|
10248
|
+
storage.setItem(keyX, i2);
|
|
10685
10249
|
waitFor(getSetY, function() {
|
|
10686
|
-
if (storage.getItem(keyX) ===
|
|
10250
|
+
if (storage.getItem(keyX) === i2) {
|
|
10687
10251
|
criticalSection();
|
|
10688
10252
|
return;
|
|
10689
10253
|
}
|
|
10690
10254
|
delay(function() {
|
|
10691
|
-
if (storage.getItem(keyY) !==
|
|
10255
|
+
if (storage.getItem(keyY) !== i2) {
|
|
10692
10256
|
loop();
|
|
10693
10257
|
return;
|
|
10694
10258
|
}
|
|
@@ -10704,10 +10268,10 @@ SharedLock.prototype.withLock = function(lockedCB, errorCB, pid) {
|
|
|
10704
10268
|
lockedCB();
|
|
10705
10269
|
} finally {
|
|
10706
10270
|
storage.removeItem(keyZ);
|
|
10707
|
-
if (storage.getItem(keyY) ===
|
|
10271
|
+
if (storage.getItem(keyY) === i2) {
|
|
10708
10272
|
storage.removeItem(keyY);
|
|
10709
10273
|
}
|
|
10710
|
-
if (storage.getItem(keyX) ===
|
|
10274
|
+
if (storage.getItem(keyX) === i2) {
|
|
10711
10275
|
storage.removeItem(keyX);
|
|
10712
10276
|
}
|
|
10713
10277
|
}
|
|
@@ -10778,8 +10342,8 @@ RequestQueue.prototype.fillBatch = function(batchSize) {
|
|
|
10778
10342
|
_.each(batch, function(item2) {
|
|
10779
10343
|
idsInBatch[item2["id"]] = true;
|
|
10780
10344
|
});
|
|
10781
|
-
for (var
|
|
10782
|
-
var item = storedQueue[
|
|
10345
|
+
for (var i2 = 0; i2 < storedQueue.length; i2++) {
|
|
10346
|
+
var item = storedQueue[i2];
|
|
10783
10347
|
if ((/* @__PURE__ */ new Date()).getTime() > item["flushAfter"] && !idsInBatch[item["id"]]) {
|
|
10784
10348
|
item.orphaned = true;
|
|
10785
10349
|
batch.push(item);
|
|
@@ -10820,8 +10384,8 @@ RequestQueue.prototype.removeItemsByID = function(ids, cb) {
|
|
|
10820
10384
|
succeeded = this.saveToStorage(storedQueue);
|
|
10821
10385
|
if (succeeded) {
|
|
10822
10386
|
storedQueue = this.readFromStorage();
|
|
10823
|
-
for (var
|
|
10824
|
-
var item = storedQueue[
|
|
10387
|
+
for (var i2 = 0; i2 < storedQueue.length; i2++) {
|
|
10388
|
+
var item = storedQueue[i2];
|
|
10825
10389
|
if (item["id"] && !!idSet[item["id"]]) {
|
|
10826
10390
|
this.reportError("Item not removed from storage");
|
|
10827
10391
|
return false;
|
|
@@ -11830,7 +11394,7 @@ MixpanelPeople.prototype._flush = function(_set_callback, _add_callback, _append
|
|
|
11830
11394
|
_append_callback(response, data);
|
|
11831
11395
|
}
|
|
11832
11396
|
};
|
|
11833
|
-
for (var
|
|
11397
|
+
for (var i2 = $append_queue.length - 1; i2 >= 0; i2--) {
|
|
11834
11398
|
$append_queue = this._mixpanel["persistence"].load_queue(APPEND_ACTION);
|
|
11835
11399
|
$append_item = $append_queue.pop();
|
|
11836
11400
|
_this._mixpanel["persistence"].save();
|
|
@@ -13381,104 +12945,728 @@ var add_dom_loaded_handler = function() {
|
|
|
13381
12945
|
}
|
|
13382
12946
|
dom_loaded_handler();
|
|
13383
12947
|
}
|
|
13384
|
-
if (document$1.addEventListener) {
|
|
13385
|
-
if (document$1.readyState === "complete") {
|
|
13386
|
-
dom_loaded_handler();
|
|
13387
|
-
} else {
|
|
13388
|
-
document$1.addEventListener("DOMContentLoaded", dom_loaded_handler, false);
|
|
13389
|
-
}
|
|
13390
|
-
} else if (document$1.attachEvent) {
|
|
13391
|
-
document$1.attachEvent("onreadystatechange", dom_loaded_handler);
|
|
13392
|
-
var toplevel = false;
|
|
13393
|
-
try {
|
|
13394
|
-
toplevel = win.frameElement === null;
|
|
13395
|
-
} catch (e2) {
|
|
13396
|
-
}
|
|
13397
|
-
if (document$1.documentElement.doScroll && toplevel) {
|
|
13398
|
-
do_scroll_check();
|
|
13399
|
-
}
|
|
12948
|
+
if (document$1.addEventListener) {
|
|
12949
|
+
if (document$1.readyState === "complete") {
|
|
12950
|
+
dom_loaded_handler();
|
|
12951
|
+
} else {
|
|
12952
|
+
document$1.addEventListener("DOMContentLoaded", dom_loaded_handler, false);
|
|
12953
|
+
}
|
|
12954
|
+
} else if (document$1.attachEvent) {
|
|
12955
|
+
document$1.attachEvent("onreadystatechange", dom_loaded_handler);
|
|
12956
|
+
var toplevel = false;
|
|
12957
|
+
try {
|
|
12958
|
+
toplevel = win.frameElement === null;
|
|
12959
|
+
} catch (e2) {
|
|
12960
|
+
}
|
|
12961
|
+
if (document$1.documentElement.doScroll && toplevel) {
|
|
12962
|
+
do_scroll_check();
|
|
12963
|
+
}
|
|
12964
|
+
}
|
|
12965
|
+
_.register_event(win, "load", dom_loaded_handler, true);
|
|
12966
|
+
};
|
|
12967
|
+
function init_as_module(bundle_loader) {
|
|
12968
|
+
load_extra_bundle = bundle_loader;
|
|
12969
|
+
init_type = INIT_MODULE;
|
|
12970
|
+
mixpanel_master = new MixpanelLib();
|
|
12971
|
+
override_mp_init_func();
|
|
12972
|
+
mixpanel_master["init"]();
|
|
12973
|
+
add_dom_loaded_handler();
|
|
12974
|
+
return mixpanel_master;
|
|
12975
|
+
}
|
|
12976
|
+
function loadNoop(_src, onload) {
|
|
12977
|
+
onload();
|
|
12978
|
+
}
|
|
12979
|
+
var mixpanel = init_as_module(loadNoop);
|
|
12980
|
+
function createIdentifyReporter() {
|
|
12981
|
+
const reported = /* @__PURE__ */ new Set();
|
|
12982
|
+
return (stage, reason, httpStatus) => {
|
|
12983
|
+
const key = `${stage}:${reason}`;
|
|
12984
|
+
if (reported.has(key)) return;
|
|
12985
|
+
reported.add(key);
|
|
12986
|
+
const payload = {
|
|
12987
|
+
stage,
|
|
12988
|
+
reason,
|
|
12989
|
+
...httpStatus !== void 0 ? { httpStatus } : {}
|
|
12990
|
+
};
|
|
12991
|
+
try {
|
|
12992
|
+
if (mixpanelService.isReady()) {
|
|
12993
|
+
trackEventError(
|
|
12994
|
+
"Identify",
|
|
12995
|
+
new Error(`Identify ${stage}: ${reason}`),
|
|
12996
|
+
payload
|
|
12997
|
+
);
|
|
12998
|
+
} else {
|
|
12999
|
+
console.error("Identify diagnostic", payload);
|
|
13000
|
+
}
|
|
13001
|
+
} catch {
|
|
13002
|
+
console.error("Identify diagnostic", payload);
|
|
13003
|
+
}
|
|
13004
|
+
};
|
|
13005
|
+
}
|
|
13006
|
+
function waitForIdentifyReady(report) {
|
|
13007
|
+
if (mixpanelService.isReady()) return Promise.resolve(true);
|
|
13008
|
+
return new Promise((resolve) => {
|
|
13009
|
+
let active = true;
|
|
13010
|
+
const finish = (ready) => {
|
|
13011
|
+
if (!active) return;
|
|
13012
|
+
active = false;
|
|
13013
|
+
clearTimeout(timer);
|
|
13014
|
+
window.removeEventListener("Tracker Ready", onReady);
|
|
13015
|
+
if (!ready) report("readiness", "timeout");
|
|
13016
|
+
resolve(ready);
|
|
13017
|
+
};
|
|
13018
|
+
const onReady = () => {
|
|
13019
|
+
if (mixpanelService.isReady()) finish(true);
|
|
13020
|
+
};
|
|
13021
|
+
const timer = setTimeout(() => finish(false), 5e3);
|
|
13022
|
+
window.addEventListener("Tracker Ready", onReady);
|
|
13023
|
+
onReady();
|
|
13024
|
+
});
|
|
13025
|
+
}
|
|
13026
|
+
function waitForIdentifyStage(stage, timeout, run, report) {
|
|
13027
|
+
return new Promise((resolve) => {
|
|
13028
|
+
let active = true;
|
|
13029
|
+
const finish = (value) => {
|
|
13030
|
+
if (!active) return;
|
|
13031
|
+
active = false;
|
|
13032
|
+
clearTimeout(timer);
|
|
13033
|
+
resolve(value);
|
|
13034
|
+
};
|
|
13035
|
+
const timer = setTimeout(() => {
|
|
13036
|
+
report(stage, "timeout");
|
|
13037
|
+
finish();
|
|
13038
|
+
}, timeout);
|
|
13039
|
+
const context = {
|
|
13040
|
+
isActive: () => active,
|
|
13041
|
+
report: (...args) => {
|
|
13042
|
+
if (active) report(...args);
|
|
13043
|
+
}
|
|
13044
|
+
};
|
|
13045
|
+
void Promise.resolve().then(() => run(context)).then(
|
|
13046
|
+
(value) => finish(value),
|
|
13047
|
+
() => {
|
|
13048
|
+
if (active) report(stage, "failed");
|
|
13049
|
+
finish();
|
|
13050
|
+
}
|
|
13051
|
+
);
|
|
13052
|
+
});
|
|
13053
|
+
}
|
|
13054
|
+
function observeIdentifyResult(stage, report, onTimeout) {
|
|
13055
|
+
let active = true;
|
|
13056
|
+
const complete = (reason, httpStatus) => {
|
|
13057
|
+
if (!active) return;
|
|
13058
|
+
active = false;
|
|
13059
|
+
clearTimeout(timer);
|
|
13060
|
+
if (reason) report(stage, reason, httpStatus);
|
|
13061
|
+
};
|
|
13062
|
+
const timer = setTimeout(() => {
|
|
13063
|
+
complete(stage === "people" ? "unobserved" : "timeout");
|
|
13064
|
+
onTimeout == null ? void 0 : onTimeout();
|
|
13065
|
+
}, 5e3);
|
|
13066
|
+
return { complete };
|
|
13067
|
+
}
|
|
13068
|
+
const version = "1.1.7-alpha.1";
|
|
13069
|
+
const MIXPANEL_DISTINCT_ID_CACHE_KEY = "mp_distinct_id";
|
|
13070
|
+
const SDK_SUPER_PROPERTIES = {
|
|
13071
|
+
"Event Source": "sdk",
|
|
13072
|
+
"Reservamos Version": version
|
|
13073
|
+
};
|
|
13074
|
+
function init$2(mixpanelToken, debug = false, proxyUrl) {
|
|
13075
|
+
return new Promise((resolve) => {
|
|
13076
|
+
mixpanel.init(mixpanelToken, {
|
|
13077
|
+
debug,
|
|
13078
|
+
loaded: () => {
|
|
13079
|
+
window.mixpanel = mixpanel;
|
|
13080
|
+
mixpanel.register({ ...SDK_SUPER_PROPERTIES });
|
|
13081
|
+
resolve();
|
|
13082
|
+
},
|
|
13083
|
+
...proxyUrl && { api_host: proxyUrl }
|
|
13084
|
+
});
|
|
13085
|
+
});
|
|
13086
|
+
}
|
|
13087
|
+
function identify$1(userId, properties, report) {
|
|
13088
|
+
mixpanel.identify(userId);
|
|
13089
|
+
try {
|
|
13090
|
+
updateCachedDistinctId(userId);
|
|
13091
|
+
} catch {
|
|
13092
|
+
report == null ? void 0 : report("cache", "unavailable");
|
|
13093
|
+
}
|
|
13094
|
+
if (!report) {
|
|
13095
|
+
mixpanel.people.set(properties);
|
|
13096
|
+
return;
|
|
13097
|
+
}
|
|
13098
|
+
const observer = observeIdentifyResult("people", report);
|
|
13099
|
+
try {
|
|
13100
|
+
mixpanel.people.set(properties, (response) => {
|
|
13101
|
+
const status = typeof response === "number" ? response : response == null ? void 0 : response.status;
|
|
13102
|
+
observer.complete(
|
|
13103
|
+
status === 1 ? void 0 : status === 0 ? "failed" : "unconfirmed"
|
|
13104
|
+
);
|
|
13105
|
+
});
|
|
13106
|
+
} catch {
|
|
13107
|
+
observer.complete("failed");
|
|
13108
|
+
}
|
|
13109
|
+
}
|
|
13110
|
+
function attachProperty(key, value) {
|
|
13111
|
+
if (!isReady()) {
|
|
13112
|
+
return;
|
|
13113
|
+
}
|
|
13114
|
+
mixpanel.people.union(key, [value]);
|
|
13115
|
+
}
|
|
13116
|
+
function setPeopleProperties(properties) {
|
|
13117
|
+
if (!isReady()) {
|
|
13118
|
+
return;
|
|
13119
|
+
}
|
|
13120
|
+
mixpanel.people.set(properties);
|
|
13121
|
+
}
|
|
13122
|
+
function isReady() {
|
|
13123
|
+
return window.mixpanel !== void 0;
|
|
13124
|
+
}
|
|
13125
|
+
function track(eventName, properties) {
|
|
13126
|
+
if (!isReady()) {
|
|
13127
|
+
return;
|
|
13128
|
+
}
|
|
13129
|
+
mixpanel.track(eventName, { ...properties, "Reservamos Version": version });
|
|
13130
|
+
}
|
|
13131
|
+
const getMixpanelDistinctId = () => {
|
|
13132
|
+
const cachedId = localStorage.getItem(MIXPANEL_DISTINCT_ID_CACHE_KEY);
|
|
13133
|
+
if (mixpanel && mixpanel.get_distinct_id) {
|
|
13134
|
+
const distinctId = mixpanel.get_distinct_id();
|
|
13135
|
+
updateCachedDistinctId(distinctId);
|
|
13136
|
+
return distinctId;
|
|
13137
|
+
} else if (cachedId) {
|
|
13138
|
+
return cachedId;
|
|
13139
|
+
}
|
|
13140
|
+
return null;
|
|
13141
|
+
};
|
|
13142
|
+
function updateCachedDistinctId(distinctId) {
|
|
13143
|
+
localStorage.setItem(MIXPANEL_DISTINCT_ID_CACHE_KEY, distinctId);
|
|
13144
|
+
}
|
|
13145
|
+
const mixpanelService = {
|
|
13146
|
+
init: init$2,
|
|
13147
|
+
isReady,
|
|
13148
|
+
track,
|
|
13149
|
+
identify: identify$1,
|
|
13150
|
+
attachProperty,
|
|
13151
|
+
setPeopleProperties,
|
|
13152
|
+
getMixpanelDistinctId
|
|
13153
|
+
};
|
|
13154
|
+
const DEFAULT_CACHE_NAME = "default_fingerprint_cache";
|
|
13155
|
+
const DEFAULT_CACHE_TIME_IN_DAYS = 7;
|
|
13156
|
+
const PROXY_QUERY_PARAM = "apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>";
|
|
13157
|
+
let fingerprintAgentReady = false;
|
|
13158
|
+
const getExpirationDate = (cacheTimeInDays) => {
|
|
13159
|
+
const currentDate = /* @__PURE__ */ new Date();
|
|
13160
|
+
const futureDate = new Date(
|
|
13161
|
+
currentDate.getTime() + cacheTimeInDays * 24 * 60 * 60 * 1e3
|
|
13162
|
+
);
|
|
13163
|
+
return futureDate.getTime();
|
|
13164
|
+
};
|
|
13165
|
+
const getCachedFingerprint = () => {
|
|
13166
|
+
return readCachedFingerprint();
|
|
13167
|
+
};
|
|
13168
|
+
function readCachedFingerprint(context) {
|
|
13169
|
+
const { cacheName = DEFAULT_CACHE_NAME } = window.fingerprintConfig;
|
|
13170
|
+
try {
|
|
13171
|
+
const cachedData = JSON.parse(localStorage.getItem(cacheName) || "null");
|
|
13172
|
+
if (cachedData && cachedData.expiresAt > Date.now()) {
|
|
13173
|
+
return cachedData.fingerprint;
|
|
13174
|
+
}
|
|
13175
|
+
localStorage.removeItem(cacheName);
|
|
13176
|
+
return null;
|
|
13177
|
+
} catch {
|
|
13178
|
+
context == null ? void 0 : context.report("cache", "unavailable");
|
|
13179
|
+
return null;
|
|
13180
|
+
}
|
|
13181
|
+
}
|
|
13182
|
+
const setCachedFingerprint = (fingerprint) => {
|
|
13183
|
+
const {
|
|
13184
|
+
cacheName = DEFAULT_CACHE_NAME,
|
|
13185
|
+
cacheTimeInDays = DEFAULT_CACHE_TIME_IN_DAYS
|
|
13186
|
+
} = window.fingerprintConfig;
|
|
13187
|
+
const cacheData = {
|
|
13188
|
+
fingerprint,
|
|
13189
|
+
expiresAt: getExpirationDate(cacheTimeInDays)
|
|
13190
|
+
};
|
|
13191
|
+
localStorage.setItem(cacheName, JSON.stringify(cacheData));
|
|
13192
|
+
};
|
|
13193
|
+
function buildProxyUrl(url) {
|
|
13194
|
+
return `${url}?${PROXY_QUERY_PARAM}`;
|
|
13195
|
+
}
|
|
13196
|
+
async function initFingerprint(apiKey, proxyUrl) {
|
|
13197
|
+
const customEndpointArray = [r$2];
|
|
13198
|
+
const customScriptEndpointArray = [G];
|
|
13199
|
+
if (proxyUrl) {
|
|
13200
|
+
customEndpointArray.unshift(proxyUrl);
|
|
13201
|
+
customScriptEndpointArray.unshift(buildProxyUrl(proxyUrl));
|
|
13202
|
+
}
|
|
13203
|
+
fingerprintAgentReady = false;
|
|
13204
|
+
window.fingerprintConfig = {};
|
|
13205
|
+
const client = new FpjsClient({
|
|
13206
|
+
loadOptions: {
|
|
13207
|
+
apiKey,
|
|
13208
|
+
endpoint: customEndpointArray,
|
|
13209
|
+
scriptUrlPattern: customScriptEndpointArray
|
|
13210
|
+
}
|
|
13211
|
+
});
|
|
13212
|
+
window.fpClient = client;
|
|
13213
|
+
try {
|
|
13214
|
+
await client.init();
|
|
13215
|
+
if (window.fpClient === client) {
|
|
13216
|
+
fingerprintAgentReady = true;
|
|
13217
|
+
}
|
|
13218
|
+
} catch (error) {
|
|
13219
|
+
if (window.fpClient === client) {
|
|
13220
|
+
fingerprintAgentReady = false;
|
|
13221
|
+
}
|
|
13222
|
+
console.error("Error initializing identification service:", error);
|
|
13223
|
+
throw error;
|
|
13224
|
+
}
|
|
13225
|
+
}
|
|
13226
|
+
async function getFingerprint(cacheOnly = false) {
|
|
13227
|
+
return readFingerprint(cacheOnly);
|
|
13228
|
+
}
|
|
13229
|
+
function getFingerprintForIdentify(context) {
|
|
13230
|
+
return readFingerprint(false, context);
|
|
13231
|
+
}
|
|
13232
|
+
async function readFingerprint(cacheOnly, context) {
|
|
13233
|
+
if (!window.fingerprintConfig) {
|
|
13234
|
+
if (cacheOnly) {
|
|
13235
|
+
return "";
|
|
13236
|
+
}
|
|
13237
|
+
throw new Error("Fingerprint configuration is not initialized.");
|
|
13238
|
+
}
|
|
13239
|
+
const cachedFingerprint = readCachedFingerprint(context);
|
|
13240
|
+
if (cachedFingerprint) {
|
|
13241
|
+
return cachedFingerprint;
|
|
13242
|
+
}
|
|
13243
|
+
if (cacheOnly || !isFingerprintReady()) {
|
|
13244
|
+
return "";
|
|
13245
|
+
}
|
|
13246
|
+
const { visitorId } = await requestIdentification(false, context);
|
|
13247
|
+
return visitorId;
|
|
13248
|
+
}
|
|
13249
|
+
async function identifyVisitor(ignoreCache = false) {
|
|
13250
|
+
return requestIdentification(ignoreCache);
|
|
13251
|
+
}
|
|
13252
|
+
async function requestIdentification(ignoreCache, context) {
|
|
13253
|
+
if (!isFingerprintReady()) {
|
|
13254
|
+
throw new Error("Identification service is not initialized.");
|
|
13255
|
+
}
|
|
13256
|
+
try {
|
|
13257
|
+
const result = await window.fpClient.getVisitorData({}, ignoreCache);
|
|
13258
|
+
if (!context || context.isActive()) {
|
|
13259
|
+
try {
|
|
13260
|
+
setCachedFingerprint(result.visitorId);
|
|
13261
|
+
} catch (error) {
|
|
13262
|
+
if (!context) throw error;
|
|
13263
|
+
context.report("cache", "unavailable");
|
|
13264
|
+
}
|
|
13265
|
+
if (typeof result.visitorFound === "boolean") {
|
|
13266
|
+
try {
|
|
13267
|
+
mixpanelService.setPeopleProperties({
|
|
13268
|
+
"Visitor Found": result.visitorFound
|
|
13269
|
+
});
|
|
13270
|
+
} catch (error) {
|
|
13271
|
+
if (context) context.report("fingerprint", "failed");
|
|
13272
|
+
else console.error("Error updating Mixpanel visitor profile:", error);
|
|
13273
|
+
}
|
|
13274
|
+
}
|
|
13275
|
+
}
|
|
13276
|
+
return {
|
|
13277
|
+
visitorId: result.visitorId,
|
|
13278
|
+
requestId: result.requestId,
|
|
13279
|
+
...typeof result.visitorFound === "boolean" ? { visitorFound: result.visitorFound } : {},
|
|
13280
|
+
confidenceScore: result.confidence.score,
|
|
13281
|
+
cacheHit: result.cacheHit
|
|
13282
|
+
};
|
|
13283
|
+
} catch (error) {
|
|
13284
|
+
if (!context) console.error("Error retrieving fingerprint:", error);
|
|
13285
|
+
throw error;
|
|
13286
|
+
}
|
|
13287
|
+
}
|
|
13288
|
+
function isFingerprintReady() {
|
|
13289
|
+
return window.fpClient !== void 0 && fingerprintAgentReady;
|
|
13290
|
+
}
|
|
13291
|
+
const fingerprintService = {
|
|
13292
|
+
initFingerprint,
|
|
13293
|
+
getFingerprint,
|
|
13294
|
+
identifyVisitor,
|
|
13295
|
+
isFingerprintReady,
|
|
13296
|
+
getCachedFingerprint
|
|
13297
|
+
};
|
|
13298
|
+
const r$1 = {
|
|
13299
|
+
sandbox: {
|
|
13300
|
+
search: "https://search.resertravel.com/api",
|
|
13301
|
+
purchase: "https://purchases.resertravel.com/api",
|
|
13302
|
+
core: ""
|
|
13303
|
+
},
|
|
13304
|
+
production: {
|
|
13305
|
+
search: "https://search.reservamos.mx/api",
|
|
13306
|
+
purchase: "https://compras.reservamos.mx/api",
|
|
13307
|
+
core: ""
|
|
13308
|
+
}
|
|
13309
|
+
}, s$2 = "sandbox", a$1 = "v2", t$2 = "v1", n$1 = {
|
|
13310
|
+
env: s$2,
|
|
13311
|
+
headers: {},
|
|
13312
|
+
searchUrl: r$1[s$2].search,
|
|
13313
|
+
purchaseUrl: r$1[s$2].purchase,
|
|
13314
|
+
coreUrl: r$1[s$2].core,
|
|
13315
|
+
version: a$1,
|
|
13316
|
+
coreVersion: t$2,
|
|
13317
|
+
apiKey: void 0,
|
|
13318
|
+
userAuthToken: void 0,
|
|
13319
|
+
withCredentials: false
|
|
13320
|
+
};
|
|
13321
|
+
let c$2 = Object.assign({}, n$1);
|
|
13322
|
+
const o$1 = {
|
|
13323
|
+
// UNAUTHORIZED
|
|
13324
|
+
1: {
|
|
13325
|
+
code: 200,
|
|
13326
|
+
message: "Operación no autorizada"
|
|
13327
|
+
}
|
|
13328
|
+
}, s$1 = {
|
|
13329
|
+
// INCORRECT_PARAMS
|
|
13330
|
+
3: {
|
|
13331
|
+
code: 300,
|
|
13332
|
+
message: "Parámetros incorrectos"
|
|
13333
|
+
},
|
|
13334
|
+
// INCORRECT_DATE
|
|
13335
|
+
7: {
|
|
13336
|
+
code: 301,
|
|
13337
|
+
message: "Fecha inválida"
|
|
13338
|
+
}
|
|
13339
|
+
}, r = {
|
|
13340
|
+
// NONEXISTENT_TRIP
|
|
13341
|
+
10: {
|
|
13342
|
+
code: 400,
|
|
13343
|
+
message: "No existe el viaje"
|
|
13344
|
+
},
|
|
13345
|
+
// journey_key_not_found
|
|
13346
|
+
20: {
|
|
13347
|
+
code: 60,
|
|
13348
|
+
message: "No se encontró el viaje"
|
|
13349
|
+
},
|
|
13350
|
+
// sold_out_fare_code
|
|
13351
|
+
21: {
|
|
13352
|
+
code: 60,
|
|
13353
|
+
message: "Tarifa no disponible"
|
|
13354
|
+
},
|
|
13355
|
+
// unavailable_fare_code
|
|
13356
|
+
22: {
|
|
13357
|
+
code: 60,
|
|
13358
|
+
message: "Tarifa no disponible"
|
|
13359
|
+
}
|
|
13360
|
+
}, n = (e2) => ({
|
|
13361
|
+
// INVALID_DISCOUNT
|
|
13362
|
+
11: {
|
|
13363
|
+
code: 500,
|
|
13364
|
+
message: e2
|
|
13365
|
+
},
|
|
13366
|
+
//EXPIRED_DISCOUNT
|
|
13367
|
+
12: {
|
|
13368
|
+
code: 501,
|
|
13369
|
+
message: e2
|
|
13370
|
+
}
|
|
13371
|
+
}), a = {
|
|
13372
|
+
// unavailable_student
|
|
13373
|
+
23: {
|
|
13374
|
+
code: 60,
|
|
13375
|
+
message: "Estudiante no disponible"
|
|
13376
|
+
},
|
|
13377
|
+
// unavailable_teacher
|
|
13378
|
+
24: {
|
|
13379
|
+
code: 60,
|
|
13380
|
+
message: "Profesor no disponible"
|
|
13381
|
+
},
|
|
13382
|
+
// unavailable_minor
|
|
13383
|
+
25: {
|
|
13384
|
+
code: 60,
|
|
13385
|
+
message: "Menor no disponible"
|
|
13386
|
+
},
|
|
13387
|
+
// unavailable_special
|
|
13388
|
+
26: {
|
|
13389
|
+
code: 60,
|
|
13390
|
+
message: "Capacidades diferentes no disponible"
|
|
13391
|
+
},
|
|
13392
|
+
// unavailable_older
|
|
13393
|
+
27: {
|
|
13394
|
+
code: 60,
|
|
13395
|
+
message: "INSEN no disponible"
|
|
13396
|
+
},
|
|
13397
|
+
// unavailable_general
|
|
13398
|
+
28: {
|
|
13399
|
+
code: 60,
|
|
13400
|
+
message: "General no disponible"
|
|
13401
|
+
},
|
|
13402
|
+
// unavailable_unknown
|
|
13403
|
+
29: {
|
|
13404
|
+
code: 60,
|
|
13405
|
+
message: "Error desconocido"
|
|
13406
|
+
}
|
|
13407
|
+
}, c$1 = (e2) => ({
|
|
13408
|
+
30: {
|
|
13409
|
+
code: 30,
|
|
13410
|
+
message: e2
|
|
13411
|
+
}
|
|
13412
|
+
}), d$1 = {
|
|
13413
|
+
50: {
|
|
13414
|
+
code: 50,
|
|
13415
|
+
message: "Unknow Error"
|
|
13416
|
+
}
|
|
13417
|
+
}, i$1 = (e2) => ({
|
|
13418
|
+
...o$1,
|
|
13419
|
+
...s$1,
|
|
13420
|
+
...r,
|
|
13421
|
+
...n(e2),
|
|
13422
|
+
...a,
|
|
13423
|
+
...d$1,
|
|
13424
|
+
...c$1(e2)
|
|
13425
|
+
});
|
|
13426
|
+
class o extends Error {
|
|
13427
|
+
constructor(r2 = -100, s2 = "Unknown error", t2 = null) {
|
|
13428
|
+
super(s2), this.code = r2, this.details = t2, this.stack = new Error().stack;
|
|
13429
|
+
}
|
|
13430
|
+
}
|
|
13431
|
+
async function w(t2) {
|
|
13432
|
+
const e2 = [404, 422, 500], r2 = await t2.json();
|
|
13433
|
+
if (t2.ok)
|
|
13434
|
+
return r2;
|
|
13435
|
+
if (e2.includes(t2.status))
|
|
13436
|
+
switch (t2.status) {
|
|
13437
|
+
case 404:
|
|
13438
|
+
throw new o(100, "Not found");
|
|
13439
|
+
case 422:
|
|
13440
|
+
return r2;
|
|
13441
|
+
case 500:
|
|
13442
|
+
throw new o(101, "Server error");
|
|
13443
|
+
default:
|
|
13444
|
+
throw new o();
|
|
13445
|
+
}
|
|
13446
|
+
else
|
|
13447
|
+
throw new o(t2.status, r2.message || t2.statusText, r2);
|
|
13448
|
+
}
|
|
13449
|
+
function l$1(t2) {
|
|
13450
|
+
if (t2.errors instanceof Array) {
|
|
13451
|
+
const { code: e2 = -100, message: r2 = "Unknown error" } = t2.errors[0] || {}, n2 = i$1(r2)[e2];
|
|
13452
|
+
throw n2 ? new o(n2.code, n2.message, t2.errors[0]) : new o(e2, r2, t2.errors[0]);
|
|
13453
|
+
} else
|
|
13454
|
+
return t2;
|
|
13455
|
+
}
|
|
13456
|
+
function y(...t2) {
|
|
13457
|
+
const r2 = Object.keys(Object.assign({}, ...t2)).reduce(
|
|
13458
|
+
(n2, o2) => ({
|
|
13459
|
+
...n2,
|
|
13460
|
+
[o2]: t2.map((a2) => o2 in a2 && a2[o2]).filter(Boolean)
|
|
13461
|
+
}),
|
|
13462
|
+
{}
|
|
13463
|
+
);
|
|
13464
|
+
return new Headers(r2);
|
|
13465
|
+
}
|
|
13466
|
+
function c(t2, e2 = {}, r2 = {}, n2) {
|
|
13467
|
+
const {
|
|
13468
|
+
apiKey: o2,
|
|
13469
|
+
withCredentials: a2,
|
|
13470
|
+
userAuthToken: s2,
|
|
13471
|
+
headers: d2
|
|
13472
|
+
} = c$2, u3 = {
|
|
13473
|
+
Accept: "application/json",
|
|
13474
|
+
Authorization: `Token token=${r2.apiKey || o2}`,
|
|
13475
|
+
"Content-Type": "application/json"
|
|
13476
|
+
};
|
|
13477
|
+
return s2 && (u3.Authorization = `Token ${r2.apiKey || o2}, Bearer ${s2}`), e2.headers = y(d2, u3), e2.credentials = a2 ? "include" : "omit", typeof e2.body != "string" && (e2.body = JSON.stringify(e2.body)), fetch(t2, e2).then(w).then(l$1).catch(n2);
|
|
13478
|
+
}
|
|
13479
|
+
function E(t2, e2 = {}, r2) {
|
|
13480
|
+
return c(t2, e2, {}, r2);
|
|
13481
|
+
}
|
|
13482
|
+
let u$1 = class u {
|
|
13483
|
+
constructor({
|
|
13484
|
+
url: e2,
|
|
13485
|
+
watch: i2,
|
|
13486
|
+
expect: h2,
|
|
13487
|
+
maxRetries: t2 = 30,
|
|
13488
|
+
interval: s2 = 2e3,
|
|
13489
|
+
eachCall: c2 = null
|
|
13490
|
+
}) {
|
|
13491
|
+
this.url = e2, this.watch = i2, this.expect = h2 instanceof Array ? h2 : [h2], this.interval = s2, this.maxRetries = t2, this.eachCall = c2 && c2.bind(this), this.aborted = false, this.timers = [], this.execute = this.execute.bind(this), this.executeEachCall = this.executeEachCall.bind(this);
|
|
13492
|
+
}
|
|
13493
|
+
start() {
|
|
13494
|
+
return this.execute(this.maxRetries);
|
|
13495
|
+
}
|
|
13496
|
+
abort() {
|
|
13497
|
+
this.aborted = true;
|
|
13498
|
+
}
|
|
13499
|
+
execute(e2) {
|
|
13500
|
+
const i2 = (t2) => {
|
|
13501
|
+
if (this.expect.includes(t2[this.watch]) || e2 === 1 || this.aborted) {
|
|
13502
|
+
let s2 = t2[this.watch];
|
|
13503
|
+
e2 === 1 ? s2 = "retries_exceeded" : this.aborted && (s2 = "aborted"), this.timers.forEach(clearInterval), this.executeEachCall(s2, t2);
|
|
13504
|
+
} else if (t2[this.watch] === "failed")
|
|
13505
|
+
this.timers.forEach(clearInterval), this.executeEachCall("failed", t2);
|
|
13506
|
+
else {
|
|
13507
|
+
this.executeEachCall("pending", t2);
|
|
13508
|
+
const s2 = window.setTimeout(
|
|
13509
|
+
this.execute,
|
|
13510
|
+
this.interval,
|
|
13511
|
+
e2 - 1
|
|
13512
|
+
);
|
|
13513
|
+
this.timers.push(s2);
|
|
13514
|
+
}
|
|
13515
|
+
}, h2 = (t2) => this.executeEachCall("error", t2);
|
|
13516
|
+
return E(this.url, {}, h2).then(i2);
|
|
13517
|
+
}
|
|
13518
|
+
executeEachCall(e2, i2) {
|
|
13519
|
+
this.eachCall instanceof Function && this.eachCall({ status: e2, payload: i2 }) && this.abort();
|
|
13400
13520
|
}
|
|
13401
|
-
_.register_event(win, "load", dom_loaded_handler, true);
|
|
13402
13521
|
};
|
|
13403
|
-
function
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13522
|
+
function j({
|
|
13523
|
+
apiName: h2,
|
|
13524
|
+
defaultApiVersion: c2
|
|
13525
|
+
}) {
|
|
13526
|
+
let n2, i2 = {
|
|
13527
|
+
"Content-Type": "application/json"
|
|
13528
|
+
}, r2;
|
|
13529
|
+
function f2(e2) {
|
|
13530
|
+
n2 = e2.baseUrl, i2 = {
|
|
13531
|
+
...i2,
|
|
13532
|
+
...e2.defaultHeaders || {}
|
|
13533
|
+
};
|
|
13534
|
+
}
|
|
13535
|
+
function p2(e2) {
|
|
13536
|
+
r2 = e2;
|
|
13537
|
+
}
|
|
13538
|
+
function d2() {
|
|
13539
|
+
if (!n2)
|
|
13540
|
+
throw new Error(`Base URL is not set for ${h2} API.`);
|
|
13541
|
+
}
|
|
13542
|
+
const $ = { body: {} };
|
|
13543
|
+
async function y2(e2, t2 = $) {
|
|
13544
|
+
d2();
|
|
13545
|
+
const { body: s2, headers: o2 = {}, apiVersion: a2 = c2 } = t2, u3 = `${n2}/${a2}/${e2}`, l2 = {
|
|
13546
|
+
...i2,
|
|
13547
|
+
...o2,
|
|
13548
|
+
...r2 ? { Authorization: r2 } : {}
|
|
13549
|
+
};
|
|
13550
|
+
return (await fetch(u3, {
|
|
13551
|
+
method: "POST",
|
|
13552
|
+
body: JSON.stringify(s2),
|
|
13553
|
+
headers: l2
|
|
13554
|
+
})).json();
|
|
13555
|
+
}
|
|
13556
|
+
async function w2(e2, t2 = {}) {
|
|
13557
|
+
d2();
|
|
13558
|
+
const { headers: s2 = {}, apiVersion: o2 = c2 } = t2, a2 = `${n2}/${o2}/${e2}`;
|
|
13559
|
+
return (await fetch(a2, { headers: s2 })).json();
|
|
13560
|
+
}
|
|
13561
|
+
function H2(e2, t2) {
|
|
13562
|
+
const o2 = {
|
|
13563
|
+
url: `${n2}/${c2}/${e2}`,
|
|
13564
|
+
watch: t2.watch,
|
|
13565
|
+
expect: t2.expect,
|
|
13566
|
+
eachCall: t2.onEachResponse
|
|
13567
|
+
};
|
|
13568
|
+
return new u$1(o2);
|
|
13569
|
+
}
|
|
13570
|
+
async function b2(e2, t2 = {}) {
|
|
13571
|
+
d2();
|
|
13572
|
+
const { headers: s2 = {}, apiVersion: o2 = c2 } = t2, a2 = `${n2}/${o2}/${e2}`, u3 = {
|
|
13573
|
+
...i2,
|
|
13574
|
+
...s2,
|
|
13575
|
+
...r2 ? { Authorization: r2 } : {}
|
|
13576
|
+
};
|
|
13577
|
+
return (await fetch(a2, {
|
|
13578
|
+
method: "DELETE",
|
|
13579
|
+
headers: u3
|
|
13580
|
+
})).json();
|
|
13581
|
+
}
|
|
13582
|
+
return {
|
|
13583
|
+
get: w2,
|
|
13584
|
+
post: y2,
|
|
13585
|
+
delete: b2,
|
|
13586
|
+
setAuthorizationHeader: p2,
|
|
13587
|
+
setConfig: f2,
|
|
13588
|
+
poll: H2
|
|
13589
|
+
};
|
|
13411
13590
|
}
|
|
13412
|
-
|
|
13413
|
-
|
|
13591
|
+
const t$1 = j({
|
|
13592
|
+
apiName: "Core",
|
|
13593
|
+
defaultApiVersion: "v1"
|
|
13594
|
+
});
|
|
13595
|
+
async function t(o2) {
|
|
13596
|
+
const { data: e2 } = await t$1.post(
|
|
13597
|
+
"anonymous_profiles/identify",
|
|
13598
|
+
{
|
|
13599
|
+
body: o2
|
|
13600
|
+
}
|
|
13601
|
+
);
|
|
13602
|
+
return e2;
|
|
13414
13603
|
}
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
const MIXPANEL_DISTINCT_ID_CACHE_KEY = "mp_distinct_id";
|
|
13418
|
-
const EVENT_SOURCE_SUPER_PROPERTY = {
|
|
13419
|
-
"Event Source": "sdk"
|
|
13604
|
+
const s = {
|
|
13605
|
+
createAnonymousProfile: t
|
|
13420
13606
|
};
|
|
13421
|
-
function
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13607
|
+
function d({
|
|
13608
|
+
searchId: e2,
|
|
13609
|
+
userIdentifier: t2
|
|
13610
|
+
}) {
|
|
13611
|
+
return t$1.get(
|
|
13612
|
+
`trip_recommendations/${e2}/${t2}`
|
|
13613
|
+
);
|
|
13614
|
+
}
|
|
13615
|
+
function i(e2) {
|
|
13616
|
+
return t$1.post("seat_recommendations", {
|
|
13617
|
+
body: e2
|
|
13432
13618
|
});
|
|
13433
13619
|
}
|
|
13434
|
-
function
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13620
|
+
function p({
|
|
13621
|
+
distinct_id: e2,
|
|
13622
|
+
...t2
|
|
13623
|
+
}) {
|
|
13624
|
+
return t$1.post(`seat_recommendations/${e2}`, {
|
|
13625
|
+
body: t2
|
|
13626
|
+
});
|
|
13438
13627
|
}
|
|
13439
|
-
function
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13628
|
+
function u2(e2, t2) {
|
|
13629
|
+
const { start: o2, onEachResponse: r2 } = t2, c2 = `profiles/${e2}`, a2 = {
|
|
13630
|
+
watch: "state",
|
|
13631
|
+
expect: "finished",
|
|
13632
|
+
onEachResponse: r2
|
|
13633
|
+
}, s2 = t$1.poll(c2, a2);
|
|
13634
|
+
return o2 && s2.start(), s2;
|
|
13444
13635
|
}
|
|
13445
|
-
function
|
|
13446
|
-
|
|
13447
|
-
|
|
13448
|
-
}
|
|
13449
|
-
mixpanel.people.set(properties);
|
|
13636
|
+
async function m(e2) {
|
|
13637
|
+
return t$1.post("profiles", {
|
|
13638
|
+
body: e2
|
|
13639
|
+
});
|
|
13450
13640
|
}
|
|
13451
|
-
function
|
|
13452
|
-
return
|
|
13641
|
+
async function l(e2) {
|
|
13642
|
+
return t$1.post("passengers", {
|
|
13643
|
+
body: e2
|
|
13644
|
+
});
|
|
13453
13645
|
}
|
|
13454
|
-
function
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
mixpanel.track(eventName, { ...properties, "Reservamos Version": version });
|
|
13646
|
+
async function f$1(e2) {
|
|
13647
|
+
return t$1.get(
|
|
13648
|
+
`passengers/${e2}`
|
|
13649
|
+
);
|
|
13459
13650
|
}
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
updateCachedDistinctId(distinctId);
|
|
13465
|
-
return distinctId;
|
|
13466
|
-
} else if (cachedId) {
|
|
13467
|
-
return cachedId;
|
|
13468
|
-
}
|
|
13469
|
-
return null;
|
|
13470
|
-
};
|
|
13471
|
-
function updateCachedDistinctId(distinctId) {
|
|
13472
|
-
localStorage.setItem(MIXPANEL_DISTINCT_ID_CACHE_KEY, distinctId);
|
|
13651
|
+
async function g(e2, t2) {
|
|
13652
|
+
return t$1.delete(
|
|
13653
|
+
`passengers/${e2}/${t2}`
|
|
13654
|
+
);
|
|
13473
13655
|
}
|
|
13474
|
-
const
|
|
13475
|
-
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13656
|
+
const R = {
|
|
13657
|
+
getRecommendedTrips: d,
|
|
13658
|
+
createRecommendedPlaces: m,
|
|
13659
|
+
pollRecommendedPlaces: u2,
|
|
13660
|
+
createRecommendedSeats: i,
|
|
13661
|
+
getRecommendedSeats: p,
|
|
13662
|
+
getFrequentPassengers: f$1,
|
|
13663
|
+
createFrequentPassengers: l,
|
|
13664
|
+
deleteFrequentPassenger: g
|
|
13665
|
+
};
|
|
13666
|
+
const f = {
|
|
13667
|
+
setConfig: t$1.setConfig,
|
|
13668
|
+
recommendations: R,
|
|
13669
|
+
profiles: s
|
|
13482
13670
|
};
|
|
13483
13671
|
const geolocationSelectedSchema = z.object({
|
|
13484
13672
|
"Selected City": z.string().min(1, "Selected city is required"),
|
|
@@ -14152,9 +14340,18 @@ async function trackEvent(eventName, eventProperties, meta = {}) {
|
|
|
14152
14340
|
}
|
|
14153
14341
|
try {
|
|
14154
14342
|
validatorService.parseEventProps(eventName, eventProperties);
|
|
14155
|
-
const
|
|
14156
|
-
|
|
14157
|
-
|
|
14343
|
+
const distinctId = mixpanelService.getMixpanelDistinctId();
|
|
14344
|
+
const botDetectionEnabled = botDetectionRelayService.isEnabledFor(eventName);
|
|
14345
|
+
let fingerprint;
|
|
14346
|
+
let fingerprintRequestId;
|
|
14347
|
+
if (botDetectionEnabled && fingerprintService.isFingerprintReady()) {
|
|
14348
|
+
const identification = await fingerprintService.identifyVisitor(true);
|
|
14349
|
+
fingerprint = identification.visitorId;
|
|
14350
|
+
fingerprintRequestId = identification.requestId;
|
|
14351
|
+
} else {
|
|
14352
|
+
const cacheOnly = !FP_TRIGGER_EVENTS.includes(eventName);
|
|
14353
|
+
fingerprint = await fingerprintService.getFingerprint(cacheOnly);
|
|
14354
|
+
}
|
|
14158
14355
|
const defaultCoordinates = {};
|
|
14159
14356
|
const coordinates = geolocationService.getCoordinates();
|
|
14160
14357
|
const geolocationSource = geolocationService.getGeolocationSource();
|
|
@@ -14178,6 +14375,14 @@ async function trackEvent(eventName, eventProperties, meta = {}) {
|
|
|
14178
14375
|
...meta
|
|
14179
14376
|
};
|
|
14180
14377
|
mixpanelService.track(eventName, properties);
|
|
14378
|
+
if (fingerprintRequestId) {
|
|
14379
|
+
void botDetectionRelayService.relay({
|
|
14380
|
+
requestId: fingerprintRequestId,
|
|
14381
|
+
visitorId: fingerprint,
|
|
14382
|
+
...distinctId && { distinctId },
|
|
14383
|
+
eventName
|
|
14384
|
+
});
|
|
14385
|
+
}
|
|
14181
14386
|
} catch (error) {
|
|
14182
14387
|
console.error(`Error tracking event '${eventName}':`, error);
|
|
14183
14388
|
trackEventError(eventName, error, eventProperties);
|
|
@@ -14266,20 +14471,37 @@ function getAnonymousProfilePayload(values, identifiersProps) {
|
|
|
14266
14471
|
}
|
|
14267
14472
|
async function createAnonymousProfile(payload) {
|
|
14268
14473
|
try {
|
|
14269
|
-
|
|
14270
|
-
const identifiers = [];
|
|
14271
|
-
const userFingerprintId = fingerprintService.getCachedFingerprint();
|
|
14272
|
-
const distinctId = mixpanelService.getMixpanelDistinctId();
|
|
14273
|
-
if (userFingerprintId)
|
|
14274
|
-
identifiers.push({ key: "fingerprint", value: userFingerprintId });
|
|
14275
|
-
if (distinctId) identifiers.push({ key: "distinct_id", value: distinctId });
|
|
14276
|
-
const dataPayload = getAnonymousProfilePayload(payload, identifiers);
|
|
14277
|
-
return await f.profiles.createAnonymousProfile(dataPayload);
|
|
14474
|
+
return await requestAnonymousProfile(payload);
|
|
14278
14475
|
} catch (error) {
|
|
14279
14476
|
console.error("Could not create anonymous profile:", error);
|
|
14280
14477
|
return void 0;
|
|
14281
14478
|
}
|
|
14282
14479
|
}
|
|
14480
|
+
function createAnonymousProfileForIdentify(payload, report) {
|
|
14481
|
+
return requestAnonymousProfile(payload, report);
|
|
14482
|
+
}
|
|
14483
|
+
async function requestAnonymousProfile(payload, report) {
|
|
14484
|
+
validatorService.validateProps(payload, CreateAnonymousProfileSchema);
|
|
14485
|
+
const identifiers = [];
|
|
14486
|
+
const readIdentifier = (read) => {
|
|
14487
|
+
if (!report) return read();
|
|
14488
|
+
try {
|
|
14489
|
+
return read();
|
|
14490
|
+
} catch {
|
|
14491
|
+
report("cache", "unavailable");
|
|
14492
|
+
return null;
|
|
14493
|
+
}
|
|
14494
|
+
};
|
|
14495
|
+
const userFingerprintId = readIdentifier(
|
|
14496
|
+
fingerprintService.getCachedFingerprint
|
|
14497
|
+
);
|
|
14498
|
+
const distinctId = readIdentifier(mixpanelService.getMixpanelDistinctId);
|
|
14499
|
+
if (userFingerprintId)
|
|
14500
|
+
identifiers.push({ key: "fingerprint", value: userFingerprintId });
|
|
14501
|
+
if (distinctId) identifiers.push({ key: "distinct_id", value: distinctId });
|
|
14502
|
+
const dataPayload = getAnonymousProfilePayload(payload, identifiers);
|
|
14503
|
+
return await f.profiles.createAnonymousProfile(dataPayload);
|
|
14504
|
+
}
|
|
14283
14505
|
const KNOWN_PROPERTIES = ["firstName", "lastName", "email", "phone"];
|
|
14284
14506
|
const FINGERPRINT_PROPERTY = "Known Fingerprints";
|
|
14285
14507
|
function mapProperties(properties) {
|
|
@@ -14300,8 +14522,9 @@ function mapProperties(properties) {
|
|
|
14300
14522
|
);
|
|
14301
14523
|
return { ...parsedProperties, ...additionalProperties };
|
|
14302
14524
|
}
|
|
14303
|
-
const identifyWithLocation = async (userId, properties) => {
|
|
14525
|
+
const identifyWithLocation = async (userId, properties, report) => {
|
|
14304
14526
|
var _a, _b, _c;
|
|
14527
|
+
let observer;
|
|
14305
14528
|
try {
|
|
14306
14529
|
const coordinates = geolocationService.getCoordinates();
|
|
14307
14530
|
if (!coordinates) {
|
|
@@ -14316,50 +14539,87 @@ const identifyWithLocation = async (userId, properties) => {
|
|
|
14316
14539
|
delete properties.firstName;
|
|
14317
14540
|
delete properties.lastName;
|
|
14318
14541
|
const coreApiConfig = configService.getCoreAPIConfig();
|
|
14319
|
-
|
|
14320
|
-
|
|
14321
|
-
|
|
14322
|
-
|
|
14323
|
-
|
|
14324
|
-
|
|
14325
|
-
|
|
14326
|
-
}
|
|
14327
|
-
|
|
14328
|
-
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
|
|
14334
|
-
|
|
14335
|
-
|
|
14542
|
+
const controller = new AbortController();
|
|
14543
|
+
observer = observeIdentifyResult(
|
|
14544
|
+
"datalake",
|
|
14545
|
+
report,
|
|
14546
|
+
() => controller.abort()
|
|
14547
|
+
);
|
|
14548
|
+
const response = await fetch(
|
|
14549
|
+
`${coreApiConfig.baseUrl}/v1/datalake/identify`,
|
|
14550
|
+
{
|
|
14551
|
+
method: "POST",
|
|
14552
|
+
signal: controller.signal,
|
|
14553
|
+
headers: {
|
|
14554
|
+
"Content-Type": "application/json",
|
|
14555
|
+
"Authorization": ((_a = coreApiConfig.defaultHeaders) == null ? void 0 : _a.Authorization) || "",
|
|
14556
|
+
"Origin": ((_b = coreApiConfig.defaultHeaders) == null ? void 0 : _b.Origin) || "",
|
|
14557
|
+
...((_c = coreApiConfig.defaultHeaders) == null ? void 0 : _c["x-app-name"]) ? { "x-app-name": coreApiConfig.defaultHeaders["x-app-name"] } : {}
|
|
14558
|
+
},
|
|
14559
|
+
body: JSON.stringify({
|
|
14560
|
+
profile_params: {
|
|
14561
|
+
...properties,
|
|
14562
|
+
distinct_id: userId
|
|
14563
|
+
}
|
|
14564
|
+
})
|
|
14565
|
+
}
|
|
14566
|
+
);
|
|
14567
|
+
observer.complete(
|
|
14568
|
+
response.ok ? void 0 : "http_error",
|
|
14569
|
+
response.ok ? void 0 : response.status
|
|
14570
|
+
);
|
|
14571
|
+
} catch {
|
|
14572
|
+
if (observer) observer.complete("failed");
|
|
14573
|
+
else report("datalake", "failed");
|
|
14336
14574
|
}
|
|
14337
14575
|
};
|
|
14338
14576
|
async function identify(userId, properties = {}) {
|
|
14339
|
-
|
|
14577
|
+
const report = createIdentifyReporter();
|
|
14578
|
+
if (!await waitForIdentifyReady(report)) return;
|
|
14579
|
+
try {
|
|
14340
14580
|
try {
|
|
14341
14581
|
validatorService.parseIdentifyProps(properties);
|
|
14342
14582
|
if (!userId) {
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
}
|
|
14346
|
-
const anonymousProfile = await createAnonymousProfile(properties);
|
|
14347
|
-
if (anonymousProfile) {
|
|
14348
|
-
properties.reservamos_one_id = anonymousProfile.id;
|
|
14583
|
+
report("validation", "invalid_input");
|
|
14584
|
+
return;
|
|
14349
14585
|
}
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14586
|
+
} catch {
|
|
14587
|
+
report("validation", "invalid_input");
|
|
14588
|
+
return;
|
|
14589
|
+
}
|
|
14590
|
+
const anonymousProfile = await waitForIdentifyStage(
|
|
14591
|
+
"profile",
|
|
14592
|
+
3e3,
|
|
14593
|
+
(context) => createAnonymousProfileForIdentify({ ...properties }, context.report),
|
|
14594
|
+
report
|
|
14595
|
+
);
|
|
14596
|
+
if (anonymousProfile) {
|
|
14597
|
+
properties.reservamos_one_id = anonymousProfile.id;
|
|
14598
|
+
}
|
|
14599
|
+
const mappedProps = mapProperties(properties);
|
|
14600
|
+
try {
|
|
14601
|
+
mixpanelService.identify(userId, mappedProps, report);
|
|
14602
|
+
} catch {
|
|
14603
|
+
report("mixpanel", "failed");
|
|
14604
|
+
}
|
|
14605
|
+
const fingerprint = await waitForIdentifyStage(
|
|
14606
|
+
"fingerprint",
|
|
14607
|
+
2e3,
|
|
14608
|
+
getFingerprintForIdentify,
|
|
14609
|
+
report
|
|
14610
|
+
);
|
|
14611
|
+
if (fingerprint) {
|
|
14612
|
+
try {
|
|
14354
14613
|
mixpanelService.attachProperty(FINGERPRINT_PROPERTY, fingerprint);
|
|
14614
|
+
} catch {
|
|
14615
|
+
report("fingerprint", "failed");
|
|
14355
14616
|
}
|
|
14356
|
-
} catch (error) {
|
|
14357
|
-
console.error("Error identifying user", error);
|
|
14358
|
-
trackEventError("Identify", error, { userId, properties });
|
|
14359
|
-
} finally {
|
|
14360
|
-
identifyWithLocation(userId, properties);
|
|
14361
14617
|
}
|
|
14362
|
-
}
|
|
14618
|
+
} catch {
|
|
14619
|
+
report("mixpanel", "failed");
|
|
14620
|
+
} finally {
|
|
14621
|
+
void identifyWithLocation(userId, properties, report);
|
|
14622
|
+
}
|
|
14363
14623
|
}
|
|
14364
14624
|
z.object({
|
|
14365
14625
|
"Operation Id": stringField("Operation Id"),
|