fg-dynamic-component 3.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -17
- package/fesm2022/fg-dynamic-component.mjs +1432 -309
- package/fesm2022/fg-dynamic-component.mjs.map +1 -1
- package/package.json +5 -3
- package/types/fg-dynamic-component.d.ts +290 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fg-dynamic-component.mjs","names":[],"sources":["../../../projects/fg-dynamic-component/src/lib/safe-expression.ts","../../../projects/fg-dynamic-component/src/lib/fg-dynamic.component.ts"],"sourcesContent":["/**\n * Small, allowlisted expression interpreter used for the `$vm` / `$event` binding\n * feature of `FGDynamicComponent`.\n *\n * This intentionally does NOT use `eval`, `new Function`, or any other\n * string-to-code primitive. Only the following constructs are supported:\n *\n * - literals (string, number, boolean, null, undefined, NaN, Infinity)\n * - identifiers from the provided variables (`$vm`, `$event`, arrow parameters)\n * - member access: `a.b`, `a['b']`, optional chaining `a?.b`\n * - calls: `$vm()`, `$vm.update(fn)`, `$event.value`\n * - unary: `!`, `-`, `+`, `typeof`\n * - binary/logical/ternary operators\n * - array and object literals, including spread\n * - expression-bodied arrow functions (and arrow blocks containing `return`)\n *\n * Assignments, `new`, `this`, globals (e.g. `window`, `fetch`), template\n * literals and regular-expression literals are rejected. Prototype-related\n * property names are blocked at every access.\n */\n\nconst MAX_SOURCE_LENGTH = 2000;\nconst MAX_TOKENS = 4000;\nconst MAX_PARSE_DEPTH = 80;\nconst MAX_EVALUATION_STEPS = 20000;\nconst MAX_EVALUATION_DEPTH = 80;\n\nconst FORBIDDEN_PROPERTIES: ReadonlySet<string> = new Set([\n '__proto__',\n 'prototype',\n 'constructor',\n 'caller',\n 'callee',\n 'arguments',\n '__defineGetter__',\n '__defineSetter__',\n '__lookupGetter__',\n '__lookupSetter__'\n]);\n\nconst PUNCTUATORS: readonly string[] = [\n '===', '!==', '**', '==', '!=', '<=', '>=', '&&', '||', '??', '?.', '...', '=>',\n '+', '-', '*', '/', '%', '<', '>', '!', '?', ':', '.', ',', '(', ')', '[', ']', '{', '}', ';'\n];\n\ntype TokenType = 'number' | 'string' | 'identifier' | 'punctuator' | 'eof';\n\ninterface Token {\n type: TokenType;\n value: string;\n position: number;\n}\n\ninterface ArgumentNode {\n spread: boolean;\n value: Node;\n}\n\ninterface ObjectProperty {\n spread: boolean;\n key?: Node;\n value: Node;\n computed: boolean;\n}\n\ntype Node =\n | { type: 'Literal'; value: unknown }\n | { type: 'Identifier'; name: string }\n | { type: 'Member'; object: Node; property: Node; computed: boolean; optional: boolean }\n | { type: 'Call'; callee: Node; args: ArgumentNode[]; optional: boolean }\n | { type: 'Unary'; operator: string; argument: Node }\n | { type: 'Binary'; operator: string; left: Node; right: Node }\n | { type: 'Logical'; operator: string; left: Node; right: Node }\n | { type: 'Conditional'; test: Node; consequent: Node; alternate: Node }\n | { type: 'Array'; elements: ArgumentNode[] }\n | { type: 'Object'; properties: ObjectProperty[] }\n | { type: 'Arrow'; params: string[]; body: Node; block: boolean };\n\ninterface EvaluationState {\n steps: number;\n depth: number;\n}\n\nexport class FGDynamicExpressionError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'FGDynamicExpressionError';\n }\n}\n\nfunction fail(message: string): never {\n throw new FGDynamicExpressionError(message);\n}\n\nfunction isPunctuator(token: Token, value: string): boolean {\n return token.type === 'punctuator' && token.value === value;\n}\n\nfunction isIdentifier(token: Token, value: string): boolean {\n return token.type === 'identifier' && token.value === value;\n}\n\nfunction tokenize(source: string): Token[] {\n const tokens: Token[] = [];\n let index = 0;\n\n while (index < source.length) {\n const character = source[index];\n\n if (/\\s/.test(character)) {\n index++;\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n const quote = character;\n let value = '';\n let cursor = index + 1;\n let closed = false;\n\n while (cursor < source.length) {\n const current = source[cursor];\n\n if (current === quote) {\n cursor++;\n closed = true;\n break;\n }\n\n if (current === '\\\\') {\n const escaped = source[cursor + 1];\n if (escaped === undefined) {\n fail('Unterminated string literal.');\n }\n\n switch (escaped) {\n case 'n': value += '\\n'; break;\n case 'r': value += '\\r'; break;\n case 't': value += '\\t'; break;\n case 'b': value += '\\b'; break;\n case 'f': value += '\\f'; break;\n case 'v': value += '\\v'; break;\n case '0': value += '\\0'; break;\n case 'u': {\n const hex = source.slice(cursor + 2, cursor + 6);\n if (!/^[0-9a-fA-F]{4}$/.test(hex)) {\n fail('Invalid unicode escape sequence.');\n }\n value += String.fromCharCode(parseInt(hex, 16));\n cursor += 4;\n break;\n }\n default: value += escaped; break;\n }\n\n cursor += 2;\n continue;\n }\n\n value += current;\n cursor++;\n }\n\n if (!closed) {\n fail('Unterminated string literal.');\n }\n\n tokens.push({ type: 'string', value, position: index });\n index = cursor;\n continue;\n }\n\n if (/[0-9]/.test(character) || (character === '.' && /[0-9]/.test(source[index + 1] ?? ''))) {\n const match = /^(?:0[xX][0-9a-fA-F]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)/.exec(source.slice(index));\n if (!match) {\n fail('Invalid number literal.');\n }\n const raw = match[0];\n const numeric = Number(raw);\n if (!Number.isFinite(numeric)) {\n fail('Number literal is not finite.');\n }\n tokens.push({ type: 'number', value: raw, position: index });\n index += raw.length;\n continue;\n }\n\n if (/[A-Za-z_$]/.test(character)) {\n const match = /^[A-Za-z_$][A-Za-z0-9_$]*/.exec(source.slice(index));\n if (!match) {\n fail('Invalid identifier.');\n }\n tokens.push({ type: 'identifier', value: match[0], position: index });\n index += match[0].length;\n continue;\n }\n\n const punctuator = PUNCTUATORS.find((candidate: string): boolean => source.startsWith(candidate, index));\n if (!punctuator) {\n fail('Unexpected character in expression.');\n }\n\n tokens.push({ type: 'punctuator', value: punctuator, position: index });\n index += punctuator.length;\n }\n\n tokens.push({ type: 'eof', value: '', position: source.length });\n\n if (tokens.length > MAX_TOKENS) {\n fail('Expression is too complex.');\n }\n\n return tokens;\n}\n\nclass ExpressionParser {\n private index = 0;\n private depth = 0;\n private readonly tokens: Token[];\n\n constructor(tokens: Token[]) {\n this.tokens = tokens;\n }\n\n parse(): Node {\n const expression = this.parseExpression();\n if (this.current().type !== 'eof') {\n fail('Unexpected token after expression.');\n }\n return expression;\n }\n\n private current(): Token {\n return this.tokens[this.index];\n }\n\n private peek(offset = 1): Token | undefined {\n return this.tokens[this.index + offset];\n }\n\n private advance(): Token {\n const token = this.tokens[this.index];\n if (token.type !== 'eof') {\n this.index++;\n }\n return token;\n }\n\n private matchPunctuator(value: string): boolean {\n if (isPunctuator(this.current(), value)) {\n this.advance();\n return true;\n }\n return false;\n }\n\n private expectPunctuator(value: string): void {\n if (!this.matchPunctuator(value)) {\n fail(`Expected \"${value}\".`);\n }\n }\n\n private enter(): void {\n this.depth++;\n if (this.depth > MAX_PARSE_DEPTH) {\n fail('Expression is nested too deeply.');\n }\n }\n\n private leave(): void {\n this.depth--;\n }\n\n private parseExpression(): Node {\n this.enter();\n try {\n return this.parseAssignment();\n } finally {\n this.leave();\n }\n }\n\n private parseAssignment(): Node {\n if (this.isArrowStart()) {\n return this.parseArrow();\n }\n return this.parseConditional();\n }\n\n private isArrowStart(): boolean {\n const token = this.current();\n\n if (token.type === 'identifier' && this.peek()?.value === '=>') {\n return true;\n }\n\n if (!isPunctuator(token, '(')) {\n return false;\n }\n\n let nesting = 0;\n for (let cursor = this.index; cursor < this.tokens.length; cursor++) {\n const candidate = this.tokens[cursor];\n if (candidate.type !== 'punctuator') {\n continue;\n }\n if (candidate.value === '(') {\n nesting++;\n } else if (candidate.value === ')') {\n nesting--;\n if (nesting === 0) {\n return this.tokens[cursor + 1]?.value === '=>';\n }\n }\n }\n\n return false;\n }\n\n private parseArrow(): Node {\n const params: string[] = [];\n\n if (this.current().type === 'identifier') {\n params.push(this.advance().value);\n } else {\n this.expectPunctuator('(');\n if (!isPunctuator(this.current(), ')')) {\n do {\n if (isPunctuator(this.current(), ')')) {\n break;\n }\n const parameter = this.advance();\n if (parameter.type !== 'identifier') {\n fail('Arrow function parameters must be identifiers.');\n }\n if (FORBIDDEN_PROPERTIES.has(parameter.value)) {\n fail('Forbidden arrow function parameter name.');\n }\n params.push(parameter.value);\n } while (this.matchPunctuator(','));\n }\n this.expectPunctuator(')');\n }\n\n this.expectPunctuator('=>');\n\n if (this.matchPunctuator('{')) {\n while (this.matchPunctuator(';')) {\n // Skip empty statements.\n }\n\n if (!isIdentifier(this.current(), 'return')) {\n fail('Arrow function blocks must contain a return statement.');\n }\n\n this.advance();\n const value = this.parseExpression();\n this.matchPunctuator(';');\n this.expectPunctuator('}');\n return { type: 'Arrow', params, body: value, block: true };\n }\n\n return { type: 'Arrow', params, body: this.parseExpression(), block: false };\n }\n\n private parseConditional(): Node {\n const test = this.parseNullish();\n\n if (this.matchPunctuator('?')) {\n const consequent = this.parseAssignment();\n this.expectPunctuator(':');\n const alternate = this.parseAssignment();\n return { type: 'Conditional', test, consequent, alternate };\n }\n\n return test;\n }\n\n private parseNullish(): Node {\n let left = this.parseLogicalOr();\n while (this.matchPunctuator('??')) {\n const right = this.parseLogicalOr();\n left = { type: 'Logical', operator: '??', left, right };\n }\n return left;\n }\n\n private parseLogicalOr(): Node {\n let left = this.parseLogicalAnd();\n while (this.matchPunctuator('||')) {\n const right = this.parseLogicalAnd();\n left = { type: 'Logical', operator: '||', left, right };\n }\n return left;\n }\n\n private parseLogicalAnd(): Node {\n let left = this.parseEquality();\n while (this.matchPunctuator('&&')) {\n const right = this.parseEquality();\n left = { type: 'Logical', operator: '&&', left, right };\n }\n return left;\n }\n\n private parseEquality(): Node {\n let left = this.parseRelational();\n while (\n isPunctuator(this.current(), '===') ||\n isPunctuator(this.current(), '!==') ||\n isPunctuator(this.current(), '==') ||\n isPunctuator(this.current(), '!=')\n ) {\n const operator = this.advance().value;\n const right = this.parseRelational();\n left = { type: 'Binary', operator, left, right };\n }\n return left;\n }\n\n private parseRelational(): Node {\n let left = this.parseAdditive();\n while (\n isPunctuator(this.current(), '<') ||\n isPunctuator(this.current(), '>') ||\n isPunctuator(this.current(), '<=') ||\n isPunctuator(this.current(), '>=')\n ) {\n const operator = this.advance().value;\n const right = this.parseAdditive();\n left = { type: 'Binary', operator, left, right };\n }\n return left;\n }\n\n private parseAdditive(): Node {\n let left = this.parseMultiplicative();\n while (isPunctuator(this.current(), '+') || isPunctuator(this.current(), '-')) {\n const operator = this.advance().value;\n const right = this.parseMultiplicative();\n left = { type: 'Binary', operator, left, right };\n }\n return left;\n }\n\n private parseMultiplicative(): Node {\n let left = this.parseExponent();\n while (\n isPunctuator(this.current(), '*') ||\n isPunctuator(this.current(), '/') ||\n isPunctuator(this.current(), '%')\n ) {\n const operator = this.advance().value;\n const right = this.parseExponent();\n left = { type: 'Binary', operator, left, right };\n }\n return left;\n }\n\n private parseExponent(): Node {\n const left = this.parseUnary();\n if (this.matchPunctuator('**')) {\n const right = this.parseExponent();\n return { type: 'Binary', operator: '**', left, right };\n }\n return left;\n }\n\n private parseUnary(): Node {\n if (\n isPunctuator(this.current(), '!') ||\n isPunctuator(this.current(), '-') ||\n isPunctuator(this.current(), '+')\n ) {\n const operator = this.advance().value;\n return { type: 'Unary', operator, argument: this.parseUnary() };\n }\n\n if (isIdentifier(this.current(), 'typeof')) {\n this.advance();\n return { type: 'Unary', operator: 'typeof', argument: this.parseUnary() };\n }\n\n return this.parsePostfix();\n }\n\n private parsePostfix(): Node {\n let node = this.parsePrimary();\n\n for (;;) {\n if (this.matchPunctuator('.')) {\n const property = this.advance();\n if (property.type !== 'identifier') {\n fail('Expected a property name.');\n }\n node = {\n type: 'Member',\n object: node,\n property: { type: 'Literal', value: property.value },\n computed: false,\n optional: false\n };\n continue;\n }\n\n if (this.matchPunctuator('?.')) {\n if (this.matchPunctuator('(')) {\n node = { type: 'Call', callee: node, args: this.parseArguments(), optional: true };\n } else if (this.matchPunctuator('[')) {\n const property = this.parseExpression();\n this.expectPunctuator(']');\n node = { type: 'Member', object: node, property, computed: true, optional: true };\n } else {\n const property = this.advance();\n if (property.type !== 'identifier') {\n fail('Expected a property name.');\n }\n node = {\n type: 'Member',\n object: node,\n property: { type: 'Literal', value: property.value },\n computed: false,\n optional: true\n };\n }\n continue;\n }\n\n if (this.matchPunctuator('[')) {\n const property = this.parseExpression();\n this.expectPunctuator(']');\n node = { type: 'Member', object: node, property, computed: true, optional: false };\n continue;\n }\n\n if (this.matchPunctuator('(')) {\n node = { type: 'Call', callee: node, args: this.parseArguments(), optional: false };\n continue;\n }\n\n break;\n }\n\n return node;\n }\n\n private parseArguments(): ArgumentNode[] {\n const args: ArgumentNode[] = [];\n\n if (!isPunctuator(this.current(), ')')) {\n do {\n if (isPunctuator(this.current(), ')')) {\n break;\n }\n const spread = this.matchPunctuator('...');\n args.push({ spread, value: this.parseAssignment() });\n } while (this.matchPunctuator(','));\n }\n\n this.expectPunctuator(')');\n return args;\n }\n\n private parsePrimary(): Node {\n const token = this.current();\n\n if (token.type === 'number') {\n this.advance();\n return { type: 'Literal', value: Number(token.value) };\n }\n\n if (token.type === 'string') {\n this.advance();\n return { type: 'Literal', value: token.value };\n }\n\n if (token.type === 'identifier') {\n this.advance();\n switch (token.value) {\n case 'true': return { type: 'Literal', value: true };\n case 'false': return { type: 'Literal', value: false };\n case 'null': return { type: 'Literal', value: null };\n case 'undefined': return { type: 'Literal', value: undefined };\n case 'NaN': return { type: 'Literal', value: NaN };\n case 'Infinity': return { type: 'Literal', value: Infinity };\n default: return { type: 'Identifier', name: token.value };\n }\n }\n\n if (this.matchPunctuator('(')) {\n const expression = this.parseExpression();\n this.expectPunctuator(')');\n return expression;\n }\n\n if (this.matchPunctuator('[')) {\n return this.parseArray();\n }\n\n if (this.matchPunctuator('{')) {\n return this.parseObject();\n }\n\n return fail('Unexpected token in expression.');\n }\n\n private parseArray(): Node {\n const elements: ArgumentNode[] = [];\n\n if (!isPunctuator(this.current(), ']')) {\n do {\n if (isPunctuator(this.current(), ']')) {\n break;\n }\n const spread = this.matchPunctuator('...');\n elements.push({ spread, value: this.parseAssignment() });\n } while (this.matchPunctuator(','));\n }\n\n this.expectPunctuator(']');\n return { type: 'Array', elements };\n }\n\n private parseObject(): Node {\n const properties: ObjectProperty[] = [];\n\n if (!isPunctuator(this.current(), '}')) {\n do {\n if (isPunctuator(this.current(), '}')) {\n break;\n }\n\n if (this.matchPunctuator('...')) {\n properties.push({ spread: true, value: this.parseAssignment(), computed: false });\n continue;\n }\n\n let key: Node;\n let computed = false;\n\n if (this.matchPunctuator('[')) {\n key = this.parseExpression();\n this.expectPunctuator(']');\n computed = true;\n } else {\n const keyToken = this.advance();\n if (keyToken.type === 'identifier' || keyToken.type === 'string') {\n key = { type: 'Literal', value: keyToken.value };\n } else if (keyToken.type === 'number') {\n key = { type: 'Literal', value: String(Number(keyToken.value)) };\n } else {\n return fail('Invalid object key.');\n }\n }\n\n this.expectPunctuator(':');\n const value = this.parseAssignment();\n properties.push({ spread: false, key, value, computed });\n } while (this.matchPunctuator(','));\n }\n\n this.expectPunctuator('}');\n return { type: 'Object', properties };\n }\n}\n\nfunction assertSafeProperty(property: string): void {\n if (FORBIDDEN_PROPERTIES.has(property)) {\n fail('Access to a forbidden property was blocked.');\n }\n}\n\nfunction defineSafeProperty(target: Record<string, unknown>, key: string, value: unknown): void {\n assertSafeProperty(key);\n Object.defineProperty(target, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n}\n\nfunction readMember(target: unknown, key: unknown, optional: boolean): unknown {\n if (typeof key !== 'string' && typeof key !== 'number') {\n fail('Property keys must be strings or numbers.');\n }\n\n const property = String(key);\n assertSafeProperty(property);\n\n if (target == null) {\n if (optional) {\n return undefined;\n }\n fail('Cannot read properties of null or undefined.');\n }\n\n return (Object(target) as Record<string, unknown>)[property];\n}\n\nfunction spreadValues(value: unknown): unknown[] {\n if (Array.isArray(value)) {\n return value.slice();\n }\n if (typeof value === 'string') {\n return value.split('');\n }\n return fail('Spread is only supported for arrays and strings.');\n}\n\nfunction isPrimitive(value: unknown): boolean {\n return value == null || typeof value === 'string' || typeof value === 'number' ||\n typeof value === 'boolean' || typeof value === 'bigint';\n}\n\nfunction primitiveAdd(left: unknown, right: unknown): unknown {\n if (!isPrimitive(left) || !isPrimitive(right)) {\n fail('Arithmetic on objects is not allowed.');\n }\n return (left as number) + (right as number);\n}\n\nfunction numericOperation(operator: string, left: unknown, right: unknown): number {\n if (typeof left !== 'number' || typeof right !== 'number') {\n fail(`Operator \"${operator}\" only supports numbers.`);\n }\n\n switch (operator) {\n case '-': return left - right;\n case '*': return left * right;\n case '/': return left / right;\n case '%': return left % right;\n case '**': return left ** right;\n default: return fail(`Unsupported arithmetic operator \"${operator}\".`);\n }\n}\n\nfunction looseEquals(left: unknown, right: unknown): boolean {\n if (!isPrimitive(left) || !isPrimitive(right)) {\n fail('Loose equality is only supported for primitive values.');\n }\n return left == right;\n}\n\nfunction compareValues(operator: string, left: unknown, right: unknown): boolean {\n if (!isPrimitive(left) || !isPrimitive(right)) {\n fail('Comparison is only supported for primitive values.');\n }\n\n switch (operator) {\n case '<': return (left as number) < (right as number);\n case '>': return (left as number) > (right as number);\n case '<=': return (left as number) <= (right as number);\n case '>=': return (left as number) >= (right as number);\n default: return fail(`Unsupported comparison operator \"${operator}\".`);\n }\n}\n\nfunction evaluateNode(node: Node, environment: Map<string, unknown>, state: EvaluationState): unknown {\n state.steps++;\n state.depth++;\n\n if (state.steps > MAX_EVALUATION_STEPS) {\n state.depth--;\n return fail('Expression is too complex.');\n }\n if (state.depth > MAX_EVALUATION_DEPTH) {\n state.depth--;\n return fail('Expression is nested too deeply.');\n }\n\n try {\n switch (node.type) {\n case 'Literal':\n return node.value;\n\n case 'Identifier': {\n if (!environment.has(node.name)) {\n return fail(`Unknown identifier \"${node.name}\".`);\n }\n return environment.get(node.name);\n }\n\n case 'Member': {\n const object = evaluateNode(node.object, environment, state);\n const key = evaluateNode(node.property, environment, state);\n return readMember(object, key, node.optional);\n }\n\n case 'Call': {\n let fn: unknown;\n let thisArg: unknown;\n\n if (node.callee.type === 'Member') {\n const object = evaluateNode(node.callee.object, environment, state);\n const key = evaluateNode(node.callee.property, environment, state);\n fn = readMember(object, key, node.callee.optional);\n thisArg = object;\n } else {\n fn = evaluateNode(node.callee, environment, state);\n }\n\n if (fn == null && node.optional) {\n return undefined;\n }\n if (typeof fn !== 'function') {\n if (node.optional) {\n return undefined;\n }\n return fail('Attempted to call a non-function value.');\n }\n if (fn === Function || fn === eval) {\n return fail('Calling global constructors is not allowed.');\n }\n\n const args: unknown[] = [];\n for (const argument of node.args) {\n const value = evaluateNode(argument.value, environment, state);\n if (argument.spread) {\n args.push(...spreadValues(value));\n } else {\n args.push(value);\n }\n }\n\n return (fn as (...args: unknown[]) => unknown).apply(thisArg, args);\n }\n\n case 'Unary': {\n const argument = evaluateNode(node.argument, environment, state);\n switch (node.operator) {\n case '!': return !argument;\n case 'typeof': return typeof argument;\n case '-':\n if (typeof argument !== 'number' && typeof argument !== 'bigint') {\n return fail('Unary \"-\" only supports numbers.');\n }\n return typeof argument === 'bigint' ? -argument : -argument;\n case '+':\n if (typeof argument !== 'number') {\n return fail('Unary \"+\" only supports numbers.');\n }\n return +argument;\n default:\n return fail(`Unsupported unary operator \"${node.operator}\".`);\n }\n }\n\n case 'Binary': {\n const left = evaluateNode(node.left, environment, state);\n const right = evaluateNode(node.right, environment, state);\n\n switch (node.operator) {\n case '===': return left === right;\n case '!==': return left !== right;\n case '==': return looseEquals(left, right);\n case '!=': return !looseEquals(left, right);\n case '+': return primitiveAdd(left, right);\n case '-':\n case '*':\n case '/':\n case '%':\n case '**':\n return numericOperation(node.operator, left, right);\n case '<':\n case '>':\n case '<=':\n case '>=':\n return compareValues(node.operator, left, right);\n default:\n return fail(`Unsupported binary operator \"${node.operator}\".`);\n }\n }\n\n case 'Logical': {\n const left = evaluateNode(node.left, environment, state);\n switch (node.operator) {\n case '&&': return left ? evaluateNode(node.right, environment, state) : left;\n case '||': return left ? left : evaluateNode(node.right, environment, state);\n case '??': return left == null ? evaluateNode(node.right, environment, state) : left;\n default: return fail(`Unsupported logical operator \"${node.operator}\".`);\n }\n }\n\n case 'Conditional':\n return evaluateNode(node.test, environment, state)\n ? evaluateNode(node.consequent, environment, state)\n : evaluateNode(node.alternate, environment, state);\n\n case 'Array': {\n const values: unknown[] = [];\n for (const element of node.elements) {\n const value = evaluateNode(element.value, environment, state);\n if (element.spread) {\n values.push(...spreadValues(value));\n } else {\n values.push(value);\n }\n }\n return values;\n }\n\n case 'Object': {\n const result: Record<string, unknown> = {};\n for (const property of node.properties) {\n if (property.spread) {\n const source = evaluateNode(property.value, environment, state);\n if (source == null || typeof source !== 'object') {\n return fail('Object spread is only supported for objects.');\n }\n for (const key of Object.keys(source)) {\n const descriptor = Object.getOwnPropertyDescriptor(source, key);\n if (descriptor && 'value' in descriptor) {\n defineSafeProperty(result, key, descriptor.value);\n }\n }\n continue;\n }\n\n if (!property.key) {\n return fail('Invalid object property.');\n }\n\n const key = property.computed\n ? evaluateNode(property.key, environment, state)\n : (property.key as { type: 'Literal'; value: unknown }).value;\n\n if (typeof key !== 'string' && typeof key !== 'number') {\n return fail('Object keys must be strings or numbers.');\n }\n\n defineSafeProperty(result, String(key), evaluateNode(property.value, environment, state));\n }\n return result;\n }\n\n case 'Arrow': {\n const params = node.params;\n const body = node.body;\n const closure = new Map(environment);\n\n return function evaluateArrowFunction(...args: unknown[]): unknown {\n const local = new Map(closure);\n params.forEach((parameter: string, index: number): void => {\n local.set(parameter, args[index]);\n });\n return evaluateNode(body, local, state);\n };\n }\n\n default:\n return fail('Unsupported expression node.');\n }\n } finally {\n state.depth--;\n }\n}\n\n/**\n * Evaluates a configuration expression without ever compiling it as JavaScript.\n *\n * Only the identifiers provided in `variables` are visible. Any unsupported\n * construct throws an `FGDynamicExpressionError`; callers should treat that as\n * an invalid expression and fall back to the literal value.\n */\nexport function evaluateSafeExpression(source: string, variables: Record<string, unknown> = {}): unknown {\n if (typeof source !== 'string') {\n fail('Expression must be a string.');\n }\n if (source.length === 0) {\n fail('Expression is empty.');\n }\n if (source.length > MAX_SOURCE_LENGTH) {\n fail('Expression is too long.');\n }\n\n const parser = new ExpressionParser(tokenize(source));\n const ast = parser.parse();\n const environment = new Map<string, unknown>();\n\n for (const [key, value] of Object.entries(variables)) {\n environment.set(key, value);\n }\n\n return evaluateNode(ast, environment, { steps: 0, depth: 0 });\n}\n","import { ChangeDetectionStrategy, Component, ComponentRef, ElementRef, EventEmitter, Injector, InputSignal, ModelSignal, OnChanges, OnDestroy, Renderer2, Signal, SimpleChanges, Type, ViewContainerRef, computed, inject, input, isDevMode, model, viewChild, viewChildren } from '@angular/core';\nimport { AbstractControl, ControlValueAccessor, FormControl, FormControlDirective, FormGroup, NG_VALUE_ACCESSOR, NgControl, ValidationErrors, ValidatorFn, Validators } from '@angular/forms';\nimport { Subscription } from 'rxjs';\nimport { evaluateSafeExpression } from './safe-expression';\n\nexport type FGDynamicType = Type<unknown> | Promise<Type<unknown>> | (() => Promise<Type<unknown>>);\n\nexport interface IFGDynamicItem {\n type?: string | FGDynamicType;\n inputs?: Record<string, string | unknown>;\n outputs?: Record<string, string | Function>;\n attributes?: Record<string, string | unknown>;\n items?: IFGDynamicItem[];\n}\n\nconst FORBIDDEN_PATH_SEGMENTS: ReadonlySet<string> = new Set(['__proto__', 'prototype', 'constructor']);\nconst MAX_PATH_DEPTH = 32;\nconst MAX_PATH_SEGMENT_LENGTH = 128;\nconst MAX_CONFIGURATION_ITEMS = 1000;\nconst MAX_ATTRIBUTE_NAME_LENGTH = 128;\nconst MAX_ATTRIBUTE_VALUE_LENGTH = 8192;\nconst MAX_PATTERN_LENGTH = 512;\nconst MAX_PATTERN_INPUT_LENGTH = 1024;\n\nconst ALLOWED_ATTRIBUTES: ReadonlySet<string> = new Set([\n 'class', 'id', 'name', 'role', 'title', 'tabindex', 'hidden', 'dir', 'lang',\n 'disabled', 'readonly', 'required', 'placeholder', 'autocomplete', 'spellcheck',\n 'min', 'max', 'minlength', 'maxlength', 'pattern', 'email', 'step',\n 'multiple', 'checked', 'selected', 'for', 'href', 'src'\n]);\n\nconst URL_ATTRIBUTES: ReadonlySet<string> = new Set(['href', 'src']);\n\n/**\n * A scoped component registry. Backed by a `Map`, so lookups never walk the\n * prototype chain and names such as `__proto__` or `constructor` are ordinary keys.\n *\n * Use one registry per rendering context (e.g. per plugin or tenant) so a\n * configuration can only select components that were explicitly registered for\n * that context.\n */\nexport class FGDynamicRegistry {\n private readonly _components = new Map<string, FGDynamicType>();\n\n register(name: string, type: FGDynamicType): void {\n if (typeof name === 'string' && name.length > 0 && type) {\n this._components.set(name, type);\n }\n }\n\n get(name: string): FGDynamicType | undefined {\n return typeof name === 'string' ? this._components.get(name) : undefined;\n }\n\n has(name: string): boolean {\n return typeof name === 'string' && this._components.has(name);\n }\n\n unregister(name: string): boolean {\n return this._components.delete(name);\n }\n\n clear(): void {\n this._components.clear();\n }\n\n get names(): string[] {\n return Array.from(this._components.keys());\n }\n}\n\n/**\n * Declare components to dynamically load in static and/or dynamic way using the FGDynamicService.\n *\n * The static registry is global. For untrusted or multi-tenant configurations,\n * create a scoped registry with `FGDynamicService.createRegistry()` and pass it\n * to `<fg-dynamic [registry]=\"registry\">`.\n */\nexport class FGDynamicService {\n private static readonly _defaultRegistry = new FGDynamicRegistry();\n\n static get registry(): FGDynamicRegistry {\n return FGDynamicService._defaultRegistry;\n }\n\n static createRegistry(): FGDynamicRegistry {\n return new FGDynamicRegistry();\n }\n\n static registerComponent(name: string, type: FGDynamicType): void {\n FGDynamicService._defaultRegistry.register(name, type);\n }\n\n static getComponent(name: string): FGDynamicType | undefined {\n return FGDynamicService._defaultRegistry.get(name);\n }\n\n static hasComponent(name: string): boolean {\n return FGDynamicService._defaultRegistry.has(name);\n }\n\n static unregisterComponent(name: string): boolean {\n return FGDynamicService._defaultRegistry.unregister(name);\n }\n\n static clearRegistry(): void {\n FGDynamicService._defaultRegistry.clear();\n }\n}\n\n/**\n * Create a standalone signals based dynamic components tree through a JSON configuration with full\n * life-cycle support for inputs, outputs, attributes, reactive forms and expressions binding evaluation.\n */\n@Component({\n\tselector: 'fg-dynamic',\n\ttemplate: `\n <ng-container #viewContainer></ng-container>\n @for (item of items(); track $index) {\n <fg-dynamic #dynamicItem [configuration]=\"item\" [(viewModel)]=\"viewModel\" [formGroup]=\"formGroup()\" [registry]=\"registry()\" />\n }\n `,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tstandalone: true,\n\tstyles: [`:host { display: contents; }`]\n})\nexport class FGDynamicComponent implements OnChanges, OnDestroy {\n\tconfiguration: InputSignal<IFGDynamicItem> = input.required<IFGDynamicItem>();\n\tviewModel: ModelSignal<unknown> = model<unknown>();\n\tformGroup: InputSignal<FormGroup> = input<FormGroup>();\n\tregistry: InputSignal<FGDynamicRegistry> = input<FGDynamicRegistry>(FGDynamicService.registry);\n\n /**\n * Validated child items. Invalid entries are ignored and the list is capped\n * to avoid pathological configurations blocking the renderer.\n */\n protected readonly items: Signal<readonly IFGDynamicItem[]> = computed((): readonly IFGDynamicItem[] => {\n const configuration = this.configuration();\n const items = configuration && typeof configuration === 'object' && !Array.isArray(configuration) ? (configuration as IFGDynamicItem).items : undefined;\n if (!Array.isArray(items)) {\n return [];\n }\n return items\n .filter((item: unknown): item is IFGDynamicItem => item != null && typeof item === 'object' && !Array.isArray(item))\n .slice(0, MAX_CONFIGURATION_ITEMS);\n });\n\n\tprivate _viewContainerRef: Signal<ViewContainerRef> = viewChild.required('viewContainer', {\n read: ViewContainerRef\n });\n private _dynamicItems: Signal<readonly ElementRef<unknown>[]> = viewChildren('dynamicItem', {\n read: ElementRef\n });\n\tprivate _componentRef: ComponentRef<unknown>;\n private _renderer: Renderer2 = inject(Renderer2);\n private _outputsSubscriptions: Subscription[] = [];\n private _currentOutputsConfig?: Record<string, string | Function>;\n private _formControl: FormControl;\n private _formControlDirective: FormControlDirective;\n private _formControlSubscription: Subscription;\n private _managedValidatorFns: ValidatorFn[] = [];\n private _component: Type<unknown>;\n private _injector: Injector = inject(Injector);\n private _ngOnChangesCounter = 0;\n private _lastProjectedItemsSignature: string;\n\n /**\n * A callback method that is invoked immediately after the default change\n * detector has checked data-bound properties if at least one has changed,\n * and before the view and content children are checked.\n */\n async ngOnChanges(changes?: SimpleChanges): Promise<void> {\n const counter = ++this._ngOnChangesCounter;\n try {\n const configuration = this.configuration();\n if (configuration != null && (typeof configuration !== 'object' || Array.isArray(configuration))) {\n this.logError('Invalid configuration: expected an object.');\n return;\n }\n\n // Lazy-load a component.\n await this.loadComponentAsync();\n\n if (counter !== this._ngOnChangesCounter) {\n return;\n }\n\n // If projected items changed, we need to recreate the component to update projectableNodes\n const items = this.items();\n const itemsSignature = items.length > 0\n ? `${items.length}:${items.map((item: IFGDynamicItem, index: number): string => `${index}:${item?.type}`).join('|')}`\n : '';\n if (this._componentRef && this._lastProjectedItemsSignature !== itemsSignature) {\n this.cleanup();\n this._lastProjectedItemsSignature = itemsSignature;\n } else if (!this._componentRef) {\n this._lastProjectedItemsSignature = itemsSignature;\n }\n\n // Instantiates a single component and inserts its host view into this container.\n this.createComponent();\n\n if (counter !== this._ngOnChangesCounter) {\n return;\n }\n\n // Updates specified input names to new values.\n this.setInputs();\n // Disables/enables the control.\n this.setFormControlStatus();\n // Add synchronous validators to this control.\n this.setFormControlValidators();\n // Set attribute values for an element in the DOM.\n this.setAttributes();\n // Re-wire outputs if they changed\n this.handleOutputsIfChanged();\n // Ensure change detection\n if (this._componentRef?.changeDetectorRef) {\n this._componentRef.changeDetectorRef.markForCheck();\n }\n } catch (error) {\n this.logError('Error during component initialization.', error);\n }\n }\n\n /**\n * A method to lazy-load a component.\n */\n private async loadComponentAsync(): Promise<void> {\n const configurationType = this.configuration()?.type;\n\n if (configurationType == null) {\n return;\n }\n\n let candidate: FGDynamicType | undefined;\n\n if (typeof configurationType === 'string') {\n candidate = this.getRegistry().get(configurationType);\n if (candidate == null) {\n this.logWarning(`Component type \"${configurationType}\" not found in the registry.`);\n return;\n }\n } else {\n candidate = configurationType;\n }\n\n try {\n const resolved = this.resolveCandidate(candidate);\n\n // Resolve synchronous types without an extra microtask hop so that\n // attribute/form updates happen within the same change-detection pass.\n const resolvedType = resolved instanceof Promise ? await resolved : resolved;\n\n // Only re-assign when the resolved type actually changed, so that subsequent\n // input/attribute updates don't tear down the already-instantiated component.\n if (resolvedType && this._component !== resolvedType) {\n this._component = resolvedType;\n }\n } catch (error) {\n this.logError('Unable to resolve the dynamic component type.', error);\n }\n }\n\n private resolveCandidate(candidate: unknown): Type<unknown> | Promise<Type<unknown> | undefined> | undefined {\n if (candidate == null) {\n return undefined;\n }\n\n if (candidate instanceof Promise) {\n return candidate.then((resolved: unknown): Type<unknown> | undefined => this.toComponentType(resolved));\n }\n\n if (typeof candidate === 'function') {\n // Never invoke an Angular component/directive/pipe class: it is a type, not a loader.\n if (this.isAngularComponentType(candidate)) {\n return candidate as Type<unknown>;\n }\n\n // A function with declared parameters cannot be a lazy loader (loaders are zero-arity).\n if (candidate.length > 0) {\n return candidate as Type<unknown>;\n }\n\n const result: unknown = (candidate as () => unknown)();\n\n if (result instanceof Promise) {\n return result.then((resolved: unknown): Type<unknown> | undefined => this.toComponentType(resolved));\n }\n\n return this.toComponentType(result);\n }\n\n this.logWarning('Invalid component type in configuration.');\n return undefined;\n }\n\n private toComponentType(resolved: unknown): Type<unknown> | undefined {\n if (typeof resolved === 'function') {\n return resolved as Type<unknown>;\n }\n\n this.logWarning('Component loader did not resolve to a component type.');\n return undefined;\n }\n\n private isAngularComponentType(candidate: Function): boolean {\n const metadata = candidate as unknown as Record<string, unknown>;\n return Boolean(\n metadata['ɵcmp'] ||\n metadata['ɵdir'] ||\n metadata['ɵpipe'] ||\n metadata['ɵfac'] ||\n metadata['ngComponentDef'] ||\n metadata['ngDirectiveDef']\n );\n }\n\n private getRegistry(): FGDynamicRegistry {\n return this.registry() ?? FGDynamicService.registry;\n }\n\n /**\n * Instantiates a single component and inserts its host view into this container.\n */\n private createComponent(): void {\n // If the component type changed, clean up and recreate it.\n if (this._componentRef && this._component !== this._componentRef.componentType) {\n this.cleanup();\n }\n\n if (this._component && !this._componentRef && this._viewContainerRef()) {\n let injector: Injector | undefined = undefined;\n const attributes = this.configuration()?.attributes;\n const nameAttr = attributes && Object.hasOwn(attributes, 'name') ? attributes['name'] : undefined;\n\n if (this.formGroup() && nameAttr != null && this.viewModel() != null) {\n const evaluatedName = this.evaluateExpression(nameAttr, this.viewModel);\n if (typeof evaluatedName === 'string' && this.isSafePath(evaluatedName)) {\n // Synchronizes a standalone FormControl instance to a form control element.\n this._formControlDirective = new FormControlDirective(null, null, null, null);\n\n // Creates a new injector instance that provides one or more dependencies, according to a given type or types of StaticProvider.\n injector = Injector.create({\n providers: [{\n provide: NgControl,\n useValue: this._formControlDirective\n }],\n parent: this._injector\n });\n } else if (typeof evaluatedName === 'string') {\n this.logWarning('Unsafe form control name was ignored.');\n }\n }\n\n // Instantiates a single component and inserts its host view into this container.\n const dynamicItems = this._dynamicItems();\n this._componentRef = this._viewContainerRef().createComponent(this._component, {\n projectableNodes: dynamicItems && dynamicItems.length > 0 ? [dynamicItems.map((e: ElementRef<unknown>): Node => e.nativeElement as Node)] : undefined,\n injector: injector\n });\n\n // When a view uses the ChangeDetectionStrategy#OnPush (checkOnce) change detection strategy, explicitly marks the view as changed so that it can be checked again.\n // Components are normally marked as dirty (in need of rerendering) when inputs have changed or events have fired in the view.\n // Call this method to ensure that a component is checked even if these triggers have not occurred.\n if (this._componentRef?.changeDetectorRef) {\n this._componentRef.changeDetectorRef.markForCheck();\n }\n\n // Register handlers for those events by subscribing to an instance.\n this.handleOutputs();\n // Construct a FormControl with an initial value.\n this.createFormControl();\n }\n }\n\n /**\n * Register handlers for those events by subscribing to an instance.\n */\n private handleOutputs(): void {\n // Clean up existing subscriptions\n if (this._outputsSubscriptions && this._outputsSubscriptions.length > 0) {\n this._outputsSubscriptions.forEach((s: Subscription): void => {\n try {\n s.unsubscribe();\n } catch (e) {\n // Ignore\n }\n });\n this._outputsSubscriptions = [];\n }\n\n const outputs = this.configuration()?.outputs;\n this._currentOutputsConfig = outputs ? { ...outputs } : undefined;\n\n if (outputs && typeof outputs === 'object' && this._componentRef?.instance) {\n const instance = this._componentRef.instance as Record<string, unknown>;\n\n for (const outputName of Object.keys(outputs)) {\n const emitter = instance[outputName];\n\n if (!(emitter instanceof EventEmitter)) {\n continue;\n }\n\n this._outputsSubscriptions.push(emitter.subscribe(($event: unknown): void => {\n try {\n const expr = outputs[outputName];\n const viewModelValue = this.getViewModelValue();\n const result: unknown = typeof expr === 'string'\n ? this.evaluateExpression(expr, this.viewModel, $event)\n : expr;\n\n if (typeof result === 'function') {\n (result as Function).call(viewModelValue, $event);\n } else if (typeof expr === 'function') {\n (expr as Function).call(viewModelValue, $event);\n }\n } catch (error) {\n this.logError('Error handling output.', error);\n }\n }));\n }\n }\n }\n\n private handleOutputsIfChanged(): void {\n const outputs = this.configuration()?.outputs;\n const current = this._currentOutputsConfig;\n \n // Check if outputs changed\n if (!outputs && !current) {\n return;\n }\n if (!outputs || !current) {\n this.handleOutputs();\n return;\n }\n \n const currentKeys = Object.keys(current).sort();\n const newKeys = Object.keys(outputs).sort();\n if (currentKeys.length !== newKeys.length) {\n this.handleOutputs();\n return;\n }\n for (let i = 0; i < currentKeys.length; i++) {\n if (currentKeys[i] !== newKeys[i] || current[currentKeys[i]] !== outputs[newKeys[i]]) {\n this.handleOutputs();\n return;\n }\n }\n }\n\n /**\n * Construct a FormControl with an initial value.\n */\n private createFormControl(): void {\n const attributes = this.configuration()?.attributes;\n const nameAttr = attributes && Object.hasOwn(attributes, 'name') ? attributes['name'] : undefined;\n\n if (this.formGroup() && nameAttr != null && this.viewModel() != null) {\n const name = this.evaluateExpression(nameAttr, this.viewModel);\n\n if (typeof name === 'string' && name.length > 0 && this.isSafePath(name)) {\n const formGroup = this.formGroup();\n\n // Check if control with same name already exists\n const existingControl = formGroup.get(name);\n if (existingControl && existingControl !== this._formControl) {\n this.logWarning('A form control with the requested name already exists; reusing it.');\n this._formControl = existingControl as FormControl;\n // Still need to attach directive if needed\n if (this._formControlDirective) {\n this.attachFormControlDirective();\n }\n return;\n }\n\n // Construct a FormControl with an initial value.\n this._formControl = new FormControl(this.getModelPropertyValue(this.viewModel(), name, null));\n\n // Add a control to this group.\n try {\n if (existingControl === this._formControl) {\n // Already added\n } else if (existingControl) {\n formGroup.setControl(name, this._formControl);\n } else {\n formGroup.addControl(name, this._formControl);\n }\n } catch (error) {\n this.logError('Error adding form control.', error);\n }\n\n // A multicasting observable that emits an event every time the value of the control changes, in the UI or programmatically.\n if (this._formControlSubscription) {\n this._formControlSubscription.unsubscribe();\n }\n this._formControlSubscription = this._formControl.valueChanges.subscribe((value: unknown): void => {\n // Creates a deep clone of an object, falling back to a JSON round-trip\n // when the view model contains non-cloneable values (functions, DOM nodes, ...).\n let viewModel: unknown;\n\n try {\n viewModel = structuredClone(this.viewModel());\n } catch {\n try {\n viewModel = JSON.parse(JSON.stringify(this.viewModel()));\n } catch {\n viewModel = this.viewModel();\n }\n }\n\n // Sets the value at path of object.\n this.setModelPropertyValue(viewModel, name, value);\n // Directly set the signal to a new value, and notify any dependents.\n try {\n this.viewModel.set(viewModel);\n } catch (error) {\n this.logError('Error updating view model.', error);\n }\n });\n\n // Synchronizes a standalone FormControl instance to a form control element.\n this.attachFormControlDirective();\n } else if (typeof name === 'string') {\n this.logWarning('Unsafe form control name was ignored.');\n }\n }\n }\n\n /**\n * Disables/enables the control.\n */\n private setFormControlStatus(): void {\n if (!this._formControl) {\n return;\n }\n const attributes = this.configuration()?.attributes;\n if (!attributes) {\n return;\n }\n \n if (Object.hasOwn(attributes, 'disabled')) {\n const disabledAttr = attributes['disabled'];\n if (disabledAttr == null || disabledAttr === false || disabledAttr === '') {\n // Remove disabled state\n if (this._formControl.disabled) {\n try {\n this._formControl.enable({\n onlySelf: true,\n emitEvent: false\n });\n } catch (e) {\n // Ignore\n }\n }\n try {\n this._formControl.updateValueAndValidity({ onlySelf: true, emitEvent: false });\n } catch (e) {\n }\n return;\n }\n // Evaluates JavaScript code and executes it.\n const isDisabled = this.evaluateExpression(disabledAttr, this.viewModel);\n if (isDisabled === true || (typeof isDisabled === 'string' && isDisabled === 'true')) {\n if (this._formControl.enabled || !this._formControl.disabled) {\n try {\n // Disables the control.\n this._formControl.disable({\n onlySelf: true,\n emitEvent: false\n });\n } catch (e) {\n // Ignore\n }\n }\n } else if (isDisabled === false || isDisabled === '' || isDisabled === null || isDisabled === undefined || (typeof isDisabled === 'string' && isDisabled === 'false')) {\n if (this._formControl.disabled) {\n try {\n // Enables the control.\n this._formControl.enable({\n onlySelf: true,\n emitEvent: false\n });\n } catch (e) {\n // Ignore\n }\n }\n } else if (typeof isDisabled === 'boolean') {\n if (isDisabled && this._formControl.enabled) {\n try {\n this._formControl.disable({\n onlySelf: true,\n emitEvent: false\n });\n } catch (e) {\n // Ignore\n }\n } else if (!isDisabled && this._formControl.disabled) {\n try {\n this._formControl.enable({\n onlySelf: true,\n emitEvent: false\n });\n } catch (e) {\n // Ignore\n }\n }\n }\n }\n }\n\n /**\n * Add synchronous validators to this control.\n */\n private setFormControlValidators(): void {\n if (!this._formControl) {\n return;\n }\n\n // Always remove previously managed validators, even when the current\n // configuration has no validator-bearing attributes.\n if (this._managedValidatorFns.length > 0) {\n try {\n this._formControl.removeValidators(this._managedValidatorFns);\n } catch (e) {\n // Ignore\n }\n \n this._managedValidatorFns = [];\n \n try {\n this._formControl.updateValueAndValidity({\n onlySelf: true,\n emitEvent: false\n });\n } catch (e) {\n // Ignore\n }\n }\n\n const attributes = this.configuration()?.attributes;\n if (attributes && Object.keys(attributes).length > 0 && this._componentRef?.location?.nativeElement) {\n const validators: ValidatorFn[] = [];\n // Validator that requires the control's value to be greater than or equal to the provided number.\n if (Object.hasOwn(attributes, 'min')) {\n const min = this.evaluateExpression(attributes['min'], this.viewModel);\n if (typeof(min) === 'number' && !isNaN(min)) {\n validators.push(Validators.min(min));\n }\n }\n\n // Validator that requires the control's value to be less than or equal to the provided number.\n if (Object.hasOwn(attributes, 'max')) {\n const max = this.evaluateExpression(attributes['max'], this.viewModel);\n if (typeof(max) === 'number' && !isNaN(max)) {\n validators.push(Validators.max(max));\n }\n }\n\n // Validator that requires the control have a non-empty value.\n if (Object.hasOwn(attributes, 'required')) {\n const required = this.evaluateExpression(attributes['required'], this.viewModel);\n if (required === true) {\n validators.push(Validators.required);\n }\n }\n\n // Validator that requires the control's value pass an email validation test.\n if (Object.hasOwn(attributes, 'email')) {\n const email = this.evaluateExpression(attributes['email'], this.viewModel);\n if (email === true) {\n validators.push(Validators.email);\n }\n }\n\n // Validator that requires the length of the control's value to be less than or equal to the provided maximum length.\n if (Object.hasOwn(attributes, 'maxlength')) {\n const maxLength = this.evaluateExpression(attributes['maxlength'], this.viewModel);\n if (typeof(maxLength) === 'number' && !isNaN(maxLength) && maxLength >= 0) {\n validators.push(Validators.maxLength(maxLength));\n }\n }\n\n // Validator that requires the length of the control's value to be greater than or equal to the provided minimum length.\n if (Object.hasOwn(attributes, 'minlength')) {\n const minLength = this.evaluateExpression(attributes['minlength'], this.viewModel);\n if (typeof(minLength) === 'number' && !isNaN(minLength) && minLength >= 0) {\n validators.push(Validators.minLength(minLength));\n }\n }\n\n // Validator that requires the control's value to match a regex pattern.\n // Configuration patterns are untrusted: cap their size and reject\n // nested quantifiers that can trigger catastrophic backtracking.\n if (Object.hasOwn(attributes, 'pattern')) {\n const pattern = this.evaluateExpression(attributes['pattern'], this.viewModel);\n const patternValidator = this.createPatternValidator(pattern);\n if (patternValidator) {\n validators.push(patternValidator);\n }\n }\n\n // Track and add the newly built managed validators.\n if (validators.length > 0) {\n this._managedValidatorFns = validators;\n try {\n this._formControl.addValidators(this._managedValidatorFns);\n } catch (e) {\n // Ignore\n }\n } else {\n this._managedValidatorFns = [];\n }\n // Recalculates the value and validation status of the control whenever the\n // managed validator set changes (including when it becomes empty).\n try {\n this._formControl.updateValueAndValidity({\n onlySelf: true,\n emitEvent: false\n });\n } catch (e) {\n // Ignore\n }\n } else {\n this._managedValidatorFns = [];\n }\n }\n\n /**\n * Builds a defensive `pattern` validator. Invalid, oversized or potentially\n * catastrophic regular expressions are ignored instead of blocking the UI.\n */\n private createPatternValidator(pattern: unknown): ValidatorFn | null {\n let regex: RegExp;\n\n if (typeof pattern === 'string') {\n if (pattern.length === 0 || pattern.length > MAX_PATTERN_LENGTH) {\n this.logWarning('Pattern validator was ignored because its source is empty or too long.');\n return null;\n }\n if (this.isUnsafeRegex(pattern)) {\n this.logWarning('Pattern validator was ignored because the expression is potentially unsafe.');\n return null;\n }\n\n try {\n const anchored = (pattern.startsWith('^') ? '' : '^') + pattern + (pattern.endsWith('$') ? '' : '$');\n regex = new RegExp(anchored);\n } catch (error) {\n this.logError('Pattern validator was ignored because the expression is invalid.', error);\n return null;\n }\n } else if (pattern instanceof RegExp) {\n if (pattern.source.length > MAX_PATTERN_LENGTH || this.isUnsafeRegex(pattern.source)) {\n this.logWarning('Pattern validator was ignored because the expression is potentially unsafe.');\n return null;\n }\n regex = pattern;\n } else {\n return null;\n }\n\n const baseValidator = Validators.pattern(regex);\n\n return (control: AbstractControl): ValidationErrors | null => {\n const value = control.value;\n\n if (value == null) {\n return baseValidator(control);\n }\n if (typeof value !== 'string' && typeof value !== 'number') {\n return { pattern: { requiredPattern: regex.toString() } };\n }\n if (typeof value === 'string' && value.length > MAX_PATTERN_INPUT_LENGTH) {\n return { pattern: { requiredPattern: regex.toString() } };\n }\n\n return baseValidator(control);\n };\n }\n\n /**\n * Heuristic check for regular expressions with nested/ambiguous quantifiers\n * (e.g. `(a+)+`, `(a*)*`, `(\\d+){2,}`) that can cause exponential backtracking.\n */\n private isUnsafeRegex(source: string): boolean {\n if (source.length > MAX_PATTERN_LENGTH) {\n return true;\n }\n if (/\\((?:[^()\\\\]|\\\\.)*[+*](?:[^()\\\\]|\\\\.)*\\)(?:[+*]|\\{\\d)/.test(source)) {\n return true;\n }\n if (/\\\\[1-9][+*{]/.test(source)) {\n return true;\n }\n if (/\\((?:\\.\\*|\\.\\+)[^)]*\\)[+*{]/.test(source)) {\n return true;\n }\n return false;\n }\n\n /**\n * Synchronizes a standalone FormControl instance to a form control element.\n */\n private attachFormControlDirective(): void {\n if (this._formControlDirective && this._componentRef?.injector && this._formControl) {\n try {\n const valueAccessors: ControlValueAccessor[] | null = this._componentRef.injector.get<ControlValueAccessor[] | null>(NG_VALUE_ACCESSOR, null);\n \n this._formControlDirective.valueAccessor = Array.isArray(valueAccessors) && valueAccessors.length > 0 ? valueAccessors[0] : null;\n this._formControlDirective.form = this._formControl;\n\n // A callback method that is invoked immediately after the default change detector has checked data-bound properties if at least one has changed, and before the view and content children are checked.\n this._formControlDirective.ngOnChanges({\n form: {\n firstChange: true,\n currentValue: this._formControl,\n previousValue: undefined,\n isFirstChange: (): true => true\n }\n });\n } catch (error) {\n this.logError('Error attaching form control directive.', error);\n }\n }\n }\n\n /**\n * Parses a dot/bracket path. Returns `null` when the path is malformed or\n * contains prototype-related segments (`__proto__`, `prototype`,\n * `constructor`), which protects both the view model and `FormGroup`.\n */\n private parsePath(property: Array<string> | string | null | undefined): string[] | null {\n if (property == null) {\n return null;\n }\n\n let pathArray: string[] | null = null;\n\n if (Array.isArray(property)) {\n pathArray = property\n .filter((segment: unknown): boolean => segment != null && segment !== '')\n .map((segment: unknown): string => String(segment));\n } else if (typeof property === 'string') {\n // Regex: ensure that we do not have '.' and brackets inside a segment.\n pathArray = property.match(/([^[.\\]])+/g);\n }\n\n if (!pathArray || pathArray.length === 0 || pathArray.length > MAX_PATH_DEPTH) {\n return null;\n }\n\n for (const segment of pathArray) {\n if (segment.length > MAX_PATH_SEGMENT_LENGTH) {\n return null;\n }\n if (FORBIDDEN_PATH_SEGMENTS.has(segment.toLowerCase())) {\n return null;\n }\n }\n\n return pathArray;\n }\n\n private isSafePath(property: Array<string> | string): boolean {\n return this.parsePath(property) !== null;\n }\n\n private defineOwn(target: object, key: string, value: unknown): void {\n Object.defineProperty(target, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n\n /**\n * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.\n * Only own properties are read; prototype-chain reads are blocked.\n * @param model The object.\n * @param property The path.\n * @param defaultValue The resolved value.\n */\n private getModelPropertyValue(model: unknown, property: Array<string> | string, defaultValue: unknown): unknown {\n if (model == null) {\n return defaultValue;\n }\n\n const pathArray = this.parsePath(property);\n if (!pathArray) {\n return defaultValue;\n }\n\n try {\n let current: unknown = model;\n\n for (const key of pathArray) {\n if (current == null) {\n return defaultValue;\n }\n const container = Object(current) as Record<string, unknown>;\n if (!Object.hasOwn(container, key)) {\n return defaultValue;\n }\n current = container[key];\n }\n\n return current != null ? current : defaultValue;\n } catch {\n return defaultValue;\n }\n }\n\n /**\n * Sets the value at path of object. If a portion of path doesn't exist, it's created.\n * Arrays are created for missing index properties while objects are created for all other missing properties.\n * Only own properties are traversed and written; prototype-related segments are rejected.\n * This method mutates object.\n * @param model The object.\n * @param property The path.\n * @param value The value.\n */\n private setModelPropertyValue(model: unknown, property: Array<string> | string, value: unknown): void {\n if (model == null) {\n return;\n }\n\n const pathArray = this.parsePath(property);\n if (!pathArray) {\n return;\n }\n\n try {\n let current: any = model;\n\n for (let index = 0; index < pathArray.length; index++) {\n const key = pathArray[index];\n const isLast = index === pathArray.length - 1;\n\n if (current == null || (typeof current !== 'object' && typeof current !== 'function')) {\n return;\n }\n\n if (isLast) {\n this.defineOwn(current, key, value);\n return;\n }\n\n const isNumericKey = /^\\d+$/.test(key);\n const existing = Object.hasOwn(current, key) ? current[key] : undefined;\n\n if (existing == null) {\n // Create array if key is numeric, otherwise object.\n const next: unknown = isNumericKey ? [] : {};\n this.defineOwn(current, key, next);\n current = next;\n } else if (isNumericKey && !Array.isArray(existing)) {\n // Try to convert to array if needed.\n if (typeof existing !== 'object') {\n return;\n }\n const next: unknown[] = [];\n this.defineOwn(current, key, next);\n current = next;\n } else if (!isNumericKey && typeof existing !== 'object') {\n const next: Record<string, unknown> = {};\n this.defineOwn(current, key, next);\n current = next;\n } else {\n current = existing;\n }\n }\n } catch (error) {\n this.logError('Error setting model property value.', error);\n }\n }\n\n /**\n * Updates specified input names to new values.\n */\n private setInputs(): void {\n const inputs = this.configuration()?.inputs;\n\n if (!inputs || typeof inputs !== 'object' || !this._componentRef) {\n return;\n }\n\n for (const inputName of Object.keys(inputs)) {\n try {\n // Updates a specified input name to a new value.\n this._componentRef.setInput(inputName, this.evaluateExpression(inputs[inputName], this.viewModel));\n } catch (error) {\n this.logError(`Error setting dynamic input \"${inputName}\".`, error);\n }\n }\n }\n\n /**\n * Set attribute values for an element in the DOM.\n *\n * Attribute names and values are validated: event handlers (`on*`),\n * namespaced attributes, `style`/`srcdoc`/`formaction` and unsafe URL\n * schemes are never applied. Non-primitive values are ignored so that\n * configuration data cannot invoke `toString()`/`toJSON()` hooks.\n */\n private setAttributes(): void {\n const attributes = this.configuration()?.attributes;\n const element = this._componentRef?.location?.nativeElement;\n\n if (!attributes || typeof attributes !== 'object' || !element) {\n return;\n }\n\n for (const attributeName of Object.keys(attributes)) {\n if (!this.isAllowedAttribute(attributeName)) {\n this.logWarning(`Attribute \"${attributeName}\" is not allowed and was skipped.`);\n continue;\n }\n\n try {\n const value = this.evaluateExpression(attributes[attributeName], this.viewModel);\n const stringValue = this.attributeValueToString(value);\n\n if (stringValue === undefined) {\n continue;\n }\n\n // Returns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise.\n const currentAttr = element.getAttribute(attributeName) as string | null;\n if (stringValue === currentAttr) {\n continue;\n }\n\n if (stringValue === null) {\n this._renderer.removeAttribute(element, attributeName);\n continue;\n }\n\n if (URL_ATTRIBUTES.has(attributeName.toLowerCase()) && !this.isSafeUrl(stringValue)) {\n this.logWarning(`Unsafe URL for attribute \"${attributeName}\" was ignored.`);\n continue;\n }\n\n this._renderer.setAttribute(element, attributeName, stringValue);\n } catch (error) {\n this.logError(`Error setting dynamic attribute \"${attributeName}\".`, error);\n }\n }\n }\n\n private isAllowedAttribute(name: string): boolean {\n if (typeof name !== 'string' || name.length === 0 || name.length > MAX_ATTRIBUTE_NAME_LENGTH) {\n return false;\n }\n\n const lower = name.toLowerCase();\n\n if (lower.startsWith('on')) {\n return false;\n }\n\n // Reject namespaces, whitespace and other non-standard attribute names.\n if (!/^[a-z][a-z0-9_.-]*$/i.test(name)) {\n return false;\n }\n\n if (lower.startsWith('data-') || lower.startsWith('aria-')) {\n return true;\n }\n\n return ALLOWED_ATTRIBUTES.has(lower);\n }\n\n /**\n * Returns `undefined` to skip the attribute entirely, `null` to remove it,\n * or a safe string value.\n */\n private attributeValueToString(value: unknown): string | null | undefined {\n if (value == null) {\n return null;\n }\n\n const type = typeof value;\n\n if (type !== 'string' && type !== 'number' && type !== 'boolean' && type !== 'bigint') {\n this.logWarning('Non-primitive attribute values are ignored.');\n return undefined;\n }\n\n const stringValue = String(value);\n\n if (stringValue.length > MAX_ATTRIBUTE_VALUE_LENGTH) {\n this.logWarning('Attribute value is too long and was ignored.');\n return undefined;\n }\n\n return stringValue;\n }\n\n private isSafeUrl(value: string): boolean {\n // Browsers ignore control characters and whitespace inside URL schemes.\n const normalized = value.replace(/[\\u0000-\\u0020\\u007f]/g, '').toLowerCase();\n\n if (normalized.length === 0) {\n return true;\n }\n\n const scheme = /^([a-z][a-z0-9+.-]*):/.exec(normalized);\n\n if (!scheme) {\n // Relative URL, fragment or query string.\n return true;\n }\n\n return scheme[1] === 'http' || scheme[1] === 'https' || scheme[1] === 'mailto' || scheme[1] === 'tel';\n }\n\n /**\n * Evaluates an expression with a small, allowlisted interpreter. No `eval`,\n * `Function` or other string-to-code primitive is used.\n * @param value The expression or literal value.\n * @param vmParam The view model (signal or plain value).\n * @param eventParam The event payload.\n * @returns Evaluated expression, `undefined` when the expression is rejected,\n * or the original value when it is a literal.\n */\n private evaluateExpression(value: unknown, vmParam?: unknown, eventParam?: unknown): unknown {\n if (typeof value !== 'string') {\n return value;\n }\n\n const hasVm = value.includes('$vm');\n const hasEvent = value.includes('$event');\n\n if (!hasVm && !hasEvent) {\n return value;\n }\n\n if ((hasVm && vmParam == null) || (hasEvent && eventParam == null)) {\n return value;\n }\n\n try {\n const viewModelInput = vmParam;\n const $vm = typeof viewModelInput === 'function' ? viewModelInput : (): unknown => viewModelInput;\n\n return evaluateSafeExpression(value, {\n $vm,\n $event: eventParam,\n $ev: eventParam\n });\n } catch {\n this.logWarning('Expression could not be evaluated safely and was ignored.');\n return undefined;\n }\n }\n\n private getViewModelValue(): unknown {\n const model = this.viewModel;\n return typeof model === 'function' ? (model as () => unknown)() : model;\n }\n\n private logWarning(message: string): void {\n if (isDevMode()) {\n console.warn(`[fg-dynamic] ${message}`);\n }\n }\n\n private logError(message: string, error?: unknown): void {\n if (!isDevMode()) {\n return;\n }\n const detail = error instanceof Error ? ` (${error.name})` : '';\n console.error(`[fg-dynamic] ${message}${detail}`);\n }\n\n /**\n * Cleans up every dynamically created resource: subscriptions, form control, value accessor directive and component reference.\n * Used both on component type change and on destroy.\n */\n private cleanup(): void {\n // Disposes the resources held by the output subscriptions.\n if (this._outputsSubscriptions) {\n this._outputsSubscriptions.forEach((s: Subscription): void => {\n try {\n s.unsubscribe();\n } catch (e) {\n // Ignore\n }\n });\n }\n\n this._outputsSubscriptions = [];\n this._currentOutputsConfig = undefined;\n\n // Disposes the resources held by the form control subscription.\n if (this._formControlSubscription) {\n try {\n this._formControlSubscription.unsubscribe();\n } catch (e) {\n // Ignore\n }\n }\n\n this._formControlSubscription = undefined;\n\n // Remove the managed control from the form group.\n if (this._formControl && this.formGroup()) {\n try {\n const attributes = this.configuration()?.attributes;\n const attributeName = attributes?.['name'];\n\n if (attributeName) {\n const controlName = this.evaluateExpression(attributeName, this.viewModel) as string;\n\n // Only remove the control if it is the one this component created, so that\n // a pre-existing control registered under the same name is left untouched.\n // Unsafe names (prototype segments) are never passed to `FormGroup`.\n if (typeof controlName === 'string' && controlName.length > 0 && this.isSafePath(controlName)) {\n const formGroup = this.formGroup();\n if (formGroup.get(controlName) === this._formControl) {\n try {\n formGroup.removeControl(controlName);\n } catch (e) {\n // Ignore\n }\n }\n }\n }\n } catch (e) {\n // Ignore\n }\n }\n\n this._formControl = undefined;\n this._managedValidatorFns = [];\n\n // A callback method that performs custom clean-up, invoked immediately before a directive, pipe, or service instance is destroyed.\n if (this._formControlDirective) {\n try {\n this._formControlDirective.ngOnDestroy();\n } catch (e) {\n // Ignore\n }\n }\n\n this._formControlDirective = undefined;\n\n // Destroys the component instance and all of the data structures associated with it.\n if (this._componentRef) {\n try {\n this._componentRef.destroy();\n } catch (e) {\n // Ignore\n }\n }\n \n this._componentRef = undefined;\n }\n\n /**\n * A callback method that performs custom clean-up, invoked immediately before a directive, pipe, or service instance is destroyed.\n */\n\tngOnDestroy(): void {\n this.cleanup();\n\t}\n}\n"],"mappings":";;;AAqBA,MAAM,oBAAoB;AAC1B,MAAM,aAAa;AACnB,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAE7B,MAAM,uCAA4C,IAAI,IAAI;CACtD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACH,CAAA;AAED,MAAM,cAAiC;CACnC;CAAO;CAAO;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAO;CAC3E;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAC7F;AAwCD,IAAa,2BAAb,cAA8C,MAAK;CAC/C,YAAY,SAAe;EACvB,MAAM,OAAO;EACb,KAAK,OAAO;CAChB;AACH;AAED,SAAS,KAAK,SAAe;CACzB,MAAM,IAAI,yBAAyB,OAAO;AAC9C;AAEA,SAAS,aAAa,OAAc,OAAa;CAC7C,OAAO,MAAM,SAAS,gBAAgB,MAAM,UAAU;AAC1D;AAEA,SAAS,aAAa,OAAc,OAAa;CAC7C,OAAO,MAAM,SAAS,gBAAgB,MAA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AA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,mBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,iBAAe;IACjF,MAAM;IACT,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAC4E,eAAa;IACtF,MAAM;IACT,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"fg-dynamic-component.mjs","names":[],"sources":["../../../projects/fg-dynamic-component/src/lib/safe-expression.ts","../../../projects/fg-dynamic-component/src/lib/fg-dynamic.component.ts"],"sourcesContent":["/**\n * Small, allowlisted expression interpreter used for the `$vm` / `$event` binding\n * feature of `FGDynamicComponent`.\n *\n * This intentionally does NOT use `eval`, `new Function`, or any other\n * string-to-code primitive. Only the following constructs are supported:\n *\n * - literals (string, number, boolean, null, undefined, NaN, Infinity)\n * - identifiers from the provided variables (`$vm`, `$event`, arrow parameters)\n * - member access: `a.b`, `a['b']`, optional chaining `a?.b`\n * - calls: `$vm()`, `$vm.update(fn)`, `$event.value`\n * - unary: `!`, `-`, `+`, `typeof`\n * - binary/logical/ternary operators\n * - array and object literals, including spread\n * - expression-bodied arrow functions (and arrow blocks containing `return`)\n *\n * Assignments, `new`, `this`, globals (e.g. `window`, `fetch`), template\n * literals and regular-expression literals are rejected. Prototype-related\n * property names are blocked at every access.\n *\n * Expressions are also treated as a capability boundary: browser host objects\n * (DOM nodes, events, `window`, `document`, storage, …) are never readable and\n * methods can only be invoked through an allowlist. This prevents an expression\n * from escaping through `$event`/`$vm` values that happen to reference the DOM.\n */\n\nconst MAX_SOURCE_LENGTH = 2000;\nconst MAX_TOKENS = 4000;\nconst MAX_PARSE_DEPTH = 80;\nconst MAX_EVALUATION_STEPS = 20000;\nconst MAX_EVALUATION_DEPTH = 80;\nconst MAX_STRING_LENGTH = 100000;\nconst MAX_REPEAT_COUNT = 10000;\n\n/**\n * A single method capability granted to expressions.\n *\n * `receiver` defaults to `'root'`, which only permits the call on the `$vm`\n * capability or on the value returned by `$vm()`. Granting a method name to\n * every reachable object (`'any'`) is only safe for fully trusted view models;\n * `on` pins the capability to one object identity.\n */\nexport interface FGDynamicAllowedMethod {\n name: string;\n receiver?: 'root' | 'any';\n on?: object;\n}\n\n/**\n * Public policy for expression evaluation.\n *\n * By default expressions are read-only and can only call native built-ins\n * (`Array.prototype.map`, `String.prototype.slice`, …) plus the callable `$vm`\n * wrapper. Custom view-model methods and `$vm.set`/`$vm.update` must be enabled\n * explicitly by the host application.\n */\nexport interface FGDynamicExpressionOptions {\n /** Allow calling any method found on a view-model value. Defaults to `false`. */\n allowCustomMethods?: boolean;\n /**\n * Methods that may be called even when `allowCustomMethods` is false.\n * String entries are root-scoped: they apply to `$vm` and the value returned\n * by `$vm()`, not to arbitrary nested objects.\n */\n allowedMethods?: readonly (string | FGDynamicAllowedMethod)[];\n}\n\n/**\n * Identifiers bound by the host that an arrow parameter must never shadow.\n * Shadowing `$vm` used to turn a parameter into a trusted direct-call target.\n */\nconst RESERVED_BINDING_NAMES: ReadonlySet<string> = new Set(['$vm', '$event', '$ev']);\n\n/** Property names that may never be read, written or used as bindings. */\nconst FORBIDDEN_PROPERTIES: ReadonlySet<string> = new Set([\n '__proto__',\n 'prototype',\n 'constructor',\n 'caller',\n 'callee',\n 'arguments',\n '__defineGetter__',\n '__defineSetter__',\n '__lookupGetter__',\n '__lookupSetter__',\n // Function capabilities that can defeat the method policy.\n 'call',\n 'apply',\n 'bind',\n // Browser globals and DOM escape hatches.\n 'window',\n 'self',\n 'globalThis',\n 'global',\n 'top',\n 'parent',\n 'frames',\n 'opener',\n 'document',\n 'ownerDocument',\n 'defaultView',\n 'contentWindow',\n 'contentDocument',\n 'location',\n 'cookie',\n 'localStorage',\n 'sessionStorage',\n 'indexedDB',\n 'navigator',\n 'history',\n 'screen',\n 'fetch',\n 'XMLHttpRequest',\n 'WebSocket',\n 'Worker',\n 'importScripts',\n 'postMessage',\n 'sendBeacon',\n 'setTimeout',\n 'setInterval',\n 'setImmediate',\n 'requestAnimationFrame',\n 'open',\n 'close',\n 'write',\n 'writeln',\n 'innerHTML',\n 'outerHTML',\n 'insertAdjacentHTML',\n 'eval',\n 'Function'\n]);\n\n/**\n * Built-in methods that are safe to invoke from an expression. Identity checks\n * are used instead of name checks, so an attacker cannot shadow `map` with a\n * custom function and have it accepted.\n */\nconst SAFE_NATIVE_METHODS: ReadonlySet<Function> = new Set<Function>([\n Array.prototype.at,\n Array.prototype.concat,\n Array.prototype.entries,\n Array.prototype.every,\n Array.prototype.filter,\n Array.prototype.find,\n Array.prototype.findIndex,\n Array.prototype.flat,\n Array.prototype.flatMap,\n Array.prototype.forEach,\n Array.prototype.includes,\n Array.prototype.indexOf,\n Array.prototype.join,\n Array.prototype.keys,\n Array.prototype.lastIndexOf,\n Array.prototype.map,\n Array.prototype.reduce,\n Array.prototype.reduceRight,\n Array.prototype.slice,\n Array.prototype.some,\n Array.prototype.toLocaleString,\n Array.prototype.toString,\n Array.prototype.values,\n String.prototype.at,\n String.prototype.charAt,\n String.prototype.charCodeAt,\n String.prototype.codePointAt,\n String.prototype.concat,\n String.prototype.endsWith,\n String.prototype.includes,\n String.prototype.indexOf,\n String.prototype.lastIndexOf,\n String.prototype.localeCompare,\n String.prototype.normalize,\n String.prototype.padEnd,\n String.prototype.padStart,\n String.prototype.repeat,\n String.prototype.replace,\n String.prototype.replaceAll,\n String.prototype.slice,\n String.prototype.split,\n String.prototype.startsWith,\n String.prototype.substring,\n String.prototype.substr,\n String.prototype.toLocaleLowerCase,\n String.prototype.toLocaleUpperCase,\n String.prototype.toLowerCase,\n String.prototype.toString,\n String.prototype.toUpperCase,\n String.prototype.trim,\n String.prototype.trimEnd,\n String.prototype.trimStart,\n String.prototype.valueOf,\n Number.prototype.toExponential,\n Number.prototype.toFixed,\n Number.prototype.toLocaleString,\n Number.prototype.toPrecision,\n Number.prototype.toString,\n Number.prototype.valueOf,\n Boolean.prototype.toString,\n Boolean.prototype.valueOf,\n BigInt.prototype.toString,\n BigInt.prototype.valueOf,\n Date.prototype.getDate,\n Date.prototype.getDay,\n Date.prototype.getFullYear,\n Date.prototype.getHours,\n Date.prototype.getMilliseconds,\n Date.prototype.getMinutes,\n Date.prototype.getMonth,\n Date.prototype.getSeconds,\n Date.prototype.getTime,\n Date.prototype.getUTCDate,\n Date.prototype.getUTCFullYear,\n Date.prototype.toISOString,\n Date.prototype.toJSON,\n Date.prototype.toLocaleDateString,\n Date.prototype.toLocaleString,\n Date.prototype.toLocaleTimeString,\n Date.prototype.toString,\n Date.prototype.valueOf,\n Object.prototype.hasOwnProperty,\n Object.prototype.isPrototypeOf,\n Object.prototype.propertyIsEnumerable,\n Object.prototype.toLocaleString,\n Object.prototype.toString,\n Object.prototype.valueOf\n]);\n\n/**\n * Native protocol hooks that may run while `join`/`concat`/`String()` coerce a\n * value. Custom implementations are rejected; built-ins such as\n * `Date.prototype.toString` are harmless.\n */\nconst SAFE_COERCION_HOOKS: ReadonlySet<Function> = new Set<Function>([\n Object.prototype.toString,\n Object.prototype.valueOf,\n Object.prototype.toLocaleString,\n Array.prototype.toString,\n Array.prototype.toLocaleString,\n Date.prototype.toString,\n Date.prototype.valueOf,\n Date.prototype.toLocaleString,\n Date.prototype.toLocaleDateString,\n Date.prototype.toLocaleTimeString,\n Date.prototype[Symbol.toPrimitive],\n Number.prototype.toString,\n Number.prototype.valueOf,\n Number.prototype.toLocaleString,\n String.prototype.toString,\n String.prototype.valueOf,\n Boolean.prototype.toString,\n Boolean.prototype.valueOf,\n BigInt.prototype.toString,\n BigInt.prototype.valueOf,\n RegExp.prototype.toString,\n Error.prototype.toString\n]);\n\nconst INTERPRETER_FUNCTIONS = new WeakSet<Function>();\n\n/**\n * Sentinel returned when an optional link short-circuits. It propagates through\n * the remaining links of the same postfix chain and becomes `undefined` at an\n * expression boundary, matching JavaScript `?.` semantics.\n */\nconst OPTIONAL_SHORT_CIRCUIT = Symbol('optional-short-circuit');\n\nfunction normalizeOptional(value: unknown): unknown {\n return value === OPTIONAL_SHORT_CIRCUIT ? undefined : value;\n}\n\n/** Native methods that invoke a user-supplied callback. */\nconst CALLBACK_NATIVE_METHODS: ReadonlySet<Function> = new Set<Function>([\n Array.prototype.every,\n Array.prototype.filter,\n Array.prototype.find,\n Array.prototype.findIndex,\n Array.prototype.flatMap,\n Array.prototype.forEach,\n Array.prototype.map,\n Array.prototype.reduce,\n Array.prototype.reduceRight,\n Array.prototype.some,\n String.prototype.replace,\n String.prototype.replaceAll\n]);\n\n/**\n * Prevents a custom function from being smuggled into a native higher-order\n * method as an argument, which would bypass the callee method policy.\n */\nfunction assertSafeCallbackArguments(fn: Function, args: readonly unknown[], options?: FGDynamicExpressionOptions): void {\n if (!CALLBACK_NATIVE_METHODS.has(fn)) {\n return;\n }\n\n for (const argument of args) {\n if (typeof argument !== 'function') {\n continue;\n }\n const argumentName = argument.name;\n if (isNativeFunction(argument) || isInterpreterFunction(argument)) {\n continue;\n }\n if (isMethodNameAllowed(argumentName, options)) {\n continue;\n }\n fail('Calling custom methods is not allowed.');\n }\n}\n\n/**\n * Prevents native methods from invoking a custom coercion hook on an element,\n * a receiver or an argument, which would bypass the method policy.\n *\n * Coercion can be triggered by `toString`/`valueOf`/`toLocaleString`, by the\n * `Symbol.toPrimitive` protocol, and (for `concat`) by\n * `Symbol.isConcatSpreadable`, so all of them are inspected. Arguments are\n * validated for every native call because most built-ins coerce at least one\n * parameter (separators, replacements, padding strings, indexes, keys, …).\n */\nfunction assertSafeCoercion(\n fn: Function,\n thisArg: unknown,\n args: readonly unknown[],\n options?: FGDynamicExpressionOptions\n): void {\n for (const argument of args) {\n assertSafeCoercionValue(argument, options, false);\n }\n\n if (fn === Array.prototype.join || fn === Array.prototype.toString) {\n forEachArrayElement(thisArg, (value: unknown): void => assertSafeCoercionValue(value, options, false));\n return;\n }\n if (fn === Array.prototype.toLocaleString) {\n forEachArrayElement(thisArg, (value: unknown): void => assertSafeCoercionValue(value, options, true));\n return;\n }\n if (fn === Object.prototype.toLocaleString) {\n assertSafeCoercionValue(thisArg, options, true);\n }\n}\n\nfunction forEachArrayElement(value: unknown, callback: (element: unknown) => void): void {\n if (value == null || typeof value !== 'object') {\n return;\n }\n\n const lengthDescriptor = Object.getOwnPropertyDescriptor(value, 'length');\n if (!lengthDescriptor || !('value' in lengthDescriptor) || typeof lengthDescriptor.value !== 'number') {\n return;\n }\n if (lengthDescriptor.value > MAX_STRING_LENGTH) {\n fail('Array coercion is too large.');\n }\n\n // Index access avoids invoking a custom iterator on an Array subclass.\n for (let index = 0; index < lengthDescriptor.value; index++) {\n const descriptor = Object.getOwnPropertyDescriptor(value, index);\n if (!descriptor) {\n continue;\n }\n if (!('value' in descriptor)) {\n fail('Access to accessor properties is not allowed.');\n }\n callback(descriptor.value);\n }\n}\n\nfunction assertSafeCoercionValue(value: unknown, options: FGDynamicExpressionOptions | undefined, locale: boolean, depth = 0): void {\n if (value == null || (typeof value !== 'object' && typeof value !== 'function')) {\n return;\n }\n if (depth > 16) {\n fail('Coercion chain is nested too deeply.');\n }\n if (Array.isArray(value)) {\n forEachArrayElement(value, (element: unknown): void => assertSafeCoercionValue(element, options, locale, depth + 1));\n return;\n }\n\n // Interpreter arrows and allowlisted built-ins stringify natively. A custom\n // host function must still be rejected below, so its source cannot leak.\n if (typeof value === 'function' && (isInterpreterFunction(value) || isNativeFunction(value))) {\n return;\n }\n\n const hooks: readonly (string | symbol)[] = locale\n ? ['toLocaleString', 'toString', 'valueOf', Symbol.toPrimitive, Symbol.isConcatSpreadable]\n : ['toString', 'valueOf', Symbol.toPrimitive, Symbol.isConcatSpreadable];\n\n for (const hookName of hooks) {\n const descriptor = findPropertyDescriptor(value, hookName);\n if (!descriptor) {\n continue;\n }\n if (!('value' in descriptor)) {\n fail('Access to accessor properties is not allowed.');\n }\n const hook = descriptor.value;\n if (typeof hook !== 'function'\n || isNativeFunction(hook)\n || isInterpreterFunction(hook)\n || SAFE_COERCION_HOOKS.has(hook)) {\n continue;\n }\n if (typeof hookName === 'string' && isMethodNameAllowed(hookName, options)) {\n continue;\n }\n fail('Calling custom methods is not allowed.');\n }\n}\n\n/** Finds an own or inherited data descriptor without reading the property. */\nfunction findPropertyDescriptor(value: object, property: PropertyKey): PropertyDescriptor | undefined {\n let current: object | null = value;\n\n while (current) {\n const descriptor = Object.getOwnPropertyDescriptor(current, property);\n if (descriptor) {\n return descriptor;\n }\n current = Object.getPrototypeOf(current);\n }\n\n return undefined;\n}\n\nconst HOST_OBJECT_TAGS: ReadonlySet<string> = new Set([\n 'Window',\n 'global',\n 'globalThis',\n 'Document',\n 'HTMLDocument',\n 'XMLDocument',\n 'DocumentFragment',\n 'DocumentType',\n 'Node',\n 'NodeList',\n 'HTMLCollection',\n 'NamedNodeMap',\n 'Element',\n 'Event',\n 'EventTarget',\n 'CustomEvent',\n 'MouseEvent',\n 'KeyboardEvent',\n 'PointerEvent',\n 'FocusEvent',\n 'InputEvent',\n 'Storage',\n 'Location',\n 'History',\n 'Navigator',\n 'Screen',\n 'XMLHttpRequest',\n 'WebSocket',\n 'Worker',\n 'MessagePort',\n 'MessageChannel',\n 'File',\n 'FileList',\n 'FileReader',\n 'Blob',\n 'FormData',\n 'URL',\n 'URLSearchParams',\n 'MutationObserver',\n 'IntersectionObserver',\n 'ResizeObserver',\n 'Performance'\n]);\n\nfunction isHostObject(value: unknown): boolean {\n if (value == null || (typeof value !== 'object' && typeof value !== 'function')) {\n return false;\n }\n\n if (value === globalThis) {\n return true;\n }\n\n try {\n const tagDescriptor = findPropertyDescriptor(value as object, Symbol.toStringTag);\n\n let tag: string;\n\n if (tagDescriptor) {\n // Never run an accessor while classifying an untrusted value.\n if (!('value' in tagDescriptor) || typeof tagDescriptor.value !== 'string') {\n return true;\n }\n tag = tagDescriptor.value;\n } else {\n // No `Symbol.toStringTag` anywhere in the prototype chain, so this\n // call cannot invoke a getter.\n tag = Object.prototype.toString.call(value).slice(8, -1);\n }\n\n if (HOST_OBJECT_TAGS.has(tag)) {\n return true;\n }\n\n // DOM element/event subclasses use tagged names such as\n // `HTMLButtonElement` or `PointerEvent`.\n if (/(?:Element|Event|Document|Node|Observer|Collection|List|Map)$/.test(tag)\n && tag !== 'Map'\n && tag !== 'WeakMap'\n && tag !== 'Set'\n && tag !== 'WeakSet') {\n return true;\n }\n } catch {\n return true;\n }\n\n return false;\n}\n\nfunction isNativeFunction(value: unknown): value is Function {\n return typeof value === 'function' && SAFE_NATIVE_METHODS.has(value);\n}\n\nfunction isInterpreterFunction(value: unknown): value is Function {\n return typeof value === 'function' && INTERPRETER_FUNCTIONS.has(value);\n}\n\nfunction assertSafeValue(value: unknown): unknown {\n if (isHostObject(value)) {\n fail('Access to host objects is not allowed.');\n }\n return value;\n}\n\nconst PUNCTUATORS: readonly string[] = [\n '===', '!==', '**', '==', '!=', '<=', '>=', '&&', '||', '??', '?.', '...', '=>',\n '+', '-', '*', '/', '%', '<', '>', '!', '?', ':', '.', ',', '(', ')', '[', ']', '{', '}', ';'\n];\n\ntype TokenType = 'number' | 'string' | 'identifier' | 'punctuator' | 'eof';\n\ninterface Token {\n type: TokenType;\n value: string;\n position: number;\n}\n\ninterface ArgumentNode {\n spread: boolean;\n value: Node;\n}\n\ninterface ObjectProperty {\n spread: boolean;\n key?: Node;\n value: Node;\n computed: boolean;\n}\n\ntype Node =\n | { type: 'Literal'; value: unknown }\n | { type: 'Identifier'; name: string }\n | { type: 'Member'; object: Node; property: Node; computed: boolean; optional: boolean }\n | { type: 'Call'; callee: Node; args: ArgumentNode[]; optional: boolean }\n | { type: 'Unary'; operator: string; argument: Node }\n | { type: 'Binary'; operator: string; left: Node; right: Node }\n | { type: 'Logical'; operator: string; left: Node; right: Node }\n | { type: 'Conditional'; test: Node; consequent: Node; alternate: Node }\n | { type: 'Array'; elements: ArgumentNode[] }\n | { type: 'Object'; properties: ObjectProperty[] }\n | { type: 'Arrow'; params: string[]; body: Node; block: boolean };\n\ninterface EvaluationState {\n steps: number;\n depth: number;\n /** The genuine `$vm` capability passed by the host, if any. */\n rootVm?: unknown;\n /** Values returned by calling the root `$vm` capability during evaluation. */\n rootVmValues: WeakSet<object>;\n}\n\nexport class FGDynamicExpressionError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'FGDynamicExpressionError';\n }\n}\n\nfunction fail(message: string): never {\n throw new FGDynamicExpressionError(message);\n}\n\nfunction isPunctuator(token: Token, value: string): boolean {\n return token.type === 'punctuator' && token.value === value;\n}\n\nfunction isIdentifier(token: Token, value: string): boolean {\n return token.type === 'identifier' && token.value === value;\n}\n\nfunction tokenize(source: string): Token[] {\n const tokens: Token[] = [];\n let index = 0;\n\n while (index < source.length) {\n const character = source[index];\n\n if (/\\s/.test(character)) {\n index++;\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n const quote = character;\n let value = '';\n let cursor = index + 1;\n let closed = false;\n\n while (cursor < source.length) {\n const current = source[cursor];\n\n if (current === quote) {\n cursor++;\n closed = true;\n break;\n }\n\n if (current === '\\\\') {\n const escaped = source[cursor + 1];\n if (escaped === undefined) {\n fail('Unterminated string literal.');\n }\n\n switch (escaped) {\n case 'n': value += '\\n'; break;\n case 'r': value += '\\r'; break;\n case 't': value += '\\t'; break;\n case 'b': value += '\\b'; break;\n case 'f': value += '\\f'; break;\n case 'v': value += '\\v'; break;\n case '0': value += '\\0'; break;\n case 'u': {\n const hex = source.slice(cursor + 2, cursor + 6);\n if (!/^[0-9a-fA-F]{4}$/.test(hex)) {\n fail('Invalid unicode escape sequence.');\n }\n value += String.fromCharCode(parseInt(hex, 16));\n cursor += 4;\n break;\n }\n default: value += escaped; break;\n }\n\n cursor += 2;\n continue;\n }\n\n value += current;\n cursor++;\n }\n\n if (!closed) {\n fail('Unterminated string literal.');\n }\n\n tokens.push({ type: 'string', value, position: index });\n index = cursor;\n continue;\n }\n\n if (/[0-9]/.test(character) || (character === '.' && /[0-9]/.test(source[index + 1] ?? ''))) {\n const match = /^(?:0[xX][0-9a-fA-F]+|(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?)/.exec(source.slice(index));\n if (!match) {\n fail('Invalid number literal.');\n }\n const raw = match[0];\n const numeric = Number(raw);\n if (!Number.isFinite(numeric)) {\n fail('Number literal is not finite.');\n }\n tokens.push({ type: 'number', value: raw, position: index });\n index += raw.length;\n continue;\n }\n\n if (/[A-Za-z_$]/.test(character)) {\n const match = /^[A-Za-z_$][A-Za-z0-9_$]*/.exec(source.slice(index));\n if (!match) {\n fail('Invalid identifier.');\n }\n tokens.push({ type: 'identifier', value: match[0], position: index });\n index += match[0].length;\n continue;\n }\n\n const punctuator = PUNCTUATORS.find((candidate: string): boolean => source.startsWith(candidate, index));\n if (!punctuator) {\n fail('Unexpected character in expression.');\n }\n\n tokens.push({ type: 'punctuator', value: punctuator, position: index });\n index += punctuator.length;\n }\n\n tokens.push({ type: 'eof', value: '', position: source.length });\n\n if (tokens.length > MAX_TOKENS) {\n fail('Expression is too complex.');\n }\n\n return tokens;\n}\n\nclass ExpressionParser {\n private index = 0;\n private depth = 0;\n private readonly tokens: Token[];\n\n constructor(tokens: Token[]) {\n this.tokens = tokens;\n }\n\n parse(): Node {\n const expression = this.parseExpression();\n if (this.current().type !== 'eof') {\n fail('Unexpected token after expression.');\n }\n return expression;\n }\n\n private current(): Token {\n return this.tokens[this.index];\n }\n\n private peek(offset = 1): Token | undefined {\n return this.tokens[this.index + offset];\n }\n\n private advance(): Token {\n const token = this.tokens[this.index];\n if (token.type !== 'eof') {\n this.index++;\n }\n return token;\n }\n\n private matchPunctuator(value: string): boolean {\n if (isPunctuator(this.current(), value)) {\n this.advance();\n return true;\n }\n return false;\n }\n\n private expectPunctuator(value: string): void {\n if (!this.matchPunctuator(value)) {\n fail(`Expected \"${value}\".`);\n }\n }\n\n private enter(): void {\n this.depth++;\n if (this.depth > MAX_PARSE_DEPTH) {\n fail('Expression is nested too deeply.');\n }\n }\n\n private leave(): void {\n this.depth--;\n }\n\n private parseExpression(): Node {\n this.enter();\n try {\n return this.parseAssignment();\n } finally {\n this.leave();\n }\n }\n\n private parseAssignment(): Node {\n if (this.isArrowStart()) {\n return this.parseArrow();\n }\n return this.parseConditional();\n }\n\n private isArrowStart(): boolean {\n const token = this.current();\n\n if (token.type === 'identifier' && this.peek()?.value === '=>') {\n return true;\n }\n\n if (!isPunctuator(token, '(')) {\n return false;\n }\n\n let nesting = 0;\n for (let cursor = this.index; cursor < this.tokens.length; cursor++) {\n const candidate = this.tokens[cursor];\n if (candidate.type !== 'punctuator') {\n continue;\n }\n if (candidate.value === '(') {\n nesting++;\n } else if (candidate.value === ')') {\n nesting--;\n if (nesting === 0) {\n return this.tokens[cursor + 1]?.value === '=>';\n }\n }\n }\n\n return false;\n }\n\n private parseArrow(): Node {\n const params: string[] = [];\n\n if (this.current().type === 'identifier') {\n const parameter = this.advance().value;\n if (FORBIDDEN_PROPERTIES.has(parameter) || RESERVED_BINDING_NAMES.has(parameter)) {\n fail('Forbidden arrow function parameter name.');\n }\n params.push(parameter);\n } else {\n this.expectPunctuator('(');\n if (!isPunctuator(this.current(), ')')) {\n do {\n if (isPunctuator(this.current(), ')')) {\n break;\n }\n const parameter = this.advance();\n if (parameter.type !== 'identifier') {\n fail('Arrow function parameters must be identifiers.');\n }\n if (FORBIDDEN_PROPERTIES.has(parameter.value) || RESERVED_BINDING_NAMES.has(parameter.value)) {\n fail('Forbidden arrow function parameter name.');\n }\n params.push(parameter.value);\n } while (this.matchPunctuator(','));\n }\n this.expectPunctuator(')');\n }\n\n this.expectPunctuator('=>');\n\n if (this.matchPunctuator('{')) {\n while (this.matchPunctuator(';')) {\n // Skip empty statements.\n }\n\n if (!isIdentifier(this.current(), 'return')) {\n fail('Arrow function blocks must contain a return statement.');\n }\n\n this.advance();\n const value = this.parseExpression();\n this.matchPunctuator(';');\n this.expectPunctuator('}');\n return { type: 'Arrow', params, body: value, block: true };\n }\n\n return { type: 'Arrow', params, body: this.parseExpression(), block: false };\n }\n\n private parseConditional(): Node {\n const test = this.parseNullish();\n\n if (this.matchPunctuator('?')) {\n const consequent = this.parseAssignment();\n this.expectPunctuator(':');\n const alternate = this.parseAssignment();\n return { type: 'Conditional', test, consequent, alternate };\n }\n\n return test;\n }\n\n private parseNullish(): Node {\n let left = this.parseLogicalOr();\n while (this.matchPunctuator('??')) {\n const right = this.parseLogicalOr();\n left = { type: 'Logical', operator: '??', left, right };\n }\n return left;\n }\n\n private parseLogicalOr(): Node {\n let left = this.parseLogicalAnd();\n while (this.matchPunctuator('||')) {\n const right = this.parseLogicalAnd();\n left = { type: 'Logical', operator: '||', left, right };\n }\n return left;\n }\n\n private parseLogicalAnd(): Node {\n let left = this.parseEquality();\n while (this.matchPunctuator('&&')) {\n const right = this.parseEquality();\n left = { type: 'Logical', operator: '&&', left, right };\n }\n return left;\n }\n\n private parseEquality(): Node {\n let left = this.parseRelational();\n while (\n isPunctuator(this.current(), '===') ||\n isPunctuator(this.current(), '!==') ||\n isPunctuator(this.current(), '==') ||\n isPunctuator(this.current(), '!=')\n ) {\n const operator = this.advance().value;\n const right = this.parseRelational();\n left = { type: 'Binary', operator, left, right };\n }\n return left;\n }\n\n private parseRelational(): Node {\n let left = this.parseAdditive();\n while (\n isPunctuator(this.current(), '<') ||\n isPunctuator(this.current(), '>') ||\n isPunctuator(this.current(), '<=') ||\n isPunctuator(this.current(), '>=')\n ) {\n const operator = this.advance().value;\n const right = this.parseAdditive();\n left = { type: 'Binary', operator, left, right };\n }\n return left;\n }\n\n private parseAdditive(): Node {\n let left = this.parseMultiplicative();\n while (isPunctuator(this.current(), '+') || isPunctuator(this.current(), '-')) {\n const operator = this.advance().value;\n const right = this.parseMultiplicative();\n left = { type: 'Binary', operator, left, right };\n }\n return left;\n }\n\n private parseMultiplicative(): Node {\n let left = this.parseExponent();\n while (\n isPunctuator(this.current(), '*') ||\n isPunctuator(this.current(), '/') ||\n isPunctuator(this.current(), '%')\n ) {\n const operator = this.advance().value;\n const right = this.parseExponent();\n left = { type: 'Binary', operator, left, right };\n }\n return left;\n }\n\n private parseExponent(): Node {\n const left = this.parseUnary();\n if (this.matchPunctuator('**')) {\n this.enter();\n try {\n const right = this.parseExponent();\n return { type: 'Binary', operator: '**', left, right };\n } finally {\n this.leave();\n }\n }\n return left;\n }\n\n private parseUnary(): Node {\n if (\n isPunctuator(this.current(), '!') ||\n isPunctuator(this.current(), '-') ||\n isPunctuator(this.current(), '+')\n ) {\n this.enter();\n try {\n const operator = this.advance().value;\n return { type: 'Unary', operator, argument: this.parseUnary() };\n } finally {\n this.leave();\n }\n }\n\n if (isIdentifier(this.current(), 'typeof')) {\n this.enter();\n try {\n this.advance();\n return { type: 'Unary', operator: 'typeof', argument: this.parseUnary() };\n } finally {\n this.leave();\n }\n }\n\n return this.parsePostfix();\n }\n\n private parsePostfix(): Node {\n let node = this.parsePrimary();\n\n for (;;) {\n if (this.matchPunctuator('.')) {\n const property = this.advance();\n if (property.type !== 'identifier') {\n fail('Expected a property name.');\n }\n node = {\n type: 'Member',\n object: node,\n property: { type: 'Literal', value: property.value },\n computed: false,\n optional: false\n };\n continue;\n }\n\n if (this.matchPunctuator('?.')) {\n if (this.matchPunctuator('(')) {\n node = { type: 'Call', callee: node, args: this.parseArguments(), optional: true };\n } else if (this.matchPunctuator('[')) {\n const property = this.parseExpression();\n this.expectPunctuator(']');\n node = { type: 'Member', object: node, property, computed: true, optional: true };\n } else {\n const property = this.advance();\n if (property.type !== 'identifier') {\n fail('Expected a property name.');\n }\n node = {\n type: 'Member',\n object: node,\n property: { type: 'Literal', value: property.value },\n computed: false,\n optional: true\n };\n }\n continue;\n }\n\n if (this.matchPunctuator('[')) {\n const property = this.parseExpression();\n this.expectPunctuator(']');\n node = { type: 'Member', object: node, property, computed: true, optional: false };\n continue;\n }\n\n if (this.matchPunctuator('(')) {\n node = { type: 'Call', callee: node, args: this.parseArguments(), optional: false };\n continue;\n }\n\n break;\n }\n\n return node;\n }\n\n private parseArguments(): ArgumentNode[] {\n this.enter();\n try {\n const args: ArgumentNode[] = [];\n\n if (!isPunctuator(this.current(), ')')) {\n do {\n if (isPunctuator(this.current(), ')')) {\n break;\n }\n const spread = this.matchPunctuator('...');\n args.push({ spread, value: this.parseAssignment() });\n } while (this.matchPunctuator(','));\n }\n\n this.expectPunctuator(')');\n return args;\n } finally {\n this.leave();\n }\n }\n\n private parsePrimary(): Node {\n const token = this.current();\n\n if (token.type === 'number') {\n this.advance();\n return { type: 'Literal', value: Number(token.value) };\n }\n\n if (token.type === 'string') {\n this.advance();\n return { type: 'Literal', value: token.value };\n }\n\n if (token.type === 'identifier') {\n this.advance();\n switch (token.value) {\n case 'true': return { type: 'Literal', value: true };\n case 'false': return { type: 'Literal', value: false };\n case 'null': return { type: 'Literal', value: null };\n case 'undefined': return { type: 'Literal', value: undefined };\n case 'NaN': return { type: 'Literal', value: NaN };\n case 'Infinity': return { type: 'Literal', value: Infinity };\n default: return { type: 'Identifier', name: token.value };\n }\n }\n\n if (this.matchPunctuator('(')) {\n const expression = this.parseExpression();\n this.expectPunctuator(')');\n return expression;\n }\n\n if (this.matchPunctuator('[')) {\n return this.parseArray();\n }\n\n if (this.matchPunctuator('{')) {\n return this.parseObject();\n }\n\n return fail('Unexpected token in expression.');\n }\n\n private parseArray(): Node {\n this.enter();\n try {\n const elements: ArgumentNode[] = [];\n\n if (!isPunctuator(this.current(), ']')) {\n do {\n if (isPunctuator(this.current(), ']')) {\n break;\n }\n const spread = this.matchPunctuator('...');\n elements.push({ spread, value: this.parseAssignment() });\n } while (this.matchPunctuator(','));\n }\n\n this.expectPunctuator(']');\n return { type: 'Array', elements };\n } finally {\n this.leave();\n }\n }\n\n private parseObject(): Node {\n this.enter();\n try {\n const properties: ObjectProperty[] = [];\n\n if (!isPunctuator(this.current(), '}')) {\n do {\n if (isPunctuator(this.current(), '}')) {\n break;\n }\n\n if (this.matchPunctuator('...')) {\n properties.push({ spread: true, value: this.parseAssignment(), computed: false });\n continue;\n }\n\n let key: Node;\n let computed = false;\n\n if (this.matchPunctuator('[')) {\n key = this.parseExpression();\n this.expectPunctuator(']');\n computed = true;\n } else {\n const keyToken = this.advance();\n if (keyToken.type === 'identifier' || keyToken.type === 'string') {\n key = { type: 'Literal', value: keyToken.value };\n } else if (keyToken.type === 'number') {\n key = { type: 'Literal', value: String(Number(keyToken.value)) };\n } else {\n return fail('Invalid object key.');\n }\n }\n\n this.expectPunctuator(':');\n const value = this.parseAssignment();\n properties.push({ spread: false, key, value, computed });\n } while (this.matchPunctuator(','));\n }\n\n this.expectPunctuator('}');\n return { type: 'Object', properties };\n } finally {\n this.leave();\n }\n }\n}\n\nfunction assertSafeProperty(property: string): void {\n if (FORBIDDEN_PROPERTIES.has(property)) {\n fail('Access to a forbidden property was blocked.');\n }\n}\n\n/** Name-only check used for coercion and callback hooks, independent of receiver. */\nfunction isMethodNameAllowed(name: string, options?: FGDynamicExpressionOptions): boolean {\n if (options?.allowCustomMethods === true) {\n return true;\n }\n if (!Array.isArray(options?.allowedMethods)) {\n return false;\n }\n return options!.allowedMethods!.some((entry): boolean =>\n typeof entry === 'string' ? entry === name : entry?.name === name\n );\n}\n\n/** True when the receiver is the host `$vm` capability or a value it returned. */\nfunction isRootReceiver(receiver: unknown, state: EvaluationState): boolean {\n if (receiver == null || (typeof receiver !== 'object' && typeof receiver !== 'function')) {\n return false;\n }\n if (receiver === state.rootVm) {\n return true;\n }\n return state.rootVmValues.has(receiver as object);\n}\n\n/**\n * Receiver-aware capability check. Unscoped string entries only apply to the\n * root `$vm` capability; `{ receiver: 'any' }` and `{ on }` opt into broader\n * grants explicitly.\n */\nfunction isMethodAllowedForReceiver(\n name: string,\n receiver: unknown,\n state: EvaluationState,\n options?: FGDynamicExpressionOptions\n): boolean {\n if (options?.allowCustomMethods === true) {\n return true;\n }\n if (!Array.isArray(options?.allowedMethods)) {\n return false;\n }\n\n for (const entry of options!.allowedMethods!) {\n if (typeof entry === 'string') {\n if (entry === name && isRootReceiver(receiver, state)) {\n return true;\n }\n continue;\n }\n if (entry == null || entry.name !== name) {\n continue;\n }\n if (entry.on !== undefined) {\n if (receiver === entry.on) {\n return true;\n }\n continue;\n }\n if ((entry.receiver ?? 'root') === 'any' || isRootReceiver(receiver, state)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction defineSafeProperty(target: Record<string, unknown>, key: string, value: unknown): void {\n assertSafeProperty(key);\n Object.defineProperty(target, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n}\n\nfunction readMember(target: unknown, key: unknown, optional: boolean, state: EvaluationState, options?: FGDynamicExpressionOptions): unknown {\n if (target === OPTIONAL_SHORT_CIRCUIT) {\n return target;\n }\n\n if (typeof key !== 'string' && typeof key !== 'number') {\n fail('Property keys must be strings or numbers.');\n }\n\n const property = String(key);\n assertSafeProperty(property);\n\n if (target == null) {\n if (optional) {\n return OPTIONAL_SHORT_CIRCUIT;\n }\n fail('Cannot read properties of null or undefined.');\n }\n\n // Reject DOM/browser host objects before any property access or getter runs.\n if (isHostObject(target)) {\n fail('Access to host objects is not allowed.');\n }\n\n const object = Object(target) as Record<string, unknown>;\n const descriptor = Object.getOwnPropertyDescriptor(object, property);\n\n if (descriptor) {\n if (!('value' in descriptor)) {\n // Accessor properties can execute arbitrary code.\n fail('Access to accessor properties is not allowed.');\n }\n const value = descriptor.value;\n if (typeof value === 'function'\n && !isNativeFunction(value)\n && !isInterpreterFunction(value)\n && !isMethodAllowedForReceiver(property, target, state, options)) {\n fail('Access to custom methods is not allowed.');\n }\n return assertSafeValue(value);\n }\n\n // Inherited properties are only readable for explicitly safe methods, so\n // class instances cannot leak services through their prototype chain.\n let prototype = Object.getPrototypeOf(object);\n while (prototype) {\n const inheritedDescriptor = Object.getOwnPropertyDescriptor(prototype, property);\n if (inheritedDescriptor) {\n if (!('value' in inheritedDescriptor)) {\n fail('Access to inherited accessor properties is not allowed.');\n }\n const inherited = inheritedDescriptor.value;\n if (typeof inherited === 'function') {\n if (isNativeFunction(inherited) || isInterpreterFunction(inherited) || isMethodAllowedForReceiver(property, target, state, options)) {\n return inherited;\n }\n fail('Access to custom methods is not allowed.');\n }\n fail('Access to inherited properties is not allowed.');\n }\n prototype = Object.getPrototypeOf(prototype);\n }\n\n return undefined;\n}\n\nfunction spreadValues(value: unknown): unknown[] {\n if (Array.isArray(value)) {\n // Descriptor iteration avoids invoking an overridden `slice` on an\n // Array subclass supplied by the view model.\n const values: unknown[] = [];\n forEachArrayElement(value, (element: unknown): void => {\n values.push(element);\n });\n return values;\n }\n if (typeof value === 'string') {\n if (value.length > MAX_STRING_LENGTH) {\n fail('Spread value is too large.');\n }\n return value.split('');\n }\n return fail('Spread is only supported for arrays and strings.');\n}\n\nfunction isPrimitive(value: unknown): boolean {\n return value == null || typeof value === 'string' || typeof value === 'number' ||\n typeof value === 'boolean' || typeof value === 'bigint';\n}\n\nfunction primitiveAdd(left: unknown, right: unknown): unknown {\n if (!isPrimitive(left) || !isPrimitive(right)) {\n fail('Arithmetic on objects is not allowed.');\n }\n return (left as number) + (right as number);\n}\n\nfunction numericOperation(operator: string, left: unknown, right: unknown): number {\n if (typeof left !== 'number' || typeof right !== 'number') {\n fail(`Operator \"${operator}\" only supports numbers.`);\n }\n\n switch (operator) {\n case '-': return left - right;\n case '*': return left * right;\n case '/': return left / right;\n case '%': return left % right;\n case '**': return left ** right;\n default: return fail(`Unsupported arithmetic operator \"${operator}\".`);\n }\n}\n\nfunction looseEquals(left: unknown, right: unknown): boolean {\n if (!isPrimitive(left) || !isPrimitive(right)) {\n fail('Loose equality is only supported for primitive values.');\n }\n return left == right;\n}\n\nfunction compareValues(operator: string, left: unknown, right: unknown): boolean {\n if (!isPrimitive(left) || !isPrimitive(right)) {\n fail('Comparison is only supported for primitive values.');\n }\n\n switch (operator) {\n case '<': return (left as number) < (right as number);\n case '>': return (left as number) > (right as number);\n case '<=': return (left as number) <= (right as number);\n case '>=': return (left as number) >= (right as number);\n default: return fail(`Unsupported comparison operator \"${operator}\".`);\n }\n}\n\nfunction evaluateNode(node: Node, environment: Map<string, unknown>, state: EvaluationState, options?: FGDynamicExpressionOptions): unknown {\n state.steps++;\n state.depth++;\n\n if (state.steps > MAX_EVALUATION_STEPS) {\n state.depth--;\n return fail('Expression is too complex.');\n }\n if (state.depth > MAX_EVALUATION_DEPTH) {\n state.depth--;\n return fail('Expression is nested too deeply.');\n }\n\n try {\n switch (node.type) {\n case 'Literal':\n return node.value;\n\n case 'Identifier': {\n if (!environment.has(node.name)) {\n return fail(`Unknown identifier \"${node.name}\".`);\n }\n return assertSafeValue(environment.get(node.name));\n }\n\n case 'Member': {\n const object = evaluateNode(node.object, environment, state, options);\n if (object === OPTIONAL_SHORT_CIRCUIT) {\n return object;\n }\n const key = normalizeOptional(evaluateNode(node.property, environment, state, options));\n return readMember(object, key, node.optional, state, options);\n }\n\n case 'Call': {\n let fn: unknown;\n let thisArg: unknown;\n let methodName: string | undefined;\n\n if (node.callee.type === 'Member') {\n const object = evaluateNode(node.callee.object, environment, state, options);\n if (object === OPTIONAL_SHORT_CIRCUIT) {\n return object;\n }\n const key = normalizeOptional(evaluateNode(node.callee.property, environment, state, options));\n fn = readMember(object, key, node.callee.optional, state, options);\n thisArg = object;\n methodName = String(key);\n } else {\n fn = evaluateNode(node.callee, environment, state, options);\n if (fn === OPTIONAL_SHORT_CIRCUIT) {\n return fn;\n }\n }\n\n if (fn === OPTIONAL_SHORT_CIRCUIT) {\n return fn;\n }\n if (fn == null) {\n if (node.optional) {\n return OPTIONAL_SHORT_CIRCUIT;\n }\n return fail('Attempted to call a non-function value.');\n }\n if (typeof fn !== 'function') {\n if (node.optional) {\n return OPTIONAL_SHORT_CIRCUIT;\n }\n return fail('Attempted to call a non-function value.');\n }\n if (fn === Function || fn === eval) {\n return fail('Calling global constructors is not allowed.');\n }\n\n // Direct calls (`$vm()`, interpreter arrows) use host-provided\n // capabilities. Member calls must be native built-ins,\n // interpreter-created arrows, or explicitly allowed methods.\n if (node.callee.type === 'Member') {\n if (!isNativeFunction(fn)\n && !isInterpreterFunction(fn)\n && !isMethodAllowedForReceiver(methodName ?? '', thisArg, state, options)) {\n return fail('Calling custom methods is not allowed.');\n }\n } else {\n // Only the genuine `$vm` capability may be called directly.\n // A same-named arrow parameter must never unlock this path.\n const isVmCall = node.callee.type === 'Identifier'\n && node.callee.name === '$vm'\n && fn === state.rootVm;\n if (!isVmCall && !isInterpreterFunction(fn)) {\n return fail('Calling custom functions is not allowed.');\n }\n }\n\n const args: unknown[] = [];\n for (const argument of node.args) {\n const value = normalizeOptional(evaluateNode(argument.value, environment, state, options));\n if (argument.spread) {\n args.push(...spreadValues(value));\n } else {\n args.push(value);\n }\n }\n\n // Native higher-order methods and coercing methods must not\n // launder custom functions past the callee policy.\n assertSafeCallbackArguments(fn, args, options);\n assertSafeCoercion(fn, thisArg, args, options);\n\n // Bound native string builders before they allocate.\n if (fn === String.prototype.repeat) {\n const count = args[0];\n const source = String(thisArg ?? '');\n if (typeof count !== 'number' || !Number.isFinite(count) || count < 0\n || count > MAX_REPEAT_COUNT || source.length * count > MAX_STRING_LENGTH) {\n return fail('String repetition is too large.');\n }\n }\n if ((fn === String.prototype.padStart || fn === String.prototype.padEnd)) {\n const targetLength = args[0];\n if (typeof targetLength === 'number' && targetLength > MAX_STRING_LENGTH) {\n return fail('String padding is too large.');\n }\n }\n if (fn === String.prototype.replace || fn === String.prototype.replaceAll) {\n const search = args[0];\n const replacement = args[1];\n if (typeof search === 'string' && typeof replacement === 'string' && typeof thisArg === 'string') {\n const sourceLength = thisArg.length;\n const matchCount = search.length === 0\n ? (fn === String.prototype.replaceAll ? sourceLength + 1 : 1)\n : Math.floor(sourceLength / search.length);\n const growthPerMatch = replacement.length - search.length;\n\n if (growthPerMatch > 0 && sourceLength + matchCount * growthPerMatch > MAX_STRING_LENGTH) {\n return fail('String replacement is too large.');\n }\n }\n }\n if (fn === Array.prototype.join && Array.isArray(thisArg)) {\n const separator = args[0];\n if (separator === undefined || typeof separator === 'string') {\n const separatorLength = typeof separator === 'string' ? separator.length : 1;\n let totalLength = Math.max(0, thisArg.length - 1) * separatorLength;\n\n for (let index = 0; index < thisArg.length; index++) {\n const element = thisArg[index];\n if (element == null) {\n continue;\n }\n if (typeof element === 'string' || typeof element === 'number'\n || typeof element === 'boolean' || typeof element === 'bigint') {\n totalLength += String(element).length;\n } else {\n // Object coercion is checked separately and its size\n // cannot be bounded without invoking the hook.\n totalLength = -1;\n break;\n }\n if (totalLength > MAX_STRING_LENGTH) {\n return fail('Array join is too large.');\n }\n }\n\n if (totalLength > MAX_STRING_LENGTH) {\n return fail('Array join is too large.');\n }\n }\n }\n\n const result = (fn as (...args: unknown[]) => unknown).apply(thisArg, args);\n\n // Track view-model values produced by the genuine `$vm`\n // capability so root-scoped method grants work even when the\n // wrapper returns a fresh object on every call.\n if (fn === state.rootVm && result !== null\n && (typeof result === 'object' || typeof result === 'function')) {\n state.rootVmValues.add(result as object);\n }\n\n if (typeof result === 'string' && result.length > MAX_STRING_LENGTH) {\n return fail('Expression result is too large.');\n }\n\n return assertSafeValue(result);\n }\n\n case 'Unary': {\n const argument = normalizeOptional(evaluateNode(node.argument, environment, state, options));\n switch (node.operator) {\n case '!': return !argument;\n case 'typeof': return typeof argument;\n case '-':\n if (typeof argument !== 'number' && typeof argument !== 'bigint') {\n return fail('Unary \"-\" only supports numbers.');\n }\n return -argument;\n case '+':\n if (typeof argument !== 'number') {\n return fail('Unary \"+\" only supports numbers.');\n }\n return +argument;\n default:\n return fail(`Unsupported unary operator \"${node.operator}\".`);\n }\n }\n\n case 'Binary': {\n const left = normalizeOptional(evaluateNode(node.left, environment, state, options));\n const right = normalizeOptional(evaluateNode(node.right, environment, state, options));\n\n switch (node.operator) {\n case '===': return left === right;\n case '!==': return left !== right;\n case '==': return looseEquals(left, right);\n case '!=': return !looseEquals(left, right);\n case '+': return primitiveAdd(left, right);\n case '-':\n case '*':\n case '/':\n case '%':\n case '**':\n return numericOperation(node.operator, left, right);\n case '<':\n case '>':\n case '<=':\n case '>=':\n return compareValues(node.operator, left, right);\n default:\n return fail(`Unsupported binary operator \"${node.operator}\".`);\n }\n }\n\n case 'Logical': {\n const left = normalizeOptional(evaluateNode(node.left, environment, state, options));\n switch (node.operator) {\n case '&&': return left ? evaluateNode(node.right, environment, state, options) : left;\n case '||': return left ? left : evaluateNode(node.right, environment, state, options);\n case '??': return left == null ? evaluateNode(node.right, environment, state, options) : left;\n default: return fail(`Unsupported logical operator \"${node.operator}\".`);\n }\n }\n\n case 'Conditional': {\n const test = normalizeOptional(evaluateNode(node.test, environment, state, options));\n return test\n ? evaluateNode(node.consequent, environment, state, options)\n : evaluateNode(node.alternate, environment, state, options);\n }\n\n case 'Array': {\n const values: unknown[] = [];\n for (const element of node.elements) {\n const value = normalizeOptional(evaluateNode(element.value, environment, state, options));\n if (element.spread) {\n values.push(...spreadValues(value));\n } else {\n values.push(value);\n }\n }\n return values;\n }\n\n case 'Object': {\n const result: Record<string, unknown> = {};\n for (const property of node.properties) {\n if (property.spread) {\n const source = normalizeOptional(evaluateNode(property.value, environment, state, options));\n if (source == null || typeof source !== 'object') {\n return fail('Object spread is only supported for objects.');\n }\n for (const key of Object.keys(source)) {\n const descriptor = Object.getOwnPropertyDescriptor(source, key);\n if (descriptor && 'value' in descriptor) {\n defineSafeProperty(result, key, descriptor.value);\n }\n }\n continue;\n }\n\n if (!property.key) {\n return fail('Invalid object property.');\n }\n\n const key = property.computed\n ? normalizeOptional(evaluateNode(property.key, environment, state, options))\n : (property.key as { type: 'Literal'; value: unknown }).value;\n\n if (typeof key !== 'string' && typeof key !== 'number') {\n return fail('Object keys must be strings or numbers.');\n }\n\n defineSafeProperty(result, String(key), normalizeOptional(evaluateNode(property.value, environment, state, options)));\n }\n return result;\n }\n\n case 'Arrow': {\n const params = node.params;\n const body = node.body;\n const closure = new Map(environment);\n\n const arrowFunction = function evaluateArrowFunction(...args: unknown[]): unknown {\n const local = new Map(closure);\n params.forEach((parameter: string, index: number): void => {\n local.set(parameter, args[index]);\n });\n return normalizeOptional(evaluateNode(body, local, state, options));\n };\n\n INTERPRETER_FUNCTIONS.add(arrowFunction);\n return arrowFunction;\n }\n\n default:\n return fail('Unsupported expression node.');\n }\n } finally {\n state.depth--;\n }\n}\n\n/**\n * Evaluates a configuration expression without ever compiling it as JavaScript.\n *\n * Only the identifiers provided in `variables` are visible. Any unsupported\n * construct throws an `FGDynamicExpressionError`; callers should treat that as\n * an invalid expression and fall back to the literal value.\n *\n * `options` controls whether custom view-model methods may be invoked. Native\n * built-ins are always available; host objects are never accessible.\n */\nexport function evaluateSafeExpression(\n source: string,\n variables: Record<string, unknown> = {},\n options?: FGDynamicExpressionOptions\n): unknown {\n if (typeof source !== 'string') {\n fail('Expression must be a string.');\n }\n if (source.length === 0) {\n fail('Expression is empty.');\n }\n if (source.length > MAX_SOURCE_LENGTH) {\n fail('Expression is too long.');\n }\n\n const parser = new ExpressionParser(tokenize(source));\n const ast = parser.parse();\n const environment = new Map<string, unknown>();\n\n for (const [key, value] of Object.entries(variables)) {\n environment.set(key, value);\n }\n\n const state: EvaluationState = {\n steps: 0,\n depth: 0,\n rootVm: variables['$vm'],\n rootVmValues: new WeakSet<object>()\n };\n\n return assertSafeValue(normalizeOptional(evaluateNode(ast, environment, state, options)));\n}\n","import { ChangeDetectionStrategy, Component, ComponentRef, ElementRef, Injector, InputSignal, ModelSignal, OnChanges, OnDestroy, Renderer2, Signal, SimpleChanges, Type, ViewContainerRef, computed, inject, input, isDevMode, model, viewChild, viewChildren } from '@angular/core';\nimport { AbstractControl, ControlValueAccessor, FormControl, FormControlDirective, FormGroup, NG_VALUE_ACCESSOR, NgControl, ValidationErrors, ValidatorFn, Validators } from '@angular/forms';\nimport { Subscription } from 'rxjs';\nimport { evaluateSafeExpression, type FGDynamicAllowedMethod } from './safe-expression';\n\nexport type { FGDynamicAllowedMethod } from './safe-expression';\n\n/** Distinguishes a missing view-model path from a stored `null`/`undefined`. */\nconst MISSING_FORM_VALUE = Symbol('missing-form-value');\n\n/** Matches `$vm`, `$event` and the `$ev` alias as identifiers, not substrings. */\nconst EXPRESSION_CONTEXT_PATTERN = /\\$(?:vm|event|ev)\\b/;\nconst VM_EXPRESSION_PATTERN = /\\$vm\\b/;\nconst EVENT_EXPRESSION_PATTERN = /\\$(?:event|ev)\\b/;\n\nexport type FGDynamicType = Type<unknown> | Promise<Type<unknown>> | (() => Promise<Type<unknown>>);\n\nexport interface IFGDynamicItem {\n type?: string | FGDynamicType;\n inputs?: Record<string, unknown>;\n outputs?: Record<string, string | Function>;\n attributes?: Record<string, unknown>;\n items?: IFGDynamicItem[];\n}\n\n/**\n * Controls what expressions may do. By default expressions are read-only and\n * can only call native built-ins and `$vm()`; custom view-model methods and\n * view-model mutation require an explicit opt-in.\n */\nexport interface IFGDynamicExpressionPolicy {\n /** Allow calling any method reachable from the view model. Defaults to `false`. */\n allowCustomMethods?: boolean;\n /**\n * Methods that may be called when `allowCustomMethods` is `false`.\n * String entries are scoped to `$vm` and the value returned by `$vm()`;\n * use `{ name, receiver: 'any' }` or `{ name, on }` to grant a nested method.\n */\n allowedMethods?: readonly (string | FGDynamicAllowedMethod)[];\n /** Expose `$vm.set` and `$vm.update`. Defaults to `false`. */\n allowViewModelMutation?: boolean;\n}\n\n/**\n * Controls how the dynamic component interacts with the host `FormGroup`.\n * By default pre-existing controls and nested groups are not reused.\n */\nexport interface IFGDynamicFormPolicy {\n /** Reuse controls/groups that already exist in the supplied `FormGroup`. */\n allowExistingControls?: boolean;\n /** Optional allowlist of form control names (the evaluated `attributes.name`). */\n allowedControlNames?: readonly string[];\n}\n\n/**\n * Controls which component `type` values are accepted.\n * Promise/loader values are rejected unless explicitly enabled.\n */\nexport interface IFGDynamicTypePolicy {\n /** Allow promise-returning and function loader `type` values. Defaults to `false`. */\n allowFunctionTypes?: boolean;\n /** Require an explicit scoped registry instead of the global default. */\n requireScopedRegistry?: boolean;\n}\n\n/**\n * Controls which DOM attributes may be applied. `strict` is intended for\n * untrusted configurations and disables UI-redress/DOM-clobbering attributes.\n */\nexport interface IFGDynamicAttributePolicy {\n /** Disallow `id`, `class`, `for`, `href` and `src`. Defaults to `false`. */\n strict?: boolean;\n /**\n * Allow `href`/`src` to point at other origins (including protocol-relative\n * URLs). Defaults to `false`: relative and same-origin URLs only, so an\n * untrusted configuration cannot exfiltrate view-model data by rendering a\n * request to an attacker-controlled host.\n */\n allowExternalUrls?: boolean;\n}\n\nconst FORBIDDEN_PATH_SEGMENTS: ReadonlySet<string> = new Set(['__proto__', 'prototype', 'constructor']);\nconst MAX_PATH_DEPTH = 32;\nconst MAX_PATH_SEGMENT_LENGTH = 128;\nconst MAX_CONFIGURATION_ITEMS = 1000;\nconst MAX_CONFIGURATION_DEPTH = 32;\nconst MAX_TOTAL_CONFIGURATION_NODES = 2000;\nconst MAX_CONFIGURATION_KEYS = 100;\nconst MAX_CONFIGURATION_KEY_LENGTH = 128;\nconst MAX_ATTRIBUTE_NAME_LENGTH = 128;\nconst MAX_ATTRIBUTE_VALUE_LENGTH = 8192;\nconst MAX_PATTERN_LENGTH = 512;\nconst MAX_PATTERN_INPUT_LENGTH = 1024;\n\nconst ALLOWED_ATTRIBUTES: ReadonlySet<string> = new Set([\n 'class', 'id', 'name', 'role', 'title', 'tabindex', 'hidden', 'dir', 'lang',\n 'disabled', 'readonly', 'required', 'placeholder', 'autocomplete', 'spellcheck',\n 'min', 'max', 'minlength', 'maxlength', 'pattern', 'email', 'step',\n 'multiple', 'checked', 'selected', 'for', 'href', 'src'\n]);\n\nconst URL_ATTRIBUTES: ReadonlySet<string> = new Set(['href', 'src']);\n\n/** Attributes disabled by `attributePolicy.strict` for untrusted configurations. */\nconst STRICT_DISALLOWED_ATTRIBUTES: ReadonlySet<string> = new Set(['id', 'class', 'for', 'href', 'src']);\n\n/**\n * HTML boolean attributes: presence means `true`, so a false/absent value must\n * remove the attribute instead of writing `\"false\"`.\n */\nconst BOOLEAN_ATTRIBUTES: ReadonlySet<string> = new Set([\n 'hidden', 'disabled', 'readonly', 'required', 'checked', 'selected', 'multiple'\n]);\n\n/**\n * A scoped component registry. Backed by a `Map`, so lookups never walk the\n * prototype chain and names such as `__proto__` or `constructor` are ordinary keys.\n *\n * Use one registry per rendering context (e.g. per plugin or tenant) so a\n * configuration can only select components that were explicitly registered for\n * that context.\n */\nexport class FGDynamicRegistry {\n private readonly _components = new Map<string, FGDynamicType>();\n\n register(name: string, type: FGDynamicType): void {\n if (typeof name === 'string' && name.length > 0 && type) {\n this._components.set(name, type);\n }\n }\n\n get(name: string): FGDynamicType | undefined {\n return typeof name === 'string' ? this._components.get(name) : undefined;\n }\n\n has(name: string): boolean {\n return typeof name === 'string' && this._components.has(name);\n }\n\n unregister(name: string): boolean {\n return this._components.delete(name);\n }\n\n clear(): void {\n this._components.clear();\n }\n\n get names(): string[] {\n return Array.from(this._components.keys());\n }\n}\n\n/**\n * Declare components to dynamically load in static and/or dynamic way using the FGDynamicService.\n *\n * The static registry is global. For untrusted or multi-tenant configurations,\n * create a scoped registry with `FGDynamicService.createRegistry()` and pass it\n * to `<fg-dynamic [registry]=\"registry\">`.\n */\nexport class FGDynamicService {\n private static readonly _defaultRegistry = new FGDynamicRegistry();\n\n static get registry(): FGDynamicRegistry {\n return FGDynamicService._defaultRegistry;\n }\n\n static createRegistry(): FGDynamicRegistry {\n return new FGDynamicRegistry();\n }\n\n static registerComponent(name: string, type: FGDynamicType): void {\n FGDynamicService._defaultRegistry.register(name, type);\n }\n\n static getComponent(name: string): FGDynamicType | undefined {\n return FGDynamicService._defaultRegistry.get(name);\n }\n\n static hasComponent(name: string): boolean {\n return FGDynamicService._defaultRegistry.has(name);\n }\n\n static unregisterComponent(name: string): boolean {\n return FGDynamicService._defaultRegistry.unregister(name);\n }\n\n static clearRegistry(): void {\n FGDynamicService._defaultRegistry.clear();\n }\n}\n\n/**\n * Create a standalone signals based dynamic components tree through a JSON configuration with full\n * life-cycle support for inputs, outputs, attributes, reactive forms and expressions binding evaluation.\n */\n@Component({\n\tselector: 'fg-dynamic',\n\ttemplate: `\n <ng-container #viewContainer></ng-container>\n @for (item of items(); track $index) {\n <fg-dynamic #dynamicItem [configuration]=\"item\" [(viewModel)]=\"viewModel\" [formGroup]=\"formGroup()\" [registry]=\"registry()\" [expressionPolicy]=\"expressionPolicy()\" [formControlPolicy]=\"formControlPolicy()\" [typePolicy]=\"typePolicy()\" [attributePolicy]=\"attributePolicy()\" [depth]=\"depth() + 1\" />\n }\n `,\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tstandalone: true,\n\tstyles: [`:host { display: contents; }`]\n})\nexport class FGDynamicComponent implements OnChanges, OnDestroy {\n\tconfiguration: InputSignal<IFGDynamicItem> = input.required<IFGDynamicItem>();\n\tviewModel: ModelSignal<unknown> = model<unknown>();\n\tformGroup: InputSignal<FormGroup> = input<FormGroup>();\n\tregistry: InputSignal<FGDynamicRegistry> = input<FGDynamicRegistry>(FGDynamicService.registry);\n\texpressionPolicy: InputSignal<IFGDynamicExpressionPolicy> = input<IFGDynamicExpressionPolicy>({});\n\tformControlPolicy: InputSignal<IFGDynamicFormPolicy> = input<IFGDynamicFormPolicy>({});\n\ttypePolicy: InputSignal<IFGDynamicTypePolicy> = input<IFGDynamicTypePolicy>({});\n\tattributePolicy: InputSignal<IFGDynamicAttributePolicy> = input<IFGDynamicAttributePolicy>({});\n\t/** Current nesting depth; used to bound recursive configurations. */\n\tdepth: InputSignal<number> = input<number>(0);\n\n /**\n * Cached structural validation for the current configuration. Both\n * `ngOnChanges` and `items` read this computed, so the tree is validated\n * once per signal change rather than twice.\n */\n private readonly _configurationIsValid: Signal<boolean> = computed((): boolean =>\n this.validateConfiguration(this.configuration()));\n\n /**\n * Child items, capped to avoid pathological configurations blocking the\n * renderer. Non-object entries are ignored. Structural limits (depth, node\n * count, cycles) are enforced by `_configurationIsValid`.\n */\n protected readonly items: Signal<readonly IFGDynamicItem[]> = computed((): readonly IFGDynamicItem[] => {\n if (this.depth() >= MAX_CONFIGURATION_DEPTH || !this._configurationIsValid()) {\n return [];\n }\n const configuration = this.configuration();\n if (configuration == null || typeof configuration !== 'object' || Array.isArray(configuration)) {\n return [];\n }\n const items = (configuration as IFGDynamicItem).items;\n if (!Array.isArray(items)) {\n return [];\n }\n return items\n .filter((item: unknown): item is IFGDynamicItem => item != null && typeof item === 'object' && !Array.isArray(item))\n .slice(0, MAX_CONFIGURATION_ITEMS);\n });\n\n\tprivate _viewContainerRef: Signal<ViewContainerRef> = viewChild.required('viewContainer', {\n read: ViewContainerRef\n });\n private _dynamicItems: Signal<readonly ElementRef<unknown>[]> = viewChildren('dynamicItem', {\n read: ElementRef\n });\n\tprivate _componentRef?: ComponentRef<unknown>;\n private _renderer: Renderer2 = inject(Renderer2);\n private _outputsSubscriptions: Array<{ unsubscribe(): void }> = [];\n private _currentOutputsConfig?: Record<string, string | Function>;\n private _formControl?: FormControl;\n private _formControlDirective?: FormControlDirective;\n private _formControlSubscription?: Subscription;\n private _managedValidatorFns: ValidatorFn[] = [];\n private _component?: Type<unknown>;\n private _injector: Injector = inject(Injector);\n private _ngOnChangesCounter = 0;\n private _destroyed = false;\n private _lastProjectedItemsSignature?: string;\n\n /** Group that literally contains the current control (may be a nested group). */\n private _formControlContainer?: FormGroup;\n /** Literal key of the control inside `_formControlContainer`. */\n private _formControlKey?: string;\n /** True only when this component created (and may therefore remove) the control. */\n private _ownsFormControl = false;\n /** Intermediate groups created while wiring a dotted control name. */\n private _createdFormGroups: Array<{ parent: FormGroup; key: string; group: FormGroup }> = [];\n /** Form wiring currently attached to the rendered component, used to detect rebinds. */\n private _wiredFormGroup?: FormGroup;\n private _wiredControlName?: string;\n /** `allowExistingControls` value used for the active wiring. */\n private _wiredAllowExistingControls?: boolean;\n /** Last value written to the control, used to avoid feedback loops when syncing the model. */\n private _hasSyncedControlValue = false;\n private _lastSyncedControlValue: unknown;\n /** Disabled state managed by this component, so it can be restored when `disabled` disappears. */\n private _disabledManaged = false;\n private _disabledBeforeManagement?: boolean;\n\n /** Attribute names currently applied to the dynamic element. */\n private _appliedAttributes = new Set<string>();\n /** Input names currently set on the dynamic component. */\n private _appliedInputs = new Set<string>();\n\n /**\n * A callback method that is invoked immediately after the default change\n * detector has checked data-bound properties if at least one has changed,\n * and before the view and content children are checked.\n */\n async ngOnChanges(changes?: SimpleChanges): Promise<void> {\n if (this._destroyed) {\n return;\n }\n\n const counter = ++this._ngOnChangesCounter;\n try {\n const configuration = this.configuration();\n if (configuration != null && (typeof configuration !== 'object' || Array.isArray(configuration))) {\n this.logError('Invalid configuration: expected an object.');\n this.clearResolvedComponent(counter);\n return;\n }\n\n if (!this._configurationIsValid()) {\n this.logError('Invalid configuration: it exceeds the structural limits.');\n this.clearResolvedComponent(counter);\n return;\n }\n\n // Lazy-load a component. Resolutions from older change-detection\n // generations are rejected inside `loadComponentAsync`.\n await this.loadComponentAsync(counter);\n\n if (this._destroyed || counter !== this._ngOnChangesCounter) {\n return;\n }\n\n // If projected items changed, we need to recreate the component to update projectableNodes\n const items = this.items();\n const itemsSignature = items.length > 0\n ? `${items.length}:${items.map((item: IFGDynamicItem, index: number): string => `${index}:${item?.type}`).join('|')}`\n : '';\n if (this._componentRef && this._lastProjectedItemsSignature !== itemsSignature) {\n this.cleanup();\n this._lastProjectedItemsSignature = itemsSignature;\n } else if (!this._componentRef) {\n this._lastProjectedItemsSignature = itemsSignature;\n }\n\n // Recreate the component when the form wiring (group/name) changed.\n this.rewireFormIfNeeded();\n\n // Instantiates a single component and inserts its host view into this container.\n this.createComponent();\n\n if (this._destroyed || counter !== this._ngOnChangesCounter) {\n return;\n }\n\n // Updates specified input names to new values.\n this.setInputs();\n // Disables/enables the control.\n this.setFormControlStatus();\n // Add synchronous validators to this control.\n this.setFormControlValidators();\n // Reflect external view-model changes into the control.\n this.syncFormControlFromViewModel();\n // Set attribute values for an element in the DOM.\n this.setAttributes();\n // Re-wire outputs if they changed\n this.handleOutputsIfChanged();\n // Ensure change detection\n if (this._componentRef?.changeDetectorRef) {\n this._componentRef.changeDetectorRef.markForCheck();\n }\n } catch (error) {\n if (counter === this._ngOnChangesCounter) {\n this.logError('Error during component initialization.', error);\n this.clearResolvedComponent(counter);\n }\n }\n }\n\n /**\n * Destroys the rendered component when it no longer has a resolvable type.\n * Ignored when a newer `ngOnChanges` generation has started.\n */\n private clearResolvedComponent(counter: number): void {\n if (this._destroyed || counter !== this._ngOnChangesCounter) {\n return;\n }\n this._component = undefined;\n if (this._componentRef) {\n this.cleanup();\n }\n }\n\n /**\n * Validates the whole configuration subtree before rendering. Rejects\n * excessive depth, node count, key counts, oversized keys and cycles.\n * The check is iterative so a hostile configuration cannot overflow the\n * JavaScript stack during validation itself.\n */\n private validateConfiguration(configuration: IFGDynamicItem | null | undefined): boolean {\n if (configuration == null) {\n return true;\n }\n\n const stats = this.collectConfigurationStats(configuration);\n if (!stats) {\n return false;\n }\n\n return this.depth() + stats.maxDepth <= MAX_CONFIGURATION_DEPTH\n && stats.nodes <= MAX_TOTAL_CONFIGURATION_NODES;\n }\n\n private collectConfigurationStats(configuration: IFGDynamicItem): { nodes: number; maxDepth: number } | null {\n const stack: Array<{ item: unknown; depth: number }> = [{ item: configuration, depth: 0 }];\n const seen = new WeakSet<object>();\n let nodes = 0;\n let maxDepth = 0;\n\n while (stack.length > 0) {\n const current = stack.pop()!;\n const item = current.item;\n\n if (item == null || typeof item !== 'object' || Array.isArray(item)) {\n if (current.depth === 0) {\n return null;\n }\n // Invalid nested entries are filtered out by `items`; skip them\n // here instead of rejecting the whole configuration tree.\n continue;\n }\n if (seen.has(item)) {\n // Reject cycles and repeated references to the same node.\n return null;\n }\n seen.add(item);\n\n nodes++;\n if (nodes > MAX_TOTAL_CONFIGURATION_NODES || current.depth > MAX_CONFIGURATION_DEPTH) {\n return null;\n }\n if (current.depth > maxDepth) {\n maxDepth = current.depth;\n }\n\n for (const field of ['inputs', 'attributes', 'outputs'] as const) {\n const map = (item as Record<string, unknown>)[field];\n if (map == null) {\n continue;\n }\n if (typeof map !== 'object' || Array.isArray(map)) {\n return null;\n }\n\n const keys = Object.keys(map as Record<string, unknown>);\n if (keys.length > MAX_CONFIGURATION_KEYS) {\n return null;\n }\n if (keys.some((key: string): boolean => key.length > MAX_CONFIGURATION_KEY_LENGTH\n || FORBIDDEN_PATH_SEGMENTS.has(key.toLowerCase()))) {\n return null;\n }\n }\n\n const items = (item as Record<string, unknown>)['items'];\n if (items == null) {\n continue;\n }\n if (!Array.isArray(items) || items.length > MAX_CONFIGURATION_ITEMS) {\n return null;\n }\n\n for (const child of items) {\n stack.push({ item: child, depth: current.depth + 1 });\n }\n }\n\n return { nodes, maxDepth };\n }\n\n /**\n * A method to lazy-load a component.\n */\n private async loadComponentAsync(counter: number): Promise<void> {\n const configurationType = this.configuration()?.type;\n\n if (configurationType == null) {\n this.clearResolvedComponent(counter);\n return;\n }\n\n if (this.typePolicy()?.requireScopedRegistry === true && this.isUsingGlobalRegistry()) {\n this.logWarning('A scoped registry is required by typePolicy but only the global registry is available.');\n this.clearResolvedComponent(counter);\n return;\n }\n\n let candidate: FGDynamicType | undefined;\n\n if (typeof configurationType === 'string') {\n candidate = this.getRegistry().get(configurationType);\n if (candidate == null) {\n this.logWarning(`Component type \"${configurationType}\" not found in the registry.`);\n this.clearResolvedComponent(counter);\n return;\n }\n } else {\n candidate = configurationType;\n }\n\n if (!this.isCandidateAllowed(candidate)) {\n this.logWarning('Component type was rejected by typePolicy (function/promise types are disabled).');\n this.clearResolvedComponent(counter);\n return;\n }\n\n try {\n const resolved = this.resolveCandidate(candidate);\n const resolvedType = this.isPromiseLike(resolved) ? await resolved : resolved;\n\n // Ignore resolutions that belong to a superseded configuration.\n if (counter !== this._ngOnChangesCounter) {\n return;\n }\n\n if (!resolvedType) {\n this.clearResolvedComponent(counter);\n return;\n }\n\n // Only re-assign when the resolved type actually changed, so that subsequent\n // input/attribute updates don't tear down the already-instantiated component.\n if (this._component !== resolvedType) {\n this.cleanup();\n this._component = resolvedType;\n }\n } catch (error) {\n if (counter !== this._ngOnChangesCounter) {\n return;\n }\n this.logError('Unable to resolve the dynamic component type.', error);\n this.clearResolvedComponent(counter);\n }\n }\n\n private isPromiseLike(value: unknown): value is PromiseLike<unknown> {\n return value != null\n && (typeof value === 'object' || typeof value === 'function')\n && typeof (value as { then?: unknown }).then === 'function';\n }\n\n private resolveCandidate(candidate: unknown): Type<unknown> | PromiseLike<Type<unknown> | undefined> | undefined {\n if (candidate == null) {\n return undefined;\n }\n\n if (this.isPromiseLike(candidate)) {\n return Promise.resolve(candidate).then((resolved: unknown): Type<unknown> | undefined => this.toComponentType(resolved));\n }\n\n if (typeof candidate === 'function') {\n // Never invoke an Angular component/directive/pipe class: it is a type, not a loader.\n if (this.isAngularComponentType(candidate)) {\n return candidate as Type<unknown>;\n }\n\n // A function with declared parameters cannot be a lazy loader (loaders are zero-arity).\n if (candidate.length > 0) {\n return candidate as Type<unknown>;\n }\n\n const result: unknown = (candidate as () => unknown)();\n\n if (this.isPromiseLike(result)) {\n return Promise.resolve(result).then((resolved: unknown): Type<unknown> | undefined => this.toComponentType(resolved));\n }\n\n return this.toComponentType(result);\n }\n\n this.logWarning('Invalid component type in configuration.');\n return undefined;\n }\n\n private toComponentType(resolved: unknown): Type<unknown> | undefined {\n if (typeof resolved === 'function') {\n return resolved as Type<unknown>;\n }\n\n this.logWarning('Component loader did not resolve to a component type.');\n return undefined;\n }\n\n private isAngularComponentType(candidate: Function): boolean {\n const metadata = candidate as unknown as Record<string, unknown>;\n return Boolean(\n metadata['ɵcmp'] ||\n metadata['ɵdir'] ||\n metadata['ɵpipe'] ||\n metadata['ɵfac'] ||\n metadata['ngComponentDef'] ||\n metadata['ngDirectiveDef']\n );\n }\n\n /**\n * Function loaders and thenables execute host code, so they are only\n * accepted when the host opts in. Angular component classes stay allowed.\n */\n private isCandidateAllowed(candidate: unknown): boolean {\n if (candidate == null) {\n return false;\n }\n if (this.typePolicy()?.allowFunctionTypes === true) {\n return true;\n }\n return typeof candidate === 'function' && this.isAngularComponentType(candidate);\n }\n\n private isUsingGlobalRegistry(): boolean {\n const registry = this.registry();\n return registry == null || registry === FGDynamicService.registry;\n }\n\n private getRegistry(): FGDynamicRegistry {\n return this.registry() ?? FGDynamicService.registry;\n }\n\n /**\n * Instantiates a single component and inserts its host view into this container.\n */\n private createComponent(): void {\n // If the component type changed, clean up and recreate it.\n if (this._componentRef && this._component !== this._componentRef.componentType) {\n this.cleanup();\n }\n\n if (this._component && !this._componentRef && this._viewContainerRef()) {\n let injector: Injector | undefined = undefined;\n const formGroup = this.formGroup();\n const controlName = this.resolveFormControlName();\n\n if (formGroup && controlName) {\n // Synchronizes a standalone FormControl instance to a form control element.\n this._formControlDirective = new FormControlDirective(null, null, null, null);\n\n // Creates a new injector instance that provides one or more dependencies, according to a given type or types of StaticProvider.\n injector = Injector.create({\n providers: [{\n provide: NgControl,\n useValue: this._formControlDirective\n }],\n parent: this._injector\n });\n }\n\n // Instantiates a single component and inserts its host view into this container.\n const dynamicItems = this._dynamicItems();\n this._componentRef = this._viewContainerRef().createComponent(this._component, {\n projectableNodes: dynamicItems && dynamicItems.length > 0 ? [dynamicItems.map((e: ElementRef<unknown>): Node => e.nativeElement as Node)] : undefined,\n injector: injector\n });\n\n // When a view uses the ChangeDetectionStrategy#OnPush (checkOnce) change detection strategy, explicitly marks the view as changed so that it can be checked again.\n // Components are normally marked as dirty (in need of rerendering) when inputs have changed or events have fired in the view.\n // Call this method to ensure that a component is checked even if these triggers have not occurred.\n if (this._componentRef?.changeDetectorRef) {\n this._componentRef.changeDetectorRef.markForCheck();\n }\n\n // Register handlers for those events by subscribing to an instance.\n this.handleOutputs();\n // Construct and attach a FormControl with an initial value.\n this.wireFormControl();\n }\n }\n\n /**\n * Register handlers for those events by subscribing to an instance.\n * Supports both `EventEmitter` (`@Output`) and signal outputs created with `output()`.\n */\n private handleOutputs(): void {\n // Clean up existing subscriptions\n if (this._outputsSubscriptions && this._outputsSubscriptions.length > 0) {\n this._outputsSubscriptions.forEach((s: { unsubscribe(): void }): void => {\n try {\n s.unsubscribe();\n } catch (e) {\n // Ignore\n }\n });\n this._outputsSubscriptions = [];\n }\n\n const outputs = this.configuration()?.outputs;\n this._currentOutputsConfig = outputs ? { ...outputs } : undefined;\n\n if (outputs && typeof outputs === 'object' && this._componentRef?.instance) {\n const instance = this._componentRef.instance as Record<string, unknown>;\n\n for (const outputName of Object.keys(outputs)) {\n const emitter = instance[outputName];\n\n if (!this.isOutputEmitter(emitter)) {\n continue;\n }\n\n const subscription = emitter.subscribe(($event: unknown): void => {\n try {\n const expr = outputs[outputName];\n const viewModelValue = this.getViewModelValue();\n // Output handlers always have an event context, even when the\n // emitted payload is `null`/`undefined` (e.g. `EventEmitter<void>`).\n const result: unknown = typeof expr === 'string'\n ? this.evaluateExpression(expr, viewModelValue, $event, true)\n : expr;\n\n if (typeof result === 'function') {\n (result as Function).call(viewModelValue, $event);\n }\n } catch (error) {\n this.logError('Error handling output.', error);\n }\n });\n\n if (subscription && typeof subscription.unsubscribe === 'function') {\n this._outputsSubscriptions.push(subscription);\n }\n }\n }\n }\n\n private isOutputEmitter(value: unknown): value is { subscribe(callback: (event: unknown) => void): { unsubscribe(): void } | void } {\n if (value == null) {\n return false;\n }\n const emitter = value as Record<string, unknown>;\n return typeof emitter['subscribe'] === 'function' && typeof emitter['emit'] === 'function';\n }\n\n private handleOutputsIfChanged(): void {\n const outputs = this.configuration()?.outputs;\n const current = this._currentOutputsConfig;\n \n // Check if outputs changed\n if (!outputs && !current) {\n return;\n }\n if (!outputs || !current) {\n this.handleOutputs();\n return;\n }\n \n const currentKeys = Object.keys(current).sort();\n const newKeys = Object.keys(outputs).sort();\n if (currentKeys.length !== newKeys.length) {\n this.handleOutputs();\n return;\n }\n for (let i = 0; i < currentKeys.length; i++) {\n if (currentKeys[i] !== newKeys[i] || current[currentKeys[i]] !== outputs[newKeys[i]]) {\n this.handleOutputs();\n return;\n }\n }\n }\n\n /**\n * Evaluates the configured `attributes.name` into a safe control path.\n * Returns `undefined` when the view model or name is not available yet, so\n * the wiring is retried on the next change.\n */\n private resolveFormControlName(): string | undefined {\n const attributes = this.configuration()?.attributes;\n if (!attributes || !Object.hasOwn(attributes, 'name')) {\n return undefined;\n }\n\n const nameAttr = attributes['name'];\n if (nameAttr == null) {\n return undefined;\n }\n\n const viewModelValue = this.getViewModelValue();\n if (viewModelValue == null) {\n return undefined;\n }\n\n const name = this.evaluateExpression(nameAttr, viewModelValue);\n if (typeof name !== 'string' || name.length === 0) {\n return undefined;\n }\n\n if (!this.isSafePath(name)) {\n this.logWarning('Unsafe form control name was ignored.');\n return undefined;\n }\n\n const allowedNames = this.formControlPolicy()?.allowedControlNames;\n if (allowedNames !== undefined && (!Array.isArray(allowedNames) || !allowedNames.includes(name))) {\n this.logWarning('Form control name was rejected by formControlPolicy.');\n return undefined;\n }\n\n return name;\n }\n\n /**\n * Recreates the dynamic component when the `formGroup`, the evaluated\n * control name or the availability of the view model changed.\n */\n private rewireFormIfNeeded(): void {\n if (!this._componentRef) {\n return;\n }\n\n const formGroup = this.formGroup();\n const controlName = this.resolveFormControlName();\n const desiredGroup = formGroup && controlName ? formGroup : undefined;\n\n const allowExistingControls = this.formControlPolicy()?.allowExistingControls === true;\n const policyChanged = desiredGroup !== undefined\n && this._wiredAllowExistingControls !== allowExistingControls;\n\n if (this._wiredFormGroup !== desiredGroup || this._wiredControlName !== controlName || policyChanged) {\n this.cleanup();\n }\n }\n\n /**\n * Constructs (or reuses) the form control and attaches it to the rendered\n * component. Dotted names are represented as nested `FormGroup`s so that\n * `formGroup.get('data.firstName')` works and no key contains a dot.\n */\n private wireFormControl(): void {\n const formGroup = this.formGroup();\n const name = this.resolveFormControlName();\n\n if (!formGroup || !name) {\n this._wiredFormGroup = undefined;\n this._wiredControlName = undefined;\n return;\n }\n\n const path = this.parsePath(name);\n if (!path) {\n this._wiredFormGroup = undefined;\n this._wiredControlName = undefined;\n return;\n }\n\n const parent = this.ensureFormGroupPath(formGroup, path.slice(0, -1));\n if (!parent) {\n this.pruneCreatedFormGroups();\n this._wiredFormGroup = undefined;\n this._wiredControlName = undefined;\n return;\n }\n\n const key = path[path.length - 1];\n const existing = parent.get(key);\n\n if (existing) {\n if (this.formControlPolicy()?.allowExistingControls !== true) {\n this.logWarning('A form control with the requested name already exists; reuse is disabled by formControlPolicy.');\n this.pruneCreatedFormGroups();\n this._wiredFormGroup = undefined;\n this._wiredControlName = undefined;\n return;\n }\n\n if (!(existing instanceof FormControl)) {\n this.logWarning('A form control with the requested name already exists and is not a FormControl.');\n this.pruneCreatedFormGroups();\n this._wiredFormGroup = undefined;\n this._wiredControlName = undefined;\n return;\n }\n\n this.logWarning('A form control with the requested name already exists; reusing it.');\n this._formControl = existing;\n this._ownsFormControl = false;\n } else {\n // Construct a FormControl with an initial value.\n const control = new FormControl(this.getModelPropertyValue(this.getViewModelValue(), name, null));\n\n try {\n // Add a control to this group. `key` never contains a dot.\n parent.addControl(key, control);\n this._formControl = control;\n this._ownsFormControl = true;\n } catch (error) {\n this.logError('Error adding form control.', error);\n this.pruneCreatedFormGroups();\n return;\n }\n }\n\n this._formControlContainer = parent;\n this._formControlKey = key;\n this._wiredFormGroup = formGroup;\n this._wiredControlName = name;\n this._wiredAllowExistingControls = this.formControlPolicy()?.allowExistingControls === true;\n this._disabledBeforeManagement = this._formControl.disabled;\n this._lastSyncedControlValue = this._formControl.value;\n this._hasSyncedControlValue = true;\n\n // Synchronizes a standalone FormControl instance to a form control element.\n this.attachFormControlDirective();\n this.bindFormControlValueChanges(name);\n }\n\n /**\n * Walks/creates the nested `FormGroup`s required by a dotted control path.\n * Created groups are tracked so they can be removed again on cleanup.\n */\n private ensureFormGroupPath(root: FormGroup, segments: string[]): FormGroup | null {\n let current = root;\n\n for (const segment of segments) {\n const existing = current.get(segment);\n\n if (existing == null) {\n const group = new FormGroup({});\n try {\n current.addControl(segment, group);\n } catch (error) {\n this.logError('Error creating nested form group.', error);\n this.pruneCreatedFormGroups();\n return null;\n }\n this._createdFormGroups.push({ parent: current, key: segment, group });\n current = group;\n } else if (existing instanceof FormGroup) {\n if (this.formControlPolicy()?.allowExistingControls !== true) {\n this.logWarning(`Cannot reuse existing nested form group \"${segment}\" because formControlPolicy disables it.`);\n this.pruneCreatedFormGroups();\n return null;\n }\n current = existing;\n } else {\n this.logWarning(`Cannot create nested form group \"${segment}\" because a different control already exists.`);\n this.pruneCreatedFormGroups();\n return null;\n }\n }\n\n return current;\n }\n\n /**\n * Keeps the view model in sync with the control value. Used for both newly\n * created and reused controls.\n */\n private bindFormControlValueChanges(name: string): void {\n if (this._formControlSubscription) {\n try {\n this._formControlSubscription.unsubscribe();\n } catch (e) {\n // Ignore\n }\n }\n\n this._formControlSubscription = this._formControl.valueChanges.subscribe((value: unknown): void => {\n const currentModel = this.getViewModelValue();\n if (currentModel == null) {\n return;\n }\n\n // Clone only the containers along the path so sibling subtrees are\n // shared and the update stays O(path) instead of O(view model).\n const path = this.parsePath(name);\n if (!path) {\n return;\n }\n const viewModel = this.cloneAlongPathForMutation(currentModel, path);\n // Sets the value at path of object.\n this.setModelPropertyValue(viewModel, path, value);\n\n this._lastSyncedControlValue = value;\n this._hasSyncedControlValue = true;\n\n // Directly set the signal to a new value, and notify any dependents.\n try {\n this.viewModel.set(viewModel);\n // Ensure the dynamically created view (and its value accessor)\n // is checked even though the host uses OnPush.\n if (this._componentRef?.changeDetectorRef) {\n this._componentRef.changeDetectorRef.markForCheck();\n }\n } catch (error) {\n this.logError('Error updating view model.', error);\n }\n });\n }\n\n /**\n * Clones only the containers along `path`, sharing every other subtree.\n * Accessor properties are preserved without being invoked.\n */\n private cloneAlongPathForMutation(value: unknown, path: string[]): unknown {\n if (path.length === 0 || !this.isMutableContainer(value)) {\n return value;\n }\n\n const copy = this.cloneContainerShallow(value as object);\n if (path.length === 1) {\n return copy;\n }\n\n const descriptor = Object.getOwnPropertyDescriptor(value as object, path[0]);\n if (!descriptor || !('value' in descriptor)) {\n return copy;\n }\n\n const child = descriptor.value;\n if (child == null || !this.isMutableContainer(child)) {\n return copy;\n }\n\n this.defineOwn(copy, path[0], this.cloneAlongPathForMutation(child, path.slice(1)));\n return copy;\n }\n\n /** Shallow-copies own descriptors without invoking getters. */\n private cloneContainerShallow(value: object): Record<string, unknown> {\n const copy: any = Array.isArray(value) ? [] : {};\n\n for (const key of Object.keys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (!descriptor) {\n continue;\n }\n if ('value' in descriptor) {\n this.defineOwn(copy, key, descriptor.value);\n } else {\n Object.defineProperty(copy, key, descriptor);\n }\n }\n\n if (Array.isArray(value)) {\n copy.length = value.length;\n }\n\n return copy;\n }\n\n /**\n * Reflects external view-model changes into the control. Values written by\n * the control itself are skipped to avoid clobbering user input.\n */\n private syncFormControlFromViewModel(): void {\n if (!this._formControl || !this._hasSyncedControlValue) {\n return;\n }\n\n const name = this._wiredControlName;\n const model = this.getViewModelValue();\n if (!name || model == null) {\n return;\n }\n\n const path = this.parsePath(name);\n if (!path) {\n return;\n }\n\n const nextValue = this.getModelPropertyValue(model, path, MISSING_FORM_VALUE);\n if (nextValue === MISSING_FORM_VALUE || this.valuesEqual(nextValue, this._lastSyncedControlValue)) {\n return;\n }\n\n try {\n this._formControl.setValue(nextValue, { emitEvent: false });\n this._lastSyncedControlValue = nextValue;\n } catch (error) {\n this.logError('Error synchronizing the form control with the view model.', error);\n }\n }\n\n /** Bounded structural comparison used to detect real view-model changes. */\n private valuesEqual(left: unknown, right: unknown, depth = 0): boolean {\n if (Object.is(left, right)) {\n return true;\n }\n if (depth >= 8 || left == null || right == null\n || typeof left !== 'object' || typeof right !== 'object') {\n return false;\n }\n if (Array.isArray(left) !== Array.isArray(right)) {\n return false;\n }\n if (Object.getPrototypeOf(left) !== Object.getPrototypeOf(right)) {\n return false;\n }\n\n const leftKeys = Object.keys(left);\n const rightKeys = Object.keys(right);\n if (leftKeys.length !== rightKeys.length) {\n return false;\n }\n\n for (const key of leftKeys) {\n if (!Object.hasOwn(right, key)) {\n return false;\n }\n const leftDescriptor = Object.getOwnPropertyDescriptor(left, key);\n const rightDescriptor = Object.getOwnPropertyDescriptor(right, key);\n if (!leftDescriptor || !rightDescriptor || !('value' in leftDescriptor) || !('value' in rightDescriptor)) {\n return false;\n }\n if (!this.valuesEqual(leftDescriptor.value, rightDescriptor.value, depth + 1)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Removes created intermediate groups that are detached or still empty.\n * Used after a failed wiring attempt and during cleanup.\n */\n private pruneCreatedFormGroups(): void {\n const kept: Array<{ parent: FormGroup; key: string; group: FormGroup }> = [];\n\n for (let index = this._createdFormGroups.length - 1; index >= 0; index--) {\n const entry = this._createdFormGroups[index];\n let remove = false;\n\n try {\n remove = entry.parent.get(entry.key) === entry.group\n && Object.keys(entry.group.controls).length === 0;\n if (remove) {\n entry.parent.removeControl(entry.key);\n }\n } catch {\n remove = false;\n }\n\n if (!remove) {\n kept.unshift(entry);\n }\n }\n\n this._createdFormGroups = kept;\n }\n\n private setControlDisabled(disabled: boolean): void {\n if (!this._formControl) {\n return;\n }\n\n try {\n if (disabled && this._formControl.enabled) {\n this._formControl.disable({\n emitEvent: false\n });\n } else if (!disabled && this._formControl.disabled) {\n this._formControl.enable({\n emitEvent: false\n });\n }\n } catch (error) {\n this.logError('Error updating form control status.', error);\n }\n }\n\n /**\n * Restores the disabled state a control had before this component managed\n * it (important for pre-existing/reused controls and removed `disabled` keys).\n */\n private restoreManagedDisabledState(): void {\n if (!this._formControl || !this._disabledManaged) {\n return;\n }\n\n this.setControlDisabled(this._disabledBeforeManagement === true);\n this._disabledManaged = false;\n this._disabledBeforeManagement = undefined;\n }\n\n /**\n * Disables/enables the control, normalizing boolean-ish values, and restores\n * the previous state when the `disabled` key is removed.\n */\n private setFormControlStatus(): void {\n if (!this._formControl) {\n return;\n }\n\n const attributes = this.configuration()?.attributes;\n\n if (!attributes || !Object.hasOwn(attributes, 'disabled')) {\n this.restoreManagedDisabledState();\n return;\n }\n\n const disabledAttr = attributes['disabled'];\n const evaluated = this.evaluateExpression(disabledAttr, this.getViewModelValue());\n\n // Do not treat an unevaluated `$vm`/`$event` expression as `true`.\n if (this.isUnresolvedExpression(disabledAttr, evaluated)) {\n return;\n }\n\n const shouldDisable = this.toBoolean(evaluated);\n\n if (!this._disabledManaged) {\n this._disabledBeforeManagement = this._formControl.disabled;\n this._disabledManaged = true;\n }\n\n this.setControlDisabled(shouldDisable);\n }\n\n /**\n * Add synchronous validators to this control.\n */\n private setFormControlValidators(): void {\n if (!this._formControl) {\n return;\n }\n\n // Always remove previously managed validators, even when the current\n // configuration has no validator-bearing attributes.\n if (this._managedValidatorFns.length > 0) {\n try {\n this._formControl.removeValidators(this._managedValidatorFns);\n } catch (error) {\n this.logError('Error removing managed validators.', error);\n }\n \n this._managedValidatorFns = [];\n \n try {\n this._formControl.updateValueAndValidity({\n emitEvent: false\n });\n } catch (error) {\n this.logError('Error updating form control validity.', error);\n }\n }\n\n const attributes = this.configuration()?.attributes;\n if (attributes && Object.keys(attributes).length > 0 && this._componentRef?.location?.nativeElement) {\n const validators: ValidatorFn[] = [];\n // Validator that requires the control's value to be greater than or equal to the provided number.\n if (Object.hasOwn(attributes, 'min')) {\n const { value: min, unresolved } = this.evaluateAttribute(attributes, 'min');\n if (!unresolved && typeof(min) === 'number' && !isNaN(min)) {\n validators.push(Validators.min(min));\n }\n }\n\n // Validator that requires the control's value to be less than or equal to the provided number.\n if (Object.hasOwn(attributes, 'max')) {\n const { value: max, unresolved } = this.evaluateAttribute(attributes, 'max');\n if (!unresolved && typeof(max) === 'number' && !isNaN(max)) {\n validators.push(Validators.max(max));\n }\n }\n\n // Validator that requires the control have a non-empty value.\n if (Object.hasOwn(attributes, 'required')) {\n const { value: required, unresolved } = this.evaluateAttribute(attributes, 'required');\n if (!unresolved && required === true) {\n validators.push(Validators.required);\n }\n }\n\n // Validator that requires the control's value pass an email validation test.\n if (Object.hasOwn(attributes, 'email')) {\n const { value: email, unresolved } = this.evaluateAttribute(attributes, 'email');\n if (!unresolved && email === true) {\n validators.push(Validators.email);\n }\n }\n\n // Validator that requires the length of the control's value to be less than or equal to the provided maximum length.\n if (Object.hasOwn(attributes, 'maxlength')) {\n const { value: maxLength, unresolved } = this.evaluateAttribute(attributes, 'maxlength');\n if (!unresolved && typeof(maxLength) === 'number' && !isNaN(maxLength) && maxLength >= 0) {\n validators.push(Validators.maxLength(maxLength));\n }\n }\n\n // Validator that requires the length of the control's value to be greater than or equal to the provided minimum length.\n if (Object.hasOwn(attributes, 'minlength')) {\n const { value: minLength, unresolved } = this.evaluateAttribute(attributes, 'minlength');\n if (!unresolved && typeof(minLength) === 'number' && !isNaN(minLength) && minLength >= 0) {\n validators.push(Validators.minLength(minLength));\n }\n }\n\n // Validator that requires the control's value to match a regex pattern.\n // Configuration patterns are untrusted: cap their size and reject\n // nested quantifiers that can trigger catastrophic backtracking.\n if (Object.hasOwn(attributes, 'pattern')) {\n const { value: pattern, unresolved } = this.evaluateAttribute(attributes, 'pattern');\n const patternValidator = unresolved ? null : this.createPatternValidator(pattern);\n if (patternValidator) {\n validators.push(patternValidator);\n }\n }\n\n // Track and add the newly built managed validators.\n if (validators.length > 0) {\n this._managedValidatorFns = validators;\n try {\n this._formControl.addValidators(this._managedValidatorFns);\n } catch (error) {\n this.logError('Error adding managed validators.', error);\n }\n } else {\n this._managedValidatorFns = [];\n }\n // Recalculates the value and validation status of the control whenever the\n // managed validator set changes (including when it becomes empty).\n try {\n this._formControl.updateValueAndValidity({\n emitEvent: false\n });\n } catch (error) {\n this.logError('Error updating form control validity.', error);\n }\n } else {\n this._managedValidatorFns = [];\n }\n }\n\n /**\n * Builds a defensive `pattern` validator. Invalid, oversized or potentially\n * catastrophic regular expressions are ignored instead of blocking the UI.\n */\n private createPatternValidator(pattern: unknown): ValidatorFn | null {\n let regex: RegExp;\n\n if (typeof pattern === 'string') {\n if (pattern.length === 0 || pattern.length > MAX_PATTERN_LENGTH) {\n this.logWarning('Pattern validator was ignored because its source is empty or too long.');\n return null;\n }\n if (this.isUnsafeRegex(pattern)) {\n this.logWarning('Pattern validator was ignored because the expression is potentially unsafe.');\n return null;\n }\n\n try {\n const anchored = (pattern.startsWith('^') ? '' : '^') + pattern + (pattern.endsWith('$') ? '' : '$');\n regex = new RegExp(anchored);\n } catch (error) {\n this.logError('Pattern validator was ignored because the expression is invalid.', error);\n return null;\n }\n } else if (pattern instanceof RegExp) {\n if (pattern.source.length > MAX_PATTERN_LENGTH || this.isUnsafeRegex(pattern.source)) {\n this.logWarning('Pattern validator was ignored because the expression is potentially unsafe.');\n return null;\n }\n try {\n // Global/sticky regexes mutate `lastIndex` on every `test()` call,\n // which makes validation stateful. Clone without `g`/`y`.\n regex = new RegExp(pattern.source, pattern.flags.replace(/[gy]/g, ''));\n } catch (error) {\n this.logError('Pattern validator was ignored because the expression is invalid.', error);\n return null;\n }\n } else {\n return null;\n }\n\n const baseValidator = Validators.pattern(regex);\n\n return (control: AbstractControl): ValidationErrors | null => {\n const value = control.value;\n\n if (value == null) {\n return baseValidator(control);\n }\n if (typeof value !== 'string' && typeof value !== 'number') {\n return { pattern: { requiredPattern: regex.toString() } };\n }\n if (typeof value === 'string' && value.length > MAX_PATTERN_INPUT_LENGTH) {\n return { pattern: { requiredPattern: regex.toString() } };\n }\n\n return baseValidator(control);\n };\n }\n\n /**\n * Conservative scanner for regular expressions with nested/ambiguous\n * quantifiers (e.g. `(a+)+`, `(\\d+(?:\\d+)?)+`, `(a*)*`, `(\\d+){2,}`) and\n * quantified alternations (e.g. `(a|aa)+`, `(\\w|\\d)+`) that can cause\n * exponential backtracking.\n *\n * Groups are tracked with an explicit stack, so nested groups and optional\n * inner quantifiers are detected instead of relying on a single regex.\n * This is still a heuristic: it errs on the side of rejecting ambiguous\n * constructs rather than allowing a catastrophic pattern through.\n */\n private isUnsafeRegex(source: string): boolean {\n if (source.length > MAX_PATTERN_LENGTH) {\n return true;\n }\n\n interface GroupState {\n hasQuantifier: boolean;\n hasAlternation: boolean;\n }\n\n const stack: GroupState[] = [{ hasQuantifier: false, hasAlternation: false }];\n let inCharacterClass = false;\n\n const isQuantifierAt = (index: number): boolean => {\n const character = source[index];\n if (character === '+' || character === '*') {\n return true;\n }\n if (character !== '{') {\n return false;\n }\n const match = /^\\{\\d+(?:,\\d*)?\\}/.exec(source.slice(index));\n if (!match) {\n return false;\n }\n // Very large bounded repetitions are also a CPU/memory hazard.\n const bounds = /^\\{(\\d+)(?:,(\\d*))?\\}/.exec(match[0]);\n if (bounds) {\n const upper = bounds[2] === undefined || bounds[2] === '' ? Infinity : Number(bounds[2]);\n if (Number.isFinite(upper) && upper > 10000) {\n return true;\n }\n }\n return true;\n };\n\n for (let index = 0; index < source.length; index++) {\n const character = source[index];\n\n if (character === '\\\\') {\n const next = source[index + 1];\n if (next && /[1-9]/.test(next)) {\n let cursor = index + 2;\n while (cursor < source.length && /\\d/.test(source[cursor])) {\n cursor++;\n }\n if (isQuantifierAt(cursor)) {\n return true;\n }\n }\n index++;\n continue;\n }\n\n if (inCharacterClass) {\n if (character === ']') {\n inCharacterClass = false;\n }\n continue;\n }\n\n if (character === '[') {\n inCharacterClass = true;\n continue;\n }\n\n if (character === '(') {\n stack.push({ hasQuantifier: false, hasAlternation: false });\n // Skip the `?` of `(?:`, `(?=`, `(?!`, `(?<=`, `(?<!` and\n // named capture group prefixes.\n if (source[index + 1] === '?') {\n index++;\n }\n continue;\n }\n\n if (character === ')') {\n const group = stack.pop();\n if (group) {\n const quantified = isQuantifierAt(index + 1);\n if (quantified && (group.hasQuantifier || group.hasAlternation)) {\n return true;\n }\n\n const parent = stack[stack.length - 1];\n if (parent) {\n if (quantified || group.hasQuantifier) {\n parent.hasQuantifier = true;\n }\n if (group.hasAlternation) {\n parent.hasAlternation = true;\n }\n }\n }\n continue;\n }\n\n if (character === '|') {\n stack[stack.length - 1].hasAlternation = true;\n continue;\n }\n\n if (character === '+' || character === '*' || character === '{' || character === '?') {\n // `?` is a quantifier when it follows a token, but not when it\n // belongs to a group prefix (`(?:`, `(?=`, …).\n if (character === '?' && source[index - 1] === '(') {\n continue;\n }\n if (character === '{' && !/^\\{\\d+(?:,\\d*)?\\}/.test(source.slice(index))) {\n continue;\n }\n if (character === '{' && isQuantifierAt(index)) {\n const bounds = /^\\{(\\d+)(?:,(\\d*))?\\}/.exec(source.slice(index));\n const upper = bounds && bounds[2] !== undefined && bounds[2] !== '' ? Number(bounds[2]) : Infinity;\n if (Number.isFinite(upper) && upper > 10000) {\n return true;\n }\n }\n stack[stack.length - 1].hasQuantifier = true;\n }\n }\n\n return false;\n }\n\n /**\n * Synchronizes a standalone FormControl instance to a form control element.\n */\n private attachFormControlDirective(): void {\n if (this._formControlDirective && this._componentRef?.injector && this._formControl) {\n try {\n const valueAccessors: ControlValueAccessor[] | null = this._componentRef.injector.get<ControlValueAccessor[] | null>(NG_VALUE_ACCESSOR, null);\n const valueAccessor = Array.isArray(valueAccessors) && valueAccessors.length > 0 ? valueAccessors[0] : null;\n\n if (!valueAccessor) {\n this.logWarning('The dynamic component does not provide an NG_VALUE_ACCESSOR; the form control will not be bound to its view.');\n }\n\n // NOTE: `valueAccessor`/`form` and `ngOnChanges` are the public\n // surface Angular's `FormControlDirective` uses internally; this\n // keeps the standalone control attachable without a template.\n this._formControlDirective.valueAccessor = valueAccessor;\n this._formControlDirective.form = this._formControl;\n\n // A callback method that is invoked immediately after the default change detector has checked data-bound properties if at least one has changed, and before the view and content children are checked.\n this._formControlDirective.ngOnChanges({\n form: {\n firstChange: true,\n currentValue: this._formControl,\n previousValue: undefined,\n isFirstChange: (): true => true\n }\n });\n } catch (error) {\n this.logError('Error attaching form control directive.', error);\n }\n }\n }\n\n /**\n * Parses a dot/bracket path. Returns `null` when the path is malformed or\n * contains prototype-related segments (`__proto__`, `prototype`,\n * `constructor`), which protects both the view model and `FormGroup`.\n */\n private parsePath(property: Array<string> | string | null | undefined): string[] | null {\n if (property == null) {\n return null;\n }\n\n let pathArray: string[] | null = null;\n\n if (Array.isArray(property)) {\n pathArray = property\n .filter((segment: unknown): boolean => segment != null && segment !== '')\n .map((segment: unknown): string => String(segment));\n } else if (typeof property === 'string') {\n pathArray = this.parseStringPath(property);\n }\n\n if (!pathArray || pathArray.length === 0 || pathArray.length > MAX_PATH_DEPTH) {\n return null;\n }\n\n for (const segment of pathArray) {\n if (segment.length === 0 || segment.length > MAX_PATH_SEGMENT_LENGTH) {\n return null;\n }\n if (FORBIDDEN_PATH_SEGMENTS.has(segment.toLowerCase())) {\n return null;\n }\n }\n\n return pathArray;\n }\n\n /**\n * Strictly parses `a.b`, `a[0]`, `a['b']` and `a[\"b\"]`. Unbalanced brackets,\n * empty segments and stray characters are rejected instead of being silently\n * ignored.\n */\n private parseStringPath(property: string): string[] | null {\n const source = property.trim();\n if (source.length === 0) {\n return null;\n }\n\n const segments: string[] = [];\n let index = 0;\n let expectingSegment = true;\n\n while (index < source.length) {\n const character = source[index];\n\n if (character === '.') {\n if (expectingSegment) {\n return null;\n }\n expectingSegment = true;\n index++;\n continue;\n }\n\n if (character === '[') {\n index++;\n let value = '';\n\n if (source[index] === '\"' || source[index] === \"'\") {\n const quote = source[index];\n index++;\n let closed = false;\n\n while (index < source.length) {\n const current = source[index];\n if (current === '\\\\') {\n if (index + 1 >= source.length) {\n return null;\n }\n value += source[index + 1];\n index += 2;\n continue;\n }\n if (current === quote) {\n index++;\n closed = true;\n break;\n }\n value += current;\n index++;\n }\n\n if (!closed) {\n return null;\n }\n } else {\n const start = index;\n while (index < source.length && source[index] !== ']') {\n if (source[index] === '[' || source[index] === '.') {\n return null;\n }\n value += source[index];\n index++;\n }\n if (index === start) {\n return null;\n }\n value = value.trim();\n }\n\n if (source[index] !== ']' || value.length === 0) {\n return null;\n }\n\n index++;\n segments.push(value);\n expectingSegment = false;\n continue;\n }\n\n if (!expectingSegment) {\n return null;\n }\n\n let value = '';\n while (index < source.length && source[index] !== '.' && source[index] !== '[') {\n value += source[index];\n index++;\n }\n\n if (value.length === 0) {\n return null;\n }\n\n segments.push(value);\n expectingSegment = false;\n }\n\n if (expectingSegment) {\n return null;\n }\n\n return segments;\n }\n\n private isSafePath(property: Array<string> | string): boolean {\n return this.parsePath(property) !== null;\n }\n\n private defineOwn(target: object, key: string, value: unknown): void {\n Object.defineProperty(target, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n\n /**\n * Only plain objects and arrays may be traversed/written by form\n * synchronization. This prevents writes into class instances, services and\n * DOM objects referenced by the view model.\n */\n private isMutableContainer(value: unknown): boolean {\n if (value == null || typeof value !== 'object') {\n return false;\n }\n if (Array.isArray(value)) {\n return true;\n }\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n }\n\n /**\n * Gets the value at path of object. If the resolved value is undefined, the defaultValue is returned in its place.\n * Only own properties are read; prototype-chain reads are blocked.\n * @param model The object.\n * @param property The path.\n * @param defaultValue The resolved value.\n */\n private getModelPropertyValue(model: unknown, property: Array<string> | string, defaultValue: unknown): unknown {\n if (model == null) {\n return defaultValue;\n }\n\n const pathArray = this.parsePath(property);\n if (!pathArray) {\n return defaultValue;\n }\n\n try {\n let current: unknown = model;\n\n for (const key of pathArray) {\n if (current == null) {\n return defaultValue;\n }\n const container = Object(current) as Record<string, unknown>;\n if (!Object.hasOwn(container, key)) {\n return defaultValue;\n }\n const descriptor = Object.getOwnPropertyDescriptor(container, key);\n if (!descriptor || !('value' in descriptor)) {\n // Never execute a getter from the view model.\n return defaultValue;\n }\n current = descriptor.value;\n }\n\n return current != null ? current : defaultValue;\n } catch {\n return defaultValue;\n }\n }\n\n /**\n * Sets the value at path of object. If a portion of path doesn't exist, it's created.\n * Arrays are created for missing index properties while objects are created for all other missing properties.\n * Only own properties are traversed and written; prototype-related segments are rejected.\n * This method mutates object.\n * @param model The object.\n * @param property The path.\n * @param value The value.\n */\n private setModelPropertyValue(model: unknown, property: Array<string> | string, value: unknown): void {\n if (model == null) {\n return;\n }\n\n const pathArray = this.parsePath(property);\n if (!pathArray) {\n return;\n }\n\n try {\n let current: any = model;\n\n for (let index = 0; index < pathArray.length; index++) {\n const key = pathArray[index];\n const isLast = index === pathArray.length - 1;\n\n if (!this.isMutableContainer(current)) {\n return;\n }\n\n if (isLast) {\n const descriptor = Object.getOwnPropertyDescriptor(current, key);\n if (descriptor && !('value' in descriptor)) {\n // Never overwrite an accessor (which could run its setter).\n return;\n }\n this.defineOwn(current, key, value);\n return;\n }\n\n const isNumericKey = /^\\d+$/.test(key);\n let existing: unknown;\n\n if (Object.hasOwn(current, key)) {\n const descriptor = Object.getOwnPropertyDescriptor(current, key);\n if (!descriptor || !('value' in descriptor)) {\n // Never traverse or overwrite an accessor property.\n return;\n }\n existing = descriptor.value;\n }\n\n if (existing == null) {\n // Create array if key is numeric, otherwise object.\n const next: unknown = isNumericKey ? [] : {};\n this.defineOwn(current, key, next);\n current = next;\n } else if (isNumericKey && !Array.isArray(existing)) {\n // Preserve existing objects with numeric keys instead of\n // discarding their data by replacing them with an array.\n if (existing !== null && typeof existing === 'object') {\n current = existing;\n } else {\n return;\n }\n } else if (!isNumericKey && typeof existing !== 'object') {\n const next: Record<string, unknown> = {};\n this.defineOwn(current, key, next);\n current = next;\n } else {\n current = existing;\n }\n }\n } catch (error) {\n this.logError('Error setting model property value.', error);\n }\n }\n\n /**\n * Updates specified input names to new values and resets inputs that were\n * removed from the configuration.\n */\n private setInputs(): void {\n if (!this._componentRef) {\n return;\n }\n\n const inputs = this.configuration()?.inputs;\n const currentNames = inputs && typeof inputs === 'object' ? Object.keys(inputs) : [];\n\n for (const inputName of Array.from(this._appliedInputs)) {\n if (!currentNames.includes(inputName)) {\n try {\n this._componentRef.setInput(inputName, undefined);\n } catch (error) {\n this.logError(`Error resetting dynamic input \"${inputName}\".`, error);\n }\n this._appliedInputs.delete(inputName);\n }\n }\n\n if (!inputs || typeof inputs !== 'object') {\n return;\n }\n\n for (const inputName of currentNames) {\n try {\n // Updates a specified input name to a new value.\n this._componentRef.setInput(inputName, this.evaluateExpression(inputs[inputName], this.getViewModelValue()));\n this._appliedInputs.add(inputName);\n } catch (error) {\n this.logError(`Error setting dynamic input \"${inputName}\".`, error);\n }\n }\n }\n\n /**\n * Set attribute values for an element in the DOM.\n *\n * Attribute names and values are validated: event handlers (`on*`),\n * namespaced attributes, `style`/`srcdoc`/`formaction` and unsafe URL\n * schemes are never applied. Non-primitive values are ignored so that\n * configuration data cannot invoke `toString()`/`toJSON()` hooks.\n *\n * Attributes removed from the configuration (or set to a false boolean /\n * `null`) are removed from the element.\n */\n private setAttributes(): void {\n const attributes = this.configuration()?.attributes;\n const element = this._componentRef?.location?.nativeElement;\n\n if (!element) {\n return;\n }\n\n const currentNames = attributes && typeof attributes === 'object' ? Object.keys(attributes) : [];\n\n // Remove attributes that were applied previously but are now absent.\n for (const attributeName of Array.from(this._appliedAttributes)) {\n if (!currentNames.includes(attributeName) || !this.isAllowedAttribute(attributeName)) {\n this._renderer.removeAttribute(element, attributeName);\n this._appliedAttributes.delete(attributeName);\n }\n }\n\n if (!attributes || typeof attributes !== 'object') {\n return;\n }\n\n for (const attributeName of currentNames) {\n if (!this.isAllowedAttribute(attributeName)) {\n this.logWarning(`Attribute \"${attributeName}\" is not allowed and was skipped.`);\n continue;\n }\n\n try {\n const rawValue = attributes[attributeName];\n const value = this.evaluateExpression(rawValue, this.getViewModelValue());\n\n // An unresolved `$vm`/`$event` expression must not be written as\n // a literal attribute value (which would be truthy/visible).\n if (this.isUnresolvedExpression(rawValue, value)) {\n continue;\n }\n\n const lower = attributeName.toLowerCase();\n\n if (BOOLEAN_ATTRIBUTES.has(lower)) {\n if (!this.toBoolean(value)) {\n this._renderer.removeAttribute(element, attributeName);\n this._appliedAttributes.delete(attributeName);\n } else if (element.getAttribute(attributeName) !== '') {\n this._renderer.setAttribute(element, attributeName, '');\n this._appliedAttributes.add(attributeName);\n } else {\n this._appliedAttributes.add(attributeName);\n }\n continue;\n }\n\n const stringValue = this.attributeValueToString(value);\n\n if (stringValue === undefined) {\n continue;\n }\n\n if (stringValue === null) {\n this._renderer.removeAttribute(element, attributeName);\n this._appliedAttributes.delete(attributeName);\n continue;\n }\n\n if (URL_ATTRIBUTES.has(lower) && !this.isSafeUrl(stringValue)) {\n this.logWarning(`Unsafe URL for attribute \"${attributeName}\" was ignored.`);\n continue;\n }\n\n // Returns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise.\n if (element.getAttribute(attributeName) !== stringValue) {\n this._renderer.setAttribute(element, attributeName, stringValue);\n }\n this._appliedAttributes.add(attributeName);\n } catch (error) {\n this.logError(`Error setting dynamic attribute \"${attributeName}\".`, error);\n }\n }\n }\n\n private isAllowedAttribute(name: string): boolean {\n if (typeof name !== 'string' || name.length === 0 || name.length > MAX_ATTRIBUTE_NAME_LENGTH) {\n return false;\n }\n\n const lower = name.toLowerCase();\n\n if (lower.startsWith('on')) {\n return false;\n }\n\n // Reject namespaces, whitespace and other non-standard attribute names.\n if (!/^[a-z][a-z0-9_.-]*$/i.test(name)) {\n return false;\n }\n\n if (this.attributePolicy()?.strict === true && STRICT_DISALLOWED_ATTRIBUTES.has(lower)) {\n return false;\n }\n\n if (lower.startsWith('data-') || lower.startsWith('aria-')) {\n return true;\n }\n\n return ALLOWED_ATTRIBUTES.has(lower);\n }\n\n /**\n * Returns `undefined` to skip the attribute entirely, `null` to remove it,\n * or a safe string value.\n */\n private attributeValueToString(value: unknown): string | null | undefined {\n if (value == null) {\n return null;\n }\n\n const type = typeof value;\n\n if (type !== 'string' && type !== 'number' && type !== 'boolean' && type !== 'bigint') {\n this.logWarning('Non-primitive attribute values are ignored.');\n return undefined;\n }\n\n const stringValue = String(value);\n\n if (stringValue.length > MAX_ATTRIBUTE_VALUE_LENGTH) {\n this.logWarning('Attribute value is too long and was ignored.');\n return undefined;\n }\n\n return stringValue;\n }\n\n private isSafeUrl(value: string): boolean {\n // Browsers ignore control characters and whitespace inside URL schemes.\n const normalized = value.replace(/[\\u0000-\\u0020\\u007f]/g, '').toLowerCase();\n\n if (normalized.length === 0) {\n return true;\n }\n\n // Protocol-relative URLs inherit the page scheme but can target any\n // origin, so they require the same opt-in as absolute external URLs.\n if (normalized.startsWith('//')) {\n return this.allowsExternalUrls();\n }\n\n const scheme = /^([a-z][a-z0-9+.-]*):/.exec(normalized);\n\n if (!scheme) {\n // Relative URL, fragment or query string.\n return true;\n }\n\n if (scheme[1] === 'mailto' || scheme[1] === 'tel') {\n return true;\n }\n\n if (scheme[1] !== 'http' && scheme[1] !== 'https') {\n return false;\n }\n\n return this.allowsExternalUrls() || this.isSameOriginUrl(value);\n }\n\n private allowsExternalUrls(): boolean {\n return this.attributePolicy()?.allowExternalUrls === true;\n }\n\n /**\n * Resolves `value` against the document base URL and compares origins. In a\n * non-browser environment absolute URLs are treated as external.\n */\n private isSameOriginUrl(value: string): boolean {\n if (typeof document === 'undefined' || !document.baseURI) {\n return false;\n }\n try {\n return new URL(value, document.baseURI).origin === new URL(document.baseURI).origin;\n } catch {\n return false;\n }\n }\n\n /**\n * Evaluates a configured attribute value and reports whether it is an\n * expression that could not be evaluated because its context was missing.\n */\n private evaluateAttribute(attributes: Record<string, unknown>, name: string): { value: unknown; unresolved: boolean } {\n const raw = attributes[name];\n const value = this.evaluateExpression(raw, this.getViewModelValue());\n return { value, unresolved: this.isUnresolvedExpression(raw, value) };\n }\n\n /**\n * True when a string expression was returned verbatim because its `$vm` or\n * `$event` context was not available. Such values must not be treated as\n * literal booleans/attributes/control names.\n */\n private isUnresolvedExpression(source: unknown, result: unknown): boolean {\n return typeof source === 'string'\n && result === source\n && EXPRESSION_CONTEXT_PATTERN.test(source);\n }\n\n /**\n * Normalizes boolean-ish configuration values. `false`, `'false'`, `0`,\n * `'0'`, `''`, `null` and `undefined` are false; everything else is true.\n */\n private toBoolean(value: unknown): boolean {\n if (typeof value === 'boolean') {\n return value;\n }\n if (typeof value === 'number') {\n return value !== 0 && !Number.isNaN(value);\n }\n if (typeof value === 'string') {\n const normalized = value.trim().toLowerCase();\n return normalized !== '' && normalized !== 'false' && normalized !== '0'\n && normalized !== 'null' && normalized !== 'undefined';\n }\n return value != null;\n }\n\n /**\n * Evaluates an expression with a small, allowlisted interpreter. No `eval`,\n * `Function` or other string-to-code primitive is used.\n * @param value The expression or literal value.\n * @param viewModelValue The resolved view model value.\n * @param eventParam The event payload.\n * @param hasEventContext Whether an event is currently being handled. This\n * distinguishes \"no event\" from an output that emitted `null`/`undefined`.\n * @returns Evaluated expression, `undefined` when the expression is rejected,\n * or the original value when it is a literal/unresolved expression.\n */\n private evaluateExpression(value: unknown, viewModelValue?: unknown, eventParam?: unknown, hasEventContext = false): unknown {\n if (typeof value !== 'string') {\n return value;\n }\n\n const hasVm = VM_EXPRESSION_PATTERN.test(value);\n const hasEvent = EVENT_EXPRESSION_PATTERN.test(value);\n\n if (!hasVm && !hasEvent) {\n return value;\n }\n\n if (hasVm && viewModelValue == null) {\n return value;\n }\n\n if (hasEvent && !hasEventContext) {\n return value;\n }\n\n try {\n const policy = this.expressionPolicy() ?? {};\n const allowedMethods: (string | FGDynamicAllowedMethod)[] = Array.isArray(policy.allowedMethods)\n ? [...policy.allowedMethods]\n : [];\n\n // Expose the view model as a callable (`$vm()`). The ModelSignal\n // helpers are only attached when the host opts into mutation.\n const $vm: any = (): unknown => this.getViewModelValue();\n\n if (policy.allowViewModelMutation === true) {\n $vm.set = (nextValue: unknown): void => {\n this.viewModel.set(nextValue);\n };\n $vm.update = (updateFn: (current: unknown) => unknown): void => {\n this.viewModel.update(updateFn);\n };\n allowedMethods.push('set');\n allowedMethods.push('update');\n }\n\n return evaluateSafeExpression(value, {\n $vm,\n $event: eventParam,\n $ev: eventParam\n }, {\n allowCustomMethods: policy.allowCustomMethods === true,\n allowedMethods\n });\n } catch {\n this.logWarning('Expression could not be evaluated safely and was ignored.');\n return undefined;\n }\n }\n\n private getViewModelValue(): unknown {\n const model = this.viewModel;\n return typeof model === 'function' ? (model as () => unknown)() : model;\n }\n\n private logWarning(message: string): void {\n if (isDevMode()) {\n console.warn(`[fg-dynamic] ${message}`);\n }\n }\n\n private logError(message: string, error?: unknown): void {\n if (!isDevMode()) {\n return;\n }\n const detail = error instanceof Error ? ` (${error.name})` : '';\n console.error(`[fg-dynamic] ${message}${detail}`);\n }\n\n /**\n * Cleans up every dynamically created resource: subscriptions, form control, value accessor directive and component reference.\n * Used both on component type change and on destroy.\n */\n private cleanup(): void {\n // Disposes the resources held by the output subscriptions.\n if (this._outputsSubscriptions) {\n this._outputsSubscriptions.forEach((s: { unsubscribe(): void }): void => {\n try {\n s.unsubscribe();\n } catch (e) {\n // Ignore\n }\n });\n }\n\n this._outputsSubscriptions = [];\n this._currentOutputsConfig = undefined;\n\n // Disposes the resources held by the form control subscription.\n if (this._formControlSubscription) {\n try {\n this._formControlSubscription.unsubscribe();\n } catch (e) {\n // Ignore\n }\n }\n\n this._formControlSubscription = undefined;\n\n // Remove validators added by this component. Owned controls are removed\n // below, but reused controls stay in their group and must not keep them.\n if (this._formControl && this._managedValidatorFns.length > 0) {\n try {\n this._formControl.removeValidators(this._managedValidatorFns);\n this._formControl.updateValueAndValidity({ emitEvent: false });\n } catch (error) {\n this.logError('Error removing managed validators.', error);\n }\n }\n\n // Restore the disabled state of reused controls before detaching.\n this.restoreManagedDisabledState();\n\n // A callback method that performs custom clean-up, invoked immediately before a directive, pipe, or service instance is destroyed.\n if (this._formControlDirective) {\n try {\n this._formControlDirective.ngOnDestroy();\n } catch (e) {\n // Ignore\n }\n }\n\n this._formControlDirective = undefined;\n\n // Remove the managed control from the exact group/key it was wired to.\n // Only owned controls are removed; pre-existing controls are left intact.\n if (this._ownsFormControl && this._formControl && this._formControlContainer && this._formControlKey) {\n try {\n if (this._formControlContainer.get(this._formControlKey) === this._formControl) {\n this._formControlContainer.removeControl(this._formControlKey);\n }\n } catch (e) {\n // Ignore\n }\n }\n\n // Remove intermediate groups created for dotted names, deepest first,\n // but only if they are still empty and still attached to the parent.\n this.pruneCreatedFormGroups();\n this._createdFormGroups = [];\n this._formControl = undefined;\n this._formControlContainer = undefined;\n this._formControlKey = undefined;\n this._ownsFormControl = false;\n this._disabledManaged = false;\n this._disabledBeforeManagement = undefined;\n this._wiredFormGroup = undefined;\n this._wiredControlName = undefined;\n this._wiredAllowExistingControls = undefined;\n this._hasSyncedControlValue = false;\n this._lastSyncedControlValue = undefined;\n this._managedValidatorFns = [];\n this._appliedAttributes.clear();\n this._appliedInputs.clear();\n\n // Destroys the component instance and all of the data structures associated with it.\n if (this._componentRef) {\n try {\n this._componentRef.destroy();\n } catch (e) {\n // Ignore\n }\n }\n\n this._componentRef = undefined;\n }\n\n /**\n * A callback method that performs custom clean-up, invoked immediately before a directive, pipe, or service instance is destroyed.\n */\n\tngOnDestroy(): void {\n this._destroyed = true;\n this._ngOnChangesCounter++;\n this.cleanup();\n\t}\n}\n"],"mappings":";;;AA0BA,MAAM,oBAAoB;AAC1B,MAAM,aAAa;AACnB,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAC7B,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;AAuCzB,MAAM,yCAA8C,IAAI,IAAI;CAAC;CAAO;CAAU;AAAK,CAAC;AAGpF,MAAM,uCAA4C,IAAI,IAAI;CACtD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACH,CAAA;AAOD,MAAM,sCAA6C,IAAI,IAAc;CACjE,MAAM,UAAU;CAChB,MAAM,UAAU;CAChB,MAAM,UAAU;CAChB,MAAM,UAAU;CAChB,MAAM,UAAU;CAChB,MAAM,UAAU;CAChB,MAAM,UAAU;CAChB,MAAM,UAAU;CAChB,MAAM,UA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