ecma-evaluator 2.0.8 → 2.0.9

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.
@@ -720,7 +720,11 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
720
720
  property
721
721
  ]));
722
722
  }
723
- return object[property];
723
+ var result = object[property];
724
+ if (result === Function || result === Function.prototype) throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
725
+ "Function constructor"
726
+ ]));
727
+ return result;
724
728
  }
725
729
  },
726
730
  {
@@ -819,6 +823,11 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
819
823
  return result;
820
824
  }();
821
825
  var target = "MemberExpression" === node.callee.type ? this.visit(node.callee.object) : null;
826
+ if (args.some(function(arg) {
827
+ return arg === Function;
828
+ })) throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
829
+ "Function constructor"
830
+ ]));
822
831
  if ("function" != typeof func) {
823
832
  var calledString = getNodeString(node.callee);
824
833
  throw new TypeError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_FUNCTION, [
@@ -1 +1 @@
1
- {"version":3,"file":"cjs/index.cjs","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../src/block.js","../../src/Evaluator.js","../../src/TemplateParser.js","../../src/index.js"],"sourcesContent":["__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const mutableMethods = [\n\t\"Array.prototype.push\",\n\t\"Array.prototype.pop\",\n\t\"Array.prototype.shift\",\n\t\"Array.prototype.unshift\",\n\t\"Array.prototype.splice\",\n\t\"Array.prototype.reverse\",\n\t\"Array.prototype.sort\",\n\t\"Array.prototype.fill\",\n\t\"Array.prototype.copyWithin\",\n\n\t\"Object.defineProperty\",\n\t\"Object.defineProperties\",\n\t\"Object.preventExtensions\",\n\t\"Object.seal\",\n\t\"Object.freeze\",\n\t\"Object.setPrototypeOf\",\n\t\"Object.assign\",\n\t\"Object.prototype.__defineGetter__\",\n\t\"Object.prototype.__defineSetter__\",\n\n\t\"Reflect.set\",\n\t\"Reflect.defineProperty\",\n\t\"Reflect.deleteProperty\",\n\t\"Reflect.setPrototypeOf\",\n\t\"Reflect.preventExtensions\",\n\n\t\"Set.prototype.add\",\n\t\"Set.prototype.delete\",\n\t\"Set.prototype.clear\",\n\t\"WeakSet.prototype.add\",\n\t\"WeakSet.prototype.delete\",\n\n\t\"Map.prototype.set\",\n\t\"Map.prototype.delete\",\n\t\"Map.prototype.clear\",\n\t\"WeakMap.prototype.set\",\n\t\"WeakMap.prototype.delete\",\n\n\t\"Date.prototype.setTime\",\n\t\"Date.prototype.setMilliseconds\",\n\t\"Date.prototype.setUTCSeconds\",\n\t\"Date.prototype.setSeconds\",\n\t\"Date.prototype.setMinutes\",\n\t\"Date.prototype.setHours\",\n\t\"Date.prototype.setDate\",\n\t\"Date.prototype.setMonth\",\n\t\"Date.prototype.setFullYear\",\n\t\"Date.prototype.setYear\",\n\t\"Date.prototype.setUTCMilliseconds\",\n\t\"Date.prototype.setUTCMinutes\",\n\t\"Date.prototype.setUTCHours\",\n\t\"Date.prototype.setUTCDate\",\n\t\"Date.prototype.setUTCMonth\",\n\t\"Date.prototype.setUTCFullYear\",\n\n\t\"RegExp.prototype.compile\",\n\n\t\"Int8Array.prototype.set\",\n\t\"Uint8Array.prototype.set\",\n\t\"Uint8ClampedArray.prototype.set\",\n\t\"Int16Array.prototype.set\",\n\t\"Uint16Array.prototype.set\",\n\t\"Int32Array.prototype.set\",\n\t\"Uint32Array.prototype.set\",\n\t\"Float32Array.prototype.set\",\n\t\"Float64Array.prototype.set\",\n\t\"BigInt64Array.prototype.set\",\n\t\"BigUint64Array.prototype.set\",\n\n\t\"Int8Array.prototype.fill\",\n\t\"Uint8Array.prototype.fill\",\n\t\"Uint8ClampedArray.prototype.fill\",\n\t\"Int16Array.prototype.fill\",\n\t\"Uint16Array.prototype.fill\",\n\t\"Int32Array.prototype.fill\",\n\t\"Uint32Array.prototype.fill\",\n\t\"Float32Array.prototype.fill\",\n\t\"Float64Array.prototype.fill\",\n\t\"BigInt64Array.prototype.fill\",\n\t\"BigUint64Array.prototype.fill\",\n\n\t\"Int8Array.prototype.reverse\",\n\t\"Uint8Array.prototype.reverse\",\n\t\"Uint8ClampedArray.prototype.reverse\",\n\t\"Int16Array.prototype.reverse\",\n\t\"Uint16Array.prototype.reverse\",\n\t\"Int32Array.prototype.reverse\",\n\t\"Uint32Array.prototype.reverse\",\n\t\"Float32Array.prototype.reverse\",\n\t\"Float64Array.prototype.reverse\",\n\t\"BigInt64Array.prototype.reverse\",\n\t\"BigUint64Array.prototype.reverse\",\n\n\t\"Int8Array.prototype.sort\",\n\t\"Uint8Array.prototype.sort\",\n\t\"Uint8ClampedArray.prototype.sort\",\n\t\"Int16Array.prototype.sort\",\n\t\"Uint16Array.prototype.sort\",\n\t\"Int32Array.prototype.sort\",\n\t\"Uint32Array.prototype.sort\",\n\t\"Float32Array.prototype.sort\",\n\t\"Float64Array.prototype.sort\",\n\t\"BigInt64Array.prototype.sort\",\n\t\"BigUint64Array.prototype.sort\",\n\n\t\"Int8Array.prototype.copyWithin\",\n\t\"Uint8Array.prototype.copyWithin\",\n\t\"Uint8ClampedArray.prototype.copyWithin\",\n\t\"Int16Array.prototype.copyWithin\",\n\t\"Uint16Array.prototype.copyWithin\",\n\t\"Int32Array.prototype.copyWithin\",\n\t\"Uint32Array.prototype.copyWithin\",\n\t\"Float32Array.prototype.copyWithin\",\n\t\"Float64Array.prototype.copyWithin\",\n\t\"BigInt64Array.prototype.copyWithin\",\n\t\"BigUint64Array.prototype.copyWithin\",\n\n\t\"ArrayBuffer.prototype.transfer\",\n\t\"ArrayBuffer.prototype.transferToFixedLength\",\n\n\t\"SharedArrayBuffer.prototype.grow\",\n\n\t\"DataView.prototype.setInt8\",\n\t\"DataView.prototype.setUint8\",\n\t\"DataView.prototype.setInt16\",\n\t\"DataView.prototype.setUint16\",\n\t\"DataView.prototype.setInt32\",\n\t\"DataView.prototype.setUint32\",\n\t\"DataView.prototype.setFloat32\",\n\t\"DataView.prototype.setFloat64\",\n\t\"DataView.prototype.setBigInt64\",\n\t\"DataView.prototype.setBigUint64\",\n\n\t\"Promise.prototype.catch\",\n\t\"Promise.prototype.finally\",\n\n\t\"Generator.prototype.next\",\n\t\"Generator.prototype.return\",\n\t\"Generator.prototype.throw\",\n\n\t\"AsyncGenerator.prototype.next\",\n\t\"AsyncGenerator.prototype.return\",\n\t\"AsyncGenerator.prototype.throw\",\n\n\t\"Iterator.prototype.next\",\n\n\t\"WeakRef.prototype.deref\",\n\n\t\"FinalizationRegistry.prototype.register\",\n\t\"FinalizationRegistry.prototype.unregister\",\n\n\t\"URLSearchParams.prototype.append\",\n\t\"URLSearchParams.prototype.delete\",\n\t\"URLSearchParams.prototype.set\",\n\t\"URLSearchParams.prototype.sort\",\n\n\t\"FormData.prototype.append\",\n\t\"FormData.prototype.delete\",\n\t\"FormData.prototype.set\",\n\n\t\"Headers.prototype.append\",\n\t\"Headers.prototype.delete\",\n\t\"Headers.prototype.set\",\n\n\t// Function call/apply/bind can be used to invoke with arbitrary `this`\n\t\"Function.prototype.call\",\n\t\"Function.prototype.apply\",\n\t\"Function.prototype.bind\",\n\t\"Function.prototype.constructor\",\n\n\t// Legacy lookup helpers\n\t\"Object.prototype.__lookupGetter__\",\n\t\"Object.prototype.__lookupSetter__\",\n\n\t// Constructor property can be abused to retrieve the Function constructor\n\t\"Object.prototype.constructor\",\n];\n\nconst dangerousMethods = [\n\t\"Object.getPrototypeOf\",\n\t// Various reflective/object-inspection APIs that may expose internals\n\t\"Object.getOwnPropertyDescriptor\",\n\t\"Object.getOwnPropertyDescriptors\",\n\t\"Object.getOwnPropertyNames\",\n\t\"Object.getOwnPropertySymbols\",\n\t\"Object.getOwnPropertyDescriptors\",\n];\n\n// Some prototype-style aliases/properties that can be used to break sandboxes\nmutableMethods.push(\"Object.prototype.__proto__\");\n\n/**\n * List of methods to block due to mutability or dangerousness\n */\nexport const blockedMethods = [...mutableMethods, ...dangerousMethods];\n\n/**\n * List of global built-ins to block entirely\n */\nexport const blockedGlobalBuiltIns = [\n\t\"Function\",\n\t\"GeneratorFunction\",\n\t\"AsyncFunction\",\n\t\"AsyncGeneratorFunction\",\n\t\"eval\",\n\t\"setTimeout\",\n\t\"setInterval\",\n\t\"clearTimeout\",\n\t\"clearInterval\",\n\t\"setImmediate\",\n\t\"XMLHttpRequest\",\n\t\"fetch\",\n\t\"WebSocket\",\n\t\"globalThis\",\n\n\t// Node / runtime globals\n\t\"process\",\n\t\"require\",\n\t\"module\",\n\t\"exports\",\n\t\"global\",\n\t\"Buffer\",\n\t\"setImmediate\",\n\t\"clearImmediate\",\n\n\t// Worker / threading / messaging\n\t\"importScripts\",\n\t\"Worker\",\n\t\"SharedWorker\",\n\t\"ServiceWorker\",\n\t\"BroadcastChannel\",\n\t\"MessageChannel\",\n\t\"MessagePort\",\n\t\"postMessage\",\n\n\t// Host environment globals (browser)\n\t\"window\",\n\t\"document\",\n\t\"navigator\",\n\t\"location\",\n\t\"localStorage\",\n\t\"sessionStorage\",\n\t\"indexedDB\",\n\t\"performance\",\n\n\t// Low-level / concurrent / binary APIs\n\t\"Proxy\",\n\t\"Reflect\",\n\t\"Atomics\",\n\t\"WebAssembly\",\n\n\t// Console and internationalization\n\t\"console\",\n\t\"Intl\",\n\n\t// Other runtimes\n\t\"Deno\",\n];\n","import * as acorn from \"acorn\";\nimport globals from \"globals\";\nimport { blockedGlobalBuiltIns, blockedMethods } from \"./block.js\";\n\n// Error message constants for better maintainability\nconst ERROR_MESSAGES = {\n\tCAN_NOT_READ_PROPERTY: \"Cannot read property of {0} (reading '{1}')\",\n\tIS_INVALID_SYNTAX: \"{0} is not a valid syntax\",\n\tIS_NOT_FUNCTION: \"{0} is not a function\",\n\tIS_NOT_DEFINED: \"{0} is not defined\",\n\tIS_NOT_ALLOWED: \"{0} is not allowed\",\n};\n\n/**\n * Renders an error message by replacing placeholders with context values.\n * @param {string} template\n * @param {Record<string, any>} context\n * @example\n * ```js\n * const msg = renderErrorMessage(\"Cannot call mutable prototype method: {method}\", { method: \"push\" });\n * ```\n */\nconst renderErrorMessage = (template, context = {}) => template.replace(/{(\\w+)}/g, (_, key) => String(context[key]));\n\nconst BINARY_OPERATION_MAP = {\n\t\"+\": (a, b) => a + b,\n\t\"-\": (a, b) => a - b,\n\t\"*\": (a, b) => a * b,\n\t\"**\": (a, b) => a ** b,\n\t\"==\": (a, b) => a == b,\n\t\"===\": (a, b) => a === b,\n\t\"!=\": (a, b) => a != b,\n\t\"!==\": (a, b) => a !== b,\n\t\">\": (a, b) => a > b,\n\t\">=\": (a, b) => a >= b,\n\t\"<\": (a, b) => a < b,\n\t\"<=\": (a, b) => a <= b,\n\t\"%\": (a, b) => a % b,\n\t\"/\": (a, b) => a / b,\n\t\"|\": (a, b) => a | b,\n\t\"&\": (a, b) => a & b,\n\t\"^\": (a, b) => a ^ b,\n\t\"<<\": (a, b) => a << b,\n\t\">>\": (a, b) => a >> b,\n\t\">>>\": (a, b) => a >>> b,\n\tin: (a, b) => a in b,\n\tinstanceof: (a, b) => a instanceof b,\n};\n\nfunction createGlobalScope() {\n\tconst scope = Object.create(null);\n\tconst { builtin } = globals;\n\n\tfor (const key in builtin) {\n\t\tif (blockedGlobalBuiltIns.includes(key)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t/** @type {boolean} */\n\t\tconst isWritable = builtin[key];\n\n\t\tObject.defineProperty(scope, key, {\n\t\t\tvalue: globalThis[key],\n\t\t\twritable: isWritable,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(scope, \"globalThis\", {\n\t\tvalue: scope,\n\t\twritable: false,\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t});\n\n\treturn scope;\n}\n\nconst getBlockedMethods = (() => {\n\t/**\n\t * @type {Map<Function, string>}\n\t */\n\tlet BLOCKED_METHODS = null;\n\n\treturn () => {\n\t\tif (BLOCKED_METHODS) return BLOCKED_METHODS;\n\n\t\tconst map = new Map();\n\t\tfor (const path of blockedMethods) {\n\t\t\tconst [object, ...properties] = path.split(\".\");\n\t\t\tlet current = globalThis[object];\n\t\t\tfor (const prop of properties) {\n\t\t\t\tif (current && Object.hasOwn(current, prop)) {\n\t\t\t\t\tcurrent = current[prop];\n\t\t\t\t} else {\n\t\t\t\t\tcurrent = null;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof current === \"function\") map.set(current, path);\n\t\t}\n\t\tBLOCKED_METHODS = map;\n\n\t\treturn BLOCKED_METHODS;\n\t};\n})();\n\n/**\n * A JavaScript expression evaluator that safely evaluates expressions within a sandboxed environment.\n * Supports various JavaScript features including arithmetic, logical operations, functions, and more.\n *\n * Security features:\n * - Blocks mutable methods to prevent side effects\n * - No access to eval() or Function() constructor\n * - Sandboxed scope with limited global objects\n *\n * @example\n * const evaluator = new Evaluator({ x: 10, y: 20 });\n * evaluator.evaluate('x + y') // returns 30\n */\nexport class Evaluator {\n\t/**\n\t * Creates a new Evaluator instance with a custom variable context.\n\t * The scope hierarchy is: user variables -> global scope\n\t * @param {Object} [variables={}] - An optional object containing variables to make available in the evaluation context\n\t */\n\tconstructor(variables = Object.create(null)) {\n\t\tthis.scopes = [structuredClone(variables), createGlobalScope()].filter((scope) => scope !== null && scope !== undefined);\n\t\tthis.source = undefined;\n\t}\n\n\t/**\n\t * Evaluates a JavaScript expression with an optional context.\n\t * @param {string} expression\n\t * @param {unknown} [context]\n\t * @returns\n\t */\n\tstatic evaluate(expression, context) {\n\t\tconst evaluator = new Evaluator(context);\n\t\treturn evaluator.evaluate(expression);\n\t}\n\n\t/**\n\t * Parses and evaluates a JavaScript expression using acorn parser.\n\t * @param {string} expression - The JavaScript expression to evaluate\n\t * @returns {*} The result of the evaluation\n\t * @throws {SyntaxError} If the expression has invalid syntax\n\t * @throws {ReferenceError} If referencing undefined variables\n\t * @throws {TypeError} If performing invalid operations\n\t */\n\tevaluate(expression) {\n\t\tthis.source = expression;\n\n\t\tconst ast = acorn.parse(expression, { ecmaVersion: \"latest\" });\n\n\t\t// Start recursive evaluation from the root node\n\t\ttry {\n\t\t\treturn this.execute(ast.body);\n\t\t} finally {\n\t\t\tthis.source = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Executes an array of AST body nodes sequentially.\n\t * @private\n\t * @param {Array} body - Array of AST nodes to execute\n\t * @returns {*} The result of the last executed node\n\t */\n\texecute(body) {\n\t\tlet result;\n\n\t\tfor (const node of body) {\n\t\t\tresult = this.visit(node);\n\t\t}\n\n\t\tif (typeof result === \"function\") {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning functions from expressions\"]));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Visits an AST node and delegates to the appropriate handler based on node type.\n\t * @private\n\t * @param {import(\"acorn\").Node} node - The AST node to visit\n\t * @returns {*} The result of visiting the node\n\t */\n\tvisit(node) {\n\t\tswitch (node.type) {\n\t\t\tcase \"ExpressionStatement\": {\n\t\t\t\treturn this.visit(node.expression);\n\t\t\t}\n\t\t\tcase \"BinaryExpression\": {\n\t\t\t\treturn this.handleBinaryExpression(node);\n\t\t\t}\n\t\t\tcase \"LogicalExpression\": {\n\t\t\t\treturn this.handleLogicalExpression(node);\n\t\t\t}\n\t\t\tcase \"UnaryExpression\": {\n\t\t\t\treturn this.handleUnaryExpression(node);\n\t\t\t}\n\t\t\tcase \"Identifier\": {\n\t\t\t\treturn this.handleIdentifier(node);\n\t\t\t}\n\t\t\tcase \"Literal\": {\n\t\t\t\treturn node.value;\n\t\t\t}\n\t\t\tcase \"MemberExpression\": {\n\t\t\t\treturn this.handleMemberExpression(node);\n\t\t\t}\n\t\t\tcase \"ArrayExpression\": {\n\t\t\t\treturn this.handleArrayExpression(node);\n\t\t\t}\n\t\t\tcase \"SpreadElement\": {\n\t\t\t\treturn this.handleSpreadElement(node);\n\t\t\t}\n\t\t\tcase \"ObjectExpression\": {\n\t\t\t\treturn this.handleObjectExpression(node);\n\t\t\t}\n\t\t\tcase \"FunctionExpression\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function expression\"]));\n\t\t\t}\n\t\t\tcase \"ArrowFunctionExpression\": {\n\t\t\t\treturn this.handleArrowFunctionExpression(node);\n\t\t\t}\n\t\t\tcase \"CallExpression\": {\n\t\t\t\treturn this.handleCallExpression(node);\n\t\t\t}\n\t\t\tcase \"ConditionalExpression\": {\n\t\t\t\treturn this.visit(node.test) ? this.visit(node.consequent) : this.visit(node.alternate);\n\t\t\t}\n\t\t\tcase \"NewExpression\": {\n\t\t\t\tif (node.callee.type !== \"Identifier\") {\n\t\t\t\t\tthrow new Error(`Unsupported callee type '${node.callee.type}' in new expression`);\n\t\t\t\t}\n\n\t\t\t\tif (node.callee.name === \"Function\") {\n\t\t\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"new Function() constructor\"]));\n\t\t\t\t}\n\n\t\t\t\tconst Constructor = this.visit(node.callee);\n\n\t\t\t\t// 仅在存在参数时构建数组\n\t\t\t\tconst args = node.arguments.length ? node.arguments.map((arg) => this.visit(arg)) : [];\n\n\t\t\t\treturn new Constructor(...args);\n\t\t\t}\n\t\t\tcase \"ChainExpression\": {\n\t\t\t\treturn this.visit(node.expression);\n\t\t\t}\n\t\t\tcase \"TemplateLiteral\": {\n\t\t\t\treturn this.handleTemplateLiteral(node);\n\t\t\t}\n\t\t\tcase \"ThisExpression\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'this' expression\"]));\n\t\t\t}\n\t\t\tcase \"WithStatement\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'with' statement\"]));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tlet content = this.source.slice(node.start, node.end);\n\n\t\t\t\tif (content.length > 20) {\n\t\t\t\t\tcontent = content.slice(0, 17) + \"...\";\n\t\t\t\t}\n\n\t\t\t\tthrow new SyntaxError(`'${content}'` + \" \" + renderErrorMessage(ERROR_MESSAGES.IS_INVALID_SYNTAX, [content]));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles binary expressions (arithmetic and comparison operations).\n\t * @param {import('acorn').BinaryExpression} node\n\t * @private\n\t */\n\thandleBinaryExpression(node) {\n\t\tconst op = node.operator;\n\t\tconst left = this.visit(node.left);\n\t\tconst right = this.visit(node.right);\n\n\t\tif (BINARY_OPERATION_MAP.hasOwnProperty(op)) {\n\t\t\treturn BINARY_OPERATION_MAP[op](left, right);\n\t\t}\n\n\t\tthrow new SyntaxError(`Unsupported operator: ${node.operator}`);\n\t}\n\n\t/**\n\t * Handles logical expressions (&&, ||, ??).\n\t * Implements proper short-circuit evaluation for performance.\n\t * @private\n\t */\n\thandleLogicalExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"&&\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? this.visit(node.right) : left;\n\t\t\t}\n\t\t\tcase \"||\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tcase \"??\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left !== null && left !== undefined ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported logical operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles unary expressions (-, +, !, ~, typeof, void).\n\t * @private\n\t */\n\thandleUnaryExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"-\": {\n\t\t\t\treturn -this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"+\": {\n\t\t\t\treturn +this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"!\": {\n\t\t\t\treturn !this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"~\": {\n\t\t\t\treturn ~this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"typeof\": {\n\t\t\t\treturn typeof this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"void\": {\n\t\t\t\treturn void this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"delete\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Delete operator\"]));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported unary operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles identifier (variable) lookups in the scope chain.\n\t * @private\n\t */\n\thandleIdentifier(node) {\n\t\tconst name = node.name;\n\t\tfor (const scope of this.scopes) {\n\t\t\tif (Object.hasOwn(scope, name)) {\n\t\t\t\treturn scope[name];\n\t\t\t}\n\t\t}\n\n\t\tthrow new ReferenceError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_DEFINED, [name]));\n\t}\n\n\t/**\n\t * Handles member expressions (property access like obj.prop or obj[prop]).\n\t * @private\n\t */\n\thandleMemberExpression(node) {\n\t\tconst object = this.visit(node.object);\n\n\t\t// Determine property name: either identifier name or computed value\n\t\tconst isStaticProperty = node.property.type === \"Identifier\" && !node.computed;\n\t\tconst property = isStaticProperty ? node.property.name : this.visit(node.property);\n\n\t\t// Prevent access to prototype properties\n\t\tif (typeof object !== \"undefined\" && object !== null && object[property] === object?.__proto__) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Accessing prototype properties\"]));\n\t\t}\n\n\t\tif (object === null || object === undefined) {\n\t\t\t// optional chaining\n\t\t\tif (node.optional) {\n\t\t\t\treturn void 0;\n\t\t\t}\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.CAN_NOT_READ_PROPERTY, [object, property]));\n\t\t}\n\n\t\treturn object[property];\n\t}\n\n\t/**\n\t * Handles array literal expressions.\n\t * @private\n\t */\n\thandleArrayExpression(node) {\n\t\tconst result = [];\n\n\t\tfor (let i = 0; i < node.elements.length; i++) {\n\t\t\tconst element = node.elements.at(i);\n\t\t\tconst value = this.visit(element);\n\n\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\tresult.push(...value);\n\t\t\t} else {\n\t\t\t\tresult.push(value);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Handles object literal expressions.\n\t * @returns\n\t */\n\thandleObjectExpression(node) {\n\t\tconst obj = {};\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === \"SpreadElement\") {\n\t\t\t\tObject.assign(obj, this.visit(prop.argument));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = prop.key.name || prop.key.value;\n\t\t\tconst value = this.visit(prop.value);\n\t\t\tobj[key] = value;\n\t\t}\n\t\treturn obj;\n\t}\n\n\thandleSpreadElement(node) {\n\t\treturn this.visit(node.argument);\n\t}\n\n\t/**\n\t * Handles arrow function expressions.\n\t * Creates a closure that captures the current scope and executes the function body\n\t * with parameters bound to a new scope.\n\t * @private\n\t */\n\thandleArrowFunctionExpression(node) {\n\t\treturn (...args) => {\n\t\t\t// Create new scope with parameters bound to arguments\n\t\t\tconst newScope = {};\n\t\t\tconst paramCount = node.params.length;\n\t\t\tfor (let i = 0; i < paramCount; i++) {\n\t\t\t\tnewScope[node.params[i].name] = args[i];\n\t\t\t}\n\n\t\t\t// Push new scope, evaluate body, then pop scope\n\t\t\tthis.scopes.unshift(newScope);\n\t\t\tconst result = this.visit(node.body);\n\t\t\tthis.scopes.shift();\n\t\t\treturn result;\n\t\t};\n\t}\n\n\t/**\n\t * Handles function call expressions, including optional chaining.\n\t * @private\n\t */\n\thandleCallExpression(node) {\n\t\tconst func = this.visit(node.callee);\n\n\t\tconst isOptional = node.optional || node.callee.optional;\n\t\tif ((func === undefined || func === null) && isOptional) {\n\t\t\treturn void 0;\n\t\t}\n\n\t\tif (func === Function) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\n\t\tif (getBlockedMethods().has(func)) {\n\t\t\tconst path = getBlockedMethods().get(func);\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [path]));\n\t\t}\n\n\t\t// 仅在存在参数时构建数组\n\t\tconst args = (() => {\n\t\t\tif (node.arguments.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tlet result = [];\n\n\t\t\tfor (let i = 0; i < node.arguments.length; i++) {\n\t\t\t\tconst element = node.arguments.at(i);\n\t\t\t\tconst value = this.visit(element);\n\n\t\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\t\tresult.push(...value);\n\t\t\t\t} else {\n\t\t\t\t\tresult.push(value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t})();\n\n\t\tconst target = node.callee.type === \"MemberExpression\" ? this.visit(node.callee.object) : null;\n\n\t\tif (typeof func !== \"function\") {\n\t\t\tconst calledString = getNodeString(node.callee);\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_FUNCTION, [calledString]));\n\t\t}\n\n\t\treturn func.apply(target, args);\n\t}\n\n\t/**\n\t * Handles template literal expressions.\n\t * More efficient implementation that interleaves quasis and expressions without sorting.\n\t * @private\n\t */\n\thandleTemplateLiteral(node) {\n\t\tlet result = \"\";\n\t\tconst expressionCount = node.expressions.length;\n\n\t\tfor (let i = 0; i < node.quasis.length; i++) {\n\t\t\tresult += node.quasis[i].value.raw;\n\t\t\tif (i < expressionCount) {\n\t\t\t\tresult += this.visit(node.expressions[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\n/**\n *\n * @param {import('acorn').Node} node\n * @returns\n */\nexport function getNodeString(node) {\n\tswitch (node.type) {\n\t\tcase \"Identifier\": {\n\t\t\treturn node.name;\n\t\t}\n\t\tcase \"Literal\": {\n\t\t\treturn node.raw;\n\t\t}\n\t\tcase \"ArrayExpression\": {\n\t\t\treturn `[${node.elements.map((child) => getNodeString(child)).join(\",\")}]`;\n\t\t}\n\t\tcase \"ObjectExpression\": {\n\t\t\t// if keys is empty\n\t\t\tif (node.properties.length === 0) {\n\t\t\t\treturn \"{}\";\n\t\t\t}\n\n\t\t\treturn \"{(intermediate value)}\";\n\t\t}\n\t\tcase \"MemberExpression\": {\n\t\t\tconst objectStr = getNodeString(node.object);\n\t\t\tconst propertyStr = getNodeString(node.property);\n\n\t\t\tif (node.computed) {\n\t\t\t\treturn `${objectStr}[${propertyStr}]`;\n\t\t\t}\n\t\t\treturn `${objectStr}.${propertyStr}`;\n\t\t}\n\t\tdefault: {\n\t\t\treturn null;\n\t\t}\n\t}\n}\n","/**\n * 简单状态机模板解析器\n * 能够正确处理表达式中包含字符串、转义字符和结束标记的情况\n * @class SimpleStateTemplateParser\n */\nclass TemplateParser {\n\t/**\n\t * 创建解析器实例\n\t * @param {Object} [options] - 配置选项\n\t * @param {string} [options.expressionStart='{{'] - 表达式开始标记\n\t * @param {string} [options.expressionEnd='}}'] - 表达式结束标记\n\t * @param {boolean} [options.preserveWhitespace=true] - 是否保留表达式周围的空白字符\n\t */\n\tconstructor(options = {}) {\n\t\t// 表达式标记配置\n\t\tthis.exprStart = options.expressionStart || \"{{\";\n\t\tthis.exprEnd = options.expressionEnd || \"}}\";\n\n\t\t// 标记长度缓存,避免重复计算\n\t\tthis.startLen = this.exprStart.length;\n\t\tthis.endLen = this.exprEnd.length;\n\n\t\t// 其他配置\n\t\tthis.preserveWhitespace = options.preserveWhitespace === true;\n\t}\n\n\t/**\n\t * 解析模板字符串,将其转换为 token 数组\n\t * @param {string} template - 要解析的模板字符串\n\t * @returns {Array<{type: string, value: string}>} token 数组\n\t */\n\tparse(template) {\n\t\t// 输入验证\n\t\tif (typeof template !== \"string\") {\n\t\t\tthrow new TypeError(\"模板必须是字符串\");\n\t\t}\n\n\t\tconst tokens = []; // 存储解析结果的 token 数组\n\t\tconst length = template.length;\n\n\t\t// 状态机变量\n\t\tlet state = \"TEXT\"; // 当前状态:TEXT | EXPR | STRING_SQ | STRING_DQ | TEMPLATE | ESCAPE_*\n\t\tlet buffer = \"\"; // 当前状态的字符缓冲区\n\t\tlet exprStartPos = 0; // 当前表达式的开始位置(用于错误恢复)\n\t\tlet pos = 0; // 当前扫描位置\n\n\t\t// 主解析循环:逐个字符扫描模板\n\t\twhile (pos < length) {\n\t\t\tconst char = template[pos];\n\t\t\tconst nextChar = template[pos + 1];\n\n\t\t\t// 状态机核心逻辑\n\t\t\tswitch (state) {\n\t\t\t\t// ==================== 文本状态 ====================\n\t\t\t\tcase \"TEXT\":\n\t\t\t\t\t// 检查是否遇到表达式开始标记\n\t\t\t\t\tif (this._isMatch(pos, template, this.exprStart)) {\n\t\t\t\t\t\t// 将缓冲区中的文本保存为 token\n\t\t\t\t\t\tif (buffer.length > 0) {\n\t\t\t\t\t\t\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 切换到表达式状态\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t\texprStartPos = pos; // 记录表达式开始位置\n\t\t\t\t\t\tpos += this.startLen; // 跳过开始标记\n\t\t\t\t\t\tcontinue; // 继续处理下一个字符(跳过本次循环的剩余部分)\n\t\t\t\t\t}\n\t\t\t\t\t// 普通文本字符,添加到缓冲区\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 表达式状态 ====================\n\t\t\t\tcase \"EXPR\":\n\t\t\t\t\t// 在表达式中,需要处理各种字符串和转义字符\n\t\t\t\t\tif (char === \"'\") {\n\t\t\t\t\t\t// 进入单引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_SQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\t// 进入双引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\t// 进入模板字符串状态\n\t\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\t} else if (char === \"\\\\\") {\n\t\t\t\t\t\t// 遇到转义字符,根据当前上下文进入相应的转义状态\n\t\t\t\t\t\tif (nextChar === \"'\") state = \"ESCAPE_SQ\";\n\t\t\t\t\t\telse if (nextChar === '\"') state = \"ESCAPE_DQ\";\n\t\t\t\t\t\telse if (nextChar === \"`\") state = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t\telse state = \"ESCAPE_EXPR\";\n\t\t\t\t\t} else if (this._isMatch(pos, template, this.exprEnd)) {\n\t\t\t\t\t\t// 找到表达式结束标记,且不在字符串中\n\t\t\t\t\t\tconst exprValue = this.preserveWhitespace ? buffer : buffer.trim();\n\t\t\t\t\t\tif (exprValue.length > 0) {\n\t\t\t\t\t\t\ttokens.push({\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\tvalue: exprValue,\n\t\t\t\t\t\t\t\tstart: exprStartPos,\n\t\t\t\t\t\t\t\tend: pos + this.endLen,\n\t\t\t\t\t\t\t\tcontentStart: exprStartPos + this.startLen,\n\t\t\t\t\t\t\t\tcontentEnd: pos,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 重置状态,准备处理后续文本\n\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\tstate = \"TEXT\";\n\t\t\t\t\t\tpos += this.endLen; // 跳过结束标记\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// 将当前字符添加到表达式缓冲区\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 字符串状态 ====================\n\t\t\t\tcase \"STRING_SQ\": // 单引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_SQ\"; // 遇到转义字符\n\t\t\t\t\t} else if (char === \"'\") {\n\t\t\t\t\t\tstate = \"EXPR\"; // 字符串结束,回到表达式状态\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"STRING_DQ\": // 双引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_DQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"TEMPLATE\": // 模板字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 转义状态 ====================\n\t\t\t\t// 转义状态:处理转义字符,然后返回到之前的状态\n\t\t\t\tcase \"ESCAPE_SQ\":\n\t\t\t\t\tbuffer += char; // 添加转义后的字符\n\t\t\t\t\tstate = \"STRING_SQ\"; // 回到单引号字符串状态\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_DQ\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_TEMPLATE\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_EXPR\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// 移动到下一个字符\n\t\t\tpos++;\n\t\t}\n\n\t\t// ==================== 后处理 ====================\n\t\t// 处理扫描结束后缓冲区中剩余的内容\n\t\tif (buffer.length > 0) {\n\t\t\tif (state === \"TEXT\") {\n\t\t\t\t// 剩余的文本内容\n\t\t\t\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t} else {\n\t\t\t\t// 未完成的表达式,将其作为普通文本处理\n\t\t\t\t// 这里可以根据需要选择不同的错误处理策略:\n\t\t\t\t// 1. 抛出错误\n\t\t\t\t// 2. 忽略未完成的表达式\n\t\t\t\t// 3. 将其作为文本处理(当前实现)\n\t\t\t\tconst incompleteExpr = this.exprStart + buffer;\n\t\t\t\ttokens.push({ type: \"text\", value: incompleteExpr, start: exprStartPos, end: pos });\n\n\t\t\t\t// 可选:输出警告\n\t\t\t\tconsole.warn(`警告:在位置 ${exprStartPos} 开始的表达式未正确结束`);\n\t\t\t}\n\t\t}\n\n\t\treturn tokens;\n\t}\n\n\t/**\n\t * 检查指定位置是否匹配给定的字符序列\n\t * @param {number} pos - 开始检查的位置\n\t * @param {string} template - 模板字符串\n\t * @param {string} sequence - 要匹配的字符序列\n\t * @returns {boolean} 是否匹配\n\t * @private\n\t */\n\t_isMatch(pos, template, sequence) {\n\t\t// 检查剩余长度是否足够\n\t\tif (pos + sequence.length > template.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// 逐个字符比较\n\t\tfor (let i = 0; i < sequence.length; i++) {\n\t\t\tif (template[pos + i] !== sequence[i]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * 静态方法:快速解析模板\n\t * @param {string} template - 模板字符串\n\t * @param {Object} [options] - 配置选项\n\t * @returns {Array} token 数组\n\t */\n\tstatic parse(template, options) {\n\t\tconst parser = new TemplateParser(options);\n\t\treturn parser.parse(template);\n\t}\n}\n\nexport { TemplateParser };\n","import { Evaluator } from \"./Evaluator.js\";\nimport { TemplateParser } from \"./TemplateParser.js\";\n\nexport { Evaluator, TemplateParser };\n\n/**\n * Evaluates a JavaScript expression with an optional context.\n * @param {string} expression - The JavaScript expression to evaluate\n * @param {unknown} [context] - Optional context object with variables to use in the expression\n * @returns {*} The result of evaluating the expression\n * @example\n * evalExpression('a + b', { a: 1, b: 2 }) // returns 3\n */\nexport function evalExpression(expression, context) {\n\treturn Evaluator.evaluate(expression, context);\n}\n\n/**\n * Evaluates a template string by replacing {{ expression }} patterns with their evaluated values.\n * Undefined variables in expressions are replaced with empty strings instead of throwing errors.\n * @param {string} template - The template string containing {{ expression }} patterns\n * @param {Object} [context] - Optional context object with variables to use in expressions\n * @param {Object} [templateParserOptions] - Optional options for the template parser\n * @returns {string} The template with all expressions evaluated and replaced\n * @example\n * evalTemplate('Hello {{ name }}!', { name: 'World' }) // returns 'Hello World!'\n */\nexport function evalTemplate(template, context, templateParserOptions) {\n\tlet result = \"\";\n\n\tconst typeHandler = {\n\t\ttext: (token) => token.value,\n\t\texpression: (token) => {\n\t\t\ttry {\n\t\t\t\treturn Evaluator.evaluate(token.value, context);\n\t\t\t} catch (error) {\n\t\t\t\t// Replace undefined variables with empty string for graceful degradation\n\t\t\t\tif (error instanceof ReferenceError && error.message.endsWith(\"is not defined\")) {\n\t\t\t\t\treturn \"undefined\";\n\t\t\t\t} else {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n\n\tfor (const token of TemplateParser.parse(template, templateParserOptions)) {\n\t\t// Unknown token type, treat as text\n\t\tconst handler = typeHandler[token.type] ?? typeHandler[\"text\"];\n\n\t\tresult += handler(token);\n\t}\n\n\treturn result;\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","mutableMethods","dangerousMethods","blockedMethods","blockedGlobalBuiltIns","ERROR_MESSAGES","renderErrorMessage","template","context","_","String","BINARY_OPERATION_MAP","a","b","_instanceof","createGlobalScope","scope","builtin","globals","isWritable","globalThis","getBlockedMethods","BLOCKED_METHODS","map","Map","_iteratorError","path","_path_split","object","properties","current","_iteratorError1","Evaluator","variables","structuredClone","undefined","evaluate","expression","ast","acorn","execute","body","result","node","Error","visit","SyntaxError","Constructor","args","arg","content","handleBinaryExpression","op","left","right","handleLogicalExpression","left1","left2","handleUnaryExpression","_type_of","handleIdentifier","name","ReferenceError","handleMemberExpression","isStaticProperty","property","TypeError","handleArrayExpression","i","element","value","_result","handleObjectExpression","handleSpreadElement","handleArrowFunctionExpression","newScope","paramCount","handleCallExpression","func","isOptional","Function","target","calledString","getNodeString","handleTemplateLiteral","expressionCount","evaluator","child","objectStr","propertyStr","TemplateParser","options","parse","tokens","length","state","buffer","exprStartPos","pos","char","nextChar","exprValue","incompleteExpr","console","_isMatch","sequence","parser","evalExpression","evalTemplate","templateParserOptions","typeHandler","token","error","_typeHandler_token_type","handler"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,SAAS,QAAO,EAAEC,UAAU;QACnD,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,SAASI,GAAG,EAAEC,IAAI;QAAI,OAAOF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;IAAO;;;ICCtGL,oBAAoB,CAAC,GAAG,SAAS,QAAO;QACvC,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNA,IAAMI,iBAAiB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;IACA;IACA;IAEA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IAEA;IACA;IACA;IACA;IAEA;IACA;IACA;IAEA;IACA;IACA;IAGA;IACA;IACA;IACA;IAGA;IACA;IAGA;CACA;AAED,IAAMC,mBAAmB;IACxB;IAEA;IACA;IACA;IACA;IACA;CACA;AAGDD,eAAe,IAAI,CAAC;AAKb,IAAME,iBAAkB,qBAAGF,gBAAAA,MAAAA,CAAgB,qBAAGC;AAK9C,IAAME,wBAAwB;IACpC;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;;gBAAAA,mB,MAAAA;;;IAOL,OAAOiB;AACR"}
1
+ {"version":3,"file":"cjs/index.cjs","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../src/block.js","../../src/Evaluator.js","../../src/TemplateParser.js","../../src/index.js"],"sourcesContent":["__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const mutableMethods = [\n\t\"Array.prototype.push\",\n\t\"Array.prototype.pop\",\n\t\"Array.prototype.shift\",\n\t\"Array.prototype.unshift\",\n\t\"Array.prototype.splice\",\n\t\"Array.prototype.reverse\",\n\t\"Array.prototype.sort\",\n\t\"Array.prototype.fill\",\n\t\"Array.prototype.copyWithin\",\n\n\t\"Object.defineProperty\",\n\t\"Object.defineProperties\",\n\t\"Object.preventExtensions\",\n\t\"Object.seal\",\n\t\"Object.freeze\",\n\t\"Object.setPrototypeOf\",\n\t\"Object.assign\",\n\t\"Object.prototype.__defineGetter__\",\n\t\"Object.prototype.__defineSetter__\",\n\n\t\"Reflect.set\",\n\t\"Reflect.defineProperty\",\n\t\"Reflect.deleteProperty\",\n\t\"Reflect.setPrototypeOf\",\n\t\"Reflect.preventExtensions\",\n\n\t\"Set.prototype.add\",\n\t\"Set.prototype.delete\",\n\t\"Set.prototype.clear\",\n\t\"WeakSet.prototype.add\",\n\t\"WeakSet.prototype.delete\",\n\n\t\"Map.prototype.set\",\n\t\"Map.prototype.delete\",\n\t\"Map.prototype.clear\",\n\t\"WeakMap.prototype.set\",\n\t\"WeakMap.prototype.delete\",\n\n\t\"Date.prototype.setTime\",\n\t\"Date.prototype.setMilliseconds\",\n\t\"Date.prototype.setUTCSeconds\",\n\t\"Date.prototype.setSeconds\",\n\t\"Date.prototype.setMinutes\",\n\t\"Date.prototype.setHours\",\n\t\"Date.prototype.setDate\",\n\t\"Date.prototype.setMonth\",\n\t\"Date.prototype.setFullYear\",\n\t\"Date.prototype.setYear\",\n\t\"Date.prototype.setUTCMilliseconds\",\n\t\"Date.prototype.setUTCMinutes\",\n\t\"Date.prototype.setUTCHours\",\n\t\"Date.prototype.setUTCDate\",\n\t\"Date.prototype.setUTCMonth\",\n\t\"Date.prototype.setUTCFullYear\",\n\n\t\"RegExp.prototype.compile\",\n\n\t\"Int8Array.prototype.set\",\n\t\"Uint8Array.prototype.set\",\n\t\"Uint8ClampedArray.prototype.set\",\n\t\"Int16Array.prototype.set\",\n\t\"Uint16Array.prototype.set\",\n\t\"Int32Array.prototype.set\",\n\t\"Uint32Array.prototype.set\",\n\t\"Float32Array.prototype.set\",\n\t\"Float64Array.prototype.set\",\n\t\"BigInt64Array.prototype.set\",\n\t\"BigUint64Array.prototype.set\",\n\n\t\"Int8Array.prototype.fill\",\n\t\"Uint8Array.prototype.fill\",\n\t\"Uint8ClampedArray.prototype.fill\",\n\t\"Int16Array.prototype.fill\",\n\t\"Uint16Array.prototype.fill\",\n\t\"Int32Array.prototype.fill\",\n\t\"Uint32Array.prototype.fill\",\n\t\"Float32Array.prototype.fill\",\n\t\"Float64Array.prototype.fill\",\n\t\"BigInt64Array.prototype.fill\",\n\t\"BigUint64Array.prototype.fill\",\n\n\t\"Int8Array.prototype.reverse\",\n\t\"Uint8Array.prototype.reverse\",\n\t\"Uint8ClampedArray.prototype.reverse\",\n\t\"Int16Array.prototype.reverse\",\n\t\"Uint16Array.prototype.reverse\",\n\t\"Int32Array.prototype.reverse\",\n\t\"Uint32Array.prototype.reverse\",\n\t\"Float32Array.prototype.reverse\",\n\t\"Float64Array.prototype.reverse\",\n\t\"BigInt64Array.prototype.reverse\",\n\t\"BigUint64Array.prototype.reverse\",\n\n\t\"Int8Array.prototype.sort\",\n\t\"Uint8Array.prototype.sort\",\n\t\"Uint8ClampedArray.prototype.sort\",\n\t\"Int16Array.prototype.sort\",\n\t\"Uint16Array.prototype.sort\",\n\t\"Int32Array.prototype.sort\",\n\t\"Uint32Array.prototype.sort\",\n\t\"Float32Array.prototype.sort\",\n\t\"Float64Array.prototype.sort\",\n\t\"BigInt64Array.prototype.sort\",\n\t\"BigUint64Array.prototype.sort\",\n\n\t\"Int8Array.prototype.copyWithin\",\n\t\"Uint8Array.prototype.copyWithin\",\n\t\"Uint8ClampedArray.prototype.copyWithin\",\n\t\"Int16Array.prototype.copyWithin\",\n\t\"Uint16Array.prototype.copyWithin\",\n\t\"Int32Array.prototype.copyWithin\",\n\t\"Uint32Array.prototype.copyWithin\",\n\t\"Float32Array.prototype.copyWithin\",\n\t\"Float64Array.prototype.copyWithin\",\n\t\"BigInt64Array.prototype.copyWithin\",\n\t\"BigUint64Array.prototype.copyWithin\",\n\n\t\"ArrayBuffer.prototype.transfer\",\n\t\"ArrayBuffer.prototype.transferToFixedLength\",\n\n\t\"SharedArrayBuffer.prototype.grow\",\n\n\t\"DataView.prototype.setInt8\",\n\t\"DataView.prototype.setUint8\",\n\t\"DataView.prototype.setInt16\",\n\t\"DataView.prototype.setUint16\",\n\t\"DataView.prototype.setInt32\",\n\t\"DataView.prototype.setUint32\",\n\t\"DataView.prototype.setFloat32\",\n\t\"DataView.prototype.setFloat64\",\n\t\"DataView.prototype.setBigInt64\",\n\t\"DataView.prototype.setBigUint64\",\n\n\t\"Promise.prototype.catch\",\n\t\"Promise.prototype.finally\",\n\n\t\"Generator.prototype.next\",\n\t\"Generator.prototype.return\",\n\t\"Generator.prototype.throw\",\n\n\t\"AsyncGenerator.prototype.next\",\n\t\"AsyncGenerator.prototype.return\",\n\t\"AsyncGenerator.prototype.throw\",\n\n\t\"Iterator.prototype.next\",\n\n\t\"WeakRef.prototype.deref\",\n\n\t\"FinalizationRegistry.prototype.register\",\n\t\"FinalizationRegistry.prototype.unregister\",\n\n\t\"URLSearchParams.prototype.append\",\n\t\"URLSearchParams.prototype.delete\",\n\t\"URLSearchParams.prototype.set\",\n\t\"URLSearchParams.prototype.sort\",\n\n\t\"FormData.prototype.append\",\n\t\"FormData.prototype.delete\",\n\t\"FormData.prototype.set\",\n\n\t\"Headers.prototype.append\",\n\t\"Headers.prototype.delete\",\n\t\"Headers.prototype.set\",\n\n\t// Function call/apply/bind can be used to invoke with arbitrary `this`\n\t\"Function.prototype.call\",\n\t\"Function.prototype.apply\",\n\t\"Function.prototype.bind\",\n\t\"Function.prototype.constructor\",\n\n\t// Legacy lookup helpers\n\t\"Object.prototype.__lookupGetter__\",\n\t\"Object.prototype.__lookupSetter__\",\n\n\t// Constructor property can be abused to retrieve the Function constructor\n\t\"Object.prototype.constructor\",\n];\n\nconst dangerousMethods = [\n\t\"Object.getPrototypeOf\",\n\t// Various reflective/object-inspection APIs that may expose internals\n\t\"Object.getOwnPropertyDescriptor\",\n\t\"Object.getOwnPropertyDescriptors\",\n\t\"Object.getOwnPropertyNames\",\n\t\"Object.getOwnPropertySymbols\",\n\t\"Object.getOwnPropertyDescriptors\",\n];\n\n// Some prototype-style aliases/properties that can be used to break sandboxes\nmutableMethods.push(\"Object.prototype.__proto__\");\n\n/**\n * List of methods to block due to mutability or dangerousness\n */\nexport const blockedMethods = [...mutableMethods, ...dangerousMethods];\n\n/**\n * List of global built-ins to block entirely\n */\nexport const blockedGlobalBuiltIns = [\n\t\"Function\",\n\t\"GeneratorFunction\",\n\t\"AsyncFunction\",\n\t\"AsyncGeneratorFunction\",\n\t\"eval\",\n\t\"setTimeout\",\n\t\"setInterval\",\n\t\"clearTimeout\",\n\t\"clearInterval\",\n\t\"setImmediate\",\n\t\"XMLHttpRequest\",\n\t\"fetch\",\n\t\"WebSocket\",\n\t\"globalThis\",\n\n\t// Node / runtime globals\n\t\"process\",\n\t\"require\",\n\t\"module\",\n\t\"exports\",\n\t\"global\",\n\t\"Buffer\",\n\t\"setImmediate\",\n\t\"clearImmediate\",\n\n\t// Worker / threading / messaging\n\t\"importScripts\",\n\t\"Worker\",\n\t\"SharedWorker\",\n\t\"ServiceWorker\",\n\t\"BroadcastChannel\",\n\t\"MessageChannel\",\n\t\"MessagePort\",\n\t\"postMessage\",\n\n\t// Host environment globals (browser)\n\t\"window\",\n\t\"document\",\n\t\"navigator\",\n\t\"location\",\n\t\"localStorage\",\n\t\"sessionStorage\",\n\t\"indexedDB\",\n\t\"performance\",\n\n\t// Low-level / concurrent / binary APIs\n\t\"Proxy\",\n\t\"Reflect\",\n\t\"Atomics\",\n\t\"WebAssembly\",\n\n\t// Console and internationalization\n\t\"console\",\n\t\"Intl\",\n\n\t// Other runtimes\n\t\"Deno\",\n];\n","import * as acorn from \"acorn\";\nimport globals from \"globals\";\nimport { blockedGlobalBuiltIns, blockedMethods } from \"./block.js\";\n\n// Error message constants for better maintainability\nconst ERROR_MESSAGES = {\n\tCAN_NOT_READ_PROPERTY: \"Cannot read property of {0} (reading '{1}')\",\n\tIS_INVALID_SYNTAX: \"{0} is not a valid syntax\",\n\tIS_NOT_FUNCTION: \"{0} is not a function\",\n\tIS_NOT_DEFINED: \"{0} is not defined\",\n\tIS_NOT_ALLOWED: \"{0} is not allowed\",\n};\n\n/**\n * Renders an error message by replacing placeholders with context values.\n * @param {string} template\n * @param {Record<string, any>} context\n * @example\n * ```js\n * const msg = renderErrorMessage(\"Cannot call mutable prototype method: {method}\", { method: \"push\" });\n * ```\n */\nconst renderErrorMessage = (template, context = {}) => template.replace(/{(\\w+)}/g, (_, key) => String(context[key]));\n\nconst BINARY_OPERATION_MAP = {\n\t\"+\": (a, b) => a + b,\n\t\"-\": (a, b) => a - b,\n\t\"*\": (a, b) => a * b,\n\t\"**\": (a, b) => a ** b,\n\t\"==\": (a, b) => a == b,\n\t\"===\": (a, b) => a === b,\n\t\"!=\": (a, b) => a != b,\n\t\"!==\": (a, b) => a !== b,\n\t\">\": (a, b) => a > b,\n\t\">=\": (a, b) => a >= b,\n\t\"<\": (a, b) => a < b,\n\t\"<=\": (a, b) => a <= b,\n\t\"%\": (a, b) => a % b,\n\t\"/\": (a, b) => a / b,\n\t\"|\": (a, b) => a | b,\n\t\"&\": (a, b) => a & b,\n\t\"^\": (a, b) => a ^ b,\n\t\"<<\": (a, b) => a << b,\n\t\">>\": (a, b) => a >> b,\n\t\">>>\": (a, b) => a >>> b,\n\tin: (a, b) => a in b,\n\tinstanceof: (a, b) => a instanceof b,\n};\n\nfunction createGlobalScope() {\n\tconst scope = Object.create(null);\n\tconst { builtin } = globals;\n\n\tfor (const key in builtin) {\n\t\tif (blockedGlobalBuiltIns.includes(key)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t/** @type {boolean} */\n\t\tconst isWritable = builtin[key];\n\n\t\tObject.defineProperty(scope, key, {\n\t\t\tvalue: globalThis[key],\n\t\t\twritable: isWritable,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(scope, \"globalThis\", {\n\t\tvalue: scope,\n\t\twritable: false,\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t});\n\n\treturn scope;\n}\n\nconst getBlockedMethods = (() => {\n\t/**\n\t * @type {Map<Function, string>}\n\t */\n\tlet BLOCKED_METHODS = null;\n\n\treturn () => {\n\t\tif (BLOCKED_METHODS) return BLOCKED_METHODS;\n\n\t\tconst map = new Map();\n\t\tfor (const path of blockedMethods) {\n\t\t\tconst [object, ...properties] = path.split(\".\");\n\t\t\tlet current = globalThis[object];\n\t\t\tfor (const prop of properties) {\n\t\t\t\tif (current && Object.hasOwn(current, prop)) {\n\t\t\t\t\tcurrent = current[prop];\n\t\t\t\t} else {\n\t\t\t\t\tcurrent = null;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof current === \"function\") map.set(current, path);\n\t\t}\n\t\tBLOCKED_METHODS = map;\n\n\t\treturn BLOCKED_METHODS;\n\t};\n})();\n\n/**\n * A JavaScript expression evaluator that safely evaluates expressions within a sandboxed environment.\n * Supports various JavaScript features including arithmetic, logical operations, functions, and more.\n *\n * Security features:\n * - Blocks mutable methods to prevent side effects\n * - No access to eval() or Function() constructor\n * - Sandboxed scope with limited global objects\n *\n * @example\n * const evaluator = new Evaluator({ x: 10, y: 20 });\n * evaluator.evaluate('x + y') // returns 30\n */\nexport class Evaluator {\n\t/**\n\t * Creates a new Evaluator instance with a custom variable context.\n\t * The scope hierarchy is: user variables -> global scope\n\t * @param {Object} [variables={}] - An optional object containing variables to make available in the evaluation context\n\t */\n\tconstructor(variables = Object.create(null)) {\n\t\tthis.scopes = [structuredClone(variables), createGlobalScope()].filter((scope) => scope !== null && scope !== undefined);\n\t\tthis.source = undefined;\n\t}\n\n\t/**\n\t * Evaluates a JavaScript expression with an optional context.\n\t * @param {string} expression\n\t * @param {unknown} [context]\n\t * @returns\n\t */\n\tstatic evaluate(expression, context) {\n\t\tconst evaluator = new Evaluator(context);\n\t\treturn evaluator.evaluate(expression);\n\t}\n\n\t/**\n\t * Parses and evaluates a JavaScript expression using acorn parser.\n\t * @param {string} expression - The JavaScript expression to evaluate\n\t * @returns {*} The result of the evaluation\n\t * @throws {SyntaxError} If the expression has invalid syntax\n\t * @throws {ReferenceError} If referencing undefined variables\n\t * @throws {TypeError} If performing invalid operations\n\t */\n\tevaluate(expression) {\n\t\tthis.source = expression;\n\n\t\tconst ast = acorn.parse(expression, { ecmaVersion: \"latest\" });\n\n\t\t// Start recursive evaluation from the root node\n\t\ttry {\n\t\t\treturn this.execute(ast.body);\n\t\t} finally {\n\t\t\tthis.source = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Executes an array of AST body nodes sequentially.\n\t * @private\n\t * @param {Array} body - Array of AST nodes to execute\n\t * @returns {*} The result of the last executed node\n\t */\n\texecute(body) {\n\t\tlet result;\n\n\t\tfor (const node of body) {\n\t\t\tresult = this.visit(node);\n\t\t}\n\n\t\tif (typeof result === \"function\") {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning functions from expressions\"]));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Visits an AST node and delegates to the appropriate handler based on node type.\n\t * @private\n\t * @param {import(\"acorn\").Node} node - The AST node to visit\n\t * @returns {*} The result of visiting the node\n\t */\n\tvisit(node) {\n\t\tswitch (node.type) {\n\t\t\tcase \"ExpressionStatement\": {\n\t\t\t\treturn this.visit(node.expression);\n\t\t\t}\n\t\t\tcase \"BinaryExpression\": {\n\t\t\t\treturn this.handleBinaryExpression(node);\n\t\t\t}\n\t\t\tcase \"LogicalExpression\": {\n\t\t\t\treturn this.handleLogicalExpression(node);\n\t\t\t}\n\t\t\tcase \"UnaryExpression\": {\n\t\t\t\treturn this.handleUnaryExpression(node);\n\t\t\t}\n\t\t\tcase \"Identifier\": {\n\t\t\t\treturn this.handleIdentifier(node);\n\t\t\t}\n\t\t\tcase \"Literal\": {\n\t\t\t\treturn node.value;\n\t\t\t}\n\t\t\tcase \"MemberExpression\": {\n\t\t\t\treturn this.handleMemberExpression(node);\n\t\t\t}\n\t\t\tcase \"ArrayExpression\": {\n\t\t\t\treturn this.handleArrayExpression(node);\n\t\t\t}\n\t\t\tcase \"SpreadElement\": {\n\t\t\t\treturn this.handleSpreadElement(node);\n\t\t\t}\n\t\t\tcase \"ObjectExpression\": {\n\t\t\t\treturn this.handleObjectExpression(node);\n\t\t\t}\n\t\t\tcase \"FunctionExpression\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function expression\"]));\n\t\t\t}\n\t\t\tcase \"ArrowFunctionExpression\": {\n\t\t\t\treturn this.handleArrowFunctionExpression(node);\n\t\t\t}\n\t\t\tcase \"CallExpression\": {\n\t\t\t\treturn this.handleCallExpression(node);\n\t\t\t}\n\t\t\tcase \"ConditionalExpression\": {\n\t\t\t\treturn this.visit(node.test) ? this.visit(node.consequent) : this.visit(node.alternate);\n\t\t\t}\n\t\t\tcase \"NewExpression\": {\n\t\t\t\tif (node.callee.type !== \"Identifier\") {\n\t\t\t\t\tthrow new Error(`Unsupported callee type '${node.callee.type}' in new expression`);\n\t\t\t\t}\n\n\t\t\t\tif (node.callee.name === \"Function\") {\n\t\t\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"new Function() constructor\"]));\n\t\t\t\t}\n\n\t\t\t\tconst Constructor = this.visit(node.callee);\n\n\t\t\t\t// 仅在存在参数时构建数组\n\t\t\t\tconst args = node.arguments.length ? node.arguments.map((arg) => this.visit(arg)) : [];\n\n\t\t\t\treturn new Constructor(...args);\n\t\t\t}\n\t\t\tcase \"ChainExpression\": {\n\t\t\t\treturn this.visit(node.expression);\n\t\t\t}\n\t\t\tcase \"TemplateLiteral\": {\n\t\t\t\treturn this.handleTemplateLiteral(node);\n\t\t\t}\n\t\t\tcase \"ThisExpression\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'this' expression\"]));\n\t\t\t}\n\t\t\tcase \"WithStatement\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'with' statement\"]));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tlet content = this.source.slice(node.start, node.end);\n\n\t\t\t\tif (content.length > 20) {\n\t\t\t\t\tcontent = content.slice(0, 17) + \"...\";\n\t\t\t\t}\n\n\t\t\t\tthrow new SyntaxError(`'${content}'` + \" \" + renderErrorMessage(ERROR_MESSAGES.IS_INVALID_SYNTAX, [content]));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles binary expressions (arithmetic and comparison operations).\n\t * @param {import('acorn').BinaryExpression} node\n\t * @private\n\t */\n\thandleBinaryExpression(node) {\n\t\tconst op = node.operator;\n\t\tconst left = this.visit(node.left);\n\t\tconst right = this.visit(node.right);\n\n\t\tif (BINARY_OPERATION_MAP.hasOwnProperty(op)) {\n\t\t\treturn BINARY_OPERATION_MAP[op](left, right);\n\t\t}\n\n\t\tthrow new SyntaxError(`Unsupported operator: ${node.operator}`);\n\t}\n\n\t/**\n\t * Handles logical expressions (&&, ||, ??).\n\t * Implements proper short-circuit evaluation for performance.\n\t * @private\n\t */\n\thandleLogicalExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"&&\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? this.visit(node.right) : left;\n\t\t\t}\n\t\t\tcase \"||\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tcase \"??\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left !== null && left !== undefined ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported logical operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles unary expressions (-, +, !, ~, typeof, void).\n\t * @private\n\t */\n\thandleUnaryExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"-\": {\n\t\t\t\treturn -this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"+\": {\n\t\t\t\treturn +this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"!\": {\n\t\t\t\treturn !this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"~\": {\n\t\t\t\treturn ~this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"typeof\": {\n\t\t\t\treturn typeof this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"void\": {\n\t\t\t\treturn void this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"delete\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Delete operator\"]));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported unary operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles identifier (variable) lookups in the scope chain.\n\t * @private\n\t */\n\thandleIdentifier(node) {\n\t\tconst name = node.name;\n\t\tfor (const scope of this.scopes) {\n\t\t\tif (Object.hasOwn(scope, name)) {\n\t\t\t\treturn scope[name];\n\t\t\t}\n\t\t}\n\n\t\tthrow new ReferenceError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_DEFINED, [name]));\n\t}\n\n\t/**\n\t * Handles member expressions (property access like obj.prop or obj[prop]).\n\t * @private\n\t */\n\thandleMemberExpression(node) {\n\t\tconst object = this.visit(node.object);\n\n\t\t// Determine property name: either identifier name or computed value\n\t\tconst isStaticProperty = node.property.type === \"Identifier\" && !node.computed;\n\t\tconst property = isStaticProperty ? node.property.name : this.visit(node.property);\n\n\t\t// Prevent access to prototype properties\n\t\tif (typeof object !== \"undefined\" && object !== null && object[property] === object?.__proto__) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Accessing prototype properties\"]));\n\t\t}\n\n\t\tif (object === null || object === undefined) {\n\t\t\t// optional chaining\n\t\t\tif (node.optional) {\n\t\t\t\treturn void 0;\n\t\t\t}\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.CAN_NOT_READ_PROPERTY, [object, property]));\n\t\t}\n\n\t\tconst result = object[property];\n\n\t\t// The Function constructor must never be reachable from an expression.\n\t\t// If it escapes as a value, native callbacks (e.g. Promise.then,\n\t\t// Array.prototype.map) invoke it outside the interpreter's call path,\n\t\t// enabling arbitrary host code execution. This is a structural guard:\n\t\t// no matter how many `.constructor` hops an expression takes, the\n\t\t// final value can never be `Function` (or its prototype).\n\t\tif (result === Function || result === Function.prototype) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Handles array literal expressions.\n\t * @private\n\t */\n\thandleArrayExpression(node) {\n\t\tconst result = [];\n\n\t\tfor (let i = 0; i < node.elements.length; i++) {\n\t\t\tconst element = node.elements.at(i);\n\t\t\tconst value = this.visit(element);\n\n\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\tresult.push(...value);\n\t\t\t} else {\n\t\t\t\tresult.push(value);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Handles object literal expressions.\n\t * @returns\n\t */\n\thandleObjectExpression(node) {\n\t\tconst obj = {};\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === \"SpreadElement\") {\n\t\t\t\tObject.assign(obj, this.visit(prop.argument));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = prop.key.name || prop.key.value;\n\t\t\tconst value = this.visit(prop.value);\n\t\t\tobj[key] = value;\n\t\t}\n\t\treturn obj;\n\t}\n\n\thandleSpreadElement(node) {\n\t\treturn this.visit(node.argument);\n\t}\n\n\t/**\n\t * Handles arrow function expressions.\n\t * Creates a closure that captures the current scope and executes the function body\n\t * with parameters bound to a new scope.\n\t * @private\n\t */\n\thandleArrowFunctionExpression(node) {\n\t\treturn (...args) => {\n\t\t\t// Create new scope with parameters bound to arguments\n\t\t\tconst newScope = {};\n\t\t\tconst paramCount = node.params.length;\n\t\t\tfor (let i = 0; i < paramCount; i++) {\n\t\t\t\tnewScope[node.params[i].name] = args[i];\n\t\t\t}\n\n\t\t\t// Push new scope, evaluate body, then pop scope\n\t\t\tthis.scopes.unshift(newScope);\n\t\t\tconst result = this.visit(node.body);\n\t\t\tthis.scopes.shift();\n\t\t\treturn result;\n\t\t};\n\t}\n\n\t/**\n\t * Handles function call expressions, including optional chaining.\n\t * @private\n\t */\n\thandleCallExpression(node) {\n\t\tconst func = this.visit(node.callee);\n\n\t\tconst isOptional = node.optional || node.callee.optional;\n\t\tif ((func === undefined || func === null) && isOptional) {\n\t\t\treturn void 0;\n\t\t}\n\n\t\tif (func === Function) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\n\t\tif (getBlockedMethods().has(func)) {\n\t\t\tconst path = getBlockedMethods().get(func);\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [path]));\n\t\t}\n\n\t\t// 仅在存在参数时构建数组\n\t\tconst args = (() => {\n\t\t\tif (node.arguments.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tlet result = [];\n\n\t\t\tfor (let i = 0; i < node.arguments.length; i++) {\n\t\t\t\tconst element = node.arguments.at(i);\n\t\t\t\tconst value = this.visit(element);\n\n\t\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\t\tresult.push(...value);\n\t\t\t\t} else {\n\t\t\t\t\tresult.push(value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t})();\n\n\t\tconst target = node.callee.type === \"MemberExpression\" ? this.visit(node.callee.object) : null;\n\n\t\t// Defense in depth: even if a `Function` reference were somehow\n\t\t// produced by an expression, it must not be passed as an argument.\n\t\t// Native methods (Promise.then, Array.prototype.map, ...) would\n\t\t// invoke it in the host runtime, outside this interpreter's checks.\n\t\tif (args.some((arg) => arg === Function)) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\n\t\tif (typeof func !== \"function\") {\n\t\t\tconst calledString = getNodeString(node.callee);\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_FUNCTION, [calledString]));\n\t\t}\n\n\t\treturn func.apply(target, args);\n\t}\n\n\t/**\n\t * Handles template literal expressions.\n\t * More efficient implementation that interleaves quasis and expressions without sorting.\n\t * @private\n\t */\n\thandleTemplateLiteral(node) {\n\t\tlet result = \"\";\n\t\tconst expressionCount = node.expressions.length;\n\n\t\tfor (let i = 0; i < node.quasis.length; i++) {\n\t\t\tresult += node.quasis[i].value.raw;\n\t\t\tif (i < expressionCount) {\n\t\t\t\tresult += this.visit(node.expressions[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\n/**\n *\n * @param {import('acorn').Node} node\n * @returns\n */\nexport function getNodeString(node) {\n\tswitch (node.type) {\n\t\tcase \"Identifier\": {\n\t\t\treturn node.name;\n\t\t}\n\t\tcase \"Literal\": {\n\t\t\treturn node.raw;\n\t\t}\n\t\tcase \"ArrayExpression\": {\n\t\t\treturn `[${node.elements.map((child) => getNodeString(child)).join(\",\")}]`;\n\t\t}\n\t\tcase \"ObjectExpression\": {\n\t\t\t// if keys is empty\n\t\t\tif (node.properties.length === 0) {\n\t\t\t\treturn \"{}\";\n\t\t\t}\n\n\t\t\treturn \"{(intermediate value)}\";\n\t\t}\n\t\tcase \"MemberExpression\": {\n\t\t\tconst objectStr = getNodeString(node.object);\n\t\t\tconst propertyStr = getNodeString(node.property);\n\n\t\t\tif (node.computed) {\n\t\t\t\treturn `${objectStr}[${propertyStr}]`;\n\t\t\t}\n\t\t\treturn `${objectStr}.${propertyStr}`;\n\t\t}\n\t\tdefault: {\n\t\t\treturn null;\n\t\t}\n\t}\n}\n","/**\n * 简单状态机模板解析器\n * 能够正确处理表达式中包含字符串、转义字符和结束标记的情况\n * @class SimpleStateTemplateParser\n */\nclass TemplateParser {\n\t/**\n\t * 创建解析器实例\n\t * @param {Object} [options] - 配置选项\n\t * @param {string} [options.expressionStart='{{'] - 表达式开始标记\n\t * @param {string} [options.expressionEnd='}}'] - 表达式结束标记\n\t * @param {boolean} [options.preserveWhitespace=true] - 是否保留表达式周围的空白字符\n\t */\n\tconstructor(options = {}) {\n\t\t// 表达式标记配置\n\t\tthis.exprStart = options.expressionStart || \"{{\";\n\t\tthis.exprEnd = options.expressionEnd || \"}}\";\n\n\t\t// 标记长度缓存,避免重复计算\n\t\tthis.startLen = this.exprStart.length;\n\t\tthis.endLen = this.exprEnd.length;\n\n\t\t// 其他配置\n\t\tthis.preserveWhitespace = options.preserveWhitespace === true;\n\t}\n\n\t/**\n\t * 解析模板字符串,将其转换为 token 数组\n\t * @param {string} template - 要解析的模板字符串\n\t * @returns {Array<{type: string, value: string}>} token 数组\n\t */\n\tparse(template) {\n\t\t// 输入验证\n\t\tif (typeof template !== \"string\") {\n\t\t\tthrow new TypeError(\"模板必须是字符串\");\n\t\t}\n\n\t\tconst tokens = []; // 存储解析结果的 token 数组\n\t\tconst length = template.length;\n\n\t\t// 状态机变量\n\t\tlet state = \"TEXT\"; // 当前状态:TEXT | EXPR | STRING_SQ | STRING_DQ | TEMPLATE | ESCAPE_*\n\t\tlet buffer = \"\"; // 当前状态的字符缓冲区\n\t\tlet exprStartPos = 0; // 当前表达式的开始位置(用于错误恢复)\n\t\tlet pos = 0; // 当前扫描位置\n\n\t\t// 主解析循环:逐个字符扫描模板\n\t\twhile (pos < length) {\n\t\t\tconst char = template[pos];\n\t\t\tconst nextChar = template[pos + 1];\n\n\t\t\t// 状态机核心逻辑\n\t\t\tswitch (state) {\n\t\t\t\t// ==================== 文本状态 ====================\n\t\t\t\tcase \"TEXT\":\n\t\t\t\t\t// 检查是否遇到表达式开始标记\n\t\t\t\t\tif (this._isMatch(pos, template, this.exprStart)) {\n\t\t\t\t\t\t// 将缓冲区中的文本保存为 token\n\t\t\t\t\t\tif (buffer.length > 0) {\n\t\t\t\t\t\t\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 切换到表达式状态\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t\texprStartPos = pos; // 记录表达式开始位置\n\t\t\t\t\t\tpos += this.startLen; // 跳过开始标记\n\t\t\t\t\t\tcontinue; // 继续处理下一个字符(跳过本次循环的剩余部分)\n\t\t\t\t\t}\n\t\t\t\t\t// 普通文本字符,添加到缓冲区\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 表达式状态 ====================\n\t\t\t\tcase \"EXPR\":\n\t\t\t\t\t// 在表达式中,需要处理各种字符串和转义字符\n\t\t\t\t\tif (char === \"'\") {\n\t\t\t\t\t\t// 进入单引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_SQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\t// 进入双引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\t// 进入模板字符串状态\n\t\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\t} else if (char === \"\\\\\") {\n\t\t\t\t\t\t// 遇到转义字符,根据当前上下文进入相应的转义状态\n\t\t\t\t\t\tif (nextChar === \"'\") state = \"ESCAPE_SQ\";\n\t\t\t\t\t\telse if (nextChar === '\"') state = \"ESCAPE_DQ\";\n\t\t\t\t\t\telse if (nextChar === \"`\") state = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t\telse state = \"ESCAPE_EXPR\";\n\t\t\t\t\t} else if (this._isMatch(pos, template, this.exprEnd)) {\n\t\t\t\t\t\t// 找到表达式结束标记,且不在字符串中\n\t\t\t\t\t\tconst exprValue = this.preserveWhitespace ? buffer : buffer.trim();\n\t\t\t\t\t\tif (exprValue.length > 0) {\n\t\t\t\t\t\t\ttokens.push({\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\tvalue: exprValue,\n\t\t\t\t\t\t\t\tstart: exprStartPos,\n\t\t\t\t\t\t\t\tend: pos + this.endLen,\n\t\t\t\t\t\t\t\tcontentStart: exprStartPos + this.startLen,\n\t\t\t\t\t\t\t\tcontentEnd: pos,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 重置状态,准备处理后续文本\n\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\tstate = \"TEXT\";\n\t\t\t\t\t\tpos += this.endLen; // 跳过结束标记\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// 将当前字符添加到表达式缓冲区\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 字符串状态 ====================\n\t\t\t\tcase \"STRING_SQ\": // 单引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_SQ\"; // 遇到转义字符\n\t\t\t\t\t} else if (char === \"'\") {\n\t\t\t\t\t\tstate = \"EXPR\"; // 字符串结束,回到表达式状态\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"STRING_DQ\": // 双引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_DQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"TEMPLATE\": // 模板字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 转义状态 ====================\n\t\t\t\t// 转义状态:处理转义字符,然后返回到之前的状态\n\t\t\t\tcase \"ESCAPE_SQ\":\n\t\t\t\t\tbuffer += char; // 添加转义后的字符\n\t\t\t\t\tstate = \"STRING_SQ\"; // 回到单引号字符串状态\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_DQ\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_TEMPLATE\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_EXPR\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// 移动到下一个字符\n\t\t\tpos++;\n\t\t}\n\n\t\t// ==================== 后处理 ====================\n\t\t// 处理扫描结束后缓冲区中剩余的内容\n\t\tif (buffer.length > 0) {\n\t\t\tif (state === \"TEXT\") {\n\t\t\t\t// 剩余的文本内容\n\t\t\t\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t} else {\n\t\t\t\t// 未完成的表达式,将其作为普通文本处理\n\t\t\t\t// 这里可以根据需要选择不同的错误处理策略:\n\t\t\t\t// 1. 抛出错误\n\t\t\t\t// 2. 忽略未完成的表达式\n\t\t\t\t// 3. 将其作为文本处理(当前实现)\n\t\t\t\tconst incompleteExpr = this.exprStart + buffer;\n\t\t\t\ttokens.push({ type: \"text\", value: incompleteExpr, start: exprStartPos, end: pos });\n\n\t\t\t\t// 可选:输出警告\n\t\t\t\tconsole.warn(`警告:在位置 ${exprStartPos} 开始的表达式未正确结束`);\n\t\t\t}\n\t\t}\n\n\t\treturn tokens;\n\t}\n\n\t/**\n\t * 检查指定位置是否匹配给定的字符序列\n\t * @param {number} pos - 开始检查的位置\n\t * @param {string} template - 模板字符串\n\t * @param {string} sequence - 要匹配的字符序列\n\t * @returns {boolean} 是否匹配\n\t * @private\n\t */\n\t_isMatch(pos, template, sequence) {\n\t\t// 检查剩余长度是否足够\n\t\tif (pos + sequence.length > template.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// 逐个字符比较\n\t\tfor (let i = 0; i < sequence.length; i++) {\n\t\t\tif (template[pos + i] !== sequence[i]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * 静态方法:快速解析模板\n\t * @param {string} template - 模板字符串\n\t * @param {Object} [options] - 配置选项\n\t * @returns {Array} token 数组\n\t */\n\tstatic parse(template, options) {\n\t\tconst parser = new TemplateParser(options);\n\t\treturn parser.parse(template);\n\t}\n}\n\nexport { TemplateParser };\n","import { Evaluator } from \"./Evaluator.js\";\nimport { TemplateParser } from \"./TemplateParser.js\";\n\nexport { Evaluator, TemplateParser };\n\n/**\n * Evaluates a JavaScript expression with an optional context.\n * @param {string} expression - The JavaScript expression to evaluate\n * @param {unknown} [context] - Optional context object with variables to use in the expression\n * @returns {*} The result of evaluating the expression\n * @example\n * evalExpression('a + b', { a: 1, b: 2 }) // returns 3\n */\nexport function evalExpression(expression, context) {\n\treturn Evaluator.evaluate(expression, context);\n}\n\n/**\n * Evaluates a template string by replacing {{ expression }} patterns with their evaluated values.\n * Undefined variables in expressions are replaced with empty strings instead of throwing errors.\n * @param {string} template - The template string containing {{ expression }} patterns\n * @param {Object} [context] - Optional context object with variables to use in expressions\n * @param {Object} [templateParserOptions] - Optional options for the template parser\n * @returns {string} The template with all expressions evaluated and replaced\n * @example\n * evalTemplate('Hello {{ name }}!', { name: 'World' }) // returns 'Hello World!'\n */\nexport function evalTemplate(template, context, templateParserOptions) {\n\tlet result = \"\";\n\n\tconst typeHandler = {\n\t\ttext: (token) => token.value,\n\t\texpression: (token) => {\n\t\t\ttry {\n\t\t\t\treturn Evaluator.evaluate(token.value, context);\n\t\t\t} catch (error) {\n\t\t\t\t// Replace undefined variables with empty string for graceful degradation\n\t\t\t\tif (error instanceof ReferenceError && error.message.endsWith(\"is not defined\")) {\n\t\t\t\t\treturn \"undefined\";\n\t\t\t\t} else {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n\n\tfor (const token of TemplateParser.parse(template, templateParserOptions)) {\n\t\t// Unknown token type, treat as text\n\t\tconst handler = typeHandler[token.type] ?? typeHandler[\"text\"];\n\n\t\tresult += handler(token);\n\t}\n\n\treturn result;\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","mutableMethods","dangerousMethods","blockedMethods","blockedGlobalBuiltIns","ERROR_MESSAGES","renderErrorMessage","template","context","_","String","BINARY_OPERATION_MAP","a","b","_instanceof","createGlobalScope","scope","builtin","globals","isWritable","globalThis","getBlockedMethods","BLOCKED_METHODS","map","Map","_iteratorError","path","_path_split","object","properties","current","_iteratorError1","Evaluator","variables","structuredClone","undefined","evaluate","expression","ast","acorn","execute","body","result","node","Error","visit","SyntaxError","Constructor","args","arg","content","handleBinaryExpression","op","left","right","handleLogicalExpression","left1","left2","handleUnaryExpression","_type_of","handleIdentifier","name","ReferenceError","handleMemberExpression","isStaticProperty","property","TypeError","Function","handleArrayExpression","i","element","value","_result","handleObjectExpression","handleSpreadElement","handleArrowFunctionExpression","newScope","paramCount","handleCallExpression","func","isOptional","target","calledString","getNodeString","handleTemplateLiteral","expressionCount","evaluator","child","objectStr","propertyStr","TemplateParser","options","parse","tokens","length","state","buffer","exprStartPos","pos","char","nextChar","exprValue","incompleteExpr","console","_isMatch","sequence","parser","evalExpression","evalTemplate","templateParserOptions","typeHandler","token","error","_typeHandler_token_type","handler"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,SAAS,QAAO,EAAEC,UAAU;QACnD,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,SAASI,GAAG,EAAEC,IAAI;QAAI,OAAOF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;IAAO;;;ICCtGL,oBAAoB,CAAC,GAAG,SAAS,QAAO;QACvC,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNA,IAAMI,iBAAiB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;IACA;IACA;IAEA;IACA;IACA;IAEA;IAEA;IAEA;IACA;IAEA;IACA;IACA;IACA;IAEA;IACA;IACA;IAEA;IACA;IACA;IAGA;IACA;IACA;IACA;IAGA;IACA;IAGA;CACA;AAED,IAAMC,mBAAmB;IACxB;IAEA;IACA;IACA;IACA;IACA;CACA;AAGDD,eAAe,IAAI,CAAC;AAKb,IAAME,iBAAkB,qBAAGF,gBAAAA,MAAAA,CAAgB,qBAAGC;AAK9C,IAAME,wBAAwB;IACpC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAGA;IACA;IACA;IACA;IACA;IAC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,WAAW,CAACF,MAAM,IAAI,CAAC,AAAD,IAAtBE,0BAA2BH,WAAW,CAAC,OAAO;YAE9DpE,UAAUwE,QAAQH;QACnB;;QALKtF,oBAAAA;QAAAA,iBAAAA;;;iBAAAA,6BAAAA,AAAAA,QAAAA,UAAAA,MAAAA,EAAAA,UAAAA,MAAAA;;gBAAAA,mB,MAAAA;;;IAOL,OAAOiB;AACR"}
@@ -679,7 +679,11 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
679
679
  property
680
680
  ]));
