{"version":3,"names":["createContext","createEffect","createMemo","createSignal","createUniqueId","onCleanup","runWithOwner","untrack","useContext","createDefaultValidityData","useFormContext","makeSlotRefDirective","readOption","mergeRootProps","SNAPSHOT_KEYS","snapshotKeys","useFieldValidation","FieldApiContext","useField","ctx","Error","createField","options","form","initialValueAtSetup","value","name","setValue","next","event","reason","ev","Event","cancelable","onValueChange","internalDirty","setInternalDirty","ownedWrite","internalTouched","setInternalTouched","filled","setFilledInner","focused","setFocusedInner","dirty","touched","markedDirtyRef","current","setDirty","undefined","setTouched","setFilled","setFocused","disabled","Boolean","invalid","n","errs","errors","Object","hasOwn","validationMode","validationDebounceTime","shouldValidateOnChange","mode","submitAttemptedRef","validityData","setValidityDataInner","setValidityData","valid","state","error","inFlightCount","setInFlightCount","validating","validateAccessor","validate","fallbackControlId","controlIdSignal","setControlIdSignal","controlIdAccessor","validation","controlId","trackedCommit","v","revalidate","c","p","commit","finally","defaultPrevented","userValidate","isAsync","constructor","result","reset","fallbackControlRef","entry","getValue","controlRef","inputRef","r","lastKey","writeEntry","key","formRef","fields","delete","set","pushInitialValue","registration","initialValue","cur","controlInternal","id","aria-invalid","onFocus","_event","onBlur","currentTarget","onInput","clearErrors","debounce","control","userProps","baseDirective","el","api","validity","Provider","props","children","_internal","validateFn","setControlId","FIELD_SNAPSHOT_KEYS"],"sources":["create-field.tsx"],"sourcesContent":["import type { JSX } from \"@solidjs/web\";\nimport {\n\ttype Accessor,\n\tcreateContext,\n\tcreateEffect,\n\tcreateMemo,\n\tcreateSignal,\n\tcreateUniqueId,\n\tonCleanup,\n\trunWithOwner,\n\tuntrack,\n\tuseContext,\n} from \"solid-js\";\nimport {\n\tcreateDefaultValidityData,\n\ttype FieldRegistration,\n\ttype FieldValidateFn,\n\ttype FieldValidationMode,\n\ttype FieldValidationProps,\n\ttype FieldValidityData,\n\ttype MutableRef,\n} from \"../internals/field-context\";\nimport { type FormFieldEntry, useFormContext } from \"../internals/form-context\";\nimport { makeSlotRefDirective } from \"../internals/make-slot-ref-directive\";\nimport { type MaybeAccessor, readOption } from \"../internals/maybe-accessor\";\nimport { mergeRootProps } from \"../internals/merge-root-props\";\nimport {\n\tSNAPSHOT_KEYS,\n\ttype Snapshottable,\n\tsnapshotKeys,\n} from \"../internals/observability/snapshot\";\nimport { useFieldValidation } from \"../internals/use-field-validation/use-field-validation\";\n\n/**\n * Why a value/touched/lifecycle change happened. Emitted as the third\n * argument of `onValueChange(next, event, reason)` and accepted by\n * imperative setters.\n *\n * - `\"input\"` — change originated from the control's `onInput` handler.\n * - `\"reset\"` — change originated from {@link FieldApi.reset}.\n * - `\"imperative\"` — programmatic change with no originating DOM event,\n *   or caller-supplied reason not covered above.\n */\nexport type FieldChangeReason = \"input\" | \"reset\" | \"imperative\";\n\n/**\n * Options for {@link createField}.\n *\n * Everything reactive accepts `MaybeAccessor<T>` so a consumer can flip\n * `disabled`/`invalid`/`name` etc. at runtime without re-creating the\n * primitive.\n */\nexport interface CreateFieldOptions<V = unknown> {\n\t/**\n\t * Value accessor. Consumer-owned signal — `createField` reads through\n\t * this and never owns its own value state. The setup-time read is\n\t * captured and used as the reset target (`reset()` fires\n\t * `onValueChange(initial, event, \"reset\")` so the consumer can\n\t * restore their signal). See `solidify.md` §6.\n\t */\n\tvalue?: MaybeAccessor<V | undefined>;\n\t/**\n\t * Pre-change callback. Called synchronously before the internal value\n\t * write. The consumer may call `event.preventDefault()` to veto the\n\t * change.\n\t *\n\t * **Pre/post asymmetry — important.** Reading `c.value()` inside this\n\t * handler returns the OLD value. For post-change observation, use\n\t * `createEffect(c.value, (next) => ...)`.\n\t */\n\tonValueChange?: (value: V, event: Event, reason: FieldChangeReason) => void;\n\t/** Whether interaction is suppressed. */\n\tdisabled?: MaybeAccessor<boolean | undefined>;\n\t/**\n\t * Force `valid: false` regardless of validator output. Useful when\n\t * field validity is owned by an external system (server response,\n\t * separate model layer).\n\t */\n\tinvalid?: MaybeAccessor<boolean | undefined>;\n\t/**\n\t * External `dirty` override. When defined, `c.dirty()` reads this\n\t * instead of the internal flip-flop. Setter calls become no-ops\n\t * (consumer is the source of truth).\n\t */\n\tdirty?: MaybeAccessor<boolean | undefined>;\n\t/** External `touched` override. Same shape as {@link dirty}. */\n\ttouched?: MaybeAccessor<boolean | undefined>;\n\t/**\n\t * Identifier this field uses when registering into a surrounding\n\t * `<Form>`. Optional — when omitted, the field still validates but\n\t * isn't keyed into the form's `fields` map by name (server-error\n\t * lookup uses this name; cross-field `formValues` keys by it).\n\t */\n\tname?: MaybeAccessor<string | undefined>;\n\t/**\n\t * Custom validator. Receives the current value and a snapshot of all\n\t * sibling field values keyed by name. Return a string / list of\n\t * strings (errors) or `null` (valid). Both sync and `async` shapes\n\t * are supported — `async` validators (`zod.parseAsync`, async\n\t * refinements, server-side checks) are awaited by the surrounding\n\t * `<Form>` on submit before validity is read.\n\t */\n\tvalidate?: FieldValidateFn;\n\t/**\n\t * When validation should run. Inherited from `<Form validationMode>`\n\t * if undefined.\n\t *\n\t * - `\"onSubmit\"` — only on form submit (default after a failed submit\n\t *   triggers re-validation on every change).\n\t * - `\"onBlur\"` — when the control loses focus.\n\t * - `\"onChange\"` — every input event (with optional debounce).\n\t */\n\tvalidationMode?: MaybeAccessor<FieldValidationMode | undefined>;\n\t/** Debounce for `validationMode === \"onChange\"` (ms). */\n\tvalidationDebounceTime?: MaybeAccessor<number | undefined>;\n}\n\n/**\n * Public API returned by {@link createField}. Flat accessors at the root —\n * no `state` blob.\n *\n * The `[SNAPSHOT_KEYS]` symbol is attached post-construction (NOT declared\n * on this interface; see `primitive-template.md` §2.5) so `snapshot(c)`\n * returns a debug-friendly plain-object view of the field's logical state.\n */\nexport interface FieldApi<V = unknown> {\n\t/** Current value (controlled accessor wins; falls back to internal). */\n\tvalue: Accessor<V | undefined>;\n\t/**\n\t * Imperative value setter. Fires `onValueChange(next, event, reason)`\n\t * before the internal write; consumer can `event.preventDefault()` to\n\t * veto.\n\t */\n\tsetValue: (next: V, event?: Event, reason?: FieldChangeReason) => void;\n\n\t/** Whether interaction is suppressed. */\n\tdisabled: Accessor<boolean>;\n\t/** External-invalid override or form-level error presence. */\n\tinvalid: Accessor<boolean>;\n\n\t/** Whether the user has typed/cleared since mount. */\n\tdirty: Accessor<boolean>;\n\t/** Whether the control has lost focus at least once. */\n\ttouched: Accessor<boolean>;\n\t/** Whether the input element currently has a non-empty value. */\n\tfilled: Accessor<boolean>;\n\t/** Whether the input element currently has focus. */\n\tfocused: Accessor<boolean>;\n\n\tsetDirty: (value: boolean) => void;\n\tsetTouched: (value: boolean) => void;\n\tsetFilled: (value: boolean) => void;\n\tsetFocused: (value: boolean) => void;\n\n\t/** Raw validity record (state + errors + value snapshot). */\n\tvalidity: Accessor<FieldValidityData>;\n\t/**\n\t * Tri-state: `true` (passed all checks), `false` (custom or native\n\t * error), `null` (not yet validated).\n\t */\n\tvalid: Accessor<boolean | null>;\n\t/** True while an async `validate` is in-flight. */\n\tvalidating: Accessor<boolean>;\n\t/** Active error messages from the last validation. */\n\terrors: Accessor<readonly string[]>;\n\t/**\n\t * First / primary error, if any. Convenience for the common\n\t * single-error rendering case.\n\t */\n\terror: Accessor<string>;\n\n\t/**\n\t * Imperatively validate the current value. Returns the in-flight\n\t * Promise when `options.validate` is `async` (so callers can `await`);\n\t * returns `void` when the validator is sync (writes have already\n\t * landed). The surrounding `<Form>`'s submit path uses the same\n\t * shape to gate submission on async validators.\n\t */\n\tvalidate: (event?: Event) => Promise<void> | void;\n\n\t/**\n\t * Restore the value to the setup-time captured initial, clear\n\t * touched/dirty/validity. Fires `onValueChange(initial, event,\n\t * \"reset\")` with the synthesized event so consumers can observe (and\n\t * optionally veto).\n\t */\n\treset: (event?: Event) => void;\n\n\t/**\n\t * Control slot — getter-bag of HTML attributes ready for spreading\n\t * onto an `<input>` (or any compatible element). Includes the\n\t * validation pipeline's `onInput` handler, `aria-invalid`, focus/blur\n\t * handlers, and the registered control id.\n\t */\n\tcontrol: <U extends object | undefined = undefined>(\n\t\tuserProps?: U,\n\t) => FieldControlSlotProps & (U extends object ? U : object);\n\t/** Directive form of {@link control}. */\n\tcontrolRef: () => (el: HTMLInputElement | null) => void;\n\n\t/**\n\t * Context provider. Wrap a subtree to make this api discoverable via\n\t * {@link useField} without prop-drilling.\n\t */\n\tProvider: (props: { children: JSX.Element }) => JSX.Element;\n\n\t/**\n\t * Internal bridge surface for `<Field.Root>` composition. Not part of\n\t * the public API — see {@link FieldApiInternal}.\n\t */\n\t_internal: FieldApiInternal<V>;\n}\n\n/**\n * Bridge surface exposed on `api._internal`. Consumed by `<Field.Root>` to\n * compose the `FieldContextValue` without duplicating state. **Not part of\n * the public API** — the leading underscore signals intent; downstream code\n * should use `FieldApi` members directly.\n */\nexport interface FieldApiInternal<_V = unknown> {\n\t/** The raw `validate` option as a reactive accessor (for useFieldValidation). */\n\tvalidateFn: Accessor<FieldValidateFn | undefined>;\n\t/** Props-factories + inputRef + commit from the composed validation pipeline. */\n\tvalidation: FieldValidationProps;\n\t/** The `markedDirtyRef` used to gate `valueMissing`-only errors. */\n\tmarkedDirtyRef: MutableRef<boolean>;\n\t/** Resolved validation mode (inherits from Form). */\n\tvalidationMode: Accessor<FieldValidationMode>;\n\t/** Debounce time in ms for `onChange` mode. */\n\tvalidationDebounceTime: Accessor<number>;\n\t/** Whether validation should run on every input change. */\n\tshouldValidateOnChange: Accessor<boolean>;\n\t/** Direct setter for `validityData` (bypasses the tracked commit path). */\n\tsetValidityData: (next: FieldValidityData) => void;\n\t/** Combined field state for `data-*` projections. */\n\tstate: Accessor<{\n\t\tdisabled: boolean;\n\t\ttouched: boolean;\n\t\tdirty: boolean;\n\t\tvalid: boolean | null;\n\t\tfilled: boolean;\n\t\tfocused: boolean;\n\t}>;\n\t/**\n\t * Register (or unregister) a control via the same symbol+registration\n\t * protocol used by `<Field.Root>`. FieldRoot builds its own thin\n\t * `registerFieldControl` on top of this to sync `initialValue` while\n\t * leaving form-entry management to createField.\n\t *\n\t * `controlRef` on the registration is intentionally not used here —\n\t * `Field.Control` already writes `field.validation.inputRef.current`\n\t * directly via its `ref` prop, which is the same ref `useFieldValidation`\n\t * reads for `element.validity` checks.\n\t */\n\tpushInitialValue: (registration: FieldRegistration | undefined) => void;\n\t/**\n\t * Override createField's auto-generated controlId. FieldRoot's bridge\n\t * calls this from `registerFieldControl` so the form-fields-map key\n\t * matches the actual `<input>`'s DOM id (which comes from the\n\t * labelable-provider id pool, not createField's `createUniqueId()`).\n\t */\n\tsetControlId: (id: string) => void;\n}\n\n/**\n * Shape of attributes emitted by `c.control()`. Intersected with any\n * caller-supplied extras at the call site.\n */\nexport interface FieldControlSlotProps {\n\tid: string;\n\tname: string | undefined;\n\tdisabled: boolean;\n\t\"aria-invalid\": \"true\" | \"false\";\n\tonInput: (event: InputEvent & { currentTarget: HTMLInputElement }) => void;\n\tonFocus: (event: FocusEvent) => void;\n\tonBlur: (event: FocusEvent & { currentTarget: HTMLInputElement }) => void;\n}\n\nconst FieldApiContext = createContext<FieldApi<unknown> | null>(null);\n\n/**\n * Read the nearest {@link FieldApi} provided by `c.Provider`. Throws if\n * called outside one — match the\n * `useCollapsible()` / `useToggle()` pattern.\n */\nexport function useField<V = unknown>(): FieldApi<V> {\n\tconst ctx = useContext(FieldApiContext);\n\tif (ctx == null) {\n\t\tthrow new Error(\n\t\t\t\"Base UI: useField() must be called inside a <c.Provider>.\",\n\t\t);\n\t}\n\treturn ctx as FieldApi<V>;\n}\n\n/**\n * Solid 2.0-native primitive for a single form field. Owns value\n * (controlled/uncontrolled), interaction lifecycle (touched/dirty/\n * filled/focused), and the validation pipeline. Composes\n * `useFieldValidation` under the hood — async validators (`async fn`,\n * `zod.parseAsync`, server-side checks) are first-class and gate the\n * surrounding `<Form>`'s submit when used inside one.\n *\n * Consumers can drive markup either via `c.control()` (slot getter-bag\n * spread onto an `<input>`) or via `c.controlRef()` (directive form, for\n * cva-style variants and any consumer-owned JSX). Both surfaces wire the\n * same internal handlers.\n *\n * When called inside a `<Form>`, the field auto-registers into the form's\n * fields map under the generated control id so submit-time validation\n * can find it. Outside a Form, the field works standalone.\n */\nexport function createField<V = unknown>(\n\toptions: CreateFieldOptions<V> = {},\n): FieldApi<V> {\n\tconst form = useFormContext();\n\n\t// ---------- value: consumer-owned signal ----------\n\t// Solid-native shape (2026-04-30, §4.1): no internal signal, no\n\t// defaultValue. Consumer brings the accessor; `setValue` is a pure\n\t// event-emitter that fires `onValueChange`. The consumer's signal\n\t// write is the only writer.\n\t//\n\t// We capture the initial value once at setup so `reset()` has a\n\t// target to fire `onValueChange(initial, …, \"reset\")` against; the\n\t// consumer is then expected to update their signal in response.\n\tconst initialValueAtSetup = untrack(() => readOption(options.value));\n\tconst value = createMemo<V | undefined>(() => readOption(options.value), {\n\t\tname: \"field.value\",\n\t});\n\n\tconst setValue = (\n\t\tnext: V,\n\t\tevent?: Event,\n\t\treason: FieldChangeReason = \"imperative\",\n\t): void => {\n\t\tconst ev = event ?? new Event(\"valuechange\", { cancelable: true });\n\t\t// Use runWithOwner(null, ...) to escape the current reactive owner so\n\t\t// that consumer signal writes inside onValueChange don't trigger\n\t\t// SIGNAL_WRITE_IN_OWNED_SCOPE. Event-emitter pattern — exits the\n\t\t// reactive graph intentionally.\n\t\trunWithOwner(null, () => options.onValueChange?.(next, ev, reason));\n\t};\n\n\t// ---------- lifecycle flip-flops ----------\n\tconst [internalDirty, setInternalDirty] = createSignal(false, {\n\t\townedWrite: true,\n\t\tname: \"field.dirty\",\n\t});\n\tconst [internalTouched, setInternalTouched] = createSignal(false, {\n\t\townedWrite: true,\n\t\tname: \"field.touched\",\n\t});\n\tconst [filled, setFilledInner] = createSignal(false, {\n\t\townedWrite: true,\n\t\tname: \"field.filled\",\n\t});\n\tconst [focused, setFocusedInner] = createSignal(false, {\n\t\townedWrite: true,\n\t\tname: \"field.focused\",\n\t});\n\n\tconst dirty = createMemo<boolean>(\n\t\t() => readOption(options.dirty) ?? internalDirty(),\n\t\t{ name: \"field.dirtyResolved\" },\n\t);\n\tconst touched = createMemo<boolean>(\n\t\t() => readOption(options.touched) ?? internalTouched(),\n\t\t{ name: \"field.touchedResolved\" },\n\t);\n\n\t// `markedDirtyRef` gates valueMissing: native `required` errors only\n\t// surface once the user has touched the field, so a fresh form\n\t// doesn't render every empty required field as invalid on mount.\n\t// Plain mutable ref — NOT a signal. Mirrors React's pattern.\n\tconst markedDirtyRef: MutableRef<boolean> = { current: false };\n\n\tconst setDirty = (next: boolean): void => {\n\t\tif (readOption(options.dirty) !== undefined) return;\n\t\tif (next) markedDirtyRef.current = true;\n\t\tsetInternalDirty(next);\n\t};\n\tconst setTouched = (next: boolean): void => {\n\t\tif (readOption(options.touched) !== undefined) return;\n\t\tsetInternalTouched(next);\n\t};\n\tconst setFilled = (next: boolean): void => {\n\t\tsetFilledInner(next);\n\t};\n\tconst setFocused = (next: boolean): void => {\n\t\tsetFocusedInner(next);\n\t};\n\n\t// ---------- disabled / invalid ----------\n\tconst disabled = createMemo<boolean>(\n\t\t() => Boolean(readOption(options.disabled)),\n\t\t{ name: \"field.disabled\" },\n\t);\n\n\tconst name = (): string | undefined => readOption(options.name);\n\n\t// `invalid` combines the consumer override with any Form-level error\n\t// for this field's name. Mirrors `<Field.Root>`'s logic.\n\tconst invalid = createMemo<boolean>(\n\t\t() => {\n\t\t\tif (readOption(options.invalid) === true) return true;\n\t\t\tconst n = name();\n\t\t\tif (!n) return false;\n\t\t\tconst errs = form.errors();\n\t\t\treturn Object.hasOwn(errs, n) && errs[n] !== undefined;\n\t\t},\n\t\t{ name: \"field.invalid\" },\n\t);\n\n\t// ---------- validation mode ----------\n\tconst validationMode = createMemo<FieldValidationMode>(\n\t\t() => readOption(options.validationMode) ?? form.validationMode(),\n\t\t{ name: \"field.validationMode\" },\n\t);\n\tconst validationDebounceTime = (): number =>\n\t\treadOption(options.validationDebounceTime) ?? 0;\n\n\tconst shouldValidateOnChange = createMemo<boolean>(\n\t\t() => {\n\t\t\tconst mode = validationMode();\n\t\t\treturn (\n\t\t\t\tmode === \"onChange\" ||\n\t\t\t\t(mode === \"onSubmit\" && form.submitAttemptedRef.current)\n\t\t\t);\n\t\t},\n\t\t{ name: \"field.shouldValidateOnChange\" },\n\t);\n\n\t// ---------- validity ----------\n\tconst [validityData, setValidityDataInner] = createSignal<FieldValidityData>(\n\t\tcreateDefaultValidityData(),\n\t\t{ ownedWrite: true, name: \"field.validityData\" },\n\t);\n\tconst setValidityData = (next: FieldValidityData): void => {\n\t\tsetValidityDataInner(next);\n\t};\n\n\tconst valid = createMemo<boolean | null>(\n\t\t() => {\n\t\t\tif (invalid()) return false;\n\t\t\treturn validityData().state.valid;\n\t\t},\n\t\t{ name: \"field.valid\" },\n\t);\n\n\tconst errors = createMemo<readonly string[]>(() => validityData().errors, {\n\t\tname: \"field.errors\",\n\t});\n\tconst error = createMemo<string>(() => validityData().error, {\n\t\tname: \"field.error\",\n\t});\n\n\t// `validating`: in-flight counter for async commits. Increments at the\n\t// start of every commit, decrements after the await chain settles.\n\t// Counter (not boolean) so concurrent calls don't false-resolve to\n\t// `false` when an inner one settles before the outer.\n\tconst [inFlightCount, setInFlightCount] = createSignal(0, {\n\t\townedWrite: true,\n\t\tname: \"field.inFlightCount\",\n\t});\n\tconst validating = createMemo<boolean>(() => inFlightCount() > 0, {\n\t\tname: \"field.validating\",\n\t});\n\n\t// ---------- composed validation pipeline ----------\n\t// `useFieldValidation` is the engine. Wrap its `commit` so we can\n\t// track in-flight count for the `validating` accessor.\n\tconst validateAccessor = (): FieldValidateFn | undefined => options.validate;\n\n\t// Stable controlId. `useFieldValidation` keys back into Form's fields\n\t// map under this; it's also stamped on the `<input>` we render via\n\t// `c.control()` so server-error lookup-by-name and DOM-id-by-control\n\t// stay aligned.\n\t//\n\t// Signal (not constant) so the structural FieldRoot bridge can swap\n\t// in the actual DOM input id when `<Field.Control>` registers via\n\t// `registerFieldControl` (the labelable-provider id pool gives the\n\t// input its own id; the form-fields-map key must match it so\n\t// `formRef.fields.has(input.id)` finds the entry).\n\tconst fallbackControlId = createUniqueId();\n\tconst [controlIdSignal, setControlIdSignal] = createSignal(\n\t\tfallbackControlId,\n\t\t{ ownedWrite: true, name: \"field.controlId\" },\n\t);\n\tconst controlIdAccessor = (): string => controlIdSignal();\n\n\t// Named state memo — shared with useFieldValidation and exposed via\n\t// `_internal.state` so FieldRoot can build FieldContextValue.state.\n\tconst state = createMemo(\n\t\t() => ({\n\t\t\tdisabled: disabled(),\n\t\t\ttouched: touched(),\n\t\t\tdirty: dirty(),\n\t\t\tvalid: valid(),\n\t\t\tfilled: filled(),\n\t\t\tfocused: focused(),\n\t\t}),\n\t\t{ name: \"field.state\" },\n\t);\n\n\tconst validation = useFieldValidation({\n\t\tsetValidityData,\n\t\tvalidate: validateAccessor,\n\t\tvalidityData,\n\t\tvalidationDebounceTime,\n\t\tinvalid,\n\t\tmarkedDirtyRef,\n\t\tstate,\n\t\tname,\n\t\tcontrolId: controlIdAccessor,\n\t\tshouldValidateOnChange,\n\t});\n\n\tconst trackedCommit = (v: unknown, revalidate?: boolean): Promise<void> => {\n\t\tsetInFlightCount((c) => c + 1);\n\t\tconst p = validation.commit(v, revalidate);\n\t\t// `validation.commit` always returns a Promise (the underlying\n\t\t// commit body is async); decrement once it settles, regardless of\n\t\t// outcome. We do NOT await here — caller decides whether to.\n\t\tp.finally(() => setInFlightCount((c) => c - 1));\n\t\treturn p;\n\t};\n\n\t// ---------- imperative validate ----------\n\tconst validate = (event?: Event): Promise<void> | void => {\n\t\t// Synthesize an event purely for parity with `setValue` / `reset`'s\n\t\t// shape — we don't currently expose a pre-validate hook, but we\n\t\t// honor `defaultPrevented` if a consumer wires one.\n\t\tconst ev = event ?? new Event(\"validate\", { cancelable: true });\n\t\tif (ev.defaultPrevented) return;\n\t\tmarkedDirtyRef.current = true;\n\t\tconst userValidate = options.validate;\n\t\tconst isAsync = userValidate?.constructor.name === \"AsyncFunction\";\n\t\tconst result = trackedCommit(untrack(value));\n\t\tif (isAsync) return result;\n\t\treturn undefined;\n\t};\n\n\t// ---------- reset ----------\n\t// Fire `onValueChange(initialValue, event, \"reset\")` against the value\n\t// captured at setup; the consumer is expected to update their signal\n\t// in response. createField does NOT write the value itself — same\n\t// rule as setValue. Lifecycle flags + validity ARE cleared internally\n\t// since they're owned here.\n\tconst reset = (event?: Event): void => {\n\t\tconst ev = event ?? new Event(\"reset\", { cancelable: true });\n\t\t// runWithOwner(null) escapes the reactive owner so consumer signal\n\t\t// writes inside onValueChange don't trigger SIGNAL_WRITE_IN_OWNED_SCOPE.\n\t\trunWithOwner(null, () =>\n\t\t\toptions.onValueChange?.(initialValueAtSetup as V, ev, \"reset\"),\n\t\t);\n\t\tsetInternalDirty(false);\n\t\tsetInternalTouched(false);\n\t\tsetFilledInner(false);\n\t\tsetFocusedInner(false);\n\t\tmarkedDirtyRef.current = false;\n\t\tsetValidityDataInner(\n\t\t\tcreateDefaultValidityData(initialValueAtSetup ?? null),\n\t\t);\n\t};\n\n\t// ---------- form integration ----------\n\t// Whenever this primitive lives inside a `<Form>`, register a\n\t// `FormFieldEntry` so submit-time validation can find us. The entry\n\t// is keyed by `controlId`. We re-write on every value change so the\n\t// snapshot the form captures stays current.\n\t// Always register — even when `form.present === false` (i.e. no\n\t// `<Form>` ancestor), the consumer-supplied noop context has its own\n\t// `formRef.current.fields` Map that test fixtures and external consumers\n\t// inspect via `useFieldContext` lookups. Skipping the write would break\n\t// the \"test registers the control into Form's fields map under its id\"\n\t// contract that field-root previously enforced unconditionally.\n\t{\n\t\tconst fallbackControlRef: MutableRef<HTMLElement | null> = {\n\t\t\tcurrent: null,\n\t\t};\n\t\tconst entry = (): FormFieldEntry => ({\n\t\t\tname: name(),\n\t\t\tgetValue: () => untrack(value),\n\t\t\tcontrolRef:\n\t\t\t\t(validation.inputRef as MutableRef<HTMLElement | null>) ??\n\t\t\t\tfallbackControlRef,\n\t\t\tvalidityData: validityData(),\n\t\t\tvalidate: () => {\n\t\t\t\t// Match `validateControl()` in field-root: detect async via\n\t\t\t\t// the user's validator shape and only return the Promise to\n\t\t\t\t// Form when one is in-flight, so all-sync forms keep their\n\t\t\t\t// React-parity sync submit.\n\t\t\t\tmarkedDirtyRef.current = true;\n\t\t\t\tconst userValidate = options.validate;\n\t\t\t\tconst isAsync = userValidate?.constructor.name === \"AsyncFunction\";\n\t\t\t\tconst r = trackedCommit(untrack(value));\n\t\t\t\tif (isAsync) return r;\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t});\n\n\t\t// Track the previous key so a controlId swap (when FieldRoot's\n\t\t// bridge calls `_internal.setControlId(input.id)`) can delete the\n\t\t// old entry before writing under the new key.\n\t\tlet lastKey: string | undefined;\n\t\tconst writeEntry = (): void => {\n\t\t\tconst key = controlIdSignal();\n\t\t\tif (lastKey !== undefined && lastKey !== key) {\n\t\t\t\tform.formRef.current.fields.delete(lastKey);\n\t\t\t}\n\t\t\tform.formRef.current.fields.set(key, entry());\n\t\t\tlastKey = key;\n\t\t};\n\n\t\t// Initial registration.\n\t\tuntrack(writeEntry);\n\t\t// Refresh on controlId / value / name / validity change so the\n\t\t// snapshot is current and the key tracks the registered control id.\n\t\tcreateEffect(\n\t\t\t() => {\n\t\t\t\tcontrolIdSignal();\n\t\t\t\tvalue();\n\t\t\t\tname();\n\t\t\t\tvalidityData();\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tuntrack(writeEntry);\n\t\t\t},\n\t\t);\n\t\tonCleanup(() => {\n\t\t\tif (lastKey !== undefined) {\n\t\t\t\tform.formRef.current.fields.delete(lastKey);\n\t\t\t}\n\t\t});\n\t}\n\n\t// ---------- bridge: initial-value sync for FieldRoot ----------\n\t// When `<Field.Root>` wraps this primitive, `<Field.Control>` registers\n\t// itself via `registerFieldControl`. FieldRoot calls `pushInitialValue`\n\t// so the first-known value is seeded into `validityData.initialValue`\n\t// (mirrors the old `syncInitialValue` in FieldRoot).\n\tconst pushInitialValue = (\n\t\tregistration: FieldRegistration | undefined,\n\t): void => {\n\t\tif (!registration) return;\n\t\tuntrack(() => {\n\t\t\tlet initialValue = registration.value;\n\t\t\tif (initialValue === undefined && registration.getValue) {\n\t\t\t\tinitialValue = registration.getValue();\n\t\t\t}\n\t\t\tconst cur = validityData();\n\t\t\tif (cur.initialValue === null && initialValue !== null) {\n\t\t\t\tsetValidityData({ ...cur, initialValue });\n\t\t\t}\n\t\t});\n\t};\n\n\t// ---------- control slot ----------\n\tconst controlInternal = {\n\t\tget id() {\n\t\t\treturn controlIdSignal();\n\t\t},\n\t\tget name() {\n\t\t\treturn name();\n\t\t},\n\t\tget disabled() {\n\t\t\treturn disabled();\n\t\t},\n\t\tget \"aria-invalid\"() {\n\t\t\treturn valid() === false ? (\"true\" as const) : (\"false\" as const);\n\t\t},\n\t\tonFocus(_event: FocusEvent): void {\n\t\t\tsetFocused(true);\n\t\t},\n\t\tonBlur(event: FocusEvent & { currentTarget: HTMLInputElement }): void {\n\t\t\tsetTouched(true);\n\t\t\tsetFocused(false);\n\t\t\tif (validationMode() === \"onBlur\") {\n\t\t\t\tvoid trackedCommit(event.currentTarget.value);\n\t\t\t}\n\t\t},\n\t\tonInput(event: InputEvent & { currentTarget: HTMLInputElement }): void {\n\t\t\tconst next = event.currentTarget.value;\n\t\t\tsetDirty(next !== validityData().initialValue);\n\t\t\tsetFilled(next !== \"\");\n\t\t\t// Mirror the value through the controlled-or-internal channel.\n\t\t\t// `setValue` honors the `event.preventDefault()` veto and\n\t\t\t// dispatches `onValueChange` with the live `InputEvent`.\n\t\t\tsetValue(next as V, event, \"input\");\n\t\t\t// Validation-on-change lives in `useFieldValidation`'s\n\t\t\t// `getInputValidationProps().onInput` — but since we're not\n\t\t\t// splatting that handler (we own the control bag here), do\n\t\t\t// the equivalent dispatch ourselves: clear form-level errors\n\t\t\t// for our name, then commit either with revalidate=true (when\n\t\t\t// not validating on change) or directly (when on-change).\n\t\t\tform.clearErrors(name());\n\t\t\tif (!shouldValidateOnChange()) {\n\t\t\t\tvoid trackedCommit(next, true);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (next === \"\") {\n\t\t\t\t// Empty bypasses debounce so `required` clears immediately.\n\t\t\t\tvoid trackedCommit(next);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst debounce = validationDebounceTime();\n\t\t\tif (debounce > 0) {\n\t\t\t\t// We don't ship a timer instance here — keep the simple\n\t\t\t\t// path: trigger the commit. Consumers wanting debounced\n\t\t\t\t// validation should use the structural <Field.Control>\n\t\t\t\t// which composes `useFieldValidation`'s debounced\n\t\t\t\t// handler. createField's slot is the no-debounce path.\n\t\t\t\tvoid trackedCommit(next);\n\t\t\t} else {\n\t\t\t\tvoid trackedCommit(next);\n\t\t\t}\n\t\t},\n\t};\n\n\tconst control = <U extends object | undefined>(userProps?: U) =>\n\t\tmergeRootProps(\n\t\t\tcontrolInternal as Record<string, unknown>,\n\t\t\tuserProps,\n\t\t) as FieldControlSlotProps & (U extends object ? U : object);\n\n\tconst controlRef = (): ((el: HTMLInputElement | null) => void) => {\n\t\tconst baseDirective = makeSlotRefDirective(\n\t\t\t() => control() as Record<string, unknown>,\n\t\t);\n\t\t// The validation pipeline needs access to the live element for\n\t\t// `element.validity` reads + `setCustomValidity()` writes. Layer\n\t\t// the inputRef.current assignment on top of the slot-ref\n\t\t// directive's own ref-application step.\n\t\treturn (el: HTMLInputElement | null): void => {\n\t\t\tvalidation.inputRef.current = el;\n\t\t\tbaseDirective(el);\n\t\t};\n\t};\n\n\t// ---------- assemble api ----------\n\tconst api: FieldApi<V> = {\n\t\tvalue,\n\t\tsetValue,\n\t\tdisabled,\n\t\tinvalid,\n\t\tdirty,\n\t\ttouched,\n\t\tfilled,\n\t\tfocused,\n\t\tsetDirty,\n\t\tsetTouched,\n\t\tsetFilled,\n\t\tsetFocused,\n\t\tvalidity: validityData,\n\t\tvalid,\n\t\tvalidating,\n\t\terrors,\n\t\terror,\n\t\tvalidate,\n\t\treset,\n\t\tcontrol,\n\t\tcontrolRef,\n\t\tProvider: (props) => (\n\t\t\t<FieldApiContext value={api as FieldApi<unknown>}>\n\t\t\t\t{props.children}\n\t\t\t</FieldApiContext>\n\t\t),\n\t\t_internal: {\n\t\t\tvalidateFn: validateAccessor,\n\t\t\tvalidation,\n\t\t\tmarkedDirtyRef,\n\t\t\tvalidationMode,\n\t\t\tvalidationDebounceTime,\n\t\t\tshouldValidateOnChange,\n\t\t\tsetValidityData,\n\t\t\tstate,\n\t\t\tpushInitialValue,\n\t\t\tsetControlId: (id: string) => {\n\t\t\t\tsetControlIdSignal(id);\n\t\t\t},\n\t\t},\n\t};\n\t(api as FieldApi<V> & Snapshottable)[SNAPSHOT_KEYS] = FIELD_SNAPSHOT_KEYS;\n\treturn api;\n}\n\nconst FIELD_SNAPSHOT_KEYS = snapshotKeys<FieldApi<unknown>>(\n\t\"value\",\n\t\"disabled\",\n\t\"invalid\",\n\t\"dirty\",\n\t\"touched\",\n\t\"filled\",\n\t\"focused\",\n\t\"valid\",\n\t\"validating\",\n\t\"errors\",\n\t\"error\",\n);\n"],"mappings":"AACA,SAECA,aAAa,EACbC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,cAAc,EACdC,SAAS,EACTC,YAAY,EACZC,OAAO,EACPC,UAAU,QACJ,UAAU;AACjB,SACCC,yBAAyB,QAOnB,4BAA4B;AACnC,SAA8BC,cAAc,QAAQ,2BAA2B;AAC/E,SAASC,oBAAoB,QAAQ,sCAAsC;AAC3E,SAA6BC,UAAU,QAAQ,6BAA6B;AAC5E,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SACCC,aAAa,EAEbC,YAAY,QACN,qCAAqC;AAC5C,SAASC,kBAAkB,QAAQ,wDAAwD;;AAE3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyFA;AACA;AACA;AACA;AACA;AACA;;AA8CA;AACA;AACA;AACA;;AAWA,MAAMC,eAAe,GAAGjB,aAAa,CAA2B,IAAI,CAAC;;AAEr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