UNPKG

@angular/forms

Version:

Angular - directives and services for creating forms

1 lines 198 kB
{"version":3,"file":"signals.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/assertions.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/field/di.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/di.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/disabled.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/hidden.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/readonly.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/util.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/validate.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/validation_errors.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/email.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/max.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/max_date.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/max_length.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/min.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/min_date.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/min_length.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/pattern.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/required.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/validate_async.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/validate_tree.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/standard_schema.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/validation/validate_http.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/rules/debounce.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/util/parser.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/api/transformed_value.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/controls/interop_ng_control.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/bindings.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/native.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/control_custom.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/control_cva.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/select.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/control_native.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/input_validity_monitor.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/form_field.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/directive/form_root.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/forms/signals/src/webmcp/registration.ts"],"sourcesContent":["/*!\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {FIELD_TREE} from './symbols';\nimport type {FieldTree} from './types';\n\n/**\n * Asserts whether a value is a `FieldTree`.\n * @param value Value to be checked.\n *\n * @publicApi 22.1\n */\nexport function isFieldTree(value: unknown): value is FieldTree<unknown> {\n  return typeof value === 'function' && (value as any)[FIELD_TREE] === true;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {InjectionToken} from '@angular/core';\nimport type {SignalFormsConfig} from '../api/di';\n\n/** Injection token for the signal forms configuration. */\nexport const SIGNAL_FORMS_CONFIG = new InjectionToken<SignalFormsConfig>(\n  typeof ngDevMode !== 'undefined' && ngDevMode ? 'SIGNAL_FORMS_CONFIG' : '',\n);\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {type Provider} from '@angular/core';\nimport type {FormFieldBinding} from '../api/types';\nimport {SIGNAL_FORMS_CONFIG} from '../field/di';\n\n/**\n * Configuration options for signal forms.\n *\n * @see [Automatic status classes](guide/forms/signals/migration#automatic-status-classes)\n *\n * @publicApi 22.0\n */\nexport interface SignalFormsConfig {\n  /** A map of CSS class names to predicate functions that determine when to apply them. */\n  classes?: {\n    [className: string]: (formField: FormFieldBinding) => boolean;\n  };\n}\n\n/**\n * Provides configuration options for signal forms.\n *\n * @see [Automatic status classes](guide/forms/signals/migration#automatic-status-classes)\n *\n * @publicApi 22.0\n */\nexport function provideSignalFormsConfig(config: SignalFormsConfig): Provider[] {\n  return [{provide: SIGNAL_FORMS_CONFIG, useValue: config}];\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {FieldPathNode} from '../../schema/path_node';\nimport {assertPathIsCurrent} from '../../schema/schema';\nimport type {FieldContext, LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../types';\n\n/**\n * Adds logic to a field to conditionally disable it. A disabled field does not contribute to the\n * validation, touched/dirty, or other state of its parent field.\n *\n * @param path The target path to add the disabled logic to.\n * @param config Optional configuration object.\n *  - `when`: A reactive function that returns `true` (or a string reason) when the field is disabled,\n *    and `false` when it is not disabled. Can also be a static string reason.\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Disabled fields](guide/forms/signals/form-logic#prevent-field-updates-with-disabled)\n * @see [Availability state](guide/forms/signals/field-state-management#availability-state)\n *\n * @category logic\n * @publicApi 22.0\n */\nexport function disabled<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  config?: {when?: string | NoInfer<LogicFn<TValue, boolean | string, TPathKind>>},\n): void;\n\n/**\n * Adds logic to a field to conditionally disable it.\n *\n * @deprecated Passing a function or string directly to `disabled` is deprecated. Use `{ when: ... }` instead.\n */\nexport function disabled<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  logic?: string | NoInfer<LogicFn<TValue, boolean | string, TPathKind>>,\n): void;\n\nexport function disabled<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  configOrLogic?:\n    | {when?: string | NoInfer<LogicFn<TValue, boolean | string, TPathKind>>}\n    | string\n    | NoInfer<LogicFn<TValue, boolean | string, TPathKind>>,\n): void {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n\n  let logic: string | LogicFn<TValue, boolean | string, TPathKind> | undefined;\n  if (typeof configOrLogic === 'function' || typeof configOrLogic === 'string') {\n    logic = configOrLogic;\n  } else {\n    logic = configOrLogic?.when;\n  }\n\n  pathNode.builder.addDisabledReasonRule((ctx) => {\n    let result: boolean | string = true;\n    if (typeof logic === 'string') {\n      result = logic;\n    } else if (logic) {\n      result = logic(ctx as FieldContext<TValue, TPathKind>);\n    }\n    if (typeof result === 'string') {\n      return {fieldTree: ctx.fieldTree, message: result};\n    }\n    return result ? {fieldTree: ctx.fieldTree} : undefined;\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {FieldPathNode} from '../../schema/path_node';\nimport {assertPathIsCurrent} from '../../schema/schema';\nimport type {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../types';\n\n/**\n * Adds logic to a field to conditionally hide it. A hidden field does not contribute to the\n * validation, touched/dirty, or other state of its parent field.\n *\n * If a field may be hidden it is recommended to guard it with an `@if` in the template:\n * ```\n * @if (!email().hidden()) {\n *   <label for=\"email\">Email</label>\n *   <input id=\"email\" type=\"email\" [control]=\"email\" />\n * }\n * ```\n *\n * @param path The target path to add the hidden logic to.\n * @param config Options object containing the `when` condition.\n *  - `when`: A reactive function that returns `true` when the field is hidden.\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Hidden fields](guide/forms/signals/form-logic#configuring-hidden-state-on-fields)\n * @see [Availability state](guide/forms/signals/field-state-management#availability-state)\n *\n * @category logic\n * @publicApi 22.0\n */\nexport function hidden<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  config: {when: NoInfer<LogicFn<TValue, boolean, TPathKind>>},\n): void;\n\n/**\n * Adds logic to a field to conditionally hide it.\n *\n * @deprecated Passing a function directly to `hidden` is deprecated. Use `{ when: ... }` instead.\n */\nexport function hidden<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  logic: NoInfer<LogicFn<TValue, boolean, TPathKind>>,\n): void;\n\nexport function hidden<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  configOrLogic:\n    | {when: NoInfer<LogicFn<TValue, boolean, TPathKind>>}\n    | NoInfer<LogicFn<TValue, boolean, TPathKind>>,\n): void {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n\n  const logic = typeof configOrLogic === 'function' ? configOrLogic : configOrLogic.when;\n\n  pathNode.builder.addHiddenRule(logic);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {FieldPathNode} from '../../schema/path_node';\nimport {assertPathIsCurrent} from '../../schema/schema';\nimport type {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../types';\n\n/**\n * Adds logic to a field to conditionally make it readonly. A readonly field does not contribute to\n * the validation, touched/dirty, or other state of its parent field.\n *\n * @param path The target path to make readonly.\n * @param config Optional configuration object.\n *  - `when`: A reactive function that returns `true` when the field is readonly.\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Readonly fields](guide/forms/signals/form-logic#display-uneditable-fields-with-readonly)\n * @see [Availability state](guide/forms/signals/field-state-management#availability-state)\n *\n * @category logic\n * @publicApi 22.0\n */\nexport function readonly<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  config?: {when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>},\n): void;\n\n/**\n * Adds logic to a field to conditionally make it readonly.\n *\n * @deprecated Passing a function directly to `readonly` is deprecated. Use `{ when: ... }` instead.\n */\nexport function readonly<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  logic?: NoInfer<LogicFn<TValue, boolean, TPathKind>>,\n): void;\n\nexport function readonly<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  configOrLogic?:\n    | {when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>}\n    | NoInfer<LogicFn<TValue, boolean, TPathKind>>,\n): void {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n\n  const logic =\n    typeof configOrLogic === 'function' ? configOrLogic : (configOrLogic?.when ?? (() => true));\n\n  pathNode.builder.addReadonlyRule(logic);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {LogicFn, OneOrMany, PathKind, type FieldContext} from '../../types';\nimport {ValidationError} from './validation_errors';\n\n/** Represents a value that has a length or size, such as an array or string, or set. */\nexport type ValueWithLengthOrSize = {length: number} | {size: number};\n\n/** Common options available on the standard validators. */\nexport type BaseValidatorConfig<TValue, TPathKind extends PathKind = PathKind.Root> =\n  | {\n      /** A user-facing error message to include with the error. */\n      message?: string | LogicFn<TValue, string, TPathKind>;\n      error?: never;\n      /** A function that receives the `FieldContext` and returns true if the validator should be applied. */\n      when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;\n    }\n  | {\n      /**\n       * Custom validation error(s) to report instead of the default,\n       * or a function that receives the `FieldContext` and returns custom validation error(s).\n       */\n      error?: OneOrMany<ValidationError> | LogicFn<TValue, OneOrMany<ValidationError>, TPathKind>;\n      message?: never;\n      /** A function that receives the `FieldContext` and returns true if the validator should be applied. */\n      when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;\n    };\n\n/** Gets the length or size of the given value. */\nexport function getLengthOrSize(value: ValueWithLengthOrSize) {\n  const v = value as {length: number; size: number};\n  return typeof v.length === 'number' ? v.length : v.size;\n}\n\n/**\n * Gets the value for an option that may be either a static value or a logic function that produces\n * the option value.\n *\n * @param opt The option from BaseValidatorConfig.\n * @param ctx The current FieldContext.\n * @returns The value for the option.\n */\nexport function getOption<TOption, TValue, TPathKind extends PathKind = PathKind.Root>(\n  opt: Exclude<TOption, Function> | LogicFn<TValue, TOption, TPathKind> | undefined,\n  ctx: FieldContext<TValue, TPathKind>,\n): TOption | undefined {\n  return opt instanceof Function ? opt(ctx) : opt;\n}\n\n/**\n * Checks if the given value is considered empty. Empty values are: null, undefined, '', false, NaN.\n */\nexport function isEmpty(value: unknown): boolean {\n  if (typeof value === 'number') {\n    return isNaN(value);\n  }\n  return value === '' || value === false || value == null;\n}\n\n/**\n * Normalizes validation errors (which can be a single error, an array of errors, or undefined)\n * into a list of errors.\n */\nexport function normalizeErrors<T>(error: OneOrMany<T> | undefined): readonly T[] {\n  if (error === undefined) {\n    return [];\n  }\n  if (Array.isArray(error)) {\n    return error as readonly T[];\n  }\n  return [error as T];\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {addDefaultField} from '../../../field/validation';\nimport {FieldPathNode} from '../../../schema/path_node';\nimport {assertPathIsCurrent} from '../../../schema/schema';\nimport type {\n  FieldContext,\n  FieldValidator,\n  PathKind,\n  SchemaPath,\n  SchemaPathRules,\n} from '../../types';\n\n/**\n * Adds logic to a field to determine if the field has validation errors.\n *\n * @param path The target path to add the validation logic to.\n * @param logic A `Validator` that returns the current validation errors.\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Custom validation rules](guide/forms/signals/validation#using-validate)\n *\n * @category logic\n * @publicApi 22.0\n */\nexport function validate<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  logic: NoInfer<FieldValidator<TValue, TPathKind>>,\n): void {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n  pathNode.builder.addSyncErrorRule((ctx) => {\n    return addDefaultField(logic(ctx as FieldContext<TValue, TPathKind>), ctx.fieldTree);\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type {FormField} from '../../../directive/form_field';\nimport type {ReadonlyFieldTree} from '../../types';\nimport type {StandardSchemaValidationError} from './standard_schema';\n\n/**\n * Options used to create a `ValidationError`.\n */\nexport interface ValidationErrorOptions {\n  /** Human readable error message. */\n  message?: string;\n}\n\n/**\n * A type that requires the given type `T` to have a `field` property.\n * @template T The type to add a `field` to.\n *\n * @see [Validation errors](guide/forms/signals/validation#validation-errors)\n *\n * @publicApi 22.0\n */\nexport type WithFieldTree<T> = T & {fieldTree: ReadonlyFieldTree<unknown>};\n\n/**\n * A type that allows the given type `T` to optionally have a `field` property.\n * @template T The type to optionally add a `field` to.\n *\n * @see [Validation errors](guide/forms/signals/validation#validation-errors)\n *\n * @publicApi 22.0\n */\nexport type WithOptionalFieldTree<T> = Omit<T, 'fieldTree'> & {\n  fieldTree?: ReadonlyFieldTree<unknown>;\n};\n\n/**\n * A type that ensures the given type `T` does not have a `field` property.\n * @template T The type to remove the `field` from.\n *\n * @see [Validation errors](guide/forms/signals/validation#validation-errors)\n *\n * @publicApi 22.0\n */\nexport type WithoutFieldTree<T> = T & {fieldTree: never};\n\n/**\n * Create a required error associated with the target field\n * @param options The validation error options\n *\n * @see [Required validation](guide/forms/signals/validation#required)\n *\n * @publicApi 22.0\n */\nexport function requiredError(\n  options: WithFieldTree<ValidationErrorOptions>,\n): RequiredValidationError;\n/**\n * Create a required error\n * @param options The optional validation error options\n *\n * @see [Required validation](guide/forms/signals/validation#required)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function requiredError(\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<RequiredValidationError>;\nexport function requiredError(\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<RequiredValidationError> {\n  return new RequiredValidationError(options);\n}\n\n/**\n * Create a min value error associated with the target field\n * @param min The min value constraint\n * @param options The validation error options\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minError(\n  min: number,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MinValidationError;\n/**\n * Create a min value error\n * @param min The min value constraint\n * @param options The optional validation error options\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minError(\n  min: number,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MinValidationError>;\nexport function minError(\n  min: number,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MinValidationError> {\n  return new MinValidationError(min, options);\n}\n\n/**\n * Create a minDate error associated with the target field\n * @param minDate The min date constraint\n * @param options The validation error options\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minDateError(\n  minDate: Date,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MinDateValidationError;\n/**\n * Create a minDate error\n * @param minDate The min date constraint\n * @param options The optional validation error options\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minDateError(\n  minDate: Date,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MinDateValidationError>;\nexport function minDateError(\n  minDate: Date,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MinDateValidationError> {\n  return new MinDateValidationError(minDate, options);\n}\n\n/**\n * Create a max value error associated with the target field\n * @param max The max value constraint\n * @param options The validation error options\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxError(\n  max: number,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MaxValidationError;\n/**\n * Create a max value error\n * @param max The max value constraint\n * @param options The optional validation error options\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxError(\n  max: number,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MaxValidationError>;\nexport function maxError(\n  max: number,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MaxValidationError> {\n  return new MaxValidationError(max, options);\n}\n\n/**\n * Create a maxDate error associated with the target field\n * @param maxDate The max date constraint\n * @param options The validation error options\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxDateError(\n  maxDate: Date,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MaxDateValidationError;\n/**\n * Create a maxDate error\n * @param maxDate The max date constraint\n * @param options The optional validation error options\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxDateError(\n  maxDate: Date,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MaxDateValidationError>;\nexport function maxDateError(\n  maxDate: Date,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MaxDateValidationError> {\n  return new MaxDateValidationError(maxDate, options);\n}\n\n/**\n * Create a minLength error associated with the target field\n * @param minLength The minLength constraint\n * @param options The validation error options\n *\n * @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minLengthError(\n  minLength: number,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MinLengthValidationError;\n/**\n * Create a minLength error\n * @param minLength The minLength constraint\n * @param options The optional validation error options\n *\n * @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function minLengthError(\n  minLength: number,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MinLengthValidationError>;\nexport function minLengthError(\n  minLength: number,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MinLengthValidationError> {\n  return new MinLengthValidationError(minLength, options);\n}\n\n/**\n * Create a maxLength error associated with the target field\n * @param maxLength The maxLength constraint\n * @param options The validation error options\n *\n * @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxLengthError(\n  maxLength: number,\n  options: WithFieldTree<ValidationErrorOptions>,\n): MaxLengthValidationError;\n/**\n * Create a maxLength error\n * @param maxLength The maxLength constraint\n * @param options The optional validation error options\n *\n * @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function maxLengthError(\n  maxLength: number,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<MaxLengthValidationError>;\nexport function maxLengthError(\n  maxLength: number,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<MaxLengthValidationError> {\n  return new MaxLengthValidationError(maxLength, options);\n}\n\n/**\n * Create a pattern matching error associated with the target field\n * @param pattern The violated pattern\n * @param options The validation error options\n *\n * @see [Pattern validation](guide/forms/signals/validation#pattern)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function patternError(\n  pattern: RegExp,\n  options: WithFieldTree<ValidationErrorOptions>,\n): PatternValidationError;\n/**\n * Create a pattern matching error\n * @param pattern The violated pattern\n * @param options The optional validation error options\n *\n * @see [Pattern validation](guide/forms/signals/validation#pattern)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function patternError(\n  pattern: RegExp,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<PatternValidationError>;\nexport function patternError(\n  pattern: RegExp,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<PatternValidationError> {\n  return new PatternValidationError(pattern, options);\n}\n\n/**\n * Create an email format error associated with the target field\n * @param options The validation error options\n *\n * @see [Email validation](guide/forms/signals/validation#email)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function emailError(options: WithFieldTree<ValidationErrorOptions>): EmailValidationError;\n/**\n * Create an email format error\n * @param options The optional validation error options\n *\n * @see [Email validation](guide/forms/signals/validation#email)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function emailError(\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<EmailValidationError>;\nexport function emailError(\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<EmailValidationError> {\n  return new EmailValidationError(options);\n}\n\n/**\n * Common interface for all validation errors.\n *\n * This can be returned from validators.\n *\n * It's also used by the creation functions to create an instance\n * (e.g. `requiredError`, `minError`, etc.).\n *\n * @see [Signal Form Validation](guide/forms/signals/validation)\n * @see [Signal Form Validation Errors](guide/forms/signals/validation#validation-errors)\n * @category validation\n * @publicApi 22.0\n */\nexport interface ValidationError {\n  /** Identifies the kind of error. */\n  readonly kind: string;\n  /** Human readable error message. */\n  readonly message?: string;\n}\n\nexport declare namespace ValidationError {\n  /**\n   * Validation error with an associated field tree.\n   *\n   * This is returned from field state, e.g., catField.errors() would be of a list of errors with\n   * `field: catField` bound to state.\n   */\n  export interface WithFieldTree extends ValidationError {\n    /** The field associated with this error. */\n    readonly fieldTree: ReadonlyFieldTree<unknown>;\n    readonly formField?: FormField<unknown>;\n  }\n  /** @deprecated Use `ValidationError.WithFieldTree` instead  */\n  export type WithField = WithFieldTree;\n\n  /**\n   * Validation error with an associated field tree and specific form field binding.\n   */\n  export interface WithFormField extends WithFieldTree {\n    readonly formField: FormField<unknown>;\n  }\n\n  /**\n   * Validation error with optional field.\n   *\n   * This is generally used in places where the result might have a field.\n   * e.g., as a result of a `validateTree`, or when handling form submission.\n   */\n  export interface WithOptionalFieldTree extends ValidationError {\n    /** The field associated with this error. */\n    readonly fieldTree?: ReadonlyFieldTree<unknown>;\n  }\n  /** @deprecated Use `ValidationError.WithOptionalFieldTree` instead  */\n  export type WithOptionalField = WithOptionalFieldTree;\n\n  /**\n   * Validation error with no field.\n   *\n   * This is used to strongly enforce that fields are not allowed in validation result.\n   */\n  export interface WithoutFieldTree extends ValidationError {\n    /** The field associated with this error. */\n    readonly fieldTree?: never;\n    readonly formField?: never;\n  }\n  /** @deprecated Use `ValidationError.WithoutFieldTree` instead  */\n  export type WithoutField = WithoutFieldTree;\n}\n\n/**\n * Internal version of `NgValidationError`, we create this separately so we can change its type on\n * the exported version to a type union of the possible sub-classes.\n *\n * @see [Signal Form Validation Errors](guide/forms/signals/validation#validation-errors)\n *\n * @publicApi 22.0\n */\nexport abstract class BaseNgValidationError implements ValidationError {\n  /** Brand the class to avoid Typescript structural matching */\n  private __brand = undefined;\n\n  /** Identifies the kind of error. */\n  readonly kind: string = '';\n\n  /** The field associated with this error. */\n  readonly fieldTree!: ReadonlyFieldTree<unknown>;\n\n  /** Human readable error message. */\n  readonly message?: string;\n\n  constructor(options?: ValidationErrorOptions) {\n    if (options) {\n      Object.assign(this, options);\n    }\n  }\n}\n\n/**\n * An error used to indicate that a required field is empty.\n *\n * @see [Required validation](guide/forms/signals/validation#required)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class RequiredValidationError extends BaseNgValidationError {\n  override readonly kind = 'required';\n}\n\n/**\n * An error used to indicate that a value is lower than the minimum allowed.\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MinValidationError extends BaseNgValidationError {\n  override readonly kind = 'min';\n\n  constructor(\n    readonly min: number,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a date value is earlier than the minimum allowed.\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MinDateValidationError extends BaseNgValidationError {\n  override readonly kind = 'minDate';\n\n  constructor(\n    readonly minDate: Date,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a value is higher than the maximum allowed.\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MaxValidationError extends BaseNgValidationError {\n  override readonly kind = 'max';\n\n  constructor(\n    readonly max: number,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a date value is later than the maximum allowed.\n *\n * @see [Minimum and maximum validation](guide/forms/signals/validation#min-and-max)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MaxDateValidationError extends BaseNgValidationError {\n  override readonly kind = 'maxDate';\n\n  constructor(\n    readonly maxDate: Date,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a value is shorter than the minimum allowed length.\n *\n * @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MinLengthValidationError extends BaseNgValidationError {\n  override readonly kind = 'minLength';\n\n  constructor(\n    readonly minLength: number,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a value is longer than the maximum allowed length.\n *\n * @see [Minimum and maximum length validation](guide/forms/signals/validation#minlength-and-maxlength)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class MaxLengthValidationError extends BaseNgValidationError {\n  override readonly kind = 'maxLength';\n\n  constructor(\n    readonly maxLength: number,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a value does not match the required pattern.\n *\n * @see [Pattern validation](guide/forms/signals/validation#pattern)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class PatternValidationError extends BaseNgValidationError {\n  override readonly kind = 'pattern';\n\n  constructor(\n    readonly pattern: RegExp,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n\n/**\n * An error used to indicate that a value is not a valid email.\n *\n * @see [Email validation](guide/forms/signals/validation#email)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class EmailValidationError extends BaseNgValidationError {\n  override readonly kind = 'email';\n}\n\n/**\n * An error used to indicate that a value entered in a native input does not parse.\n *\n * @see [Value transformation](guide/forms/signals/custom-controls#value-transformation)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class NativeInputParseError extends BaseNgValidationError {\n  override readonly kind = 'parse';\n}\n\n/**\n * The base class for all built-in, non-custom errors. This class can be used to check if an error\n * is one of the standard kinds, allowing you to switch on the kind to further narrow the type.\n *\n * @example\n * ```ts\n * const f = form(...);\n * for (const e of form().errors()) {\n *   if (e instanceof NgValidationError) {\n *     switch(e.kind) {\n *       case 'required':\n *         console.log('This is required!');\n *         break;\n *       case 'min':\n *         console.log(`Must be at least ${e.min}`);\n *         break;\n *       ...\n *     }\n *   }\n * }\n * ```\n *\n * @see [Signal Form Validation Errors](guide/forms/signals/validation#validation-errors)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport const NgValidationError: abstract new () => NgValidationError = BaseNgValidationError as any;\nexport type NgValidationError =\n  | RequiredValidationError\n  | MinValidationError\n  | MinDateValidationError\n  | MaxValidationError\n  | MaxDateValidationError\n  | MinLengthValidationError\n  | MaxLengthValidationError\n  | PatternValidationError\n  | EmailValidationError\n  | StandardSchemaValidationError\n  | NativeInputParseError;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {BaseValidatorConfig, getOption, isEmpty} from './util';\nimport {validate} from './validate';\nimport {emailError} from './validation_errors';\n\n/**\n * A regular expression that matches valid e-mail addresses.\n *\n * At a high level, this regexp matches e-mail addresses of the format `local-part@tld`, where:\n * - `local-part` consists of one or more of the allowed characters (alphanumeric and some\n *   punctuation symbols).\n * - `local-part` cannot begin or end with a period (`.`).\n * - `local-part` cannot be longer than 64 characters.\n * - `tld` consists of one or more `labels` separated by periods (`.`). For example `localhost` or\n *   `foo.com`.\n * - A `label` consists of one or more of the allowed characters (alphanumeric, dashes (`-`) and\n *   periods (`.`)).\n * - A `label` cannot begin or end with a dash (`-`) or a period (`.`).\n * - A `label` cannot be longer than 63 characters.\n * - The whole address cannot be longer than 254 characters.\n *\n * ## Implementation background\n *\n * This regexp was ported over from AngularJS (see there for git history):\n * https://github.com/angular/angular.js/blob/c133ef836/src/ng/directive/input.js#L27\n * It is based on the\n * [WHATWG version](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address) with\n * some enhancements to incorporate more RFC rules (such as rules related to domain names and the\n * lengths of different parts of the address). The main differences from the WHATWG version are:\n *   - Disallow `local-part` to begin or end with a period (`.`).\n *   - Disallow `local-part` length to exceed 64 characters.\n *   - Disallow total address length to exceed 254 characters.\n *\n * See [this commit](https://github.com/angular/angular.js/commit/f3f5cf72e) for more details.\n */\nconst EMAIL_REGEXP =\n  /^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n\n/**\n * Binds a validator to the given path that requires the value to match the standard email format.\n * This function can only be called on string paths.\n *\n * @param path Path of the field to validate\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.email()`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Email Validation](guide/forms/signals/validation#email)\n * @category validation\n * @publicApi 22.0\n */\nexport function email<TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>,\n  config?: BaseValidatorConfig<string, TPathKind>,\n) {\n  validate(path, (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    if (isEmpty(ctx.value())) {\n      return undefined;\n    }\n    if (!EMAIL_REGEXP.test(ctx.value())) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return emailError({message: getOption(config?.message, ctx)});\n      }\n    }\n\n    return undefined;\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, MAX, MAX_NUMBER, metadata, LimitKey} from '../metadata';\nimport {BaseValidatorConfig, getOption} from './util';\nimport {validate} from './validate';\nimport {maxError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to be less than or equal to the\n * given `maxValue`.\n * This function can only be called on number paths.\n * This function can only be called on number paths.\n * In addition to binding a validator, this function adds `MAX` property to the field.\n *\n * @param path Path of the field to validate\n * @param maxValue The maximum value, or a LogicFn that returns the maximum value.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.max(maxValue)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Max Validation](guide/forms/signals/validation#min-and-max)\n * @category validation\n * @publicApi 22.0\n */\nexport function max<TValue extends number | null, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  maxValue: number | LogicFn<TValue, number | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n): void {\n  const MAX_MEMO = createMetadataKey<number | undefined>();\n\n  // Memoize the maximum valid value.\n  metadata(path, MAX_MEMO, (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof maxValue === 'function' ? maxValue(ctx) : maxValue;\n  });\n\n  // Publish the memoized maximum value for aggregation.\n  metadata(path, MAX_NUMBER, ({state}) => state.metadata(MAX_MEMO)!());\n\n  // Use `MAX_NUMBER` to define the `max` property of the field.\n  metadata(path, MAX, () => MAX_NUMBER as LimitKey<TValue>);\n  validate(path, (ctx) => {\n    const value = ctx.value();\n    if (value === null || Number.isNaN(value)) {\n      return undefined;\n    }\n    const max = ctx.state.metadata(MAX_MEMO)!();\n    if (max === undefined || Number.isNaN(max)) {\n      return undefined;\n    }\n    if (value > max) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return maxError(max, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, LimitKey, MAX, MAX_DATE, metadata} from '../metadata';\nimport {BaseValidatorConfig, getOption} from './util';\nimport {validate} from './validate';\nimport {maxDateError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to be less than or equal to the\n * given `maxDate`.\n * This function can only be called on date paths.\n * In addition to binding a validator, this function adds `MAX` property to the field.\n *\n * @param path Path of the field to validate\n * @param maxDate The maximum date, or a LogicFn that returns the maximum date.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.max(maxDate)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Max Validation](guide/forms/signals/validation#min-and-max)\n * @category validation\n * @publicApi 22.0\n */\nexport function maxDate<TValue extends Date | null, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  maxDateValue: Date | LogicFn<TValue, Date | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n): void {\n  const MAX_MEMO = createMetadataKey<Date | undefined>();\n\n  // Memoize the maximum valid date.\n  metadata(path, MAX_MEMO, (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof maxDateValue === 'function' ? maxDateValue(ctx) : maxDateValue;\n  });\n\n  // Publish the memoized maximum date for aggregation.\n  metadata(path, MAX_DATE, ({state}) => state.metadata(MAX_MEMO)!());\n\n  // Use `MAX_DATE` to define the `max` property of the field.\n  metadata(path, MAX, () => MAX_DATE as LimitKey<TValue>);\n\n  // Validate that the field value is not greater than the maximum date.\n  validate(path, (ctx) => {\n    const value = ctx.value();\n    if (value === null || Number.isNaN(value.getTime())) {\n      return undefined;\n    }\n    const max = ctx.state.metadata(MAX_MEMO)!();\n    if (max === undefined || Number.isNaN(max.getTime())) {\n      return undefined;\n    }\n    if (value > max) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return maxDateError(max, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, MAX_LENGTH, metadata} from '../metadata';\nimport {\n  BaseValidatorConfig,\n  getLengthOrSize,\n  getOption,\n  isEmpty,\n  ValueWithLengthOrSize,\n} from './util';\nimport {validate} from './validate';\nimport {maxLengthError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the length of the value to be less than or\n * equal to the given `maxLength`.\n * This function can only be called on string or array paths.\n * In addition to binding a validator, this function adds `MAX_LENGTH` property to the field.\n *\n * @param path Path of the field to validate\n * @param maxLength The maximum length, or a LogicFn that returns the maximum length.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.maxLength(maxLength)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Max Length Validation](guide/forms/signals/validation#minlength-and-maxlength)\n * @category validation\n * @publicApi 22.0\n */\nexport function maxLength<\n  TValue extends ValueWithLengthOrSize,\n  TPathKind extends PathKind = PathKind.Root,\n>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  maxLength: number | LogicFn<TValue, number | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n) {\n  const MAX_LENGTH_MEMO = metadata(path, createMetadataKey<number | undefined>(), (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof maxLength === 'number' ? maxLength : maxLength(ctx);\n  });\n  metadata(path, MAX_LENGTH, ({state}) => state.metadata(MAX_LENGTH_MEMO)!());\n  validate(path, (ctx) => {\n    if (isEmpty(ctx.value())) {\n      return undefined;\n    }\n    const maxLength = ctx.state.metadata(MAX_LENGTH_MEMO)!();\n    if (maxLength === undefined) {\n      return undefined;\n    }\n    if (getLengthOrSize(ctx.value()) > maxLength) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return maxLengthError(maxLength, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, metadata, LimitKey, MIN, MIN_NUMBER} from '../metadata';\nimport {BaseValidatorConfig, getOption} from './util';\nimport {validate} from './validate';\nimport {minError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to be greater than or equal to\n * the given `minValue`.\n * This function can only be called on number paths.\n * This function can only be called on number paths.\n * In addition to binding a validator, this function adds `MIN` property to the field.\n *\n * @param path Path of the field to validate\n * @param minValue The minimum value, or a LogicFn that returns the minimum value.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.min(minValue)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Min Validation](guide/forms/signals/validation#min-and-max)\n * @category validation\n * @publicApi 22.0\n */\nexport function min<TValue extends number | null, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  minValue: number | LogicFn<TValue, number | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n): void {\n  const MIN_MEMO = createMetadataKey<number | undefined>();\n\n  // Memomize the minimum valid.\n  metadata(path, MIN_MEMO, (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof minValue === 'function' ? minValue(ctx) : minValue;\n  });\n\n  // Publish the memoized mininum value for aggregation.\n  metadata(path, MIN_NUMBER, ({state}) => state.metadata(MIN_MEMO)!());\n\n  // Use `MIN_NUMBER` to define the `min` property of the field.\n  metadata(path, MIN, () => MIN_NUMBER as LimitKey<TValue>);\n  validate(path, (ctx) => {\n    const value = ctx.value();\n    if (value === null || Number.isNaN(value)) {\n      return undefined;\n    }\n    const min = ctx.state.metadata(MIN_MEMO)!();\n    if (min === undefined || Number.isNaN(min)) {\n      return undefined;\n    }\n    if (value < min) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return minError(min, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, LimitKey, metadata, MIN, MIN_DATE} from '../metadata';\nimport {BaseValidatorConfig, getOption} from './util';\nimport {validate} from './validate';\nimport {minDateError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to be greater than or equal to\n * the given `minDate`.\n * This function can only be called on date paths.\n * In addition to binding a validator, this function adds `MIN` property to the field.\n *\n * @param path Path of the field to validate\n * @param minDate The minimum date, or a LogicFn that returns the minimum date.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.min(minDate)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Min Validation](guide/forms/signals/validation#min-and-max)\n * @category validation\n * @publicApi 22.0\n */\nexport function minDate<TValue extends Date | null, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  minDateValue: Date | LogicFn<TValue, Date | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n): void {\n  const MIN_MEMO = createMetadataKey<Date | undefined>();\n\n  // Memoize the minimum valid date.\n  metadata(path, MIN_MEMO, (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof minDateValue === 'function' ? minDateValue(ctx) : minDateValue;\n  });\n\n  // Publish the memoized minimum date for aggregation.\n  metadata(path, MIN_DATE, ({state}) => state.metadata(MIN_MEMO)!());\n\n  // Use `MIN_DATE` to define the `min` property of the field.\n  metadata(path, MIN, () => MIN_DATE as LimitKey<TValue>);\n\n  // Validate that the field value is not less than the minimum date.\n  validate(path, (ctx) => {\n    const value = ctx.value();\n    if (value === null || Number.isNaN(value.getTime())) {\n      return undefined;\n    }\n    const min = ctx.state.metadata(MIN_MEMO)!();\n    if (min === undefined || Number.isNaN(min.getTime())) {\n      return undefined;\n    }\n    if (value < min) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return minDateError(min, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, metadata, MIN_LENGTH} from '../metadata';\nimport {\n  BaseValidatorConfig,\n  getLengthOrSize,\n  getOption,\n  isEmpty,\n  ValueWithLengthOrSize,\n} from './util';\nimport {validate} from './validate';\nimport {minLengthError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the length of the value to be greater than or\n * equal to the given `minLength`.\n * This function can only be called on string or array paths.\n * In addition to binding a validator, this function adds `MIN_LENGTH` property to the field.\n *\n * @param path Path of the field to validate\n * @param minLength The minimum length, or a LogicFn that returns the minimum length.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.minLength(minLength)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Min Length Validation](guide/forms/signals/validation#minlength-and-maxlength)\n * @category validation\n * @publicApi 22.0\n */\nexport function minLength<\n  TValue extends ValueWithLengthOrSize,\n  TPathKind extends PathKind = PathKind.Root,\n>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  minLength: number | LogicFn<TValue, number | undefined, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind>,\n) {\n  const MIN_LENGTH_MEMO = metadata(path, createMetadataKey<number | undefined>(), (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return typeof minLength === 'number' ? minLength : minLength(ctx);\n  });\n  metadata(path, MIN_LENGTH, ({state}) => state.metadata(MIN_LENGTH_MEMO)!());\n  validate(path, (ctx) => {\n    if (isEmpty(ctx.value())) {\n      return undefined;\n    }\n    const minLength = ctx.state.metadata(MIN_LENGTH_MEMO)!();\n    if (minLength === undefined) {\n      return undefined;\n    }\n    if (getLengthOrSize(ctx.value()) < minLength) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return minLengthError(minLength, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, metadata, PATTERN} from '../metadata';\nimport {BaseValidatorConfig, getOption, isEmpty} from './util';\nimport {validate} from './validate';\nimport {patternError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to match a specific regex pattern.\n * This function can only be called on string paths.\n * In addition to binding a validator, this function adds `PATTERN` property to the field.\n *\n * @param path Path of the field to validate\n * @param pattern The RegExp pattern to match, or a LogicFn that returns the RegExp pattern.\n * @param config Optional, allows providing any of the following options:\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.pattern(pattern)`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Pattern Validation](guide/forms/signals/validation#pattern)\n * @category validation\n * @publicApi 22.0\n */\nexport function pattern<TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>,\n  pattern: RegExp | LogicFn<string | undefined, RegExp | undefined, TPathKind>,\n  config?: BaseValidatorConfig<string, TPathKind>,\n) {\n  const PATTERN_MEMO = metadata(path, createMetadataKey<RegExp | undefined>(), (ctx) => {\n    if (config?.when && !config.when(ctx)) {\n      return undefined;\n    }\n    return pattern instanceof RegExp ? pattern : pattern(ctx);\n  });\n  metadata(path, PATTERN, ({state}) => state.metadata(PATTERN_MEMO)!());\n  validate(path, (ctx) => {\n    if (isEmpty(ctx.value())) {\n      return undefined;\n    }\n    const pattern = ctx.state.metadata(PATTERN_MEMO)!();\n    if (pattern === undefined) {\n      return undefined;\n    }\n    if (!pattern.test(ctx.value())) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return patternError(pattern, {message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {LogicFn, PathKind, SchemaPath, SchemaPathRules} from '../../types';\nimport {createMetadataKey, metadata, REQUIRED} from '../metadata';\nimport {BaseValidatorConfig, getOption, isEmpty} from './util';\nimport {validate} from './validate';\nimport {requiredError} from './validation_errors';\n\n/**\n * Binds a validator to the given path that requires the value to be non-empty.\n * This function can only be called on any type of path.\n * In addition to binding a validator, this function adds `REQUIRED` property to the field.\n *\n * @param path Path of the field to validate\n * @param config Optional, allows providing any of the following options:\n *  - `message`: A user-facing message for the error.\n *  - `error`: Custom validation error(s) to be used instead of the default `ValidationError.required()`\n *    or a function that receives the `FieldContext` and returns custom validation error(s).\n *  - `when`: A function that receives the `FieldContext` and returns true if the field is required\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Signal Form Required Validation](guide/forms/signals/validation#required)\n * @category validation\n * @publicApi 22.0\n */\nexport function required<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  config?: BaseValidatorConfig<TValue, TPathKind> & {\n    when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;\n  },\n): void {\n  const REQUIRED_MEMO = metadata(path, createMetadataKey<boolean>(), (ctx) =>\n    config?.when ? config.when(ctx) : true,\n  );\n  metadata(path, REQUIRED, ({state}) => state.metadata(REQUIRED_MEMO)!()!);\n  validate(path, (ctx) => {\n    if (ctx.state.metadata(REQUIRED_MEMO)!() && isEmpty(ctx.value())) {\n      if (config?.error) {\n        return getOption(config.error, ctx);\n      } else {\n        return requiredError({message: getOption(config?.message, ctx)});\n      }\n    }\n    return undefined;\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {DebounceTimer, Resource, Signal, computed, debounced, ɵchain} from '@angular/core';\nimport {FieldNode} from '../../../field/node';\nimport {addDefaultField} from '../../../field/validation';\nimport {FieldPathNode} from '../../../schema/path_node';\nimport {assertPathIsCurrent} from '../../../schema/schema';\nimport {\n  FieldContext,\n  LogicFn,\n  PathKind,\n  SchemaPath,\n  SchemaPathRules,\n  TreeValidationResult,\n} from '../../types';\nimport {IS_ASYNC_VALIDATION_RESOURCE, createManagedMetadataKey, metadata} from '../metadata';\n\n/**\n * A function that takes the result of an async operation and the current field context, and maps it\n * to a list of validation errors.\n *\n * @param result The result of the async operation.\n * @param ctx The context for the field the validator is attached to.\n * @return A validation error, or list of validation errors to report based on the result of the async operation.\n *   The returned errors can optionally specify a field that the error should be targeted to.\n *   A targeted error will show up as an error on its target field rather than the field being validated.\n *   If a field is not given, the error is assumed to apply to the field being validated.\n * @template TValue The type of value stored in the field being validated.\n * @template TResult The type of result returned by the async operation\n * @template TPathKind The kind of path being validated (a root path, child path, or item of an array)\n *\n * @publicApi 22.0\n */\nexport type MapToErrorsFn<TValue, TResult, TPathKind extends PathKind = PathKind.Root> = (\n  result: TResult,\n  ctx: FieldContext<TValue, TPathKind>,\n) => TreeValidationResult;\n\n/**\n * Options that indicate how to create a resource for async validation for a field,\n * and map its result to validation errors.\n *\n * @template TValue The type of value stored in the field being validated.\n * @template TParams The type of parameters to the resource.\n * @template TResult The type of result returned by the resource\n * @template TPathKind The kind of path being validated (a root path, child path, or item of an array)\n *\n * @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)\n * @see [Custom async validation](guide/forms/signals/async-operations#custom-async-validation-with-validateasync)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport interface AsyncValidatorOptions<\n  TValue,\n  TParams,\n  TResult,\n  TPathKind extends PathKind = PathKind.Root,\n> {\n  /**\n   * A function that receives the field context and returns the params for the resource.\n   *\n   * @param ctx The field context for the field being validated.\n   * @returns The params for the resource.\n   */\n  readonly params: (ctx: FieldContext<TValue, TPathKind>) => TParams;\n\n  /**\n   * Duration in milliseconds to wait before triggering the async operation, or a function that\n   * returns a promise that resolves when the update should proceed.\n   */\n  readonly debounce?: DebounceTimer<TParams | undefined>;\n\n  /**\n   * A function that receives the resource params and returns a resource of the given params.\n   * The given params should be used as is to create the resource.\n   * The forms system will report the params as `undefined` when this validation doesn't need to be run.\n   *\n   * @param params The params to use for constructing the resource\n   * @returns A reference to the constructed resource.\n   */\n  readonly factory: (params: Signal<TParams | undefined>) => Resource<TResult | undefined>;\n  /**\n   * A function to handle errors thrown by httpResource (HTTP errors, network errors, etc.).\n   * Receives the error and the field context, returns a list of validation errors.\n   */\n  readonly onError: (error: unknown, ctx: FieldContext<TValue, TPathKind>) => TreeValidationResult;\n  /**\n   * A function that takes the resource result, and the current field context and maps it to a list\n   * of validation errors.\n   *\n   * @param result The resource result.\n   * @param ctx The context for the field the validator is attached to.\n   * @return A validation error, or list of validation errors to report based on the resource result.\n   *   The returned errors can optionally specify a field that the error should be targeted to.\n   *   A targeted error will show up as an error on its target field rather than the field being validated.\n   *   If a field is not given, the error is assumed to apply to the field being validated.\n   */\n  readonly onSuccess: MapToErrorsFn<TValue, TResult, TPathKind>;\n  /**\n   * A function that receives the field context and returns true if the async validation should be run.\n   */\n  readonly when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;\n}\n\n/**\n * Adds async validation to the field corresponding to the given path based on a resource.\n * Async validation for a field only runs once all synchronous validation is passing.\n *\n * @param path A path indicating the field to bind the async validation logic to.\n * @param opts The async validation options.\n * @template TValue The type of value stored in the field being validated.\n * @template TParams The type of parameters to the resource.\n * @template TResult The type of result returned by the resource\n * @template TPathKind The kind of path being validated (a root path, child path, or item of an array)\n *\n * @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)\n * @see [Custom async validation](guide/forms/signals/async-operations#custom-async-validation-with-validateasync)\n * @category validation\n * @publicApi 22.0\n */\nexport function validateAsync<TValue, TParams, TResult, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  opts: AsyncValidatorOptions<TValue, TParams, TResult, TPathKind>,\n): void {\n  assertPathIsCurrent(path);\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n\n  const RESOURCE = createManagedMetadataKey<ReturnType<typeof opts.factory>, TParams | undefined>(\n    (_state, params) => {\n      if (opts.debounce !== undefined) {\n        const debouncedResource = debounced(() => params(), opts.debounce);\n        const wrappedParams = computed(() => ɵchain(debouncedResource));\n        return opts.factory(wrappedParams);\n      }\n      return opts.factory(params);\n    },\n  );\n  RESOURCE[IS_ASYNC_VALIDATION_RESOURCE] = true;\n\n  metadata(path, RESOURCE, (ctx) => {\n    const node = ctx.stateOf(path) as FieldNode;\n    const validationState = node.validationState;\n    if (validationState.shouldSkipValidation() || !validationState.syncValid()) {\n      return undefined;\n    }\n    if (opts.when && !opts.when(ctx)) {\n      return undefined;\n    }\n    return opts.params(ctx);\n  });\n\n  pathNode.builder.addAsyncErrorRule((ctx) => {\n    const res = ctx.state.metadata(RESOURCE)!;\n    let errors;\n    switch (res.status()) {\n      case 'idle':\n        return undefined;\n      case 'loading':\n      case 'reloading':\n        return 'pending';\n      case 'resolved':\n      case 'local':\n        if (!res.hasValue()) {\n          return undefined;\n        }\n        errors = opts.onSuccess(res.value()!, ctx as FieldContext<TValue, TPathKind>);\n        return addDefaultField(errors, ctx.fieldTree);\n      case 'error':\n        errors = opts.onError(res.error(), ctx as FieldContext<TValue, TPathKind>);\n        return addDefaultField(errors, ctx.fieldTree);\n    }\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {addDefaultField} from '../../../field/validation';\nimport {FieldPathNode} from '../../../schema/path_node';\nimport {assertPathIsCurrent} from '../../../schema/schema';\nimport type {FieldContext, PathKind, SchemaPath, SchemaPathRules, TreeValidator} from '../../types';\n\n/**\n * Adds logic to a field to determine if the field or any of its child fields has validation errors.\n *\n * @param path The target path to add the validation logic to.\n * @param logic A `TreeValidator` that returns the current validation errors.\n *   Errors returned by the validator may specify a target field to indicate an error on a child field.\n * @template TValue The type of value stored in the field the logic is bound to.\n * @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)\n *\n * @see [Cross-field validation](guide/forms/signals/cross-field-logic#using-validatetree)\n * @see [Custom validation rules](guide/forms/signals/validation#using-validatetree)\n *\n * @category logic\n * @publicApi 22.0\n */\nexport function validateTree<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  logic: NoInfer<TreeValidator<TValue, TPathKind>>,\n): void {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n  pathNode.builder.addSyncTreeErrorRule((ctx) =>\n    addDefaultField(logic(ctx as FieldContext<TValue, TPathKind>), ctx.fieldTree),\n  );\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {resource, ɵisPromise} from '@angular/core';\nimport type {StandardSchemaV1} from '@standard-schema/spec';\nimport {addDefaultField} from '../../../field/validation';\nimport type {LogicFn, ReadonlyFieldTree, SchemaPath, SchemaPathTree} from '../../types';\nimport {createMetadataKey, metadata} from '../metadata';\nimport {validateAsync} from './validate_async';\nimport {validateTree} from './validate_tree';\nimport {\n  BaseNgValidationError,\n  type ValidationErrorOptions,\n  type WithFieldTree,\n  type WithOptionalFieldTree,\n  type WithoutFieldTree,\n} from './validation_errors';\n\n/**\n * Utility type that removes a string index key when its value is `unknown`,\n * i.e. `{[key: string]: unknown}`. It allows specific string keys to pass through, even if their\n * value is `unknown`, e.g. `{key: unknown}`.\n *\n * @see [Integration with schema validation libraries](guide/forms/signals/validation#integration-with-schema-validation-libraries)\n *\n * @publicApi 22.0\n */\nexport type RemoveStringIndexUnknownKey<K, V> = string extends K\n  ? unknown extends V\n    ? never\n    : K\n  : K;\n\n/**\n * Utility type that recursively ignores unknown string index properties on the given object.\n * We use this on the `TSchema` type in `validateStandardSchema` in order to accommodate Zod's\n * `looseObject` which includes `{[key: string]: unknown}` as part of the type.\n *\n * @see [Integration with schema validation libraries](guide/forms/signals/validation#integration-with-schema-validation-libraries)\n *\n * @publicApi 22.0\n */\nexport type IgnoreUnknownProperties<T> =\n  T extends Record<PropertyKey, unknown>\n    ? {\n        [K in keyof T as RemoveStringIndexUnknownKey<K, T[K]>]: IgnoreUnknownProperties<T[K]>;\n      }\n    : T;\n\n/**\n * Validates a field using a `StandardSchemaV1` compatible validator (e.g. a Zod validator).\n *\n * See https://github.com/standard-schema/standard-schema for more about standard schema.\n *\n * @param path The `FieldPath` to the field to validate.\n * @param schema The standard schema compatible validator to use for validation, or a LogicFn that returns the schema.\n * @template TSchema The type validated by the schema. This may be either the full `TValue` type,\n *   or a partial of it.\n * @template TValue The type of value stored in the field being validated.\n *\n * @see [Signal Form Schema Validation](guide/forms/signals/validation#integration-with-schema-validation-libraries)\n * @category validation\n * @publicApi 22.0\n */\nexport function validateStandardSchema<TSchema, TModel extends IgnoreUnknownProperties<TSchema>>(\n  path: SchemaPath<TModel> & SchemaPathTree<TModel>,\n  schema: StandardSchemaV1<TSchema> | LogicFn<TModel, StandardSchemaV1<unknown> | undefined>,\n) {\n  // We create both a sync and async validator because the standard schema validator can return\n  // either a sync result or a Promise, and we need to handle both cases. The sync validator\n  // handles the sync result, and the async validator handles the Promise.\n  // We memoize the result of the validation function here, so that it is only run once for both\n  // validators, it can then be passed through both sync & async validation.\n  type Result = StandardSchemaV1.Result<TSchema> | Promise<StandardSchemaV1.Result<TSchema>>;\n  const VALIDATOR_MEMO = metadata(\n    path as SchemaPath<TModel>,\n    createMetadataKey<Result | undefined>(),\n    (ctx) => {\n      const resolvedSchema = typeof schema === 'function' ? schema(ctx) : schema;\n      return resolvedSchema\n        ? (resolvedSchema['~standard'].validate(ctx.value()) as Result)\n        : undefined;\n    },\n  );\n\n  validateTree<TModel>(path, ({state, fieldTreeOf}) => {\n    // Skip sync validation if the result is a Promise or undefined.\n    const result = state.metadata(VALIDATOR_MEMO)!();\n    if (!result || ɵisPromise(result)) {\n      return [];\n    }\n    return (\n      result?.issues?.map((issue) =>\n        standardIssueToFormTreeError(fieldTreeOf<TModel>(path), issue),\n      ) ?? []\n    );\n  });\n\n  validateAsync<\n    TModel,\n    Promise<StandardSchemaV1.Result<TSchema>> | undefined,\n    readonly StandardSchemaV1.Issue[]\n  >(path, {\n    params: ({state}) => {\n      // Skip async validation if the result is *not* a Promise.\n      const result = state.metadata(VALIDATOR_MEMO)!();\n      return result && ɵisPromise(result) ? result : undefined;\n    },\n    factory: (params) => {\n      return resource({\n        params,\n        loader: async ({params}) => (await params)?.issues ?? [],\n      });\n    },\n    onSuccess: (issues, {fieldTreeOf}) => {\n      return issues.map((issue) => standardIssueToFormTreeError(fieldTreeOf<TModel>(path), issue));\n    },\n    onError: () => {},\n  });\n}\n\n/**\n * Create a standard schema issue error associated with the target field\n * @param issue The standard schema issue\n * @param options The validation error options\n *\n * @see [Integration with schema validation libraries](guide/forms/signals/validation#integration-with-schema-validation-libraries)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function standardSchemaError(\n  issue: StandardSchemaV1.Issue,\n  options: WithFieldTree<ValidationErrorOptions>,\n): StandardSchemaValidationError;\n/**\n * Create a standard schema issue error\n * @param issue The standard schema issue\n * @param options The optional validation error options\n *\n * @see [Integration with schema validation libraries](guide/forms/signals/validation#integration-with-schema-validation-libraries)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport function standardSchemaError(\n  issue: StandardSchemaV1.Issue,\n  options?: ValidationErrorOptions,\n): WithoutFieldTree<StandardSchemaValidationError>;\nexport function standardSchemaError(\n  issue: StandardSchemaV1.Issue,\n  options?: ValidationErrorOptions,\n): WithOptionalFieldTree<StandardSchemaValidationError> {\n  return new StandardSchemaValidationError(issue, options);\n}\n\n/**\n * Converts a `StandardSchemaV1.Issue` to a `FormTreeError`.\n *\n * @param fieldTree The root field to which the issue's path is relative.\n * @param issue The `StandardSchemaV1.Issue` to convert.\n * @returns A `ValidationError` representing the issue.\n */\nfunction standardIssueToFormTreeError(\n  fieldTree: ReadonlyFieldTree<unknown>,\n  issue: StandardSchemaV1.Issue,\n): StandardSchemaValidationError {\n  let target = fieldTree as ReadonlyFieldTree<Record<PropertyKey, unknown>>;\n  for (const pathPart of issue.path ?? []) {\n    const pathKey = typeof pathPart === 'object' ? pathPart.key : pathPart;\n    target = target[pathKey] as ReadonlyFieldTree<Record<PropertyKey, unknown>>;\n  }\n  return addDefaultField(standardSchemaError(issue, {message: issue.message}), target);\n}\n\n/**\n * An error used to indicate an issue validating against a standard schema.\n *\n * @see [Integration with schema validation libraries](guide/forms/signals/validation#integration-with-schema-validation-libraries)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport class StandardSchemaValidationError extends BaseNgValidationError {\n  override readonly kind = 'standardSchema';\n\n  constructor(\n    readonly issue: StandardSchemaV1.Issue,\n    options?: ValidationErrorOptions,\n  ) {\n    super(options);\n  }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {httpResource, HttpResourceOptions, HttpResourceRequest} from '@angular/common/http';\nimport {DebounceTimer, ResourceSnapshot, Signal} from '@angular/core';\nimport {\n  FieldContext,\n  LogicFn,\n  PathKind,\n  SchemaPath,\n  SchemaPathRules,\n  TreeValidationResult,\n} from '../../types';\nimport {MapToErrorsFn, validateAsync} from './validate_async';\n\n/**\n * Options that indicate how to create an httpResource for async validation for a field,\n * and map its result to validation errors.\n *\n * @template TValue The type of value stored in the field being validated.\n * @template TResult The type of result returned by the httpResource\n * @template TPathKind The kind of path being validated (a root path, child path, or item of an array)\n *\n * @see [HTTP validation with validateHttp](guide/forms/signals/async-operations#http-validation-with-validatehttp)\n * @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)\n *\n * @category validation\n * @publicApi 22.0\n */\nexport interface HttpValidatorOptions<TValue, TResult, TPathKind extends PathKind = PathKind.Root> {\n  /**\n   * A function that receives the field context and returns the url or request for the httpResource.\n   * If given a URL, the underlying httpResource will perform an HTTP GET on it.\n   *\n   * @param ctx The field context for the field being validated.\n   * @returns The URL or request for creating the httpResource.\n   */\n  readonly request:\n    | ((ctx: FieldContext<TValue, TPathKind>) => string | undefined)\n    | ((ctx: FieldContext<TValue, TPathKind>) => HttpResourceRequest | undefined);\n\n  /**\n   * A function that takes the httpResource result, and the current field context and maps it to a\n   * list of validation errors.\n   *\n   * @param result The httpResource result.\n   * @param ctx The context for the field the validator is attached to.\n   * @return A validation error, or list of validation errors to report based on the httpResource result.\n   *   The returned errors can optionally specify a field that the error should be targeted to.\n   *   A targeted error will show up as an error on its target field rather than the field being validated.\n   *   If a field is not given, the error is assumed to apply to the field being validated.\n   */\n  readonly onSuccess: MapToErrorsFn<TValue, TResult, TPathKind>;\n\n  /**\n   * A function to handle errors thrown by httpResource (HTTP errors, network errors, etc.).\n   * Receives the error and the field context, returns a list of validation errors.\n   */\n  readonly onError: (error: unknown, ctx: FieldContext<TValue, TPathKind>) => TreeValidationResult;\n  /**\n   * The options to use when creating the httpResource.\n   */\n  readonly options?: HttpResourceOptions<TResult, unknown>;\n\n  /**\n   * Duration in milliseconds to wait before triggering the async operation, or a function that\n   * returns a promise that resolves when the update should proceed.\n   */\n  readonly debounce?: DebounceTimer<string | HttpResourceRequest | undefined>;\n  /**\n   * A function that receives the field context and returns true if the async validation should be run.\n   */\n  readonly when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;\n}\n\n/**\n * Adds async validation to the field corresponding to the given path based on an httpResource.\n * Async validation for a field only runs once all synchronous validation is passing.\n *\n * @param path A path indicating the field to bind the async validation logic to.\n * @param opts The http validation options.\n * @template TValue The type of value stored in the field being validated.\n * @template TResult The type of result returned by the httpResource\n * @template TPathKind The kind of path being validated (a root path, child path, or item of an array)\n *\n * @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)\n * @see [HTTP validation with validateHttp](guide/forms/signals/async-operations#http-validation-with-validatehttp)\n * @category validation\n * @publicApi 22.0\n */\nexport function validateHttp<TValue, TResult = unknown, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  opts: HttpValidatorOptions<TValue, TResult, TPathKind>,\n) {\n  validateAsync(path, {\n    params: opts.request as (\n      ctx: FieldContext<TValue, TPathKind>,\n    ) => string | HttpResourceRequest | undefined,\n    debounce: opts.debounce,\n    factory: (request: Signal<any>) => httpResource(request, opts.options),\n    onSuccess: opts.onSuccess,\n    onError: opts.onError,\n    when: opts.when,\n  });\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {DEBOUNCER} from '../../field/debounce';\nimport {FieldPathNode} from '../../schema/path_node';\nimport {assertPathIsCurrent} from '../../schema/schema';\nimport type {Debouncer, PathKind, SchemaPath, SchemaPathRules} from '../types';\n\n/**\n * Configures the frequency at which a form field is updated by UI events.\n *\n * When this rule is applied, updates from the UI to the form model will be delayed until either\n * the field is touched, or the most recently debounced update resolves.\n *\n * @param path The target path to debounce.\n * @param config A debounce configuration, which can be either a debounce duration in milliseconds,\n *     `'blur'` to debounce until the field is blurred, or a custom {@link Debouncer} function.\n *\n * @see [Debouncing form updates](guide/forms/signals/form-logic#delay-input-operations-with-debounce)\n * @see [Custom form controls](guide/forms/signals/custom-controls) for using `debounce('blur')` with\n *     a custom `FormValueControl`.\n *\n * @publicApi 22.0\n */\nexport function debounce<TValue, TPathKind extends PathKind = PathKind.Root>(\n  path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>,\n  config: number | 'blur' | Debouncer<TValue, TPathKind>,\n): void {\n  assertPathIsCurrent(path);\n\n  const pathNode = FieldPathNode.unwrapFieldPath(path);\n  const debouncer = normalizeDebouncer(config);\n  pathNode.builder.addMetadataRule(DEBOUNCER, () => debouncer);\n}\n\nfunction normalizeDebouncer<TValue, TPathKind extends PathKind>(\n  debouncer: number | 'blur' | Debouncer<TValue, TPathKind>,\n) {\n  // If it's already a debounce function, return it as-is.\n  if (typeof debouncer === 'function') {\n    return debouncer;\n  }\n  // If it's 'blur', return a debouncer that never resolves. The field will still be updated when\n  // the control is blurred.\n  if (debouncer === 'blur') {\n    return debounceUntilBlur();\n  }\n  // If it's a non-zero number, return a timer-based debouncer.\n  if (debouncer > 0) {\n    return debounceForDuration(debouncer);\n  }\n  // Otherwise it's 0, so we return a function that will synchronize the model without delay.\n  return immediate;\n}\n\n/**\n * Creates a debouncer that will wait for the given duration before resolving.\n */\nfunction debounceForDuration(durationInMilliseconds: number): Debouncer<unknown> {\n  return (_context, abortSignal) => {\n    return new Promise((resolve) => {\n      let timeoutId: ReturnType<typeof setTimeout> | undefined;\n\n      const onAbort = () => {\n        clearTimeout(timeoutId);\n        resolve();\n      };\n\n      timeoutId = setTimeout(() => {\n        abortSignal.removeEventListener('abort', onAbort);\n        resolve();\n      }, durationInMilliseconds);\n\n      abortSignal.addEventListener('abort', onAbort, {once: true});\n    });\n  };\n}\n\n/**\n * Creates a debouncer that will wait indefinitely, relying on the node to synchronize pending\n * updates when blurred.\n */\nfunction debounceUntilBlur(): Debouncer<unknown> {\n  return (_context, abortSignal) => {\n    return new Promise((resolve) => {\n      abortSignal.addEventListener('abort', () => resolve(), {once: true});\n    });\n  };\n}\n\nfunction immediate(): void {}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {type Signal, linkedSignal} from '@angular/core';\nimport type {ValidationError} from '../api/rules';\nimport {normalizeErrors} from '../api/rules/validation/util';\nimport type {ParseResult} from '../api/transformed_value';\nimport {shallowArrayEquals} from './array';\n\n/**\n * An object that handles parsing raw UI values into model values.\n */\nexport interface Parser<TRaw> {\n  /**\n   * Errors encountered during the last parse attempt.\n   */\n  errors: Signal<readonly ValidationError.WithoutFieldTree[]>;\n  /**\n   * Parses the given raw value and updates the underlying model value if successful.\n   */\n  setRawValue: (rawValue: TRaw) => void;\n  /**\n   * Resets the parser errors.\n   */\n  readonly reset: () => void;\n}\n\n/**\n * Creates a {@link Parser} that synchronizes a raw value with an underlying model value.\n *\n * @param getValue Function to get the current model value.\n * @param setValue Function to update the model value.\n * @param parse Function to parse the raw value into a {@link ParseResult}.\n * @returns A {@link Parser} instance.\n */\nexport function createParser<TValue, TRaw>(\n  getValue: () => TValue,\n  setValue: (value: TValue) => void,\n  parse: (raw: TRaw) => ParseResult<TValue>,\n): Parser<TRaw> {\n  const errors = linkedSignal({\n    source: getValue,\n    computation: () => [] as readonly ValidationError.WithoutFieldTree[],\n    equal: shallowArrayEquals,\n  });\n\n  const setRawValue = (rawValue: TRaw) => {\n    const result = parse(rawValue);\n    errors.set(normalizeErrors(result.error));\n    if (result.value !== undefined) {\n      setValue(result.value);\n    }\n    // `errors` is a linked signal sourced from the model value; write parse errors after\n    // model updates so `{value, errors}` results do not get reset by the recomputation.\n    errors.set(normalizeErrors(result.error));\n  };\n\n  const reset = () => {\n    errors.set([]);\n  };\n\n  return {errors: errors.asReadonly(), setRawValue, reset};\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n  inject,\n  linkedSignal,\n  type ModelSignal,\n  type Signal,\n  type WritableSignal,\n} from '@angular/core';\nimport {createParser} from '../util/parser';\nimport type {ValidationError} from './rules';\nimport type {OneOrMany} from './types';\nimport {ɵFORM_CONTROL_INTEGRATION as FORM_CONTROL_INTEGRATION} from '@angular/forms';\n\n/**\n * Result of parsing a raw value into a model value.\n */\nexport interface ParseResult<TValue> {\n  /**\n   * The parsed value. If omitted, the model is not updated.\n   */\n  readonly value?: TValue;\n  /**\n   * Errors encountered during parsing, if any.\n   */\n  readonly error?: OneOrMany<ValidationError.WithoutFieldTree>;\n}\n\n/**\n * Options for `transformedValue`.\n *\n * @see [Value transformation](guide/forms/signals/custom-controls#value-transformation)\n *\n * @publicApi 22.0\n */\nexport interface TransformedValueOptions<TValue, TRaw> {\n  /**\n   * Parse the raw value into the model value.\n   *\n   * Should return an object containing the parsed result, which may contain:\n   *   - `value`: The parsed model value. If `undefined`, the model will not be updated.\n   *   - `error`: Any parse errors encountered. If `undefined`, no errors are reported.\n   */\n  parse: (rawValue: TRaw) => ParseResult<TValue>;\n\n  /**\n   * Format the model value into the raw value.\n   */\n  format: (value: TValue) => TRaw;\n}\n\n/**\n * A writable signal representing a \"raw\" UI value that is synchronized with a model signal\n * via parse/format transformations.\n *\n * @see [Value transformation](guide/forms/signals/custom-controls#value-transformation)\n *\n * @category control\n * @publicApi 22.0\n */\nexport interface TransformedValueSignal<TRaw> extends WritableSignal<TRaw> {\n  /**\n   * The current parse errors resulting from the last transformation.\n   */\n  readonly parseErrors: Signal<readonly ValidationError.WithoutFieldTree[]>;\n}\n\n/**\n * Creates a writable signal representing a \"raw\" UI value that is transformed to/from a model\n * value via `parse` and `format` functions.\n *\n * This utility simplifies the creation of custom form controls that parse a user-facing value\n * representation into an underlying model value. For example, a numeric input that displays and\n * accepts string values but stores a number.\n *\n * Parse errors are exposed via the returned signal’s `parseErrors()` property.\n * When `transformedValue` is used within a Signal Forms field context, parse errors are also\n * reported to the nearest field automatically. When no field context is present, no automatic\n * reporting occurs and `parseErrors` can be consumed directly.\n *\n * Note: `parse` may return both a `value` and an `error`. Returning `value` updates the model;\n * omitting it leaves the model unchanged.\n *\n * @param value The model signal to synchronize with.\n * @param options Configuration including `parse` and `format` functions.\n * @returns A `TransformedValueSignal` representing the raw value with parse error tracking.\n * @publicApi 22.0\n *\n * @example\n * ```ts\n * @Component({\n *   selector: 'number-input',\n *   template: `<input [value]=\"rawValue()\" (input)=\"rawValue.set($event.target.value)\" />`,\n * })\n * export class NumberInput implements FormValueControl<number | null> {\n *   readonly value = model.required<number | null>();\n *\n *   protected readonly rawValue = transformedValue(this.value, {\n *     parse: (val) => {\n *       const parsed = val ? Number(val) : null;\n *\n *       return Number.isNaN(parsed)\n *         ? {error: {kind: 'parse', message: `${val} is not a number`}}\n *         : {value: parsed};\n *     },\n *     format: (val) => val?.toString() ?? '',\n *   });\n * }\n * ```\n *\n * @see [Value transformation](guide/forms/signals/custom-controls#value-transformation)\n *\n\n */\nexport function transformedValue<TValue, TRaw>(\n  value: ModelSignal<TValue>,\n  options: TransformedValueOptions<TValue, TRaw>,\n): TransformedValueSignal<TRaw> {\n  const {parse, format} = options;\n  const parser = createParser(value, value.set, parse);\n\n  // Create the result signal with overridden set/update and a `parseErrors` property.\n  const rawValue = linkedSignal(() => format(value()));\n  const result = rawValue as WritableSignal<TRaw> & {\n    parseErrors: Signal<readonly ValidationError.WithoutFieldTree[]>;\n  };\n  result.parseErrors = parser.errors;\n  const originalSet = result.set.bind(result);\n\n  // Wire up the integration with the form control (parse errors and reset handling).\n  const integration = inject(FORM_CONTROL_INTEGRATION, {self: true, optional: true});\n  if (integration) {\n    integration.setParseErrors(parser.errors);\n    integration.onReset = (resetValue) => {\n      parser.reset();\n      const modelValue = resetValue !== undefined ? resetValue : value();\n      originalSet(format(modelValue));\n    };\n  }\n\n  // Notify the parser when `set` or `update` is called on the raw value\n  result.set = (newRawValue: TRaw) => {\n    parser.setRawValue(newRawValue);\n    originalSet(newRawValue);\n  };\n  result.update = (updateFn: (value: TRaw) => TRaw) => {\n    result.set(updateFn(rawValue()));\n  };\n\n  return result;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ɵRuntimeError as RuntimeError} from '@angular/core';\nimport {RuntimeErrorCode} from '../errors';\nimport {signalErrorsToValidationErrors} from '../compat/validation_errors';\n\nimport {\n  ControlValueAccessor,\n  Validators,\n  type AbstractControl,\n  type FormControlStatus,\n  type ValidationErrors,\n  type ValidatorFn,\n} from '@angular/forms';\nimport type {ReadonlyFieldState} from '../api/types';\n\n// TODO: Also consider supporting (if possible):\n// - hasError\n// - getError\n// - reset\n// - name\n// - path\n// - markAs[Touched,Dirty,etc.]\n\n/**\n * Represents a combination of `NgControl` and `AbstractControl`.\n *\n * Note: We have this separate interface, rather than implementing the relevant parts of the two\n * controls with something like `InteropNgControl implements Pick<NgControl, ...>, Pick<AbstractControl, ...>`\n * because it confuses the internal JS minifier which can cause collisions in field names.\n */\ninterface CombinedControl {\n  value: unknown;\n  valid: boolean;\n  invalid: boolean;\n  touched: boolean;\n  untouched: boolean;\n  disabled: boolean;\n  enabled: boolean;\n  errors: ValidationErrors | null;\n  pristine: boolean;\n  dirty: boolean;\n  status: FormControlStatus;\n  control: AbstractControl<any, any>;\n  valueAccessor: ControlValueAccessor | null;\n  hasValidator(validator: ValidatorFn): boolean;\n  updateValueAndValidity(): void;\n}\n\n/**\n * A fake version of `NgControl` provided by the `Field` directive. This allows interoperability\n * with a wider range of components designed to work with reactive forms, in particular ones that\n * inject the `NgControl`. The interop control does not implement *all* properties and methods of\n * the real `NgControl`, but does implement some of the most commonly used ones that have a clear\n * equivalent in signal forms.\n */\nexport class InteropNgControl implements CombinedControl {\n  constructor(protected field: () => ReadonlyFieldState<unknown>) {}\n\n  readonly control: AbstractControl<any, any> = this as unknown as AbstractControl<any, any>;\n\n  get value(): unknown {\n    // CVA controls are not aware of user debouncing and will expect `NgControl.value` to reflect their latest writes.\n    return this.field().controlValue();\n  }\n\n  get valid(): boolean {\n    return this.field().valid();\n  }\n\n  get invalid(): boolean {\n    return this.field().invalid();\n  }\n\n  get pending(): boolean | null {\n    return this.field().pending();\n  }\n\n  get disabled(): boolean {\n    return this.field().disabled();\n  }\n\n  get enabled(): boolean {\n    return !this.field().disabled();\n  }\n\n  get errors(): ValidationErrors | null {\n    return signalErrorsToValidationErrors(this.field().errors());\n  }\n\n  get pristine(): boolean {\n    return !this.field().dirty();\n  }\n\n  get dirty(): boolean {\n    return this.field().dirty();\n  }\n\n  get touched(): boolean {\n    return this.field().touched();\n  }\n\n  get untouched(): boolean {\n    return !this.field().touched();\n  }\n\n  get status(): FormControlStatus {\n    if (this.field().disabled()) {\n      return 'DISABLED';\n    }\n    if (this.field().valid()) {\n      return 'VALID';\n    }\n    if (this.field().invalid()) {\n      return 'INVALID';\n    }\n    if (this.field().pending()) {\n      return 'PENDING';\n    }\n    throw new RuntimeError(\n      RuntimeErrorCode.UNKNOWN_STATUS,\n      ngDevMode && 'Unknown form control status',\n    );\n  }\n\n  valueAccessor: ControlValueAccessor | null = null;\n\n  hasValidator(validator: ValidatorFn): boolean {\n    // This addresses a common case where users look for the presence of `Validators.required` to\n    // determine whether or not to show a required \"*\" indicator in the UI.\n    if (validator === Validators.required) {\n      return this.field().required();\n    }\n    return false;\n  }\n\n  updateValueAndValidity() {\n    // No-op since value and validity are always up to date in signal forms.\n    // We offer this method so that reactive forms code attempting to call it doesn't error.\n  }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type {ReadonlyFieldState} from '../api/types';\n\n/**\n * Branded type for the public name of an input we bind on control components or DOM elements.\n */\nexport type ControlBindingKey = string & {__brand: 'ControlBindingKey'};\n\n/**\n * A map of field state properties to control binding name.\n *\n * This excludes `controlValue` whose corresponding control binding name differs between control\n * types.\n *\n * The control binding name can be used for inputs or attributes (since DOM attributes are case\n * insensitive).\n */\nconst FIELD_STATE_KEY_TO_CONTROL_BINDING = {\n  disabled: 'disabled' as ControlBindingKey,\n  disabledReasons: 'disabledReasons' as ControlBindingKey,\n  dirty: 'dirty' as ControlBindingKey,\n  errors: 'errors' as ControlBindingKey,\n  hidden: 'hidden' as ControlBindingKey,\n  invalid: 'invalid' as ControlBindingKey,\n  max: 'max' as ControlBindingKey,\n  maxLength: 'maxLength' as ControlBindingKey,\n  min: 'min' as ControlBindingKey,\n  minLength: 'minLength' as ControlBindingKey,\n  name: 'name' as ControlBindingKey,\n  pattern: 'pattern' as ControlBindingKey,\n  pending: 'pending' as ControlBindingKey,\n  readonly: 'readonly' as ControlBindingKey,\n  required: 'required' as ControlBindingKey,\n  touched: 'touched' as ControlBindingKey,\n} as const satisfies {[K in keyof ReadonlyFieldState<unknown>]?: ControlBindingKey};\n\n/**\n * Inverts `FIELD_STATE_KEY_TO_CONTROL_BINDING` to look up the minified name of the corresponding\n * field state property from its control binding name.\n */\nconst CONTROL_BINDING_TO_FIELD_STATE_KEY = /* @__PURE__ */ (() => {\n  const map = {} as Record<ControlBindingKey, keyof typeof FIELD_STATE_KEY_TO_CONTROL_BINDING>;\n  for (const key of Object.keys(FIELD_STATE_KEY_TO_CONTROL_BINDING) as Array<\n    keyof typeof FIELD_STATE_KEY_TO_CONTROL_BINDING\n  >) {\n    map[FIELD_STATE_KEY_TO_CONTROL_BINDING[key]] = key;\n  }\n  return map;\n})();\n\nexport function readFieldStateBindingValue(\n  fieldState: ReadonlyFieldState<unknown>,\n  key: ControlBindingKey,\n): unknown {\n  const property = CONTROL_BINDING_TO_FIELD_STATE_KEY[key];\n  return fieldState[property]?.();\n}\n\n/** The keys of {@link FIELD_STATE_KEY_TO_CONTROL_BINDING} */\nexport const CONTROL_BINDING_NAMES = /* @__PURE__ */ (() =>\n  Object.values(FIELD_STATE_KEY_TO_CONTROL_BINDING))() as Array<ControlBindingKey>;\n\nexport function createBindings<TKey extends string>(): {[K in TKey]?: unknown} {\n  return {};\n}\n\nexport function bindingUpdated<TKey extends string>(\n  bindings: {[K in TKey]?: unknown},\n  key: TKey,\n  value: unknown,\n) {\n  if (bindings[key] !== value) {\n    bindings[key] = value;\n    return true;\n  }\n  return false;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {ɵformatRuntimeError as formatRuntimeError, untracked} from '@angular/core';\nimport {NativeInputParseError, WithoutFieldTree} from '../api/rules';\nimport type {ParseResult} from '../api/transformed_value';\nimport {RuntimeErrorCode} from '../errors';\nimport type {InputValidityMonitor} from './input_validity_monitor';\n\n// Re-export shared native utilities from main forms package\nexport {\n  ɵelementAcceptsMinMax as elementAcceptsMinMax,\n  ɵisNativeFormElement as isNativeFormElement,\n  ɵisTextualFormElement as isTextualFormElement,\n  ɵsetNativeDomProperty as setNativeDomProperty,\n  type ɵNativeFormControl as NativeFormControl,\n} from '@angular/forms';\n\nimport type {ɵNativeFormControl as NativeFormControl} from '@angular/forms';\n\n/**\n * Returns the value from a native control element.\n *\n * @param element The native control element.\n * @param currentValue A function that returns the current value from the control's corresponding\n *   field state.\n *\n * The type of the returned value depends on the `type` property of the control, and will attempt to\n * match the current value's type. For example, the value of `<input type=\"number\">` can be read as\n * a `string` or a `number`. If the current value is a `number`, then this will return a `number`.\n * Otherwise, this will return the value as a `string`.\n */\nexport function getNativeControlValue(\n  element: NativeFormControl,\n  currentValue: () => unknown,\n  validityMonitor: InputValidityMonitor,\n): ParseResult<unknown> {\n  let modelValue: unknown;\n\n  if (isInput(element) && validityMonitor.isBadInput(element)) {\n    return {\n      error: new NativeInputParseError() as WithoutFieldTree<NativeInputParseError>,\n    };\n  }\n\n  // Special cases for specific input types.\n  switch (element.type) {\n    case 'checkbox':\n      return {value: element.checked};\n    case 'number':\n    case 'range':\n    case 'datetime-local':\n      // We can read a `number` or a `string` from this input type. Prefer whichever is consistent\n      // with the current type.\n      modelValue = untracked(currentValue);\n      if (typeof modelValue === 'number' || modelValue === null) {\n        return {value: element.value === '' ? null : element.valueAsNumber};\n      }\n      break;\n    case 'date':\n    case 'month':\n    case 'time':\n    case 'week':\n      // We can read a `Date | null`, `number`, or `string` from this input type. Prefer whichever\n      // is consistent with the current type.\n      modelValue = untracked(currentValue);\n      if (modelValue === null || modelValue instanceof Date) {\n        return {value: element.valueAsDate};\n      } else if (typeof modelValue === 'number') {\n        return {value: element.valueAsNumber};\n      }\n      break;\n  }\n\n  // For text-like <input> elements, parse numeric values if the model is numeric.\n  if (element.tagName === 'INPUT' && element.type === 'text') {\n    modelValue ??= untracked(currentValue);\n    if (typeof modelValue === 'number' || modelValue === null) {\n      if (element.value === '') {\n        return {value: null};\n      }\n      const parsed = Number(element.value);\n      if (Number.isNaN(parsed)) {\n        return {error: new NativeInputParseError() as WithoutFieldTree<NativeInputParseError>};\n      }\n      return {value: parsed};\n    }\n  }\n\n  // Default to reading the value as a string.\n  return {value: element.value};\n}\n\n/**\n * Sets a native control element's value.\n *\n * @param element The native control element.\n * @param value The new value to set.\n */\nexport function setNativeControlValue(element: NativeFormControl, value: unknown) {\n  // Special cases for specific input types.\n  switch (element.type) {\n    case 'checkbox':\n      element.checked = value as boolean;\n      return;\n    case 'radio':\n      // Although HTML behavior is to clear the input already, we do this just in case. It seems\n      // like it might be necessary in certain environments (e.g. Domino).\n      element.checked = value === element.value;\n      return;\n    case 'number':\n    case 'range':\n    case 'datetime-local':\n      // This input type can receive a `number` or a `string`.\n      if (typeof value === 'number') {\n        setNativeNumberControlValue(element, value);\n        return;\n      } else if (value === null) {\n        element.value = '';\n        return;\n      }\n      break;\n    case 'date':\n    case 'month':\n    case 'time':\n    case 'week':\n      // This input type can receive a `Date | null` or a `number` or a `string`.\n      if (value === null || value instanceof Date) {\n        element.valueAsDate = value;\n        return;\n      } else if (typeof value === 'number') {\n        setNativeNumberControlValue(element, value);\n        return;\n      }\n  }\n\n  // For text-like <input> elements, handle numeric and null values.\n  if (element.tagName === 'INPUT' && element.type === 'text') {\n    if (typeof value === 'number') {\n      element.value = isNaN(value) ? '' : String(value);\n      return;\n    }\n    if (value === null) {\n      if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n        console.warn(\n          formatRuntimeError(\n            RuntimeErrorCode.TEXT_INPUT_NULL_VALUE,\n            `The text input ${element.name} received a null value. Text inputs should use empty strings to represent null values. ` +\n              ` The input's value will be set to an empty string instead.`,\n          ),\n        );\n      }\n      element.value = '';\n      return;\n    }\n  }\n\n  // Default to setting the value as a string.\n  element.value = value as string;\n}\n\n/** Writes a value to a native <input type=\"number\">. */\nexport function setNativeNumberControlValue(element: HTMLInputElement, value: number) {\n  // Writing `NaN` causes a warning in the console, so we instead write `''`.\n  // This allows the user to safely use `NaN` as a number value that means \"clear the input\".\n  if (isNaN(value)) {\n    element.value = '';\n  } else {\n    element.valueAsNumber = value;\n  }\n}\nexport function isInput(element: HTMLElement): element is HTMLInputElement {\n  return element.tagName === 'INPUT';\n}\n\nexport function inputRequiresValidityTracking(input: HTMLInputElement): boolean {\n  return (\n    input.type === 'date' ||\n    input.type === 'datetime-local' ||\n    input.type === 'month' ||\n    input.type === 'time' ||\n    input.type === 'week'\n  );\n}\n\nfunction formatDateForInput(date: Date, type: 'date' | 'month'): string {\n  const year = date.getUTCFullYear();\n  const month = String(date.getUTCMonth() + 1).padStart(2, '0');\n\n  if (type === 'month') {\n    return `${year}-${month}`;\n  }\n  const day = String(date.getUTCDate()).padStart(2, '0');\n  return `${year}-${month}-${day}`;\n}\n\nexport function formatDateForMinMax(name: string, value: unknown, type: string): unknown {\n  if (\n    value instanceof Date &&\n    (name === 'min' || name === 'max') &&\n    (type === 'date' || type === 'month')\n  ) {\n    return formatDateForInput(value, type);\n  }\n  return value;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type {ɵControlDirectiveHost as ControlDirectiveHost} from '@angular/core';\nimport type {FormField, FormFieldBindingOptions} from './form_field';\nimport {\n  bindingUpdated,\n  CONTROL_BINDING_NAMES,\n  type ControlBindingKey,\n  createBindings,\n  readFieldStateBindingValue,\n} from './bindings';\nimport {formatDateForMinMax, setNativeDomProperty} from './native';\n\nexport function customControlCreate(\n  host: ControlDirectiveHost,\n  parent: FormField<unknown>,\n): () => void {\n  host.listenToCustomControlModel((value) => parent.state().controlValue.set(value));\n  host.listenToCustomControlOutput('touch', () => parent.state().markAsTouched());\n\n  parent.registerAsBinding(host.customControl as FormFieldBindingOptions);\n\n  const bindings = createBindings<ControlBindingKey | 'controlValue'>();\n  return () => {\n    const state = parent.state();\n    // Bind custom form control model ('value' or 'checked').\n    const controlValue = state.controlValue();\n    if (bindingUpdated(bindings, 'controlValue', controlValue)) {\n      host.setCustomControlModelInput(controlValue);\n    }\n\n    // Bind remaining field state properties.\n    for (const name of CONTROL_BINDING_NAMES) {\n      let value: unknown;\n      if (name === 'errors') {\n        value = parent.errors();\n      } else {\n        value = readFieldStateBindingValue(state, name);\n      }\n      if (bindingUpdated(bindings, name, value)) {\n        host.setInputOnDirectives(name, value);\n\n        // If the host node is a native control, we can bind field state properties to native\n        // properties for any that weren't defined as inputs on the custom control.\n        if (parent.elementAcceptsNativeProperty(name) && !host.customControlHasInput(name)) {\n          const domValue = formatDateForMinMax(name, value, parent.nativeFormElement.type);\n          setNativeDomProperty(\n            parent.renderer,\n            parent.nativeFormElement,\n            name,\n            domValue as string | number | boolean | undefined,\n          );\n        }\n      }\n    }\n  };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n  computed,\n  signal,\n  untracked,\n  type Signal,\n  type WritableSignal,\n  type ɵControlDirectiveHost as ControlDirectiveHost,\n} from '@angular/core';\nimport {NG_VALIDATORS, type Validator, Validators, type ValidatorFn} from '@angular/forms';\nimport {reactiveErrorsToSignalErrors} from '../compat/validation_errors';\nimport {type ValidationError} from '../api/rules';\nimport {\n  bindingUpdated,\n  CONTROL_BINDING_NAMES,\n  type ControlBindingKey,\n  createBindings,\n  readFieldStateBindingValue,\n} from './bindings';\nimport {setNativeDomProperty} from './native';\nimport type {FormField} from './form_field';\n\nfunction isValidatorObject(v: Function | Validator): v is Validator {\n  return typeof v === 'object' && v !== null;\n}\n\nexport function cvaControlCreate(\n  host: ControlDirectiveHost,\n  parent: FormField<unknown>,\n): () => void {\n  const bindings = createBindings<ControlBindingKey | 'controlValue'>();\n\n  parent.controlValueAccessor!.registerOnChange((value: unknown) => {\n    // Update tracking for 'controlValue' here so that when the effect runs,\n    // `bindingUpdated` sees that the model value matches the last seen view value.\n    // This prevents the framework from writing the same value back to the CVA (CVA loopback).\n    bindings['controlValue'] = value;\n    parent.state().controlValue.set(value);\n  });\n  parent.controlValueAccessor!.registerOnTouched(() => parent.state().markAsTouched());\n\n  const legacyValidators = parent.injector.get(NG_VALIDATORS, null, {optional: true, self: true});\n  if (legacyValidators) {\n    let version: WritableSignal<number> | undefined;\n\n    for (const v of legacyValidators) {\n      if (isValidatorObject(v) && v.registerOnValidatorChange) {\n        version ??= signal(0);\n        v.registerOnValidatorChange(() => {\n          version!.update((n) => n + 1);\n        });\n      }\n    }\n\n    const validatorFns = legacyValidators.map((v) =>\n      typeof v === 'function' ? (v as ValidatorFn) : v.validate.bind(v),\n    );\n    const mergedValidator = Validators.compose(validatorFns);\n\n    const parseErrors = computed(() => {\n      // Read the `version` signal to re-run the validator when legacy validators trigger their change callbacks.\n      version?.();\n      const errors = mergedValidator ? mergedValidator(parent.interopNgControl.control) : null;\n      return reactiveErrorsToSignalErrors(errors, parent.interopNgControl.control);\n    });\n    // We must cast here because `CompatValidationError` claims to have `fieldTree` statically (to\n    // satisfy `ValidationState` elsewhere), but at construction it is created without it and acts as\n    // `WithoutFieldTree` initially.\n    parent.parseErrorsSource.set(\n      parseErrors as unknown as Signal<readonly ValidationError.WithoutFieldTree[]>,\n    );\n  }\n\n  parent.registerAsBinding({\n    reset: () => {\n      const value = parent.state().value();\n      bindings['controlValue'] = value;\n      untracked(() => parent.controlValueAccessor!.writeValue(value));\n    },\n  });\n\n  return () => {\n    const fieldState = parent.state();\n    const controlValue = fieldState.controlValue();\n\n    if (bindingUpdated(bindings, 'controlValue', controlValue)) {\n      // We don't know if the interop control has underlying signals, so we must use `untracked` to\n      // prevent writing to a signal in a reactive context.\n      untracked(() => parent.controlValueAccessor!.writeValue(controlValue));\n    }\n\n    for (const name of CONTROL_BINDING_NAMES) {\n      const value = readFieldStateBindingValue(fieldState, name);\n      if (bindingUpdated(bindings, name, value)) {\n        const propertyWasSet = host.setInputOnDirectives(name, value);\n        if (name === 'disabled' && parent.controlValueAccessor!.setDisabledState) {\n          untracked(() => parent.controlValueAccessor!.setDisabledState!(value as boolean));\n        } else if (!propertyWasSet && parent.elementAcceptsNativeProperty(name)) {\n          // Fall back to native DOM properties.\n          setNativeDomProperty(\n            parent.renderer,\n            parent.nativeFormElement,\n            name,\n            value as string | number | undefined,\n          );\n        }\n      }\n    }\n  };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport type {DestroyRef} from '@angular/core';\n\n/**\n * Creates a `MutationObserver` to observe changes to the available `<option>`s for this select.\n *\n * @param select The native `<select>` element to observe.\n * @param lView The `LView` that contains the native form control.\n * @param tNode The `TNode` of the native form control.\n * @return The newly created `MutationObserver`.\n */\nexport function observeSelectMutations(\n  select: HTMLSelectElement,\n  onMutation: () => void,\n  destroyRef: DestroyRef,\n): void {\n  if (typeof MutationObserver !== 'function') {\n    // Observing mutations is best-effort.\n    return;\n  }\n\n  const observer = new MutationObserver((mutations) => {\n    if (mutations.some((m) => isRelevantSelectMutation(m))) {\n      onMutation();\n    }\n  });\n  observer.observe(select, {\n    attributes: true,\n    attributeFilter: ['value'],\n    // We watch the character data, because an `<option>` with no explicit `value` property set uses\n    // its text content as its value.\n    // (See https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement/value)\n    characterData: true,\n    childList: true,\n    subtree: true,\n  });\n  destroyRef.onDestroy(() => observer.disconnect());\n}\n\n/**\n * Checks if a given mutation record is relevant for resyncing a <select>.\n * In general its relevant if:\n * - Non comment content of the select changed\n * - The value attribute of an option changed.\n */\nfunction isRelevantSelectMutation(mutation: MutationRecord) {\n  // Consider changes that may add / remove options, or change their text content.\n  if (mutation.type === 'childList' || mutation.type === 'characterData') {\n    // If the target element is a comment it's not relevant.\n    if (mutation.target instanceof Comment) {\n      return false;\n    }\n    // Otherwise if any non-comment nodes were added / removed it is relevant.\n    for (const node of mutation.addedNodes) {\n      if (!(node instanceof Comment)) {\n        return true;\n      }\n    }\n    for (const node of mutation.removedNodes) {\n      if (!(node instanceof Comment)) {\n        return true;\n      }\n    }\n    // Otherwise it's not relevant.\n    return false;\n  }\n  // If the value attribute of an option changed, it's relevant.\n  if (mutation.type === 'attributes' && mutation.target instanceof HTMLOptionElement) {\n    return true;\n  }\n  // Everything else is not relevant.\n  return false;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nimport {\n  type ɵControlDirectiveHost as ControlDirectiveHost,\n  type Signal,\n  type WritableSignal,\n} from '@angular/core';\nimport type {ValidationError} from '../api/rules';\nimport {createParser} from '../util/parser';\nimport {\n  bindingUpdated,\n  CONTROL_BINDING_NAMES,\n  createBindings,\n  readFieldStateBindingValue,\n  type ControlBindingKey,\n} from './bindings';\nimport type {FormField} from './form_field';\nimport {InputValidityMonitor} from './input_validity_monitor';\nimport {\n  formatDateForMinMax,\n  getNativeControlValue,\n  inputRequiresValidityTracking,\n  isInput,\n  setNativeControlValue,\n  setNativeDomProperty,\n} from './native';\nimport {observeSelectMutations} from './select';\n\nexport function nativeControlCreate(\n  host: ControlDirectiveHost,\n  parent: FormField<unknown>,\n  parseErrorsSource: WritableSignal<\n    Signal<readonly ValidationError.WithoutFieldTree[]> | undefined\n  >,\n  validityMonitor: InputValidityMonitor,\n): () => void {\n  let updateMode = false;\n  const input = parent.nativeFormElement;\n\n  // TODO: (perf) ok to always create this?\n  const parser = createParser(\n    // Read from the model value\n    () => parent.state().value(),\n    // Write to the buffered \"control value\"\n    (rawValue: unknown) => parent.state().controlValue.set(rawValue),\n    // Our parse function doesn't care about the raw value that gets passed in,\n    // It just reads the newly parsed value directly off the input element.\n    (_rawValue: unknown) => getNativeControlValue(input, parent.state().value, validityMonitor),\n  );\n\n  parseErrorsSource.set(parser.errors);\n  parent.onReset = () => {\n    parser.reset();\n    const value = parent.state().value();\n    bindings['controlValue'] = value;\n    setNativeControlValue(input, value);\n  };\n  // Pass undefined as the raw value since the parse function doesn't care about it.\n  host.listenToDom('input', () => parser.setRawValue(undefined));\n  host.listenToDom('blur', () => parent.state().markAsTouched());\n\n  // TODO: move extraction to first update pass?\n  if (isInput(input) && inputRequiresValidityTracking(input)) {\n    validityMonitor.watchValidity(parent.destroyRef, input, () => parser.setRawValue(undefined));\n  }\n\n  parent.registerAsBinding();\n\n  // The native `<select>` tracks its `value` by keeping track of the selected `<option>`.\n  // Therefore if we set the value to an arbitrary string *before* the corresponding option has been\n  // created, the `<select>` will ignore it.\n  //\n  // This means that we need to know when an `<option>` is created, destroyed, or has its `value`\n  // changed so that we can re-sync the `<select>` to the field state's value. We implement this\n  // using a `MutationObserver` that we create to observe `<option>` changes.\n  if (input.tagName === 'SELECT') {\n    observeSelectMutations(\n      input as HTMLSelectElement,\n      () => {\n        // It's not legal to access `parent.state()` until update mode has run, but\n        // `observeSelectMutations` may fire earlier. It's okay to ignore these early notifications\n        // because we'll write `input.value` in that first update pass anyway.\n        if (!updateMode) {\n          return;\n        }\n        input.value = parent.state().controlValue() as string;\n      },\n      parent.destroyRef,\n    );\n  }\n\n  const bindings = createBindings<ControlBindingKey | 'controlValue' | 'radioValue'>();\n\n  return () => {\n    const state = parent.state();\n\n    for (const name of CONTROL_BINDING_NAMES) {\n      const value = readFieldStateBindingValue(state, name);\n      if (bindingUpdated(bindings, name, value)) {\n        host.setInputOnDirectives(name, value);\n        if (parent.elementAcceptsNativeProperty(name)) {\n          const domValue = formatDateForMinMax(name, value, input.type);\n          setNativeDomProperty(\n            parent.renderer,\n            input,\n            name,\n            domValue as string | number | boolean | undefined,\n          );\n        }\n      }\n    }\n\n    // We need to update the value after setting the attributes as some attributes like min/max might prevent from setting the value\n    const controlValue = state.controlValue();\n    const controlValueChanged = bindingUpdated(bindings, 'controlValue', controlValue);\n    const radioValueChanged =\n      input.type === 'radio' && bindingUpdated(bindings, 'radioValue', input.value);\n\n    if (controlValueChanged || radioValueChanged) {\n      setNativeControlValue(input, controlValue);\n    }\n\n    updateMode = true;\n  };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {DOCUMENT} from '@angular/common';\nimport {\n  Injectable,\n  CSP_NONCE,\n  inject,\n  type OnDestroy,\n  forwardRef,\n  type DestroyRef,\n} from '@angular/core';\n\n/**\n * Service that monitors validity state changes on native form elements.\n *\n * It works by dynamically installing a CSS transition on `input, textarea` `:valid`\n * and `:invalid` states, which allows us to intercept a `transitionstart` event\n * whenever the native validity state changes without an `input` event (e.g. clearing a date input).\n */\n@Injectable({providedIn: 'root', useClass: forwardRef(() => AnimationInputValidityMonitor)})\nexport abstract class InputValidityMonitor {\n  abstract watchValidity(\n    destroyRef: DestroyRef,\n    element: HTMLInputElement,\n    callback: () => void,\n  ): void;\n  abstract isBadInput(element: HTMLInputElement): boolean;\n}\n\n@Injectable()\nexport class AnimationInputValidityMonitor extends InputValidityMonitor implements OnDestroy {\n  private readonly document = inject(DOCUMENT);\n  private readonly cspNonce = inject(CSP_NONCE, {optional: true});\n  private readonly injectedStyles = new WeakMap<Document | ShadowRoot, HTMLStyleElement>();\n\n  /** Starts watching the given element for validity state changes. */\n  override watchValidity(\n    destroyRef: DestroyRef,\n    element: HTMLInputElement,\n    callback: () => void,\n  ): void {\n    if (typeof ngServerMode !== 'undefined' && ngServerMode) {\n      return;\n    }\n\n    const rootNode = element.getRootNode() as Document | ShadowRoot;\n    if (!this.injectedStyles.has(rootNode)) {\n      this.injectedStyles.set(rootNode, this.createTransitionStyle(rootNode));\n    }\n\n    const onAnimationStart = (event: Event) => {\n      const animationEvent = event as AnimationEvent;\n      if (\n        animationEvent.animationName === 'ng-valid' ||\n        animationEvent.animationName === 'ng-invalid'\n      ) {\n        callback();\n      }\n    };\n    element.addEventListener('animationstart', onAnimationStart);\n    destroyRef.onDestroy(() => {\n      element.removeEventListener('animationstart', onAnimationStart);\n    });\n  }\n\n  override isBadInput(element: HTMLInputElement): boolean {\n    return element.validity?.badInput ?? false;\n  }\n\n  private createTransitionStyle(rootNode: Document | ShadowRoot): HTMLStyleElement {\n    const element = this.document.createElement('style');\n    if (this.cspNonce) {\n      element.nonce = this.cspNonce;\n    }\n    element.textContent = `\n      @keyframes ng-valid {}\n      @keyframes ng-invalid {}\n      input:valid, textarea:valid {\n        animation: ng-valid 0.001s;\n      }\n      input:invalid, textarea:invalid {\n        animation: ng-invalid 0.001s;\n      }\n    `;\n    if (rootNode.nodeType === 9 /* Node.DOCUMENT_NODE */) {\n      (rootNode as Document).head?.appendChild(element);\n    } else {\n      rootNode.appendChild(element);\n    }\n    return element;\n  }\n\n  ngOnDestroy(): void {\n    // We explicitly clean up the main document's injected style wrapper.\n    this.injectedStyles.get(this.document)?.remove();\n\n    // We do not need to iterate over ShadowRoots to clean them up.\n    // The WeakMap drops the reference when the ShadowRoot is destroyed,\n    // and the DOM subtree takes care of its own garbage collection.\n  }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n  afterRenderEffect,\n  computed,\n  type ɵControlDirectiveHost as ControlDirectiveHost,\n  DestroyRef,\n  Directive,\n  effect,\n  ElementRef,\n  ɵformatRuntimeError as formatRuntimeError,\n  inject,\n  InjectionToken,\n  Injector,\n  input,\n  Renderer2,\n  ɵRuntimeError as RuntimeError,\n  type Signal,\n  signal,\n  untracked,\n} from '@angular/core';\nimport {\n  type ControlValueAccessor,\n  NG_VALUE_ACCESSOR,\n  NgControl,\n  ɵFORM_CONTROL_INTEGRATION as FORM_CONTROL_INTEGRATION,\n  ɵselectValueAccessor as selectValueAccessor,\n} from '@angular/forms';\nimport {type ValidationError} from '../api/rules';\nimport type {Field, FieldState} from '../api/types';\nimport {InteropNgControl} from '../controls/interop_ng_control';\nimport {RuntimeErrorCode} from '../errors';\nimport {SIGNAL_FORMS_CONFIG} from '../field/di';\nimport type {FieldNode} from '../field/node';\nimport type {FormUiControl} from '../api/control';\nimport {shallowArrayEquals} from '../util/array';\nimport {bindingUpdated, type ControlBindingKey, createBindings} from './bindings';\nimport {customControlCreate} from './control_custom';\nimport {cvaControlCreate} from './control_cva';\nimport {nativeControlCreate} from './control_native';\nimport {\n  elementAcceptsMinMax,\n  isNativeFormElement,\n  isTextualFormElement,\n  type NativeFormControl,\n} from './native';\nimport {InputValidityMonitor} from './input_validity_monitor';\n\nexport const ɵNgFieldDirective: unique symbol = Symbol();\n\nexport interface FormFieldBindingOptions {\n  /**\n   * Focuses the binding.\n   *\n   * If not specified, Signal Forms will attempt to focus the host element of the `FormField` when\n   * asked to focus this binding.\n   */\n  readonly focus?: (focusOptions?: FocusOptions) => void;\n  /**\n   * Resets the binding.\n   */\n  readonly reset?: () => void;\n}\n\n/**\n * Lightweight DI token provided by the {@link FormField} directive.\n *\n * @see [Custom form controls](guide/forms/signals/custom-controls)\n *\n * @category control\n * @publicApi 22.0\n */\nexport const FORM_FIELD = new InjectionToken<FormField<unknown>>(\n  typeof ngDevMode !== 'undefined' && ngDevMode ? 'FORM_FIELD' : '',\n);\n\n/**\n * Binds a form `FieldTree` to a UI control that edits it. A UI control can be one of several things:\n * 1. A native HTML input or textarea\n * 2. A signal forms custom control that implements `FormValueControl` or `FormCheckboxControl`\n * 3. A component that provides a `ControlValueAccessor`. This should only be used for backwards\n *    compatibility with reactive forms. Prefer options (1) and (2).\n *\n * This directive has several responsibilities:\n * 1. Two-way binds the field state's value with the UI control's value\n * 2. Binds additional forms related state on the field state to the UI control (disabled, required, etc.)\n * 3. Relays relevant events on the control to the field state (e.g. marks touched on blur)\n * 4. Provides a fake `NgControl` that implements a subset of the features available on the\n *    reactive forms `NgControl`. This is provided to improve interoperability with controls\n *    designed to work with reactive forms. It should not be used by controls written for signal\n *    forms.\n *\n * @category control\n *\n * @see [How the FormField directive works](guide/forms/signals/custom-controls#how-the-formfield-directive-works)\n *\n * @publicApi 22.0\n */\n@Directive({\n  selector: '[formField]',\n  exportAs: 'formField',\n  providers: [\n    {provide: FORM_FIELD, useExisting: FormField},\n    {provide: NgControl, useFactory: () => inject(FormField).interopNgControl},\n    {\n      provide: FORM_CONTROL_INTEGRATION,\n      useFactory: () => inject(FORM_FIELD, {self: true}),\n    },\n  ],\n})\nexport class FormField<T> {\n  /**\n   * The field to bind to the underlying form control.\n   */\n  readonly field = input.required<Field<T>>({alias: 'formField'});\n\n  /**\n   * `FieldState` for the currently bound field.\n   */\n  readonly state = computed<FieldState<T>>(() => this.field()());\n\n  /** @internal */\n  readonly renderer = inject(Renderer2);\n\n  /** @internal */\n  readonly destroyRef = inject(DestroyRef);\n\n  /**\n   * The node injector for the DOM element hosting this field binding.\n   */\n  readonly injector = inject(Injector);\n\n  /**\n   * The DOM element hosting this field binding.\n   */\n  readonly element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n  // Compute some helper booleans about the type of element we're sitting on.\n  private readonly elementIsNativeFormElement = isNativeFormElement(this.element);\n  private readonly elementAcceptsTextualValues = isTextualFormElement(this.element);\n  private _elementAcceptsMinMax: boolean | undefined;\n\n  /**\n   * Utility that casts `this.element` to `NativeFormControl` to avoid repeated type guards. Only\n   * safe to access when `elementIsNativeFormElement` is true.\n   *\n   * @internal\n   */\n  readonly nativeFormElement: NativeFormControl = (this.elementIsNativeFormElement\n    ? this.element\n    : undefined) as NativeFormControl;\n\n  /**\n   * Current focus implementation, set by `registerAsBinding`.\n   */\n  private focuser = (options?: FocusOptions) => this.element.focus(options);\n\n  /** Any `ControlValueAccessor` instances provided on the host element. */\n  private readonly controlValueAccessors = inject(NG_VALUE_ACCESSOR, {optional: true, self: true});\n\n  private readonly config = inject(SIGNAL_FORMS_CONFIG, {optional: true});\n  private readonly validityMonitor = inject(InputValidityMonitor);\n\n  /** @internal */\n  readonly parseErrorsSource = signal<\n    Signal<readonly ValidationError.WithoutFieldTree[]> | undefined\n  >(undefined);\n\n  /** A lazily instantiated fake `NgControl`. */\n  private _interopNgControl: InteropNgControl | undefined;\n\n  /** Lazily instantiates a fake `NgControl` for this form field. */\n  /** @internal */\n  get interopNgControl(): InteropNgControl {\n    return (this._interopNgControl ??= new InteropNgControl(this.state));\n  }\n\n  /** @internal */\n  readonly parseErrors = computed<ValidationError.WithFormField[]>(\n    () =>\n      this.parseErrorsSource()?.().map((err) => ({\n        ...err,\n        fieldTree: untracked(this.state).fieldTree,\n        formField: this as FormField<unknown>,\n      })) ?? [],\n    {equal: shallowArrayEquals},\n  );\n\n  /** Errors associated with this form field. */\n  readonly errors = computed(\n    () =>\n      this.state()\n        .errors()\n        .filter((err) => !err.formField || err.formField === this),\n    {equal: shallowArrayEquals},\n  );\n\n  /** Whether this `FormField` has been registered as a binding on its associated `FieldState`. */\n  private isFieldBinding = false;\n\n  /**\n   * Current reset implementation, set by `registerAsBinding`.\n   */\n  private resetter = () => {};\n\n  private parseErrorsResetCallback?: (value?: unknown) => void;\n\n  /** @internal */\n  setParseErrors(source: Signal<ReadonlyArray<{readonly kind: string}>> | undefined): void {\n    this.parseErrorsSource.set(source);\n  }\n\n  /** @internal */\n  set onReset(callback: ((value?: unknown) => void) | undefined) {\n    this.parseErrorsResetCallback = callback;\n  }\n\n  /** @internal */\n  get onReset(): ((value?: unknown) => void) | undefined {\n    return this.parseErrorsResetCallback;\n  }\n\n  /**\n   * A `ControlValueAccessor`, if configured, for the host component.\n   *\n   * @internal\n   */\n  get controlValueAccessor(): ControlValueAccessor | undefined {\n    if (!this.controlValueAccessors || this.controlValueAccessors.length === 0) {\n      return this.interopNgControl?.valueAccessor ?? undefined;\n    }\n\n    // Rely on the exact logic in `@angular/forms` to pick the accessors with correct priority,\n    // passing our fake `InteropNgControl` to fulfill its first parameter requirement.\n    return (\n      selectValueAccessor(\n        this.interopNgControl as unknown as NgControl,\n        this.controlValueAccessors,\n      ) ?? undefined\n    );\n  }\n\n  /**\n   * Creates an `afterRenderEffect` that applies the configured class bindings to the host element\n   * if needed.\n   */\n  private installClassBindingEffect(): void {\n    const classes = Object.entries(this.config?.classes ?? {}).map(\n      ([className, computation]) => [className, computed(() => computation(this))] as const,\n    );\n    if (classes.length === 0) {\n      return;\n    }\n\n    // If we have class bindings to apply, set up an afterRenderEffect to apply them.\n    const bindings = createBindings<string>();\n    afterRenderEffect(\n      {\n        write: () => {\n          for (const [className, computation] of classes) {\n            const active = computation();\n            if (bindingUpdated(bindings, className, active)) {\n              if (active) {\n                this.renderer.addClass(this.element, className);\n              } else {\n                this.renderer.removeClass(this.element, className);\n              }\n            }\n          }\n        },\n      },\n      {injector: this.injector},\n    );\n  }\n\n  /**\n   * Focuses this field binding.\n   *\n   * By default, this will focus the host DOM element. However, custom `FormUiControl`s can\n   * implement custom focusing behavior.\n   */\n  focus(options?: FocusOptions): void {\n    this.focuser(options);\n  }\n\n  /**\n   * Resets the bound control.\n   */\n  reset(): void {\n    this.resetter();\n    this.parseErrorsResetCallback?.(this.state().value());\n  }\n\n  /**\n   * Registers this `FormField` as a binding on its associated `FieldState`.\n   *\n   * This method should be called at most once for a given `FormField`. A `FormField` placed on a\n   * custom control (`FormUiControl`) automatically registers that custom control as a binding.\n   */\n  registerAsBinding(bindingOptions?: FormFieldBindingOptions): void {\n    if (this.isFieldBinding) {\n      throw new RuntimeError(\n        RuntimeErrorCode.BINDING_ALREADY_REGISTERED,\n        typeof ngDevMode !== 'undefined' &&\n          ngDevMode &&\n          'FormField already registered as a binding',\n      );\n    }\n    this.isFieldBinding = true;\n\n    this.installClassBindingEffect();\n\n    if (bindingOptions?.focus) {\n      this.focuser = (focusOptions?: FocusOptions) => bindingOptions.focus!(focusOptions);\n    }\n\n    if (bindingOptions?.reset) {\n      this.resetter = () => bindingOptions.reset!();\n    }\n\n    // Register this control on the field state it is currently bound to. We do this at the end of\n    // initialization so that it only runs if we are actually syncing with this control\n    // (as opposed to just passing the field state through to its `formField` input).\n    effect(\n      (onCleanup) => {\n        const fieldNode = this.state() as unknown as FieldNode;\n        fieldNode.nodeState.formFieldBindings.update((controls) => [\n          ...controls,\n          this as FormField<unknown>,\n        ]);\n        onCleanup(() => {\n          fieldNode.nodeState.formFieldBindings.update((controls) =>\n            controls.filter((c) => c !== this),\n          );\n        });\n      },\n      {injector: this.injector},\n    );\n\n    if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n      effect(\n        () => {\n          const fieldNode = this.state() as unknown as FieldNode;\n          if (fieldNode.hidden()) {\n            const path = fieldNode.structure.pathKeys().join('.') || '<root>';\n            console.warn(\n              formatRuntimeError(\n                RuntimeErrorCode.RENDERED_HIDDEN_FIELD,\n                `Field '${path}' is hidden but is being rendered. ` +\n                  `Hidden fields should be removed from the DOM using @if.`,\n              ),\n            );\n          }\n        },\n        {injector: this.injector},\n      );\n    }\n  }\n\n  /**\n   * The presence of this symbol tells the template type-checker that this directive is a control\n   * directive and should be type-checked as such. We don't use the `ɵngControlCreate` method below\n   * as it's marked internal and removed from the public API. A symbol is used instead to avoid\n   * polluting the public API with the marker.\n   */\n  readonly [ɵNgFieldDirective]!: true;\n\n  /**\n   * Internal control directive creation lifecycle hook.\n   *\n   * The presence of this method tells the compiler to install `ɵɵControlFeature`, which will\n   * cause this directive to be recognized as a control directive by the `ɵcontrolCreate` and\n   * `ɵcontrol` instructions.\n   *\n   * @internal */\n  ɵngControlCreate(host: ControlDirectiveHost<'formField'>): void {\n    if (host.hasPassThrough) {\n      return;\n    }\n\n    if (this.controlValueAccessor) {\n      this.ɵngControlUpdate = cvaControlCreate(host, this as FormField<unknown>);\n    } else if (host.customControl) {\n      this.ɵngControlUpdate = customControlCreate(host, this as FormField<unknown>);\n    } else if (this.elementIsNativeFormElement) {\n      this.ɵngControlUpdate = nativeControlCreate(\n        host,\n        this as FormField<unknown>,\n        this.parseErrorsSource,\n        this.validityMonitor,\n      );\n    } else {\n      throw new RuntimeError(\n        RuntimeErrorCode.INVALID_FIELD_DIRECTIVE_HOST,\n        typeof ngDevMode !== 'undefined' &&\n          ngDevMode &&\n          `${host.descriptor} is an invalid [formField] directive host. The host must be a native form control ` +\n            `(such as <input>', '<select>', or '<textarea>') or a custom form control with a 'value' or ` +\n            `'checked' model.`,\n      );\n    }\n  }\n\n  /** @internal */\n  ɵngControlUpdate: (() => void) | undefined;\n\n  /** @internal */\n  elementAcceptsNativeProperty<K extends ControlBindingKey>(\n    key: K,\n  ): key is K &\n    ('min' | 'max' | 'minLength' | 'maxLength' | 'disabled' | 'required' | 'readonly' | 'name') {\n    if (!this.elementIsNativeFormElement) {\n      return false;\n    }\n\n    switch (key) {\n      case 'min':\n      case 'max':\n        return (this._elementAcceptsMinMax ??= elementAcceptsMinMax(this.element));\n      case 'minLength':\n      case 'maxLength':\n        return this.elementAcceptsTextualValues;\n      case 'disabled':\n      case 'required':\n      case 'readonly':\n      case 'name':\n        return true;\n      default:\n        return false;\n    }\n  }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Directive, input, untracked} from '@angular/core';\n\nimport {submit} from '../api/structure';\nimport {FieldState, FieldTree} from '../api/types';\nimport {FieldNode} from '../field/node';\n\n/**\n * A directive that binds a `FieldTree` to a `<form>` element.\n *\n * It automatically:\n * 1. Sets `novalidate` on the form element to disable browser validation.\n * 2. Listens for the `submit` event, prevents the default behavior, and calls `submit()` on the\n * `FieldTree` if it defines its own submission options.\n *\n * @usageNotes\n *\n * ```html\n * <form [formRoot]=\"myFieldTree\">\n *   ...\n * </form>\n * ```\n *\n * @see [Setting up form submission with FormRoot](guide/forms/signals/form-submission#setting-up-form-submission-with-formroot)\n *\n * @publicApi 22.0\n */\n@Directive({\n  selector: 'form[formRoot]',\n  host: {\n    'novalidate': '',\n    '(submit)': 'onSubmit($event)',\n  },\n})\nexport class FormRoot<T> {\n  readonly fieldTree = input.required<FieldTree<T>>({alias: 'formRoot'});\n\n  protected onSubmit(event: Event): void {\n    event.preventDefault();\n\n    untracked(() => {\n      const fieldTree = this.fieldTree();\n      const node = fieldTree() as FieldState<unknown> as FieldNode;\n\n      if (node.structure.fieldManager.submitOptions) {\n        submit(fieldTree);\n      }\n    });\n  }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n  declareExperimentalWebMcpTool,\n  effect,\n  EnvironmentProviders,\n  inject,\n  Injector,\n  makeEnvironmentProviders,\n  untracked,\n} from '@angular/core';\nimport type {JsonSchemaForInference} from '@mcp-b/webmcp-types';\nimport {submit} from '../api/structure';\nimport {FieldTree} from '../api/types';\nimport {FieldNode} from '../field/node';\nimport {REGISTER_WEBMCP_FORM, RegisterWebMcpForm} from './tokens';\n\nconst registerWebMcpForm: RegisterWebMcpForm = (formTree, options) => {\n  const injector = inject(Injector);\n\n  // we want to defer the registration until the context is fully initialized,\n  // This is especially useful if the form model is a derivation of a required input\n  return new Promise<void>((resolve, reject) => {\n    effect(() => {\n      untracked(() => {\n        initWebMcpForm(formTree, options, injector).then(resolve, reject);\n      });\n    });\n  });\n};\n\nasync function initWebMcpForm(\n  formTree: FieldTree<unknown>,\n  options: {name: string; description: string},\n  injector: Injector,\n) {\n  const node = formTree() as FieldNode;\n  const inputSchema = inferSchemaFromFieldNode(node);\n\n  if (!inputSchema) {\n    throw new Error(\n      `Could not accurately infer WebMCP schema for form \"${options.name}\". ` +\n        `Ensure that the form model does not contain null, undefined, empty arrays, or unsupported types.`,\n    );\n  }\n\n  await declareExperimentalWebMcpTool(\n    {\n      name: options.name,\n      description: options.description,\n      inputSchema,\n      execute: async (args: Record<string, unknown>) => {\n        // Populate the form with changes from the agent.\n        node.value.set(args);\n\n        // Trigger form submission.\n        const success = await submit(formTree);\n\n        // Report the result to the agent.\n        if (success) {\n          return {content: [{type: 'text', text: 'Form submitted successfully.'}]};\n        } else {\n          const errorMessages = node\n            .errorSummary()\n            .map((err) => {\n              const fieldName = (err.fieldTree() as FieldNode).structure.pathKeys().join('.');\n              return `${fieldName ? `${fieldName}: ` : ''}${err.message || err.kind}`;\n            })\n            .join('\\n');\n          return {content: [{type: 'text', text: `Form submission failed:\\n${errorMessages}`}]};\n        }\n      },\n    },\n    injector,\n  );\n}\n\n/** Infers the JSON schema from a specific form field. */\nfunction inferSchemaFromFieldNode(node: FieldNode): JsonSchemaForInference | undefined {\n  const value = node.value();\n\n  // Primitive types.\n  if (typeof value === 'string') return {type: 'string'};\n  if (typeof value === 'number') return {type: 'number'};\n  if (typeof value === 'boolean') return {type: 'boolean'};\n\n  // `null` or `undefined` does not hint at the underlying type.\n  if (value === null || value === undefined) return undefined;\n\n  // Use the type of the first value of an array.\n  if (Array.isArray(value)) {\n    if (value.length === 0) return undefined;\n\n    const firstChild = node.structure.getChild('0');\n    if (!firstChild) return undefined;\n\n    const itemSchema = inferSchemaFromFieldNode(firstChild);\n    if (!itemSchema) return undefined;\n\n    return {\n      type: 'array',\n      items: itemSchema,\n    };\n  }\n\n  // Recursively infer the types of all object properties.\n  if (typeof value === 'object') {\n    const properties: Record<string, JsonSchemaForInference> = {};\n    const required: string[] = [];\n    const children = node.structure.children();\n    for (const child of children) {\n      const key = child.keyInParent();\n      const childSchema = inferSchemaFromFieldNode(child);\n      if (!childSchema) return undefined;\n\n      properties[key] = childSchema;\n\n      if (child.required()) required.push(key.toString());\n    }\n\n    return {\n      type: 'object',\n      properties,\n      required,\n      additionalProperties: false,\n    };\n  }\n\n  return undefined; // Unknown type.\n}\n\n/**\n * Creates a provider that configures all signal forms with `experimentalWebMcpTool`\n * to be registered as WebMCP tools.\n *\n * @see [Implicit tools in Signal Forms](ai/webmcp#implicit-tools-in-signal-forms)\n *\n * @experimental\n */\nexport function provideExperimentalWebMcpForms(): EnvironmentProviders {\n  return makeEnvironmentProviders([\n    {\n      provide: REGISTER_WEBMCP_FORM,\n      useValue: registerWebMcpForm,\n    },\n  ]);\n}\n"],"names":["ɵchain","ɵisPromise","FORM_CONTROL_INTEGRATION","RuntimeError","formatRuntimeError","setNativeDomProperty","isNativeFormElement","isTextualFormElement","selectValueAccessor","elementAcceptsMinMax"],"mappings":";;;;;;;;;;;;;;;AAiBM,SAAU,WAAW,CAAC,KAAc,EAAA;EACxC,OAAO,OAAO,KAAK,KAAK,UAAU,IAAK,KAAa,CAAC,UAAU,CAAC,KAAK,IAAI;AAC3E;;ACPO,MAAM,mBAAmB,GAAG,IAAI,cAAc,CACnD,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,GAAG,qBAAqB,GAAG,EAAE,CAC3E;;ACmBK,SAAU,wBAAwB,CAAC,MAAyB,EAAA;AAChE,EAAA,OAAO,CAAC;AAAC,IAAA,OAAO,EAAE,mBAAmB;AAAE,IAAA,QAAQ,EAAE;AAAM,GAAC,CAAC;AAC3D;;ACSM,SAAU,QAAQ,CACtB,IAA8D,EAC9D,aAGyD,EAAA;EAEzD,mBAAmB,CAAC,IAAI,CAAC;AAEzB,EAAA,MAAM,QAAQ,GAAG,aAAa,CAAC,eAAe,CAAC,IAAI,CAAC;AAEpD,EAAA,IAAI,KAAwE;EAC5E,IAAI,OAAO,aA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