681
681
  }
682
- return object[property];
682
+ var result = object[property];
683
+ if (result === Function || result === Function.prototype) throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
684
+ "Function constructor"
685
+ ]));
686
+ return result;
683
687
  }
684
688
  },
685
689
  {
@@ -778,6 +782,11 @@ var Evaluator_Evaluator = /*#__PURE__*/ function() {
778
782
  return result;
779
783
  }();
780
784
  var target = "MemberExpression" === node.callee.type ? this.visit(node.callee.object) : null;
785
+ if (args.some(function(arg) {
786
+ return arg === Function;
787
+ })) throw new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [
788
+ "Function constructor"
789
+ ]));
781
790
  if ("function" != typeof func) {
782
791
  var calledString = getNodeString(node.callee);
783
792
  throw new TypeError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_FUNCTION, [
@@ -1 +1 @@
1
- {"version":3,"file":"esm/index.mjs","sources":["../../src/block.js","../../src/Evaluator.js","../../src/TemplateParser.js","../../src/index.js"],"sourcesContent":["const mutableMethods = [\n\t\"Array.prototype.push\",\n\t\"Array.prototype.pop\",\n\t\"Array.prototype.shift\",\n\t\"Array.prototype.unshift\",\n\t\"Array.prototype.splice\",\n\t\"Array.prototype.reverse\",\n\t\"Array.prototype.sort\",\n\t\"Array.prototype.fill\",\n\t\"Array.prototype.copyWithin\",\n\n\t\"Object.defineProperty\",\n\t\"Object.defineProperties\",\n\t\"Object.preventExtensions\",\n\t\"Object.seal\",\n\t\"Object.freeze\",\n\t\"Object.setPrototypeOf\",\n\t\"Object.assign\",\n\t\"Object.prototype.__defineGetter__\",\n\t\"Object.prototype.__defineSetter__\",\n\n\t\"Reflect.set\",\n\t\"Reflect.defineProperty\",\n\t\"Reflect.deleteProperty\",\n\t\"Reflect.setPrototypeOf\",\n\t\"Reflect.preventExtensions\",\n\n\t\"Set.prototype.add\",\n\t\"Set.prototype.delete\",\n\t\"Set.prototype.clear\",\n\t\"WeakSet.prototype.add\",\n\t\"WeakSet.prototype.delete\",\n\n\t\"Map.prototype.set\",\n\t\"Map.prototype.delete\",\n\t\"Map.prototype.clear\",\n\t\"WeakMap.prototype.set\",\n\t\"WeakMap.prototype.delete\",\n\n\t\"Date.prototype.setTime\",\n\t\"Date.prototype.setMilliseconds\",\n\t\"Date.prototype.setUTCSeconds\",\n\t\"Date.prototype.setSeconds\",\n\t\"Date.prototype.setMinutes\",\n\t\"Date.prototype.setHours\",\n\t\"Date.prototype.setDate\",\n\t\"Date.prototype.setMonth\",\n\t\"Date.prototype.setFullYear\",\n\t\"Date.prototype.setYear\",\n\t\"Date.prototype.setUTCMilliseconds\",\n\t\"Date.prototype.setUTCMinutes\",\n\t\"Date.prototype.setUTCHours\",\n\t\"Date.prototype.setUTCDate\",\n\t\"Date.prototype.setUTCMonth\",\n\t\"Date.prototype.setUTCFullYear\",\n\n\t\"RegExp.prototype.compile\",\n\n\t\"Int8Array.prototype.set\",\n\t\"Uint8Array.prototype.set\",\n\t\"Uint8ClampedArray.prototype.set\",\n\t\"Int16Array.prototype.set\",\n\t\"Uint16Array.prototype.set\",\n\t\"Int32Array.prototype.set\",\n\t\"Uint32Array.prototype.set\",\n\t\"Float32Array.prototype.set\",\n\t\"Float64Array.prototype.set\",\n\t\"BigInt64Array.prototype.set\",\n\t\"BigUint64Array.prototype.set\",\n\n\t\"Int8Array.prototype.fill\",\n\t\"Uint8Array.prototype.fill\",\n\t\"Uint8ClampedArray.prototype.fill\",\n\t\"Int16Array.prototype.fill\",\n\t\"Uint16Array.prototype.fill\",\n\t\"Int32Array.prototype.fill\",\n\t\"Uint32Array.prototype.fill\",\n\t\"Float32Array.prototype.fill\",\n\t\"Float64Array.prototype.fill\",\n\t\"BigInt64Array.prototype.fill\",\n\t\"BigUint64Array.prototype.fill\",\n\n\t\"Int8Array.prototype.reverse\",\n\t\"Uint8Array.prototype.reverse\",\n\t\"Uint8ClampedArray.prototype.reverse\",\n\t\"Int16Array.prototype.reverse\",\n\t\"Uint16Array.prototype.reverse\",\n\t\"Int32Array.prototype.reverse\",\n\t\"Uint32Array.prototype.reverse\",\n\t\"Float32Array.prototype.reverse\",\n\t\"Float64Array.prototype.reverse\",\n\t\"BigInt64Array.prototype.reverse\",\n\t\"BigUint64Array.prototype.reverse\",\n\n\t\"Int8Array.prototype.sort\",\n\t\"Uint8Array.prototype.sort\",\n\t\"Uint8ClampedArray.prototype.sort\",\n\t\"Int16Array.prototype.sort\",\n\t\"Uint16Array.prototype.sort\",\n\t\"Int32Array.prototype.sort\",\n\t\"Uint32Array.prototype.sort\",\n\t\"Float32Array.prototype.sort\",\n\t\"Float64Array.prototype.sort\",\n\t\"BigInt64Array.prototype.sort\",\n\t\"BigUint64Array.prototype.sort\",\n\n\t\"Int8Array.prototype.copyWithin\",\n\t\"Uint8Array.prototype.copyWithin\",\n\t\"Uint8ClampedArray.prototype.copyWithin\",\n\t\"Int16Array.prototype.copyWithin\",\n\t\"Uint16Array.prototype.copyWithin\",\n\t\"Int32Array.prototype.copyWithin\",\n\t\"Uint32Array.prototype.copyWithin\",\n\t\"Float32Array.prototype.copyWithin\",\n\t\"Float64Array.prototype.copyWithin\",\n\t\"BigInt64Array.prototype.copyWithin\",\n\t\"BigUint64Array.prototype.copyWithin\",\n\n\t\"ArrayBuffer.prototype.transfer\",\n\t\"ArrayBuffer.prototype.transferToFixedLength\",\n\n\t\"SharedArrayBuffer.prototype.grow\",\n\n\t\"DataView.prototype.setInt8\",\n\t\"DataView.prototype.setUint8\",\n\t\"DataView.prototype.setInt16\",\n\t\"DataView.prototype.setUint16\",\n\t\"DataView.prototype.setInt32\",\n\t\"DataView.prototype.setUint32\",\n\t\"DataView.prototype.setFloat32\",\n\t\"DataView.prototype.setFloat64\",\n\t\"DataView.prototype.setBigInt64\",\n\t\"DataView.prototype.setBigUint64\",\n\n\t\"Promise.prototype.catch\",\n\t\"Promise.prototype.finally\",\n\n\t\"Generator.prototype.next\",\n\t\"Generator.prototype.return\",\n\t\"Generator.prototype.throw\",\n\n\t\"AsyncGenerator.prototype.next\",\n\t\"AsyncGenerator.prototype.return\",\n\t\"AsyncGenerator.prototype.throw\",\n\n\t\"Iterator.prototype.next\",\n\n\t\"WeakRef.prototype.deref\",\n\n\t\"FinalizationRegistry.prototype.register\",\n\t\"FinalizationRegistry.prototype.unregister\",\n\n\t\"URLSearchParams.prototype.append\",\n\t\"URLSearchParams.prototype.delete\",\n\t\"URLSearchParams.prototype.set\",\n\t\"URLSearchParams.prototype.sort\",\n\n\t\"FormData.prototype.append\",\n\t\"FormData.prototype.delete\",\n\t\"FormData.prototype.set\",\n\n\t\"Headers.prototype.append\",\n\t\"Headers.prototype.delete\",\n\t\"Headers.prototype.set\",\n\n\t// Function call/apply/bind can be used to invoke with arbitrary `this`\n\t\"Function.prototype.call\",\n\t\"Function.prototype.apply\",\n\t\"Function.prototype.bind\",\n\t\"Function.prototype.constructor\",\n\n\t// Legacy lookup helpers\n\t\"Object.prototype.__lookupGetter__\",\n\t\"Object.prototype.__lookupSetter__\",\n\n\t// Constructor property can be abused to retrieve the Function constructor\n\t\"Object.prototype.constructor\",\n];\n\nconst dangerousMethods = [\n\t\"Object.getPrototypeOf\",\n\t// Various reflective/object-inspection APIs that may expose internals\n\t\"Object.getOwnPropertyDescriptor\",\n\t\"Object.getOwnPropertyDescriptors\",\n\t\"Object.getOwnPropertyNames\",\n\t\"Object.getOwnPropertySymbols\",\n\t\"Object.getOwnPropertyDescriptors\",\n];\n\n// Some prototype-style aliases/properties that can be used to break sandboxes\nmutableMethods.push(\"Object.prototype.__proto__\");\n\n/**\n * List of methods to block due to mutability or dangerousness\n */\nexport const blockedMethods = [...mutableMethods, ...dangerousMethods];\n\n/**\n * List of global built-ins to block entirely\n */\nexport const blockedGlobalBuiltIns = [\n\t\"Function\",\n\t\"GeneratorFunction\",\n\t\"AsyncFunction\",\n\t\"AsyncGeneratorFunction\",\n\t\"eval\",\n\t\"setTimeout\",\n\t\"setInterval\",\n\t\"clearTimeout\",\n\t\"clearInterval\",\n\t\"setImmediate\",\n\t\"XMLHttpRequest\",\n\t\"fetch\",\n\t\"WebSocket\",\n\t\"globalThis\",\n\n\t// Node / runtime globals\n\t\"process\",\n\t\"require\",\n\t\"module\",\n\t\"exports\",\n\t\"global\",\n\t\"Buffer\",\n\t\"setImmediate\",\n\t\"clearImmediate\",\n\n\t// Worker / threading / messaging\n\t\"importScripts\",\n\t\"Worker\",\n\t\"SharedWorker\",\n\t\"ServiceWorker\",\n\t\"BroadcastChannel\",\n\t\"MessageChannel\",\n\t\"MessagePort\",\n\t\"postMessage\",\n\n\t// Host environment globals (browser)\n\t\"window\",\n\t\"document\",\n\t\"navigator\",\n\t\"location\",\n\t\"localStorage\",\n\t\"sessionStorage\",\n\t\"indexedDB\",\n\t\"performance\",\n\n\t// Low-level / concurrent / binary APIs\n\t\"Proxy\",\n\t\"Reflect\",\n\t\"Atomics\",\n\t\"WebAssembly\",\n\n\t// Console and internationalization\n\t\"console\",\n\t\"Intl\",\n\n\t// Other runtimes\n\t\"Deno\",\n];\n","import * as acorn from \"acorn\";\nimport globals from \"globals\";\nimport { blockedGlobalBuiltIns, blockedMethods } from \"./block.js\";\n\n// Error message constants for better maintainability\nconst ERROR_MESSAGES = {\n\tCAN_NOT_READ_PROPERTY: \"Cannot read property of {0} (reading '{1}')\",\n\tIS_INVALID_SYNTAX: \"{0} is not a valid syntax\",\n\tIS_NOT_FUNCTION: \"{0} is not a function\",\n\tIS_NOT_DEFINED: \"{0} is not defined\",\n\tIS_NOT_ALLOWED: \"{0} is not allowed\",\n};\n\n/**\n * Renders an error message by replacing placeholders with context values.\n * @param {string} template\n * @param {Record<string, any>} context\n * @example\n * ```js\n * const msg = renderErrorMessage(\"Cannot call mutable prototype method: {method}\", { method: \"push\" });\n * ```\n */\nconst renderErrorMessage = (template, context = {}) => template.replace(/{(\\w+)}/g, (_, key) => String(context[key]));\n\nconst BINARY_OPERATION_MAP = {\n\t\"+\": (a, b) => a + b,\n\t\"-\": (a, b) => a - b,\n\t\"*\": (a, b) => a * b,\n\t\"**\": (a, b) => a ** b,\n\t\"==\": (a, b) => a == b,\n\t\"===\": (a, b) => a === b,\n\t\"!=\": (a, b) => a != b,\n\t\"!==\": (a, b) => a !== b,\n\t\">\": (a, b) => a > b,\n\t\">=\": (a, b) => a >= b,\n\t\"<\": (a, b) => a < b,\n\t\"<=\": (a, b) => a <= b,\n\t\"%\": (a, b) => a % b,\n\t\"/\": (a, b) => a / b,\n\t\"|\": (a, b) => a | b,\n\t\"&\": (a, b) => a & b,\n\t\"^\": (a, b) => a ^ b,\n\t\"<<\": (a, b) => a << b,\n\t\">>\": (a, b) => a >> b,\n\t\">>>\": (a, b) => a >>> b,\n\tin: (a, b) => a in b,\n\tinstanceof: (a, b) => a instanceof b,\n};\n\nfunction createGlobalScope() {\n\tconst scope = Object.create(null);\n\tconst { builtin } = globals;\n\n\tfor (const key in builtin) {\n\t\tif (blockedGlobalBuiltIns.includes(key)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t/** @type {boolean} */\n\t\tconst isWritable = builtin[key];\n\n\t\tObject.defineProperty(scope, key, {\n\t\t\tvalue: globalThis[key],\n\t\t\twritable: isWritable,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(scope, \"globalThis\", {\n\t\tvalue: scope,\n\t\twritable: false,\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t});\n\n\treturn scope;\n}\n\nconst getBlockedMethods = (() => {\n\t/**\n\t * @type {Map<Function, string>}\n\t */\n\tlet BLOCKED_METHODS = null;\n\n\treturn () => {\n\t\tif (BLOCKED_METHODS) return BLOCKED_METHODS;\n\n\t\tconst map = new Map();\n\t\tfor (const path of blockedMethods) {\n\t\t\tconst [object, ...properties] = path.split(\".\");\n\t\t\tlet current = globalThis[object];\n\t\t\tfor (const prop of properties) {\n\t\t\t\tif (current && Object.hasOwn(current, prop)) {\n\t\t\t\t\tcurrent = current[prop];\n\t\t\t\t} else {\n\t\t\t\t\tcurrent = null;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof current === \"function\") map.set(current, path);\n\t\t}\n\t\tBLOCKED_METHODS = map;\n\n\t\treturn BLOCKED_METHODS;\n\t};\n})();\n\n/**\n * A JavaScript expression evaluator that safely evaluates expressions within a sandboxed environment.\n * Supports various JavaScript features including arithmetic, logical operations, functions, and more.\n *\n * Security features:\n * - Blocks mutable methods to prevent side effects\n * - No access to eval() or Function() constructor\n * - Sandboxed scope with limited global objects\n *\n * @example\n * const evaluator = new Evaluator({ x: 10, y: 20 });\n * evaluator.evaluate('x + y') // returns 30\n */\nexport class Evaluator {\n\t/**\n\t * Creates a new Evaluator instance with a custom variable context.\n\t * The scope hierarchy is: user variables -> global scope\n\t * @param {Object} [variables={}] - An optional object containing variables to make available in the evaluation context\n\t */\n\tconstructor(variables = Object.create(null)) {\n\t\tthis.scopes = [structuredClone(variables), createGlobalScope()].filter((scope) => scope !== null && scope !== undefined);\n\t\tthis.source = undefined;\n\t}\n\n\t/**\n\t * Evaluates a JavaScript expression with an optional context.\n\t * @param {string} expression\n\t * @param {unknown} [context]\n\t * @returns\n\t */\n\tstatic evaluate(expression, context) {\n\t\tconst evaluator = new Evaluator(context);\n\t\treturn evaluator.evaluate(expression);\n\t}\n\n\t/**\n\t * Parses and evaluates a JavaScript expression using acorn parser.\n\t * @param {string} expression - The JavaScript expression to evaluate\n\t * @returns {*} The result of the evaluation\n\t * @throws {SyntaxError} If the expression has invalid syntax\n\t * @throws {ReferenceError} If referencing undefined variables\n\t * @throws {TypeError} If performing invalid operations\n\t */\n\tevaluate(expression) {\n\t\tthis.source = expression;\n\n\t\tconst ast = acorn.parse(expression, { ecmaVersion: \"latest\" });\n\n\t\t// Start recursive evaluation from the root node\n\t\ttry {\n\t\t\treturn this.execute(ast.body);\n\t\t} finally {\n\t\t\tthis.source = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Executes an array of AST body nodes sequentially.\n\t * @private\n\t * @param {Array} body - Array of AST nodes to execute\n\t * @returns {*} The result of the last executed node\n\t */\n\texecute(body) {\n\t\tlet result;\n\n\t\tfor (const node of body) {\n\t\t\tresult = this.visit(node);\n\t\t}\n\n\t\tif (typeof result === \"function\") {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning functions from expressions\"]));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Visits an AST node and delegates to the appropriate handler based on node type.\n\t * @private\n\t * @param {import(\"acorn\").Node} node - The AST node to visit\n\t * @returns {*} The result of visiting the node\n\t */\n\tvisit(node) {\n\t\tswitch (node.type) {\n\t\t\tcase \"ExpressionStatement\": {\n\t\t\t\treturn this.visit(node.expression);\n\t\t\t}\n\t\t\tcase \"BinaryExpression\": {\n\t\t\t\treturn this.handleBinaryExpression(node);\n\t\t\t}\n\t\t\tcase \"LogicalExpression\": {\n\t\t\t\treturn this.handleLogicalExpression(node);\n\t\t\t}\n\t\t\tcase \"UnaryExpression\": {\n\t\t\t\treturn this.handleUnaryExpression(node);\n\t\t\t}\n\t\t\tcase \"Identifier\": {\n\t\t\t\treturn this.handleIdentifier(node);\n\t\t\t}\n\t\t\tcase \"Literal\": {\n\t\t\t\treturn node.value;\n\t\t\t}\n\t\t\tcase \"MemberExpression\": {\n\t\t\t\treturn this.handleMemberExpression(node);\n\t\t\t}\n\t\t\tcase \"ArrayExpression\": {\n\t\t\t\treturn this.handleArrayExpression(node);\n\t\t\t}\n\t\t\tcase \"SpreadElement\": {\n\t\t\t\treturn this.handleSpreadElement(node);\n\t\t\t}\n\t\t\tcase \"ObjectExpression\": {\n\t\t\t\treturn this.handleObjectExpression(node);\n\t\t\t}\n\t\t\tcase \"FunctionExpression\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function expression\"]));\n\t\t\t}\n\t\t\tcase \"ArrowFunctionExpression\": {\n\t\t\t\treturn this.handleArrowFunctionExpression(node);\n\t\t\t}\n\t\t\tcase \"CallExpression\": {\n\t\t\t\treturn this.handleCallExpression(node);\n\t\t\t}\n\t\t\tcase \"ConditionalExpression\": {\n\t\t\t\treturn this.visit(node.test) ? this.visit(node.consequent) : this.visit(node.alternate);\n\t\t\t}\n\t\t\tcase \"NewExpression\": {\n\t\t\t\tif (node.callee.type !== \"Identifier\") {\n\t\t\t\t\tthrow new Error(`Unsupported callee type '${node.callee.type}' in new expression`);\n\t\t\t\t}\n\n\t\t\t\tif (node.callee.name === \"Function\") {\n\t\t\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"new Function() constructor\"]));\n\t\t\t\t}\n\n\t\t\t\tconst Constructor = this.visit(node.callee);\n\n\t\t\t\t// 仅在存在参数时构建数组\n\t\t\t\tconst args = node.arguments.length ? node.arguments.map((arg) => this.visit(arg)) : [];\n\n\t\t\t\treturn new Constructor(...args);\n\t\t\t}\n\t\t\tcase \"ChainExpression\": {\n\t\t\t\treturn this.visit(node.expression);\n\t\t\t}\n\t\t\tcase \"TemplateLiteral\": {\n\t\t\t\treturn this.handleTemplateLiteral(node);\n\t\t\t}\n\t\t\tcase \"ThisExpression\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'this' expression\"]));\n\t\t\t}\n\t\t\tcase \"WithStatement\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'with' statement\"]));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tlet content = this.source.slice(node.start, node.end);\n\n\t\t\t\tif (content.length > 20) {\n\t\t\t\t\tcontent = content.slice(0, 17) + \"...\";\n\t\t\t\t}\n\n\t\t\t\tthrow new SyntaxError(`'${content}'` + \" \" + renderErrorMessage(ERROR_MESSAGES.IS_INVALID_SYNTAX, [content]));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles binary expressions (arithmetic and comparison operations).\n\t * @param {import('acorn').BinaryExpression} node\n\t * @private\n\t */\n\thandleBinaryExpression(node) {\n\t\tconst op = node.operator;\n\t\tconst left = this.visit(node.left);\n\t\tconst right = this.visit(node.right);\n\n\t\tif (BINARY_OPERATION_MAP.hasOwnProperty(op)) {\n\t\t\treturn BINARY_OPERATION_MAP[op](left, right);\n\t\t}\n\n\t\tthrow new SyntaxError(`Unsupported operator: ${node.operator}`);\n\t}\n\n\t/**\n\t * Handles logical expressions (&&, ||, ??).\n\t * Implements proper short-circuit evaluation for performance.\n\t * @private\n\t */\n\thandleLogicalExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"&&\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? this.visit(node.right) : left;\n\t\t\t}\n\t\t\tcase \"||\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tcase \"??\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left !== null && left !== undefined ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported logical operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles unary expressions (-, +, !, ~, typeof, void).\n\t * @private\n\t */\n\thandleUnaryExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"-\": {\n\t\t\t\treturn -this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"+\": {\n\t\t\t\treturn +this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"!\": {\n\t\t\t\treturn !this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"~\": {\n\t\t\t\treturn ~this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"typeof\": {\n\t\t\t\treturn typeof this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"void\": {\n\t\t\t\treturn void this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"delete\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Delete operator\"]));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported unary operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles identifier (variable) lookups in the scope chain.\n\t * @private\n\t */\n\thandleIdentifier(node) {\n\t\tconst name = node.name;\n\t\tfor (const scope of this.scopes) {\n\t\t\tif (Object.hasOwn(scope, name)) {\n\t\t\t\treturn scope[name];\n\t\t\t}\n\t\t}\n\n\t\tthrow new ReferenceError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_DEFINED, [name]));\n\t}\n\n\t/**\n\t * Handles member expressions (property access like obj.prop or obj[prop]).\n\t * @private\n\t */\n\thandleMemberExpression(node) {\n\t\tconst object = this.visit(node.object);\n\n\t\t// Determine property name: either identifier name or computed value\n\t\tconst isStaticProperty = node.property.type === \"Identifier\" && !node.computed;\n\t\tconst property = isStaticProperty ? node.property.name : this.visit(node.property);\n\n\t\t// Prevent access to prototype properties\n\t\tif (typeof object !== \"undefined\" && object !== null && object[property] === object?.__proto__) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Accessing prototype properties\"]));\n\t\t}\n\n\t\tif (object === null || object === undefined) {\n\t\t\t// optional chaining\n\t\t\tif (node.optional) {\n\t\t\t\treturn void 0;\n\t\t\t}\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.CAN_NOT_READ_PROPERTY, [object, property]));\n\t\t}\n\n\t\treturn object[property];\n\t}\n\n\t/**\n\t * Handles array literal expressions.\n\t * @private\n\t */\n\thandleArrayExpression(node) {\n\t\tconst result = [];\n\n\t\tfor (let i = 0; i < node.elements.length; i++) {\n\t\t\tconst element = node.elements.at(i);\n\t\t\tconst value = this.visit(element);\n\n\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\tresult.push(...value);\n\t\t\t} else {\n\t\t\t\tresult.push(value);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Handles object literal expressions.\n\t * @returns\n\t */\n\thandleObjectExpression(node) {\n\t\tconst obj = {};\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === \"SpreadElement\") {\n\t\t\t\tObject.assign(obj, this.visit(prop.argument));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = prop.key.name || prop.key.value;\n\t\t\tconst value = this.visit(prop.value);\n\t\t\tobj[key] = value;\n\t\t}\n\t\treturn obj;\n\t}\n\n\thandleSpreadElement(node) {\n\t\treturn this.visit(node.argument);\n\t}\n\n\t/**\n\t * Handles arrow function expressions.\n\t * Creates a closure that captures the current scope and executes the function body\n\t * with parameters bound to a new scope.\n\t * @private\n\t */\n\thandleArrowFunctionExpression(node) {\n\t\treturn (...args) => {\n\t\t\t// Create new scope with parameters bound to arguments\n\t\t\tconst newScope = {};\n\t\t\tconst paramCount = node.params.length;\n\t\t\tfor (let i = 0; i < paramCount; i++) {\n\t\t\t\tnewScope[node.params[i].name] = args[i];\n\t\t\t}\n\n\t\t\t// Push new scope, evaluate body, then pop scope\n\t\t\tthis.scopes.unshift(newScope);\n\t\t\tconst result = this.visit(node.body);\n\t\t\tthis.scopes.shift();\n\t\t\treturn result;\n\t\t};\n\t}\n\n\t/**\n\t * Handles function call expressions, including optional chaining.\n\t * @private\n\t */\n\thandleCallExpression(node) {\n\t\tconst func = this.visit(node.callee);\n\n\t\tconst isOptional = node.optional || node.callee.optional;\n\t\tif ((func === undefined || func === null) && isOptional) {\n\t\t\treturn void 0;\n\t\t}\n\n\t\tif (func === Function) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\n\t\tif (getBlockedMethods().has(func)) {\n\t\t\tconst path = getBlockedMethods().get(func);\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [path]));\n\t\t}\n\n\t\t// 仅在存在参数时构建数组\n\t\tconst args = (() => {\n\t\t\tif (node.arguments.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tlet result = [];\n\n\t\t\tfor (let i = 0; i < node.arguments.length; i++) {\n\t\t\t\tconst element = node.arguments.at(i);\n\t\t\t\tconst value = this.visit(element);\n\n\t\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\t\tresult.push(...value);\n\t\t\t\t} else {\n\t\t\t\t\tresult.push(value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t})();\n\n\t\tconst target = node.callee.type === \"MemberExpression\" ? this.visit(node.callee.object) : null;\n\n\t\tif (typeof func !== \"function\") {\n\t\t\tconst calledString = getNodeString(node.callee);\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_FUNCTION, [calledString]));\n\t\t}\n\n\t\treturn func.apply(target, args);\n\t}\n\n\t/**\n\t * Handles template literal expressions.\n\t * More efficient implementation that interleaves quasis and expressions without sorting.\n\t * @private\n\t */\n\thandleTemplateLiteral(node) {\n\t\tlet result = \"\";\n\t\tconst expressionCount = node.expressions.length;\n\n\t\tfor (let i = 0; i < node.quasis.length; i++) {\n\t\t\tresult += node.quasis[i].value.raw;\n\t\t\tif (i < expressionCount) {\n\t\t\t\tresult += this.visit(node.expressions[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\n/**\n *\n * @param {import('acorn').Node} node\n * @returns\n */\nexport function getNodeString(node) {\n\tswitch (node.type) {\n\t\tcase \"Identifier\": {\n\t\t\treturn node.name;\n\t\t}\n\t\tcase \"Literal\": {\n\t\t\treturn node.raw;\n\t\t}\n\t\tcase \"ArrayExpression\": {\n\t\t\treturn `[${node.elements.map((child) => getNodeString(child)).join(\",\")}]`;\n\t\t}\n\t\tcase \"ObjectExpression\": {\n\t\t\t// if keys is empty\n\t\t\tif (node.properties.length === 0) {\n\t\t\t\treturn \"{}\";\n\t\t\t}\n\n\t\t\treturn \"{(intermediate value)}\";\n\t\t}\n\t\tcase \"MemberExpression\": {\n\t\t\tconst objectStr = getNodeString(node.object);\n\t\t\tconst propertyStr = getNodeString(node.property);\n\n\t\t\tif (node.computed) {\n\t\t\t\treturn `${objectStr}[${propertyStr}]`;\n\t\t\t}\n\t\t\treturn `${objectStr}.${propertyStr}`;\n\t\t}\n\t\tdefault: {\n\t\t\treturn null;\n\t\t}\n\t}\n}\n","/**\n * 简单状态机模板解析器\n * 能够正确处理表达式中包含字符串、转义字符和结束标记的情况\n * @class SimpleStateTemplateParser\n */\nclass TemplateParser {\n\t/**\n\t * 创建解析器实例\n\t * @param {Object} [options] - 配置选项\n\t * @param {string} [options.expressionStart='{{'] - 表达式开始标记\n\t * @param {string} [options.expressionEnd='}}'] - 表达式结束标记\n\t * @param {boolean} [options.preserveWhitespace=true] - 是否保留表达式周围的空白字符\n\t */\n\tconstructor(options = {}) {\n\t\t// 表达式标记配置\n\t\tthis.exprStart = options.expressionStart || \"{{\";\n\t\tthis.exprEnd = options.expressionEnd || \"}}\";\n\n\t\t// 标记长度缓存,避免重复计算\n\t\tthis.startLen = this.exprStart.length;\n\t\tthis.endLen = this.exprEnd.length;\n\n\t\t// 其他配置\n\t\tthis.preserveWhitespace = options.preserveWhitespace === true;\n\t}\n\n\t/**\n\t * 解析模板字符串,将其转换为 token 数组\n\t * @param {string} template - 要解析的模板字符串\n\t * @returns {Array<{type: string, value: string}>} token 数组\n\t */\n\tparse(template) {\n\t\t// 输入验证\n\t\tif (typeof template !== \"string\") {\n\t\t\tthrow new TypeError(\"模板必须是字符串\");\n\t\t}\n\n\t\tconst tokens = []; // 存储解析结果的 token 数组\n\t\tconst length = template.length;\n\n\t\t// 状态机变量\n\t\tlet state = \"TEXT\"; // 当前状态:TEXT | EXPR | STRING_SQ | STRING_DQ | TEMPLATE | ESCAPE_*\n\t\tlet buffer = \"\"; // 当前状态的字符缓冲区\n\t\tlet exprStartPos = 0; // 当前表达式的开始位置(用于错误恢复)\n\t\tlet pos = 0; // 当前扫描位置\n\n\t\t// 主解析循环:逐个字符扫描模板\n\t\twhile (pos < length) {\n\t\t\tconst char = template[pos];\n\t\t\tconst nextChar = template[pos + 1];\n\n\t\t\t// 状态机核心逻辑\n\t\t\tswitch (state) {\n\t\t\t\t// ==================== 文本状态 ====================\n\t\t\t\tcase \"TEXT\":\n\t\t\t\t\t// 检查是否遇到表达式开始标记\n\t\t\t\t\tif (this._isMatch(pos, template, this.exprStart)) {\n\t\t\t\t\t\t// 将缓冲区中的文本保存为 token\n\t\t\t\t\t\tif (buffer.length > 0) {\n\t\t\t\t\t\t\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 切换到表达式状态\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t\texprStartPos = pos; // 记录表达式开始位置\n\t\t\t\t\t\tpos += this.startLen; // 跳过开始标记\n\t\t\t\t\t\tcontinue; // 继续处理下一个字符(跳过本次循环的剩余部分)\n\t\t\t\t\t}\n\t\t\t\t\t// 普通文本字符,添加到缓冲区\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 表达式状态 ====================\n\t\t\t\tcase \"EXPR\":\n\t\t\t\t\t// 在表达式中,需要处理各种字符串和转义字符\n\t\t\t\t\tif (char === \"'\") {\n\t\t\t\t\t\t// 进入单引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_SQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\t// 进入双引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\t// 进入模板字符串状态\n\t\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\t} else if (char === \"\\\\\") {\n\t\t\t\t\t\t// 遇到转义字符,根据当前上下文进入相应的转义状态\n\t\t\t\t\t\tif (nextChar === \"'\") state = \"ESCAPE_SQ\";\n\t\t\t\t\t\telse if (nextChar === '\"') state = \"ESCAPE_DQ\";\n\t\t\t\t\t\telse if (nextChar === \"`\") state = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t\telse state = \"ESCAPE_EXPR\";\n\t\t\t\t\t} else if (this._isMatch(pos, template, this.exprEnd)) {\n\t\t\t\t\t\t// 找到表达式结束标记,且不在字符串中\n\t\t\t\t\t\tconst exprValue = this.preserveWhitespace ? buffer : buffer.trim();\n\t\t\t\t\t\tif (exprValue.length > 0) {\n\t\t\t\t\t\t\ttokens.push({\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\tvalue: exprValue,\n\t\t\t\t\t\t\t\tstart: exprStartPos,\n\t\t\t\t\t\t\t\tend: pos + this.endLen,\n\t\t\t\t\t\t\t\tcontentStart: exprStartPos + this.startLen,\n\t\t\t\t\t\t\t\tcontentEnd: pos,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 重置状态,准备处理后续文本\n\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\tstate = \"TEXT\";\n\t\t\t\t\t\tpos += this.endLen; // 跳过结束标记\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// 将当前字符添加到表达式缓冲区\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 字符串状态 ====================\n\t\t\t\tcase \"STRING_SQ\": // 单引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_SQ\"; // 遇到转义字符\n\t\t\t\t\t} else if (char === \"'\") {\n\t\t\t\t\t\tstate = \"EXPR\"; // 字符串结束,回到表达式状态\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"STRING_DQ\": // 双引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_DQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"TEMPLATE\": // 模板字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 转义状态 ====================\n\t\t\t\t// 转义状态:处理转义字符,然后返回到之前的状态\n\t\t\t\tcase \"ESCAPE_SQ\":\n\t\t\t\t\tbuffer += char; // 添加转义后的字符\n\t\t\t\t\tstate = \"STRING_SQ\"; // 回到单引号字符串状态\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_DQ\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_TEMPLATE\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_EXPR\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// 移动到下一个字符\n\t\t\tpos++;\n\t\t}\n\n\t\t// ==================== 后处理 ====================\n\t\t// 处理扫描结束后缓冲区中剩余的内容\n\t\tif (buffer.length > 0) {\n\t\t\tif (state === \"TEXT\") {\n\t\t\t\t// 剩余的文本内容\n\t\t\t\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t} else {\n\t\t\t\t// 未完成的表达式,将其作为普通文本处理\n\t\t\t\t// 这里可以根据需要选择不同的错误处理策略:\n\t\t\t\t// 1. 抛出错误\n\t\t\t\t// 2. 忽略未完成的表达式\n\t\t\t\t// 3. 将其作为文本处理(当前实现)\n\t\t\t\tconst incompleteExpr = this.exprStart + buffer;\n\t\t\t\ttokens.push({ type: \"text\", value: incompleteExpr, start: exprStartPos, end: pos });\n\n\t\t\t\t// 可选:输出警告\n\t\t\t\tconsole.warn(`警告:在位置 ${exprStartPos} 开始的表达式未正确结束`);\n\t\t\t}\n\t\t}\n\n\t\treturn tokens;\n\t}\n\n\t/**\n\t * 检查指定位置是否匹配给定的字符序列\n\t * @param {number} pos - 开始检查的位置\n\t * @param {string} template - 模板字符串\n\t * @param {string} sequence - 要匹配的字符序列\n\t * @returns {boolean} 是否匹配\n\t * @private\n\t */\n\t_isMatch(pos, template, sequence) {\n\t\t// 检查剩余长度是否足够\n\t\tif (pos + sequence.length > template.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// 逐个字符比较\n\t\tfor (let i = 0; i < sequence.length; i++) {\n\t\t\tif (template[pos + i] !== sequence[i]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * 静态方法:快速解析模板\n\t * @param {string} template - 模板字符串\n\t * @param {Object} [options] - 配置选项\n\t * @returns {Array} token 数组\n\t */\n\tstatic parse(template, options) {\n\t\tconst parser = new TemplateParser(options);\n\t\treturn parser.parse(template);\n\t}\n}\n\nexport { TemplateParser };\n","import { Evaluator } from \"./Evaluator.js\";\nimport { TemplateParser } from \"./TemplateParser.js\";\n\nexport { Evaluator, TemplateParser };\n\n/**\n * Evaluates a JavaScript expression with an optional context.\n * @param {string} expression - The JavaScript expression to evaluate\n * @param {unknown} [context] - Optional context object with variables to use in the expression\n * @returns {*} The result of evaluating the expression\n * @example\n * evalExpression('a + b', { a: 1, b: 2 }) // returns 3\n */\nexport function evalExpression(expression, context) {\n\treturn Evaluator.evaluate(expression, context);\n}\n\n/**\n * Evaluates a template string by replacing {{ expression }} patterns with their evaluated values.\n * Undefined variables in expressions are replaced with empty strings instead of throwing errors.\n * @param {string} template - The template string containing {{ expression }} patterns\n * @param {Object} [context] - Optional context object with variables to use in expressions\n * @param {Object} [templateParserOptions] - Optional options for the template parser\n * @returns {string} The template with all expressions evaluated and replaced\n * @example\n * evalTemplate('Hello {{ name }}!', { name: 'World' }) // returns 'Hello World!'\n */\nexport function evalTemplate(template, context, templateParserOptions) {\n\tlet result = \"\";\n\n\tconst typeHandler = {\n\t\ttext: (token) => token.value,\n\t\texpression: (token) => {\n\t\t\ttry {\n\t\t\t\treturn Evaluator.evaluate(token.value, context);\n\t\t\t} catch (error) {\n\t\t\t\t// Replace undefined variables with empty string for graceful degradation\n\t\t\t\tif (error instanceof ReferenceError && error.message.endsWith(\"is not defined\")) {\n\t\t\t\t\treturn \"undefined\";\n\t\t\t\t} else {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n\n\tfor (const token of TemplateParser.parse(template, templateParserOptions)) {\n\t\t// Unknown token type, treat as text\n\t\tconst handler = typeHandler[token.type] ?? typeHandler[\"text\"];\n\n\t\tresult += handler(token);\n\t}\n\n\treturn result;\n}\n"],"names":["mutableMethods","dangerousMethods","blockedMethods","blockedGlobalBuiltIns","ERROR_MESSAGES","renderErrorMessage","template","context","_","key","String","BINARY_OPERATION_MAP","a","b","_instanceof","createGlobalScope","scope","Object","builtin","globals","isWritable","globalThis","getBlockedMethods","BLOCKED_METHODS","map","Map","_iteratorError","path","_path_split","object","properties","current","_iteratorError1","prop","Evaluator","variables","structuredClone","undefined","evaluate","expression","ast","acorn","execute","body","result","node","Error","visit","SyntaxError","Constructor","args","arg","content","handleBinaryExpression","op","left","right","handleLogicalExpression","left1","left2","handleUnaryExpression","_type_of","handleIdentifier","name","ReferenceError","handleMemberExpression","isStaticProperty","property","TypeError","handleArrayExpression","i","element","value","_result","handleObjectExpression","obj","handleSpreadElement","handleArrowFunctionExpression","newScope","paramCount","handleCallExpression","func","isOptional","Function","target","calledString","getNodeString","handleTemplateLiteral","expressionCount","evaluator","child","objectStr","propertyStr","TemplateParser","options","parse","tokens","length","state","buffer","exprStartPos","pos","char","nextChar","exprValue","incompleteExpr","console","_isMatch","sequence","parser","evalExpression","evalTemplate","templateParserOptions","typeHandler","token","error","_typeHandler_token_type","handler"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,iBAAiB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IA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wF,QAANxF,MAAAA,KAAAA;gBAEY0F;YAAhB,IAAMC,UAAUD,QAAAA,CAAAA,0BAAAA,WAAW,CAACF,MAAM,IAAI,CAAC,AAAD,IAAtBE,0BAA2BH,WAAW,CAAC,OAAO;YAE9DrE,UAAUyE,QAAQH;QACnB;;QALKxF,oBAAAA;QAAAA,iBAAAA;;;iBAAAA,6BAAAA,AAAAA,QAAAA,UAAAA,MAAAA,EAAAA,UAAAA,MAAAA;;gBAAAA,mB,MAAAA;;;IAOL,OAAOkB;AACR"}
1
+ {"version":3,"file":"esm/index.mjs","sources":["../../src/block.js","../../src/Evaluator.js","../../src/TemplateParser.js","../../src/index.js"],"sourcesContent":["const mutableMethods = [\n\t\"Array.prototype.push\",\n\t\"Array.prototype.pop\",\n\t\"Array.prototype.shift\",\n\t\"Array.prototype.unshift\",\n\t\"Array.prototype.splice\",\n\t\"Array.prototype.reverse\",\n\t\"Array.prototype.sort\",\n\t\"Array.prototype.fill\",\n\t\"Array.prototype.copyWithin\",\n\n\t\"Object.defineProperty\",\n\t\"Object.defineProperties\",\n\t\"Object.preventExtensions\",\n\t\"Object.seal\",\n\t\"Object.freeze\",\n\t\"Object.setPrototypeOf\",\n\t\"Object.assign\",\n\t\"Object.prototype.__defineGetter__\",\n\t\"Object.prototype.__defineSetter__\",\n\n\t\"Reflect.set\",\n\t\"Reflect.defineProperty\",\n\t\"Reflect.deleteProperty\",\n\t\"Reflect.setPrototypeOf\",\n\t\"Reflect.preventExtensions\",\n\n\t\"Set.prototype.add\",\n\t\"Set.prototype.delete\",\n\t\"Set.prototype.clear\",\n\t\"WeakSet.prototype.add\",\n\t\"WeakSet.prototype.delete\",\n\n\t\"Map.prototype.set\",\n\t\"Map.prototype.delete\",\n\t\"Map.prototype.clear\",\n\t\"WeakMap.prototype.set\",\n\t\"WeakMap.prototype.delete\",\n\n\t\"Date.prototype.setTime\",\n\t\"Date.prototype.setMilliseconds\",\n\t\"Date.prototype.setUTCSeconds\",\n\t\"Date.prototype.setSeconds\",\n\t\"Date.prototype.setMinutes\",\n\t\"Date.prototype.setHours\",\n\t\"Date.prototype.setDate\",\n\t\"Date.prototype.setMonth\",\n\t\"Date.prototype.setFullYear\",\n\t\"Date.prototype.setYear\",\n\t\"Date.prototype.setUTCMilliseconds\",\n\t\"Date.prototype.setUTCMinutes\",\n\t\"Date.prototype.setUTCHours\",\n\t\"Date.prototype.setUTCDate\",\n\t\"Date.prototype.setUTCMonth\",\n\t\"Date.prototype.setUTCFullYear\",\n\n\t\"RegExp.prototype.compile\",\n\n\t\"Int8Array.prototype.set\",\n\t\"Uint8Array.prototype.set\",\n\t\"Uint8ClampedArray.prototype.set\",\n\t\"Int16Array.prototype.set\",\n\t\"Uint16Array.prototype.set\",\n\t\"Int32Array.prototype.set\",\n\t\"Uint32Array.prototype.set\",\n\t\"Float32Array.prototype.set\",\n\t\"Float64Array.prototype.set\",\n\t\"BigInt64Array.prototype.set\",\n\t\"BigUint64Array.prototype.set\",\n\n\t\"Int8Array.prototype.fill\",\n\t\"Uint8Array.prototype.fill\",\n\t\"Uint8ClampedArray.prototype.fill\",\n\t\"Int16Array.prototype.fill\",\n\t\"Uint16Array.prototype.fill\",\n\t\"Int32Array.prototype.fill\",\n\t\"Uint32Array.prototype.fill\",\n\t\"Float32Array.prototype.fill\",\n\t\"Float64Array.prototype.fill\",\n\t\"BigInt64Array.prototype.fill\",\n\t\"BigUint64Array.prototype.fill\",\n\n\t\"Int8Array.prototype.reverse\",\n\t\"Uint8Array.prototype.reverse\",\n\t\"Uint8ClampedArray.prototype.reverse\",\n\t\"Int16Array.prototype.reverse\",\n\t\"Uint16Array.prototype.reverse\",\n\t\"Int32Array.prototype.reverse\",\n\t\"Uint32Array.prototype.reverse\",\n\t\"Float32Array.prototype.reverse\",\n\t\"Float64Array.prototype.reverse\",\n\t\"BigInt64Array.prototype.reverse\",\n\t\"BigUint64Array.prototype.reverse\",\n\n\t\"Int8Array.prototype.sort\",\n\t\"Uint8Array.prototype.sort\",\n\t\"Uint8ClampedArray.prototype.sort\",\n\t\"Int16Array.prototype.sort\",\n\t\"Uint16Array.prototype.sort\",\n\t\"Int32Array.prototype.sort\",\n\t\"Uint32Array.prototype.sort\",\n\t\"Float32Array.prototype.sort\",\n\t\"Float64Array.prototype.sort\",\n\t\"BigInt64Array.prototype.sort\",\n\t\"BigUint64Array.prototype.sort\",\n\n\t\"Int8Array.prototype.copyWithin\",\n\t\"Uint8Array.prototype.copyWithin\",\n\t\"Uint8ClampedArray.prototype.copyWithin\",\n\t\"Int16Array.prototype.copyWithin\",\n\t\"Uint16Array.prototype.copyWithin\",\n\t\"Int32Array.prototype.copyWithin\",\n\t\"Uint32Array.prototype.copyWithin\",\n\t\"Float32Array.prototype.copyWithin\",\n\t\"Float64Array.prototype.copyWithin\",\n\t\"BigInt64Array.prototype.copyWithin\",\n\t\"BigUint64Array.prototype.copyWithin\",\n\n\t\"ArrayBuffer.prototype.transfer\",\n\t\"ArrayBuffer.prototype.transferToFixedLength\",\n\n\t\"SharedArrayBuffer.prototype.grow\",\n\n\t\"DataView.prototype.setInt8\",\n\t\"DataView.prototype.setUint8\",\n\t\"DataView.prototype.setInt16\",\n\t\"DataView.prototype.setUint16\",\n\t\"DataView.prototype.setInt32\",\n\t\"DataView.prototype.setUint32\",\n\t\"DataView.prototype.setFloat32\",\n\t\"DataView.prototype.setFloat64\",\n\t\"DataView.prototype.setBigInt64\",\n\t\"DataView.prototype.setBigUint64\",\n\n\t\"Promise.prototype.catch\",\n\t\"Promise.prototype.finally\",\n\n\t\"Generator.prototype.next\",\n\t\"Generator.prototype.return\",\n\t\"Generator.prototype.throw\",\n\n\t\"AsyncGenerator.prototype.next\",\n\t\"AsyncGenerator.prototype.return\",\n\t\"AsyncGenerator.prototype.throw\",\n\n\t\"Iterator.prototype.next\",\n\n\t\"WeakRef.prototype.deref\",\n\n\t\"FinalizationRegistry.prototype.register\",\n\t\"FinalizationRegistry.prototype.unregister\",\n\n\t\"URLSearchParams.prototype.append\",\n\t\"URLSearchParams.prototype.delete\",\n\t\"URLSearchParams.prototype.set\",\n\t\"URLSearchParams.prototype.sort\",\n\n\t\"FormData.prototype.append\",\n\t\"FormData.prototype.delete\",\n\t\"FormData.prototype.set\",\n\n\t\"Headers.prototype.append\",\n\t\"Headers.prototype.delete\",\n\t\"Headers.prototype.set\",\n\n\t// Function call/apply/bind can be used to invoke with arbitrary `this`\n\t\"Function.prototype.call\",\n\t\"Function.prototype.apply\",\n\t\"Function.prototype.bind\",\n\t\"Function.prototype.constructor\",\n\n\t// Legacy lookup helpers\n\t\"Object.prototype.__lookupGetter__\",\n\t\"Object.prototype.__lookupSetter__\",\n\n\t// Constructor property can be abused to retrieve the Function constructor\n\t\"Object.prototype.constructor\",\n];\n\nconst dangerousMethods = [\n\t\"Object.getPrototypeOf\",\n\t// Various reflective/object-inspection APIs that may expose internals\n\t\"Object.getOwnPropertyDescriptor\",\n\t\"Object.getOwnPropertyDescriptors\",\n\t\"Object.getOwnPropertyNames\",\n\t\"Object.getOwnPropertySymbols\",\n\t\"Object.getOwnPropertyDescriptors\",\n];\n\n// Some prototype-style aliases/properties that can be used to break sandboxes\nmutableMethods.push(\"Object.prototype.__proto__\");\n\n/**\n * List of methods to block due to mutability or dangerousness\n */\nexport const blockedMethods = [...mutableMethods, ...dangerousMethods];\n\n/**\n * List of global built-ins to block entirely\n */\nexport const blockedGlobalBuiltIns = [\n\t\"Function\",\n\t\"GeneratorFunction\",\n\t\"AsyncFunction\",\n\t\"AsyncGeneratorFunction\",\n\t\"eval\",\n\t\"setTimeout\",\n\t\"setInterval\",\n\t\"clearTimeout\",\n\t\"clearInterval\",\n\t\"setImmediate\",\n\t\"XMLHttpRequest\",\n\t\"fetch\",\n\t\"WebSocket\",\n\t\"globalThis\",\n\n\t// Node / runtime globals\n\t\"process\",\n\t\"require\",\n\t\"module\",\n\t\"exports\",\n\t\"global\",\n\t\"Buffer\",\n\t\"setImmediate\",\n\t\"clearImmediate\",\n\n\t// Worker / threading / messaging\n\t\"importScripts\",\n\t\"Worker\",\n\t\"SharedWorker\",\n\t\"ServiceWorker\",\n\t\"BroadcastChannel\",\n\t\"MessageChannel\",\n\t\"MessagePort\",\n\t\"postMessage\",\n\n\t// Host environment globals (browser)\n\t\"window\",\n\t\"document\",\n\t\"navigator\",\n\t\"location\",\n\t\"localStorage\",\n\t\"sessionStorage\",\n\t\"indexedDB\",\n\t\"performance\",\n\n\t// Low-level / concurrent / binary APIs\n\t\"Proxy\",\n\t\"Reflect\",\n\t\"Atomics\",\n\t\"WebAssembly\",\n\n\t// Console and internationalization\n\t\"console\",\n\t\"Intl\",\n\n\t// Other runtimes\n\t\"Deno\",\n];\n","import * as acorn from \"acorn\";\nimport globals from \"globals\";\nimport { blockedGlobalBuiltIns, blockedMethods } from \"./block.js\";\n\n// Error message constants for better maintainability\nconst ERROR_MESSAGES = {\n\tCAN_NOT_READ_PROPERTY: \"Cannot read property of {0} (reading '{1}')\",\n\tIS_INVALID_SYNTAX: \"{0} is not a valid syntax\",\n\tIS_NOT_FUNCTION: \"{0} is not a function\",\n\tIS_NOT_DEFINED: \"{0} is not defined\",\n\tIS_NOT_ALLOWED: \"{0} is not allowed\",\n};\n\n/**\n * Renders an error message by replacing placeholders with context values.\n * @param {string} template\n * @param {Record<string, any>} context\n * @example\n * ```js\n * const msg = renderErrorMessage(\"Cannot call mutable prototype method: {method}\", { method: \"push\" });\n * ```\n */\nconst renderErrorMessage = (template, context = {}) => template.replace(/{(\\w+)}/g, (_, key) => String(context[key]));\n\nconst BINARY_OPERATION_MAP = {\n\t\"+\": (a, b) => a + b,\n\t\"-\": (a, b) => a - b,\n\t\"*\": (a, b) => a * b,\n\t\"**\": (a, b) => a ** b,\n\t\"==\": (a, b) => a == b,\n\t\"===\": (a, b) => a === b,\n\t\"!=\": (a, b) => a != b,\n\t\"!==\": (a, b) => a !== b,\n\t\">\": (a, b) => a > b,\n\t\">=\": (a, b) => a >= b,\n\t\"<\": (a, b) => a < b,\n\t\"<=\": (a, b) => a <= b,\n\t\"%\": (a, b) => a % b,\n\t\"/\": (a, b) => a / b,\n\t\"|\": (a, b) => a | b,\n\t\"&\": (a, b) => a & b,\n\t\"^\": (a, b) => a ^ b,\n\t\"<<\": (a, b) => a << b,\n\t\">>\": (a, b) => a >> b,\n\t\">>>\": (a, b) => a >>> b,\n\tin: (a, b) => a in b,\n\tinstanceof: (a, b) => a instanceof b,\n};\n\nfunction createGlobalScope() {\n\tconst scope = Object.create(null);\n\tconst { builtin } = globals;\n\n\tfor (const key in builtin) {\n\t\tif (blockedGlobalBuiltIns.includes(key)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t/** @type {boolean} */\n\t\tconst isWritable = builtin[key];\n\n\t\tObject.defineProperty(scope, key, {\n\t\t\tvalue: globalThis[key],\n\t\t\twritable: isWritable,\n\t\t\tenumerable: false,\n\t\t\tconfigurable: false,\n\t\t});\n\t}\n\n\tObject.defineProperty(scope, \"globalThis\", {\n\t\tvalue: scope,\n\t\twritable: false,\n\t\tenumerable: false,\n\t\tconfigurable: false,\n\t});\n\n\treturn scope;\n}\n\nconst getBlockedMethods = (() => {\n\t/**\n\t * @type {Map<Function, string>}\n\t */\n\tlet BLOCKED_METHODS = null;\n\n\treturn () => {\n\t\tif (BLOCKED_METHODS) return BLOCKED_METHODS;\n\n\t\tconst map = new Map();\n\t\tfor (const path of blockedMethods) {\n\t\t\tconst [object, ...properties] = path.split(\".\");\n\t\t\tlet current = globalThis[object];\n\t\t\tfor (const prop of properties) {\n\t\t\t\tif (current && Object.hasOwn(current, prop)) {\n\t\t\t\t\tcurrent = current[prop];\n\t\t\t\t} else {\n\t\t\t\t\tcurrent = null;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (typeof current === \"function\") map.set(current, path);\n\t\t}\n\t\tBLOCKED_METHODS = map;\n\n\t\treturn BLOCKED_METHODS;\n\t};\n})();\n\n/**\n * A JavaScript expression evaluator that safely evaluates expressions within a sandboxed environment.\n * Supports various JavaScript features including arithmetic, logical operations, functions, and more.\n *\n * Security features:\n * - Blocks mutable methods to prevent side effects\n * - No access to eval() or Function() constructor\n * - Sandboxed scope with limited global objects\n *\n * @example\n * const evaluator = new Evaluator({ x: 10, y: 20 });\n * evaluator.evaluate('x + y') // returns 30\n */\nexport class Evaluator {\n\t/**\n\t * Creates a new Evaluator instance with a custom variable context.\n\t * The scope hierarchy is: user variables -> global scope\n\t * @param {Object} [variables={}] - An optional object containing variables to make available in the evaluation context\n\t */\n\tconstructor(variables = Object.create(null)) {\n\t\tthis.scopes = [structuredClone(variables), createGlobalScope()].filter((scope) => scope !== null && scope !== undefined);\n\t\tthis.source = undefined;\n\t}\n\n\t/**\n\t * Evaluates a JavaScript expression with an optional context.\n\t * @param {string} expression\n\t * @param {unknown} [context]\n\t * @returns\n\t */\n\tstatic evaluate(expression, context) {\n\t\tconst evaluator = new Evaluator(context);\n\t\treturn evaluator.evaluate(expression);\n\t}\n\n\t/**\n\t * Parses and evaluates a JavaScript expression using acorn parser.\n\t * @param {string} expression - The JavaScript expression to evaluate\n\t * @returns {*} The result of the evaluation\n\t * @throws {SyntaxError} If the expression has invalid syntax\n\t * @throws {ReferenceError} If referencing undefined variables\n\t * @throws {TypeError} If performing invalid operations\n\t */\n\tevaluate(expression) {\n\t\tthis.source = expression;\n\n\t\tconst ast = acorn.parse(expression, { ecmaVersion: \"latest\" });\n\n\t\t// Start recursive evaluation from the root node\n\t\ttry {\n\t\t\treturn this.execute(ast.body);\n\t\t} finally {\n\t\t\tthis.source = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Executes an array of AST body nodes sequentially.\n\t * @private\n\t * @param {Array} body - Array of AST nodes to execute\n\t * @returns {*} The result of the last executed node\n\t */\n\texecute(body) {\n\t\tlet result;\n\n\t\tfor (const node of body) {\n\t\t\tresult = this.visit(node);\n\t\t}\n\n\t\tif (typeof result === \"function\") {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Returning functions from expressions\"]));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Visits an AST node and delegates to the appropriate handler based on node type.\n\t * @private\n\t * @param {import(\"acorn\").Node} node - The AST node to visit\n\t * @returns {*} The result of visiting the node\n\t */\n\tvisit(node) {\n\t\tswitch (node.type) {\n\t\t\tcase \"ExpressionStatement\": {\n\t\t\t\treturn this.visit(node.expression);\n\t\t\t}\n\t\t\tcase \"BinaryExpression\": {\n\t\t\t\treturn this.handleBinaryExpression(node);\n\t\t\t}\n\t\t\tcase \"LogicalExpression\": {\n\t\t\t\treturn this.handleLogicalExpression(node);\n\t\t\t}\n\t\t\tcase \"UnaryExpression\": {\n\t\t\t\treturn this.handleUnaryExpression(node);\n\t\t\t}\n\t\t\tcase \"Identifier\": {\n\t\t\t\treturn this.handleIdentifier(node);\n\t\t\t}\n\t\t\tcase \"Literal\": {\n\t\t\t\treturn node.value;\n\t\t\t}\n\t\t\tcase \"MemberExpression\": {\n\t\t\t\treturn this.handleMemberExpression(node);\n\t\t\t}\n\t\t\tcase \"ArrayExpression\": {\n\t\t\t\treturn this.handleArrayExpression(node);\n\t\t\t}\n\t\t\tcase \"SpreadElement\": {\n\t\t\t\treturn this.handleSpreadElement(node);\n\t\t\t}\n\t\t\tcase \"ObjectExpression\": {\n\t\t\t\treturn this.handleObjectExpression(node);\n\t\t\t}\n\t\t\tcase \"FunctionExpression\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function expression\"]));\n\t\t\t}\n\t\t\tcase \"ArrowFunctionExpression\": {\n\t\t\t\treturn this.handleArrowFunctionExpression(node);\n\t\t\t}\n\t\t\tcase \"CallExpression\": {\n\t\t\t\treturn this.handleCallExpression(node);\n\t\t\t}\n\t\t\tcase \"ConditionalExpression\": {\n\t\t\t\treturn this.visit(node.test) ? this.visit(node.consequent) : this.visit(node.alternate);\n\t\t\t}\n\t\t\tcase \"NewExpression\": {\n\t\t\t\tif (node.callee.type !== \"Identifier\") {\n\t\t\t\t\tthrow new Error(`Unsupported callee type '${node.callee.type}' in new expression`);\n\t\t\t\t}\n\n\t\t\t\tif (node.callee.name === \"Function\") {\n\t\t\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"new Function() constructor\"]));\n\t\t\t\t}\n\n\t\t\t\tconst Constructor = this.visit(node.callee);\n\n\t\t\t\t// 仅在存在参数时构建数组\n\t\t\t\tconst args = node.arguments.length ? node.arguments.map((arg) => this.visit(arg)) : [];\n\n\t\t\t\treturn new Constructor(...args);\n\t\t\t}\n\t\t\tcase \"ChainExpression\": {\n\t\t\t\treturn this.visit(node.expression);\n\t\t\t}\n\t\t\tcase \"TemplateLiteral\": {\n\t\t\t\treturn this.handleTemplateLiteral(node);\n\t\t\t}\n\t\t\tcase \"ThisExpression\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'this' expression\"]));\n\t\t\t}\n\t\t\tcase \"WithStatement\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"'with' statement\"]));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tlet content = this.source.slice(node.start, node.end);\n\n\t\t\t\tif (content.length > 20) {\n\t\t\t\t\tcontent = content.slice(0, 17) + \"...\";\n\t\t\t\t}\n\n\t\t\t\tthrow new SyntaxError(`'${content}'` + \" \" + renderErrorMessage(ERROR_MESSAGES.IS_INVALID_SYNTAX, [content]));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles binary expressions (arithmetic and comparison operations).\n\t * @param {import('acorn').BinaryExpression} node\n\t * @private\n\t */\n\thandleBinaryExpression(node) {\n\t\tconst op = node.operator;\n\t\tconst left = this.visit(node.left);\n\t\tconst right = this.visit(node.right);\n\n\t\tif (BINARY_OPERATION_MAP.hasOwnProperty(op)) {\n\t\t\treturn BINARY_OPERATION_MAP[op](left, right);\n\t\t}\n\n\t\tthrow new SyntaxError(`Unsupported operator: ${node.operator}`);\n\t}\n\n\t/**\n\t * Handles logical expressions (&&, ||, ??).\n\t * Implements proper short-circuit evaluation for performance.\n\t * @private\n\t */\n\thandleLogicalExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"&&\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? this.visit(node.right) : left;\n\t\t\t}\n\t\t\tcase \"||\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tcase \"??\": {\n\t\t\t\tconst left = this.visit(node.left);\n\t\t\t\treturn left !== null && left !== undefined ? left : this.visit(node.right);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported logical operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles unary expressions (-, +, !, ~, typeof, void).\n\t * @private\n\t */\n\thandleUnaryExpression(node) {\n\t\tswitch (node.operator) {\n\t\t\tcase \"-\": {\n\t\t\t\treturn -this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"+\": {\n\t\t\t\treturn +this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"!\": {\n\t\t\t\treturn !this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"~\": {\n\t\t\t\treturn ~this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"typeof\": {\n\t\t\t\treturn typeof this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"void\": {\n\t\t\t\treturn void this.visit(node.argument);\n\t\t\t}\n\t\t\tcase \"delete\": {\n\t\t\t\tthrow new SyntaxError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Delete operator\"]));\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new SyntaxError(`Unsupported unary operator: ${node.operator}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Handles identifier (variable) lookups in the scope chain.\n\t * @private\n\t */\n\thandleIdentifier(node) {\n\t\tconst name = node.name;\n\t\tfor (const scope of this.scopes) {\n\t\t\tif (Object.hasOwn(scope, name)) {\n\t\t\t\treturn scope[name];\n\t\t\t}\n\t\t}\n\n\t\tthrow new ReferenceError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_DEFINED, [name]));\n\t}\n\n\t/**\n\t * Handles member expressions (property access like obj.prop or obj[prop]).\n\t * @private\n\t */\n\thandleMemberExpression(node) {\n\t\tconst object = this.visit(node.object);\n\n\t\t// Determine property name: either identifier name or computed value\n\t\tconst isStaticProperty = node.property.type === \"Identifier\" && !node.computed;\n\t\tconst property = isStaticProperty ? node.property.name : this.visit(node.property);\n\n\t\t// Prevent access to prototype properties\n\t\tif (typeof object !== \"undefined\" && object !== null && object[property] === object?.__proto__) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Accessing prototype properties\"]));\n\t\t}\n\n\t\tif (object === null || object === undefined) {\n\t\t\t// optional chaining\n\t\t\tif (node.optional) {\n\t\t\t\treturn void 0;\n\t\t\t}\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.CAN_NOT_READ_PROPERTY, [object, property]));\n\t\t}\n\n\t\tconst result = object[property];\n\n\t\t// The Function constructor must never be reachable from an expression.\n\t\t// If it escapes as a value, native callbacks (e.g. Promise.then,\n\t\t// Array.prototype.map) invoke it outside the interpreter's call path,\n\t\t// enabling arbitrary host code execution. This is a structural guard:\n\t\t// no matter how many `.constructor` hops an expression takes, the\n\t\t// final value can never be `Function` (or its prototype).\n\t\tif (result === Function || result === Function.prototype) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Handles array literal expressions.\n\t * @private\n\t */\n\thandleArrayExpression(node) {\n\t\tconst result = [];\n\n\t\tfor (let i = 0; i < node.elements.length; i++) {\n\t\t\tconst element = node.elements.at(i);\n\t\t\tconst value = this.visit(element);\n\n\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\tresult.push(...value);\n\t\t\t} else {\n\t\t\t\tresult.push(value);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Handles object literal expressions.\n\t * @returns\n\t */\n\thandleObjectExpression(node) {\n\t\tconst obj = {};\n\t\tfor (const prop of node.properties) {\n\t\t\tif (prop.type === \"SpreadElement\") {\n\t\t\t\tObject.assign(obj, this.visit(prop.argument));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = prop.key.name || prop.key.value;\n\t\t\tconst value = this.visit(prop.value);\n\t\t\tobj[key] = value;\n\t\t}\n\t\treturn obj;\n\t}\n\n\thandleSpreadElement(node) {\n\t\treturn this.visit(node.argument);\n\t}\n\n\t/**\n\t * Handles arrow function expressions.\n\t * Creates a closure that captures the current scope and executes the function body\n\t * with parameters bound to a new scope.\n\t * @private\n\t */\n\thandleArrowFunctionExpression(node) {\n\t\treturn (...args) => {\n\t\t\t// Create new scope with parameters bound to arguments\n\t\t\tconst newScope = {};\n\t\t\tconst paramCount = node.params.length;\n\t\t\tfor (let i = 0; i < paramCount; i++) {\n\t\t\t\tnewScope[node.params[i].name] = args[i];\n\t\t\t}\n\n\t\t\t// Push new scope, evaluate body, then pop scope\n\t\t\tthis.scopes.unshift(newScope);\n\t\t\tconst result = this.visit(node.body);\n\t\t\tthis.scopes.shift();\n\t\t\treturn result;\n\t\t};\n\t}\n\n\t/**\n\t * Handles function call expressions, including optional chaining.\n\t * @private\n\t */\n\thandleCallExpression(node) {\n\t\tconst func = this.visit(node.callee);\n\n\t\tconst isOptional = node.optional || node.callee.optional;\n\t\tif ((func === undefined || func === null) && isOptional) {\n\t\t\treturn void 0;\n\t\t}\n\n\t\tif (func === Function) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\n\t\tif (getBlockedMethods().has(func)) {\n\t\t\tconst path = getBlockedMethods().get(func);\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [path]));\n\t\t}\n\n\t\t// 仅在存在参数时构建数组\n\t\tconst args = (() => {\n\t\t\tif (node.arguments.length === 0) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\tlet result = [];\n\n\t\t\tfor (let i = 0; i < node.arguments.length; i++) {\n\t\t\t\tconst element = node.arguments.at(i);\n\t\t\t\tconst value = this.visit(element);\n\n\t\t\t\tif (element.type === \"SpreadElement\") {\n\t\t\t\t\tresult.push(...value);\n\t\t\t\t} else {\n\t\t\t\t\tresult.push(value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t})();\n\n\t\tconst target = node.callee.type === \"MemberExpression\" ? this.visit(node.callee.object) : null;\n\n\t\t// Defense in depth: even if a `Function` reference were somehow\n\t\t// produced by an expression, it must not be passed as an argument.\n\t\t// Native methods (Promise.then, Array.prototype.map, ...) would\n\t\t// invoke it in the host runtime, outside this interpreter's checks.\n\t\tif (args.some((arg) => arg === Function)) {\n\t\t\tthrow new Error(renderErrorMessage(ERROR_MESSAGES.IS_NOT_ALLOWED, [\"Function constructor\"]));\n\t\t}\n\n\t\tif (typeof func !== \"function\") {\n\t\t\tconst calledString = getNodeString(node.callee);\n\t\t\tthrow new TypeError(renderErrorMessage(ERROR_MESSAGES.IS_NOT_FUNCTION, [calledString]));\n\t\t}\n\n\t\treturn func.apply(target, args);\n\t}\n\n\t/**\n\t * Handles template literal expressions.\n\t * More efficient implementation that interleaves quasis and expressions without sorting.\n\t * @private\n\t */\n\thandleTemplateLiteral(node) {\n\t\tlet result = \"\";\n\t\tconst expressionCount = node.expressions.length;\n\n\t\tfor (let i = 0; i < node.quasis.length; i++) {\n\t\t\tresult += node.quasis[i].value.raw;\n\t\t\tif (i < expressionCount) {\n\t\t\t\tresult += this.visit(node.expressions[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n}\n\n/**\n *\n * @param {import('acorn').Node} node\n * @returns\n */\nexport function getNodeString(node) {\n\tswitch (node.type) {\n\t\tcase \"Identifier\": {\n\t\t\treturn node.name;\n\t\t}\n\t\tcase \"Literal\": {\n\t\t\treturn node.raw;\n\t\t}\n\t\tcase \"ArrayExpression\": {\n\t\t\treturn `[${node.elements.map((child) => getNodeString(child)).join(\",\")}]`;\n\t\t}\n\t\tcase \"ObjectExpression\": {\n\t\t\t// if keys is empty\n\t\t\tif (node.properties.length === 0) {\n\t\t\t\treturn \"{}\";\n\t\t\t}\n\n\t\t\treturn \"{(intermediate value)}\";\n\t\t}\n\t\tcase \"MemberExpression\": {\n\t\t\tconst objectStr = getNodeString(node.object);\n\t\t\tconst propertyStr = getNodeString(node.property);\n\n\t\t\tif (node.computed) {\n\t\t\t\treturn `${objectStr}[${propertyStr}]`;\n\t\t\t}\n\t\t\treturn `${objectStr}.${propertyStr}`;\n\t\t}\n\t\tdefault: {\n\t\t\treturn null;\n\t\t}\n\t}\n}\n","/**\n * 简单状态机模板解析器\n * 能够正确处理表达式中包含字符串、转义字符和结束标记的情况\n * @class SimpleStateTemplateParser\n */\nclass TemplateParser {\n\t/**\n\t * 创建解析器实例\n\t * @param {Object} [options] - 配置选项\n\t * @param {string} [options.expressionStart='{{'] - 表达式开始标记\n\t * @param {string} [options.expressionEnd='}}'] - 表达式结束标记\n\t * @param {boolean} [options.preserveWhitespace=true] - 是否保留表达式周围的空白字符\n\t */\n\tconstructor(options = {}) {\n\t\t// 表达式标记配置\n\t\tthis.exprStart = options.expressionStart || \"{{\";\n\t\tthis.exprEnd = options.expressionEnd || \"}}\";\n\n\t\t// 标记长度缓存,避免重复计算\n\t\tthis.startLen = this.exprStart.length;\n\t\tthis.endLen = this.exprEnd.length;\n\n\t\t// 其他配置\n\t\tthis.preserveWhitespace = options.preserveWhitespace === true;\n\t}\n\n\t/**\n\t * 解析模板字符串,将其转换为 token 数组\n\t * @param {string} template - 要解析的模板字符串\n\t * @returns {Array<{type: string, value: string}>} token 数组\n\t */\n\tparse(template) {\n\t\t// 输入验证\n\t\tif (typeof template !== \"string\") {\n\t\t\tthrow new TypeError(\"模板必须是字符串\");\n\t\t}\n\n\t\tconst tokens = []; // 存储解析结果的 token 数组\n\t\tconst length = template.length;\n\n\t\t// 状态机变量\n\t\tlet state = \"TEXT\"; // 当前状态:TEXT | EXPR | STRING_SQ | STRING_DQ | TEMPLATE | ESCAPE_*\n\t\tlet buffer = \"\"; // 当前状态的字符缓冲区\n\t\tlet exprStartPos = 0; // 当前表达式的开始位置(用于错误恢复)\n\t\tlet pos = 0; // 当前扫描位置\n\n\t\t// 主解析循环:逐个字符扫描模板\n\t\twhile (pos < length) {\n\t\t\tconst char = template[pos];\n\t\t\tconst nextChar = template[pos + 1];\n\n\t\t\t// 状态机核心逻辑\n\t\t\tswitch (state) {\n\t\t\t\t// ==================== 文本状态 ====================\n\t\t\t\tcase \"TEXT\":\n\t\t\t\t\t// 检查是否遇到表达式开始标记\n\t\t\t\t\tif (this._isMatch(pos, template, this.exprStart)) {\n\t\t\t\t\t\t// 将缓冲区中的文本保存为 token\n\t\t\t\t\t\tif (buffer.length > 0) {\n\t\t\t\t\t\t\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 切换到表达式状态\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t\texprStartPos = pos; // 记录表达式开始位置\n\t\t\t\t\t\tpos += this.startLen; // 跳过开始标记\n\t\t\t\t\t\tcontinue; // 继续处理下一个字符(跳过本次循环的剩余部分)\n\t\t\t\t\t}\n\t\t\t\t\t// 普通文本字符,添加到缓冲区\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 表达式状态 ====================\n\t\t\t\tcase \"EXPR\":\n\t\t\t\t\t// 在表达式中,需要处理各种字符串和转义字符\n\t\t\t\t\tif (char === \"'\") {\n\t\t\t\t\t\t// 进入单引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_SQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\t// 进入双引号字符串状态\n\t\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\t// 进入模板字符串状态\n\t\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\t} else if (char === \"\\\\\") {\n\t\t\t\t\t\t// 遇到转义字符,根据当前上下文进入相应的转义状态\n\t\t\t\t\t\tif (nextChar === \"'\") state = \"ESCAPE_SQ\";\n\t\t\t\t\t\telse if (nextChar === '\"') state = \"ESCAPE_DQ\";\n\t\t\t\t\t\telse if (nextChar === \"`\") state = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t\telse state = \"ESCAPE_EXPR\";\n\t\t\t\t\t} else if (this._isMatch(pos, template, this.exprEnd)) {\n\t\t\t\t\t\t// 找到表达式结束标记,且不在字符串中\n\t\t\t\t\t\tconst exprValue = this.preserveWhitespace ? buffer : buffer.trim();\n\t\t\t\t\t\tif (exprValue.length > 0) {\n\t\t\t\t\t\t\ttokens.push({\n\t\t\t\t\t\t\t\ttype: \"expression\",\n\t\t\t\t\t\t\t\tvalue: exprValue,\n\t\t\t\t\t\t\t\tstart: exprStartPos,\n\t\t\t\t\t\t\t\tend: pos + this.endLen,\n\t\t\t\t\t\t\t\tcontentStart: exprStartPos + this.startLen,\n\t\t\t\t\t\t\t\tcontentEnd: pos,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// 重置状态,准备处理后续文本\n\t\t\t\t\t\tbuffer = \"\";\n\t\t\t\t\t\tstate = \"TEXT\";\n\t\t\t\t\t\tpos += this.endLen; // 跳过结束标记\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t// 将当前字符添加到表达式缓冲区\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 字符串状态 ====================\n\t\t\t\tcase \"STRING_SQ\": // 单引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_SQ\"; // 遇到转义字符\n\t\t\t\t\t} else if (char === \"'\") {\n\t\t\t\t\t\tstate = \"EXPR\"; // 字符串结束,回到表达式状态\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"STRING_DQ\": // 双引号字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_DQ\";\n\t\t\t\t\t} else if (char === '\"') {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"TEMPLATE\": // 模板字符串\n\t\t\t\t\tif (char === \"\\\\\") {\n\t\t\t\t\t\tstate = \"ESCAPE_TEMPLATE\";\n\t\t\t\t\t} else if (char === \"`\") {\n\t\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\t}\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tbreak;\n\n\t\t\t\t// ==================== 转义状态 ====================\n\t\t\t\t// 转义状态:处理转义字符,然后返回到之前的状态\n\t\t\t\tcase \"ESCAPE_SQ\":\n\t\t\t\t\tbuffer += char; // 添加转义后的字符\n\t\t\t\t\tstate = \"STRING_SQ\"; // 回到单引号字符串状态\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_DQ\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"STRING_DQ\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_TEMPLATE\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"TEMPLATE\";\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase \"ESCAPE_EXPR\":\n\t\t\t\t\tbuffer += char;\n\t\t\t\t\tstate = \"EXPR\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// 移动到下一个字符\n\t\t\tpos++;\n\t\t}\n\n\t\t// ==================== 后处理 ====================\n\t\t// 处理扫描结束后缓冲区中剩余的内容\n\t\tif (buffer.length > 0) {\n\t\t\tif (state === \"TEXT\") {\n\t\t\t\t// 剩余的文本内容\n\t\t\t\ttokens.push({ type: \"text\", value: buffer, start: pos - buffer.length, end: pos });\n\t\t\t} else {\n\t\t\t\t// 未完成的表达式,将其作为普通文本处理\n\t\t\t\t// 这里可以根据需要选择不同的错误处理策略:\n\t\t\t\t// 1. 抛出错误\n\t\t\t\t// 2. 忽略未完成的表达式\n\t\t\t\t// 3. 将其作为文本处理(当前实现)\n\t\t\t\tconst incompleteExpr = this.exprStart + buffer;\n\t\t\t\ttokens.push({ type: \"text\", value: incompleteExpr, start: exprStartPos, end: pos });\n\n\t\t\t\t// 可选:输出警告\n\t\t\t\tconsole.warn(`警告:在位置 ${exprStartPos} 开始的表达式未正确结束`);\n\t\t\t}\n\t\t}\n\n\t\treturn tokens;\n\t}\n\n\t/**\n\t * 检查指定位置是否匹配给定的字符序列\n\t * @param {number} pos - 开始检查的位置\n\t * @param {string} template - 模板字符串\n\t * @param {string} sequence - 要匹配的字符序列\n\t * @returns {boolean} 是否匹配\n\t * @private\n\t */\n\t_isMatch(pos, template, sequence) {\n\t\t// 检查剩余长度是否足够\n\t\tif (pos + sequence.length > template.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// 逐个字符比较\n\t\tfor (let i = 0; i < sequence.length; i++) {\n\t\t\tif (template[pos + i] !== sequence[i]) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * 静态方法:快速解析模板\n\t * @param {string} template - 模板字符串\n\t * @param {Object} [options] - 配置选项\n\t * @returns {Array} token 数组\n\t */\n\tstatic parse(template, options) {\n\t\tconst parser = new TemplateParser(options);\n\t\treturn parser.parse(template);\n\t}\n}\n\nexport { TemplateParser };\n","import { Evaluator } from \"./Evaluator.js\";\nimport { TemplateParser } from \"./TemplateParser.js\";\n\nexport { Evaluator, TemplateParser };\n\n/**\n * Evaluates a JavaScript expression with an optional context.\n * @param {string} expression - The JavaScript expression to evaluate\n * @param {unknown} [context] - Optional context object with variables to use in the expression\n * @returns {*} The result of evaluating the expression\n * @example\n * evalExpression('a + b', { a: 1, b: 2 }) // returns 3\n */\nexport function evalExpression(expression, context) {\n\treturn Evaluator.evaluate(expression, context);\n}\n\n/**\n * Evaluates a template string by replacing {{ expression }} patterns with their evaluated values.\n * Undefined variables in expressions are replaced with empty strings instead of throwing errors.\n * @param {string} template - The template string containing {{ expression }} patterns\n * @param {Object} [context] - Optional context object with variables to use in expressions\n * @param {Object} [templateParserOptions] - Optional options for the template parser\n * @returns {string} The template with all expressions evaluated and replaced\n * @example\n * evalTemplate('Hello {{ name }}!', { name: 'World' }) // returns 'Hello World!'\n */\nexport function evalTemplate(template, context, templateParserOptions) {\n\tlet result = \"\";\n\n\tconst typeHandler = {\n\t\ttext: (token) => token.value,\n\t\texpression: (token) => {\n\t\t\ttry {\n\t\t\t\treturn Evaluator.evaluate(token.value, context);\n\t\t\t} catch (error) {\n\t\t\t\t// Replace undefined variables with empty string for graceful degradation\n\t\t\t\tif (error instanceof ReferenceError && error.message.endsWith(\"is not defined\")) {\n\t\t\t\t\treturn \"undefined\";\n\t\t\t\t} else {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t};\n\n\tfor (const token of TemplateParser.parse(template, templateParserOptions)) {\n\t\t// Unknown token type, treat as text\n\t\tconst handler = typeHandler[token.type] ?? typeHandler[\"text\"];\n\n\t\tresult += handler(token);\n\t}\n\n\treturn result;\n}\n"],"names":["mutableMethods","dangerousMethods","blockedMethods","blockedGlobalBuiltIns","ERROR_MESSAGES","renderErrorMessage","template","context","_","key","String","BINARY_OPERATION_MAP","a","b","_instanceof","createGlobalScope","scope","Object","builtin","globals","isWritable","globalThis","getBlockedMethods","BLOCKED_METHODS","map","Map","_iteratorError","path","_path_split","object","properties","current","_iteratorError1","prop","Evaluator","variables","structuredClone","undefined","evaluate","expression","ast","acorn","execute","body","result","node","Error","visit","SyntaxError","Constructor","args","arg","content","handleBinaryExpression","op","left","right","handleLogicalExpression","left1","left2","handleUnaryExpression","_type_of","handleIdentifier","name","ReferenceError","handleMemberExpression","isStaticProperty","property","TypeError","Function","handleArrayExpression","i","element","value","_result","handleObjectExpression","obj","handleSpreadElement","handleArrowFunctionExpression","newScope","paramCount","handleCallExpression","func","isOptional","target","calledString","getNodeString","handleTemplateLiteral","expressionCount","evaluator","child","objectStr","propertyStr","TemplateParser","options","parse","tokens","length","state","buffer","exprStartPos","pos","char","nextChar","exprValue","incompleteExpr","console","_isMatch","sequence","parser","evalExpression","evalTemplate","templateParserOptions","typeHandler","token","error","_typeHandler_token_type","handler"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,iBAAiB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IAEA;IAEA;IACA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O,CAAC,QAAQ,CAAC,mBAC7D,OAAO;gBAEP,MAAMA;YAER;QACD;IACD;QAEKzF,4BAAAA,MAAAA,oBAAAA,OAAAA,iBAAAA;;QAAL,QAAKA,YAAemE,8BAAAA,KAAoB,CAACvF,UAAU0G,sBAAsB,CAAtBA,OAAAA,QAAAA,CAAAA,IAA9CtF,OAAAA,CAAAA,CAAAA,4BAAAA,AAAAA,CAAAA,QAAAA,UAAAA,IAAAA,EAAAA,EAAAA,IAAAA,AAAAA,GAAAA,4BAAAA,KAAsE;YAAtEA,IAAMwF,QAANxF,MAAAA,KAAAA;gBAEY0F;YAAhB,IAAMC,UAAUD,QAAAA,CAAAA,0BAAAA,WAAW,CAACF,MAAM,IAAI,CAAC,AAAD,IAAtBE,0BAA2BH,WAAW,CAAC,OAAO;YAE9DrE,UAAUyE,QAAQH;QACnB;;QALKxF,oBAAAA;QAAAA,iBAAAA;;;iBAAAA,6BAAAA,AAAAA,QAAAA,UAAAA,MAAAA,EAAAA,UAAAA,MAAAA;;gBAAAA,mB,MAAAA;;;IAOL,OAAOkB;AACR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecma-evaluator",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "private": false,
5
5
  "description": "A tiny and fast JavaScript expression evaluator.",
6
6
  "sideEffects": false,