decord/source/48_replacer.js

241 lines
7.2 KiB
JavaScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 48
// Function ID: 49
// Name: replacer
// Dependencies: [38]
// Module 48 (replacer)
let c0 = arg2;
let c1 = arg6;
2026-08-04 21:03:28 +00:00
function replacer(arg0, props) {
2026-07-29 08:29:29 +00:00
if (arr.length) {
arr = tmp;
if (this !== tmp[0]) {
arr = arr.shift();
while (arr.length) {
arr = tmp3;
if (tmp2 === tmp3[0]) {
break;
}
}
}
}
2026-08-04 21:03:28 +00:00
if (typeof props === "string") {
let text = props;
if (props.length > POSITIVE_INFINITY2 + 17) {
text = `${props.substring(0, tmp17)}...(truncated)...`;
2026-07-29 08:29:29 +00:00
}
return text;
} else {
2026-08-04 21:03:28 +00:00
if (typeof props === "object") {
if (null !== props) {
2026-07-29 08:29:29 +00:00
const _Array = Array;
2026-08-04 21:03:28 +00:00
if (Array.isArray(props)) {
2026-07-29 08:29:29 +00:00
if (arr.length >= POSITIVE_INFINITY) {
const _HermesInternal3 = HermesInternal;
2026-08-04 21:03:28 +00:00
let combined = "[ ... array with " + props.length + " values ... ]";
2026-07-29 08:29:29 +00:00
} else {
2026-08-04 21:03:28 +00:00
combined = props;
if (props.length > POSITIVE_INFINITY3) {
const substr = props.slice(0, tmp14);
2026-07-29 08:29:29 +00:00
const _HermesInternal2 = HermesInternal;
2026-08-04 21:03:28 +00:00
const items = ["... extra " + props.length - tmp14 + " values truncated ..."];
2026-07-29 08:29:29 +00:00
combined = substr.concat(items);
}
}
} else {
2026-08-04 21:03:28 +00:00
POSITIVE_INFINITY(POSITIVE_INFINITY2[0])(typeof props === "object", "This was already found earlier");
2026-07-29 08:29:29 +00:00
const _Object = Object;
2026-08-04 21:03:28 +00:00
const keys = Object.keys(props);
2026-07-29 08:29:29 +00:00
if (arr.length >= POSITIVE_INFINITY) {
const _HermesInternal = HermesInternal;
combined = "{ ... object with " + keys.length + " keys ... }";
} else {
2026-08-04 21:03:28 +00:00
combined = props;
2026-07-29 08:29:29 +00:00
if (keys.length > POSITIVE_INFINITY4) {
const obj = {};
const substr1 = keys.slice(0, tmp9);
for (const item10028 of substr1) {
obj[item10028] = arg1[item10028];
continue;
}
obj["...(truncated keys)..."] = keys.length - POSITIVE_INFINITY4;
combined = obj;
}
}
}
arr = arr.unshift(combined);
return combined;
}
}
2026-08-04 21:03:28 +00:00
return props;
2026-07-29 08:29:29 +00:00
}
}
c0 = 10;
c1 = 100;
let c2 = 50;
let c3 = 50;
let closure_4 = [];
2026-08-04 21:03:28 +00:00
arg5.default = function stringifySafe(fn) {
if (undefined === fn) {
2026-07-29 08:29:29 +00:00
return "undefined";
2026-08-04 21:03:28 +00:00
} else if (null === fn) {
2026-07-29 08:29:29 +00:00
return "null";
2026-08-04 21:03:28 +00:00
} else if (typeof fn === "function") {
2026-07-29 08:29:29 +00:00
try {
2026-08-04 21:03:28 +00:00
return fn.toString();
2026-07-29 08:29:29 +00:00
} catch (err) {
return "[function unknown]";
}
} else {
const _Error = Error;
2026-08-04 21:03:28 +00:00
if (fn instanceof Error) {
return fn.name + ": " + fn.message;
2026-07-29 08:29:29 +00:00
} else {
try {
const _JSON = JSON;
2026-08-04 21:03:28 +00:00
const json = JSON.stringify(fn, replacer);
2026-07-29 08:29:29 +00:00
let combined = json;
if (undefined === json) {
const _HermesInternal = HermesInternal;
2026-08-04 21:03:28 +00:00
combined = "[\"" + typeof fn + "\" failed to stringify]";
2026-07-29 08:29:29 +00:00
}
return combined;
} catch (err) {
2026-08-04 21:03:28 +00:00
if (typeof str.toString !== "function") {
2026-07-29 08:29:29 +00:00
return "[\"" + typeof str + "\" failed to stringify]";
} else {
try {
return str.toString();
} catch (err) {
}
}
}
}
}
};
arg5.createStringifySafeWithLimits = function createStringifySafeWithLimits(maxDepth) {
2026-08-04 21:03:28 +00:00
function replacer(arg0, props) {
2026-07-29 08:29:29 +00:00
if (arr.length) {
arr = tmp;
if (this !== tmp[0]) {
arr = arr.shift();
while (arr.length) {
arr = tmp3;
if (tmp2 === tmp3[0]) {
break;
}
}
}
}
2026-08-04 21:03:28 +00:00
if (typeof props === "string") {
let text = props;
if (props.length > POSITIVE_INFINITY2 + 17) {
text = `${props.substring(0, tmp17)}...(truncated)...`;
2026-07-29 08:29:29 +00:00
}
return text;
} else {
2026-08-04 21:03:28 +00:00
if (typeof props === "object") {
if (null !== props) {
2026-07-29 08:29:29 +00:00
const _Array = Array;
2026-08-04 21:03:28 +00:00
if (Array.isArray(props)) {
2026-07-29 08:29:29 +00:00
if (arr.length >= POSITIVE_INFINITY) {
const _HermesInternal3 = HermesInternal;
2026-08-04 21:03:28 +00:00
let combined = "[ ... array with " + props.length + " values ... ]";
2026-07-29 08:29:29 +00:00
} else {
2026-08-04 21:03:28 +00:00
combined = props;
if (props.length > POSITIVE_INFINITY3) {
const substr = props.slice(0, tmp14);
2026-07-29 08:29:29 +00:00
const _HermesInternal2 = HermesInternal;
2026-08-04 21:03:28 +00:00
const items = ["... extra " + props.length - tmp14 + " values truncated ..."];
2026-07-29 08:29:29 +00:00
combined = substr.concat(items);
}
}
} else {
2026-08-04 21:03:28 +00:00
POSITIVE_INFINITY(POSITIVE_INFINITY2[0])(typeof props === "object", "This was already found earlier");
2026-07-29 08:29:29 +00:00
const _Object = Object;
2026-08-04 21:03:28 +00:00
const keys = Object.keys(props);
2026-07-29 08:29:29 +00:00
if (arr.length >= POSITIVE_INFINITY) {
const _HermesInternal = HermesInternal;
combined = "{ ... object with " + keys.length + " keys ... }";
} else {
2026-08-04 21:03:28 +00:00
combined = props;
2026-07-29 08:29:29 +00:00
if (keys.length > POSITIVE_INFINITY4) {
const obj = {};
const substr1 = keys.slice(0, tmp9);
for (const item10028 of substr1) {
obj[item10028] = arg1[item10028];
continue;
}
obj["...(truncated keys)..."] = keys.length - POSITIVE_INFINITY4;
combined = obj;
}
}
}
arr = arr.unshift(combined);
return combined;
}
}
2026-08-04 21:03:28 +00:00
return props;
2026-07-29 08:29:29 +00:00
}
}
let POSITIVE_INFINITY = maxDepth.maxDepth;
if (undefined === POSITIVE_INFINITY) {
const _Number = Number;
POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
}
let POSITIVE_INFINITY2 = maxDepth.maxStringLimit;
if (undefined === POSITIVE_INFINITY2) {
const _Number2 = Number;
POSITIVE_INFINITY2 = Number.POSITIVE_INFINITY;
}
let POSITIVE_INFINITY3 = maxDepth.maxArrayLimit;
if (undefined === POSITIVE_INFINITY3) {
const _Number3 = Number;
POSITIVE_INFINITY3 = Number.POSITIVE_INFINITY;
}
let POSITIVE_INFINITY4 = maxDepth.maxObjectKeysLimit;
if (undefined === POSITIVE_INFINITY4) {
const _Number4 = Number;
POSITIVE_INFINITY4 = Number.POSITIVE_INFINITY;
}
let closure_4 = [];
2026-08-04 21:03:28 +00:00
return function stringifySafe(fn) {
if (undefined === fn) {
2026-07-29 08:29:29 +00:00
return "undefined";
2026-08-04 21:03:28 +00:00
} else if (null === fn) {
2026-07-29 08:29:29 +00:00
return "null";
2026-08-04 21:03:28 +00:00
} else if (typeof fn === "function") {
2026-07-29 08:29:29 +00:00
try {
2026-08-04 21:03:28 +00:00
return fn.toString();
2026-07-29 08:29:29 +00:00
} catch (err) {
return "[function unknown]";
}
} else {
const _Error = Error;
2026-08-04 21:03:28 +00:00
if (fn instanceof Error) {
return fn.name + ": " + fn.message;
2026-07-29 08:29:29 +00:00
} else {
try {
const _JSON = JSON;
2026-08-04 21:03:28 +00:00
const json = JSON.stringify(fn, replacer);
2026-07-29 08:29:29 +00:00
let combined = json;
if (undefined === json) {
const _HermesInternal = HermesInternal;
2026-08-04 21:03:28 +00:00
combined = "[\"" + typeof fn + "\" failed to stringify]";
2026-07-29 08:29:29 +00:00
}
return combined;
} catch (err) {
2026-08-04 21:03:28 +00:00
if (typeof str.toString !== "function") {
2026-07-29 08:29:29 +00:00
return "[\"" + typeof str + "\" failed to stringify]";
} else {
try {
return str.toString();
} catch (err) {
}
}
}
}
}
};
};