{"version":3,"file":"styloviz-core-forms.mjs","names":[],"sources":["../../../../projects/core/forms/form-field-inputs.ts","../../../../projects/core/forms/composition.ts","../../../../projects/core/forms/create-flow.ts","../../../../projects/core/forms/caret-from-point.ts","../../../../projects/core/forms/select-feature.ts","../../../../projects/core/forms/described-by.ts","../../../../projects/core/forms/autofill.directive.ts","../../../../projects/core/forms/field-error.ts","../../../../projects/core/forms/field-error.component.icons.ts","../../../../projects/core/forms/field-error.component.ts","../../../../projects/core/forms/mention-scan.ts"],"sourcesContent":["/**\n * Input transforms for the names Signal Forms writes to (FL-B3).\n *\n * ★★★ `[formField]` PUSHES FIELD STATE INTO INPUTS BY NAME. On a control that\n *     has an input called `min`, `max`, `minLength`, `maxLength` or `pattern`,\n *     Signal Forms binds the field's metadata there — and the template compiler\n *     checks the type. It sends `number | undefined` for `min`/`max` on Angular\n *     21, the field's own value type on 22, and `readonly RegExp[]` for\n *     `pattern`; with no validator it sends `undefined`. An input typed plainly\n *     `number` or `string` therefore stops `[formField]` compiling on the\n *     control at all.\n *\n * ★★ SO THESE INPUTS ACCEPT `unknown` AND NORMALISE IT. Writing anything stays\n *    legal (a host's `[min]=\"0\"` is unchanged), and what the component reads is\n *    its own type, falling back to the default it always had. This is the\n *    shape `FormUiControl` itself allows (`InputSignalWithTransform<T, unknown>`),\n *    and it holds on both majors.\n */\n\n/** A finite number, else `fallback` (an absent validator sends `undefined`). */\nexport function svNumberOr(fallback: number): (value: unknown) => number {\n  return (value) => (typeof value === 'number' && !Number.isNaN(value) ? value : fallback);\n}\n\n/** A string, else `fallback` — for a `min`/`max` the control keeps as text (a time, a date). */\nexport function svStringOr(fallback: string): (value: unknown) => string {\n  return (value) => (typeof value === 'string' ? value : fallback);\n}\n\n/** A bound value the control can use as a native `min`/`max` (string or number), else `null`. */\nexport function svBoundOrNull(value: unknown): string | number | null {\n  return typeof value === 'string' || (typeof value === 'number' && !Number.isNaN(value)) ? value : null;\n}\n\n/**\n * An HTML `pattern` attribute: a string as given, or the one regular expression\n * Signal Forms sends from a `pattern()` validator. Several expressions cannot be\n * one attribute, so they leave it empty — the form still validates them.\n */\nexport function svPatternAttr(value: unknown): string {\n  if (typeof value === 'string') return value;\n  if (Array.isArray(value) && value.length === 1 && value[0] instanceof RegExp) return value[0].source;\n  return '';\n}\n","import { signal, type Signal } from '@angular/core';\n\n/**\n * IME composition: whose keystrokes these are.\n *\n * ── The defect this exists for (`FI-14-I2` / `FI-14-M1`) ────────────────────\n *\n * ★★★ `Enter` DURING COMPOSITION MEANS \"ACCEPT THIS CANDIDATE\", NOT \"CHOOSE\n *     THIS MENU ITEM\". A Japanese or Korean user typing a name presses `Enter`\n *     to confirm the kana→kanji conversion the IME is offering. A mention panel\n *     that treats `Enter` as its own inserts somebody — often the wrong somebody\n *     — into the document at the exact moment the user was committing a word.\n *     `ArrowUp`/`ArrowDown` are the same story: those move through the IME's\n *     candidate list, and a component that steals them makes the candidate list\n *     unusable while a panel is open.\n *\n * ★★ AND THE PANEL SHOULD NOT BE OPEN AT ALL. `input` fires throughout a\n *    composition, carrying phonetic text nobody has committed to — so a trigger\n *    scan runs against `ｔ`, then `て`, then `てす`, opening a panel and firing a\n *    server query per keystroke of a word that does not exist yet.\n *\n * ── Why a guard and not a boolean in each component ─────────────────────────\n *\n * Two components need exactly this — `sv-mention` and `sv-rich-text-editor` —\n * and the second copy of a rule like this drifts from the first. The same\n * argument as `svRovingTarget`, and the same shape: the guard answers \"are these\n * keystrokes mine?\" and each component decides what to do about the answer.\n */\nexport interface SvCompositionGuard {\n  /** True between `compositionstart` and `compositionend`. */\n  readonly composing: Signal<boolean>;\n  /** Bind to `(compositionstart)`. */\n  start(): void;\n  /**\n   * Bind to `(compositionend)`. Returns `true` so the caller can re-scan once,\n   * now that there is a committed word to scan.\n   */\n  end(): boolean;\n  /**\n   * Whether this key event belongs to the IME rather than to the component.\n   *\n   * ★★ `keyCode === 229` IS NOT LEGACY CRUFT. It is the value browsers report\n   *    for a key consumed by an IME, and on several of them it is the ONLY\n   *    signal during the first keystroke of a composition — `isComposing` is\n   *    still `false` because `compositionstart` has not fired yet. Checking one\n   *    of the two catches most compositions and lets the first character\n   *    through, which is the character that opens the panel.\n   */\n  blocks(event: KeyboardEvent): boolean;\n}\n\nexport function createCompositionGuard(): SvCompositionGuard {\n  const composing = signal(false);\n  return {\n    composing,\n    start: () => composing.set(true),\n    end: () => { composing.set(false); return true; },\n    blocks: (event: KeyboardEvent) =>\n      composing() || event.isComposing === true || event.keyCode === 229,\n  };\n}\n","/**\n * One \"create new\" flow for every picker that lets the user add an entry the\n * list does not have (`X-13`, `FL-J3-FI-03`).\n *\n * ★★★ FOUR DESCRIPTIONS OF ONE INTERACTION. Autocomplete (\"create-new flow\"),\n *     Select Dropdown (\"create-new\") and Tag Input (\"creatable\") each named the\n *     same thing: type a value that does not exist, get an explicit Create row,\n *     emit a typed event, and show the pending entity while the host persists\n *     it. Only Tag Input had any of it — and only the first half: the tag was\n *     added locally with no event a host could save it from and no way back\n *     when the save failed. This is the contract all three now share.\n *\n * ★★ TWO MODES, ONE EVENT. `awaited: false` (the default every component keeps)\n *    commits the entry at once, as Tag Input always did; `resolve()` can swap\n *    the component's own value for the server's id and `reject()` takes the\n *    entry back out. `awaited: true` shows the entry as PENDING — rendered,\n *    marked busy, not yet in the value — until `resolve()` commits it or\n *    `reject()` drops it. Either way the host gets the same `SvCreateRequest`.\n *\n * ★ EACH HANDLE SETTLES ONCE. A second `resolve()`, a `reject()` after a\n *   `resolve()`, or either after the component is gone is ignored: a retried\n *   network callback must not add the entity twice or remove one that saved.\n */\n\nimport { DestroyRef, inject, signal, type Signal } from '@angular/core';\nimport { SvLiveAnnouncer } from '@styloviz/core/a11y';\nimport { toSvDataError } from '@styloviz/core/data';\nimport { svRequestKey } from '@styloviz/core/data';\nimport type { SvDataError } from '@styloviz/core/data';\nimport { SV_CORE_LABELS } from '@styloviz/core/i18n';\nimport { svFormatLabel } from '@styloviz/core/i18n';\nimport { injectSvLabels } from '@styloviz/core/i18n';\n\n/** What the host's save produced, when it differs from what the user typed. */\nexport interface SvCreatedEntity {\n  /** The persisted id — replaces the component's own value for the entry. */\n  readonly value: string;\n  /** The persisted label, when the server normalised it. @default the typed label */\n  readonly label?: string;\n}\n\n/** Emitted when the user activates a picker's \"Create ‹query›\" row. */\nexport interface SvCreateRequest {\n  /** What the user typed, trimmed. */\n  readonly label: string;\n  /** The value the component gave the entry (and commits unless `resolve` names another). */\n  readonly value: string;\n  /** Idempotency key — send it, so a retried save cannot create two entities. */\n  readonly requestKey: string;\n  /** `true` when the component is showing the entry as pending until you settle. */\n  readonly awaited: boolean;\n  /** The entity saved. Pass the server's id (and label) to replace the component's own. */\n  readonly resolve: (entity?: SvCreatedEntity) => void;\n  /** The save failed — the entry is removed and the reason announced and shown. */\n  readonly reject: (error?: SvDataError | string) => void;\n}\n\n/** The entry on screen while an awaited create is in flight. */\nexport interface SvPendingCreate {\n  readonly label: string;\n  readonly value: string;\n  readonly requestKey: string;\n}\n\n/** How the flow changes the component's value. */\nexport interface SvCreateFlowOptions {\n  /** Add the entry to the value. */\n  readonly commit: (entry: { readonly value: string; readonly label: string }) => void;\n  /** Swap a committed entry's value/label for the server's (non-awaited `resolve`). */\n  readonly replace: (from: string, to: { readonly value: string; readonly label: string }) => void;\n  /** Take a committed entry back out (non-awaited `reject`). */\n  readonly remove: (value: string) => void;\n}\n\nexport interface SvCreateFlow {\n  /** The awaited entry in flight, or `null`. */\n  readonly pending: Signal<SvPendingCreate | null>;\n  /** Why the last create failed, or `''`. Cleared by the next create. */\n  readonly error: Signal<string>;\n  /** Start a create and build the request to emit. */\n  begin(label: string, value: string, awaited: boolean): SvCreateRequest;\n  /** Forget the last failure (e.g. when the user types again). */\n  clearError(): void;\n}\n\n/**\n * The shared create-new state machine. Call in an injection context — it\n * speaks through `SvLiveAnnouncer` (the pending entity and a failure are\n * announced, never a component-owned live region) and settles nothing once\n * its owner is destroyed.\n */\nexport function createCreateFlow(options: SvCreateFlowOptions): SvCreateFlow {\n  const labels = injectSvLabels('core', SV_CORE_LABELS);\n  const live = inject(SvLiveAnnouncer).scoped();\n  let destroyed = false;\n  inject(DestroyRef).onDestroy(() => { destroyed = true; });\n\n  const pending = signal<SvPendingCreate | null>(null);\n  const error = signal('');\n\n  const fail = (label: string, cause: SvDataError | string | undefined): void => {\n    const fallback = svFormatLabel(labels.createFailed, { label });\n    const message = cause === undefined ? fallback : toSvDataError(cause, fallback).message;\n    error.set(message);\n    live.announce(message, { priority: 'assertive' });\n  };\n\n  return {\n    pending: pending.asReadonly(),\n    error: error.asReadonly(),\n    clearError: () => error.set(''),\n    begin(label, value, awaited) {\n      const requestKey = svRequestKey('create');\n      let settled = false;\n      const settle = (): boolean => {\n        if (settled || destroyed) return false;\n        settled = true;\n        return true;\n      };\n      error.set('');\n\n      if (awaited) {\n        pending.set({ label, value, requestKey });\n        live.announce(svFormatLabel(labels.createPending, { label }));\n      } else {\n        options.commit({ value, label });\n      }\n\n      return {\n        label,\n        value,\n        requestKey,\n        awaited,\n        resolve: (entity) => {\n          if (!settle()) return;\n          const final = { value: entity?.value ?? value, label: entity?.label ?? label };\n          if (awaited) {\n            if (pending()?.requestKey === requestKey) pending.set(null);\n            options.commit(final);\n            live.announce(svFormatLabel(labels.createDone, { label: final.label }));\n          } else if (final.value !== value || final.label !== label) {\n            options.replace(value, final);\n          }\n        },\n        reject: (cause) => {\n          if (!settle()) return;\n          if (awaited) {\n            if (pending()?.requestKey === requestKey) pending.set(null);\n          } else {\n            options.remove(value);\n          }\n          fail(label, cause);\n        },\n      };\n    },\n  };\n}\n","/**\n * The caret position under a viewport point, as a collapsed `Range` — what a\n * drop handler needs once it has cancelled the browser's own drop and has to\n * put the content where the pointer let go (`X-4`, `FI-14-M3`).\n *\n * ★★ TWO ENGINE APIS, ONE WRITER. `caretPositionFromPoint` is the standard\n *    (Gecko, and Blink/WebKit since 2024); `caretRangeFromPoint` is what older\n *    WebKit and Blink have. Shared by `sv-mention` and `sv-rich-text-editor`\n *    so the fallback order is decided once. Browser-sensitive: registered in\n *    `mention.dom-deps.ts` and watched by `check:ui`.\n *\n * ⚠️ `null` WHEN NEITHER EXISTS (jsdom, SSR) or the point hits nothing. The\n *    caller decides what \"no drop point\" means — both callers fall back to the\n *    current caret, which is where a paste would go.\n */\nexport function svCaretRangeFromPoint(x: number, y: number, doc: Document = document): Range | null {\n  const d = doc as Document & {\n    caretPositionFromPoint?: (x: number, y: number) => { offsetNode: Node; offset: number } | null;\n    caretRangeFromPoint?: (x: number, y: number) => Range | null;\n  };\n  if (typeof d.caretPositionFromPoint === 'function') {\n    const pos = d.caretPositionFromPoint(x, y);\n    if (!pos) return null;\n    const range = doc.createRange();\n    range.setStart(pos.offsetNode, pos.offset);\n    range.collapse(true);\n    return range;\n  }\n  return typeof d.caretRangeFromPoint === 'function' ? d.caretRangeFromPoint(x, y) : null;\n}\n","import { InjectionToken, type Signal } from '@angular/core';\n\n/**\n * `FI-23-M1` — the contract between a select and the feature children that\n * configure it.\n *\n * ★★★ WHY A TOKEN AND NOT THE DIRECTIVE CLASSES. The point of the split\n *     (`docs/select-dropdown-split-adr.md`) is that the component depends on\n *     this interface and on no feature. A select that imported\n *     `SvSelectVirtualDirective` to read its inputs would be the same coupling\n *     the 38-input API already has, moved one file over.\n *\n * ★★ WHY IN CORE AND NOT IN EACH PACKAGE. The free and Pro selects are twins,\n *    and the Pro package peer-depends on the free one — so a host can easily\n *    end up with `svSelectSearch` from one tier inside the other tier's\n *    component. With one token per package that combination would compile and\n *    silently do nothing. With one shared token it works, and a feature the\n *    receiving tier does not implement (virtualization in free) is ignored,\n *    which is the no-op the ADR asks for.\n */\n\n/**\n * Everything a feature child may configure. Every member is optional, and an\n * `undefined` member means \"not set here\" — the component keeps its default\n * for it, so a feature child only overrides what it actually binds.\n */\nexport interface SvSelectFeatureConfig {\n  // ── Search (`svSelectSearch`) ──────────────────────────────────────────────\n  readonly searchable?: boolean;\n  readonly searchPlaceholder?: string;\n  readonly noResultsText?: string;\n  readonly loadingText?: string;\n  readonly minChars?: number;\n  readonly debounceMs?: number;\n  readonly serverSide?: boolean;\n  // ── Virtualization (`svSelectVirtual`) ─────────────────────────────────────\n  readonly virtualThreshold?: number;\n  readonly optionHeight?: number;\n  readonly virtualViewportHeight?: number;\n  // ── Bulk selection (`svSelectBulk`) ────────────────────────────────────────\n  readonly showSelectAll?: boolean;\n  readonly selectAllLabel?: string;\n}\n\n/** A feature child, as the select sees it. */\nexport interface SvSelectFeature {\n  /** What this feature contributes. Read reactively. */\n  readonly config: Signal<SvSelectFeatureConfig>;\n  /** Called with each settled search term the select emits as `searchChange`. */\n  searchChanged?(term: string): void;\n}\n\n/**\n * Provided by every feature child (`useExisting`), queried by the select with\n * `contentChildren(SV_SELECT_FEATURE, { descendants: true })`.\n */\nexport const SV_SELECT_FEATURE = new InjectionToken<SvSelectFeature>('SV_SELECT_FEATURE');\n\n/**\n * Merge the registered features into one config. Later children win for a key\n * they both set; an `undefined` member never overwrites a defined one.\n */\nexport function svMergeSelectFeatures(\n  features: readonly SvSelectFeature[],\n): SvSelectFeatureConfig {\n  if (features.length === 0) return {};\n  const merged: Record<string, unknown> = {};\n  for (const feature of features) {\n    for (const [key, value] of Object.entries(feature.config())) {\n      if (value !== undefined) merged[key] = value;\n    }\n  }\n  return merged as SvSelectFeatureConfig;\n}\n","/**\n * The parts of a form control's description, in the order a reader wants them.\n *\n * Every field is `false`/`null`/`''` when that part is not rendered — pass the\n * same condition the template uses to render it, so an id can never name an\n * element that is not there. `aria-describedby` pointing at a missing id is not\n * an error anyone sees; the description is simply, silently, not announced.\n */\nexport interface SvDescribedByParts {\n  /**\n   * The standing instruction under the field — \"We'll only use this to send\n   * your receipt.\"\n   *\n   * First, because it is the only part that is true before the user does\n   * anything, and the one that stops them making the mistake the other two\n   * report.\n   */\n  readonly hint?: string | false | null;\n  /**\n   * What is wrong with the value right now.\n   *\n   * Second. It is the most urgent part, but a reader who hears it before the\n   * instruction has to hold it in mind while the instruction arrives — and the\n   * instruction is usually what makes the error make sense. This is also the\n   * order GOV.UK's Design System settled on, and matching a widely-used\n   * convention is worth more here than a marginally different opinion.\n   */\n  readonly error?: string | false | null;\n  /**\n   * A live constraint that changes as the user types — \"35 characters\n   * remaining\".\n   *\n   * Last, deliberately. It is a `aria-live` region in its own right, so it will\n   * announce itself when it changes; its place here is only so that someone\n   * ARRIVING at the field is told a limit exists at all. Putting it first would\n   * mean every visit begins with a number.\n   */\n  readonly count?: string | false | null;\n  /**\n   * Anything else this control describes itself with, appended in the order\n   * given — a lock reason, a format example, a failed-write message.\n   */\n  readonly extra?: readonly (string | false | null | undefined)[];\n}\n\n/**\n * Compose one `aria-describedby` from every part of a field's description.\n *\n * ── The bug this exists for ─────────────────────────────────────────────────\n * `aria-describedby` takes a **list**, and almost nothing in this kit was\n * treating it as one. The overwhelmingly common shape was\n *\n * ```html\n * [attr.aria-describedby]=\"fieldError.showError() ? errorId() : null\"\n * ```\n *\n * which is not \"describe this field\" — it is \"describe this field with the\n * error INSTEAD of the hint\". A field with both a standing instruction and a\n * live rejection announced one of them, and which one depended on which\n * condition the author happened to write first. The counter had the same\n * problem from the other side: rendered, styled, given `aria-live` so it\n * announced every keystroke, and never mentioned to someone arriving at the\n * field, so they were told a limit existed only by exceeding it.\n *\n * Both are invisible to every gate and to every test that asserts a single id,\n * which is why this is a shared function rather than a review note.\n *\n * ── The order, and why it is fixed here ─────────────────────────────────────\n * **hint → error → count.** Each call site choosing its own order is how a kit\n * ends up with fields that read differently for no reason a user could name, so\n * the order is a property of this function and not of its callers. `extra`\n * exists for the parts only one component has.\n *\n * @example\n * ```ts\n * protected readonly describedBy = computed(() =>\n *   svDescribedBy({\n *     hint: this.hasDescription() && this.descId(),\n *     error: this.fieldError.showError() && this.errorId(),\n *     count: this.showCounter() && this.counterId(),\n *   }),\n * );\n * ```\n * ```html\n * <input [attr.aria-describedby]=\"describedBy()\" />\n * ```\n *\n * @returns The ids joined by a space, or `null` when there are none — never an\n *   empty string, because `aria-describedby=\"\"` is a present attribute naming\n *   nothing, and some assistive tech treats that differently from an absent one.\n */\nexport function svDescribedBy(parts: SvDescribedByParts): string | null {\n  const ids = [parts.hint, parts.error, parts.count, ...(parts.extra ?? [])]\n    .filter((id): id is string => typeof id === 'string' && id.trim().length > 0);\n\n  // De-duplicated because a control that describes itself with one id twice\n  // makes some readers announce it twice, and the caller cannot always tell:\n  // `extra` is often built from a list the host supplies.\n  const unique = [...new Set(ids)];\n  return unique.length > 0 ? unique.join(' ') : null;\n}\n","import {\n  CSP_NONCE,\n  Directive,\n  ElementRef,\n  PLATFORM_ID,\n  inject,\n  output,\n  signal,\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\n\n/**\n * Name of the keyframes that fire when a control ENTERS the autofilled state.\n * Exported so a host can recognise the event if it listens itself.\n */\nexport const SV_AUTOFILL_START = 'sv-autofill-start';\n/** Name of the keyframes that fire when a control LEAVES the autofilled state. */\nexport const SV_AUTOFILL_END = 'sv-autofill-end';\n\n/**\n * The stylesheet, injected once per document.\n *\n * Both keyframes are **empty** — `from {} to {}`. They animate nothing and are\n * never visible; they exist only because entering or leaving `:autofill`\n * restarts an animation, and `animationstart` is the one event the browser\n * fires for a fill that fires no input event. Nothing here is affected by\n * `prefers-reduced-motion`, because nothing here moves.\n *\n * ── Scoped to `[svAutofill]`, and that is not cosmetic ──────────────────────\n *\n * ⚠️ The first draft matched `input, textarea, select`. Measured against real\n *    Chromium, that **trampled a consumer's own animation on their own input**:\n *    `input:not(:-webkit-autofill)` is specificity (0,1,1) and beats a plain\n *    `.my-spinner` at (0,1,0), so `animation-name` was overwritten on every\n *    text input in the host application, kit-owned or not. Scoping to the\n *    attribute limits the blast radius to controls that opted in.\n *\n *    The remaining limitation, measured the same way: on a control that DOES\n *    carry `svAutofill`, this wins over a host's `animation-name`. Animate a\n *    wrapper rather than the native control itself.\n */\nconst STYLE = `\n@keyframes ${SV_AUTOFILL_START} { from {} to {} }\n@keyframes ${SV_AUTOFILL_END} { from {} to {} }\n[svAutofill]:-webkit-autofill {\n  animation-name: ${SV_AUTOFILL_START};\n  animation-duration: 1ms;\n}\n[svAutofill]:not(:-webkit-autofill) {\n  animation-name: ${SV_AUTOFILL_END};\n  animation-duration: 1ms;\n}\n`;\n\n/** Documents this stylesheet has already been added to. */\nconst INSTALLED = new WeakSet<Document>();\n\nfunction installStyles(doc: Document, nonce: string | null): void {\n  if (INSTALLED.has(doc)) return;\n  INSTALLED.add(doc);\n  const el = doc.createElement('style');\n  // Honoured when the app sets Angular's CSP_NONCE. Without it a strict\n  // `style-src` policy drops the sheet, the animation never runs, and the\n  // detector silently reports \"never autofilled\" — the pre-existing behaviour,\n  // so a strict-CSP app is no worse off than before, only not better.\n  if (nonce) el.setAttribute('nonce', nonce);\n  el.textContent = STYLE;\n  doc.head.appendChild(el);\n}\n\n/**\n * Report whether this control has been filled by the browser.\n *\n * ── Why this cannot be done with an event listener ───────────────────────────\n *\n * ★★ CHROME'S PAGE-LOAD AUTOFILL FIRES NO `input` EVENT. It sets the element's\n *    `value` directly and marks it `:autofill`; the `input` event arrives later,\n *    on the user's first interaction — or never, if they submit without\n *    touching the field. Everything downstream that is driven by a signal fed\n *    from `(input)` is therefore stale at exactly the moment the field is\n *    full: a floating label sits on top of the filled text, a \"clear\" button\n *    stays hidden, a character counter reads zero.\n *\n *    There is no event for it. What there IS: entering `:autofill` restarts any\n *    animation the selector declares, which fires `animationstart` — a real\n *    event, on the element, at the right moment. The keyframes above animate\n *    nothing; they are a notification channel wearing an animation's clothes.\n *    This is the standard technique for the same reason everywhere: it is the\n *    only one.\n *\n * ── What it does NOT tell you ───────────────────────────────────────────────\n *\n * The element's `value` is readable, but a password field filled on load is\n * masked to script until the user interacts with the page — `el.value` comes\n * back empty. So treat this as \"the browser has put something here\", which is\n * what a label needs to know, and not as a value.\n *\n * ```html\n * <input #inputEl svAutofill />\n * ```\n * ```ts\n * private readonly autofill = viewChild(SvAutofillDirective);\n * readonly labelIsFloated = computed(() =>\n *   this.isFocused() || !!this.value() || !!this.autofill()?.autofilled(),\n * );\n * ```\n */\n@Directive({\n  selector: '[svAutofill]',\n  standalone: true,\n  host: {\n    '(animationstart)': '_onAnimationStart($event)',\n    '(input)': '_onInput($event)',\n  },\n})\nexport class SvAutofillDirective {\n  private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n  private readonly nonce = inject(CSP_NONCE, { optional: true });\n  private readonly platformId = inject(PLATFORM_ID);\n\n  private readonly _autofilled = signal(false);\n\n  /** Whether the browser has filled this control. */\n  readonly autofilled = this._autofilled.asReadonly();\n\n  /** Emitted when the autofilled state changes. */\n  readonly autofillChange = output<boolean>();\n\n  constructor() {\n    if (!isPlatformBrowser(this.platformId)) return;\n\n    // ── There is deliberately no `el.matches(':autofill')` probe here ──────\n    //\n    // The obvious worry is a fill that landed before this directive existed,\n    // with its animation already started and its event already missed. It\n    // cannot happen: the stylesheet that declares the animation is installed by\n    // THIS constructor, and a CSS animation begins when its declaration begins\n    // to apply — so for an element that is already filled, the animation starts\n    // the moment the sheet lands, which is after the listener is attached.\n    //\n    // Worth recording because the probe was written first, and jsdom answers\n    // `true` to `matches(':autofill')` for EVERY input — a pseudo-class it does\n    // not implement but does parse. Every text field in the kit reported itself\n    // autofilled under test. The redundant line was the whole bug.\n    installStyles(this.el.nativeElement.ownerDocument, this.nonce);\n  }\n\n  protected _onAnimationStart(event: AnimationEvent): void {\n    if (event.animationName === SV_AUTOFILL_START) this._set(true);\n    else if (event.animationName === SV_AUTOFILL_END) this._set(false);\n  }\n\n  /**\n   * The user typed, so whatever the browser put here is no longer what is in\n   * the field — and the host's own value signal is authoritative again.\n   *\n   * Not left to the `:autofill` end-animation alone: browsers differ on whether\n   * editing an autofilled field clears the state, and a label that stayed\n   * floated because of a fill the user has since replaced is reporting\n   * something that is no longer true.\n   *\n   * ★★ ONLY AN `InputEvent` IS THE USER. Measured in Chrome 153\n   *    (`scripts/probes/autofill-real-chrome.mjs`): a page-load password fill\n   *    fires `animationstart` and THEN a trusted `input` per field — a plain\n   *    `Event`, not an `InputEvent`. Treating that as typing flipped\n   *    `autofilled()` back to `false` while the field was still filled. Typing,\n   *    deleting, pasting and dropping all arrive as `InputEvent`s.\n   */\n  protected _onInput(event: Event): void {\n    if (typeof InputEvent !== 'undefined' && !(event instanceof InputEvent)) return;\n    this._set(false);\n  }\n\n  private _set(next: boolean): void {\n    if (this._autofilled() === next) return;\n    this._autofilled.set(next);\n    this.autofillChange.emit(next);\n  }\n}\n","import { computed, linkedSignal, untracked, type Signal } from '@angular/core';\n\n/** What a host may pass as a server-reported error: a message, or an object carrying one. */\nexport type SvServerError = string | { readonly message: string } | null | undefined;\n\nexport interface SvFieldError {\n  /** The message the error slot should render — server first, then client. */\n  readonly resolvedError: Signal<string>;\n  /** Whether there is anything to render. */\n  readonly showError: Signal<boolean>;\n}\n\n/**\n * The validation-error contract shared by every form control in the kit.\n *\n * Two inputs, deliberately separate, because they expire differently:\n *\n * - `errorMessage` is the host's own client-side validation. It has no expiry;\n *   the host clears it when it decides the field is valid.\n * - `serverError` came back from a request about a SPECIFIC value (\"that email\n *   is already taken\"). The moment the user edits the field, that statement is\n *   about a value which no longer exists, and continuing to show it is telling\n *   the user something false about what they are currently looking at. So it is\n *   anchored to the value it was reported against and self-expires on the next\n *   edit — which is also why the host cannot be asked to manage it by hand.\n *\n * While live, `serverError` outranks `errorMessage`: it is the more specific\n * fact about this value.\n *\n * This logic was independently written out in 8 components before it lived\n * anywhere; each copy is a chance for one of them to keep showing a stale\n * rejection. Pair with `<sv-field-error>` for the rendering half.\n *\n * **One caveat worth knowing.** Signals are pull-based, so the anchor is captured\n * the first time the error is READ after `serverError` changes, not at the moment\n * it is written. In a rendered control those are the same change-detection pass,\n * which is why it has never mattered — but a host that writes `serverError` and\n * `value` together, with nothing reading in between, anchors to the second write\n * and the rejection stays visible against a value it was not about. Pinned in\n * `field-error.spec.ts` under \"anchors when the error is first READ\".\n *\n * @example\n * protected readonly fieldError = createFieldError(this.value, this.serverError, this.errorMessage);\n * // template: <sv-field-error [id]=\"describedById()\" [message]=\"fieldError.resolvedError()\" />\n */\nexport function createFieldError(\n  value: Signal<unknown>,\n  serverError: Signal<SvServerError>,\n  errorMessage: Signal<string>,\n): SvFieldError {\n  // The value the current serverError was reported against. Recomputed only\n  // when serverError itself changes — reading `value` untracked is what stops\n  // the anchor from chasing every keystroke.\n  const anchor = linkedSignal<SvServerError, unknown>({\n    source: serverError,\n    computation: () => untracked(() => value()),\n  });\n\n  const live = computed(() => {\n    const e = serverError();\n    if (!e) return '';\n    if (value() !== anchor()) return '';\n    return typeof e === 'string' ? e : e.message;\n  });\n\n  const resolvedError = computed(() => live() || errorMessage());\n  return { resolvedError, showError: computed(() => !!resolvedError()) };\n}\n","// GENERATED by scripts/icon-registrations.mjs from this component's template — do not edit;\n// run `npm run icons:register`.\nimport { registerSvIcons, type SvIconDef } from '@styloviz/icons';\nimport { alertCircleIcon } from '@styloviz/icons/glyph/alert-circle';\n\n/** Registers the glyphs this component draws by name (FL-B4). Call in a field initializer. */\nexport const registerFieldErrorIcons = (): readonly SvIconDef[] =>\n  registerSvIcons([alertCircleIcon]);\n","import { ChangeDetectionStrategy, Component, input } from '@angular/core';\nimport { SvIconComponent } from '@styloviz/icons';\n\nimport { registerFieldErrorIcons } from './field-error.component.icons';\n/**\n * The one-line validation-error slot every form control renders.\n *\n * `role=\"alert\"` so a rejection that appears after the fact is announced rather\n * than sitting silently below a field the user has already left — the whole\n * point of a server error. The element is not rendered at all when there is no\n * message, so an empty alert region never lingers in the accessibility tree.\n *\n * Pair the `id` with the control's `aria-describedby`, and set `aria-invalid`\n * on the control itself — this component cannot do either for you, since it\n * does not own the input element.\n */\n@Component({\n  selector: 'sv-field-error',\n  standalone: true,\n  imports: [SvIconComponent],\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  template: `\n    @if (message()) {\n      <p\n        [attr.id]=\"id() || null\"\n        role=\"alert\"\n        class=\"flex items-center gap-1 text-xs font-medium text-danger-600 dark:text-danger-400\"\n      >\n        <sv-icon name=\"alert-circle\" cssClass=\"h-3.5 w-3.5 shrink-0\" [strokeWidth]=\"2\" />\n        {{ message() }}\n      </p>\n    }\n  `,\n})\nexport class SvFieldErrorComponent {\n  /** The glyphs this template draws by name (FL-B4). */\n  protected readonly svIcons = registerFieldErrorIcons();\n\n  /** Message to show. Empty renders nothing. */\n  message = input<string>('');\n  /** Id for the control's `aria-describedby` to point at. */\n  id = input<string>('');\n}\n","/**\n * Mentions: finding the trigger, and keeping the token honest.\n *\n * Two separate problems live here, and only the first one is the one people\n * build.\n *\n * ── 1. Which trigger is active, and what has been typed after it ───────────\n *\n * A string-level scan of the text before the caret. It is extracted rather than\n * inlined because two components need exactly this rule — `sv-mention` (a\n * single-line contenteditable) and `sv-rich-text-editor` — and the second copy\n * of a rule like this always drifts from the first.\n *\n * ── 2. ★★★ THE INSERTED MENTION IS AN EDITABLE STRING, AND THAT IS THE DEFECT\n *      EVERY RICH-TEXT MENTION SHIPS ───────────────────────────────────────\n *\n * Insert `@Priya Sharma` as a styled span and the document now contains twelve\n * characters the user can edit one at a time. One backspace leaves\n * `@Priya Sharm` — which still looks like a mention, still carries the data\n * attribute naming Priya's user id, and now displays a name that is not hers.\n * The host persists it. A notification is addressed to a person whose name the\n * document renders incorrectly, or a permission check reads an id whose label\n * nobody would recognise.\n *\n * `contenteditable=\"false\"` is necessary and NOT sufficient. Browsers still\n * allow the inside of such a node to change: a drag-and-drop into it, an IME\n * composition that spans its boundary, several mobile keyboards' autocorrect,\n * and a paste over a selection that partially covers it. So the token carries\n * its label as data, and `svTokenIntegrity` re-derives the answer from what is\n * actually in the DOM — because the only trustworthy statement about a mention\n * is one that compares the rendered text against what it claims to be.\n */\n\nimport { svEscapeHtml } from '@styloviz/core/security';\n\n/** A person, topic or command a mention can refer to. */\nexport interface SvMentionToken {\n  readonly id: string;\n  readonly label: string;\n  /** The character that opened it, e.g. `'@'`. */\n  readonly trigger: string;\n}\n\n/** An open trigger and the query typed after it. */\nexport interface SvTriggerMatch {\n  /** The trigger character that opened the panel. */\n  readonly trigger: string;\n  /** Text typed after the trigger. `''` immediately after it. */\n  readonly query: string;\n  /** Index of the trigger character in the scanned string. */\n  readonly at: number;\n}\n\nexport interface SvTriggerOptions {\n  /**\n   * Longest query worth searching for.\n   *\n   * ★★ A CAP, BECAUSE AN UNCLOSED TRIGGER OTHERWISE SEARCHES A PARAGRAPH. Type\n   * an `@` and then keep writing a sentence with no spaces after it — a URL, a\n   * path, a long identifier — and without this the panel stays open issuing a\n   * query per keystroke against text nobody meant as a search.\n   * @default 60\n   */\n  readonly maxQuery?: number;\n  /**\n   * Require the trigger not to sit inside a word.\n   *\n   * ★★★ ON BY DEFAULT, AND IT IS WHAT STOPS EVERY EMAIL ADDRESS OPENING THE\n   * PANEL. Typing `priya@example.com` has an `@` with no space after it, so a\n   * naive scan opens a people-search on `example.com` in the middle of an\n   * address the user is simply writing.\n   *\n   * ★★★ THE TEST IS \"NOT PRECEDED BY A LETTER OR DIGIT\", NOT \"PRECEDED BY\n   * WHITESPACE\" — and the difference is not pedantry. The first version of this\n   * demanded whitespace, which broke three existing fixtures the moment\n   * `sv-mention` was refactored onto it: `(@alice`, `—@alice` and a trigger\n   * typed straight after a full stop are all things people write and all things\n   * that should open the panel. Whitespace-only is a stricter rule than the\n   * intent, and the intent is \"not in the middle of a word\".\n   *\n   * ★★ Unicode-aware, so `José@example.com` is caught too. `\\w` is ASCII-only,\n   * which would have made the rule work for English names and quietly fail for\n   * everyone else's.\n   * @default true\n   */\n  readonly wordBoundary?: boolean;\n}\n\nconst DEFAULTS: Required<SvTriggerOptions> = { maxQuery: 60, wordBoundary: true };\n\n/**\n * Find the active trigger in the text before the caret.\n *\n * Returns `null` when no panel should be open, which is the common case and the\n * one worth being cheap.\n */\nexport function svScanTrigger(\n  before: string,\n  triggers: readonly string[],\n  options: SvTriggerOptions = {},\n): SvTriggerMatch | null {\n  const { maxQuery, wordBoundary } = { ...DEFAULTS, ...options };\n  if (before === '' || triggers.length === 0) return null;\n\n  // ★★ THE TRIGGER NEAREST THE CARET WINS. With several configured — `@` people,\n  //    `#` topics, `/` commands — `@alice #des|` must resolve against the `#`,\n  //    or typing a topic after a mention searches for people.\n  let at = -1;\n  let trigger = '';\n  for (const char of triggers) {\n    if (char === '') continue;\n    const i = before.lastIndexOf(char);\n    if (i > at) { at = i; trigger = char; }\n  }\n  if (at === -1) return null;\n\n  if (wordBoundary && at > 0 && /[\\p{L}\\p{N}_]/u.test(before[at - 1])) return null;\n\n  const query = before.slice(at + trigger.length);\n  // ★ A SPACE CLOSES IT. Without this the panel stays open for the rest of the\n  //   paragraph, because the trigger character is still somewhere behind.\n  if (/\\s/.test(query)) return null;\n  if (query.length > maxQuery) return null;\n\n  return { trigger, query, at };\n}\n\n/**\n * Attribute names carried by a mention token.\n *\n * Exported because both the writer and the reader need them to agree, and a\n * string literal repeated in two files is a rename waiting to go half-done.\n */\nexport const SV_MENTION_ATTRS = {\n  marker: 'data-sv-mention',\n  id: 'data-sv-mention-id',\n  label: 'data-sv-mention-label',\n  trigger: 'data-sv-mention-trigger',\n} as const;\n\n/**\n * Escape text for insertion into an attribute or element body.\n *\n * 🔺 THIS WAS A BYTE-IDENTICAL COPY OF `svEscapeHtml`, inside `core`, four\n * directories from the original — which is the duplication T2 exists to stop,\n * already happened, in the package that is supposed to be the single source.\n * It is now an alias, kept only so the call sites below keep reading as\n * `esc(...)`.\n *\n * ⚠️ It escapes `&<>\"` and NOT `'`. That is sufficient here and only here:\n * every attribute this module writes is double-quoted. Single-quote an\n * attribute anywhere and this stops being enough.\n */\nconst esc = svEscapeHtml;\n\n/**\n * The markup for one mention.\n *\n * ★★★ `contenteditable=\"false\"` MAKES IT ATOMIC TO THE CARET — arrow keys step\n * over it and backspace removes the whole thing — and the label is ALSO stored\n * as data, because that attribute is not a guarantee. See the file header: the\n * inside of such a node can still change, and when it does, the only way to know\n * is to compare what is rendered against what the token says it is.\n *\n * ★★ A trailing zero-width space is NOT used here, deliberately, though it is\n * the usual trick for \"somewhere to put the caret after the chip\". It is\n * invisible, it survives into the persisted value, it breaks string equality for\n * anyone comparing the document, and it arrives in exports and search indexes as\n * mojibake. The caret is placed after the node programmatically instead.\n */\nexport function svMentionHtml(token: SvMentionToken, className = ''): string {\n  const cls = className === '' ? '' : ` class=\"${esc(className)}\"`;\n  return (\n    `<span${cls} ${SV_MENTION_ATTRS.marker}=\"true\"` + // sv-i18n-ignore: HTML markup with data attributes\n    ` ${SV_MENTION_ATTRS.id}=\"${esc(token.id)}\"` +\n    ` ${SV_MENTION_ATTRS.label}=\"${esc(token.label)}\"` +\n    ` ${SV_MENTION_ATTRS.trigger}=\"${esc(token.trigger)}\"` +\n    ` contenteditable=\"false\">${esc(token.trigger)}${esc(token.label)}</span>` // sv-i18n-ignore: HTML markup\n  );\n}\n\nexport type SvTokenIntegrity =\n  /** The rendered text still matches what the token claims to be. */\n  | 'intact'\n  /** It has been edited: the text and the stored label disagree. */\n  | 'edited'\n  /** Not a mention token at all. */\n  | 'not-a-token';\n\n/**\n * Does this element still say what it claims to say?\n *\n * ★★★ THE ONE CHECK THAT MAKES A MENTION TRUSTWORTHY. An `edited` token is not\n * a mention of anybody: it carries a user id and displays a name that is not\n * that user's, which is worse than having no mention at all, because everything\n * downstream — the notification, the permission check, the audit line — reads\n * the id and believes the label.\n */\nexport function svTokenIntegrity(el: Element): SvTokenIntegrity {\n  if (el.getAttribute(SV_MENTION_ATTRS.marker) !== 'true') return 'not-a-token';\n  const label = el.getAttribute(SV_MENTION_ATTRS.label);\n  const trigger = el.getAttribute(SV_MENTION_ATTRS.trigger) ?? '';\n  const id = el.getAttribute(SV_MENTION_ATTRS.id);\n  if (label === null || id === null) return 'not-a-token';\n  return el.textContent === `${trigger}${label}` ? 'intact' : 'edited';\n}\n\n/**\n * Every intact mention in a document, in document order.\n *\n * ★★ EDITED TOKENS ARE EXCLUDED RATHER THAN REPAIRED. Repairing means choosing\n * between two things the document says — the id and the text — and there is no\n * basis for that choice: the user may have been deleting the mention or fixing a\n * name. Reporting them separately lets the host decide, and `svMentionRepairs`\n * is what tells it there is a decision to make.\n */\nexport function svParseMentions(html: string): readonly SvMentionToken[] {\n  return readTokens(html).intact;\n}\n\n/**\n * A token whose rendered text no longer matches the id it carries.\n *\n * Named rather than inlined because it crosses a public boundary in two\n * components and a host cannot write a handler for an anonymous shape without\n * retyping it — and a retyped shape is one that stops matching.\n */\nexport interface SvMentionRepair {\n  /** The id the token still carries — the thing downstream will act on. */\n  readonly id: string;\n  /** What the token says it is. */\n  readonly label: string;\n  /** What it actually renders now. */\n  readonly text: string;\n}\n\n/** Tokens whose rendered text no longer matches the id they carry. */\nexport function svMentionRepairs(html: string): readonly SvMentionRepair[] {\n  return readTokens(html).edited;\n}\n\nfunction readTokens(html: string): {\n  intact: SvMentionToken[];\n  edited: SvMentionRepair[];\n} {\n  // Parsed inertly, for the same reason the paste sanitiser is: this may be\n  // reading a value that came from a document somebody else wrote.\n  const doc = new DOMParser().parseFromString(html, 'text/html');\n  const intact: SvMentionToken[] = [];\n  const edited: SvMentionRepair[] = [];\n  for (const el of Array.from(doc.querySelectorAll(`[${SV_MENTION_ATTRS.marker}=\"true\"]`))) {\n    const id = el.getAttribute(SV_MENTION_ATTRS.id);\n    const label = el.getAttribute(SV_MENTION_ATTRS.label);\n    const trigger = el.getAttribute(SV_MENTION_ATTRS.trigger) ?? '';\n    if (id === null || label === null) continue;\n    if (svTokenIntegrity(el) === 'intact') intact.push({ id, label, trigger });\n    else edited.push({ id, label, text: el.textContent ?? '' });\n  }\n  return { intact, edited };\n}\n\n/**\n * The document as plain text, with each mention rendered as its trigger + label.\n *\n * ★★ FROM THE STORED LABEL, NOT FROM THE ELEMENT'S TEXT. If the two disagree the\n * element's text is the thing that is wrong — the id is what the mention MEANS —\n * so a plain-text rendering that trusted the DOM would propagate the corruption\n * into the notification email.\n */\nexport function svMentionPlainText(html: string): string {\n  const doc = new DOMParser().parseFromString(html, 'text/html');\n  // ★★★ `textContent` INCLUDES THE SOURCE OF `<script>` AND `<style>`, which is\n  //     not text anybody wrote — it is code, and a plain-text rendering that\n  //     carries it puts a stylesheet into the notification email.\n  //\n  // ★★ THE SECOND TIME THIS EXACT MISTAKE HAS APPEARED IN THIS CODEBASE (the\n  //    rich editor's `svPlainTextFromHtml` had it too, and its own spec caught\n  //    it). `textContent` reads as \"just the words\" and is not; the lesson is\n  //    that any function turning a document into text needs this line, and the\n  //    reason it keeps getting missed is that the omission is invisible on every\n  //    document that happens not to contain a script.\n  for (const el of Array.from(doc.querySelectorAll('script,style,noscript,template,title'))) {\n    el.remove();\n  }\n  for (const el of Array.from(doc.querySelectorAll(`[${SV_MENTION_ATTRS.marker}=\"true\"]`))) {\n    const label = el.getAttribute(SV_MENTION_ATTRS.label);\n    const trigger = el.getAttribute(SV_MENTION_ATTRS.trigger) ?? '';\n    if (label !== null) el.replaceWith(doc.createTextNode(`${trigger}${label}`));\n  }\n  return doc.body.textContent ?? '';\n}\n\n/** `@Priya Sharma` */\nexport function svMentionLabel(token: SvMentionToken): string {\n  return `${token.trigger}${token.label}`;\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,WAAW,UAAgB;CACzC,QAAQ,UAAW,OAAO,UAAU,YAAY,CAAC,OAAO,MAAM,KAAK,IAAI,QAAQ;AACjF;AAGA,SAAgB,WAAW,UAAgB;CACzC,QAAQ,UAAW,OAAO,UAAU,WAAW,QAAQ;AACzD;AAGA,SAAgB,cAAc,OAAc;CAC1C,OAAO,OAAO,UAAU,YAAa,OAAO,UAAU,YAAY,CAAC,OAAO,MAAM,KAAK,IAAK,QAAQ;AACpG;AAOA,SAAgB,cAAc,OAAc;CAC1C,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,KAAK,MAAM,cAAc,QAAQ,OAAO,MAAM,EAAE,CAAC;CAC9F,OAAO;AACT;ACQA,SAAgB,yBAAsB;CACpC,MAAM,YAA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