@probelabs/probe 0.6.0-rc233 → 0.6.0-rc234
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/bin/binaries/probe-v0.6.0-rc234-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc234-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc234-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc234-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc234-x86_64-unknown-linux-musl.tar.gz +0 -0
- package/build/agent/ProbeAgent.js +15 -1
- package/build/agent/index.js +462 -1005
- package/build/agent/schemaUtils.js +74 -1
- package/build/agent/tasks/taskTool.js +6 -1
- package/cjs/agent/ProbeAgent.cjs +462 -1005
- package/cjs/index.cjs +462 -1005
- package/package.json +2 -2
- package/src/agent/ProbeAgent.js +15 -1
- package/src/agent/schemaUtils.js +74 -1
- package/src/agent/tasks/taskTool.js +6 -1
- package/bin/binaries/probe-v0.6.0-rc233-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc233-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc233-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc233-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc233-x86_64-unknown-linux-musl.tar.gz +0 -0
package/cjs/index.cjs
CHANGED
|
@@ -35678,7 +35678,7 @@ Manage tasks for tracking progress during code exploration and problem-solving.
|
|
|
35678
35678
|
|
|
35679
35679
|
Parameters:
|
|
35680
35680
|
- action: (required) The action to perform: create, update, complete, delete, list
|
|
35681
|
-
- tasks: (optional)
|
|
35681
|
+
- tasks: (optional) Array of task objects for batch operations. Place raw JSON array directly between tags.
|
|
35682
35682
|
- id: (optional) Task ID for single operations (e.g., "task-1")
|
|
35683
35683
|
- title: (optional) Task title for create/update
|
|
35684
35684
|
- description: (optional) Task description for create/update
|
|
@@ -35687,6 +35687,11 @@ Parameters:
|
|
|
35687
35687
|
- dependencies: (optional) JSON array of task IDs that must be completed first
|
|
35688
35688
|
- after: (optional) Task ID to insert the new task after (for ordering). By default, new tasks are appended to the end
|
|
35689
35689
|
|
|
35690
|
+
IMPORTANT - JSON Format:
|
|
35691
|
+
Place raw JSON arrays directly between tags without quotes or escaping:
|
|
35692
|
+
CORRECT: <tasks>[{"title": "Do X"}]</tasks>
|
|
35693
|
+
INCORRECT: <tasks>"[{"title": "Do X"}]"</tasks>
|
|
35694
|
+
|
|
35690
35695
|
Usage Examples:
|
|
35691
35696
|
|
|
35692
35697
|
Creating a single task:
|
|
@@ -81050,9 +81055,11 @@ __export(schemaUtils_exports, {
|
|
|
81050
81055
|
isJsonSchema: () => isJsonSchema,
|
|
81051
81056
|
isJsonSchemaDefinition: () => isJsonSchemaDefinition,
|
|
81052
81057
|
isMermaidSchema: () => isMermaidSchema,
|
|
81058
|
+
isSimpleTextWrapperSchema: () => isSimpleTextWrapperSchema,
|
|
81053
81059
|
processSchemaResponse: () => processSchemaResponse,
|
|
81054
81060
|
replaceMermaidDiagramsInJson: () => replaceMermaidDiagramsInJson,
|
|
81055
81061
|
replaceMermaidDiagramsInMarkdown: () => replaceMermaidDiagramsInMarkdown,
|
|
81062
|
+
tryAutoWrapForSimpleSchema: () => tryAutoWrapForSimpleSchema,
|
|
81056
81063
|
tryMaidAutoFix: () => tryMaidAutoFix,
|
|
81057
81064
|
validateAndFixMermaidResponse: () => validateAndFixMermaidResponse,
|
|
81058
81065
|
validateJsonResponse: () => validateJsonResponse,
|
|
@@ -81570,6 +81577,46 @@ function isJsonSchemaDefinition(jsonString, options = {}) {
|
|
|
81570
81577
|
return false;
|
|
81571
81578
|
}
|
|
81572
81579
|
}
|
|
81580
|
+
function isSimpleTextWrapperSchema(schema) {
|
|
81581
|
+
if (!schema || typeof schema !== "string") {
|
|
81582
|
+
return null;
|
|
81583
|
+
}
|
|
81584
|
+
const trimmed = schema.trim();
|
|
81585
|
+
const simplePatterns = [
|
|
81586
|
+
/^\{\s*["']?(\w+)["']?\s*:\s*["']?string["']?\s*\}$/i,
|
|
81587
|
+
/^\{\s*["']?type["']?\s*:\s*["']?object["']?\s*,\s*["']?properties["']?\s*:\s*\{\s*["']?(\w+)["']?\s*:\s*\{\s*["']?type["']?\s*:\s*["']?string["']?\s*\}\s*\}\s*\}$/i
|
|
81588
|
+
];
|
|
81589
|
+
for (const pattern of simplePatterns) {
|
|
81590
|
+
const match2 = trimmed.match(pattern);
|
|
81591
|
+
if (match2) {
|
|
81592
|
+
return { fieldName: match2[1] };
|
|
81593
|
+
}
|
|
81594
|
+
}
|
|
81595
|
+
return null;
|
|
81596
|
+
}
|
|
81597
|
+
function tryAutoWrapForSimpleSchema(response, schema, options = {}) {
|
|
81598
|
+
const { debug = false } = options;
|
|
81599
|
+
const wrapperInfo = isSimpleTextWrapperSchema(schema);
|
|
81600
|
+
if (!wrapperInfo) {
|
|
81601
|
+
if (debug) {
|
|
81602
|
+
console.log(`[DEBUG] Auto-wrap: Schema is not a simple text wrapper`);
|
|
81603
|
+
}
|
|
81604
|
+
return null;
|
|
81605
|
+
}
|
|
81606
|
+
try {
|
|
81607
|
+
JSON.parse(response);
|
|
81608
|
+
if (debug) {
|
|
81609
|
+
console.log(`[DEBUG] Auto-wrap: Response is already valid JSON, skipping`);
|
|
81610
|
+
}
|
|
81611
|
+
return null;
|
|
81612
|
+
} catch {
|
|
81613
|
+
}
|
|
81614
|
+
const wrapped = JSON.stringify({ [wrapperInfo.fieldName]: response });
|
|
81615
|
+
if (debug) {
|
|
81616
|
+
console.log(`[DEBUG] Auto-wrap: Wrapped plain text in {"${wrapperInfo.fieldName}": ...} (${response.length} chars)`);
|
|
81617
|
+
}
|
|
81618
|
+
return wrapped;
|
|
81619
|
+
}
|
|
81573
81620
|
function createJsonCorrectionPrompt(invalidResponse, schema, errorOrValidation, retryCount = 0) {
|
|
81574
81621
|
let errorMessage;
|
|
81575
81622
|
let enhancedError;
|
|
@@ -81601,7 +81648,7 @@ function createJsonCorrectionPrompt(invalidResponse, schema, errorOrValidation,
|
|
|
81601
81648
|
const currentLevel = strengthLevels[level];
|
|
81602
81649
|
let prompt = `${currentLevel.prefix} Your previous response is not valid JSON and cannot be parsed. Here's what you returned:
|
|
81603
81650
|
|
|
81604
|
-
${invalidResponse
|
|
81651
|
+
${invalidResponse}
|
|
81605
81652
|
|
|
81606
81653
|
Error: ${enhancedError}
|
|
81607
81654
|
|
|
@@ -97271,6 +97318,16 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
97271
97318
|
validation = validateJsonResponse(finalResult);
|
|
97272
97319
|
retryCount = 1;
|
|
97273
97320
|
}
|
|
97321
|
+
if (!validation.isValid) {
|
|
97322
|
+
const autoWrapped = tryAutoWrapForSimpleSchema(finalResult, options.schema, { debug: this.debug });
|
|
97323
|
+
if (autoWrapped) {
|
|
97324
|
+
if (this.debug) {
|
|
97325
|
+
console.log(`[DEBUG] JSON validation: Auto-wrapped plain text for simple schema`);
|
|
97326
|
+
}
|
|
97327
|
+
finalResult = autoWrapped;
|
|
97328
|
+
validation = validateJsonResponse(finalResult, { debug: this.debug });
|
|
97329
|
+
}
|
|
97330
|
+
}
|
|
97274
97331
|
while (!validation.isValid && retryCount < maxRetries) {
|
|
97275
97332
|
if (this.debug) {
|
|
97276
97333
|
console.log(`[DEBUG] JSON validation: attempt_completion validation failed (attempt ${retryCount + 1}/${maxRetries}):`, validation.error);
|
|
@@ -100807,6 +100864,8 @@ var require_utils2 = __commonJS({
|
|
|
100807
100864
|
var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {
|
|
100808
100865
|
}).constructor;
|
|
100809
100866
|
var SandboxGlobal = function SandboxGlobal2(globals) {
|
|
100867
|
+
if (globals === globalThis)
|
|
100868
|
+
return globalThis;
|
|
100810
100869
|
for (const i4 in globals) {
|
|
100811
100870
|
this[i4] = globals[i4];
|
|
100812
100871
|
}
|
|
@@ -100835,9 +100894,7 @@ var require_utils2 = __commonJS({
|
|
|
100835
100894
|
prototypeWhitelist: new Map([...options.prototypeWhitelist].map((a4) => [a4[0].prototype, a4[1]])),
|
|
100836
100895
|
options,
|
|
100837
100896
|
globalScope: new Scope3(null, options.globals, sandboxGlobal),
|
|
100838
|
-
sandboxGlobal
|
|
100839
|
-
ticks: { ticks: 0n, tickLimit: options.executionQuota },
|
|
100840
|
-
sandboxedFunctions: /* @__PURE__ */ new WeakSet()
|
|
100897
|
+
sandboxGlobal
|
|
100841
100898
|
};
|
|
100842
100899
|
context.prototypeWhitelist.set(Object.getPrototypeOf([][Symbol.iterator]()), /* @__PURE__ */ new Set());
|
|
100843
100900
|
return context;
|
|
@@ -100852,15 +100909,9 @@ var require_utils2 = __commonJS({
|
|
|
100852
100909
|
evals.set(AsyncFunction, asyncFunc);
|
|
100853
100910
|
evals.set(GeneratorFunction, func);
|
|
100854
100911
|
evals.set(AsyncGeneratorFunction, asyncFunc);
|
|
100855
|
-
evals.set(eval, evalContext.sandboxedEval(func
|
|
100856
|
-
evals.set(setTimeout, evalContext.sandboxedSetTimeout(func
|
|
100857
|
-
evals.set(setInterval, evalContext.sandboxedSetInterval(func
|
|
100858
|
-
evals.set(clearTimeout, evalContext.sandboxedClearTimeout(execContext));
|
|
100859
|
-
evals.set(clearInterval, evalContext.sandboxedClearInterval(execContext));
|
|
100860
|
-
for (const [key, value] of evals) {
|
|
100861
|
-
sandbox.context.prototypeWhitelist.set(value.prototype, /* @__PURE__ */ new Set());
|
|
100862
|
-
sandbox.context.prototypeWhitelist.set(key.prototype, /* @__PURE__ */ new Set());
|
|
100863
|
-
}
|
|
100912
|
+
evals.set(eval, evalContext.sandboxedEval(func));
|
|
100913
|
+
evals.set(setTimeout, evalContext.sandboxedSetTimeout(func));
|
|
100914
|
+
evals.set(setInterval, evalContext.sandboxedSetInterval(func));
|
|
100864
100915
|
}
|
|
100865
100916
|
return execContext;
|
|
100866
100917
|
}
|
|
@@ -100957,45 +101008,34 @@ var require_utils2 = __commonJS({
|
|
|
100957
101008
|
return ret;
|
|
100958
101009
|
}
|
|
100959
101010
|
var reservedWords2 = /* @__PURE__ */ new Set([
|
|
100960
|
-
"await",
|
|
100961
|
-
"break",
|
|
100962
|
-
"case",
|
|
100963
|
-
"catch",
|
|
100964
|
-
"class",
|
|
100965
|
-
"const",
|
|
100966
|
-
"continue",
|
|
100967
|
-
"debugger",
|
|
100968
|
-
"default",
|
|
100969
|
-
"delete",
|
|
100970
|
-
"do",
|
|
100971
|
-
"else",
|
|
100972
|
-
"enum",
|
|
100973
|
-
"export",
|
|
100974
|
-
"extends",
|
|
100975
|
-
"false",
|
|
100976
|
-
"finally",
|
|
100977
|
-
"for",
|
|
100978
|
-
"function",
|
|
100979
|
-
"if",
|
|
100980
|
-
"implements",
|
|
100981
|
-
"import",
|
|
100982
|
-
"in",
|
|
100983
101011
|
"instanceof",
|
|
100984
|
-
"
|
|
100985
|
-
"new",
|
|
100986
|
-
"null",
|
|
101012
|
+
"typeof",
|
|
100987
101013
|
"return",
|
|
100988
|
-
"super",
|
|
100989
|
-
"switch",
|
|
100990
|
-
"this",
|
|
100991
101014
|
"throw",
|
|
100992
|
-
"true",
|
|
100993
101015
|
"try",
|
|
100994
|
-
"
|
|
101016
|
+
"catch",
|
|
101017
|
+
"if",
|
|
101018
|
+
"finally",
|
|
101019
|
+
"else",
|
|
101020
|
+
"in",
|
|
101021
|
+
"of",
|
|
100995
101022
|
"var",
|
|
100996
|
-
"
|
|
101023
|
+
"let",
|
|
101024
|
+
"const",
|
|
101025
|
+
"for",
|
|
101026
|
+
"delete",
|
|
101027
|
+
"false",
|
|
101028
|
+
"true",
|
|
100997
101029
|
"while",
|
|
100998
|
-
"
|
|
101030
|
+
"do",
|
|
101031
|
+
"break",
|
|
101032
|
+
"continue",
|
|
101033
|
+
"new",
|
|
101034
|
+
"function",
|
|
101035
|
+
"async",
|
|
101036
|
+
"await",
|
|
101037
|
+
"switch",
|
|
101038
|
+
"case"
|
|
100999
101039
|
]);
|
|
101000
101040
|
var Scope3 = class {
|
|
101001
101041
|
constructor(parent, vars = {}, functionThis) {
|
|
@@ -101010,16 +101050,25 @@ var require_utils2 = __commonJS({
|
|
|
101010
101050
|
this.globals = parent === null ? keysOnly(vars) : {};
|
|
101011
101051
|
this.functionThis = functionThis;
|
|
101012
101052
|
}
|
|
101013
|
-
get(key) {
|
|
101014
|
-
const
|
|
101015
|
-
|
|
101016
|
-
|
|
101017
|
-
return new Prop({ this: scope.functionThis }, key, false, false, true);
|
|
101053
|
+
get(key, functionScope = false) {
|
|
101054
|
+
const functionThis = this.functionThis;
|
|
101055
|
+
if (key === "this" && functionThis !== void 0) {
|
|
101056
|
+
return new Prop({ this: functionThis }, key, true, false, true);
|
|
101018
101057
|
}
|
|
101019
|
-
if (
|
|
101020
|
-
|
|
101058
|
+
if (reservedWords2.has(key))
|
|
101059
|
+
throw new SyntaxError("Unexepected token '" + key + "'");
|
|
101060
|
+
if (this.parent === null || !functionScope || functionThis !== void 0) {
|
|
101061
|
+
if (this.globals.hasOwnProperty(key)) {
|
|
101062
|
+
return new Prop(functionThis, key, false, true, true);
|
|
101063
|
+
}
|
|
101064
|
+
if (key in this.allVars && (!(key in {}) || this.allVars.hasOwnProperty(key))) {
|
|
101065
|
+
return new Prop(this.allVars, key, this.const.hasOwnProperty(key), this.globals.hasOwnProperty(key), true);
|
|
101066
|
+
}
|
|
101067
|
+
if (this.parent === null) {
|
|
101068
|
+
return new Prop(void 0, key);
|
|
101069
|
+
}
|
|
101021
101070
|
}
|
|
101022
|
-
return
|
|
101071
|
+
return this.parent.get(key, functionScope);
|
|
101023
101072
|
}
|
|
101024
101073
|
set(key, val) {
|
|
101025
101074
|
if (key === "this")
|
|
@@ -101030,72 +101079,34 @@ var require_utils2 = __commonJS({
|
|
|
101030
101079
|
if (prop.context === void 0) {
|
|
101031
101080
|
throw new ReferenceError(`Variable '${key}' was not declared.`);
|
|
101032
101081
|
}
|
|
101033
|
-
if (prop.context === null) {
|
|
101034
|
-
throw new TypeError(`Cannot set properties of null, (setting '${key}')`);
|
|
101035
|
-
}
|
|
101036
101082
|
if (prop.isConst) {
|
|
101037
101083
|
throw new TypeError(`Cannot assign to const variable '${key}'`);
|
|
101038
101084
|
}
|
|
101039
101085
|
if (prop.isGlobal) {
|
|
101040
101086
|
throw new SandboxError(`Cannot override global variable '${key}'`);
|
|
101041
101087
|
}
|
|
101088
|
+
if (!(prop.context instanceof Object))
|
|
101089
|
+
throw new SandboxError("Scope is not an object");
|
|
101042
101090
|
prop.context[prop.prop] = val;
|
|
101043
101091
|
return prop;
|
|
101044
101092
|
}
|
|
101045
|
-
getWhereValScope(key, isThis) {
|
|
101046
|
-
if (isThis) {
|
|
101047
|
-
if (this.functionThis !== void 0) {
|
|
101048
|
-
return this;
|
|
101049
|
-
} else {
|
|
101050
|
-
return this.parent?.getWhereValScope(key, isThis) || null;
|
|
101051
|
-
}
|
|
101052
|
-
}
|
|
101053
|
-
if (key in this.allVars && !(key in {} && !hasOwnProperty19(this.allVars, key))) {
|
|
101054
|
-
return this;
|
|
101055
|
-
}
|
|
101056
|
-
return this.parent?.getWhereValScope(key, isThis) || null;
|
|
101057
|
-
}
|
|
101058
|
-
getWhereVarScope(key, localScope = false) {
|
|
101059
|
-
if (key in this.allVars && !(key in {} && !hasOwnProperty19(this.allVars, key))) {
|
|
101060
|
-
return this;
|
|
101061
|
-
}
|
|
101062
|
-
if (this.parent === null || localScope || this.functionThis !== void 0) {
|
|
101063
|
-
return this;
|
|
101064
|
-
}
|
|
101065
|
-
return this.parent.getWhereVarScope(key, localScope);
|
|
101066
|
-
}
|
|
101067
101093
|
declare(key, type, value = void 0, isGlobal = false) {
|
|
101068
101094
|
if (key === "this")
|
|
101069
101095
|
throw new SyntaxError('"this" cannot be declared');
|
|
101070
101096
|
if (reservedWords2.has(key))
|
|
101071
101097
|
throw new SyntaxError("Unexepected token '" + key + "'");
|
|
101072
|
-
|
|
101073
|
-
key,
|
|
101074
|
-
|
|
101075
|
-
|
|
101076
|
-
|
|
101077
|
-
|
|
101078
|
-
|
|
101079
|
-
|
|
101080
|
-
|
|
101081
|
-
|
|
101082
|
-
} else {
|
|
101083
|
-
existingScope.globals[key] = true;
|
|
101084
|
-
}
|
|
101085
|
-
return new Prop(existingScope.allVars, key, false, existingScope.globals[key], true);
|
|
101086
|
-
} else if (key in existingScope.allVars) {
|
|
101087
|
-
throw new SyntaxError(`Identifier '${key}' has already been declared`);
|
|
101088
|
-
}
|
|
101089
|
-
}
|
|
101090
|
-
if (key in existingScope.allVars) {
|
|
101091
|
-
throw new SyntaxError(`Identifier '${key}' has already been declared`);
|
|
101092
|
-
}
|
|
101093
|
-
if (isGlobal) {
|
|
101094
|
-
existingScope.globals[key] = true;
|
|
101098
|
+
if (type === "var" && this.functionThis === void 0 && this.parent !== null) {
|
|
101099
|
+
return this.parent.declare(key, type, value, isGlobal);
|
|
101100
|
+
} else if (this[type].hasOwnProperty(key) && type !== "const" && !this.globals.hasOwnProperty(key) || !(key in this.allVars)) {
|
|
101101
|
+
if (isGlobal) {
|
|
101102
|
+
this.globals[key] = true;
|
|
101103
|
+
}
|
|
101104
|
+
this[type][key] = true;
|
|
101105
|
+
this.allVars[key] = value;
|
|
101106
|
+
} else {
|
|
101107
|
+
throw new SandboxError(`Identifier '${key}' has already been declared`);
|
|
101095
101108
|
}
|
|
101096
|
-
|
|
101097
|
-
existingScope.allVars[key] = value;
|
|
101098
|
-
return new Prop(this.allVars, key, type === "const", isGlobal, true);
|
|
101109
|
+
return new Prop(this.allVars, key, this.const.hasOwnProperty(key), isGlobal);
|
|
101099
101110
|
}
|
|
101100
101111
|
};
|
|
101101
101112
|
var FunctionScope = class {
|
|
@@ -101104,16 +101115,8 @@ var require_utils2 = __commonJS({
|
|
|
101104
101115
|
};
|
|
101105
101116
|
var SandboxError = class extends Error {
|
|
101106
101117
|
};
|
|
101107
|
-
var SandboxExecutionQuotaExceededError = class extends SandboxError {
|
|
101108
|
-
};
|
|
101109
|
-
var SandboxExecutionTreeError = class extends SandboxError {
|
|
101110
|
-
};
|
|
101111
|
-
var SandboxCapabilityError = class extends SandboxError {
|
|
101112
|
-
};
|
|
101113
|
-
var SandboxAccessError = class extends SandboxError {
|
|
101114
|
-
};
|
|
101115
101118
|
function isLisp(item) {
|
|
101116
|
-
return Array.isArray(item) && typeof item[0] === "number" && item[0] !== 0 && item[0] !==
|
|
101119
|
+
return Array.isArray(item) && typeof item[0] === "number" && item[0] !== 0 && item[0] !== 89;
|
|
101117
101120
|
}
|
|
101118
101121
|
var Prop = class {
|
|
101119
101122
|
constructor(context, prop, isConst = false, isGlobal = false, isVariable = false) {
|
|
@@ -101126,16 +101129,13 @@ var require_utils2 = __commonJS({
|
|
|
101126
101129
|
get(context) {
|
|
101127
101130
|
const ctx = this.context;
|
|
101128
101131
|
if (ctx === void 0)
|
|
101129
|
-
throw new ReferenceError(`${this.prop
|
|
101132
|
+
throw new ReferenceError(`${this.prop} is not defined`);
|
|
101130
101133
|
if (ctx === null)
|
|
101131
|
-
throw new TypeError(`Cannot read properties of null, (reading '${this.prop
|
|
101132
|
-
context.getSubscriptions.forEach((cb) => cb(ctx, this.prop
|
|
101134
|
+
throw new TypeError(`Cannot read properties of null, (reading '${this.prop}')`);
|
|
101135
|
+
context.getSubscriptions.forEach((cb) => cb(ctx, this.prop));
|
|
101133
101136
|
return ctx[this.prop];
|
|
101134
101137
|
}
|
|
101135
101138
|
};
|
|
101136
|
-
function hasOwnProperty19(obj, prop) {
|
|
101137
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
101138
|
-
}
|
|
101139
101139
|
exports2.AsyncFunction = AsyncFunction;
|
|
101140
101140
|
exports2.AsyncGeneratorFunction = AsyncGeneratorFunction;
|
|
101141
101141
|
exports2.CodeString = CodeString;
|
|
@@ -101144,18 +101144,12 @@ var require_utils2 = __commonJS({
|
|
|
101144
101144
|
exports2.GeneratorFunction = GeneratorFunction;
|
|
101145
101145
|
exports2.LocalScope = LocalScope;
|
|
101146
101146
|
exports2.Prop = Prop;
|
|
101147
|
-
exports2.SandboxAccessError = SandboxAccessError;
|
|
101148
|
-
exports2.SandboxCapabilityError = SandboxCapabilityError;
|
|
101149
101147
|
exports2.SandboxError = SandboxError;
|
|
101150
|
-
exports2.SandboxExecutionQuotaExceededError = SandboxExecutionQuotaExceededError;
|
|
101151
|
-
exports2.SandboxExecutionTreeError = SandboxExecutionTreeError;
|
|
101152
101148
|
exports2.SandboxGlobal = SandboxGlobal;
|
|
101153
101149
|
exports2.Scope = Scope3;
|
|
101154
101150
|
exports2.createContext = createContext;
|
|
101155
101151
|
exports2.createExecContext = createExecContext;
|
|
101156
|
-
exports2.hasOwnProperty = hasOwnProperty19;
|
|
101157
101152
|
exports2.isLisp = isLisp;
|
|
101158
|
-
exports2.reservedWords = reservedWords2;
|
|
101159
101153
|
}
|
|
101160
101154
|
});
|
|
101161
101155
|
|
|
@@ -101185,9 +101179,10 @@ var require_executor = __commonJS({
|
|
|
101185
101179
|
});
|
|
101186
101180
|
return vars;
|
|
101187
101181
|
}
|
|
101182
|
+
var sandboxedFunctions = /* @__PURE__ */ new WeakSet();
|
|
101188
101183
|
function createFunction(argNames, parsed, ticks, context, scope, name14) {
|
|
101189
101184
|
if (context.ctx.options.forbidFunctionCreation) {
|
|
101190
|
-
throw new utils.
|
|
101185
|
+
throw new utils.SandboxError("Function creation is forbidden");
|
|
101191
101186
|
}
|
|
101192
101187
|
let func;
|
|
101193
101188
|
if (name14 === void 0) {
|
|
@@ -101204,15 +101199,15 @@ var require_executor = __commonJS({
|
|
|
101204
101199
|
};
|
|
101205
101200
|
}
|
|
101206
101201
|
context.registerSandboxFunction(func);
|
|
101207
|
-
|
|
101202
|
+
sandboxedFunctions.add(func);
|
|
101208
101203
|
return func;
|
|
101209
101204
|
}
|
|
101210
101205
|
function createFunctionAsync(argNames, parsed, ticks, context, scope, name14) {
|
|
101211
101206
|
if (context.ctx.options.forbidFunctionCreation) {
|
|
101212
|
-
throw new utils.
|
|
101207
|
+
throw new utils.SandboxError("Function creation is forbidden");
|
|
101213
101208
|
}
|
|
101214
101209
|
if (!context.ctx.prototypeWhitelist?.has(Promise.prototype)) {
|
|
101215
|
-
throw new utils.
|
|
101210
|
+
throw new utils.SandboxError("Async/await not permitted");
|
|
101216
101211
|
}
|
|
101217
101212
|
let func;
|
|
101218
101213
|
if (name14 === void 0) {
|
|
@@ -101229,40 +101224,43 @@ var require_executor = __commonJS({
|
|
|
101229
101224
|
};
|
|
101230
101225
|
}
|
|
101231
101226
|
context.registerSandboxFunction(func);
|
|
101232
|
-
|
|
101227
|
+
sandboxedFunctions.add(func);
|
|
101233
101228
|
return func;
|
|
101234
101229
|
}
|
|
101235
101230
|
function assignCheck(obj, context, op2 = "assign") {
|
|
101236
101231
|
if (obj.context === void 0) {
|
|
101237
101232
|
throw new ReferenceError(`Cannot ${op2} value to undefined.`);
|
|
101238
101233
|
}
|
|
101234
|
+
if (typeof obj.context !== "object" && typeof obj.context !== "function") {
|
|
101235
|
+
throw new SyntaxError(`Cannot ${op2} value to a primitive.`);
|
|
101236
|
+
}
|
|
101239
101237
|
if (obj.isConst) {
|
|
101240
|
-
throw new TypeError(`
|
|
101238
|
+
throw new TypeError(`Cannot set value to const variable '${obj.prop}'`);
|
|
101241
101239
|
}
|
|
101242
101240
|
if (obj.isGlobal) {
|
|
101243
|
-
throw new utils.
|
|
101241
|
+
throw new utils.SandboxError(`Cannot ${op2} property '${obj.prop}' of a global object`);
|
|
101244
101242
|
}
|
|
101245
101243
|
if (obj.context === null) {
|
|
101246
101244
|
throw new TypeError("Cannot set properties of null");
|
|
101247
101245
|
}
|
|
101248
|
-
if (typeof obj.context[obj.prop] === "function" && !
|
|
101249
|
-
throw new utils.
|
|
101246
|
+
if (typeof obj.context[obj.prop] === "function" && !obj.context.hasOwnProperty(obj.prop)) {
|
|
101247
|
+
throw new utils.SandboxError(`Override prototype property '${obj.prop}' not allowed`);
|
|
101250
101248
|
}
|
|
101251
101249
|
if (op2 === "delete") {
|
|
101252
|
-
if (
|
|
101253
|
-
context.changeSubscriptions.get(obj.context)?.forEach((cb) => cb({ type: "delete", prop: obj.prop
|
|
101254
|
-
context.changeSubscriptionsGlobal.get(obj.context)?.forEach((cb) => cb({ type: "delete", prop: obj.prop
|
|
101250
|
+
if (obj.context.hasOwnProperty(obj.prop)) {
|
|
101251
|
+
context.changeSubscriptions.get(obj.context)?.forEach((cb) => cb({ type: "delete", prop: obj.prop }));
|
|
101252
|
+
context.changeSubscriptionsGlobal.get(obj.context)?.forEach((cb) => cb({ type: "delete", prop: obj.prop }));
|
|
101255
101253
|
}
|
|
101256
|
-
} else if (
|
|
101257
|
-
context.setSubscriptions.get(obj.context)?.get(obj.prop
|
|
101254
|
+
} else if (obj.context.hasOwnProperty(obj.prop)) {
|
|
101255
|
+
context.setSubscriptions.get(obj.context)?.get(obj.prop)?.forEach((cb) => cb({
|
|
101258
101256
|
type: "replace"
|
|
101259
101257
|
}));
|
|
101260
|
-
context.setSubscriptionsGlobal.get(obj.context)?.get(obj.prop
|
|
101258
|
+
context.setSubscriptionsGlobal.get(obj.context)?.get(obj.prop)?.forEach((cb) => cb({
|
|
101261
101259
|
type: "replace"
|
|
101262
101260
|
}));
|
|
101263
101261
|
} else {
|
|
101264
|
-
context.changeSubscriptions.get(obj.context)?.forEach((cb) => cb({ type: "create", prop: obj.prop
|
|
101265
|
-
context.changeSubscriptionsGlobal.get(obj.context)?.forEach((cb) => cb({ type: "create", prop: obj.prop
|
|
101262
|
+
context.changeSubscriptions.get(obj.context)?.forEach((cb) => cb({ type: "create", prop: obj.prop }));
|
|
101263
|
+
context.changeSubscriptionsGlobal.get(obj.context)?.forEach((cb) => cb({ type: "create", prop: obj.prop }));
|
|
101266
101264
|
}
|
|
101267
101265
|
}
|
|
101268
101266
|
var arrayChange = /* @__PURE__ */ new Set([
|
|
@@ -101302,128 +101300,107 @@ var require_executor = __commonJS({
|
|
|
101302
101300
|
function addOps(type, cb) {
|
|
101303
101301
|
ops.set(type, cb);
|
|
101304
101302
|
}
|
|
101305
|
-
|
|
101306
|
-
function isPropertyKey(val) {
|
|
101307
|
-
return prorptyKeyTypes.includes(typeof val);
|
|
101308
|
-
}
|
|
101309
|
-
function hasPossibleProperties(val) {
|
|
101310
|
-
return val !== null && val !== void 0;
|
|
101311
|
-
}
|
|
101312
|
-
addOps(1, ({ done, a: a4, b: b4, obj, context, scope }) => {
|
|
101303
|
+
addOps(1, (exec6, done, ticks, a4, b4, obj, context, scope) => {
|
|
101313
101304
|
if (a4 === null) {
|
|
101314
|
-
throw new TypeError(`Cannot
|
|
101315
|
-
}
|
|
101316
|
-
if (!isPropertyKey(b4)) {
|
|
101317
|
-
b4 = `${b4}`;
|
|
101305
|
+
throw new TypeError(`Cannot get property ${b4} of null`);
|
|
101318
101306
|
}
|
|
101319
|
-
|
|
101307
|
+
const type = typeof a4;
|
|
101308
|
+
if (type === "undefined" && obj === void 0) {
|
|
101320
101309
|
const prop = scope.get(b4);
|
|
101321
101310
|
if (prop.context === context.ctx.sandboxGlobal) {
|
|
101322
101311
|
if (context.ctx.options.audit) {
|
|
101323
101312
|
context.ctx.auditReport?.globalsAccess.add(b4);
|
|
101324
101313
|
}
|
|
101314
|
+
const rep = context.ctx.globalsWhitelist.has(context.ctx.sandboxGlobal[b4]) ? context.evals.get(context.ctx.sandboxGlobal[b4]) : void 0;
|
|
101315
|
+
if (rep) {
|
|
101316
|
+
done(void 0, rep);
|
|
101317
|
+
return;
|
|
101318
|
+
}
|
|
101319
|
+
}
|
|
101320
|
+
if (prop.context && prop.context[b4] === globalThis) {
|
|
101321
|
+
done(void 0, context.ctx.globalScope.get("this"));
|
|
101322
|
+
return;
|
|
101325
101323
|
}
|
|
101326
|
-
|
|
101327
|
-
const p5 = getGlobalProp(val2, context, prop) || prop;
|
|
101328
|
-
done(void 0, p5);
|
|
101324
|
+
done(void 0, prop);
|
|
101329
101325
|
return;
|
|
101330
101326
|
} else if (a4 === void 0) {
|
|
101331
|
-
throw new
|
|
101327
|
+
throw new utils.SandboxError("Cannot get property '" + b4 + "' of undefined");
|
|
101332
101328
|
}
|
|
101333
|
-
if (
|
|
101329
|
+
if (type !== "object") {
|
|
101330
|
+
if (type === "number") {
|
|
101331
|
+
a4 = new Number(a4);
|
|
101332
|
+
} else if (type === "string") {
|
|
101333
|
+
a4 = new String(a4);
|
|
101334
|
+
} else if (type === "boolean") {
|
|
101335
|
+
a4 = new Boolean(a4);
|
|
101336
|
+
}
|
|
101337
|
+
} else if (typeof a4.hasOwnProperty === "undefined") {
|
|
101334
101338
|
done(void 0, new utils.Prop(void 0, b4));
|
|
101335
101339
|
return;
|
|
101336
101340
|
}
|
|
101337
|
-
const
|
|
101341
|
+
const isFunction2 = type === "function";
|
|
101342
|
+
const prototypeAccess = isFunction2 || !(a4.hasOwnProperty(b4) || typeof b4 === "number");
|
|
101338
101343
|
if (context.ctx.options.audit && prototypeAccess) {
|
|
101339
|
-
|
|
101340
|
-
|
|
101341
|
-
|
|
101342
|
-
if (
|
|
101343
|
-
context.ctx.auditReport.prototypeAccess[prot.constructor.name]
|
|
101344
|
+
if (typeof b4 === "string") {
|
|
101345
|
+
let prot = Object.getPrototypeOf(a4);
|
|
101346
|
+
do {
|
|
101347
|
+
if (prot.hasOwnProperty(b4)) {
|
|
101348
|
+
if (context.ctx.auditReport && !context.ctx.auditReport.prototypeAccess[prot.constructor.name]) {
|
|
101349
|
+
context.ctx.auditReport.prototypeAccess[prot.constructor.name] = /* @__PURE__ */ new Set();
|
|
101350
|
+
}
|
|
101351
|
+
context.ctx.auditReport?.prototypeAccess[prot.constructor.name].add(b4);
|
|
101344
101352
|
}
|
|
101345
|
-
|
|
101346
|
-
|
|
101347
|
-
} while (prot = Object.getPrototypeOf(prot));
|
|
101353
|
+
} while (prot = Object.getPrototypeOf(prot));
|
|
101354
|
+
}
|
|
101348
101355
|
}
|
|
101349
101356
|
if (prototypeAccess) {
|
|
101350
|
-
if (
|
|
101351
|
-
if (
|
|
101357
|
+
if (isFunction2) {
|
|
101358
|
+
if (!["name", "length", "constructor"].includes(b4) && a4.hasOwnProperty(b4)) {
|
|
101352
101359
|
const whitelist = context.ctx.prototypeWhitelist.get(a4.prototype);
|
|
101353
101360
|
const replace = context.ctx.options.prototypeReplacements.get(a4);
|
|
101354
101361
|
if (replace) {
|
|
101355
101362
|
done(void 0, new utils.Prop(replace(a4, true), b4));
|
|
101356
101363
|
return;
|
|
101357
101364
|
}
|
|
101358
|
-
if (!(whitelist && (!whitelist.size || whitelist.has(b4)))
|
|
101359
|
-
throw new utils.
|
|
101365
|
+
if (!(whitelist && (!whitelist.size || whitelist.has(b4)))) {
|
|
101366
|
+
throw new utils.SandboxError(`Static method or property access not permitted: ${a4.name}.${b4}`);
|
|
101360
101367
|
}
|
|
101361
101368
|
}
|
|
101362
101369
|
}
|
|
101363
|
-
|
|
101364
|
-
|
|
101365
|
-
|
|
101366
|
-
|
|
101367
|
-
|
|
101368
|
-
|
|
101369
|
-
|
|
101370
|
-
|
|
101371
|
-
|
|
101372
|
-
|
|
101373
|
-
|
|
101374
|
-
|
|
101375
|
-
|
|
101376
|
-
throw new utils.
|
|
101370
|
+
if (b4 !== "constructor") {
|
|
101371
|
+
let prot = a4;
|
|
101372
|
+
while (prot = Object.getPrototypeOf(prot)) {
|
|
101373
|
+
if (prot.hasOwnProperty(b4)) {
|
|
101374
|
+
const whitelist = context.ctx.prototypeWhitelist.get(prot);
|
|
101375
|
+
const replace = context.ctx.options.prototypeReplacements.get(prot.constuctor);
|
|
101376
|
+
if (replace) {
|
|
101377
|
+
done(void 0, new utils.Prop(replace(a4, false), b4));
|
|
101378
|
+
return;
|
|
101379
|
+
}
|
|
101380
|
+
if (whitelist && (!whitelist.size || whitelist.has(b4))) {
|
|
101381
|
+
break;
|
|
101382
|
+
}
|
|
101383
|
+
throw new utils.SandboxError(`Method or property access not permitted: ${prot.constructor.name}.${b4}`);
|
|
101377
101384
|
}
|
|
101378
|
-
throw new utils.SandboxAccessError(`Method or property access not permitted: ${prot.constructor.name}.${b4.toString()}`);
|
|
101379
101385
|
}
|
|
101380
101386
|
}
|
|
101381
101387
|
}
|
|
101382
|
-
|
|
101383
|
-
|
|
101384
|
-
if (b4 === "prototype" && !context.ctx.sandboxedFunctions.has(a4)) {
|
|
101385
|
-
throw new utils.SandboxAccessError(`Access to prototype of global object is not permitted`);
|
|
101386
|
-
}
|
|
101387
|
-
}
|
|
101388
|
-
if (b4 === "__proto__" && !context.ctx.sandboxedFunctions.has(val?.constructor)) {
|
|
101389
|
-
throw new utils.SandboxAccessError(`Access to prototype of global object is not permitted`);
|
|
101390
|
-
}
|
|
101391
|
-
const p4 = getGlobalProp(val, context);
|
|
101392
|
-
if (p4) {
|
|
101393
|
-
done(void 0, p4);
|
|
101388
|
+
if (context.evals.has(a4[b4])) {
|
|
101389
|
+
done(void 0, context.evals.get(a4[b4]));
|
|
101394
101390
|
return;
|
|
101395
101391
|
}
|
|
101396
|
-
|
|
101397
|
-
|
|
101398
|
-
});
|
|
101399
|
-
function getGlobalProp(val, context, prop) {
|
|
101400
|
-
if (!val)
|
|
101392
|
+
if (a4[b4] === globalThis) {
|
|
101393
|
+
done(void 0, context.ctx.globalScope.get("this"));
|
|
101401
101394
|
return;
|
|
101402
|
-
const isFunc = typeof val === "function";
|
|
101403
|
-
if (val instanceof utils.Prop) {
|
|
101404
|
-
if (!prop) {
|
|
101405
|
-
prop = val;
|
|
101406
|
-
}
|
|
101407
|
-
val = val.get(context);
|
|
101408
101395
|
}
|
|
101409
|
-
const
|
|
101410
|
-
|
|
101411
|
-
|
|
101412
|
-
|
|
101413
|
-
}, p4, prop?.isConst || false, false, prop?.isVariable || false);
|
|
101414
|
-
}
|
|
101415
|
-
const evl = isFunc && context.evals.get(val);
|
|
101416
|
-
if (evl) {
|
|
101417
|
-
return new utils.Prop({
|
|
101418
|
-
[p4]: evl
|
|
101419
|
-
}, p4, prop?.isConst || false, true, prop?.isVariable || false);
|
|
101420
|
-
}
|
|
101421
|
-
}
|
|
101422
|
-
addOps(5, ({ done, a: a4, b: b4, obj, context }) => {
|
|
101396
|
+
const g4 = obj.isGlobal || isFunction2 && !sandboxedFunctions.has(a4) || context.ctx.globalsWhitelist.has(a4);
|
|
101397
|
+
done(void 0, new utils.Prop(a4, b4, false, g4));
|
|
101398
|
+
});
|
|
101399
|
+
addOps(5, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101423
101400
|
if (context.ctx.options.forbidFunctionCalls)
|
|
101424
|
-
throw new utils.
|
|
101401
|
+
throw new utils.SandboxError("Function invocations are not allowed");
|
|
101425
101402
|
if (typeof a4 !== "function") {
|
|
101426
|
-
throw new TypeError(`${typeof obj
|
|
101403
|
+
throw new TypeError(`${typeof obj.prop === "symbol" ? "Symbol" : obj.prop} is not a function`);
|
|
101427
101404
|
}
|
|
101428
101405
|
const vals = b4.map((item) => {
|
|
101429
101406
|
if (item instanceof SpreadArray) {
|
|
@@ -101433,9 +101410,7 @@ var require_executor = __commonJS({
|
|
|
101433
101410
|
}
|
|
101434
101411
|
}).flat().map((item) => valueOrProp(item, context));
|
|
101435
101412
|
if (typeof obj === "function") {
|
|
101436
|
-
|
|
101437
|
-
ret2 = getGlobalProp(ret2, context) || ret2;
|
|
101438
|
-
done(void 0, ret2);
|
|
101413
|
+
done(void 0, obj(...vals));
|
|
101439
101414
|
return;
|
|
101440
101415
|
}
|
|
101441
101416
|
if (obj.context[obj.prop] === JSON.stringify && context.getSubscriptions.size) {
|
|
@@ -101507,11 +101482,9 @@ var require_executor = __commonJS({
|
|
|
101507
101482
|
}
|
|
101508
101483
|
}
|
|
101509
101484
|
obj.get(context);
|
|
101510
|
-
|
|
101511
|
-
ret = getGlobalProp(ret, context) || ret;
|
|
101512
|
-
done(void 0, ret);
|
|
101485
|
+
done(void 0, obj.context[obj.prop](...vals));
|
|
101513
101486
|
});
|
|
101514
|
-
addOps(22, (
|
|
101487
|
+
addOps(22, (exec6, done, ticks, a4, b4) => {
|
|
101515
101488
|
let res = {};
|
|
101516
101489
|
for (const item of b4) {
|
|
101517
101490
|
if (item.key instanceof SpreadObject) {
|
|
@@ -101522,8 +101495,8 @@ var require_executor = __commonJS({
|
|
|
101522
101495
|
}
|
|
101523
101496
|
done(void 0, res);
|
|
101524
101497
|
});
|
|
101525
|
-
addOps(6, (
|
|
101526
|
-
addOps(12, (
|
|
101498
|
+
addOps(6, (exec6, done, ticks, a4, b4) => done(void 0, new KeyVal(a4, b4)));
|
|
101499
|
+
addOps(12, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101527
101500
|
const items = b4.map((item) => {
|
|
101528
101501
|
if (item instanceof SpreadArray) {
|
|
101529
101502
|
return [...item.item];
|
|
@@ -101533,8 +101506,8 @@ var require_executor = __commonJS({
|
|
|
101533
101506
|
}).flat().map((item) => valueOrProp(item, context));
|
|
101534
101507
|
done(void 0, items);
|
|
101535
101508
|
});
|
|
101536
|
-
addOps(23, (
|
|
101537
|
-
addOps(35, (
|
|
101509
|
+
addOps(23, (exec6, done, ticks, a4, b4) => done(void 0, b4));
|
|
101510
|
+
addOps(35, (exec6, done, ticks, a4, b4) => {
|
|
101538
101511
|
switch (b4) {
|
|
101539
101512
|
case "true":
|
|
101540
101513
|
return done(void 0, true);
|
|
@@ -101551,18 +101524,18 @@ var require_executor = __commonJS({
|
|
|
101551
101524
|
}
|
|
101552
101525
|
done(new Error("Unknown symbol: " + b4));
|
|
101553
101526
|
});
|
|
101554
|
-
addOps(7, (
|
|
101555
|
-
addOps(83, (
|
|
101556
|
-
addOps(2, (
|
|
101557
|
-
addOps(
|
|
101527
|
+
addOps(7, (exec6, done, ticks, a4, b4) => done(void 0, Number(b4)));
|
|
101528
|
+
addOps(83, (exec6, done, ticks, a4, b4) => done(void 0, BigInt(b4)));
|
|
101529
|
+
addOps(2, (exec6, done, ticks, a4, b4, obj, context) => done(void 0, context.constants.strings[parseInt(b4)]));
|
|
101530
|
+
addOps(86, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101558
101531
|
const reg = context.constants.regexes[parseInt(b4)];
|
|
101559
101532
|
if (!context.ctx.globalsWhitelist.has(RegExp)) {
|
|
101560
|
-
throw new utils.
|
|
101533
|
+
throw new utils.SandboxError("Regex not permitted");
|
|
101561
101534
|
} else {
|
|
101562
101535
|
done(void 0, new RegExp(reg.regex, reg.flags));
|
|
101563
101536
|
}
|
|
101564
101537
|
});
|
|
101565
|
-
addOps(84, (
|
|
101538
|
+
addOps(84, (exec6, done, ticks, a4, b4, obj, context, scope) => {
|
|
101566
101539
|
const item = context.constants.literals[parseInt(b4)];
|
|
101567
101540
|
const [, name14, js] = item;
|
|
101568
101541
|
const found = [];
|
|
@@ -101574,13 +101547,12 @@ var require_executor = __commonJS({
|
|
|
101574
101547
|
resnums.push(f4[3]);
|
|
101575
101548
|
}
|
|
101576
101549
|
}
|
|
101577
|
-
exec6(ticks, found, scope, context, (
|
|
101550
|
+
exec6(ticks, found, scope, context, (err, processed) => {
|
|
101578
101551
|
const reses = {};
|
|
101579
|
-
if (
|
|
101580
|
-
done(
|
|
101552
|
+
if (err) {
|
|
101553
|
+
done(err);
|
|
101581
101554
|
return;
|
|
101582
101555
|
}
|
|
101583
|
-
const processed = args[1];
|
|
101584
101556
|
for (const i4 of Object.keys(processed)) {
|
|
101585
101557
|
const num = resnums[i4];
|
|
101586
101558
|
reses[num] = processed[i4];
|
|
@@ -101593,146 +101565,115 @@ var require_executor = __commonJS({
|
|
|
101593
101565
|
}));
|
|
101594
101566
|
});
|
|
101595
101567
|
});
|
|
101596
|
-
addOps(18, (
|
|
101568
|
+
addOps(18, (exec6, done, ticks, a4, b4) => {
|
|
101597
101569
|
done(void 0, new SpreadArray(b4));
|
|
101598
101570
|
});
|
|
101599
|
-
addOps(17, (
|
|
101571
|
+
addOps(17, (exec6, done, ticks, a4, b4) => {
|
|
101600
101572
|
done(void 0, new SpreadObject(b4));
|
|
101601
101573
|
});
|
|
101602
|
-
addOps(24, (
|
|
101603
|
-
addOps(64, (
|
|
101604
|
-
addOps(25, (
|
|
101574
|
+
addOps(24, (exec6, done, ticks, a4, b4) => done(void 0, !b4));
|
|
101575
|
+
addOps(64, (exec6, done, ticks, a4, b4) => done(void 0, ~b4));
|
|
101576
|
+
addOps(25, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101605
101577
|
assignCheck(obj, context);
|
|
101606
101578
|
done(void 0, ++obj.context[obj.prop]);
|
|
101607
101579
|
});
|
|
101608
|
-
addOps(26, (
|
|
101580
|
+
addOps(26, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101609
101581
|
assignCheck(obj, context);
|
|
101610
101582
|
done(void 0, obj.context[obj.prop]++);
|
|
101611
101583
|
});
|
|
101612
|
-
addOps(27, (
|
|
101584
|
+
addOps(27, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101613
101585
|
assignCheck(obj, context);
|
|
101614
101586
|
done(void 0, --obj.context[obj.prop]);
|
|
101615
101587
|
});
|
|
101616
|
-
addOps(28, (
|
|
101588
|
+
addOps(28, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101617
101589
|
assignCheck(obj, context);
|
|
101618
101590
|
done(void 0, obj.context[obj.prop]--);
|
|
101619
101591
|
});
|
|
101620
|
-
addOps(9, (
|
|
101592
|
+
addOps(9, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101621
101593
|
assignCheck(obj, context);
|
|
101622
|
-
obj.isGlobal = bobj?.isGlobal || false;
|
|
101623
|
-
if (obj.isVariable) {
|
|
101624
|
-
const s4 = scope.getWhereValScope(obj.prop, obj.prop === "this");
|
|
101625
|
-
if (s4 === null) {
|
|
101626
|
-
throw new ReferenceError(`Cannot assign to undeclared variable '${obj.prop.toString()}'`);
|
|
101627
|
-
}
|
|
101628
|
-
s4.set(obj.prop, b4);
|
|
101629
|
-
if (obj.isGlobal) {
|
|
101630
|
-
s4.globals[obj.prop.toString()] = true;
|
|
101631
|
-
} else {
|
|
101632
|
-
delete s4.globals[obj.prop.toString()];
|
|
101633
|
-
}
|
|
101634
|
-
done(void 0, b4);
|
|
101635
|
-
return;
|
|
101636
|
-
}
|
|
101637
101594
|
done(void 0, obj.context[obj.prop] = b4);
|
|
101638
101595
|
});
|
|
101639
|
-
addOps(66, (
|
|
101596
|
+
addOps(66, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101640
101597
|
assignCheck(obj, context);
|
|
101641
101598
|
done(void 0, obj.context[obj.prop] += b4);
|
|
101642
101599
|
});
|
|
101643
|
-
addOps(65, (
|
|
101600
|
+
addOps(65, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101644
101601
|
assignCheck(obj, context);
|
|
101645
101602
|
done(void 0, obj.context[obj.prop] -= b4);
|
|
101646
101603
|
});
|
|
101647
|
-
addOps(67, (
|
|
101604
|
+
addOps(67, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101648
101605
|
assignCheck(obj, context);
|
|
101649
101606
|
done(void 0, obj.context[obj.prop] /= b4);
|
|
101650
101607
|
});
|
|
101651
|
-
addOps(69, (
|
|
101608
|
+
addOps(69, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101652
101609
|
assignCheck(obj, context);
|
|
101653
101610
|
done(void 0, obj.context[obj.prop] *= b4);
|
|
101654
101611
|
});
|
|
101655
|
-
addOps(68, (
|
|
101612
|
+
addOps(68, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101656
101613
|
assignCheck(obj, context);
|
|
101657
101614
|
done(void 0, obj.context[obj.prop] **= b4);
|
|
101658
101615
|
});
|
|
101659
|
-
addOps(70, (
|
|
101616
|
+
addOps(70, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101660
101617
|
assignCheck(obj, context);
|
|
101661
101618
|
done(void 0, obj.context[obj.prop] %= b4);
|
|
101662
101619
|
});
|
|
101663
|
-
addOps(71, (
|
|
101620
|
+
addOps(71, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101664
101621
|
assignCheck(obj, context);
|
|
101665
101622
|
done(void 0, obj.context[obj.prop] ^= b4);
|
|
101666
101623
|
});
|
|
101667
|
-
addOps(72, (
|
|
101624
|
+
addOps(72, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101668
101625
|
assignCheck(obj, context);
|
|
101669
101626
|
done(void 0, obj.context[obj.prop] &= b4);
|
|
101670
101627
|
});
|
|
101671
|
-
addOps(73, (
|
|
101628
|
+
addOps(73, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101672
101629
|
assignCheck(obj, context);
|
|
101673
101630
|
done(void 0, obj.context[obj.prop] |= b4);
|
|
101674
101631
|
});
|
|
101675
|
-
addOps(76, (
|
|
101632
|
+
addOps(76, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101676
101633
|
assignCheck(obj, context);
|
|
101677
101634
|
done(void 0, obj.context[obj.prop] <<= b4);
|
|
101678
101635
|
});
|
|
101679
|
-
addOps(75, (
|
|
101636
|
+
addOps(75, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101680
101637
|
assignCheck(obj, context);
|
|
101681
101638
|
done(void 0, obj.context[obj.prop] >>= b4);
|
|
101682
101639
|
});
|
|
101683
|
-
addOps(74, (
|
|
101684
|
-
assignCheck(obj, context);
|
|
101685
|
-
done(void 0, obj.context[obj.prop] >>>= b4);
|
|
101686
|
-
});
|
|
101687
|
-
addOps(90, ({ done, b: b4, obj, context }) => {
|
|
101688
|
-
var _a16, _b;
|
|
101689
|
-
assignCheck(obj, context);
|
|
101690
|
-
done(void 0, (_a16 = obj.context)[_b = obj.prop] && (_a16[_b] = b4));
|
|
101691
|
-
});
|
|
101692
|
-
addOps(91, ({ done, b: b4, obj, context }) => {
|
|
101693
|
-
var _a16, _b;
|
|
101694
|
-
assignCheck(obj, context);
|
|
101695
|
-
done(void 0, (_a16 = obj.context)[_b = obj.prop] || (_a16[_b] = b4));
|
|
101696
|
-
});
|
|
101697
|
-
addOps(92, ({ done, b: b4, obj, context }) => {
|
|
101698
|
-
var _a16, _b;
|
|
101640
|
+
addOps(74, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101699
101641
|
assignCheck(obj, context);
|
|
101700
|
-
done(void 0,
|
|
101642
|
+
done(void 0, obj.context[obj.prop] >>= b4);
|
|
101701
101643
|
});
|
|
101702
|
-
addOps(57, (
|
|
101703
|
-
addOps(56, (
|
|
101704
|
-
addOps(55, (
|
|
101705
|
-
addOps(54, (
|
|
101706
|
-
addOps(52, (
|
|
101707
|
-
addOps(32, (
|
|
101708
|
-
addOps(53, (
|
|
101709
|
-
addOps(31, (
|
|
101710
|
-
addOps(29, (
|
|
101711
|
-
addOps(30, (
|
|
101712
|
-
addOps(
|
|
101713
|
-
addOps(77, (
|
|
101714
|
-
addOps(78, (
|
|
101715
|
-
addOps(33, (
|
|
101716
|
-
addOps(47, (
|
|
101717
|
-
addOps(59, (
|
|
101718
|
-
addOps(58, (
|
|
101719
|
-
addOps(48, (
|
|
101720
|
-
addOps(
|
|
101721
|
-
addOps(
|
|
101722
|
-
addOps(
|
|
101723
|
-
addOps(
|
|
101724
|
-
addOps(
|
|
101725
|
-
addOps(
|
|
101726
|
-
addOps(
|
|
101727
|
-
addOps(60, ({ exec: exec6, done, ticks, b: b4, context, scope }) => {
|
|
101644
|
+
addOps(57, (exec6, done, ticks, a4, b4) => done(void 0, a4 > b4));
|
|
101645
|
+
addOps(56, (exec6, done, ticks, a4, b4) => done(void 0, a4 < b4));
|
|
101646
|
+
addOps(55, (exec6, done, ticks, a4, b4) => done(void 0, a4 >= b4));
|
|
101647
|
+
addOps(54, (exec6, done, ticks, a4, b4) => done(void 0, a4 <= b4));
|
|
101648
|
+
addOps(52, (exec6, done, ticks, a4, b4) => done(void 0, a4 == b4));
|
|
101649
|
+
addOps(32, (exec6, done, ticks, a4, b4) => done(void 0, a4 === b4));
|
|
101650
|
+
addOps(53, (exec6, done, ticks, a4, b4) => done(void 0, a4 != b4));
|
|
101651
|
+
addOps(31, (exec6, done, ticks, a4, b4) => done(void 0, a4 !== b4));
|
|
101652
|
+
addOps(29, (exec6, done, ticks, a4, b4) => done(void 0, a4 && b4));
|
|
101653
|
+
addOps(30, (exec6, done, ticks, a4, b4) => done(void 0, a4 || b4));
|
|
101654
|
+
addOps(85, (exec6, done, ticks, a4, b4) => done(void 0, a4 ?? b4));
|
|
101655
|
+
addOps(77, (exec6, done, ticks, a4, b4) => done(void 0, a4 & b4));
|
|
101656
|
+
addOps(78, (exec6, done, ticks, a4, b4) => done(void 0, a4 | b4));
|
|
101657
|
+
addOps(33, (exec6, done, ticks, a4, b4) => done(void 0, a4 + b4));
|
|
101658
|
+
addOps(47, (exec6, done, ticks, a4, b4) => done(void 0, a4 - b4));
|
|
101659
|
+
addOps(59, (exec6, done, ticks, a4, b4) => done(void 0, +b4));
|
|
101660
|
+
addOps(58, (exec6, done, ticks, a4, b4) => done(void 0, -b4));
|
|
101661
|
+
addOps(48, (exec6, done, ticks, a4, b4) => done(void 0, a4 / b4));
|
|
101662
|
+
addOps(79, (exec6, done, ticks, a4, b4) => done(void 0, a4 ^ b4));
|
|
101663
|
+
addOps(50, (exec6, done, ticks, a4, b4) => done(void 0, a4 * b4));
|
|
101664
|
+
addOps(51, (exec6, done, ticks, a4, b4) => done(void 0, a4 % b4));
|
|
101665
|
+
addOps(80, (exec6, done, ticks, a4, b4) => done(void 0, a4 << b4));
|
|
101666
|
+
addOps(81, (exec6, done, ticks, a4, b4) => done(void 0, a4 >> b4));
|
|
101667
|
+
addOps(82, (exec6, done, ticks, a4, b4) => done(void 0, a4 >>> b4));
|
|
101668
|
+
addOps(60, (exec6, done, ticks, a4, b4, obj, context, scope) => {
|
|
101728
101669
|
exec6(ticks, b4, scope, context, (e4, prop) => {
|
|
101729
101670
|
done(void 0, typeof valueOrProp(prop, context));
|
|
101730
101671
|
});
|
|
101731
101672
|
});
|
|
101732
|
-
addOps(62, (
|
|
101733
|
-
addOps(63, (
|
|
101734
|
-
addOps(61, (
|
|
101735
|
-
if (
|
|
101673
|
+
addOps(62, (exec6, done, ticks, a4, b4) => done(void 0, a4 instanceof b4));
|
|
101674
|
+
addOps(63, (exec6, done, ticks, a4, b4) => done(void 0, a4 in b4));
|
|
101675
|
+
addOps(61, (exec6, done, ticks, a4, b4, obj, context, scope, bobj) => {
|
|
101676
|
+
if (bobj.context === void 0) {
|
|
101736
101677
|
done(void 0, true);
|
|
101737
101678
|
return;
|
|
101738
101679
|
}
|
|
@@ -101743,23 +101684,23 @@ var require_executor = __commonJS({
|
|
|
101743
101684
|
}
|
|
101744
101685
|
done(void 0, delete bobj.context?.[bobj.prop]);
|
|
101745
101686
|
});
|
|
101746
|
-
addOps(8, (
|
|
101747
|
-
addOps(34, (
|
|
101748
|
-
done(void 0, scope.declare(a4, "var", b4
|
|
101687
|
+
addOps(8, (exec6, done, ticks, a4, b4) => done(void 0, b4));
|
|
101688
|
+
addOps(34, (exec6, done, ticks, a4, b4, obj, context, scope) => {
|
|
101689
|
+
done(void 0, scope.declare(a4, "var", b4));
|
|
101749
101690
|
});
|
|
101750
|
-
addOps(3, (
|
|
101751
|
-
done(void 0, scope.declare(a4, "let", b4, bobj
|
|
101691
|
+
addOps(3, (exec6, done, ticks, a4, b4, obj, context, scope, bobj) => {
|
|
101692
|
+
done(void 0, scope.declare(a4, "let", b4, bobj && bobj.isGlobal));
|
|
101752
101693
|
});
|
|
101753
|
-
addOps(4, (
|
|
101754
|
-
done(void 0, scope.declare(a4, "const", b4
|
|
101694
|
+
addOps(4, (exec6, done, ticks, a4, b4, obj, context, scope) => {
|
|
101695
|
+
done(void 0, scope.declare(a4, "const", b4));
|
|
101755
101696
|
});
|
|
101756
|
-
addOps(11, (
|
|
101697
|
+
addOps(11, (exec6, done, ticks, a4, b4, obj, context, scope) => {
|
|
101757
101698
|
a4 = [...a4];
|
|
101758
101699
|
if (typeof obj[2] === "string" || obj[2] instanceof utils.CodeString) {
|
|
101759
101700
|
if (context.allowJit && context.evalContext) {
|
|
101760
101701
|
obj[2] = b4 = context.evalContext.lispifyFunction(new utils.CodeString(obj[2]), context.constants);
|
|
101761
101702
|
} else {
|
|
101762
|
-
throw new utils.
|
|
101703
|
+
throw new utils.SandboxError("Unevaluated code detected, JIT not allowed");
|
|
101763
101704
|
}
|
|
101764
101705
|
}
|
|
101765
101706
|
if (a4.shift()) {
|
|
@@ -101768,18 +101709,18 @@ var require_executor = __commonJS({
|
|
|
101768
101709
|
done(void 0, createFunction(a4, b4, ticks, context, scope));
|
|
101769
101710
|
}
|
|
101770
101711
|
});
|
|
101771
|
-
addOps(37, (
|
|
101712
|
+
addOps(37, (exec6, done, ticks, a4, b4, obj, context, scope) => {
|
|
101772
101713
|
if (typeof obj[2] === "string" || obj[2] instanceof utils.CodeString) {
|
|
101773
101714
|
if (context.allowJit && context.evalContext) {
|
|
101774
101715
|
obj[2] = b4 = context.evalContext.lispifyFunction(new utils.CodeString(obj[2]), context.constants);
|
|
101775
101716
|
} else {
|
|
101776
|
-
throw new utils.
|
|
101717
|
+
throw new utils.SandboxError("Unevaluated code detected, JIT not allowed");
|
|
101777
101718
|
}
|
|
101778
101719
|
}
|
|
101779
101720
|
const isAsync2 = a4.shift();
|
|
101780
101721
|
const name14 = a4.shift();
|
|
101781
101722
|
let func;
|
|
101782
|
-
if (isAsync2 ===
|
|
101723
|
+
if (isAsync2 === 89) {
|
|
101783
101724
|
func = createFunctionAsync(a4, b4, ticks, context, scope, name14);
|
|
101784
101725
|
} else {
|
|
101785
101726
|
func = createFunction(a4, b4, ticks, context, scope, name14);
|
|
@@ -101789,12 +101730,12 @@ var require_executor = __commonJS({
|
|
|
101789
101730
|
}
|
|
101790
101731
|
done(void 0, func);
|
|
101791
101732
|
});
|
|
101792
|
-
addOps(10, (
|
|
101733
|
+
addOps(10, (exec6, done, ticks, a4, b4, obj, context, scope) => {
|
|
101793
101734
|
if (typeof obj[2] === "string" || obj[2] instanceof utils.CodeString) {
|
|
101794
101735
|
if (context.allowJit && context.evalContext) {
|
|
101795
101736
|
obj[2] = b4 = context.evalContext.lispifyFunction(new utils.CodeString(obj[2]), context.constants);
|
|
101796
101737
|
} else {
|
|
101797
|
-
throw new utils.
|
|
101738
|
+
throw new utils.SandboxError("Unevaluated code detected, JIT not allowed");
|
|
101798
101739
|
}
|
|
101799
101740
|
}
|
|
101800
101741
|
const isAsync2 = a4.shift();
|
|
@@ -101803,7 +101744,7 @@ var require_executor = __commonJS({
|
|
|
101803
101744
|
scope = new utils.Scope(scope, {});
|
|
101804
101745
|
}
|
|
101805
101746
|
let func;
|
|
101806
|
-
if (isAsync2 ===
|
|
101747
|
+
if (isAsync2 === 89) {
|
|
101807
101748
|
func = createFunctionAsync(a4, b4, ticks, context, scope, name14);
|
|
101808
101749
|
} else {
|
|
101809
101750
|
func = createFunction(a4, b4, ticks, context, scope, name14);
|
|
@@ -101813,7 +101754,7 @@ var require_executor = __commonJS({
|
|
|
101813
101754
|
}
|
|
101814
101755
|
done(void 0, func);
|
|
101815
101756
|
});
|
|
101816
|
-
addOps(38, (
|
|
101757
|
+
addOps(38, (exec6, done, ticks, a4, b4, obj, context, scope) => {
|
|
101817
101758
|
const [checkFirst, startInternal, getIterator, startStep, step, condition, beforeStep] = a4;
|
|
101818
101759
|
let loop = true;
|
|
101819
101760
|
const loopScope = new utils.Scope(scope, {});
|
|
@@ -101869,27 +101810,26 @@ var require_executor = __commonJS({
|
|
|
101869
101810
|
done();
|
|
101870
101811
|
}
|
|
101871
101812
|
});
|
|
101872
|
-
addOps(
|
|
101813
|
+
addOps(87, (exec6, done, ticks, a4, b4, obj, context, scope, bobj, inLoopOrSwitch) => {
|
|
101873
101814
|
if (inLoopOrSwitch === "switch" && a4 === "continue" || !inLoopOrSwitch) {
|
|
101874
|
-
throw new
|
|
101815
|
+
throw new utils.SandboxError("Illegal " + a4 + " statement");
|
|
101875
101816
|
}
|
|
101876
101817
|
done(void 0, new ExecReturn(context.ctx.auditReport, void 0, false, a4 === "break", a4 === "continue"));
|
|
101877
101818
|
});
|
|
101878
|
-
addOps(13, (
|
|
101819
|
+
addOps(13, (exec6, done, ticks, a4, b4, obj, context, scope, bobj, inLoopOrSwitch) => {
|
|
101879
101820
|
exec6(ticks, valueOrProp(a4, context) ? b4.t : b4.f, scope, context, done, inLoopOrSwitch);
|
|
101880
101821
|
});
|
|
101881
|
-
addOps(15, (
|
|
101882
|
-
exec6(ticks, valueOrProp(a4, context) ? b4.t : b4.f, scope, context, done,
|
|
101822
|
+
addOps(15, (exec6, done, ticks, a4, b4, obj, context, scope, bobj, inLoopOrSwitch) => {
|
|
101823
|
+
exec6(ticks, valueOrProp(a4, context) ? b4.t : b4.f, scope, context, done, inLoopOrSwitch);
|
|
101883
101824
|
});
|
|
101884
|
-
addOps(16, (
|
|
101885
|
-
addOps(14, (
|
|
101886
|
-
addOps(40, (
|
|
101887
|
-
exec6(ticks, a4, scope, context, (
|
|
101888
|
-
if (
|
|
101889
|
-
done(
|
|
101825
|
+
addOps(16, (exec6, done, ticks, a4, b4) => done(void 0, new If(a4, b4)));
|
|
101826
|
+
addOps(14, (exec6, done, ticks, a4, b4) => done(void 0, new If(a4, b4)));
|
|
101827
|
+
addOps(40, (exec6, done, ticks, a4, b4, obj, context, scope) => {
|
|
101828
|
+
exec6(ticks, a4, scope, context, (err, toTest) => {
|
|
101829
|
+
if (err) {
|
|
101830
|
+
done(err);
|
|
101890
101831
|
return;
|
|
101891
101832
|
}
|
|
101892
|
-
let toTest = args[1];
|
|
101893
101833
|
toTest = valueOrProp(toTest, context);
|
|
101894
101834
|
if (exec6 === execSync) {
|
|
101895
101835
|
let res;
|
|
@@ -101937,79 +101877,34 @@ var require_executor = __commonJS({
|
|
|
101937
101877
|
}
|
|
101938
101878
|
});
|
|
101939
101879
|
});
|
|
101940
|
-
addOps(39, (
|
|
101880
|
+
addOps(39, (exec6, done, ticks, a4, b4, obj, context, scope, bobj, inLoopOrSwitch) => {
|
|
101941
101881
|
const [exception, catchBody, finallyBody] = b4;
|
|
101942
|
-
executeTreeWithDone(exec6, (
|
|
101943
|
-
|
|
101944
|
-
|
|
101945
|
-
|
|
101946
|
-
|
|
101947
|
-
|
|
101948
|
-
executeTreeWithDone(exec6, (...finallyArgs) => {
|
|
101949
|
-
const finallyHadError = finallyArgs.length === 1;
|
|
101950
|
-
const finallyResult = !finallyHadError && finallyArgs.length > 1 ? finallyArgs[1] : void 0;
|
|
101951
|
-
if (finallyHadError) {
|
|
101952
|
-
done(finallyArgs[0]);
|
|
101953
|
-
return;
|
|
101954
|
-
}
|
|
101955
|
-
if (finallyResult instanceof ExecReturn && (finallyResult.returned || finallyResult.breakLoop || finallyResult.continueLoop)) {
|
|
101956
|
-
done(void 0, finallyResult);
|
|
101957
|
-
return;
|
|
101958
|
-
}
|
|
101959
|
-
if (hadError) {
|
|
101960
|
-
done(errorOrResult);
|
|
101961
|
-
} else if (errorOrResult instanceof ExecReturn) {
|
|
101962
|
-
if (errorOrResult.returned || errorOrResult.breakLoop || errorOrResult.continueLoop) {
|
|
101963
|
-
done(void 0, errorOrResult);
|
|
101964
|
-
} else {
|
|
101965
|
-
done();
|
|
101966
|
-
}
|
|
101967
|
-
} else {
|
|
101968
|
-
done();
|
|
101969
|
-
}
|
|
101970
|
-
}, ticks, context, finallyBody, [new utils.Scope(scope, {})], inLoopOrSwitch);
|
|
101882
|
+
executeTreeWithDone(exec6, (err, res) => {
|
|
101883
|
+
executeTreeWithDone(exec6, (e4) => {
|
|
101884
|
+
if (e4)
|
|
101885
|
+
done(e4);
|
|
101886
|
+
else if (err) {
|
|
101887
|
+
executeTreeWithDone(exec6, done, ticks, context, catchBody, [new utils.Scope(scope)], inLoopOrSwitch);
|
|
101971
101888
|
} else {
|
|
101972
|
-
|
|
101973
|
-
done(errorOrResult);
|
|
101974
|
-
} else if (errorOrResult instanceof ExecReturn) {
|
|
101975
|
-
if (errorOrResult.returned || errorOrResult.breakLoop || errorOrResult.continueLoop) {
|
|
101976
|
-
done(void 0, errorOrResult);
|
|
101977
|
-
} else {
|
|
101978
|
-
done();
|
|
101979
|
-
}
|
|
101980
|
-
} else {
|
|
101981
|
-
done();
|
|
101982
|
-
}
|
|
101889
|
+
done(void 0, res);
|
|
101983
101890
|
}
|
|
101984
|
-
};
|
|
101985
|
-
if (tryHadError && catchBody && catchBody.length > 0) {
|
|
101986
|
-
const sc = {};
|
|
101987
|
-
if (exception)
|
|
101988
|
-
sc[exception] = tryError;
|
|
101989
|
-
executeTreeWithDone(exec6, (...catchArgs) => {
|
|
101990
|
-
const catchHadError = catchArgs.length === 1;
|
|
101991
|
-
const catchErrorOrResult = catchHadError ? catchArgs[0] : catchArgs.length > 1 ? catchArgs[1] : void 0;
|
|
101992
|
-
executeFinallyAndComplete(catchHadError, catchErrorOrResult);
|
|
101993
|
-
}, ticks, context, catchBody, [new utils.Scope(scope, sc)], inLoopOrSwitch);
|
|
101994
|
-
} else {
|
|
101995
|
-
executeFinallyAndComplete(tryHadError, tryHadError ? tryError : tryResult);
|
|
101996
|
-
}
|
|
101891
|
+
}, ticks, context, finallyBody, [new utils.Scope(scope, {})]);
|
|
101997
101892
|
}, ticks, context, a4, [new utils.Scope(scope)], inLoopOrSwitch);
|
|
101998
101893
|
});
|
|
101999
|
-
addOps(
|
|
101894
|
+
addOps(88, (exec6, done) => {
|
|
102000
101895
|
done();
|
|
102001
101896
|
});
|
|
102002
|
-
addOps(45, (
|
|
102003
|
-
if (!context.ctx.globalsWhitelist.has(a4) && !
|
|
102004
|
-
throw new utils.
|
|
101897
|
+
addOps(45, (exec6, done, ticks, a4, b4, obj, context) => {
|
|
101898
|
+
if (!context.ctx.globalsWhitelist.has(a4) && !sandboxedFunctions.has(a4)) {
|
|
101899
|
+
throw new utils.SandboxError(`Object construction not allowed: ${a4.constructor.name}`);
|
|
102005
101900
|
}
|
|
102006
101901
|
done(void 0, new a4(...b4));
|
|
102007
101902
|
});
|
|
102008
|
-
addOps(46, (
|
|
101903
|
+
addOps(46, (exec6, done, ticks, a4, b4) => {
|
|
102009
101904
|
done(b4);
|
|
102010
101905
|
});
|
|
102011
|
-
addOps(43, (
|
|
102012
|
-
addOps(0, (
|
|
101906
|
+
addOps(43, (exec6, done, ticks, a4) => done(void 0, a4.pop()));
|
|
101907
|
+
addOps(0, (exec6, done) => done());
|
|
102013
101908
|
function valueOrProp(a4, context) {
|
|
102014
101909
|
if (a4 instanceof utils.Prop)
|
|
102015
101910
|
return a4.get(context);
|
|
@@ -102027,7 +101922,13 @@ var require_executor = __commonJS({
|
|
|
102027
101922
|
function _execManySync(ticks, tree, done, scope, context, inLoopOrSwitch) {
|
|
102028
101923
|
const ret = [];
|
|
102029
101924
|
for (let i4 = 0; i4 < tree.length; i4++) {
|
|
102030
|
-
let res
|
|
101925
|
+
let res;
|
|
101926
|
+
try {
|
|
101927
|
+
res = syncDone((d4) => execSync(ticks, tree[i4], scope, context, d4, inLoopOrSwitch)).result;
|
|
101928
|
+
} catch (e4) {
|
|
101929
|
+
done(e4);
|
|
101930
|
+
return;
|
|
101931
|
+
}
|
|
102031
101932
|
if (res instanceof ExecReturn && (res.returned || res.breakLoop || res.continueLoop)) {
|
|
102032
101933
|
done(void 0, res);
|
|
102033
101934
|
return;
|
|
@@ -102067,13 +101968,13 @@ var require_executor = __commonJS({
|
|
|
102067
101968
|
let isInstant = false;
|
|
102068
101969
|
let instant;
|
|
102069
101970
|
const p4 = new Promise((resolve7, reject2) => {
|
|
102070
|
-
callback((
|
|
102071
|
-
if (
|
|
102072
|
-
reject2(
|
|
101971
|
+
callback((err, result) => {
|
|
101972
|
+
if (err)
|
|
101973
|
+
reject2(err);
|
|
102073
101974
|
else {
|
|
102074
101975
|
isInstant = true;
|
|
102075
|
-
instant =
|
|
102076
|
-
resolve7({ result
|
|
101976
|
+
instant = result;
|
|
101977
|
+
resolve7({ result });
|
|
102077
101978
|
}
|
|
102078
101979
|
});
|
|
102079
101980
|
});
|
|
@@ -102086,19 +101987,19 @@ var require_executor = __commonJS({
|
|
|
102086
101987
|
function syncDone(callback) {
|
|
102087
101988
|
let result;
|
|
102088
101989
|
let err;
|
|
102089
|
-
callback((
|
|
102090
|
-
err =
|
|
102091
|
-
result =
|
|
101990
|
+
callback((e4, r4) => {
|
|
101991
|
+
err = e4;
|
|
101992
|
+
result = r4;
|
|
102092
101993
|
});
|
|
102093
101994
|
if (err)
|
|
102094
|
-
throw err
|
|
101995
|
+
throw err;
|
|
102095
101996
|
return { result };
|
|
102096
101997
|
}
|
|
102097
101998
|
async function execAsync4(ticks, tree, scope, context, doneOriginal, inLoopOrSwitch) {
|
|
102098
101999
|
let done = doneOriginal;
|
|
102099
102000
|
const p4 = new Promise((resolve7) => {
|
|
102100
|
-
done = (
|
|
102101
|
-
doneOriginal(
|
|
102001
|
+
done = (e4, r4) => {
|
|
102002
|
+
doneOriginal(e4, r4);
|
|
102102
102003
|
resolve7();
|
|
102103
102004
|
};
|
|
102104
102005
|
});
|
|
@@ -102134,10 +102035,6 @@ var require_executor = __commonJS({
|
|
|
102134
102035
|
a4 = void 0;
|
|
102135
102036
|
}
|
|
102136
102037
|
}
|
|
102137
|
-
if (op2 === 89 && a4 !== void 0 && a4 !== null) {
|
|
102138
|
-
done(void 0, a4);
|
|
102139
|
-
return;
|
|
102140
|
-
}
|
|
102141
102038
|
let bobj;
|
|
102142
102039
|
try {
|
|
102143
102040
|
let ad;
|
|
@@ -102156,28 +102053,35 @@ var require_executor = __commonJS({
|
|
|
102156
102053
|
if (b4 === optional) {
|
|
102157
102054
|
b4 = void 0;
|
|
102158
102055
|
}
|
|
102159
|
-
|
|
102160
|
-
|
|
102161
|
-
|
|
102162
|
-
|
|
102163
|
-
|
|
102164
|
-
|
|
102165
|
-
|
|
102166
|
-
|
|
102167
|
-
|
|
102168
|
-
scope,
|
|
102169
|
-
bobj,
|
|
102170
|
-
inLoopOrSwitch,
|
|
102171
|
-
tree
|
|
102172
|
-
});
|
|
102056
|
+
if (ops.has(op2)) {
|
|
102057
|
+
try {
|
|
102058
|
+
ops.get(op2)?.(execAsync4, done, ticks, a4, b4, obj, context, scope, bobj, inLoopOrSwitch);
|
|
102059
|
+
} catch (err) {
|
|
102060
|
+
done(err);
|
|
102061
|
+
}
|
|
102062
|
+
} else {
|
|
102063
|
+
done(new SyntaxError("Unknown operator: " + op2));
|
|
102064
|
+
}
|
|
102173
102065
|
}
|
|
102174
102066
|
await p4;
|
|
102175
102067
|
}
|
|
102176
102068
|
function execSync(ticks, tree, scope, context, done, inLoopOrSwitch) {
|
|
102177
102069
|
if (!_execNoneRecurse(ticks, tree, scope, context, done, false, inLoopOrSwitch) && utils.isLisp(tree)) {
|
|
102178
102070
|
let op2 = tree[0];
|
|
102179
|
-
let obj
|
|
102180
|
-
|
|
102071
|
+
let obj;
|
|
102072
|
+
try {
|
|
102073
|
+
obj = syncDone((d4) => execSync(ticks, tree[1], scope, context, d4, inLoopOrSwitch)).result;
|
|
102074
|
+
} catch (e4) {
|
|
102075
|
+
done(e4);
|
|
102076
|
+
return;
|
|
102077
|
+
}
|
|
102078
|
+
let a4 = obj;
|
|
102079
|
+
try {
|
|
102080
|
+
a4 = obj instanceof utils.Prop ? obj.get(context) : obj;
|
|
102081
|
+
} catch (e4) {
|
|
102082
|
+
done(e4);
|
|
102083
|
+
return;
|
|
102084
|
+
}
|
|
102181
102085
|
if (op2 === 20 || op2 === 21) {
|
|
102182
102086
|
if (a4 === void 0 || a4 === null) {
|
|
102183
102087
|
done(void 0, optional);
|
|
@@ -102193,129 +102097,31 @@ var require_executor = __commonJS({
|
|
|
102193
102097
|
a4 = void 0;
|
|
102194
102098
|
}
|
|
102195
102099
|
}
|
|
102196
|
-
|
|
102197
|
-
|
|
102100
|
+
let bobj;
|
|
102101
|
+
try {
|
|
102102
|
+
bobj = syncDone((d4) => execSync(ticks, tree[2], scope, context, d4, inLoopOrSwitch)).result;
|
|
102103
|
+
} catch (e4) {
|
|
102104
|
+
done(e4);
|
|
102105
|
+
return;
|
|
102106
|
+
}
|
|
102107
|
+
let b4 = bobj;
|
|
102108
|
+
try {
|
|
102109
|
+
b4 = bobj instanceof utils.Prop ? bobj.get(context) : bobj;
|
|
102110
|
+
} catch (e4) {
|
|
102111
|
+
done(e4);
|
|
102198
102112
|
return;
|
|
102199
102113
|
}
|
|
102200
|
-
let bobj = syncDone((d4) => execSync(ticks, tree[2], scope, context, d4, inLoopOrSwitch)).result;
|
|
102201
|
-
let b4 = bobj instanceof utils.Prop ? bobj.get(context) : bobj;
|
|
102202
102114
|
if (b4 === optional) {
|
|
102203
102115
|
b4 = void 0;
|
|
102204
102116
|
}
|
|
102205
|
-
|
|
102206
|
-
op: op2,
|
|
102207
|
-
exec: execSync,
|
|
102208
|
-
done,
|
|
102209
|
-
ticks,
|
|
102210
|
-
a: a4,
|
|
102211
|
-
b: b4,
|
|
102212
|
-
obj,
|
|
102213
|
-
context,
|
|
102214
|
-
scope,
|
|
102215
|
-
bobj,
|
|
102216
|
-
inLoopOrSwitch,
|
|
102217
|
-
tree
|
|
102218
|
-
});
|
|
102219
|
-
}
|
|
102220
|
-
}
|
|
102221
|
-
function checkHaltExpectedTicks(params, expectTicks = 0) {
|
|
102222
|
-
const sandbox = params.context.ctx.sandbox;
|
|
102223
|
-
const options = params.context.ctx.options;
|
|
102224
|
-
const { ticks, scope, context, done, op: op2 } = params;
|
|
102225
|
-
if (sandbox.halted) {
|
|
102226
|
-
const sub = sandbox.subscribeResume(() => {
|
|
102227
|
-
sub.unsubscribe();
|
|
102117
|
+
if (ops.has(op2)) {
|
|
102228
102118
|
try {
|
|
102229
|
-
|
|
102230
|
-
if (!o4) {
|
|
102231
|
-
done(new SyntaxError("Unknown operator: " + op2));
|
|
102232
|
-
return;
|
|
102233
|
-
}
|
|
102234
|
-
o4(params);
|
|
102235
|
-
} catch (err) {
|
|
102236
|
-
if (options.haltOnSandboxError && err instanceof utils.SandboxError) {
|
|
102237
|
-
const sub2 = sandbox.subscribeResume(() => {
|
|
102238
|
-
sub2.unsubscribe();
|
|
102239
|
-
done(err);
|
|
102240
|
-
});
|
|
102241
|
-
sandbox.haltExecution({
|
|
102242
|
-
error: err,
|
|
102243
|
-
ticks,
|
|
102244
|
-
scope,
|
|
102245
|
-
context
|
|
102246
|
-
});
|
|
102247
|
-
} else {
|
|
102248
|
-
done(err);
|
|
102249
|
-
}
|
|
102250
|
-
}
|
|
102251
|
-
});
|
|
102252
|
-
return true;
|
|
102253
|
-
} else if (ticks.tickLimit && ticks.tickLimit <= ticks.ticks + BigInt(expectTicks)) {
|
|
102254
|
-
const sub = sandbox.subscribeResume(() => {
|
|
102255
|
-
sub.unsubscribe();
|
|
102256
|
-
try {
|
|
102257
|
-
const o4 = ops.get(op2);
|
|
102258
|
-
if (!o4) {
|
|
102259
|
-
done(new SyntaxError("Unknown operator: " + op2));
|
|
102260
|
-
return;
|
|
102261
|
-
}
|
|
102262
|
-
o4(params);
|
|
102119
|
+
ops.get(op2)?.(execSync, done, ticks, a4, b4, obj, context, scope, bobj, inLoopOrSwitch);
|
|
102263
102120
|
} catch (err) {
|
|
102264
|
-
if (context.ctx.options.haltOnSandboxError && err instanceof utils.SandboxError) {
|
|
102265
|
-
const sub2 = sandbox.subscribeResume(() => {
|
|
102266
|
-
sub2.unsubscribe();
|
|
102267
|
-
done(err);
|
|
102268
|
-
});
|
|
102269
|
-
sandbox.haltExecution({
|
|
102270
|
-
error: err,
|
|
102271
|
-
ticks,
|
|
102272
|
-
scope,
|
|
102273
|
-
context
|
|
102274
|
-
});
|
|
102275
|
-
} else {
|
|
102276
|
-
done(err);
|
|
102277
|
-
}
|
|
102278
|
-
}
|
|
102279
|
-
});
|
|
102280
|
-
const error2 = new utils.SandboxExecutionQuotaExceededError("Execution quota exceeded");
|
|
102281
|
-
sandbox.haltExecution({
|
|
102282
|
-
error: error2,
|
|
102283
|
-
ticks,
|
|
102284
|
-
scope,
|
|
102285
|
-
context
|
|
102286
|
-
});
|
|
102287
|
-
return true;
|
|
102288
|
-
}
|
|
102289
|
-
return false;
|
|
102290
|
-
}
|
|
102291
|
-
function performOp(params) {
|
|
102292
|
-
const { done, op: op2, ticks, context, scope } = params;
|
|
102293
|
-
ticks.ticks++;
|
|
102294
|
-
const sandbox = context.ctx.sandbox;
|
|
102295
|
-
if (checkHaltExpectedTicks(params)) {
|
|
102296
|
-
return;
|
|
102297
|
-
}
|
|
102298
|
-
try {
|
|
102299
|
-
const o4 = ops.get(op2);
|
|
102300
|
-
if (!o4) {
|
|
102301
|
-
done(new utils.SandboxExecutionTreeError("Unknown operator: " + op2));
|
|
102302
|
-
return;
|
|
102303
|
-
}
|
|
102304
|
-
o4(params);
|
|
102305
|
-
} catch (err) {
|
|
102306
|
-
if (context.ctx.options.haltOnSandboxError && err instanceof utils.SandboxError) {
|
|
102307
|
-
const sub = sandbox.subscribeResume(() => {
|
|
102308
|
-
sub.unsubscribe();
|
|
102309
102121
|
done(err);
|
|
102310
|
-
}
|
|
102311
|
-
sandbox.haltExecution({
|
|
102312
|
-
error: err,
|
|
102313
|
-
ticks,
|
|
102314
|
-
scope,
|
|
102315
|
-
context
|
|
102316
|
-
});
|
|
102122
|
+
}
|
|
102317
102123
|
} else {
|
|
102318
|
-
done(
|
|
102124
|
+
done(new SyntaxError("Unknown operator: " + op2));
|
|
102319
102125
|
}
|
|
102320
102126
|
}
|
|
102321
102127
|
}
|
|
@@ -102333,9 +102139,20 @@ var require_executor = __commonJS({
|
|
|
102333
102139
|
var currentTicks = { current: { ticks: BigInt(0) } };
|
|
102334
102140
|
function _execNoneRecurse(ticks, tree, scope, context, done, isAsync2, inLoopOrSwitch) {
|
|
102335
102141
|
const exec6 = isAsync2 ? execAsync4 : execSync;
|
|
102142
|
+
if (context.ctx.options.executionQuota && context.ctx.options.executionQuota <= ticks.ticks) {
|
|
102143
|
+
if (!(typeof context.ctx.options.onExecutionQuotaReached === "function" && context.ctx.options.onExecutionQuotaReached(ticks, scope, context, tree))) {
|
|
102144
|
+
done(new utils.SandboxError("Execution quota exceeded"));
|
|
102145
|
+
return true;
|
|
102146
|
+
}
|
|
102147
|
+
}
|
|
102148
|
+
ticks.ticks++;
|
|
102336
102149
|
currentTicks.current = ticks;
|
|
102337
102150
|
if (tree instanceof utils.Prop) {
|
|
102338
|
-
|
|
102151
|
+
try {
|
|
102152
|
+
done(void 0, tree.get(context));
|
|
102153
|
+
} catch (err) {
|
|
102154
|
+
done(err);
|
|
102155
|
+
}
|
|
102339
102156
|
} else if (tree === optional) {
|
|
102340
102157
|
done();
|
|
102341
102158
|
} else if (Array.isArray(tree) && !utils.isLisp(tree)) {
|
|
@@ -102350,36 +102167,27 @@ var require_executor = __commonJS({
|
|
|
102350
102167
|
execMany(ticks, exec6, tree[1], done, scope, context, inLoopOrSwitch);
|
|
102351
102168
|
} else if (tree[0] === 44) {
|
|
102352
102169
|
if (!isAsync2) {
|
|
102353
|
-
done(new
|
|
102170
|
+
done(new utils.SandboxError("Illegal use of 'await', must be inside async function"));
|
|
102354
102171
|
} else if (context.ctx.prototypeWhitelist?.has(Promise.prototype)) {
|
|
102355
|
-
execAsync4(ticks, tree[1], scope, context, async (
|
|
102356
|
-
if (
|
|
102357
|
-
done(
|
|
102172
|
+
execAsync4(ticks, tree[1], scope, context, async (e4, r4) => {
|
|
102173
|
+
if (e4)
|
|
102174
|
+
done(e4);
|
|
102358
102175
|
else
|
|
102359
102176
|
try {
|
|
102360
|
-
done(void 0, await valueOrProp(
|
|
102177
|
+
done(void 0, await valueOrProp(r4, context));
|
|
102361
102178
|
} catch (err) {
|
|
102362
102179
|
done(err);
|
|
102363
102180
|
}
|
|
102364
102181
|
}, inLoopOrSwitch).catch(done);
|
|
102365
102182
|
} else {
|
|
102366
|
-
done(new utils.
|
|
102183
|
+
done(new utils.SandboxError("Async/await is not permitted"));
|
|
102367
102184
|
}
|
|
102368
102185
|
} else if (unexecTypes.has(tree[0])) {
|
|
102369
|
-
|
|
102370
|
-
|
|
102371
|
-
|
|
102372
|
-
done
|
|
102373
|
-
|
|
102374
|
-
a: tree[1],
|
|
102375
|
-
b: tree[2],
|
|
102376
|
-
obj: tree,
|
|
102377
|
-
tree,
|
|
102378
|
-
context,
|
|
102379
|
-
scope,
|
|
102380
|
-
bobj: void 0,
|
|
102381
|
-
inLoopOrSwitch
|
|
102382
|
-
});
|
|
102186
|
+
try {
|
|
102187
|
+
ops.get(tree[0])?.(exec6, done, ticks, tree[1], tree[2], tree, context, scope, void 0, inLoopOrSwitch);
|
|
102188
|
+
} catch (err) {
|
|
102189
|
+
done(err);
|
|
102190
|
+
}
|
|
102383
102191
|
} else {
|
|
102384
102192
|
return false;
|
|
102385
102193
|
}
|
|
@@ -102432,17 +102240,15 @@ var require_executor = __commonJS({
|
|
|
102432
102240
|
let err;
|
|
102433
102241
|
const current2 = executionTree[i4];
|
|
102434
102242
|
try {
|
|
102435
|
-
execSync(ticks, current2, scope, context, (
|
|
102436
|
-
|
|
102437
|
-
|
|
102438
|
-
else
|
|
102439
|
-
res = args[1];
|
|
102243
|
+
execSync(ticks, current2, scope, context, (e4, r4) => {
|
|
102244
|
+
err = e4;
|
|
102245
|
+
res = r4;
|
|
102440
102246
|
}, inLoopOrSwitch);
|
|
102441
102247
|
} catch (e4) {
|
|
102442
|
-
err =
|
|
102248
|
+
err = e4;
|
|
102443
102249
|
}
|
|
102444
102250
|
if (err) {
|
|
102445
|
-
done(err
|
|
102251
|
+
done(err);
|
|
102446
102252
|
return;
|
|
102447
102253
|
}
|
|
102448
102254
|
if (res instanceof ExecReturn) {
|
|
@@ -102465,17 +102271,15 @@ var require_executor = __commonJS({
|
|
|
102465
102271
|
let err;
|
|
102466
102272
|
const current2 = executionTree[i4];
|
|
102467
102273
|
try {
|
|
102468
|
-
await execAsync4(ticks, current2, scope, context, (
|
|
102469
|
-
|
|
102470
|
-
|
|
102471
|
-
else
|
|
102472
|
-
res = args[1];
|
|
102274
|
+
await execAsync4(ticks, current2, scope, context, (e4, r4) => {
|
|
102275
|
+
err = e4;
|
|
102276
|
+
res = r4;
|
|
102473
102277
|
}, inLoopOrSwitch);
|
|
102474
102278
|
} catch (e4) {
|
|
102475
|
-
err =
|
|
102279
|
+
err = e4;
|
|
102476
102280
|
}
|
|
102477
102281
|
if (err) {
|
|
102478
|
-
done(err
|
|
102282
|
+
done(err);
|
|
102479
102283
|
return;
|
|
102480
102284
|
}
|
|
102481
102285
|
if (res instanceof ExecReturn) {
|
|
@@ -102506,6 +102310,7 @@ var require_executor = __commonJS({
|
|
|
102506
102310
|
exports2.executeTree = executeTree;
|
|
102507
102311
|
exports2.executeTreeAsync = executeTreeAsync;
|
|
102508
102312
|
exports2.ops = ops;
|
|
102313
|
+
exports2.sandboxedFunctions = sandboxedFunctions;
|
|
102509
102314
|
exports2.syncDone = syncDone;
|
|
102510
102315
|
}
|
|
102511
102316
|
});
|
|
@@ -102620,29 +102425,23 @@ var require_parser2 = __commonJS({
|
|
|
102620
102425
|
var expectTypes = {
|
|
102621
102426
|
splitter: {
|
|
102622
102427
|
types: {
|
|
102623
|
-
|
|
102624
|
-
opHigh: /^(\/|\*(?!\*)|%)(?!=)/,
|
|
102428
|
+
opHigh: /^(\/|\*\*|\*(?!\*)|%)(?!=)/,
|
|
102625
102429
|
op: /^(\+(?!(\+))|-(?!(-)))(?!=)/,
|
|
102626
102430
|
comparitor: /^(<=|>=|<(?!<)|>(?!>)|!==|!=(?!=)|===|==)/,
|
|
102627
|
-
|
|
102628
|
-
|
|
102629
|
-
bitwiseXor: /^(\^)(?!=)/,
|
|
102630
|
-
bitwiseOr: /^(\|(?!\|))(?!=)/,
|
|
102631
|
-
boolOpAnd: /^(&&)(?!=)/,
|
|
102632
|
-
boolOpOr: /^(\|\|(?!=)|instanceof(?![\w$])|in(?![\w$]))/,
|
|
102633
|
-
nullishCoalescing: /^\?\?(?!=)/
|
|
102431
|
+
boolOp: /^(&&|\|\||\?\?|instanceof(?![\w$])|in(?![\w$]))/,
|
|
102432
|
+
bitwise: /^(&(?!&)|\|(?!\|)|\^|<<|>>(?!>)|>>>)(?!=)/
|
|
102634
102433
|
},
|
|
102635
102434
|
next: ["modifier", "value", "prop", "incrementerBefore"]
|
|
102636
102435
|
},
|
|
102637
102436
|
inlineIf: {
|
|
102638
102437
|
types: {
|
|
102639
|
-
inlineIf: /^\?(
|
|
102438
|
+
inlineIf: /^\?(?!\?|\.(?!\d))/
|
|
102640
102439
|
},
|
|
102641
102440
|
next: ["expEnd"]
|
|
102642
102441
|
},
|
|
102643
102442
|
assignment: {
|
|
102644
102443
|
types: {
|
|
102645
|
-
assignModify: /^(
|
|
102444
|
+
assignModify: /^(-=|\+=|\/=|\*\*=|\*=|%=|\^=|&=|\|=|>>>=|>>=|<<=)/,
|
|
102646
102445
|
assign: /^(=)(?!=)/
|
|
102647
102446
|
},
|
|
102648
102447
|
next: ["modifier", "value", "prop", "incrementerBefore"]
|
|
@@ -102654,8 +102453,7 @@ var require_parser2 = __commonJS({
|
|
|
102654
102453
|
expEdge: {
|
|
102655
102454
|
types: {
|
|
102656
102455
|
call: /^(\?\.)?[(]/,
|
|
102657
|
-
incrementerAfter: /^(\+\+|--)
|
|
102658
|
-
taggedTemplate: /^`(\d+)`/
|
|
102456
|
+
incrementerAfter: /^(\+\+|--)/
|
|
102659
102457
|
},
|
|
102660
102458
|
next: ["splitter", "expEdge", "dot", "inlineIf", "expEnd"]
|
|
102661
102459
|
},
|
|
@@ -102687,7 +102485,7 @@ var require_parser2 = __commonJS({
|
|
|
102687
102485
|
types: {
|
|
102688
102486
|
createObject: /^\{/,
|
|
102689
102487
|
createArray: /^\[/,
|
|
102690
|
-
number: /^(
|
|
102488
|
+
number: /^(0x[\da-f]+(_[\da-f]+)*|(\d+(_\d+)*(\.\d+(_\d+)*)?|\.\d+(_\d+)*))(e[+-]?\d+(_\d+)*)?(n)?(?!\d)/i,
|
|
102691
102489
|
string: /^"(\d+)"/,
|
|
102692
102490
|
literal: /^`(\d+)`/,
|
|
102693
102491
|
regex: /^\/(\d+)\/r(?![\w$])/,
|
|
@@ -102795,8 +102593,6 @@ var require_parser2 = __commonJS({
|
|
|
102795
102593
|
let isOneLiner = false;
|
|
102796
102594
|
let i4;
|
|
102797
102595
|
let lastInertedSemi = false;
|
|
102798
|
-
let seenKeyword = false;
|
|
102799
|
-
let skipNextWord = false;
|
|
102800
102596
|
for (i4 = 0; i4 < part.length && !done; i4++) {
|
|
102801
102597
|
let char = part.char(i4);
|
|
102802
102598
|
if (quote === '"' || quote === "'" || quote === "`") {
|
|
@@ -102853,15 +102649,6 @@ var require_parser2 = __commonJS({
|
|
|
102853
102649
|
if (foundNumber = aNumber.exec(sub)) {
|
|
102854
102650
|
i4 += foundNumber[0].length - 1;
|
|
102855
102651
|
sub = part.substring(i4).toString();
|
|
102856
|
-
if (closingsTests) {
|
|
102857
|
-
let found;
|
|
102858
|
-
if (found = testMultiple(sub, closingsTests)) {
|
|
102859
|
-
details.regRes = found;
|
|
102860
|
-
i4++;
|
|
102861
|
-
done = true;
|
|
102862
|
-
break;
|
|
102863
|
-
}
|
|
102864
|
-
}
|
|
102865
102652
|
} else if (lastChar != char) {
|
|
102866
102653
|
let found = null;
|
|
102867
102654
|
if (char === ";" || insertedSemis[i4 + part.start] && !isStart && !lastInertedSemi) {
|
|
@@ -102885,16 +102672,6 @@ var require_parser2 = __commonJS({
|
|
|
102885
102672
|
}
|
|
102886
102673
|
if (!done && (foundWord = wordReg.exec(sub))) {
|
|
102887
102674
|
isOneLiner = true;
|
|
102888
|
-
if (foundWord[2]) {
|
|
102889
|
-
seenKeyword = true;
|
|
102890
|
-
skipNextWord = true;
|
|
102891
|
-
} else if (seenKeyword) {
|
|
102892
|
-
if (skipNextWord) {
|
|
102893
|
-
skipNextWord = false;
|
|
102894
|
-
} else {
|
|
102895
|
-
details.bodyContentAfterKeyword = true;
|
|
102896
|
-
}
|
|
102897
|
-
}
|
|
102898
102675
|
if (foundWord[0].length > 1) {
|
|
102899
102676
|
details.words.push(foundWord[1]);
|
|
102900
102677
|
details.lastAnyWord = foundWord[1];
|
|
@@ -103004,18 +102781,10 @@ var require_parser2 = __commonJS({
|
|
|
103004
102781
|
} else {
|
|
103005
102782
|
const extract3 = restOfExp(constants, str, [/^:/]);
|
|
103006
102783
|
key = lispify(constants, extract3, [...next, "spreadObject"]);
|
|
103007
|
-
if (
|
|
103008
|
-
|
|
103009
|
-
} else {
|
|
103010
|
-
if (key[0] === 1) {
|
|
103011
|
-
key = key[2];
|
|
103012
|
-
}
|
|
103013
|
-
if (str.length > extract3.length && str.char(extract3.length) === ":") {
|
|
103014
|
-
value = lispify(constants, str.substring(extract3.length + 1));
|
|
103015
|
-
} else {
|
|
103016
|
-
value = lispify(constants, extract3, next);
|
|
103017
|
-
}
|
|
102784
|
+
if (key[0] === 1) {
|
|
102785
|
+
key = key[2];
|
|
103018
102786
|
}
|
|
102787
|
+
value = lispify(constants, str.substring(extract3.length + 1));
|
|
103019
102788
|
}
|
|
103020
102789
|
return createLisp({
|
|
103021
102790
|
op: 6,
|
|
@@ -103042,72 +102811,12 @@ var require_parser2 = __commonJS({
|
|
|
103042
102811
|
};
|
|
103043
102812
|
setLispType(["inverse", "not", "negative", "positive", "typeof", "delete"], (constants, type, part, res, expect, ctx) => {
|
|
103044
102813
|
const extract2 = restOfExp(constants, part.substring(res[0].length), [/^([^\s.?\w$]|\?[^.])/]);
|
|
103045
|
-
const remainingAfterOperand = part.substring(extract2.length + res[0].length);
|
|
103046
|
-
const remainingStr = remainingAfterOperand.trim().toString();
|
|
103047
|
-
if (remainingStr.startsWith("**")) {
|
|
103048
|
-
throw new SyntaxError("Unary operator used immediately before exponentiation expression. Parenthesis must be used to disambiguate operator precedence");
|
|
103049
|
-
}
|
|
103050
102814
|
ctx.lispTree = lispify(constants, part.substring(extract2.length + res[0].length), restOfExp.next, createLisp({
|
|
103051
102815
|
op: modifierTypes[type],
|
|
103052
102816
|
a: ctx.lispTree,
|
|
103053
102817
|
b: lispify(constants, extract2, expectTypes[expect].next)
|
|
103054
102818
|
}));
|
|
103055
102819
|
});
|
|
103056
|
-
setLispType(["taggedTemplate"], (constants, type, part, res, expect, ctx) => {
|
|
103057
|
-
const literalIndex = res[1];
|
|
103058
|
-
const literal2 = constants.literals[parseInt(literalIndex)];
|
|
103059
|
-
const [, templateStr, jsExprs] = literal2;
|
|
103060
|
-
const stringParts = [];
|
|
103061
|
-
const expressions = [];
|
|
103062
|
-
let currentStr = "";
|
|
103063
|
-
let i4 = 0;
|
|
103064
|
-
while (i4 < templateStr.length) {
|
|
103065
|
-
if (templateStr.substring(i4, i4 + 2) === "${") {
|
|
103066
|
-
let j4 = i4 + 2;
|
|
103067
|
-
let exprIndex = "";
|
|
103068
|
-
let isValidPlaceholder = false;
|
|
103069
|
-
while (j4 < templateStr.length && templateStr[j4] !== "}") {
|
|
103070
|
-
exprIndex += templateStr[j4];
|
|
103071
|
-
j4++;
|
|
103072
|
-
}
|
|
103073
|
-
if (j4 < templateStr.length && templateStr[j4] === "}" && /^\d+$/.test(exprIndex)) {
|
|
103074
|
-
isValidPlaceholder = true;
|
|
103075
|
-
}
|
|
103076
|
-
if (isValidPlaceholder) {
|
|
103077
|
-
stringParts.push(currentStr);
|
|
103078
|
-
currentStr = "";
|
|
103079
|
-
expressions.push(jsExprs[parseInt(exprIndex)]);
|
|
103080
|
-
i4 = j4 + 1;
|
|
103081
|
-
} else {
|
|
103082
|
-
currentStr += templateStr[i4];
|
|
103083
|
-
i4++;
|
|
103084
|
-
}
|
|
103085
|
-
} else {
|
|
103086
|
-
currentStr += templateStr[i4];
|
|
103087
|
-
i4++;
|
|
103088
|
-
}
|
|
103089
|
-
}
|
|
103090
|
-
stringParts.push(currentStr);
|
|
103091
|
-
const stringsArray = stringParts.map((str) => createLisp({
|
|
103092
|
-
op: 2,
|
|
103093
|
-
a: 0,
|
|
103094
|
-
b: String(constants.strings.push(str) - 1)
|
|
103095
|
-
}));
|
|
103096
|
-
const stringsArrayLisp = createLisp({
|
|
103097
|
-
op: 12,
|
|
103098
|
-
a: createLisp({
|
|
103099
|
-
op: 0,
|
|
103100
|
-
a: 0,
|
|
103101
|
-
b: 0
|
|
103102
|
-
}),
|
|
103103
|
-
b: stringsArray
|
|
103104
|
-
});
|
|
103105
|
-
ctx.lispTree = lispify(constants, part.substring(res[0].length), expectTypes[expect].next, createLisp({
|
|
103106
|
-
op: 5,
|
|
103107
|
-
a: ctx.lispTree,
|
|
103108
|
-
b: [stringsArrayLisp, ...expressions]
|
|
103109
|
-
}));
|
|
103110
|
-
});
|
|
103111
102820
|
var incrementTypes = {
|
|
103112
102821
|
"++$": 25,
|
|
103113
102822
|
"--$": 27,
|
|
@@ -103132,7 +102841,7 @@ var require_parser2 = __commonJS({
|
|
|
103132
102841
|
var adderTypes = {
|
|
103133
102842
|
"&&": 29,
|
|
103134
102843
|
"||": 30,
|
|
103135
|
-
"??":
|
|
102844
|
+
"??": 85,
|
|
103136
102845
|
instanceof: 62,
|
|
103137
102846
|
in: 63,
|
|
103138
102847
|
"=": 9,
|
|
@@ -103147,12 +102856,9 @@ var require_parser2 = __commonJS({
|
|
|
103147
102856
|
"|=": 73,
|
|
103148
102857
|
">>>=": 74,
|
|
103149
102858
|
"<<=": 76,
|
|
103150
|
-
">>=": 75
|
|
103151
|
-
"&&=": 90,
|
|
103152
|
-
"||=": 91,
|
|
103153
|
-
"??=": 92
|
|
102859
|
+
">>=": 75
|
|
103154
102860
|
};
|
|
103155
|
-
setLispType(["assign", "assignModify", "
|
|
102861
|
+
setLispType(["assign", "assignModify", "boolOp"], (constants, type, part, res, expect, ctx) => {
|
|
103156
102862
|
ctx.lispTree = createLisp({
|
|
103157
102863
|
op: adderTypes[res[0]],
|
|
103158
102864
|
a: ctx.lispTree,
|
|
@@ -103179,46 +102885,20 @@ var require_parser2 = __commonJS({
|
|
|
103179
102885
|
"/": 48,
|
|
103180
102886
|
"**": 49,
|
|
103181
102887
|
"*": 50,
|
|
103182
|
-
"%": 51
|
|
103183
|
-
|
|
103184
|
-
|
|
103185
|
-
instanceof: 62,
|
|
103186
|
-
in: 63
|
|
103187
|
-
};
|
|
103188
|
-
setLispType([
|
|
103189
|
-
"power",
|
|
103190
|
-
"opHigh",
|
|
103191
|
-
"op",
|
|
103192
|
-
"comparitor",
|
|
103193
|
-
"bitwiseShift",
|
|
103194
|
-
"bitwiseAnd",
|
|
103195
|
-
"bitwiseXor",
|
|
103196
|
-
"bitwiseOr",
|
|
103197
|
-
"boolOpAnd",
|
|
103198
|
-
"boolOpOr"
|
|
103199
|
-
], (constants, type, part, res, expect, ctx) => {
|
|
102888
|
+
"%": 51
|
|
102889
|
+
};
|
|
102890
|
+
setLispType(["opHigh", "op", "comparitor", "bitwise"], (constants, type, part, res, expect, ctx) => {
|
|
103200
102891
|
const next = [expectTypes.inlineIf.types.inlineIf, inlineIfElse];
|
|
103201
102892
|
switch (type) {
|
|
103202
|
-
case "power":
|
|
103203
|
-
break;
|
|
103204
102893
|
case "opHigh":
|
|
103205
102894
|
next.push(expectTypes.splitter.types.opHigh);
|
|
103206
102895
|
case "op":
|
|
103207
102896
|
next.push(expectTypes.splitter.types.op);
|
|
103208
102897
|
case "comparitor":
|
|
103209
102898
|
next.push(expectTypes.splitter.types.comparitor);
|
|
103210
|
-
case "
|
|
103211
|
-
next.push(expectTypes.splitter.types.
|
|
103212
|
-
|
|
103213
|
-
next.push(expectTypes.splitter.types.bitwiseAnd);
|
|
103214
|
-
case "bitwiseXor":
|
|
103215
|
-
next.push(expectTypes.splitter.types.bitwiseXor);
|
|
103216
|
-
case "bitwiseOr":
|
|
103217
|
-
next.push(expectTypes.splitter.types.bitwiseOr);
|
|
103218
|
-
case "boolOpAnd":
|
|
103219
|
-
next.push(expectTypes.splitter.types.boolOpAnd);
|
|
103220
|
-
case "boolOpOr":
|
|
103221
|
-
next.push(expectTypes.splitter.types.boolOpOr);
|
|
102899
|
+
case "bitwise":
|
|
102900
|
+
next.push(expectTypes.splitter.types.bitwise);
|
|
102901
|
+
next.push(expectTypes.splitter.types.boolOp);
|
|
103222
102902
|
}
|
|
103223
102903
|
const extract2 = restOfExp(constants, part.substring(res[0].length), next);
|
|
103224
102904
|
ctx.lispTree = lispify(constants, part.substring(extract2.length + res[0].length), restOfExp.next, createLisp({
|
|
@@ -103392,11 +103072,7 @@ var require_parser2 = __commonJS({
|
|
|
103392
103072
|
prop = matches[0];
|
|
103393
103073
|
index = prop.length + res[0].length;
|
|
103394
103074
|
} else {
|
|
103395
|
-
throw new SyntaxError("Hanging
|
|
103396
|
-
}
|
|
103397
|
-
} else {
|
|
103398
|
-
if (utils.reservedWords.has(prop) && prop !== "this") {
|
|
103399
|
-
throw new SyntaxError(`Unexpected token '${prop}'`);
|
|
103075
|
+
throw new SyntaxError("Hanging dot");
|
|
103400
103076
|
}
|
|
103401
103077
|
}
|
|
103402
103078
|
ctx.lispTree = lispify(constants, part.substring(index), expectTypes[expect].next, createLisp({
|
|
@@ -103421,14 +103097,14 @@ var require_parser2 = __commonJS({
|
|
|
103421
103097
|
});
|
|
103422
103098
|
setLispType(["number", "boolean", "null", "und", "NaN", "Infinity"], (constants, type, part, res, expect, ctx) => {
|
|
103423
103099
|
ctx.lispTree = lispify(constants, part.substring(res[0].length), expectTypes[expect].next, createLisp({
|
|
103424
|
-
op: type === "number" ? res[
|
|
103100
|
+
op: type === "number" ? res[10] ? 83 : 7 : 35,
|
|
103425
103101
|
a: 0,
|
|
103426
|
-
b: res[
|
|
103102
|
+
b: res[10] ? res[1] : res[0]
|
|
103427
103103
|
}));
|
|
103428
103104
|
});
|
|
103429
103105
|
setLispType(["string", "literal", "regex"], (constants, type, part, res, expect, ctx) => {
|
|
103430
103106
|
ctx.lispTree = lispify(constants, part.substring(res[0].length), expectTypes[expect].next, createLisp({
|
|
103431
|
-
op: type === "string" ? 2 : type === "literal" ? 84 :
|
|
103107
|
+
op: type === "string" ? 2 : type === "literal" ? 84 : 86,
|
|
103432
103108
|
a: 0,
|
|
103433
103109
|
b: res[1]
|
|
103434
103110
|
}));
|
|
@@ -103453,7 +103129,7 @@ var require_parser2 = __commonJS({
|
|
|
103453
103129
|
const isArrow = type !== "function" && type !== "inlineFunction";
|
|
103454
103130
|
const isReturn = isArrow && !res[res.length - 1];
|
|
103455
103131
|
const argPos = isArrow ? 2 : 3;
|
|
103456
|
-
const isAsync2 = res[1] ?
|
|
103132
|
+
const isAsync2 = res[1] ? 89 : 0;
|
|
103457
103133
|
const args = res[argPos] ? res[argPos].replace(/\s+/g, "").split(/,/g) : [];
|
|
103458
103134
|
if (!isArrow) {
|
|
103459
103135
|
args.unshift((res[2] || "").trimStart());
|
|
@@ -103467,11 +103143,6 @@ var require_parser2 = __commonJS({
|
|
|
103467
103143
|
});
|
|
103468
103144
|
const f4 = restOfExp(constants, part.substring(res[0].length), !isReturn ? [/^}/] : [/^[,)}\]]/, semiColon]);
|
|
103469
103145
|
const func = isReturn ? "return " + f4 : f4.toString();
|
|
103470
|
-
args.forEach((arg) => {
|
|
103471
|
-
if (utils.reservedWords.has(arg.replace(/^\.\.\./, ""))) {
|
|
103472
|
-
throw new SyntaxError(`Unexpected token '${arg}'`);
|
|
103473
|
-
}
|
|
103474
|
-
});
|
|
103475
103146
|
ctx.lispTree = lispify(constants, part.substring(res[0].length + func.length + 1), expectTypes[expect].next, createLisp({
|
|
103476
103147
|
op: isArrow ? 11 : type === "function" ? 37 : 10,
|
|
103477
103148
|
a: [isAsync2, ...args],
|
|
@@ -103481,13 +103152,13 @@ var require_parser2 = __commonJS({
|
|
|
103481
103152
|
var iteratorRegex = /^((let|var|const)\s+)?\s*([a-zA-Z$_][a-zA-Z\d$_]*)\s+(in|of)(?![\w$])/;
|
|
103482
103153
|
setLispType(["for", "do", "while"], (constants, type, part, res, expect, ctx) => {
|
|
103483
103154
|
let i4 = 0;
|
|
103484
|
-
let startStep =
|
|
103155
|
+
let startStep = 89;
|
|
103485
103156
|
let startInternal = [];
|
|
103486
103157
|
let getIterator = 0;
|
|
103487
103158
|
let beforeStep = 0;
|
|
103488
|
-
let checkFirst =
|
|
103159
|
+
let checkFirst = 89;
|
|
103489
103160
|
let condition;
|
|
103490
|
-
let step =
|
|
103161
|
+
let step = 89;
|
|
103491
103162
|
let body;
|
|
103492
103163
|
switch (type) {
|
|
103493
103164
|
case "while": {
|
|
@@ -103567,7 +103238,7 @@ var require_parser2 = __commonJS({
|
|
|
103567
103238
|
});
|
|
103568
103239
|
setLispType(["loopAction"], (constants, type, part, res, expect, ctx) => {
|
|
103569
103240
|
ctx.lispTree = createLisp({
|
|
103570
|
-
op:
|
|
103241
|
+
op: 87,
|
|
103571
103242
|
a: res[1],
|
|
103572
103243
|
b: 0
|
|
103573
103244
|
});
|
|
@@ -103582,7 +103253,7 @@ var require_parser2 = __commonJS({
|
|
|
103582
103253
|
let offset2 = 0;
|
|
103583
103254
|
if (catchRes[1].startsWith("catch")) {
|
|
103584
103255
|
catchRes = catchReg.exec(part.substring(res[0].length + body.length + 1).toString());
|
|
103585
|
-
exception = catchRes[
|
|
103256
|
+
exception = catchRes[2];
|
|
103586
103257
|
catchBody = restOfExp(constants, part.substring(res[0].length + body.length + 1 + catchRes[0].length), [], "{");
|
|
103587
103258
|
offset2 = res[0].length + body.length + 1 + catchRes[0].length + catchBody.length + 1;
|
|
103588
103259
|
if ((catchRes = catchReg.exec(part.substring(offset2).toString())) && catchRes[1].startsWith("finally")) {
|
|
@@ -103605,7 +103276,7 @@ var require_parser2 = __commonJS({
|
|
|
103605
103276
|
setLispType(["void", "await"], (constants, type, part, res, expect, ctx) => {
|
|
103606
103277
|
const extract2 = restOfExp(constants, part.substring(res[0].length), [/^([^\s.?\w$]|\?[^.])/]);
|
|
103607
103278
|
ctx.lispTree = lispify(constants, part.substring(res[0].length + extract2.length), expectTypes[expect].next, createLisp({
|
|
103608
|
-
op: type === "void" ?
|
|
103279
|
+
op: type === "void" ? 88 : 44,
|
|
103609
103280
|
a: lispify(constants, extract2),
|
|
103610
103281
|
b: 0
|
|
103611
103282
|
}));
|
|
@@ -103822,7 +103493,6 @@ var require_parser2 = __commonJS({
|
|
|
103822
103493
|
let rest = str;
|
|
103823
103494
|
let sub = emptyString;
|
|
103824
103495
|
let details = {};
|
|
103825
|
-
let pendingDoWhile = false;
|
|
103826
103496
|
const inserted = insertedSemicolons.get(str.ref) || new Array(str.ref.str.length);
|
|
103827
103497
|
while ((sub = restOfExp(constants, rest, [], void 0, void 0, [colonsRegex], details)).length) {
|
|
103828
103498
|
let valid = false;
|
|
@@ -103837,12 +103507,7 @@ var require_parser2 = __commonJS({
|
|
|
103837
103507
|
const res = closingsNoInsertion.exec(rest.substring(sub.length - 1).toString());
|
|
103838
103508
|
if (res) {
|
|
103839
103509
|
if (res[2] === "while") {
|
|
103840
|
-
|
|
103841
|
-
valid = false;
|
|
103842
|
-
pendingDoWhile = true;
|
|
103843
|
-
} else {
|
|
103844
|
-
valid = true;
|
|
103845
|
-
}
|
|
103510
|
+
valid = details.lastWord !== "do";
|
|
103846
103511
|
} else {
|
|
103847
103512
|
valid = false;
|
|
103848
103513
|
}
|
|
@@ -103850,11 +103515,8 @@ var require_parser2 = __commonJS({
|
|
|
103850
103515
|
valid = false;
|
|
103851
103516
|
}
|
|
103852
103517
|
} else if (a4) {
|
|
103853
|
-
if (
|
|
103854
|
-
valid =
|
|
103855
|
-
pendingDoWhile = false;
|
|
103856
|
-
} else if (details.lastWord === "if" || details.lastWord === "while" || details.lastWord === "for" || details.lastWord === "else") {
|
|
103857
|
-
valid = !!details.bodyContentAfterKeyword;
|
|
103518
|
+
if (details.lastWord === "if" || details.lastWord === "while" || details.lastWord === "for" || details.lastWord === "else") {
|
|
103519
|
+
valid = false;
|
|
103858
103520
|
}
|
|
103859
103521
|
}
|
|
103860
103522
|
}
|
|
@@ -103916,7 +103578,6 @@ var require_parser2 = __commonJS({
|
|
|
103916
103578
|
i4++;
|
|
103917
103579
|
} else if (comment === "\n") {
|
|
103918
103580
|
comment = "";
|
|
103919
|
-
strRes.push("\n");
|
|
103920
103581
|
}
|
|
103921
103582
|
}
|
|
103922
103583
|
} else {
|
|
@@ -104025,6 +103686,8 @@ var require_SandboxExec = __commonJS({
|
|
|
104025
103686
|
var executor = require_executor();
|
|
104026
103687
|
var utils = require_utils2();
|
|
104027
103688
|
function subscribeSet(obj, name14, callback, context) {
|
|
103689
|
+
if (!(obj instanceof Object))
|
|
103690
|
+
throw new Error("Invalid subscription object, got " + (typeof obj === "object" ? "null" : typeof obj));
|
|
104028
103691
|
const names = context.setSubscriptions.get(obj) || /* @__PURE__ */ new Map();
|
|
104029
103692
|
context.setSubscriptions.set(obj, names);
|
|
104030
103693
|
const callbacks = names.get(name14) || /* @__PURE__ */ new Set();
|
|
@@ -104050,12 +103713,6 @@ var require_SandboxExec = __commonJS({
|
|
|
104050
103713
|
this.setSubscriptions = /* @__PURE__ */ new WeakMap();
|
|
104051
103714
|
this.changeSubscriptions = /* @__PURE__ */ new WeakMap();
|
|
104052
103715
|
this.sandboxFunctions = /* @__PURE__ */ new WeakMap();
|
|
104053
|
-
this.haltSubscriptions = /* @__PURE__ */ new Set();
|
|
104054
|
-
this.resumeSubscriptions = /* @__PURE__ */ new Set();
|
|
104055
|
-
this.halted = false;
|
|
104056
|
-
this.timeoutHandleCounter = 0;
|
|
104057
|
-
this.setTimeoutHandles = /* @__PURE__ */ new Map();
|
|
104058
|
-
this.setIntervalHandles = /* @__PURE__ */ new Map();
|
|
104059
103716
|
const opt = Object.assign({
|
|
104060
103717
|
audit: false,
|
|
104061
103718
|
forbidFunctionCalls: false,
|
|
@@ -104068,9 +103725,7 @@ var require_SandboxExec = __commonJS({
|
|
|
104068
103725
|
}
|
|
104069
103726
|
static get SAFE_GLOBALS() {
|
|
104070
103727
|
return {
|
|
104071
|
-
globalThis,
|
|
104072
103728
|
Function,
|
|
104073
|
-
eval,
|
|
104074
103729
|
console: {
|
|
104075
103730
|
debug: console.debug,
|
|
104076
103731
|
error: console.error,
|
|
@@ -104158,8 +103813,6 @@ var require_SandboxExec = __commonJS({
|
|
|
104158
103813
|
map3.set(proto, /* @__PURE__ */ new Set());
|
|
104159
103814
|
});
|
|
104160
103815
|
map3.set(Object, /* @__PURE__ */ new Set([
|
|
104161
|
-
"constructor",
|
|
104162
|
-
"name",
|
|
104163
103816
|
"entries",
|
|
104164
103817
|
"fromEntries",
|
|
104165
103818
|
"getOwnPropertyNames",
|
|
@@ -104185,56 +103838,20 @@ var require_SandboxExec = __commonJS({
|
|
|
104185
103838
|
subscribeSetGlobal(obj, name14, callback) {
|
|
104186
103839
|
return subscribeSet(obj, name14, callback, this);
|
|
104187
103840
|
}
|
|
104188
|
-
subscribeHalt(cb) {
|
|
104189
|
-
this.haltSubscriptions.add(cb);
|
|
104190
|
-
return {
|
|
104191
|
-
unsubscribe: () => {
|
|
104192
|
-
this.haltSubscriptions.delete(cb);
|
|
104193
|
-
}
|
|
104194
|
-
};
|
|
104195
|
-
}
|
|
104196
|
-
subscribeResume(cb) {
|
|
104197
|
-
this.resumeSubscriptions.add(cb);
|
|
104198
|
-
return {
|
|
104199
|
-
unsubscribe: () => {
|
|
104200
|
-
this.resumeSubscriptions.delete(cb);
|
|
104201
|
-
}
|
|
104202
|
-
};
|
|
104203
|
-
}
|
|
104204
|
-
haltExecution(haltContext) {
|
|
104205
|
-
if (this.halted)
|
|
104206
|
-
return;
|
|
104207
|
-
this.halted = true;
|
|
104208
|
-
for (const cb of this.haltSubscriptions) {
|
|
104209
|
-
cb(haltContext);
|
|
104210
|
-
}
|
|
104211
|
-
}
|
|
104212
|
-
resumeExecution() {
|
|
104213
|
-
if (!this.halted)
|
|
104214
|
-
return;
|
|
104215
|
-
if (this.context.ticks.tickLimit && this.context.ticks.ticks >= this.context.ticks.tickLimit) {
|
|
104216
|
-
throw new utils.SandboxExecutionQuotaExceededError("Cannot resume execution: tick limit exceeded");
|
|
104217
|
-
}
|
|
104218
|
-
this.halted = false;
|
|
104219
|
-
for (const cb of this.resumeSubscriptions) {
|
|
104220
|
-
cb();
|
|
104221
|
-
}
|
|
104222
|
-
}
|
|
104223
103841
|
getContext(fn) {
|
|
104224
103842
|
return this.sandboxFunctions.get(fn);
|
|
104225
103843
|
}
|
|
104226
103844
|
executeTree(context, scopes = []) {
|
|
104227
|
-
return executor.executeTree(
|
|
103845
|
+
return executor.executeTree({
|
|
103846
|
+
ticks: BigInt(0)
|
|
103847
|
+
}, context, context.tree, scopes);
|
|
104228
103848
|
}
|
|
104229
103849
|
executeTreeAsync(context, scopes = []) {
|
|
104230
|
-
return executor.executeTreeAsync(
|
|
103850
|
+
return executor.executeTreeAsync({
|
|
103851
|
+
ticks: BigInt(0)
|
|
103852
|
+
}, context, context.tree, scopes);
|
|
104231
103853
|
}
|
|
104232
103854
|
};
|
|
104233
|
-
exports2.LocalScope = utils.LocalScope;
|
|
104234
|
-
exports2.SandboxAccessError = utils.SandboxAccessError;
|
|
104235
|
-
exports2.SandboxCapabilityError = utils.SandboxCapabilityError;
|
|
104236
|
-
exports2.SandboxError = utils.SandboxError;
|
|
104237
|
-
exports2.SandboxExecutionTreeError = utils.SandboxExecutionTreeError;
|
|
104238
103855
|
exports2.default = SandboxExec;
|
|
104239
103856
|
}
|
|
104240
103857
|
});
|
|
@@ -104255,15 +103872,10 @@ var require_Sandbox = __commonJS({
|
|
|
104255
103872
|
sandboxedEval,
|
|
104256
103873
|
sandboxedSetTimeout,
|
|
104257
103874
|
sandboxedSetInterval,
|
|
104258
|
-
sandboxedClearTimeout,
|
|
104259
|
-
sandboxedClearInterval,
|
|
104260
103875
|
lispifyFunction: parser.lispifyFunction
|
|
104261
103876
|
};
|
|
104262
103877
|
}
|
|
104263
|
-
function SB() {
|
|
104264
|
-
}
|
|
104265
103878
|
function sandboxFunction(context, ticks) {
|
|
104266
|
-
SandboxFunction.prototype = SB.prototype;
|
|
104267
103879
|
return SandboxFunction;
|
|
104268
103880
|
function SandboxFunction(...params) {
|
|
104269
103881
|
const code = params.pop() || "";
|
|
@@ -104275,10 +103887,7 @@ var require_Sandbox = __commonJS({
|
|
|
104275
103887
|
}, void 0, "anonymous");
|
|
104276
103888
|
}
|
|
104277
103889
|
}
|
|
104278
|
-
function SAF() {
|
|
104279
|
-
}
|
|
104280
103890
|
function sandboxAsyncFunction(context, ticks) {
|
|
104281
|
-
SandboxAsyncFunction.prototype = SAF.prototype;
|
|
104282
103891
|
return SandboxAsyncFunction;
|
|
104283
103892
|
function SandboxAsyncFunction(...params) {
|
|
104284
103893
|
const code = params.pop() || "";
|
|
@@ -104290,172 +103899,25 @@ var require_Sandbox = __commonJS({
|
|
|
104290
103899
|
}, void 0, "anonymous");
|
|
104291
103900
|
}
|
|
104292
103901
|
}
|
|
104293
|
-
function
|
|
104294
|
-
}
|
|
104295
|
-
function sandboxedEval(func, context) {
|
|
104296
|
-
sandboxEval.prototype = SE.prototype;
|
|
103902
|
+
function sandboxedEval(func) {
|
|
104297
103903
|
return sandboxEval;
|
|
104298
103904
|
function sandboxEval(code) {
|
|
104299
|
-
|
|
104300
|
-
const tree = wrapLastStatementInReturn(parsed.tree);
|
|
104301
|
-
return executor.createFunction([], tree, executor.currentTicks.current, {
|
|
104302
|
-
...context,
|
|
104303
|
-
constants: parsed.constants,
|
|
104304
|
-
tree
|
|
104305
|
-
}, void 0, "anonymous")();
|
|
104306
|
-
}
|
|
104307
|
-
}
|
|
104308
|
-
function wrapLastStatementInReturn(tree) {
|
|
104309
|
-
if (tree.length === 0)
|
|
104310
|
-
return tree;
|
|
104311
|
-
const newTree = [...tree];
|
|
104312
|
-
const lastIndex = newTree.length - 1;
|
|
104313
|
-
const lastStmt = newTree[lastIndex];
|
|
104314
|
-
if (Array.isArray(lastStmt) && lastStmt.length >= 1) {
|
|
104315
|
-
const op2 = lastStmt[0];
|
|
104316
|
-
if (op2 === 8 || op2 === 46) {
|
|
104317
|
-
return newTree;
|
|
104318
|
-
}
|
|
104319
|
-
const statementTypes = [
|
|
104320
|
-
3,
|
|
104321
|
-
// 3
|
|
104322
|
-
4,
|
|
104323
|
-
// 4
|
|
104324
|
-
34,
|
|
104325
|
-
// 35
|
|
104326
|
-
37,
|
|
104327
|
-
// 38
|
|
104328
|
-
13,
|
|
104329
|
-
// 14
|
|
104330
|
-
38,
|
|
104331
|
-
// 39
|
|
104332
|
-
39,
|
|
104333
|
-
// 40
|
|
104334
|
-
40,
|
|
104335
|
-
// 41
|
|
104336
|
-
42,
|
|
104337
|
-
// 43
|
|
104338
|
-
43
|
|
104339
|
-
// 44
|
|
104340
|
-
];
|
|
104341
|
-
if (statementTypes.includes(op2)) {
|
|
104342
|
-
return newTree;
|
|
104343
|
-
}
|
|
104344
|
-
newTree[lastIndex] = [8, 0, lastStmt];
|
|
104345
|
-
}
|
|
104346
|
-
return newTree;
|
|
104347
|
-
}
|
|
104348
|
-
function sST() {
|
|
104349
|
-
}
|
|
104350
|
-
function sandboxedSetTimeout(func, context) {
|
|
104351
|
-
sandboxSetTimeout.prototype = sST.prototype;
|
|
104352
|
-
return sandboxSetTimeout;
|
|
104353
|
-
function sandboxSetTimeout(handler, timeout, ...args) {
|
|
104354
|
-
const sandbox = context.ctx.sandbox;
|
|
104355
|
-
const exec6 = (...a4) => {
|
|
104356
|
-
const h4 = typeof handler === "string" ? func(handler) : handler;
|
|
104357
|
-
haltsub.unsubscribe();
|
|
104358
|
-
contsub.unsubscribe();
|
|
104359
|
-
sandbox.setTimeoutHandles.delete(sandBoxhandle);
|
|
104360
|
-
return h4(...a4);
|
|
104361
|
-
};
|
|
104362
|
-
const sandBoxhandle = ++sandbox.timeoutHandleCounter;
|
|
104363
|
-
let start = Date.now();
|
|
104364
|
-
let handle = setTimeout(exec6, timeout, ...args);
|
|
104365
|
-
let elapsed = 0;
|
|
104366
|
-
const haltsub = sandbox.subscribeHalt(() => {
|
|
104367
|
-
elapsed = Date.now() - start + elapsed;
|
|
104368
|
-
clearTimeout(handle);
|
|
104369
|
-
});
|
|
104370
|
-
const contsub = sandbox.subscribeResume(() => {
|
|
104371
|
-
start = Date.now();
|
|
104372
|
-
const remaining = Math.floor((timeout || 0) - elapsed);
|
|
104373
|
-
handle = setTimeout(exec6, remaining, ...args);
|
|
104374
|
-
sandbox.setTimeoutHandles.set(sandBoxhandle, {
|
|
104375
|
-
handle,
|
|
104376
|
-
haltsub,
|
|
104377
|
-
contsub
|
|
104378
|
-
});
|
|
104379
|
-
});
|
|
104380
|
-
sandbox.setTimeoutHandles.set(sandBoxhandle, {
|
|
104381
|
-
handle,
|
|
104382
|
-
haltsub,
|
|
104383
|
-
contsub
|
|
104384
|
-
});
|
|
104385
|
-
return sandBoxhandle;
|
|
104386
|
-
}
|
|
104387
|
-
}
|
|
104388
|
-
function sCT() {
|
|
104389
|
-
}
|
|
104390
|
-
function sandboxedClearTimeout(context) {
|
|
104391
|
-
sandboxClearTimeout.prototype = sCT.prototype;
|
|
104392
|
-
return sandboxClearTimeout;
|
|
104393
|
-
function sandboxClearTimeout(handle) {
|
|
104394
|
-
const sandbox = context.ctx.sandbox;
|
|
104395
|
-
const timeoutHandle = sandbox.setTimeoutHandles.get(handle);
|
|
104396
|
-
if (timeoutHandle) {
|
|
104397
|
-
clearTimeout(timeoutHandle.handle);
|
|
104398
|
-
timeoutHandle.haltsub.unsubscribe();
|
|
104399
|
-
timeoutHandle.contsub.unsubscribe();
|
|
104400
|
-
sandbox.setTimeoutHandles.delete(handle);
|
|
104401
|
-
}
|
|
103905
|
+
return func(code)();
|
|
104402
103906
|
}
|
|
104403
103907
|
}
|
|
104404
|
-
function
|
|
104405
|
-
|
|
104406
|
-
|
|
104407
|
-
|
|
104408
|
-
|
|
104409
|
-
|
|
104410
|
-
const sandbox = context.ctx.sandbox;
|
|
104411
|
-
const intervalHandle = sandbox.setIntervalHandles.get(handle);
|
|
104412
|
-
if (intervalHandle) {
|
|
104413
|
-
clearInterval(intervalHandle.handle);
|
|
104414
|
-
intervalHandle.haltsub.unsubscribe();
|
|
104415
|
-
intervalHandle.contsub.unsubscribe();
|
|
104416
|
-
sandbox.setIntervalHandles.delete(handle);
|
|
104417
|
-
}
|
|
104418
|
-
}
|
|
104419
|
-
}
|
|
104420
|
-
function sSI() {
|
|
103908
|
+
function sandboxedSetTimeout(func) {
|
|
103909
|
+
return function sandboxSetTimeout(handler, ...args) {
|
|
103910
|
+
if (typeof handler !== "string")
|
|
103911
|
+
return setTimeout(handler, ...args);
|
|
103912
|
+
return setTimeout(func(handler), ...args);
|
|
103913
|
+
};
|
|
104421
103914
|
}
|
|
104422
|
-
function sandboxedSetInterval(func
|
|
104423
|
-
sandboxSetInterval
|
|
104424
|
-
|
|
104425
|
-
|
|
104426
|
-
|
|
104427
|
-
|
|
104428
|
-
const exec6 = (...a4) => {
|
|
104429
|
-
start = Date.now();
|
|
104430
|
-
elapsed = 0;
|
|
104431
|
-
return h4(...a4);
|
|
104432
|
-
};
|
|
104433
|
-
const sandBoxhandle = ++sandbox.timeoutHandleCounter;
|
|
104434
|
-
let start = Date.now();
|
|
104435
|
-
let handle = setInterval(exec6, timeout, ...args);
|
|
104436
|
-
let elapsed = 0;
|
|
104437
|
-
const haltsub = sandbox.subscribeHalt(() => {
|
|
104438
|
-
elapsed = Date.now() - start + elapsed;
|
|
104439
|
-
clearInterval(handle);
|
|
104440
|
-
});
|
|
104441
|
-
const contsub = sandbox.subscribeResume(() => {
|
|
104442
|
-
start = Date.now();
|
|
104443
|
-
handle = setTimeout(() => {
|
|
104444
|
-
start = Date.now();
|
|
104445
|
-
elapsed = 0;
|
|
104446
|
-
handle = setInterval(exec6, timeout, ...args);
|
|
104447
|
-
exec6(...args);
|
|
104448
|
-
}, Math.floor((timeout || 0) - elapsed), ...args);
|
|
104449
|
-
handlObj.handle = handle;
|
|
104450
|
-
});
|
|
104451
|
-
const handlObj = {
|
|
104452
|
-
handle,
|
|
104453
|
-
haltsub,
|
|
104454
|
-
contsub
|
|
104455
|
-
};
|
|
104456
|
-
sandbox.setIntervalHandles.set(sandBoxhandle, handlObj);
|
|
104457
|
-
return sandBoxhandle;
|
|
104458
|
-
}
|
|
103915
|
+
function sandboxedSetInterval(func) {
|
|
103916
|
+
return function sandboxSetInterval(handler, ...args) {
|
|
103917
|
+
if (typeof handler !== "string")
|
|
103918
|
+
return setInterval(handler, ...args);
|
|
103919
|
+
return setInterval(func(handler), ...args);
|
|
103920
|
+
};
|
|
104459
103921
|
}
|
|
104460
103922
|
var Sandbox2 = class extends SandboxExec.default {
|
|
104461
103923
|
constructor(options) {
|
|
@@ -104514,11 +103976,6 @@ var require_Sandbox = __commonJS({
|
|
|
104514
103976
|
return exec6;
|
|
104515
103977
|
}
|
|
104516
103978
|
};
|
|
104517
|
-
exports2.LocalScope = utils.LocalScope;
|
|
104518
|
-
exports2.SandboxAccessError = utils.SandboxAccessError;
|
|
104519
|
-
exports2.SandboxCapabilityError = utils.SandboxCapabilityError;
|
|
104520
|
-
exports2.SandboxError = utils.SandboxError;
|
|
104521
|
-
exports2.SandboxExecutionTreeError = utils.SandboxExecutionTreeError;
|
|
104522
103979
|
exports2.default = Sandbox2;
|
|
104523
103980
|
}
|
|
104524
103981
|
});
|