@magicx-eng/ai-autocomplete-angular 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"magicx-eng-ai-autocomplete-angular.mjs","sources":["../../src/lib/internal/layout/cluster.component.ts","../../src/lib/internal/layout/stack.component.ts","../../src/lib/internal/pill-list/pill-list.component.ts","../../src/lib/internal/pill-list/pill-list.component.html","../../src/lib/internal/product-strip/product-strip.component.ts","../../src/lib/internal/product-strip/product-strip.component.html","../../src/lib/internal/layout/grid.component.ts","../../src/lib/internal/layout/grid.component.html","../../src/lib/internal/suggestion-item/suggestion-item.component.ts","../../src/lib/internal/suggestion-item/suggestion-item.component.html","../../src/lib/internal/suggestion-grid/suggestion-grid.component.ts","../../src/lib/internal/suggestion-grid/suggestion-grid.component.html","../../src/lib/ai-autocomplete-dropdown/ai-autocomplete-dropdown.component.ts","../../src/lib/ai-autocomplete-dropdown/ai-autocomplete-dropdown.component.html","../../src/lib/controller/observables.ts","../../src/lib/controller/ai-autocomplete.controller.ts","../../src/lib/internal/editor-host/editor-host.directive.ts","../../src/lib/internal/submit-button/submit-button.component.ts","../../src/lib/internal/submit-button/submit-button.component.html","../../src/lib/ai-autocomplete/ai-autocomplete.component.ts","../../src/lib/ai-autocomplete/ai-autocomplete.component.html","../../src/lib/input/ai-autocomplete-input.directive.ts","../../src/lib/ai-autocomplete.module.ts","../../src/public-api.ts","../../src/magicx-eng-ai-autocomplete-angular.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from \"@angular/core\";\n\n/**\n * Horizontal layout primitive — children sit in a row and wrap when out of\n * room. Mirrors the React `<Cluster>` component / vanilla `.aia-cluster` CSS\n * primitive. `noWrap` keeps a single row; `inline` makes it inline-level.\n *\n * @internal\n */\n@Component({\n selector: \"aia-cluster\",\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n template: \"<ng-content></ng-content>\",\n styleUrls: [\"./cluster.component.css\"],\n host: {\n class: \"aia-cluster\",\n \"[attr.data-align]\": \"align\",\n \"[attr.data-justify]\": \"justify\",\n \"[attr.data-nowrap]\": \"noWrap ? '' : null\",\n \"[attr.data-inline]\": \"inline ? '' : null\",\n \"[style.--aia-cluster-gap]\": \"gap\",\n },\n})\nexport class ClusterComponent {\n /** Gap between children. Any CSS length. Defaults to the CSS fallback (0.5rem). */\n @Input() gap?: string;\n /** Cross-axis alignment. Defaults to `center`. */\n @Input() align: \"start\" | \"center\" | \"end\" | \"baseline\" = \"center\";\n /** Main-axis distribution. Defaults to `start`. */\n @Input() justify: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" = \"start\";\n /** When true, the cluster does NOT flex-wrap (single-row clusters). */\n @Input() noWrap = false;\n /** Render inline-level (inline-flex) instead of block. */\n @Input() inline = false;\n}\n","import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from \"@angular/core\";\n\n/**\n * Vertical layout primitive — children stack top-to-bottom with `space` gap.\n * Mirrors the React `<Stack>` component / vanilla `.aia-stack` CSS primitive.\n *\n * @internal\n */\n@Component({\n selector: \"aia-stack\",\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n template: \"<ng-content></ng-content>\",\n styleUrls: [\"./stack.component.css\"],\n host: {\n class: \"aia-stack\",\n \"[attr.data-align]\": \"align\",\n \"[style.--aia-stack-space]\": \"space\",\n },\n})\nexport class StackComponent {\n /** Gap between children. Any CSS length. Defaults to the CSS fallback (0.5rem). */\n @Input() space?: string;\n /** Cross-axis alignment of children. Defaults to `stretch` (full width). */\n @Input() align: \"start\" | \"center\" | \"end\" | \"stretch\" = \"stretch\";\n}\n","import { CommonModule } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n Output,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport type { Suggestion } from \"@magicx-eng/ai-autocomplete-vanilla\";\n\n/**\n * Internal pill list used by both the dropdown and Tier 1's inline pillbar.\n * Mirrors `packages/react/src/components/PillList.tsx` one-for-one — including\n * the per-index opacity ramp (1 / 0.7 / 0.4 / 0.2) and the skeleton-loading\n * fallback that preserves layout while the next fetch is in flight.\n *\n * @internal\n */\n@Component({\n selector: \"aia-pill-list\",\n standalone: true,\n imports: [CommonModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./pill-list.component.html\",\n styleUrls: [\"./pill-list.component.css\"],\n})\nexport class PillListComponent {\n @Input() pills: Suggestion[] = [];\n @Input() activePillIndex = 0;\n @Input() rounded = false;\n /**\n * When true, pills become non-interactive shimmering skeletons. Real pills\n * (with their text) are rendered when provided so widths/positions match\n * the previous state; with no pills, fixed-width fallback placeholders are\n * rendered instead.\n */\n @Input() loading = false;\n /**\n * Whether the active (leading) pill should render selected (full opacity)\n * rather than its positional `first` tier. Auto trigger ⇒ true while a\n * dropdown option is highlighted; manual trigger ⇒ true after the user taps\n * the pill. See `AIAutocompleteController.isActivePillSelected$`.\n */\n @Input() activeSelected = false;\n\n @Output() readonly selectPill = new EventEmitter<number>();\n\n /** Fallback widths when loading with zero cached pills (matches React). */\n readonly fallbackSkeletonWidths = [125, 69];\n\n /** The active pill is \"selected\" only when `activeSelected` is set. */\n isSelected(index: number): boolean {\n return this.activeSelected && index === this.activePillIndex;\n }\n\n /**\n * Opacity per pill state — mirrors PillList.tsx `PILL_OPACITY`. The selected\n * pill is full opacity; otherwise pills take a positional tier (first / next\n * / last).\n */\n pillOpacity(index: number): number {\n if (this.isSelected(index)) return 1; // Selected\n if (index === 0) return 0.7; // First\n if (index === 1) return 0.4; // Next\n return 0.2; // Last\n }\n\n trackByType = (_: number, pill: Suggestion): string => pill.type;\n trackByWidth = (_: number, w: number): number => w;\n\n onPillClick(index: number): void {\n if (this.loading) return;\n this.selectPill.emit(index);\n }\n\n onPillMouseDown(event: Event): void {\n // Prevent the editor from losing focus when a pill is tapped.\n event.preventDefault();\n }\n}\n","<ng-container *ngIf=\"loading && pills.length === 0; else realPills\">\n <span class=\"aia-pill-list\" data-aia-pill-list-loading=\"\">\n <span\n *ngFor=\"let w of fallbackSkeletonWidths; trackBy: trackByWidth; let i = index\"\n data-aia-pill-skeleton=\"\"\n class=\"aia-pill aia-pill-skeleton\"\n [class.aia-pill-rounded]=\"rounded\"\n [style.width.px]=\"w\"\n [style.opacity]=\"pillOpacity(i)\"\n ></span>\n </span>\n</ng-container>\n\n<ng-template #realPills>\n <span\n class=\"aia-pill-list\"\n [attr.data-aia-pill-list-loading]=\"loading ? '' : null\"\n >\n <button\n *ngFor=\"let pill of pills; trackBy: trackByType; let i = index\"\n type=\"button\"\n data-aia-pill=\"\"\n [attr.data-aia-loading]=\"loading ? '' : null\"\n tabindex=\"-1\"\n class=\"aia-pill\"\n [class.aia-pill-rounded]=\"rounded\"\n [class.aia-pill-skeleton]=\"loading\"\n [style.opacity]=\"pillOpacity(i)\"\n [disabled]=\"loading\"\n (mousedown)=\"onPillMouseDown($event)\"\n (click)=\"onPillClick(i)\"\n >\n {{ pill.text }}\n </button>\n </span>\n</ng-template>\n","import { CommonModule } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n Output,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport type { Product } from \"@magicx-eng/ai-autocomplete-vanilla\";\n\n/**\n * Internal product strip rendered below the dropdown's options grid. Mirrors\n * `packages/react/src/components/ProductStrip.tsx` and the vanilla core's\n * `renderProductStrip`, so all three packages emit the same structure and\n * theme identically.\n *\n * Two layout notes carried over from the vanilla implementation:\n *\n * - The dropdown paints a background but never sets `color`, so anything here\n * relying on `color: inherit` would pick up the *host page's* text colour —\n * black text on a dark panel. Every text node resolves its colour through\n * the same `--aia-option-*` chain the options use.\n * - The options grid carries a negative bottom margin so the footer rides up\n * over its reserved band, and whatever follows the grid inherits that pull.\n * The dropdown root is marked `data-aia-has-products` and the appearance\n * layer zeroes the band at its source rather than the strip cancelling it\n * from here.\n *\n * @internal\n */\n@Component({\n selector: \"aia-product-strip\",\n standalone: true,\n imports: [CommonModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./product-strip.component.html\",\n styleUrls: [\"./product-strip.component.css\"],\n})\nexport class ProductStripComponent {\n @Input() products: Product[] = [];\n /** Scopes the section label's id to the owning listbox. */\n @Input() listboxId = \"\";\n /**\n * False while the panel is fading out. The closed dropdown keeps rendering\n * its last content for the fade, and focusable cards inside it would still\n * answer Tab.\n */\n @Input() focusable = true;\n\n @Output() readonly select = new EventEmitter<Product>();\n /**\n * Focus moved into / out of the strip. The panel closes on blur by default\n * and the editor blurs the moment a card takes focus, so the dropdown\n * reports focus as still-inside rather than shutting out from under the card\n * the user just tabbed to.\n */\n @Output() readonly focusChange = new EventEmitter<boolean>();\n\n get labelId(): string {\n return `${this.listboxId}-products-label`;\n }\n\n cardId(index: number): string {\n return `${this.listboxId}-product-${index}`;\n }\n\n /**\n * Identity *and* content: a same-id result whose fields changed must\n * re-render rather than reuse the previous card's bindings.\n */\n trackByProduct = (_: number, product: Product): string =>\n [\n product.id,\n product.title,\n product.url,\n product.imageUrl ?? \"\",\n product.price ?? \"\",\n product.vendor ?? \"\",\n ].join(\"\u0000\");\n\n onClick(event: MouseEvent, product: Product): void {\n // Let the browser keep the clicks that mean \"open this somewhere else\" —\n // intercepting them would defeat the point of rendering an <a>. Those are\n // navigations the user asked for explicitly, so they don't emit.\n if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0) {\n return;\n }\n event.preventDefault();\n this.select.emit(product);\n }\n\n onKeyDown(event: KeyboardEvent, product: Product): void {\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n this.select.emit(product);\n }\n\n onCardFocus(): void {\n this.focusChange.emit(true);\n }\n\n onCardBlur(event: FocusEvent): void {\n const next = event.relatedTarget as HTMLElement | null;\n if (next?.closest(\"[data-aia-dropdown]\")) return;\n this.focusChange.emit(false);\n }\n}\n","<!-- `group` is the one role a listbox accepts around a set of options, so the\n strip stays inside the listbox without breaking its content model. -->\n<section\n *ngIf=\"products.length > 0\"\n class=\"aia-products\"\n data-aia-products=\"\"\n role=\"group\"\n [attr.aria-labelledby]=\"labelId\"\n>\n <div class=\"aia-products-label\" [id]=\"labelId\">Products</div>\n\n <div class=\"aia-products-row\" data-aia-products-row=\"\">\n <!-- A real <a href> rather than a <div>: it keeps the browser's own link\n affordances — cmd/ctrl-click for a new tab, middle-click, right-click →\n \"copy link address\". role=\"option\" overrides how assistive tech\n announces it, which is correct inside a listbox; the deliberate trade\n is that AT no longer calls it a link. -->\n <a\n *ngFor=\"let product of products; let i = index; trackBy: trackByProduct\"\n [id]=\"cardId(i)\"\n class=\"aia-product\"\n data-aia-product=\"\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n [href]=\"product.url\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (click)=\"onClick($event, product)\"\n (keydown)=\"onKeyDown($event, product)\"\n (focus)=\"onCardFocus()\"\n (blur)=\"onCardBlur($event)\"\n >\n <!-- Catalogues without images are common enough that the placeholder is\n a first-class state, not an error state. -->\n <span\n class=\"aia-product-media\"\n [attr.data-aia-product-placeholder]=\"product.imageUrl ? null : ''\"\n >\n <!-- alt=\"\" on purpose: the title is already the card's accessible\n name, and repeating it would have a screen reader read it twice. -->\n <img\n *ngIf=\"product.imageUrl\"\n class=\"aia-product-image\"\n [src]=\"product.imageUrl\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n </span>\n\n <!-- Every field but the title is optional, so absent ones render no\n element at all — the column gap can't leave a hole for a box that\n isn't there. -->\n <span class=\"aia-product-body\">\n <span *ngIf=\"product.vendor\" class=\"aia-product-vendor\">{{ product.vendor }}</span>\n <span class=\"aia-product-title\">{{ product.title }}</span>\n <span *ngIf=\"product.price\" class=\"aia-product-price\">{{ product.price }}</span>\n </span>\n </a>\n </div>\n</section>\n","import {\n ChangeDetectionStrategy,\n Component,\n type ElementRef,\n Input,\n type OnChanges,\n type SimpleChanges,\n ViewChild,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport { optionsGridTemplateColumns } from \"@magicx-eng/ai-autocomplete-vanilla\";\n\n/**\n * Intrinsic grid layout primitive — auto-fits as many columns as fit between\n * `min` and `max` wide, wrapping to new rows when there's no more horizontal\n * room. Mirrors the React `<Grid>` component / vanilla `.aia-grid` primitive.\n *\n * Optionally scrolls (`scroll`, capped height).\n *\n * @internal\n */\n@Component({\n selector: \"aia-grid\",\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./grid.component.html\",\n styleUrls: [\"./grid.component.css\"],\n})\nexport class GridComponent implements OnChanges {\n /** Minimum cell width. CSS length, e.g. \"16rem\". Columns auto-fit at runtime. */\n @Input() min = \"16rem\";\n /** Maximum cell width. CSS length. Defaults (via CSS) to `1fr` (stretch). */\n @Input() max?: string;\n /** Gap between cells. */\n @Input() gap?: string;\n /** Cap the height and scroll vertically when content overflows. */\n @Input() scroll = false;\n /** Max height when `scroll`. CSS length. Defaults (via CSS) to 120px. */\n @Input() maxHeight?: string;\n /** Scroll back to the top whenever this key changes (`scroll` only). */\n @Input() scrollResetKey?: string;\n /** Fixed column count. Overrides the intrinsic auto-fit when set; rows fill left-to-right. */\n @Input() cols?: number;\n\n /**\n * Explicit column template overrides the intrinsic auto-fit (inline wins).\n * The track string is built by the core so all three packages emit the same\n * one.\n */\n get templateColumns(): string | null {\n return this.cols ? optionsGridTemplateColumns(this.cols) : null;\n }\n\n @ViewChild(\"grid\", { static: false }) gridRef?: ElementRef<HTMLDivElement>;\n\n /**\n * A new `scrollResetKey` means a different content group is being shown (e.g.\n * the next suggestion's options after a selection) — start it from the top\n * instead of inheriting the previous group's scroll offset.\n */\n ngOnChanges(changes: SimpleChanges): void {\n const change = changes[\"scrollResetKey\"];\n if (!change || change.isFirstChange()) return;\n const grid = this.gridRef?.nativeElement;\n if (grid) grid.scrollTop = 0;\n }\n}\n","<div\n #grid\n class=\"aia-grid\"\n [attr.data-scroll]=\"scroll ? '' : null\"\n [style.--aia-grid-min]=\"min\"\n [style.--aia-grid-max]=\"max\"\n [style.--aia-grid-gap]=\"gap\"\n [style.--aia-grid-max-height]=\"maxHeight\"\n [style.grid-template-columns]=\"templateColumns\"\n>\n <ng-content></ng-content>\n</div>\n","import { CommonModule } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n inject,\n type OnDestroy,\n Output,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport type { SuggestionOption } from \"@magicx-eng/ai-autocomplete-vanilla\";\n\n/**\n * Internal single-option cell used inside the suggestion grid. Mirrors\n * `packages/react/src/components/SuggestionItem.tsx`. Handles:\n *\n * - Tappable vs non-tappable cursor + hover styling\n * - Pressed-state streak animation (500ms, single-flight)\n * - Keyboard activation (Enter/Space)\n * - ARIA `role=\"option\"` + `aria-selected` for the listbox pattern\n * - Loading skeleton when `loading=true`\n *\n * @internal\n */\n@Component({\n selector: \"aia-suggestion-item\",\n standalone: true,\n imports: [CommonModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./suggestion-item.component.html\",\n styleUrls: [\"./suggestion-item.component.css\"],\n})\nexport class SuggestionItemComponent implements OnDestroy {\n @Input() option!: SuggestionOption;\n @Input() isHighlighted = false;\n @Input() id = \"\";\n @Input() loading = false;\n\n @Output() readonly select = new EventEmitter<SuggestionOption>();\n @Output() readonly highlight = new EventEmitter<void>();\n\n pressed = false;\n\n private readonly cdr = inject(ChangeDetectorRef);\n private pressedTimer: ReturnType<typeof setTimeout> | undefined;\n\n ngOnDestroy(): void {\n if (this.pressedTimer !== undefined) clearTimeout(this.pressedTimer);\n }\n\n onSelect(): void {\n if (this.loading || !this.option.is_tappable || this.pressed) return;\n this.pressed = true;\n this.cdr.markForCheck();\n this.select.emit(this.option);\n if (this.pressedTimer !== undefined) clearTimeout(this.pressedTimer);\n this.pressedTimer = setTimeout(() => {\n this.pressed = false;\n this.cdr.markForCheck();\n }, 500);\n }\n\n onMouseEnter(): void {\n if (this.loading || !this.option.is_tappable) return;\n this.highlight.emit();\n }\n\n onKeyDown(event: KeyboardEvent): void {\n if (this.loading || !this.option.is_tappable) return;\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n this.onSelect();\n }\n }\n}\n","<div\n [id]=\"id\"\n role=\"option\"\n data-aia-option=\"\"\n [attr.data-aia-loading]=\"loading ? '' : null\"\n [attr.aria-selected]=\"isHighlighted\"\n class=\"aia-suggestion-item\"\n [class.aia-suggestion-item-highlighted]=\"isHighlighted && !loading\"\n [class.aia-suggestion-item-tappable]=\"option.is_tappable\"\n [class.aia-suggestion-item-non-tappable]=\"!option.is_tappable\"\n [class.aia-suggestion-item-pressed]=\"pressed\"\n [attr.tabindex]=\"loading || !option.is_tappable ? -1 : 0\"\n (click)=\"onSelect()\"\n (keydown)=\"onKeyDown($event)\"\n (mouseenter)=\"onMouseEnter()\"\n>\n <div class=\"aia-suggestion-streaks\"></div>\n <div class=\"aia-suggestion-streaks-vert\"></div>\n <span class=\"aia-suggestion-content\">\n <span class=\"aia-suggestion-text\">\n <ng-container *ngIf=\"option.icon; else noIcon\"\n >{{ option.icon }} {{ option.text }}</ng-container\n >\n <ng-template #noIcon>{{ option.text }}</ng-template>\n </span>\n <span *ngIf=\"option.tag\" class=\"aia-suggestion-tag\">{{ option.tag }}</span>\n </span>\n</div>\n","import { CommonModule } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n HostListener,\n Input,\n inject,\n Output,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport {\n computeOptionsGridLayout,\n isOptionsGridMobileViewport,\n type SuggestionOption,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\nimport { GridComponent } from \"../layout/grid.component\";\nimport { SuggestionItemComponent } from \"../suggestion-item/suggestion-item.component\";\n\n/**\n * Internal grid of suggestion options. Mirrors\n * `packages/react/src/components/SuggestionGrid.tsx` — a thin wrapper over the\n * `Grid` layout primitive (which owns the auto-fit columns and the\n * capped-height scroll). It only wires each option to its\n * select/highlight handlers and listbox-scoped id.\n *\n * @internal\n */\n@Component({\n selector: \"aia-suggestion-grid\",\n standalone: true,\n imports: [CommonModule, GridComponent, SuggestionItemComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./suggestion-grid.component.html\",\n})\nexport class SuggestionGridComponent {\n @Input() options: SuggestionOption[] = [];\n @Input() activeIndex = -1;\n @Input() listboxId = \"\";\n @Input() loading = false;\n /**\n * Identity of the suggestion these options belong to. When it changes the\n * grid scrolls back to the top, so the next parameter's options are read\n * from the first one instead of from the previous list's scroll offset.\n */\n @Input() groupKey = \"\";\n\n @Output() readonly select = new EventEmitter<SuggestionOption>();\n @Output() readonly highlight = new EventEmitter<number>();\n\n private readonly cdr = inject(ChangeDetectorRef);\n\n // Recompute the responsive layout when the viewport crosses the mobile\n // breakpoint (OnPush getters only re-run when change detection is triggered).\n @HostListener(\"window:resize\")\n onResize(): void {\n this.cdr.markForCheck();\n }\n\n /**\n * Rows/columns policy — owned by the core so vanilla, React and Angular all\n * lay the options grid out identically. See `computeOptionsGridLayout`.\n */\n private get layout() {\n return computeOptionsGridLayout(this.options.length, isOptionsGridMobileViewport());\n }\n\n get gridCols(): number {\n return this.layout.cols;\n }\n get gridMaxHeight(): string {\n return this.layout.maxHeight;\n }\n\n trackByOptionText = (_: number, opt: SuggestionOption): string => opt.text;\n}\n","<!-- max=\"1fr\": columns share out the full width, so a lone column spans the\n whole options box instead of stopping at 250px. -->\n<aia-grid\n min=\"250px\"\n max=\"1fr\"\n gap=\"0\"\n [scroll]=\"true\"\n [scrollResetKey]=\"groupKey\"\n [cols]=\"gridCols\"\n [maxHeight]=\"gridMaxHeight\"\n>\n <aia-suggestion-item\n *ngFor=\"let option of options; trackBy: trackByOptionText; let i = index\"\n [option]=\"option\"\n [isHighlighted]=\"i === activeIndex\"\n [id]=\"listboxId + '-option-' + i\"\n [loading]=\"loading\"\n (select)=\"select.emit($event)\"\n (highlight)=\"highlight.emit(i)\"\n ></aia-suggestion-item>\n</aia-grid>\n","import { CommonModule } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n Input,\n inject,\n type OnChanges,\n type OnDestroy,\n type OnInit,\n type SimpleChanges,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport {\n type AppearanceMode,\n buildAttributionUrl,\n getFooterHint,\n type Product,\n type Suggestion,\n type SuggestionOption,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\nimport { BehaviorSubject, combineLatest, type Observable } from \"rxjs\";\nimport { map } from \"rxjs/operators\";\nimport type { AIAutocompleteController } from \"../controller/ai-autocomplete.controller\";\nimport { ClusterComponent } from \"../internal/layout/cluster.component\";\nimport { StackComponent } from \"../internal/layout/stack.component\";\nimport { PillListComponent } from \"../internal/pill-list/pill-list.component\";\nimport { ProductStripComponent } from \"../internal/product-strip/product-strip.component\";\nimport { SuggestionGridComponent } from \"../internal/suggestion-grid/suggestion-grid.component\";\n\ninterface DropdownVm {\n pills: Suggestion[];\n options: SuggestionOption[];\n activeIndex: number;\n isActivePillSelected: boolean;\n isLoading: boolean;\n showsPills: boolean;\n /** Whether the pillbar ends in the trailing \"skip\" button. */\n showsSkip: boolean;\n /**\n * Disabled state for the skip button: loading, or the post-selection window\n * where isLoading is suppressed but the core's skipActivePill() no-ops.\n */\n skipDisabled: boolean;\n /** Active pill's label, for the skip button's aria-label. */\n activePillLabel: string;\n showsOptions: boolean;\n showsFallbackSkeleton: boolean;\n isVisible: boolean;\n /** Product cards for the strip. Empty unless `products` is configured. */\n products: Product[];\n /** Identity of the suggestion the options belong to — drives the grid's scroll reset. */\n groupKey: string;\n footerKey: string;\n footerHint: string;\n optionsPosition: \"above\" | \"below\";\n}\n\n/** The content-bearing fields of the view-model (everything but `isVisible`). */\ntype DropdownContent = Omit<DropdownVm, \"isVisible\">;\n\n/**\n * Tier 2 dropdown component — the Angular equivalent of React's\n * `<AIAutocompleteDropdown />`. Renders the pillbar, options grid, and\n * loading skeleton based on the supplied controller's `dropdown$` snapshot.\n *\n * ```html\n * <ai-autocomplete-dropdown [controller]=\"ac\"></ai-autocomplete-dropdown>\n * ```\n *\n * All actions (pill click, option select, option highlight) are forwarded to\n * the controller. Consumers who need to observe these events can subscribe\n * to the controller's per-field observables.\n *\n * @public\n */\n@Component({\n selector: \"ai-autocomplete-dropdown\",\n standalone: true,\n imports: [\n CommonModule,\n PillListComponent,\n ProductStripComponent,\n SuggestionGridComponent,\n StackComponent,\n ClusterComponent,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./ai-autocomplete-dropdown.component.html\",\n // The shared appearance layer carries the design tokens + box-sizing reset +\n // optionsPosition reversal, so a standalone dropdown (no Tier 1 component on\n // the page) is fully styled once `mode` is set.\n styleUrls: [\"../shared/appearance.css\", \"./ai-autocomplete-dropdown.component.css\"],\n})\nexport class AIAutocompleteDropdownComponent implements OnInit, OnChanges, OnDestroy {\n /** The controller that owns the autocomplete state. Required. */\n @Input() controller!: AIAutocompleteController;\n /** Whether to render the pillbar above the options grid. Default: true. */\n @Input() showPills = true;\n /**\n * Whether the pillbar ends in a small \"skip\" button that dismisses the\n * active pill — same action as pressing → at the end of the input. It sits\n * at the trailing edge of the bar: visually top-right when the dropdown\n * opens below the input, bottom-right when `optionsPosition` is \"above\".\n * Default: true. Hidden automatically during re-edit and while the fallback\n * skeleton renders.\n */\n @Input() showSkipButton = true;\n /** Optional CSS class applied to the dropdown root. */\n @Input() className?: string;\n /**\n * Color mode for a standalone dropdown. When set, the dropdown self-scopes the\n * design tokens to its own root (adds `magicx-aia` + `data-mode`), so it needs\n * no `.magicx-aia` wrapper. `\"auto\"` follows `prefers-color-scheme`. Leave it\n * unset when the dropdown sits inside a `.magicx-aia` ancestor (e.g. Tier 1).\n */\n @Input() mode?: AppearanceMode;\n\n /** Concrete resolved mode, or null when `mode` is unset (inherit from ancestor). */\n resolvedMode: \"light\" | \"dark\" | null = null;\n private modeMql?: MediaQueryList;\n private modeListener?: () => void;\n private readonly cdr = inject(ChangeDetectorRef);\n\n /** Root class list — adds `magicx-aia` only when self-scoping via `mode`. */\n get rootClass(): string {\n let cls = \"magicx-aia-dropdown\";\n if (this.resolvedMode) cls += \" magicx-aia\";\n if (this.className) cls += ` ${this.className}`;\n return cls;\n }\n\n /** Fallback skeleton-bar widths used when loading with zero cached options. */\n readonly fallbackSkeletonBarWidths = [159, 119, 164];\n\n /**\n * Attribution/branding link URL for the footer, with a `utm_source` derived\n * from the embedding page's hostname (see {@link buildAttributionUrl}).\n */\n readonly brandHref = buildAttributionUrl();\n\n /**\n * View-model derived from the controller's `dropdown$`. Adds three booleans\n * (`showsPills`, `showsOptions`, `showsFallbackSkeleton`, `isVisible`) that\n * keep template-level logic to a property read per §19.6.\n *\n * Initialized once in `ngOnInit` — must NOT be a getter. A getter returns a\n * fresh `Observable` instance on every property read; with OnPush + `async`\n * pipe that means each change-detection cycle unsubscribes/resubscribes,\n * causing the `*ngIf=\"vm$ | async as vm\"` root to briefly resolve `null`\n * and flicker the entire dropdown DOM.\n */\n vm$!: Observable<DropdownVm>;\n\n // Bridge for the @Input `showPills` into the reactive pipeline. Without this,\n // changing the input after init wouldn't trigger a new vm emission until the\n // next controller.dropdown$ tick — and we'd lose the showPills update entirely\n // if the controller is idle. Updated from ngOnChanges below.\n private readonly showPills$ = new BehaviorSubject<boolean>(true);\n // Same bridge, for `showSkipButton`.\n private readonly showSkipButton$ = new BehaviorSubject<boolean>(true);\n\n // Last content emitted while the dropdown was visible. Reused during the\n // close fade so the populated dropdown fades out as one — see initVm.\n private lastVisibleContent: DropdownContent | null = null;\n\n ngOnInit(): void {\n // Seed the input bridges from their resolved values at init time.\n this.showPills$.next(this.showPills);\n this.showSkipButton$.next(this.showSkipButton);\n this.applyMode();\n this.initVm();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes[\"showPills\"]) {\n this.showPills$.next(this.showPills);\n }\n if (changes[\"showSkipButton\"]) {\n this.showSkipButton$.next(this.showSkipButton);\n }\n if (changes[\"mode\"] && !changes[\"mode\"].firstChange) {\n this.applyMode();\n }\n // Re-bind vm$ when the controller @Input is swapped (e.g. a multi-step form\n // toggling between controllers). Without this, vm$ stays subscribed to the\n // previous controller's dropdown$ — rendering stale options, or, if that\n // controller was destroy()-ed, receiving a completion that collapses the\n // dropdown permanently. Skip the first change: ngOnChanges fires before\n // ngOnInit, which owns the initial creation.\n if (changes[\"controller\"] && !changes[\"controller\"].firstChange && this.controller) {\n this.initVm();\n }\n }\n\n ngOnDestroy(): void {\n this.teardownModeListener();\n }\n\n /**\n * Resolve the `mode` input into `resolvedMode`. Unset → null (the dropdown\n * stays class-less and inherits from a `.magicx-aia` ancestor). `\"auto\"` reads\n * `prefers-color-scheme` and tracks it live via a media-query listener.\n */\n private applyMode(): void {\n this.teardownModeListener();\n if (this.mode === undefined) {\n this.resolvedMode = null;\n return;\n }\n if (this.mode === \"light\" || this.mode === \"dark\") {\n this.resolvedMode = this.mode;\n return;\n }\n // \"auto\"\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n this.resolvedMode = \"light\";\n return;\n }\n this.modeMql = window.matchMedia(\"(prefers-color-scheme: dark)\");\n this.resolvedMode = this.modeMql.matches ? \"dark\" : \"light\";\n this.modeListener = () => {\n this.resolvedMode = this.modeMql?.matches ? \"dark\" : \"light\";\n this.cdr.markForCheck();\n };\n this.modeMql.addEventListener(\"change\", this.modeListener);\n }\n\n private teardownModeListener(): void {\n if (this.modeMql && this.modeListener) {\n this.modeMql.removeEventListener(\"change\", this.modeListener);\n }\n this.modeMql = undefined;\n this.modeListener = undefined;\n }\n\n /** Build the view-model stream from the current controller + showPills$. */\n private initVm(): void {\n this.vm$ = combineLatest([\n this.controller.dropdown$,\n this.showPills$,\n this.showSkipButton$,\n ]).pipe(\n map(([dd, showPills, showSkipButton]) => {\n const activeSuggestion = dd.suggestions[0];\n const options = activeSuggestion?.options ?? [];\n const showsPills = showPills && (dd.pills.length > 0 || dd.isLoading);\n // The trailing \"skip\" button only makes sense next to a real,\n // skippable pill — never on the fallback skeleton bar, and never\n // during re-edit (the bar then shows an already answered param).\n // Deliberately NOT gated on showsPills: with pills rendered elsewhere\n // (pillPlacement \"inline\"/\"hidden\") the bar renders as a skip-only\n // row holding just the button. Hidden while the input is empty — the\n // footer hint doesn't advertise \"→ to skip\" until the user has typed,\n // so the pristine starting state stays free of the affordance too.\n const showsSkip =\n dd.pills.length > 0 && showSkipButton && !dd.isEditing && !dd.isInputEmpty;\n const showsOptions = options.length > 0;\n const showsFallbackSkeleton = dd.isLoading && !showsOptions;\n // Either half is enough to keep the panel up: products render with no\n // suggestions, suggestions render with no products.\n const isVisible =\n dd.isOpen && (showsOptions || showsPills || dd.isLoading || dd.products.length > 0);\n\n // While closing, reuse the last visible content so the populated\n // dropdown fades out as one. Otherwise the pills/options vanish the\n // instant the state empties (e.g. skipping the last pill with →),\n // leaving the always-present footer alone for a flash of a footer-only\n // \"no options\" box mid-fade. Only `isVisible` tracks live state to\n // drive the opacity transition.\n if (!isVisible && this.lastVisibleContent) {\n return { ...this.lastVisibleContent, isVisible: false };\n }\n\n const optionHighlighted =\n dd.activeIndex >= 0 && Boolean(options[dd.activeIndex]?.is_tappable);\n const { key: footerKey, hint: footerHint } = getFooterHint(\n optionHighlighted,\n dd.isInputEmpty,\n );\n const content: DropdownContent = {\n pills: dd.pills,\n options,\n activeIndex: dd.activeIndex,\n isActivePillSelected: dd.isActivePillSelected,\n isLoading: dd.isLoading,\n showsPills,\n showsSkip,\n skipDisabled: dd.isLoading || Boolean(dd.inSelectionAnimation),\n activePillLabel: dd.pills[0]?.text ?? \"\",\n showsOptions,\n showsFallbackSkeleton,\n products: dd.products,\n groupKey: activeSuggestion ? `${activeSuggestion.type} ${activeSuggestion.text}` : \"\",\n footerKey,\n footerHint,\n optionsPosition: dd.optionsPosition,\n };\n if (isVisible) this.lastVisibleContent = content;\n return { ...content, isVisible };\n }),\n );\n }\n\n trackByWidth = (_: number, w: number): number => w;\n\n onPillClick(index: number): void {\n this.controller.setActivePill(index);\n }\n\n onSkip(): void {\n this.controller.skipActivePill();\n }\n\n onSelect(option: SuggestionOption): void {\n this.controller.selectOption(option);\n }\n\n onHighlight(index: number): void {\n this.controller.setActiveDropdownIndex(index);\n }\n\n onProductSelect(product: Product): void {\n this.controller.selectProduct(product);\n }\n\n /**\n * A card taking focus blurs the editor, which would otherwise close the\n * panel out from under the card the user just tabbed to.\n */\n onProductFocusChange(focused: boolean): void {\n this.controller.setFocused(focused);\n }\n\n preventBlur(event: Event): void {\n // Prevent the editor from losing focus when interacting with the dropdown.\n event.preventDefault();\n }\n}\n","<div\n *ngIf=\"vm$ | async as vm\"\n [id]=\"controller.listboxId\"\n role=\"listbox\"\n data-aia-dropdown=\"\"\n [attr.data-aia-loading]=\"vm.isLoading ? '' : null\"\n [attr.data-mode]=\"resolvedMode\"\n [attr.data-options-position]=\"vm.optionsPosition\"\n [attr.data-aia-has-products]=\"vm.products.length > 0 ? '' : null\"\n [class]=\"rootClass\"\n [class.magicx-aia-dropdown-visible]=\"vm.isVisible\"\n (mousedown)=\"preventBlur($event)\"\n>\n <aia-stack space=\"8px\">\n <aia-cluster\n *ngIf=\"vm.showsPills || vm.showsSkip\"\n class=\"magicx-aia-dropdown-pillbar\"\n data-aia-pillbar=\"\"\n [noWrap]=\"true\"\n >\n <!-- The scroll + right-edge fade live on this wrapper (not the bar) so\n the skip button stays outside the masked region — pinned and fully\n opaque while overflowing pills fade under it. Absent in a skip-only\n row (pills rendered elsewhere via pillPlacement inline/hidden). -->\n <span *ngIf=\"vm.showsPills\" class=\"magicx-aia-pill-scroll\" data-aia-pill-scroll=\"\">\n <aia-pill-list\n [pills]=\"vm.pills\"\n [activePillIndex]=\"0\"\n [activeSelected]=\"vm.isActivePillSelected\"\n [rounded]=\"true\"\n [loading]=\"vm.isLoading\"\n (selectPill)=\"onPillClick($event)\"\n ></aia-pill-list>\n </span>\n <button\n *ngIf=\"vm.showsSkip\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"magicx-aia-skip\"\n data-aia-skip=\"\"\n [disabled]=\"vm.skipDisabled\"\n [attr.aria-label]=\"vm.activePillLabel ? 'Skip ' + vm.activePillLabel : 'Skip'\"\n (click)=\"onSkip()\"\n >\n skip\n </button>\n </aia-cluster>\n\n <aia-suggestion-grid\n *ngIf=\"vm.showsOptions\"\n [options]=\"vm.options\"\n [activeIndex]=\"vm.activeIndex\"\n [listboxId]=\"controller.listboxId\"\n [loading]=\"vm.isLoading\"\n [groupKey]=\"vm.groupKey\"\n (select)=\"onSelect($event)\"\n (highlight)=\"onHighlight($event)\"\n ></aia-suggestion-grid>\n\n <div\n *ngIf=\"vm.showsFallbackSkeleton\"\n class=\"magicx-aia-dropdown-skeleton-bars\"\n data-aia-skeleton-bars=\"\"\n >\n <span\n *ngFor=\"let w of fallbackSkeletonBarWidths; trackBy: trackByWidth\"\n class=\"magicx-aia-dropdown-skeleton-bar\"\n [style.width.px]=\"w\"\n ></span>\n </div>\n\n <!-- *ngIf, not just the section's own guard inside the component: the host\n element is an in-flow child of .aia-stack (display:flex; gap:8px), so\n an always-instantiated zero-height host would add a SECOND 8px gap\n between the grid and the footer — in every dropdown, products or not.\n The grid's --aia-grid-overlap-bottom is tuned for exactly one gap, so\n the footer would land 8px below the band it is meant to cover. -->\n <aia-product-strip\n *ngIf=\"vm.products.length > 0\"\n [products]=\"vm.products\"\n [listboxId]=\"controller.listboxId\"\n [focusable]=\"vm.isVisible\"\n (select)=\"onProductSelect($event)\"\n (focusChange)=\"onProductFocusChange($event)\"\n ></aia-product-strip>\n\n <footer class=\"magicx-aia-footer\" data-aia-footer=\"\">\n <div class=\"magicx-aia-footer-row\">\n <span class=\"magicx-aia-footer-hint-group\">\n <kbd class=\"magicx-aia-footer-key\">{{ vm.footerKey }}</kbd>\n <span class=\"magicx-aia-footer-hint\">{{ vm.footerHint }}</span>\n </span>\n <a\n class=\"magicx-aia-footer-brand-link\"\n [href]=\"brandHref\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <span class=\"magicx-aia-footer-brand\">AI</span>\n <span class=\"magicx-aia-footer-badge\">Autocomplete</span>\n </a>\n </div>\n </footer>\n </aia-stack>\n</div>\n","import { distinctUntilChanged, map, type Observable, shareReplay } from \"rxjs\";\n\n/**\n * Per-field observable derivation factory. Enforces the §19.4 invariant:\n *\n * - `distinctUntilChanged` — prevents re-emission storms when the upstream\n * state object ticks but the field a consumer cares about hasn't changed.\n * Without this, every keystroke would re-render every async-pipe binding\n * in the consumer's template even when nothing changed for that binding.\n * - `shareReplay({ bufferSize: 1, refCount: true })` — guarantees that\n * multiple subscribers (multiple `async` pipes in a template, e.g.\n * `*ngIf=\"isLoading$ | async\"` and `[disabled]=\"isLoading$ | async\"`)\n * share a single upstream subscription. `refCount: true` is non-obvious\n * but essential: without it, the inner subscription survives after the\n * last subscriber unmounts, leaking the chain back to `state$`.\n *\n * Every public observable on {@link AIAutocompleteController} must go through\n * this factory — no exceptions.\n *\n * @internal\n */\nexport function deriveField<T, R>(\n source$: Observable<T>,\n selector: (value: T) => R,\n equalityFn?: (a: R, b: R) => boolean,\n): Observable<R> {\n return source$.pipe(\n map(selector),\n distinctUntilChanged(equalityFn),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n}\n","import {\n type CompletedParamState,\n AIAutocomplete as CoreAIAutocomplete,\n type CoreState,\n type Product,\n type Segment,\n type SkippedParamState,\n type Suggestion,\n type SuggestionOption,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\nimport { BehaviorSubject, combineLatest, map, type Observable, shareReplay } from \"rxjs\";\nimport type {\n AIAutocompleteControllerOptions,\n AIAutocompleteControllerState,\n AIAutocompleteControllerUpdate,\n AIAutocompleteDropdownState,\n} from \"../shared/types\";\nimport { deriveField } from \"./observables\";\n\n/**\n * Tier 2 logic surface for `@magicx-eng/ai-autocomplete-angular` — the Angular\n * equivalent of React's `useAIAutocomplete()` hook. Wraps a headless\n * `@magicx-eng/ai-autocomplete-vanilla` core and exposes its state as RxJS\n * observables plus thin action methods.\n *\n * Per TDB §3.3, the controller is consumer-managed — the consumer creates it\n * with `new`, holds the reference, and **must call `destroy()`** in their\n * own `ngOnDestroy`. The Tier 1 `<ai-autocomplete>` component does this\n * automatically; Tier 2 consumers do not get auto-cleanup.\n *\n * @public\n */\nexport class AIAutocompleteController {\n private readonly core: CoreAIAutocomplete;\n private readonly rawState$: BehaviorSubject<CoreState>;\n // optionsPosition isn't part of CoreState (it's a core option), so track it\n // here and fold it into `dropdown$` so the dropdown can read placement from\n // the controller — configured once, kept in sync through update().\n private readonly optionsPosition$ = new BehaviorSubject<\"above\" | \"below\">(\"below\");\n private readonly unsubscribeCore: () => void;\n private isDestroyed = false;\n\n // === Per-field observables ===\n // Each one runs through deriveField, which bakes in distinctUntilChanged\n // and shareReplay({ bufferSize: 1, refCount: true }) per §19.4.\n\n /** Plain-text content of the editor. */\n readonly text$: Observable<string>;\n /** Completed (bold) params currently in the editor. */\n readonly completedParams$: Observable<CompletedParamState[]>;\n /**\n * Suggestions the user dismissed with the skip key (→). Nothing renders\n * them; they exist so a hand-rolled submit can pass them to\n * `buildSubmitResult` and carry the same `text: \"skipped\"` entries the\n * SDK's own requests do.\n */\n readonly skippedParams$: Observable<SkippedParamState[]>;\n /** Actionable suggestion pills (first one is the active pill). */\n readonly suggestionPills$: Observable<Suggestion[]>;\n /** Text + completed-param segments for rendering the editor body. */\n readonly segments$: Observable<Segment[]>;\n /** ID of the most-recently-promoted param (drives shimmer animation). */\n readonly newParamId$: Observable<string | null>;\n /** All suggestions from the server (including non-actionable ones). */\n readonly suggestions$: Observable<Suggestion[]>;\n /**\n * Results of the latest product search. Always empty unless `products` is\n * configured on the controller — the strip is opt-in and costs nothing when\n * it isn't wired up.\n */\n readonly products$: Observable<Product[]>;\n /** Currently highlighted dropdown option index. -1 = none. */\n readonly activeIndex$: Observable<number>;\n /**\n * UI-visible loading flag — suppressed during the post-select streak\n * animation and during re-edit (cached options stay visible there). Use\n * this instead of the raw core state for any loading-skeleton binding.\n */\n readonly isLoading$: Observable<boolean>;\n /** Server-reported \"query is complete\" flag. */\n readonly isReady$: Observable<boolean>;\n /** Whether the editor currently has focus. */\n readonly isFocused$: Observable<boolean>;\n /** Whether the dropdown should currently be visible. */\n readonly isDropdownOpen$: Observable<boolean>;\n /**\n * Whether the active (leading) pill should render selected (full opacity)\n * rather than the de-emphasized `first` tier. Auto trigger ⇒ true only while\n * a dropdown option is highlighted; manual ⇒ true once the pill is tapped.\n */\n readonly isActivePillSelected$: Observable<boolean>;\n /** Server-suggested placeholder text for the editor. */\n readonly placeholderText$: Observable<string>;\n /** Last fetch error, or null. */\n readonly error$: Observable<Error | null>;\n /** Param currently being re-edited, or null. */\n readonly editingParam$: Observable<CompletedParamState | null>;\n /** Plain-text offset where the edit region starts, or null. */\n readonly editingAnchor$: Observable<number | null>;\n /** Live caret offset within the editor. */\n readonly caretOffset$: Observable<number | null>;\n\n // === Composite observables ===\n\n /**\n * Snapshot of every public field in one object. Convenient for\n * `*ngIf=\"ctrl.state$ | async as state\"` templating — aliases all fields\n * under a single subscription instead of multiple `| async` pipes.\n */\n readonly state$: Observable<AIAutocompleteControllerState>;\n\n /**\n * Composite state for the dropdown view. Tier 2 consumers spread this into\n * `<ai-autocomplete-dropdown>`; Tier 1 uses the same shape internally.\n */\n readonly dropdown$: Observable<AIAutocompleteDropdownState>;\n\n /**\n * Throws if invoked outside a browser environment. For SSR / Angular\n * Universal, gate construction with `isPlatformBrowser` — see TDB §16.3.\n */\n constructor(opts: AIAutocompleteControllerOptions = {}) {\n if (typeof document === \"undefined\") {\n throw new Error(\n \"AIAutocompleteController requires a browser environment. \" +\n \"For SSR / Angular Universal, gate construction with isPlatformBrowser.\",\n );\n }\n\n // Headless mode never renders to the host, so a throwaway div is fine —\n // it's required by the core's signature for symmetry with full mode.\n const host = document.createElement(\"div\");\n\n this.core = new CoreAIAutocomplete(host, {\n ...opts,\n renderMode: \"headless\",\n source: opts.source ?? \"headless-sdk\",\n // Headless mode never renders the dropdown DOM, but the keyboard\n // controller still reads `optionsPosition` to decide which vertical\n // arrow opens the dropdown from the input.\n optionsPosition: opts.optionsPosition ?? \"below\",\n });\n\n this.rawState$ = new BehaviorSubject<CoreState>(this.core.getState());\n // Push the store's *current* state, not the snapshot the listener was\n // handed. The core notifies listeners synchronously, and some actions\n // trigger reentrant `store.set` calls (e.g. typing a non-matching char\n // during re-edit makes the core synchronously exit re-edit and kick off a\n // fetch).\n //\n // The core's store used to deliver such a nested set inline and then\n // resume the outer listener loop, so a listener could be handed an older\n // state (still in re-edit) *after* a newer one (re-edit exited) — which\n // resurrected a stale `editingParam` and retriggered the editor's re-edit\n // caret-park, yanking the caret back to where re-editing started. The\n // store now queues notifications and drains them in order, so that\n // out-of-order delivery can no longer happen at the source.\n //\n // Reading `getState()` at emission time is kept as belt-and-braces: it\n // costs nothing (distinctUntilChanged downstream drops the duplicate\n // emissions) and keeps this bridge correct for any future consumer that\n // emits mid-cascade. React needs neither, since it batches renders and\n // gates its caret effects on dependencies.\n this.unsubscribeCore = this.core.subscribe(() => {\n if (!this.isDestroyed) this.rawState$.next(this.core.getState());\n });\n\n // === Per-field observables ===\n // Array-valued fields use shallow equality. The vanilla store spreads on\n // every write (`store.set({ completedParams: [...] })`), so reference\n // equality would re-fire downstream subscribers on every state tick even\n // when the array's contents are unchanged. The other fields are\n // primitives or stable object references, so default identity equality\n // works fine.\n this.text$ = deriveField(this.rawState$, (s) => s.text);\n this.completedParams$ = deriveField(this.rawState$, (s) => s.completedParams, arrEq);\n this.skippedParams$ = deriveField(this.rawState$, (s) => s.skippedParams, arrEq);\n this.suggestionPills$ = deriveField(this.rawState$, (s) => s.actionableSuggestions, arrEq);\n this.segments$ = deriveField(this.rawState$, (s) => s.segments, arrEq);\n this.newParamId$ = deriveField(this.rawState$, (s) => s.newParamId);\n this.suggestions$ = deriveField(this.rawState$, (s) => s.suggestions, arrEq);\n this.products$ = deriveField(this.rawState$, (s) => s.products, arrEq);\n this.activeIndex$ = deriveField(this.rawState$, (s) => s.activeDropdownIndex);\n this.isLoading$ = deriveField(this.rawState$, computeUiLoading);\n this.isReady$ = deriveField(this.rawState$, (s) => s.isReady);\n this.isFocused$ = deriveField(this.rawState$, (s) => s.isFocused);\n this.isDropdownOpen$ = deriveField(this.rawState$, (s) => s.isDropdownOpen);\n this.isActivePillSelected$ = deriveField(this.rawState$, (s) => s.isActivePillSelected);\n this.placeholderText$ = deriveField(this.rawState$, (s) => s.placeholderText);\n this.error$ = deriveField(this.rawState$, (s) => s.error);\n this.editingParam$ = deriveField(this.rawState$, (s) => s.editingParam);\n this.editingAnchor$ = deriveField(this.rawState$, (s) => s.editingAnchor);\n this.caretOffset$ = deriveField(this.rawState$, (s) => s.caretOffset);\n\n // === Composite observables ===\n // Project directly off `rawState$` with a single map() so each store\n // tick produces exactly ONE coherent state$ emission. Using\n // `combineLatest` over the per-field observables here would fire one\n // emission per inner-source tick (up to N per store update), and the\n // editor-host directive's post-promote refocus would run against an\n // intermediate state where `newParamId` was set but `segments` /\n // `caretOffset` still held their old values — leaving the caret stuck\n // at the pre-click position.\n this.state$ = this.rawState$.pipe(\n map(computeState),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n\n this.optionsPosition$.next(opts.optionsPosition ?? \"below\");\n this.dropdown$ = combineLatest([this.rawState$, this.optionsPosition$]).pipe(\n map(([s, optionsPosition]) => computeDropdown(s, optionsPosition)),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n }\n\n // === Read-only accessors ===\n\n /** Stable ARIA listbox ID for the dropdown. Pass to `<textarea aria-controls=\"...\">`. */\n get listboxId(): string {\n return this.core.listboxId;\n }\n\n /** Whether `destroy()` has been called. After destruction all action methods no-op. */\n get destroyed(): boolean {\n return this.isDestroyed;\n }\n\n /**\n * Synchronous snapshot of the controller's current public state. Mirrors\n * the latest emission of `state$`. Useful in callbacks where you can't\n * `subscribe` (e.g. inside an event handler).\n */\n getState(): AIAutocompleteControllerState {\n return computeState(this.rawState$.value);\n }\n\n // === Action methods (pass-through to the core) ===\n //\n // Every action method begins with an `isDestroyed` guard so that callers\n // who hold a stale reference after `destroy()` don't accidentally trigger\n // work on a torn-down core. The vanilla core does not gate its own methods\n // post-dispose — `reset()`, `handleTextChange()`, and friends would still\n // schedule fetches or fire HTTP requests against an aborted controller,\n // and the responses would have nowhere to surface (rawState$ is already\n // complete). The guard makes the JSDoc-promised \"no-op silently\"\n // semantics actually true.\n\n /** Clear all state, rotate `session_id`, and re-fetch. Call after submit. */\n reset(): void {\n if (this.isDestroyed) return;\n this.core.reset();\n }\n\n /** Pick a dropdown option (or replace the re-edited param if in re-edit mode). */\n selectOption(option: SuggestionOption): void {\n if (this.isDestroyed) return;\n this.core.selectOption(option);\n }\n\n /**\n * Announce a product selection — fires the `onProductSelect` callback the\n * controller was constructed with. `<ai-autocomplete-dropdown>` calls this\n * for you; consumers rendering their own strip call it themselves.\n *\n * Emitting is the whole behaviour: the SDK deliberately does not navigate to\n * `product.url`, because only the integration knows whether a selection\n * means \"open the PDP\", \"add to cart\", or \"fill the input\".\n */\n selectProduct(product: Product): void {\n if (this.isDestroyed) return;\n this.core.selectProduct(product);\n }\n\n /** Promote the pill at `index` to active (front of the list). */\n setActivePill(index: number): void {\n if (this.isDestroyed) return;\n this.core.setActivePill(index);\n }\n\n /**\n * Skip the active pill — same action as pressing → at the end of the input.\n * The dropdown's skip button calls this; consumers rendering their own skip\n * affordance call it directly. The skipped suggestion joins `skippedParams$`.\n */\n skipActivePill(): void {\n if (this.isDestroyed) return;\n this.core.skipActivePill();\n }\n\n /** Drop the last completed param's \"completed\" status. Text stays as plain text. */\n removeLastParam(): void {\n if (this.isDestroyed) return;\n this.core.removeLastParam();\n }\n\n /** Clear the shimmer animation state for the most-recently-added param. */\n clearNewParamId(): void {\n if (this.isDestroyed) return;\n this.core.clearNewParamId();\n }\n\n /** Controlled-mode setter for editor text. */\n setValue(text: string): void {\n if (this.isDestroyed) return;\n this.core.setValue(text);\n }\n\n /** Controlled-mode setter for completed params. */\n setCompletedParams(params: CompletedParamState[]): void {\n if (this.isDestroyed) return;\n this.core.setCompletedParams(params);\n }\n\n /** Forward plain-text input from the consumer's `<textarea>` to the core. */\n handleTextChange(value: string): void {\n if (this.isDestroyed) return;\n this.core.handleTextChange(value);\n }\n\n /** Forward keyboard events from the consumer's `<textarea>` to the core. */\n handleKeyDown(event: KeyboardEvent): void {\n if (this.isDestroyed) return;\n this.core.handleKeyDown(event);\n }\n\n /** Notify the core of focus state. */\n setFocused(focused: boolean): void {\n if (this.isDestroyed) return;\n this.core.setFocused(focused);\n }\n\n /** Enter re-edit mode for the bold param with the given id. */\n startEditingParam(paramId: string): void {\n if (this.isDestroyed) return;\n this.core.startEditingParam(paramId);\n }\n\n /** Exit re-edit mode without changing the bold param. */\n exitEditMode(): void {\n if (this.isDestroyed) return;\n this.core.exitEditMode();\n }\n\n /** Forward post-input caret position (extends the edit tail). */\n handleCaretAfterInput(offset: number | null): void {\n if (this.isDestroyed) return;\n this.core.handleCaretAfterInput(offset);\n }\n\n /** Forward selection-only caret moves (may exit re-edit). */\n handleCaretMove(offset: number | null): void {\n if (this.isDestroyed) return;\n this.core.handleCaretMove(offset);\n }\n\n /** Replace the bold param being re-edited. Returns true when applied. */\n replaceEditingRange(replacement: string): boolean {\n if (this.isDestroyed) return false;\n return this.core.replaceEditingRange(replacement);\n }\n\n /** Set the highlighted option index (typically driven by hover). */\n setActiveDropdownIndex(index: number): void {\n if (this.isDestroyed) return;\n this.core.setActiveDropdownIndex(index);\n }\n\n // === Lifecycle ===\n\n /**\n * Apply runtime changes to a subset of options. Event callbacks\n * (`onSubmit`, `onError`, etc.) cannot be swapped this way — they are\n * registered once at construction (matches the React hook's design). For\n * dynamic event reactivity, subscribe to the corresponding observable\n * (e.g. `text$` instead of `onChange`).\n */\n update(opts: AIAutocompleteControllerUpdate): void {\n if (this.isDestroyed) return;\n this.core.update(opts);\n if (opts.optionsPosition !== undefined) {\n this.optionsPosition$.next(opts.optionsPosition);\n }\n }\n\n /**\n * Release all resources — unsubscribes from the core, destroys the core,\n * and completes the internal state subject. Safe to call multiple times.\n * After destruction, action methods no-op silently.\n */\n destroy(): void {\n if (this.isDestroyed) return;\n this.isDestroyed = true;\n this.unsubscribeCore();\n this.core.destroy();\n this.rawState$.complete();\n }\n}\n\n// ===== Pure helpers — not part of the public surface =====\n\n/**\n * Shallow array equality. The vanilla store reassigns array fields on every\n * write (`store.set({ completedParams: [...prev, x] })`), so reference\n * equality alone would re-emit downstream even when the contents are\n * identical. Used for `completedParams$`, `suggestions$`, `suggestionPills$`,\n * and `segments$`.\n */\nfunction arrEq<T>(a: readonly T[], b: readonly T[]): boolean {\n if (a === b) return true;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\nfunction computeUiLoading(s: CoreState): boolean {\n return s.isLoading && !s.editingParam && !s.inSelectionAnimation;\n}\n\nfunction computeState(s: CoreState): AIAutocompleteControllerState {\n return {\n text: s.text,\n completedParams: s.completedParams,\n skippedParams: s.skippedParams,\n suggestionPills: s.actionableSuggestions,\n segments: s.segments,\n newParamId: s.newParamId,\n suggestions: s.suggestions,\n products: s.products,\n activeIndex: s.activeDropdownIndex,\n isLoading: computeUiLoading(s),\n isReady: s.isReady,\n isFocused: s.isFocused,\n isDropdownOpen: s.isDropdownOpen,\n placeholderText: s.placeholderText,\n error: s.error,\n editingParam: s.editingParam,\n editingAnchor: s.editingAnchor,\n caretOffset: s.caretOffset,\n };\n}\n\nfunction computeDropdown(\n s: CoreState,\n optionsPosition: \"above\" | \"below\",\n): AIAutocompleteDropdownState {\n const editingParam = s.editingParam;\n const activeSuggestion = s.actionableSuggestions[0];\n const dropdownPill: Suggestion | null = editingParam\n ? {\n type: editingParam.suggestionType,\n text: editingParam.suggestionPlaceholder,\n required: true,\n options: editingParam.options,\n }\n : null;\n const dropdownActivePill = dropdownPill ?? activeSuggestion;\n const dropdownPills = dropdownPill ? [dropdownPill] : s.actionableSuggestions;\n return {\n suggestions: dropdownActivePill ? [{ ...dropdownActivePill, options: s.filteredOptions }] : [],\n activeIndex: s.activeDropdownIndex,\n isOpen: s.isDropdownOpen,\n pills: dropdownPills,\n isActivePillSelected: s.isActivePillSelected,\n isLoading: computeUiLoading(s),\n isInputEmpty: s.text.trim().length === 0,\n products: s.products,\n isEditing: Boolean(editingParam),\n inSelectionAnimation: s.inSelectionAnimation,\n optionsPosition,\n };\n}\n","import {\n Directive,\n ElementRef,\n Input,\n inject,\n NgZone,\n type OnDestroy,\n type OnInit,\n Renderer2,\n} from \"@angular/core\";\nimport {\n extractPlainText,\n getCursorOffset,\n plainTextLength,\n renderEditableContent,\n setCursorOffset,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\nimport { Subject, takeUntil } from \"rxjs\";\nimport type { AIAutocompleteController } from \"../../controller/ai-autocomplete.controller\";\n\n/**\n * Module-level cache for the one-time plaintext-only feature detection.\n * Mirrors `supportsPlaintextOnly` in useContentEditableEditor.ts.\n */\nlet plaintextOnlyCache: boolean | undefined;\nfunction supportsPlaintextOnly(): boolean {\n if (plaintextOnlyCache !== undefined) return plaintextOnlyCache;\n if (typeof document === \"undefined\") return false;\n const probe = document.createElement(\"div\");\n probe.setAttribute(\"contenteditable\", \"plaintext-only\");\n plaintextOnlyCache = probe.contentEditable === \"plaintext-only\";\n return plaintextOnlyCache;\n}\n\n/**\n * Internal directive that owns every concern specific to running the\n * autocomplete on top of a contentEditable host: composition state, caret\n * tracking, selectionchange handling, `beforeinput` interception, paste\n * sanitization, plaintext-only feature detection, segment rendering,\n * post-promote refocus, and re-edit caret park.\n *\n * Mirrors `packages/react/src/hooks/useContentEditableEditor.ts` one-for-one.\n * Used only by the Tier 1 `<ai-autocomplete>` component — never exported.\n *\n * @internal\n */\n@Directive({\n selector: \"[aiaEditorHost]\",\n standalone: true,\n host: {\n role: \"combobox\",\n \"aria-autocomplete\": \"list\",\n \"aria-haspopup\": \"listbox\",\n spellcheck: \"true\",\n enterkeyhint: \"send\",\n tabindex: \"0\",\n \"(input)\": \"onInput()\",\n \"(keydown)\": \"onKeyDown($event)\",\n \"(compositionstart)\": \"onCompositionStart()\",\n \"(compositionend)\": \"onCompositionEnd()\",\n \"(paste)\": \"onPaste($event)\",\n \"(focus)\": \"onFocus()\",\n \"(blur)\": \"onBlur()\",\n },\n})\nexport class AIAutocompleteEditorHostDirective implements OnInit, OnDestroy {\n @Input(\"aiaEditorHost\") controller!: AIAutocompleteController;\n @Input() autoFocus = true;\n\n private readonly el = inject<ElementRef<HTMLDivElement>>(ElementRef);\n private readonly renderer = inject(Renderer2);\n private readonly zone = inject(NgZone);\n private readonly destroy$ = new Subject<void>();\n\n private composing = false;\n private lastInputAt = 0;\n private lastSeenParamId = \"\";\n private lastEditingId = \"\";\n private editingParamId: string | null = null;\n\n private documentSelectionListener?: () => void;\n private beforeInputListener?: (event: Event) => void;\n\n ngOnInit(): void {\n if (!this.controller) {\n throw new Error(\"[aiaEditorHost] requires a controller\");\n }\n\n const el = this.el.nativeElement;\n const ceMode = supportsPlaintextOnly() ? \"plaintext-only\" : \"true\";\n this.renderer.setAttribute(el, \"contenteditable\", ceMode);\n this.renderer.setAttribute(el, \"aria-controls\", this.controller.listboxId);\n this.renderer.setAttribute(el, \"suppress-content-editable-warning\", \"true\");\n\n // Auto-focus on mount. If the editor already has focus (e.g. from a\n // click that fired before our lifecycle ran), notify the controller\n // instead of stealing focus.\n if (this.autoFocus) {\n queueMicrotask(() => {\n if (typeof document === \"undefined\") return;\n if (document.activeElement === el) {\n this.controller.setFocused(true);\n } else {\n el.focus();\n }\n });\n }\n\n this.bindDocumentSelectionListener();\n this.bindBeforeInputListener();\n this.bindStateSubscription();\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n if (this.documentSelectionListener && typeof document !== \"undefined\") {\n document.removeEventListener(\"selectionchange\", this.documentSelectionListener);\n }\n if (this.beforeInputListener) {\n this.el.nativeElement.removeEventListener(\"beforeinput\", this.beforeInputListener);\n }\n }\n\n // === Host event handlers ===\n\n onCompositionStart(): void {\n this.composing = true;\n }\n\n onCompositionEnd(): void {\n this.composing = false;\n this.fireInput();\n }\n\n onInput(): void {\n this.lastInputAt = performance.now();\n this.fireInput();\n this.controller.handleCaretAfterInput(getCursorOffset(this.el.nativeElement));\n }\n\n onKeyDown(event: KeyboardEvent): void {\n this.controller.handleKeyDown(event);\n }\n\n onPaste(event: ClipboardEvent): void {\n event.preventDefault();\n const el = this.el.nativeElement;\n const text = (event.clipboardData?.getData(\"text/plain\") ?? \"\").replace(/\\r?\\n/g, \" \");\n if (!text) return;\n const doc = el.ownerDocument ?? document;\n const sel = doc.getSelection();\n if (!sel || sel.rangeCount === 0) return;\n const range = sel.getRangeAt(0);\n if (!el.contains(range.startContainer)) return;\n range.deleteContents();\n const node = doc.createTextNode(text);\n range.insertNode(node);\n range.setStartAfter(node);\n range.collapse(true);\n sel.removeAllRanges();\n sel.addRange(range);\n this.fireInput();\n }\n\n onFocus(): void {\n this.controller.setFocused(true);\n }\n\n onBlur(): void {\n this.controller.setFocused(false);\n }\n\n // === Internal helpers ===\n\n private fireInput(): void {\n if (this.composing) return;\n const el = this.el.nativeElement;\n const raw = extractPlainText(el);\n const shouldCapitalize = raw.length > 0 && raw[0] !== raw[0].toUpperCase();\n const next = shouldCapitalize ? raw[0].toUpperCase() + raw.slice(1) : raw;\n this.controller.handleTextChange(next);\n }\n\n private bindDocumentSelectionListener(): void {\n if (typeof document === \"undefined\") return;\n const el = this.el.nativeElement;\n // selectionchange fires on every keystroke and caret move — run outside\n // Angular's zone (§16.1) and re-enter only when we actually need to\n // notify the controller of a meaningful change.\n this.zone.runOutsideAngular(() => {\n const handler = (): void => {\n const sel = document.getSelection();\n if (!sel || sel.rangeCount === 0) return;\n if (!sel.anchorNode || !el.contains(sel.anchorNode)) return;\n const anchor = sel.anchorNode;\n const startEl =\n anchor.nodeType === Node.ELEMENT_NODE ? (anchor as Element) : anchor.parentElement;\n // Only a COLLAPSED selection means \"the caret landed in a chip\". A\n // range selection (Cmd+A, shift-arrow, drag) anchors at its start,\n // which lands inside the first `<strong>` whenever the input begins\n // with a chip — starting re-edit there parks the caret on that chip\n // and destroys the user's selection.\n const strong = sel.isCollapsed\n ? startEl?.closest<HTMLElement>('strong[data-seg=\"completed\"][data-param-id]')\n : null;\n // `DOMStringMap` is an index signature; bracket notation is required\n // by `noPropertyAccessFromIndexSignature`.\n const enclosing = strong?.dataset[\"paramId\"] ?? null;\n if (enclosing && enclosing !== this.editingParamId) {\n this.zone.run(() => this.controller.startEditingParam(enclosing));\n return;\n }\n if (performance.now() - this.lastInputAt < 50) return;\n this.zone.run(() => this.controller.handleCaretMove(getCursorOffset(el)));\n };\n this.documentSelectionListener = handler;\n document.addEventListener(\"selectionchange\", handler);\n });\n }\n\n private bindBeforeInputListener(): void {\n const el = this.el.nativeElement;\n // Native beforeinput — React's synthetic onBeforeInput is wired to the\n // legacy textInput event and doesn't fire reliably for delete* types.\n const handler = (event: Event): void => {\n const inputEvent = event as InputEvent;\n const t = inputEvent.inputType;\n if (t === \"insertParagraph\" || t === \"insertLineBreak\" || t === \"insertFromDrop\") {\n event.preventDefault();\n return;\n }\n if (t.startsWith(\"insert\") || t.startsWith(\"delete\")) {\n const replacement = t.startsWith(\"delete\") ? \"\" : (inputEvent.data ?? \"\");\n if (this.controller.replaceEditingRange(replacement)) {\n event.preventDefault();\n }\n }\n };\n this.beforeInputListener = handler;\n el.addEventListener(\"beforeinput\", handler);\n }\n\n private bindStateSubscription(): void {\n const el = this.el.nativeElement;\n this.controller.state$.pipe(takeUntil(this.destroy$)).subscribe((state) => {\n this.editingParamId = state.editingParam?.id ?? null;\n\n renderEditableContent({\n input: el,\n segments: state.segments,\n newParamId: state.newParamId,\n editingParamId: state.editingParam?.id ?? null,\n placeholderText: state.placeholderText,\n isFocused: state.isFocused,\n });\n\n // Post-promote refocus + caret-after-bold placement (mirrors React's\n // useLayoutEffect on newParamId).\n const currentParamId = state.newParamId ?? \"\";\n if (currentParamId && currentParamId !== this.lastSeenParamId) {\n this.lastSeenParamId = currentParamId;\n el.focus();\n const desired = state.caretOffset ?? plainTextLength(el);\n setCursorOffset(el, desired);\n } else if (!currentParamId) {\n this.lastSeenParamId = \"\";\n }\n\n // Re-edit caret park (mirrors React's useLayoutEffect on editingParam).\n const editingId = state.editingParam?.id ?? \"\";\n if (editingId && editingId !== this.lastEditingId && state.editingAnchor != null) {\n this.lastEditingId = editingId;\n setCursorOffset(el, state.editingAnchor);\n } else if (!editingId) {\n this.lastEditingId = \"\";\n }\n });\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n Output,\n ViewEncapsulation,\n} from \"@angular/core\";\n\n/**\n * Internal default submit button (up-arrow). Angular analogue of React's\n * `SubmitButton`. The default/custom/hidden branching stays in the parent\n * (`AIAutocompleteComponent`); this is only the built-in button.\n *\n * @internal\n */\n@Component({\n selector: \"aia-submit-button\",\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./submit-button.component.html\",\n styleUrls: [\"./submit-button.component.css\"],\n})\nexport class SubmitButtonComponent {\n @Input() disabled = false;\n @Output() readonly submit = new EventEmitter<MouseEvent>();\n\n onClick(event: MouseEvent): void {\n this.submit.emit(event);\n }\n}\n","<button\n type=\"button\"\n data-aia-submit=\"\"\n class=\"magicx-aia-submit-button\"\n [disabled]=\"disabled\"\n aria-label=\"Submit\"\n (click)=\"onClick($event)\"\n>\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\" role=\"img\" aria-label=\"Submit\">\n <path\n d=\"M9 14V4M9 4L4 9M9 4L14 9\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n</button>\n","import { CommonModule, isPlatformBrowser } from \"@angular/common\";\nimport {\n type AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n type ElementRef,\n EventEmitter,\n forwardRef,\n Input,\n inject,\n NgZone,\n type OnChanges,\n type OnDestroy,\n type OnInit,\n Output,\n PLATFORM_ID,\n type SimpleChanges,\n type TemplateRef,\n ViewChild,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport {\n type APIConfig,\n type AppearanceMode,\n type AutocompleteResult,\n buildSubmitResult,\n type CompletedParamState,\n extractPlainText,\n ModeController,\n type OptionOverrides,\n type Product,\n type ProductsConfig,\n setCursorOffset,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\nimport { AIAutocompleteDropdownComponent } from \"../ai-autocomplete-dropdown/ai-autocomplete-dropdown.component\";\nimport { AIAutocompleteController } from \"../controller/ai-autocomplete.controller\";\nimport { AIAutocompleteEditorHostDirective } from \"../internal/editor-host/editor-host.directive\";\nimport { PillListComponent } from \"../internal/pill-list/pill-list.component\";\nimport { SubmitButtonComponent } from \"../internal/submit-button/submit-button.component\";\n\n/**\n * Tier 1 component — `<ai-autocomplete>`. The Angular equivalent of React's\n * `<AIAutocomplete />`. Owns the contentEditable editor, inline pills, mode\n * controller, submit button slot, and an embedded\n * {@link AIAutocompleteController} that drives the dropdown.\n *\n * @public\n */\n@Component({\n selector: \"ai-autocomplete\",\n standalone: true,\n imports: [\n CommonModule,\n AIAutocompleteDropdownComponent,\n AIAutocompleteEditorHostDirective,\n PillListComponent,\n SubmitButtonComponent,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./ai-autocomplete.component.html\",\n styleUrls: [\"./ai-autocomplete.component.css\"],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n useExisting: forwardRef(() => AIAutocompleteComponent),\n multi: true,\n },\n ],\n})\nexport class AIAutocompleteComponent\n implements OnInit, AfterViewInit, OnChanges, OnDestroy, ControlValueAccessor\n{\n // === Inputs (mirrors React's AIAutocompleteProps) ===\n\n @Input() apiConfig?: APIConfig;\n @Input() optionOverrides?: OptionOverrides;\n @Input() maskCompletedText = false;\n @Input() columns?: number;\n /** Where unfilled pills render. Default: \"dropdown\". */\n @Input() pillPlacement: \"inline\" | \"dropdown\" | \"hidden\" = \"dropdown\";\n /** Color mode. \"auto\" follows prefers-color-scheme. Default: \"auto\". */\n @Input() mode: AppearanceMode = \"auto\";\n @Input() optionsPosition: \"above\" | \"below\" = \"below\";\n @Input() animations = true;\n @Input() dropdownTrigger?: \"auto\" | \"manual\" | \"hidden\";\n @Input() closeDropdownOnBlur?: boolean;\n @Input() showNonTappableOptions?: boolean;\n /**\n * When true (default), the dropdown's pill bar ends in a small \"skip\" button\n * that dismisses the active pill — same action as pressing → at the end of\n * the input. Set to false to hide it. When pills render elsewhere\n * (`pillPlacement: \"inline\"` / `\"hidden\"`) the bar renders as a skip-only\n * row holding just the button. Hidden while the input is empty — it appears\n * alongside the footer's \"→ to skip\" hint once the user has typed.\n */\n @Input() showSkipButton = true;\n /** Focus the editor on mount. Default: true. */\n @Input() autoFocus = true;\n /** Controlled-mode text value. */\n @Input() value?: string;\n /** Controlled-mode completed params. */\n @Input() completedParams?: CompletedParamState[];\n /**\n * Opt-in product strip. When set, the dropdown renders a horizontal row of\n * product cards below the options grid, fed by your own search endpoint on\n * the SDK's existing fetch cadence. Omit it and nothing about the dropdown\n * changes — no request, no markup, no layout shift.\n *\n * Bind a stable reference (a component field, not an inline object literal):\n * a new object on each change-detection pass reads as a swapped integration\n * and clears the current cards — the same rule that already applies to\n * `apiConfig` and `optionOverrides`.\n */\n @Input() products?: ProductsConfig;\n /**\n * Custom submit button. Pass a `<ng-template>` to replace the default arrow\n * button. Pass `null` to render no button. Default (`undefined`) renders\n * the built-in arrow.\n */\n @Input() submitButton?: TemplateRef<unknown> | null;\n\n // === Outputs ===\n\n /** Called on Enter or submit-button click. */\n @Output() readonly submitted = new EventEmitter<AutocompleteResult>();\n @Output() readonly errored = new EventEmitter<Error>();\n @Output() readonly valueChange = new EventEmitter<string>();\n @Output() readonly completedParamsChange = new EventEmitter<CompletedParamState[]>();\n @Output() readonly focused = new EventEmitter<void>();\n @Output() readonly blurred = new EventEmitter<void>();\n /**\n * Emitted when the user activates a product card. The SDK does not\n * navigate — you decide what a selection means. Modifier / middle clicks are\n * left to the browser (cmd-click still opens a tab) and don't emit.\n */\n @Output() readonly productSelect = new EventEmitter<Product>();\n\n // === View refs ===\n\n @ViewChild(\"container\", { static: true }) containerRef!: ElementRef<HTMLDivElement>;\n @ViewChild(\"editor\", { static: false }) editorRef?: ElementRef<HTMLDivElement>;\n @ViewChild(\"pillContainer\") pillContainerRef?: ElementRef<HTMLSpanElement>;\n\n // === Public state for the template ===\n\n controller!: AIAutocompleteController;\n /**\n * Concrete light/dark value bound to `[attr.data-mode]`. Seeded in ngOnInit\n * so the attribute is present during SSR (where ModeController, gated behind\n * isPlatformBrowser in ngAfterViewInit, never runs). On the browser the\n * ModeController's resolve callback keeps this in sync — so its runtime\n * prefers-color-scheme updates and this binding always agree (no clobber).\n */\n resolvedMode: \"light\" | \"dark\" = \"dark\";\n\n // === Internal ===\n\n private modeController?: ModeController;\n private resizeObserver?: ResizeObserver;\n private onChangeFn: (value: string) => void = noop;\n private onTouchedFn: () => void = noop;\n // Holds a value written by Reactive Forms before ngOnInit ran. Reactive\n // Forms can call writeValue() during dynamic form construction (e.g. when\n // a FormControl already holds a value at the moment the directive is\n // created). We stash the value here and flush it in ngOnInit *after*\n // the controller exists — otherwise the editor renders empty even though\n // the form had a value. `undefined` means \"no pending write\".\n private pendingWriteValue: string | undefined;\n\n // §16.9: prefer `inject()` over constructor-parameter DI for components.\n private readonly platformId = inject(PLATFORM_ID);\n private readonly zone = inject(NgZone);\n private readonly cdr = inject(ChangeDetectorRef);\n\n ngOnInit(): void {\n // Seed before the browser guard so SSR renders a concrete data-mode.\n this.resolvedMode = resolveInitialMode(this.mode);\n if (!isPlatformBrowser(this.platformId)) return;\n\n this.controller = new AIAutocompleteController({\n apiConfig: this.apiConfig,\n optionOverrides: this.optionOverrides,\n maskCompletedText: this.maskCompletedText,\n columns: this.columns,\n dropdownTrigger: this.dropdownTrigger,\n optionsPosition: this.optionsPosition,\n closeDropdownOnBlur: this.closeDropdownOnBlur,\n showNonTappableOptions: this.showNonTappableOptions,\n source: \"full-sdk\",\n products: this.products,\n value: this.value,\n completedParams: this.completedParams,\n onSubmit: (result) => this.handleSubmit(result),\n onError: (error) => this.errored.emit(error),\n onChange: (text) => {\n this.valueChange.emit(text);\n this.onChangeFn(text);\n },\n onParamsChange: (params) => this.completedParamsChange.emit(params),\n onFocus: () => this.focused.emit(),\n onProductSelect: (product) => this.productSelect.emit(product),\n onBlur: () => {\n this.blurred.emit();\n this.onTouchedFn();\n },\n setCursor: (offset) => {\n const editor = this.editorRef?.nativeElement;\n if (!editor) return;\n editor.focus();\n setCursorOffset(editor, offset);\n },\n });\n\n if (this.pendingWriteValue !== undefined) {\n this.controller.setValue(this.pendingWriteValue);\n this.pendingWriteValue = undefined;\n }\n }\n\n ngAfterViewInit(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n // ModeController writes `data-mode` to the element it's given. The CSS\n // selectors are scoped to `.magicx-aia[data-mode=\"...\"]` — which lives on\n // the inner `<div class=\"magicx-aia magicx-aia-container\" #container>`,\n // NOT the host `<ai-autocomplete>` element. The resolve callback mirrors\n // the value into `resolvedMode` so the `[attr.data-mode]` binding stays in\n // lockstep with ModeController — the binding handles SSR, ModeController\n // handles runtime prefers-color-scheme switches, and because they always\n // agree neither clobbers the other.\n this.modeController = new ModeController(\n this.containerRef.nativeElement,\n this.mode,\n (resolved) => {\n this.resolvedMode = resolved;\n this.cdr.markForCheck();\n },\n );\n\n // Pill-wrap detection — when the pill list wraps below the editor's last\n // line, drop its 8px left margin via a data attribute the CSS keys off.\n // Mirrors the React component's useLayoutEffect.\n if (typeof ResizeObserver !== \"undefined\") {\n this.zone.runOutsideAngular(() => {\n this.resizeObserver = new ResizeObserver(() => this.measurePillWrap());\n const editor = this.editorRef?.nativeElement;\n if (editor) this.resizeObserver.observe(editor);\n });\n this.measurePillWrap();\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.controller) return;\n // `SimpleChanges` is `{ [key: string]: SimpleChange }`, so per\n // `noPropertyAccessFromIndexSignature` each key lookup uses bracket\n // notation — this keeps the strictness contract that the rest of the\n // workspace enforces.\n // Controlled-mode propagation\n if (changes[\"value\"] && this.value !== undefined) {\n this.controller.setValue(this.value);\n }\n if (changes[\"completedParams\"] && this.completedParams !== undefined) {\n this.controller.setCompletedParams(this.completedParams);\n }\n // Reactive options\n if (\n changes[\"apiConfig\"] ||\n changes[\"optionOverrides\"] ||\n changes[\"dropdownTrigger\"] ||\n changes[\"optionsPosition\"] ||\n changes[\"closeDropdownOnBlur\"] ||\n changes[\"showNonTappableOptions\"] ||\n changes[\"products\"]\n ) {\n this.controller.update({\n apiConfig: this.apiConfig,\n optionOverrides: this.optionOverrides,\n dropdownTrigger: this.dropdownTrigger,\n optionsPosition: this.optionsPosition,\n closeDropdownOnBlur: this.closeDropdownOnBlur,\n showNonTappableOptions: this.showNonTappableOptions,\n // Same reference on an unrelated change is a no-op in the core; only a\n // genuinely swapped (or removed) integration clears the strip.\n products: this.products,\n });\n }\n if (changes[\"mode\"]) {\n // Keep the binding correct even when ModeController doesn't exist yet\n // (SSR / pre-ngAfterViewInit). On the browser, setMode triggers the\n // resolve callback which sets the same value.\n this.resolvedMode = resolveInitialMode(this.mode);\n this.modeController?.setMode(this.mode);\n }\n }\n\n ngOnDestroy(): void {\n this.resizeObserver?.disconnect();\n this.modeController?.destroy();\n this.controller?.destroy();\n }\n\n // === Imperative API (exposed on the component instance via @ViewChild) ===\n\n /** Programmatically focus the editor. */\n focus(): void {\n this.editorRef?.nativeElement.focus();\n }\n\n /** Programmatically blur the editor. */\n blur(): void {\n this.editorRef?.nativeElement.blur();\n }\n\n /** Clear all state, rotate session, and re-fetch. */\n reset(): void {\n this.controller?.reset();\n }\n\n /**\n * Skip the active pill — same action as the dropdown's skip button / →.\n * Lets a consumer who hides the built-in button (`showSkipButton=false`)\n * drive skipping from their own UI.\n */\n skipActivePill(): void {\n this.controller?.skipActivePill();\n }\n\n /** Switch color mode at runtime. */\n setMode(mode: AppearanceMode): void {\n this.mode = mode;\n this.resolvedMode = resolveInitialMode(mode);\n this.modeController?.setMode(mode);\n this.cdr.markForCheck();\n }\n\n // === Template helpers ===\n\n /**\n * 'default' → render the built-in arrow button.\n * 'custom' → project the consumer-supplied TemplateRef.\n * 'hidden' → no button.\n */\n get submitButtonState(): \"default\" | \"custom\" | \"hidden\" {\n if (this.submitButton === null) return \"hidden\";\n if (this.submitButton === undefined) return \"default\";\n return \"custom\";\n }\n\n /** Narrowed accessor for *ngTemplateOutlet — never undefined. */\n get customSubmitTemplate(): TemplateRef<unknown> | null {\n return this.submitButton ?? null;\n }\n\n get showInlinePills(): boolean {\n return this.pillPlacement === \"inline\";\n }\n\n get showDropdownPills(): boolean {\n return this.pillPlacement === \"dropdown\";\n }\n\n /**\n * `true` when there's something to submit — driven by current segments\n * and completed params. Read off the live editor via the controller state.\n */\n canSubmit(state: { segments: { length: number }; completedParams: { length: number } }): boolean {\n return state.segments.length > 0 || state.completedParams.length > 0;\n }\n\n onWrapperClick(event: MouseEvent): void {\n // Clicking a pill should activate it without stealing focus elsewhere.\n const target = event.target as HTMLElement | null;\n if (target?.closest(\"[data-aia-pill]\")) return;\n this.focus();\n }\n\n onSubmitButtonClick(event: MouseEvent): void {\n event.stopPropagation();\n this.handleSubmitFromUserAction();\n }\n\n onSubmitSlotClick(event: MouseEvent): void {\n event.stopPropagation();\n this.handleSubmitFromUserAction();\n }\n\n onSelectPill(index: number): void {\n this.controller.setActivePill(index);\n }\n\n // === ControlValueAccessor ===\n\n writeValue(value: string | null): void {\n const next = value ?? \"\";\n if (!this.controller) {\n // Reactive Forms can call writeValue() before ngOnInit creates the\n // controller (dynamic form construction, or a FormControl that already\n // had a value at directive-creation time). Buffer the value; ngOnInit\n // flushes it as soon as the controller exists.\n this.pendingWriteValue = next;\n return;\n }\n this.controller.setValue(next);\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChangeFn = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouchedFn = fn;\n }\n\n setDisabledState(_disabled: boolean): void {\n // The contentEditable host doesn't have a native disabled attribute. For\n // v0.1 we accept the call so Angular's forms layer doesn't throw, but\n // the editor stays interactive. A future enhancement can toggle\n // contentEditable + ARIA disabled here.\n }\n\n // === Submit flow ===\n\n /**\n * Called by the controller's onSubmit callback (which fires from the\n * keyboard controller on Enter). Reads the live editor text — same trick\n * the React component uses — so the emitted query reflects whatever's in\n * the DOM right now, not a possibly-stale state snapshot.\n */\n private handleSubmit(_result: AutocompleteResult): void {\n const editor = this.editorRef?.nativeElement;\n if (!editor) return;\n const text = extractPlainText(editor);\n const state = this.controller.getState();\n const params = this.completedParams ?? state.completedParams;\n this.submitted.emit(buildSubmitResult(text, params, state.skippedParams));\n this.controller.reset();\n }\n\n private handleSubmitFromUserAction(): void {\n const state = this.controller.getState();\n if (!this.canSubmit(state)) return;\n // Synthesize the result for the submit-button click path; same shape\n // the controller would deliver from a keyboard Enter, so handleSubmit\n // can take either entry point.\n this.handleSubmit({\n query: state.text.trim(),\n raw_query: \"\",\n completed_params: [],\n });\n }\n\n private measurePillWrap(): void {\n const container = this.pillContainerRef?.nativeElement;\n const editor = this.editorRef?.nativeElement;\n if (!container || !editor) return;\n const inner = container.firstElementChild as HTMLElement | null;\n if (!inner) return;\n // Wrap detection: the pill row's top vs the editor's bottom. When the\n // pills sit on (or above) the editor's last line they're NOT wrapped —\n // keep the 8px margin so they don't butt against typed text or the\n // placeholder. This handles the empty-editor + placeholder case\n // naturally: the placeholder still occupies the editor's line box.\n const cRect = inner.getBoundingClientRect();\n const eRect = editor.getBoundingClientRect();\n const wrapped = cRect.top >= eRect.bottom - 2;\n this.zone.run(() => {\n if (wrapped) container.setAttribute(\"data-aia-pill-wrapped\", \"\");\n else container.removeAttribute(\"data-aia-pill-wrapped\");\n });\n }\n}\n\nfunction noop(): void {\n // Default no-op for CVA callbacks.\n}\n\n/**\n * Resolve a concrete light/dark value from the configured mode. Used to seed\n * the `data-mode` attribute synchronously (including during SSR, where\n * ModeController never runs). On the server `window` is undefined → defaults\n * to \"dark\" (matches the vanilla/React behavior).\n */\nfunction resolveInitialMode(mode: AppearanceMode): \"light\" | \"dark\" {\n if (mode !== \"auto\") return mode;\n if (typeof window === \"undefined\") return \"dark\";\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n}\n","<div\n #container\n class=\"magicx-aia magicx-aia-container\"\n [attr.data-pill-placement]=\"pillPlacement\"\n [attr.data-options-position]=\"optionsPosition\"\n [attr.data-animations]=\"animations ? 'on' : 'off'\"\n [attr.data-mode]=\"resolvedMode\"\n>\n <ai-autocomplete-dropdown\n *ngIf=\"controller\"\n [controller]=\"controller\"\n [showPills]=\"showDropdownPills\"\n [showSkipButton]=\"showSkipButton\"\n ></ai-autocomplete-dropdown>\n\n <div\n class=\"magicx-aia-input-wrapper\"\n (click)=\"onWrapperClick($event)\"\n (keyup)=\"$event.stopPropagation()\"\n >\n <div class=\"magicx-aia-editor-area\" data-aia-editor=\"\">\n <div\n #editor\n *ngIf=\"controller\"\n [aiaEditorHost]=\"controller\"\n [autoFocus]=\"autoFocus\"\n class=\"magicx-aia-input\"\n data-aia-input=\"\"\n ></div>\n\n <ng-container *ngIf=\"controller && showInlinePills\">\n <span\n #pillContainer\n class=\"magicx-aia-pill-list-container\"\n data-aia-pill-list-container=\"\"\n *ngIf=\"\n (controller.isLoading$ | async) ||\n ((controller.suggestionPills$ | async)?.length ?? 0) > 0\n \"\n >\n <aia-pill-list\n [pills]=\"(controller.suggestionPills$ | async) ?? []\"\n [activePillIndex]=\"0\"\n [activeSelected]=\"(controller.isActivePillSelected$ | async) ?? false\"\n [loading]=\"(controller.isLoading$ | async) ?? false\"\n (selectPill)=\"onSelectPill($event)\"\n ></aia-pill-list>\n </span>\n </ng-container>\n </div>\n\n <ng-container [ngSwitch]=\"submitButtonState\">\n <aia-submit-button\n *ngSwitchCase=\"'default'\"\n [disabled]=\"\n !(\n controller &&\n canSubmit({\n segments: (controller.segments$ | async) ?? [],\n completedParams: (controller.completedParams$ | async) ?? []\n })\n )\n \"\n (submit)=\"onSubmitButtonClick($event)\"\n ></aia-submit-button>\n\n <span\n *ngSwitchCase=\"'custom'\"\n data-aia-submit=\"\"\n class=\"magicx-aia-submit-slot\"\n (click)=\"onSubmitSlotClick($event)\"\n >\n <ng-container *ngTemplateOutlet=\"customSubmitTemplate\"></ng-container>\n </span>\n </ng-container>\n </div>\n</div>\n","import {\n Directive,\n ElementRef,\n forwardRef,\n Input,\n inject,\n type OnDestroy,\n type OnInit,\n Renderer2,\n} from \"@angular/core\";\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { Subject, takeUntil } from \"rxjs\";\nimport type { AIAutocompleteController } from \"../controller/ai-autocomplete.controller\";\n\n/**\n * Tier 2 input binder. Attach to a `<textarea>` or `<input>` and pass an\n * {@link AIAutocompleteController}:\n *\n * ```html\n * <textarea [aiaInput]=\"ac\"></textarea>\n * ```\n *\n * The directive wires the input's events (input/keydown/focus/blur) to the\n * controller, mirrors controller state into ARIA attributes\n * (`role=\"combobox\"`, `aria-expanded`, `aria-activedescendant`,\n * `aria-autocomplete`, `aria-controls`), and implements\n * {@link ControlValueAccessor} so the host element participates in Reactive\n * Forms out of the box:\n *\n * ```html\n * <textarea [aiaInput]=\"ac\" [formControl]=\"myControl\"></textarea>\n * ```\n *\n * Per the React hook's behavior, the first typed character is auto-capitalized\n * — typing \"h\" becomes \"H\" before being forwarded to the controller. The\n * cursor position is preserved across that rewrite.\n *\n * @public\n */\n@Directive({\n selector: \"[aiaInput]\",\n standalone: true,\n host: {\n role: \"combobox\",\n \"aria-autocomplete\": \"list\",\n \"(input)\": \"onInput($event)\",\n \"(keydown)\": \"onKeyDown($event)\",\n \"(keyup)\": \"onCaretMove()\",\n \"(mouseup)\": \"onCaretMove()\",\n \"(focus)\": \"onFocus()\",\n \"(blur)\": \"onBlur()\",\n },\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n useExisting: forwardRef(() => AIAutocompleteInputDirective),\n multi: true,\n },\n ],\n})\nexport class AIAutocompleteInputDirective implements OnInit, OnDestroy, ControlValueAccessor {\n /**\n * The {@link AIAutocompleteController} that owns the autocomplete state.\n * Required. The directive throws on init if this is missing.\n */\n @Input(\"aiaInput\") controller!: AIAutocompleteController;\n\n private readonly el = inject<ElementRef<HTMLInputElement | HTMLTextAreaElement>>(ElementRef);\n private readonly renderer = inject(Renderer2);\n private readonly destroy$ = new Subject<void>();\n\n private onChangeFn: (value: string) => void = noop;\n private onTouchedFn: () => void = noop;\n // Timestamp of the last `input` event. A `keyup`/`select` that fires within\n // this window is the tail of a keystroke, not a deliberate caret move, so we\n // skip the caret-move handler there (mirrors the editor host's selectionchange\n // guard). performance.now() is monotonic; 0 means \"no input yet\".\n private lastInputAt = 0;\n // Tracks the most-recently-promoted param so we only reposition the caret\n // once per option selection (mirrors the editor host's post-promote refocus).\n private lastSeenParamId = \"\";\n // Holds a value written by Reactive Forms before ngOnInit ran. Reactive\n // Forms can call writeValue() during dynamic form construction (e.g. when\n // a control is patched at the moment the directive is created), and our\n // controller binding may not be initialized yet. We stash the value here\n // and flush it into the controller in ngOnInit *before* subscribing to\n // text$, otherwise text$'s initial \"\" emission would clobber the form\n // value the textarea already shows. `undefined` means \"no pending write\".\n private pendingWriteValue: string | undefined;\n\n ngOnInit(): void {\n if (!this.controller) {\n throw new Error('[aiaInput] requires a controller — use `[aiaInput]=\"myController\"`.');\n }\n\n if (this.pendingWriteValue !== undefined) {\n this.controller.setValue(this.pendingWriteValue);\n this.pendingWriteValue = undefined;\n }\n\n const el = this.el.nativeElement;\n this.renderer.setAttribute(el, \"aria-controls\", this.controller.listboxId);\n\n // Sync editor text → DOM. Skips the write when values already match, so\n // user keystrokes don't fight with our writeback. Preserves the caret\n // position when we do write (and the element still has focus).\n this.controller.text$.pipe(takeUntil(this.destroy$)).subscribe((text) => {\n if (el.value === text) return;\n const wasFocused = typeof document !== \"undefined\" && document.activeElement === el;\n const start = el.selectionStart;\n const end = el.selectionEnd;\n this.renderer.setProperty(el, \"value\", text);\n if (wasFocused && start != null && end != null) {\n const clampedStart = Math.min(start, text.length);\n const clampedEnd = Math.min(end, text.length);\n try {\n el.setSelectionRange(clampedStart, clampedEnd);\n } catch {\n // `setSelectionRange` throws on some input types (e.g. \"number\");\n // safe to ignore — those inputs don't have a meaningful selection.\n }\n }\n });\n\n this.controller.isDropdownOpen$.pipe(takeUntil(this.destroy$)).subscribe((isOpen) => {\n this.renderer.setAttribute(el, \"aria-expanded\", String(isOpen));\n });\n\n this.controller.activeIndex$.pipe(takeUntil(this.destroy$)).subscribe((idx) => {\n if (idx >= 0) {\n this.renderer.setAttribute(\n el,\n \"aria-activedescendant\",\n `${this.controller.listboxId}-option-${idx}`,\n );\n } else {\n this.renderer.removeAttribute(el, \"aria-activedescendant\");\n }\n });\n\n // After an option selection promotes a param, the core appends its text and\n // stamps `caretOffset` at the end of the inserted text. The text$ subscriber\n // above writes the new value but *restores the pre-write caret* (correct for\n // typing echoes, wrong here), so we move the caret to the promoted position.\n // Keyed on newParamId so it fires once per selection, not on every tick.\n // Registered after text$ so the new value is in the DOM before we seek.\n this.controller.newParamId$.pipe(takeUntil(this.destroy$)).subscribe((id) => {\n const current = id ?? \"\";\n if (current && current !== this.lastSeenParamId) {\n this.lastSeenParamId = current;\n const offset = this.controller.getState().caretOffset ?? el.value.length;\n const clamped = Math.min(Math.max(offset, 0), el.value.length);\n // Only grab focus if we don't already have it — don't yank focus back\n // from wherever the user moved it after selecting (e.g. a host-app\n // button). setSelectionRange still positions the caret regardless.\n if (typeof document !== \"undefined\" && document.activeElement !== el) {\n el.focus();\n }\n try {\n el.setSelectionRange(clamped, clamped);\n } catch {\n // Some input types (e.g. \"number\") don't support setSelectionRange.\n }\n } else if (!current) {\n this.lastSeenParamId = \"\";\n }\n });\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n // === Event handlers (wired via host metadata above) ===\n\n /**\n * Auto-capitalizes the first character on the user's first keystroke so the\n * server receives \"Create\" instead of \"create\". Matches React's\n * `handleChange` in `useAIAutocomplete`. Skipped during IME composition so\n * we don't disrupt multi-keystroke input methods (Pinyin, Hangul, etc.).\n */\n onInput(event: Event): void {\n // Stamp the input time before anything else. The autocapitalize path below\n // calls setSelectionRange, which can synchronously fire a `select` event →\n // onCaretMove; stamping first ensures that event falls inside the guard\n // window and is treated as part of this keystroke, not a caret move.\n this.lastInputAt = performance.now();\n const target = event.target as HTMLInputElement | HTMLTextAreaElement;\n const raw = target.value;\n const isComposing = (event as InputEvent).isComposing === true;\n const shouldCapitalize = raw.length > 0 && !isComposing && raw[0] !== raw[0].toUpperCase();\n\n let next = raw;\n if (shouldCapitalize) {\n const start = target.selectionStart;\n const end = target.selectionEnd;\n next = raw[0].toUpperCase() + raw.slice(1);\n this.renderer.setProperty(target, \"value\", next);\n if (start != null && end != null) {\n try {\n target.setSelectionRange(start, end);\n } catch {\n // See note in ngOnInit's text$ subscriber.\n }\n }\n }\n\n this.controller.handleTextChange(next);\n // Sync the real caret into the core. The dropdown's auto-trigger gate only\n // opens when the caret is at the end of the text; without this, the core's\n // `caretOffset` stays pinned at whatever a prior promote/select set it to\n // and goes stale as the user keeps typing, wedging the dropdown closed.\n // selectionStart is null on some input types (number/email/color); treat\n // that as \"caret at end\" rather than feeding null into the core.\n this.controller.handleCaretAfterInput(target.selectionStart ?? target.value.length);\n this.onChangeFn(next);\n }\n\n onKeyDown(event: KeyboardEvent): void {\n this.controller.handleKeyDown(event);\n }\n\n /**\n * Caret moved by something other than typing — arrow keys, Home/End, or a\n * mouse click/drag (keyup + mouseup). Forward the new offset so the core can\n * re-evaluate the caret-at-end dropdown gate (and exit re-edit if the caret\n * left the region). We deliberately do NOT listen for the `select` event:\n * programmatic `setSelectionRange` calls (the text$ writeback, the post-select\n * caret reposition) fire it in jsdom/some browsers, which would re-enter here\n * and clobber `caretOffset`. `keyup`/`mouseup` only fire for real user input.\n * Skipped right after an `input` event, where the caret is already handled by\n * `handleCaretAfterInput` above.\n */\n onCaretMove(): void {\n if (performance.now() - this.lastInputAt < 50) return;\n const el = this.el.nativeElement;\n // selectionStart is null on some input types — treat as caret at end.\n this.controller.handleCaretMove(el.selectionStart ?? el.value.length);\n }\n\n onFocus(): void {\n this.controller.setFocused(true);\n }\n\n onBlur(): void {\n this.controller.setFocused(false);\n this.onTouchedFn();\n }\n\n // === ControlValueAccessor ===\n\n writeValue(value: string | null): void {\n const next = value ?? \"\";\n this.renderer.setProperty(this.el.nativeElement, \"value\", next);\n // If Angular calls writeValue() before ngOnInit (possible during dynamic\n // form construction), queue the value and let ngOnInit flush it. We\n // can't push it into the controller now because either the controller\n // binding hasn't resolved yet, or text$'s initial subscription would\n // overwrite it moments later.\n if (this.controller) {\n this.controller.setValue(next);\n } else {\n this.pendingWriteValue = next;\n }\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChangeFn = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouchedFn = fn;\n }\n\n setDisabledState(disabled: boolean): void {\n this.renderer.setProperty(this.el.nativeElement, \"disabled\", disabled);\n }\n}\n\nfunction noop(): void {\n // Default no-op callback for CVA — overwritten by Angular's form bridge.\n}\n","import { NgModule } from \"@angular/core\";\nimport { AIAutocompleteComponent } from \"./ai-autocomplete/ai-autocomplete.component\";\nimport { AIAutocompleteDropdownComponent } from \"./ai-autocomplete-dropdown/ai-autocomplete-dropdown.component\";\nimport { AIAutocompleteInputDirective } from \"./input/ai-autocomplete-input.directive\";\n\n/**\n * Convenience NgModule that re-exports every public component and directive\n * in this package. Standalone-first consumers can import the individual\n * symbols directly; legacy NgModule-based codebases import this once and\n * get everything.\n *\n * @public\n */\n@NgModule({\n imports: [AIAutocompleteComponent, AIAutocompleteDropdownComponent, AIAutocompleteInputDirective],\n exports: [AIAutocompleteComponent, AIAutocompleteDropdownComponent, AIAutocompleteInputDirective],\n})\nexport class AIAutocompleteModule {}\n","/**\n * Public API surface for @magicx-eng/ai-autocomplete-angular.\n *\n * Populated incrementally as features land — see TDB.md §6.6 for the full\n * planned export list. Only symbols re-exported here are considered part of\n * the package's public contract (TDB §19.2).\n */\n\n// === Re-exported wire types ===\nexport type {\n AccessTokenConfig,\n AccessTokenResult,\n APIConfig,\n APIKeyConfig,\n AppearanceMode,\n AutocompleteResult,\n CompletedParam,\n CompletedParamState,\n OptionOverrides,\n Product,\n ProductsConfig,\n Segment,\n SkippedParamState,\n Suggestion,\n SuggestionOption,\n TaskKind,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\n// === Submit-result builder (folds skipped params into completed_params) ===\nexport { buildSubmitResult, withSkippedParams } from \"@magicx-eng/ai-autocomplete-vanilla\";\n// === Tier 1: Full component ===\nexport { AIAutocompleteComponent } from \"./lib/ai-autocomplete\";\n// === Convenience NgModule ===\nexport { AIAutocompleteModule } from \"./lib/ai-autocomplete.module\";\n// === Tier 2: Dropdown component ===\nexport { AIAutocompleteDropdownComponent } from \"./lib/ai-autocomplete-dropdown\";\n// === Tier 2: Controller (headless logic class) ===\nexport { AIAutocompleteController } from \"./lib/controller\";\n// === Tier 2: Input binder + ControlValueAccessor ===\nexport { AIAutocompleteInputDirective } from \"./lib/input\";\n// === Angular-specific public types ===\nexport type {\n AIAutocompleteControllerOptions,\n AIAutocompleteControllerState,\n AIAutocompleteControllerUpdate,\n AIAutocompleteDropdownState,\n} from \"./lib/shared/types\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["map","CoreAIAutocomplete","noop"],"mappings":";;;;;;;;;;AAEA;;;;;;AAMG;MAiBU,gBAAgB,CAAA;AAhB7B,IAAA,WAAA,GAAA;;AAoBW,QAAA,IAAK,CAAA,KAAA,GAA4C,QAAQ,CAAC;;AAE1D,QAAA,IAAO,CAAA,OAAA,GAAsD,OAAO,CAAC;;AAErE,QAAA,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;;AAEf,QAAA,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC;KACzB;;8GAXY,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAhB,gBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,gBAAgB,kZAXjB,2BAA2B,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,kqBAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA,CAAA;4FAW1B,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAhB5B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,aAAa,EACX,UAAA,EAAA,IAAI,EACC,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAChC,aAAA,EAAA,iBAAiB,CAAC,IAAI,EAC3B,QAAA,EA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wBAAA,QAAQ,EAAE,UAAU;AACrB,qBAAA;AACD,oBAAA,SAAS,EAAE;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;;AAE1B,4BAAA,WAAW,EAAE,UAAU,CAAC,kCAAkC,CAAC;AAC3D,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA;iBACF,CAAA;8BAMoB,UAAU,EAAA,CAAA;sBAA5B,KAAK;uBAAC,UAAU,CAAA;;AAuNnB,SAAS,IAAI,GAAA;;AAEb;;ACtRA;;;;;;;AAOG;MAKU,oBAAoB,CAAA;;kHAApB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;mHAApB,oBAAoB,EAAA,OAAA,EAAA,CAHrB,uBAAuB,EAAE,+BAA+B,EAAE,4BAA4B,CAAA,EAAA,OAAA,EAAA,CACtF,uBAAuB,EAAE,+BAA+B,EAAE,4BAA4B,CAAA,EAAA,CAAA,CAAA;mHAErF,oBAAoB,EAAA,OAAA,EAAA,CAHrB,uBAAuB,EAAE,+BAA+B,CAAA,EAAA,CAAA,CAAA;4FAGvD,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,uBAAuB,EAAE,+BAA+B,EAAE,4BAA4B,CAAC;AACjG,oBAAA,OAAO,EAAE,CAAC,uBAAuB,EAAE,+BAA+B,EAAE,4BAA4B,CAAC;iBAClG,CAAA;;;AChBD;;;;;;AAMG;AAqBH;;AC3BA;;AAEG;;;;"}
1
+ {"version":3,"file":"magicx-eng-ai-autocomplete-angular.mjs","sources":["../../src/lib/internal/layout/cluster.component.ts","../../src/lib/internal/layout/stack.component.ts","../../src/lib/internal/pill-list/pill-list.component.ts","../../src/lib/internal/pill-list/pill-list.component.html","../../src/lib/internal/product-strip/product-strip.component.ts","../../src/lib/internal/product-strip/product-strip.component.html","../../src/lib/internal/layout/grid.component.ts","../../src/lib/internal/layout/grid.component.html","../../src/lib/internal/suggestion-item/suggestion-item.component.ts","../../src/lib/internal/suggestion-item/suggestion-item.component.html","../../src/lib/internal/suggestion-grid/suggestion-grid.component.ts","../../src/lib/internal/suggestion-grid/suggestion-grid.component.html","../../src/lib/ai-autocomplete-dropdown/ai-autocomplete-dropdown.component.ts","../../src/lib/ai-autocomplete-dropdown/ai-autocomplete-dropdown.component.html","../../src/lib/controller/observables.ts","../../src/lib/controller/ai-autocomplete.controller.ts","../../src/lib/internal/editor-host/editor-host.directive.ts","../../src/lib/internal/submit-button/submit-button.component.ts","../../src/lib/internal/submit-button/submit-button.component.html","../../src/lib/ai-autocomplete/ai-autocomplete.component.ts","../../src/lib/ai-autocomplete/ai-autocomplete.component.html","../../src/lib/input/ai-autocomplete-input.directive.ts","../../src/lib/ai-autocomplete.module.ts","../../src/public-api.ts","../../src/magicx-eng-ai-autocomplete-angular.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from \"@angular/core\";\n\n/**\n * Horizontal layout primitive — children sit in a row and wrap when out of\n * room. Mirrors the React `<Cluster>` component / vanilla `.aia-cluster` CSS\n * primitive. `noWrap` keeps a single row; `inline` makes it inline-level.\n *\n * @internal\n */\n@Component({\n selector: \"aia-cluster\",\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n template: \"<ng-content></ng-content>\",\n styleUrls: [\"./cluster.component.css\"],\n host: {\n class: \"aia-cluster\",\n \"[attr.data-align]\": \"align\",\n \"[attr.data-justify]\": \"justify\",\n \"[attr.data-nowrap]\": \"noWrap ? '' : null\",\n \"[attr.data-inline]\": \"inline ? '' : null\",\n \"[style.--aia-cluster-gap]\": \"gap\",\n },\n})\nexport class ClusterComponent {\n /** Gap between children. Any CSS length. Defaults to the CSS fallback (0.5rem). */\n @Input() gap?: string;\n /** Cross-axis alignment. Defaults to `center`. */\n @Input() align: \"start\" | \"center\" | \"end\" | \"baseline\" = \"center\";\n /** Main-axis distribution. Defaults to `start`. */\n @Input() justify: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" = \"start\";\n /** When true, the cluster does NOT flex-wrap (single-row clusters). */\n @Input() noWrap = false;\n /** Render inline-level (inline-flex) instead of block. */\n @Input() inline = false;\n}\n","import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from \"@angular/core\";\n\n/**\n * Vertical layout primitive — children stack top-to-bottom with `space` gap.\n * Mirrors the React `<Stack>` component / vanilla `.aia-stack` CSS primitive.\n *\n * @internal\n */\n@Component({\n selector: \"aia-stack\",\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n template: \"<ng-content></ng-content>\",\n styleUrls: [\"./stack.component.css\"],\n host: {\n class: \"aia-stack\",\n \"[attr.data-align]\": \"align\",\n \"[style.--aia-stack-space]\": \"space\",\n },\n})\nexport class StackComponent {\n /** Gap between children. Any CSS length. Defaults to the CSS fallback (0.5rem). */\n @Input() space?: string;\n /** Cross-axis alignment of children. Defaults to `stretch` (full width). */\n @Input() align: \"start\" | \"center\" | \"end\" | \"stretch\" = \"stretch\";\n}\n","import { CommonModule } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n Output,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport type { Suggestion } from \"@magicx-eng/ai-autocomplete-vanilla\";\n\n/**\n * Internal pill list used by both the dropdown and Tier 1's inline pillbar.\n * Mirrors `packages/react/src/components/PillList.tsx` one-for-one — including\n * the per-index opacity ramp (1 / 0.7 / 0.4 / 0.2) and the skeleton-loading\n * fallback that preserves layout while the next fetch is in flight.\n *\n * @internal\n */\n@Component({\n selector: \"aia-pill-list\",\n standalone: true,\n imports: [CommonModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./pill-list.component.html\",\n styleUrls: [\"./pill-list.component.css\"],\n})\nexport class PillListComponent {\n @Input() pills: Suggestion[] = [];\n @Input() activePillIndex = 0;\n @Input() rounded = false;\n /**\n * When true, pills become non-interactive shimmering skeletons. Real pills\n * (with their text) are rendered when provided so widths/positions match\n * the previous state; with no pills, fixed-width fallback placeholders are\n * rendered instead.\n */\n @Input() loading = false;\n /**\n * Whether the active (leading) pill should render selected (full opacity)\n * rather than its positional `first` tier. Auto trigger ⇒ true while a\n * dropdown option is highlighted; manual trigger ⇒ true after the user taps\n * the pill. See `AIAutocompleteController.isActivePillSelected$`.\n */\n @Input() activeSelected = false;\n\n @Output() readonly selectPill = new EventEmitter<number>();\n\n /** Fallback widths when loading with zero cached pills (matches React). */\n readonly fallbackSkeletonWidths = [125, 69];\n\n /** The active pill is \"selected\" only when `activeSelected` is set. */\n isSelected(index: number): boolean {\n return this.activeSelected && index === this.activePillIndex;\n }\n\n /**\n * Opacity per pill state — mirrors PillList.tsx `PILL_OPACITY`. The selected\n * pill is full opacity; otherwise pills take a positional tier (first / next\n * / last).\n */\n pillOpacity(index: number): number {\n if (this.isSelected(index)) return 1; // Selected\n if (index === 0) return 0.7; // First\n if (index === 1) return 0.4; // Next\n return 0.2; // Last\n }\n\n trackByType = (_: number, pill: Suggestion): string => pill.type;\n trackByWidth = (_: number, w: number): number => w;\n\n onPillClick(index: number): void {\n if (this.loading) return;\n this.selectPill.emit(index);\n }\n\n onPillMouseDown(event: Event): void {\n // Prevent the editor from losing focus when a pill is tapped.\n event.preventDefault();\n }\n}\n","<ng-container *ngIf=\"loading && pills.length === 0; else realPills\">\n <span class=\"aia-pill-list\" data-aia-pill-list-loading=\"\">\n <span\n *ngFor=\"let w of fallbackSkeletonWidths; trackBy: trackByWidth; let i = index\"\n data-aia-pill-skeleton=\"\"\n class=\"aia-pill aia-pill-skeleton\"\n [class.aia-pill-rounded]=\"rounded\"\n [style.width.px]=\"w\"\n [style.opacity]=\"pillOpacity(i)\"\n ></span>\n </span>\n</ng-container>\n\n<ng-template #realPills>\n <span\n class=\"aia-pill-list\"\n [attr.data-aia-pill-list-loading]=\"loading ? '' : null\"\n >\n <button\n *ngFor=\"let pill of pills; trackBy: trackByType; let i = index\"\n type=\"button\"\n data-aia-pill=\"\"\n [attr.data-aia-loading]=\"loading ? '' : null\"\n tabindex=\"-1\"\n class=\"aia-pill\"\n [class.aia-pill-rounded]=\"rounded\"\n [class.aia-pill-skeleton]=\"loading\"\n [style.opacity]=\"pillOpacity(i)\"\n [disabled]=\"loading\"\n (mousedown)=\"onPillMouseDown($event)\"\n (click)=\"onPillClick(i)\"\n >\n {{ pill.text }}\n </button>\n </span>\n</ng-template>\n","import { CommonModule } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n Output,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport type { Product } from \"@magicx-eng/ai-autocomplete-vanilla\";\n\n/**\n * Internal product strip rendered below the dropdown's options grid. Mirrors\n * `packages/react/src/components/ProductStrip.tsx` and the vanilla core's\n * `renderProductStrip`, so all three packages emit the same structure and\n * theme identically.\n *\n * Two layout notes carried over from the vanilla implementation:\n *\n * - The dropdown paints a background but never sets `color`, so anything here\n * relying on `color: inherit` would pick up the *host page's* text colour —\n * black text on a dark panel. Every text node resolves its colour through\n * the same `--aia-option-*` chain the options use.\n * - The options grid carries a negative bottom margin so the footer rides up\n * over its reserved band, and whatever follows the grid inherits that pull.\n * The dropdown root is marked `data-aia-has-products` and the appearance\n * layer zeroes the band at its source rather than the strip cancelling it\n * from here.\n *\n * @internal\n */\n@Component({\n selector: \"aia-product-strip\",\n standalone: true,\n imports: [CommonModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./product-strip.component.html\",\n styleUrls: [\"./product-strip.component.css\"],\n})\nexport class ProductStripComponent {\n @Input() products: Product[] = [];\n /** Scopes the section label's id to the owning listbox. */\n @Input() listboxId = \"\";\n /**\n * False while the panel is fading out. The closed dropdown keeps rendering\n * its last content for the fade, and focusable cards inside it would still\n * answer Tab.\n */\n @Input() focusable = true;\n\n @Output() readonly select = new EventEmitter<Product>();\n /**\n * Focus moved into / out of the strip. The panel closes on blur by default\n * and the editor blurs the moment a card takes focus, so the dropdown\n * reports focus as still-inside rather than shutting out from under the card\n * the user just tabbed to.\n */\n @Output() readonly focusChange = new EventEmitter<boolean>();\n\n get labelId(): string {\n return `${this.listboxId}-products-label`;\n }\n\n cardId(index: number): string {\n return `${this.listboxId}-product-${index}`;\n }\n\n /**\n * Identity *and* content: a same-id result whose fields changed must\n * re-render rather than reuse the previous card's bindings.\n */\n trackByProduct = (_: number, product: Product): string =>\n [\n product.id,\n product.title,\n product.url,\n product.imageUrl ?? \"\",\n product.price ?? \"\",\n product.vendor ?? \"\",\n ].join(\"\u0000\");\n\n onClick(event: MouseEvent, product: Product): void {\n // Let the browser keep the clicks that mean \"open this somewhere else\" —\n // intercepting them would defeat the point of rendering an <a>. Those are\n // navigations the user asked for explicitly, so they don't emit.\n if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0) {\n return;\n }\n event.preventDefault();\n this.select.emit(product);\n }\n\n onKeyDown(event: KeyboardEvent, product: Product): void {\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n this.select.emit(product);\n }\n\n onCardFocus(): void {\n this.focusChange.emit(true);\n }\n\n onCardBlur(event: FocusEvent): void {\n const next = event.relatedTarget as HTMLElement | null;\n if (next?.closest(\"[data-aia-dropdown]\")) return;\n this.focusChange.emit(false);\n }\n}\n","<!-- `group` is the one role a listbox accepts around a set of options, so the\n strip stays inside the listbox without breaking its content model. -->\n<section\n *ngIf=\"products.length > 0\"\n class=\"aia-products\"\n data-aia-products=\"\"\n role=\"group\"\n [attr.aria-labelledby]=\"labelId\"\n>\n <div class=\"aia-products-label\" [id]=\"labelId\">Products</div>\n\n <div class=\"aia-products-row\" data-aia-products-row=\"\">\n <!-- A real <a href> rather than a <div>: it keeps the browser's own link\n affordances — cmd/ctrl-click for a new tab, middle-click, right-click →\n \"copy link address\". role=\"option\" overrides how assistive tech\n announces it, which is correct inside a listbox; the deliberate trade\n is that AT no longer calls it a link. -->\n <a\n *ngFor=\"let product of products; let i = index; trackBy: trackByProduct\"\n [id]=\"cardId(i)\"\n class=\"aia-product\"\n data-aia-product=\"\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n [href]=\"product.url\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (click)=\"onClick($event, product)\"\n (keydown)=\"onKeyDown($event, product)\"\n (focus)=\"onCardFocus()\"\n (blur)=\"onCardBlur($event)\"\n >\n <!-- Catalogues without images are common enough that the placeholder is\n a first-class state, not an error state. -->\n <span\n class=\"aia-product-media\"\n [attr.data-aia-product-placeholder]=\"product.imageUrl ? null : ''\"\n >\n <!-- alt=\"\" on purpose: the title is already the card's accessible\n name, and repeating it would have a screen reader read it twice. -->\n <img\n *ngIf=\"product.imageUrl\"\n class=\"aia-product-image\"\n [src]=\"product.imageUrl\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n </span>\n\n <!-- Every field but the title is optional, so absent ones render no\n element at all — the column gap can't leave a hole for a box that\n isn't there. -->\n <span class=\"aia-product-body\">\n <span *ngIf=\"product.vendor\" class=\"aia-product-vendor\">{{ product.vendor }}</span>\n <span class=\"aia-product-title\">{{ product.title }}</span>\n <span *ngIf=\"product.price\" class=\"aia-product-price\">{{ product.price }}</span>\n </span>\n </a>\n </div>\n</section>\n","import {\n ChangeDetectionStrategy,\n Component,\n type ElementRef,\n Input,\n type OnChanges,\n type SimpleChanges,\n ViewChild,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport { optionsGridTemplateColumns } from \"@magicx-eng/ai-autocomplete-vanilla\";\n\n/**\n * Intrinsic grid layout primitive — auto-fits as many columns as fit between\n * `min` and `max` wide, wrapping to new rows when there's no more horizontal\n * room. Mirrors the React `<Grid>` component / vanilla `.aia-grid` primitive.\n *\n * Optionally scrolls (`scroll`, capped height).\n *\n * @internal\n */\n@Component({\n selector: \"aia-grid\",\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./grid.component.html\",\n styleUrls: [\"./grid.component.css\"],\n})\nexport class GridComponent implements OnChanges {\n /** Minimum cell width. CSS length, e.g. \"16rem\". Columns auto-fit at runtime. */\n @Input() min = \"16rem\";\n /** Maximum cell width. CSS length. Defaults (via CSS) to `1fr` (stretch). */\n @Input() max?: string;\n /** Gap between cells. */\n @Input() gap?: string;\n /** Cap the height and scroll vertically when content overflows. */\n @Input() scroll = false;\n /** Max height when `scroll`. CSS length. Defaults (via CSS) to 120px. */\n @Input() maxHeight?: string;\n /** Scroll back to the top whenever this key changes (`scroll` only). */\n @Input() scrollResetKey?: string;\n /** Fixed column count. Overrides the intrinsic auto-fit when set; rows fill left-to-right. */\n @Input() cols?: number;\n\n /**\n * Explicit column template overrides the intrinsic auto-fit (inline wins).\n * The track string is built by the core so all three packages emit the same\n * one.\n */\n get templateColumns(): string | null {\n return this.cols ? optionsGridTemplateColumns(this.cols) : null;\n }\n\n @ViewChild(\"grid\", { static: false }) gridRef?: ElementRef<HTMLDivElement>;\n\n /**\n * A new `scrollResetKey` means a different content group is being shown (e.g.\n * the next suggestion's options after a selection) — start it from the top\n * instead of inheriting the previous group's scroll offset.\n */\n ngOnChanges(changes: SimpleChanges): void {\n const change = changes[\"scrollResetKey\"];\n if (!change || change.isFirstChange()) return;\n const grid = this.gridRef?.nativeElement;\n if (grid) grid.scrollTop = 0;\n }\n}\n","<div\n #grid\n class=\"aia-grid\"\n [attr.data-scroll]=\"scroll ? '' : null\"\n [style.--aia-grid-min]=\"min\"\n [style.--aia-grid-max]=\"max\"\n [style.--aia-grid-gap]=\"gap\"\n [style.--aia-grid-max-height]=\"maxHeight\"\n [style.grid-template-columns]=\"templateColumns\"\n>\n <ng-content></ng-content>\n</div>\n","import { CommonModule } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n inject,\n type OnDestroy,\n Output,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport type { SuggestionOption } from \"@magicx-eng/ai-autocomplete-vanilla\";\n\n/**\n * Internal single-option cell used inside the suggestion grid. Mirrors\n * `packages/react/src/components/SuggestionItem.tsx`. Handles:\n *\n * - Tappable vs non-tappable cursor + hover styling\n * - Pressed-state streak animation (500ms, single-flight)\n * - Keyboard activation (Enter/Space)\n * - ARIA `role=\"option\"` + `aria-selected` for the listbox pattern\n * - Loading skeleton when `loading=true`\n *\n * @internal\n */\n@Component({\n selector: \"aia-suggestion-item\",\n standalone: true,\n imports: [CommonModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./suggestion-item.component.html\",\n styleUrls: [\"./suggestion-item.component.css\"],\n})\nexport class SuggestionItemComponent implements OnDestroy {\n @Input() option!: SuggestionOption;\n @Input() isHighlighted = false;\n @Input() id = \"\";\n @Input() loading = false;\n\n @Output() readonly select = new EventEmitter<SuggestionOption>();\n @Output() readonly highlight = new EventEmitter<void>();\n\n pressed = false;\n\n private readonly cdr = inject(ChangeDetectorRef);\n private pressedTimer: ReturnType<typeof setTimeout> | undefined;\n\n ngOnDestroy(): void {\n if (this.pressedTimer !== undefined) clearTimeout(this.pressedTimer);\n }\n\n onSelect(): void {\n if (this.loading || !this.option.is_tappable || this.pressed) return;\n this.pressed = true;\n this.cdr.markForCheck();\n this.select.emit(this.option);\n if (this.pressedTimer !== undefined) clearTimeout(this.pressedTimer);\n this.pressedTimer = setTimeout(() => {\n this.pressed = false;\n this.cdr.markForCheck();\n }, 500);\n }\n\n onMouseEnter(): void {\n if (this.loading || !this.option.is_tappable) return;\n this.highlight.emit();\n }\n\n onKeyDown(event: KeyboardEvent): void {\n if (this.loading || !this.option.is_tappable) return;\n if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n this.onSelect();\n }\n }\n}\n","<div\n [id]=\"id\"\n role=\"option\"\n data-aia-option=\"\"\n [attr.data-aia-loading]=\"loading ? '' : null\"\n [attr.aria-selected]=\"isHighlighted\"\n class=\"aia-suggestion-item\"\n [class.aia-suggestion-item-highlighted]=\"isHighlighted && !loading\"\n [class.aia-suggestion-item-tappable]=\"option.is_tappable\"\n [class.aia-suggestion-item-non-tappable]=\"!option.is_tappable\"\n [class.aia-suggestion-item-pressed]=\"pressed\"\n [attr.tabindex]=\"loading || !option.is_tappable ? -1 : 0\"\n (click)=\"onSelect()\"\n (keydown)=\"onKeyDown($event)\"\n (mouseenter)=\"onMouseEnter()\"\n>\n <div class=\"aia-suggestion-streaks\"></div>\n <div class=\"aia-suggestion-streaks-vert\"></div>\n <span class=\"aia-suggestion-content\">\n <span class=\"aia-suggestion-text\">\n <ng-container *ngIf=\"option.icon; else noIcon\"\n >{{ option.icon }} {{ option.text }}</ng-container\n >\n <ng-template #noIcon>{{ option.text }}</ng-template>\n </span>\n <span *ngIf=\"option.tag\" class=\"aia-suggestion-tag\">{{ option.tag }}</span>\n </span>\n</div>\n","import { CommonModule } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n HostListener,\n Input,\n inject,\n Output,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport {\n computeOptionsGridLayout,\n isOptionsGridMobileViewport,\n type SuggestionOption,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\nimport { GridComponent } from \"../layout/grid.component\";\nimport { SuggestionItemComponent } from \"../suggestion-item/suggestion-item.component\";\n\n/**\n * Internal grid of suggestion options. Mirrors\n * `packages/react/src/components/SuggestionGrid.tsx` — a thin wrapper over the\n * `Grid` layout primitive (which owns the auto-fit columns and the\n * capped-height scroll). It only wires each option to its\n * select/highlight handlers and listbox-scoped id.\n *\n * @internal\n */\n@Component({\n selector: \"aia-suggestion-grid\",\n standalone: true,\n imports: [CommonModule, GridComponent, SuggestionItemComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./suggestion-grid.component.html\",\n})\nexport class SuggestionGridComponent {\n @Input() options: SuggestionOption[] = [];\n @Input() activeIndex = -1;\n @Input() listboxId = \"\";\n @Input() loading = false;\n /**\n * Identity of the suggestion these options belong to. When it changes the\n * grid scrolls back to the top, so the next parameter's options are read\n * from the first one instead of from the previous list's scroll offset.\n */\n @Input() groupKey = \"\";\n\n @Output() readonly select = new EventEmitter<SuggestionOption>();\n @Output() readonly highlight = new EventEmitter<number>();\n\n private readonly cdr = inject(ChangeDetectorRef);\n\n // Recompute the responsive layout when the viewport crosses the mobile\n // breakpoint (OnPush getters only re-run when change detection is triggered).\n @HostListener(\"window:resize\")\n onResize(): void {\n this.cdr.markForCheck();\n }\n\n /**\n * Rows/columns policy — owned by the core so vanilla, React and Angular all\n * lay the options grid out identically. See `computeOptionsGridLayout`.\n */\n private get layout() {\n return computeOptionsGridLayout(this.options.length, isOptionsGridMobileViewport());\n }\n\n get gridCols(): number {\n return this.layout.cols;\n }\n get gridMaxHeight(): string {\n return this.layout.maxHeight;\n }\n\n trackByOptionText = (_: number, opt: SuggestionOption): string => opt.text;\n}\n","<!-- max=\"1fr\": columns share out the full width, so a lone column spans the\n whole options box instead of stopping at 250px. -->\n<aia-grid\n min=\"250px\"\n max=\"1fr\"\n gap=\"0\"\n [scroll]=\"true\"\n [scrollResetKey]=\"groupKey\"\n [cols]=\"gridCols\"\n [maxHeight]=\"gridMaxHeight\"\n>\n <aia-suggestion-item\n *ngFor=\"let option of options; trackBy: trackByOptionText; let i = index\"\n [option]=\"option\"\n [isHighlighted]=\"i === activeIndex\"\n [id]=\"listboxId + '-option-' + i\"\n [loading]=\"loading\"\n (select)=\"select.emit($event)\"\n (highlight)=\"highlight.emit(i)\"\n ></aia-suggestion-item>\n</aia-grid>\n","import { CommonModule } from \"@angular/common\";\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n Input,\n inject,\n type OnChanges,\n type OnDestroy,\n type OnInit,\n type SimpleChanges,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport {\n type AppearanceMode,\n buildAttributionUrl,\n getFooterHint,\n type Product,\n type Suggestion,\n type SuggestionOption,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\nimport { BehaviorSubject, combineLatest, type Observable } from \"rxjs\";\nimport { map } from \"rxjs/operators\";\nimport type { AIAutocompleteController } from \"../controller/ai-autocomplete.controller\";\nimport { ClusterComponent } from \"../internal/layout/cluster.component\";\nimport { StackComponent } from \"../internal/layout/stack.component\";\nimport { PillListComponent } from \"../internal/pill-list/pill-list.component\";\nimport { ProductStripComponent } from \"../internal/product-strip/product-strip.component\";\nimport { SuggestionGridComponent } from \"../internal/suggestion-grid/suggestion-grid.component\";\n\ninterface DropdownVm {\n pills: Suggestion[];\n options: SuggestionOption[];\n activeIndex: number;\n isActivePillSelected: boolean;\n isLoading: boolean;\n showsPills: boolean;\n /** Whether the pillbar ends in the trailing \"skip\" button. */\n showsSkip: boolean;\n /**\n * Disabled state for the skip button: loading, or the post-selection window\n * where isLoading is suppressed but the core's skipActivePill() no-ops.\n */\n skipDisabled: boolean;\n /** Active pill's label, for the skip button's aria-label. */\n activePillLabel: string;\n showsOptions: boolean;\n showsFallbackSkeleton: boolean;\n isVisible: boolean;\n /** Product cards for the strip. Empty unless `products` is configured. */\n products: Product[];\n /** Identity of the suggestion the options belong to — drives the grid's scroll reset. */\n groupKey: string;\n footerKey: string;\n footerHint: string;\n optionsPosition: \"above\" | \"below\";\n}\n\n/** The content-bearing fields of the view-model (everything but `isVisible`). */\ntype DropdownContent = Omit<DropdownVm, \"isVisible\">;\n\n/**\n * Tier 2 dropdown component — the Angular equivalent of React's\n * `<AIAutocompleteDropdown />`. Renders the pillbar, options grid, and\n * loading skeleton based on the supplied controller's `dropdown$` snapshot.\n *\n * ```html\n * <ai-autocomplete-dropdown [controller]=\"ac\"></ai-autocomplete-dropdown>\n * ```\n *\n * All actions (pill click, option select, option highlight) are forwarded to\n * the controller. Consumers who need to observe these events can subscribe\n * to the controller's per-field observables.\n *\n * @public\n */\n@Component({\n selector: \"ai-autocomplete-dropdown\",\n standalone: true,\n imports: [\n CommonModule,\n PillListComponent,\n ProductStripComponent,\n SuggestionGridComponent,\n StackComponent,\n ClusterComponent,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./ai-autocomplete-dropdown.component.html\",\n // The shared appearance layer carries the design tokens + box-sizing reset +\n // optionsPosition reversal, so a standalone dropdown (no Tier 1 component on\n // the page) is fully styled once `mode` is set.\n styleUrls: [\"../shared/appearance.css\", \"./ai-autocomplete-dropdown.component.css\"],\n})\nexport class AIAutocompleteDropdownComponent implements OnInit, OnChanges, OnDestroy {\n /** The controller that owns the autocomplete state. Required. */\n @Input() controller!: AIAutocompleteController;\n /** Whether to render the pillbar above the options grid. Default: true. */\n @Input() showPills = true;\n /**\n * Whether the pillbar ends in a small \"skip\" button that dismisses the\n * active pill — same action as pressing → at the end of the input. It sits\n * at the trailing edge of the bar: visually top-right when the dropdown\n * opens below the input, bottom-right when `optionsPosition` is \"above\".\n * Default: true. Hidden automatically during re-edit and while the fallback\n * skeleton renders.\n */\n @Input() showSkipButton = true;\n /** Optional CSS class applied to the dropdown root. */\n @Input() className?: string;\n /**\n * Color mode for a standalone dropdown. When set, the dropdown self-scopes the\n * design tokens to its own root (adds `magicx-aia` + `data-mode`), so it needs\n * no `.magicx-aia` wrapper. `\"auto\"` follows `prefers-color-scheme`. Leave it\n * unset when the dropdown sits inside a `.magicx-aia` ancestor (e.g. Tier 1).\n */\n @Input() mode?: AppearanceMode;\n\n /** Concrete resolved mode, or null when `mode` is unset (inherit from ancestor). */\n resolvedMode: \"light\" | \"dark\" | null = null;\n private modeMql?: MediaQueryList;\n private modeListener?: () => void;\n private readonly cdr = inject(ChangeDetectorRef);\n\n /** Root class list — adds `magicx-aia` only when self-scoping via `mode`. */\n get rootClass(): string {\n let cls = \"magicx-aia-dropdown\";\n if (this.resolvedMode) cls += \" magicx-aia\";\n if (this.className) cls += ` ${this.className}`;\n return cls;\n }\n\n /** Fallback skeleton-bar widths used when loading with zero cached options. */\n readonly fallbackSkeletonBarWidths = [159, 119, 164];\n\n /**\n * Attribution/branding link URL for the footer, with a `utm_source` derived\n * from the embedding page's hostname (see {@link buildAttributionUrl}).\n */\n readonly brandHref = buildAttributionUrl();\n\n /**\n * View-model derived from the controller's `dropdown$`. Adds three booleans\n * (`showsPills`, `showsOptions`, `showsFallbackSkeleton`, `isVisible`) that\n * keep template-level logic to a property read per §19.6.\n *\n * Initialized once in `ngOnInit` — must NOT be a getter. A getter returns a\n * fresh `Observable` instance on every property read; with OnPush + `async`\n * pipe that means each change-detection cycle unsubscribes/resubscribes,\n * causing the `*ngIf=\"vm$ | async as vm\"` root to briefly resolve `null`\n * and flicker the entire dropdown DOM.\n */\n vm$!: Observable<DropdownVm>;\n\n // Bridge for the @Input `showPills` into the reactive pipeline. Without this,\n // changing the input after init wouldn't trigger a new vm emission until the\n // next controller.dropdown$ tick — and we'd lose the showPills update entirely\n // if the controller is idle. Updated from ngOnChanges below.\n private readonly showPills$ = new BehaviorSubject<boolean>(true);\n // Same bridge, for `showSkipButton`.\n private readonly showSkipButton$ = new BehaviorSubject<boolean>(true);\n\n // Last content emitted while the dropdown was visible. Reused during the\n // close fade so the populated dropdown fades out as one — see initVm.\n private lastVisibleContent: DropdownContent | null = null;\n\n ngOnInit(): void {\n // Seed the input bridges from their resolved values at init time.\n this.showPills$.next(this.showPills);\n this.showSkipButton$.next(this.showSkipButton);\n this.applyMode();\n this.initVm();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes[\"showPills\"]) {\n this.showPills$.next(this.showPills);\n }\n if (changes[\"showSkipButton\"]) {\n this.showSkipButton$.next(this.showSkipButton);\n }\n if (changes[\"mode\"] && !changes[\"mode\"].firstChange) {\n this.applyMode();\n }\n // Re-bind vm$ when the controller @Input is swapped (e.g. a multi-step form\n // toggling between controllers). Without this, vm$ stays subscribed to the\n // previous controller's dropdown$ — rendering stale options, or, if that\n // controller was destroy()-ed, receiving a completion that collapses the\n // dropdown permanently. Skip the first change: ngOnChanges fires before\n // ngOnInit, which owns the initial creation.\n if (changes[\"controller\"] && !changes[\"controller\"].firstChange && this.controller) {\n this.initVm();\n }\n }\n\n ngOnDestroy(): void {\n this.teardownModeListener();\n }\n\n /**\n * Resolve the `mode` input into `resolvedMode`. Unset → null (the dropdown\n * stays class-less and inherits from a `.magicx-aia` ancestor). `\"auto\"` reads\n * `prefers-color-scheme` and tracks it live via a media-query listener.\n */\n private applyMode(): void {\n this.teardownModeListener();\n if (this.mode === undefined) {\n this.resolvedMode = null;\n return;\n }\n if (this.mode === \"light\" || this.mode === \"dark\") {\n this.resolvedMode = this.mode;\n return;\n }\n // \"auto\"\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n this.resolvedMode = \"light\";\n return;\n }\n this.modeMql = window.matchMedia(\"(prefers-color-scheme: dark)\");\n this.resolvedMode = this.modeMql.matches ? \"dark\" : \"light\";\n this.modeListener = () => {\n this.resolvedMode = this.modeMql?.matches ? \"dark\" : \"light\";\n this.cdr.markForCheck();\n };\n this.modeMql.addEventListener(\"change\", this.modeListener);\n }\n\n private teardownModeListener(): void {\n if (this.modeMql && this.modeListener) {\n this.modeMql.removeEventListener(\"change\", this.modeListener);\n }\n this.modeMql = undefined;\n this.modeListener = undefined;\n }\n\n /** Build the view-model stream from the current controller + showPills$. */\n private initVm(): void {\n this.vm$ = combineLatest([\n this.controller.dropdown$,\n this.showPills$,\n this.showSkipButton$,\n ]).pipe(\n map(([dd, showPills, showSkipButton]) => {\n const activeSuggestion = dd.suggestions[0];\n const options = activeSuggestion?.options ?? [];\n const showsPills = showPills && (dd.pills.length > 0 || dd.isLoading);\n // The trailing \"skip\" button only makes sense next to a real,\n // skippable pill — never on the fallback skeleton bar, and never\n // during re-edit (the bar then shows an already answered param).\n // Deliberately NOT gated on showsPills: with pills rendered elsewhere\n // (pillPlacement \"inline\"/\"hidden\") the bar renders as a skip-only\n // row holding just the button. Hidden while the input is empty — the\n // footer hint doesn't advertise \"→ to skip\" until the user has typed,\n // so the pristine starting state stays free of the affordance too.\n const showsSkip =\n dd.pills.length > 0 && showSkipButton && !dd.isEditing && !dd.isInputEmpty;\n const showsOptions = options.length > 0;\n const showsFallbackSkeleton = dd.isLoading && !showsOptions;\n // Either half is enough to keep the panel up: products render with no\n // suggestions, suggestions render with no products.\n const isVisible =\n dd.isOpen && (showsOptions || showsPills || dd.isLoading || dd.products.length > 0);\n\n // While closing, reuse the last visible content so the populated\n // dropdown fades out as one. Otherwise the pills/options vanish the\n // instant the state empties (e.g. skipping the last pill with →),\n // leaving the always-present footer alone for a flash of a footer-only\n // \"no options\" box mid-fade. Only `isVisible` tracks live state to\n // drive the opacity transition.\n if (!isVisible && this.lastVisibleContent) {\n return { ...this.lastVisibleContent, isVisible: false };\n }\n\n const optionHighlighted =\n dd.activeIndex >= 0 && Boolean(options[dd.activeIndex]?.is_tappable);\n const { key: footerKey, hint: footerHint } = getFooterHint(\n optionHighlighted,\n dd.isInputEmpty,\n );\n const content: DropdownContent = {\n pills: dd.pills,\n options,\n activeIndex: dd.activeIndex,\n isActivePillSelected: dd.isActivePillSelected,\n isLoading: dd.isLoading,\n showsPills,\n showsSkip,\n skipDisabled: dd.isLoading || Boolean(dd.inSelectionAnimation),\n activePillLabel: dd.pills[0]?.text ?? \"\",\n showsOptions,\n showsFallbackSkeleton,\n products: dd.products,\n groupKey: activeSuggestion ? `${activeSuggestion.type} ${activeSuggestion.text}` : \"\",\n footerKey,\n footerHint,\n optionsPosition: dd.optionsPosition,\n };\n if (isVisible) this.lastVisibleContent = content;\n return { ...content, isVisible };\n }),\n );\n }\n\n trackByWidth = (_: number, w: number): number => w;\n\n onPillClick(index: number): void {\n this.controller.setActivePill(index);\n }\n\n onSkip(): void {\n this.controller.skipActivePill();\n }\n\n onSelect(option: SuggestionOption): void {\n this.controller.selectOption(option);\n }\n\n onHighlight(index: number): void {\n this.controller.setActiveDropdownIndex(index);\n }\n\n onProductSelect(product: Product): void {\n this.controller.selectProduct(product);\n }\n\n /**\n * A card taking focus blurs the editor, which would otherwise close the\n * panel out from under the card the user just tabbed to.\n */\n onProductFocusChange(focused: boolean): void {\n this.controller.setFocused(focused);\n }\n\n preventBlur(event: Event): void {\n // Prevent the editor from losing focus when interacting with the dropdown.\n event.preventDefault();\n }\n}\n","<div\n *ngIf=\"vm$ | async as vm\"\n [id]=\"controller.listboxId\"\n role=\"listbox\"\n data-aia-dropdown=\"\"\n [attr.data-aia-loading]=\"vm.isLoading ? '' : null\"\n [attr.data-mode]=\"resolvedMode\"\n [attr.data-options-position]=\"vm.optionsPosition\"\n [attr.data-aia-has-products]=\"vm.products.length > 0 ? '' : null\"\n [class]=\"rootClass\"\n [class.magicx-aia-dropdown-visible]=\"vm.isVisible\"\n (mousedown)=\"preventBlur($event)\"\n>\n <aia-stack space=\"8px\">\n <aia-cluster\n *ngIf=\"vm.showsPills || vm.showsSkip\"\n class=\"magicx-aia-dropdown-pillbar\"\n data-aia-pillbar=\"\"\n [noWrap]=\"true\"\n >\n <!-- The scroll + right-edge fade live on this wrapper (not the bar) so\n the skip button stays outside the masked region — pinned and fully\n opaque while overflowing pills fade under it. Absent in a skip-only\n row (pills rendered elsewhere via pillPlacement inline/hidden). -->\n <span *ngIf=\"vm.showsPills\" class=\"magicx-aia-pill-scroll\" data-aia-pill-scroll=\"\">\n <aia-pill-list\n [pills]=\"vm.pills\"\n [activePillIndex]=\"0\"\n [activeSelected]=\"vm.isActivePillSelected\"\n [rounded]=\"true\"\n [loading]=\"vm.isLoading\"\n (selectPill)=\"onPillClick($event)\"\n ></aia-pill-list>\n </span>\n <button\n *ngIf=\"vm.showsSkip\"\n type=\"button\"\n tabindex=\"-1\"\n class=\"magicx-aia-skip\"\n data-aia-skip=\"\"\n [disabled]=\"vm.skipDisabled\"\n [attr.aria-label]=\"vm.activePillLabel ? 'Skip ' + vm.activePillLabel : 'Skip'\"\n (click)=\"onSkip()\"\n >\n skip\n </button>\n </aia-cluster>\n\n <aia-suggestion-grid\n *ngIf=\"vm.showsOptions\"\n [options]=\"vm.options\"\n [activeIndex]=\"vm.activeIndex\"\n [listboxId]=\"controller.listboxId\"\n [loading]=\"vm.isLoading\"\n [groupKey]=\"vm.groupKey\"\n (select)=\"onSelect($event)\"\n (highlight)=\"onHighlight($event)\"\n ></aia-suggestion-grid>\n\n <div\n *ngIf=\"vm.showsFallbackSkeleton\"\n class=\"magicx-aia-dropdown-skeleton-bars\"\n data-aia-skeleton-bars=\"\"\n >\n <span\n *ngFor=\"let w of fallbackSkeletonBarWidths; trackBy: trackByWidth\"\n class=\"magicx-aia-dropdown-skeleton-bar\"\n [style.width.px]=\"w\"\n ></span>\n </div>\n\n <!-- *ngIf, not just the section's own guard inside the component: the host\n element is an in-flow child of .aia-stack (display:flex; gap:8px), so\n an always-instantiated zero-height host would add a SECOND 8px gap\n between the grid and the footer — in every dropdown, products or not.\n The grid's --aia-grid-overlap-bottom is tuned for exactly one gap, so\n the footer would land 8px below the band it is meant to cover. -->\n <aia-product-strip\n *ngIf=\"vm.products.length > 0\"\n [products]=\"vm.products\"\n [listboxId]=\"controller.listboxId\"\n [focusable]=\"vm.isVisible\"\n (select)=\"onProductSelect($event)\"\n (focusChange)=\"onProductFocusChange($event)\"\n ></aia-product-strip>\n\n <footer class=\"magicx-aia-footer\" data-aia-footer=\"\">\n <div class=\"magicx-aia-footer-row\">\n <span class=\"magicx-aia-footer-hint-group\">\n <kbd class=\"magicx-aia-footer-key\">{{ vm.footerKey }}</kbd>\n <span class=\"magicx-aia-footer-hint\">{{ vm.footerHint }}</span>\n </span>\n <a\n class=\"magicx-aia-footer-brand-link\"\n [href]=\"brandHref\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <span class=\"magicx-aia-footer-brand\">AI</span>\n <span class=\"magicx-aia-footer-badge\">Autocomplete</span>\n </a>\n </div>\n </footer>\n </aia-stack>\n</div>\n","import { distinctUntilChanged, map, type Observable, shareReplay } from \"rxjs\";\n\n/**\n * Per-field observable derivation factory. Enforces the §19.4 invariant:\n *\n * - `distinctUntilChanged` — prevents re-emission storms when the upstream\n * state object ticks but the field a consumer cares about hasn't changed.\n * Without this, every keystroke would re-render every async-pipe binding\n * in the consumer's template even when nothing changed for that binding.\n * - `shareReplay({ bufferSize: 1, refCount: true })` — guarantees that\n * multiple subscribers (multiple `async` pipes in a template, e.g.\n * `*ngIf=\"isLoading$ | async\"` and `[disabled]=\"isLoading$ | async\"`)\n * share a single upstream subscription. `refCount: true` is non-obvious\n * but essential: without it, the inner subscription survives after the\n * last subscriber unmounts, leaking the chain back to `state$`.\n *\n * Every public observable on {@link AIAutocompleteController} must go through\n * this factory — no exceptions.\n *\n * @internal\n */\nexport function deriveField<T, R>(\n source$: Observable<T>,\n selector: (value: T) => R,\n equalityFn?: (a: R, b: R) => boolean,\n): Observable<R> {\n return source$.pipe(\n map(selector),\n distinctUntilChanged(equalityFn),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n}\n","import {\n type CompletedParamState,\n AIAutocomplete as CoreAIAutocomplete,\n type CoreState,\n type Product,\n type Segment,\n type SkippedParamState,\n type Suggestion,\n type SuggestionOption,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\nimport { BehaviorSubject, combineLatest, map, type Observable, shareReplay } from \"rxjs\";\nimport type {\n AIAutocompleteControllerOptions,\n AIAutocompleteControllerState,\n AIAutocompleteControllerUpdate,\n AIAutocompleteDropdownState,\n} from \"../shared/types\";\nimport { deriveField } from \"./observables\";\n\n/**\n * Tier 2 logic surface for `@magicx-eng/ai-autocomplete-angular` — the Angular\n * equivalent of React's `useAIAutocomplete()` hook. Wraps a headless\n * `@magicx-eng/ai-autocomplete-vanilla` core and exposes its state as RxJS\n * observables plus thin action methods.\n *\n * The controller is consumer-managed — the consumer creates it\n * with `new`, holds the reference, and **must call `destroy()`** in their\n * own `ngOnDestroy`. The Tier 1 `<ai-autocomplete>` component does this\n * automatically; Tier 2 consumers do not get auto-cleanup.\n *\n * @public\n */\nexport class AIAutocompleteController {\n private readonly core: CoreAIAutocomplete;\n private readonly rawState$: BehaviorSubject<CoreState>;\n // optionsPosition isn't part of CoreState (it's a core option), so track it\n // here and fold it into `dropdown$` so the dropdown can read placement from\n // the controller — configured once, kept in sync through update().\n private readonly optionsPosition$ = new BehaviorSubject<\"above\" | \"below\">(\"below\");\n private readonly unsubscribeCore: () => void;\n private isDestroyed = false;\n\n // === Per-field observables ===\n // Each one runs through deriveField, which bakes in distinctUntilChanged\n // and shareReplay({ bufferSize: 1, refCount: true }) per §19.4.\n\n /** Plain-text content of the editor. */\n readonly text$: Observable<string>;\n /** Completed (bold) params currently in the editor. */\n readonly completedParams$: Observable<CompletedParamState[]>;\n /**\n * Suggestions the user dismissed with the skip key (→). Nothing renders\n * them; they exist so a hand-rolled submit can pass them to\n * `buildSubmitResult` and carry the same `text: \"skipped\"` entries the\n * SDK's own requests do.\n */\n readonly skippedParams$: Observable<SkippedParamState[]>;\n /** Actionable suggestion pills (first one is the active pill). */\n readonly suggestionPills$: Observable<Suggestion[]>;\n /** Text + completed-param segments for rendering the editor body. */\n readonly segments$: Observable<Segment[]>;\n /** ID of the most-recently-promoted param (drives shimmer animation). */\n readonly newParamId$: Observable<string | null>;\n /** All suggestions from the server (including non-actionable ones). */\n readonly suggestions$: Observable<Suggestion[]>;\n /**\n * Results of the latest product search. Always empty unless `products` is\n * configured on the controller — the strip is opt-in and costs nothing when\n * it isn't wired up.\n */\n readonly products$: Observable<Product[]>;\n /** Currently highlighted dropdown option index. -1 = none. */\n readonly activeIndex$: Observable<number>;\n /**\n * UI-visible loading flag — suppressed during the post-select streak\n * animation and during re-edit (cached options stay visible there). Use\n * this instead of the raw core state for any loading-skeleton binding.\n */\n readonly isLoading$: Observable<boolean>;\n /** Server-reported \"query is complete\" flag. */\n readonly isReady$: Observable<boolean>;\n /** Whether the editor currently has focus. */\n readonly isFocused$: Observable<boolean>;\n /** Whether the dropdown should currently be visible. */\n readonly isDropdownOpen$: Observable<boolean>;\n /**\n * Whether the active (leading) pill should render selected (full opacity)\n * rather than the de-emphasized `first` tier. Auto trigger ⇒ true only while\n * a dropdown option is highlighted; manual ⇒ true once the pill is tapped.\n */\n readonly isActivePillSelected$: Observable<boolean>;\n /** Server-suggested placeholder text for the editor. */\n readonly placeholderText$: Observable<string>;\n /** Last fetch error, or null. */\n readonly error$: Observable<Error | null>;\n /** Param currently being re-edited, or null. */\n readonly editingParam$: Observable<CompletedParamState | null>;\n /** Plain-text offset where the edit region starts, or null. */\n readonly editingAnchor$: Observable<number | null>;\n /** Live caret offset within the editor. */\n readonly caretOffset$: Observable<number | null>;\n\n // === Composite observables ===\n\n /**\n * Snapshot of every public field in one object. Convenient for\n * `*ngIf=\"ctrl.state$ | async as state\"` templating — aliases all fields\n * under a single subscription instead of multiple `| async` pipes.\n */\n readonly state$: Observable<AIAutocompleteControllerState>;\n\n /**\n * Composite state for the dropdown view. Tier 2 consumers spread this into\n * `<ai-autocomplete-dropdown>`; Tier 1 uses the same shape internally.\n */\n readonly dropdown$: Observable<AIAutocompleteDropdownState>;\n\n /**\n * Throws if invoked outside a browser environment. For SSR / Angular\n * Universal, gate construction with `isPlatformBrowser`.\n */\n constructor(opts: AIAutocompleteControllerOptions = {}) {\n if (typeof document === \"undefined\") {\n throw new Error(\n \"AIAutocompleteController requires a browser environment. \" +\n \"For SSR / Angular Universal, gate construction with isPlatformBrowser.\",\n );\n }\n\n // Headless mode never renders to the host, so a throwaway div is fine —\n // it's required by the core's signature for symmetry with full mode.\n const host = document.createElement(\"div\");\n\n this.core = new CoreAIAutocomplete(host, {\n ...opts,\n renderMode: \"headless\",\n source: opts.source ?? \"headless-sdk\",\n // Headless mode never renders the dropdown DOM, but the keyboard\n // controller still reads `optionsPosition` to decide which vertical\n // arrow opens the dropdown from the input.\n optionsPosition: opts.optionsPosition ?? \"below\",\n });\n\n this.rawState$ = new BehaviorSubject<CoreState>(this.core.getState());\n // Push the store's *current* state, not the snapshot the listener was\n // handed. The core notifies listeners synchronously, and some actions\n // trigger reentrant `store.set` calls (e.g. typing a non-matching char\n // during re-edit makes the core synchronously exit re-edit and kick off a\n // fetch).\n //\n // The core's store used to deliver such a nested set inline and then\n // resume the outer listener loop, so a listener could be handed an older\n // state (still in re-edit) *after* a newer one (re-edit exited) — which\n // resurrected a stale `editingParam` and retriggered the editor's re-edit\n // caret-park, yanking the caret back to where re-editing started. The\n // store now queues notifications and drains them in order, so that\n // out-of-order delivery can no longer happen at the source.\n //\n // Reading `getState()` at emission time is kept as belt-and-braces: it\n // costs nothing (distinctUntilChanged downstream drops the duplicate\n // emissions) and keeps this bridge correct for any future consumer that\n // emits mid-cascade. React needs neither, since it batches renders and\n // gates its caret effects on dependencies.\n this.unsubscribeCore = this.core.subscribe(() => {\n if (!this.isDestroyed) this.rawState$.next(this.core.getState());\n });\n\n // === Per-field observables ===\n // Array-valued fields use shallow equality. The vanilla store spreads on\n // every write (`store.set({ completedParams: [...] })`), so reference\n // equality would re-fire downstream subscribers on every state tick even\n // when the array's contents are unchanged. The other fields are\n // primitives or stable object references, so default identity equality\n // works fine.\n this.text$ = deriveField(this.rawState$, (s) => s.text);\n this.completedParams$ = deriveField(this.rawState$, (s) => s.completedParams, arrEq);\n this.skippedParams$ = deriveField(this.rawState$, (s) => s.skippedParams, arrEq);\n this.suggestionPills$ = deriveField(this.rawState$, (s) => s.actionableSuggestions, arrEq);\n this.segments$ = deriveField(this.rawState$, (s) => s.segments, arrEq);\n this.newParamId$ = deriveField(this.rawState$, (s) => s.newParamId);\n this.suggestions$ = deriveField(this.rawState$, (s) => s.suggestions, arrEq);\n this.products$ = deriveField(this.rawState$, (s) => s.products, arrEq);\n this.activeIndex$ = deriveField(this.rawState$, (s) => s.activeDropdownIndex);\n this.isLoading$ = deriveField(this.rawState$, computeUiLoading);\n this.isReady$ = deriveField(this.rawState$, (s) => s.isReady);\n this.isFocused$ = deriveField(this.rawState$, (s) => s.isFocused);\n this.isDropdownOpen$ = deriveField(this.rawState$, (s) => s.isDropdownOpen);\n this.isActivePillSelected$ = deriveField(this.rawState$, (s) => s.isActivePillSelected);\n this.placeholderText$ = deriveField(this.rawState$, (s) => s.placeholderText);\n this.error$ = deriveField(this.rawState$, (s) => s.error);\n this.editingParam$ = deriveField(this.rawState$, (s) => s.editingParam);\n this.editingAnchor$ = deriveField(this.rawState$, (s) => s.editingAnchor);\n this.caretOffset$ = deriveField(this.rawState$, (s) => s.caretOffset);\n\n // === Composite observables ===\n // Project directly off `rawState$` with a single map() so each store\n // tick produces exactly ONE coherent state$ emission. Using\n // `combineLatest` over the per-field observables here would fire one\n // emission per inner-source tick (up to N per store update), and the\n // editor-host directive's post-promote refocus would run against an\n // intermediate state where `newParamId` was set but `segments` /\n // `caretOffset` still held their old values — leaving the caret stuck\n // at the pre-click position.\n this.state$ = this.rawState$.pipe(\n map(computeState),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n\n this.optionsPosition$.next(opts.optionsPosition ?? \"below\");\n this.dropdown$ = combineLatest([this.rawState$, this.optionsPosition$]).pipe(\n map(([s, optionsPosition]) => computeDropdown(s, optionsPosition)),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n }\n\n // === Read-only accessors ===\n\n /** Stable ARIA listbox ID for the dropdown. Pass to `<textarea aria-controls=\"...\">`. */\n get listboxId(): string {\n return this.core.listboxId;\n }\n\n /** Whether `destroy()` has been called. After destruction all action methods no-op. */\n get destroyed(): boolean {\n return this.isDestroyed;\n }\n\n /**\n * Synchronous snapshot of the controller's current public state. Mirrors\n * the latest emission of `state$`. Useful in callbacks where you can't\n * `subscribe` (e.g. inside an event handler).\n */\n getState(): AIAutocompleteControllerState {\n return computeState(this.rawState$.value);\n }\n\n // === Action methods (pass-through to the core) ===\n //\n // Every action method begins with an `isDestroyed` guard so that callers\n // who hold a stale reference after `destroy()` don't accidentally trigger\n // work on a torn-down core. The vanilla core does not gate its own methods\n // post-dispose — `reset()`, `handleTextChange()`, and friends would still\n // schedule fetches or fire HTTP requests against an aborted controller,\n // and the responses would have nowhere to surface (rawState$ is already\n // complete). The guard makes the JSDoc-promised \"no-op silently\"\n // semantics actually true.\n\n /** Clear all state, rotate `session_id`, and re-fetch. Call after submit. */\n reset(): void {\n if (this.isDestroyed) return;\n this.core.reset();\n }\n\n /** Pick a dropdown option (or replace the re-edited param if in re-edit mode). */\n selectOption(option: SuggestionOption): void {\n if (this.isDestroyed) return;\n this.core.selectOption(option);\n }\n\n /**\n * Announce a product selection — fires the `onProductSelect` callback the\n * controller was constructed with. `<ai-autocomplete-dropdown>` calls this\n * for you; consumers rendering their own strip call it themselves.\n *\n * Emitting is the whole behaviour: the SDK deliberately does not navigate to\n * `product.url`, because only the integration knows whether a selection\n * means \"open the PDP\", \"add to cart\", or \"fill the input\".\n */\n selectProduct(product: Product): void {\n if (this.isDestroyed) return;\n this.core.selectProduct(product);\n }\n\n /** Promote the pill at `index` to active (front of the list). */\n setActivePill(index: number): void {\n if (this.isDestroyed) return;\n this.core.setActivePill(index);\n }\n\n /**\n * Skip the active pill — same action as pressing → at the end of the input.\n * The dropdown's skip button calls this; consumers rendering their own skip\n * affordance call it directly. The skipped suggestion joins `skippedParams$`.\n */\n skipActivePill(): void {\n if (this.isDestroyed) return;\n this.core.skipActivePill();\n }\n\n /** Drop the last completed param's \"completed\" status. Text stays as plain text. */\n removeLastParam(): void {\n if (this.isDestroyed) return;\n this.core.removeLastParam();\n }\n\n /** Clear the shimmer animation state for the most-recently-added param. */\n clearNewParamId(): void {\n if (this.isDestroyed) return;\n this.core.clearNewParamId();\n }\n\n /** Controlled-mode setter for editor text. */\n setValue(text: string): void {\n if (this.isDestroyed) return;\n this.core.setValue(text);\n }\n\n /** Controlled-mode setter for completed params. */\n setCompletedParams(params: CompletedParamState[]): void {\n if (this.isDestroyed) return;\n this.core.setCompletedParams(params);\n }\n\n /** Forward plain-text input from the consumer's `<textarea>` to the core. */\n handleTextChange(value: string): void {\n if (this.isDestroyed) return;\n this.core.handleTextChange(value);\n }\n\n /** Forward keyboard events from the consumer's `<textarea>` to the core. */\n handleKeyDown(event: KeyboardEvent): void {\n if (this.isDestroyed) return;\n this.core.handleKeyDown(event);\n }\n\n /** Notify the core of focus state. */\n setFocused(focused: boolean): void {\n if (this.isDestroyed) return;\n this.core.setFocused(focused);\n }\n\n /** Enter re-edit mode for the bold param with the given id. */\n startEditingParam(paramId: string): void {\n if (this.isDestroyed) return;\n this.core.startEditingParam(paramId);\n }\n\n /** Exit re-edit mode without changing the bold param. */\n exitEditMode(): void {\n if (this.isDestroyed) return;\n this.core.exitEditMode();\n }\n\n /** Forward post-input caret position (extends the edit tail). */\n handleCaretAfterInput(offset: number | null): void {\n if (this.isDestroyed) return;\n this.core.handleCaretAfterInput(offset);\n }\n\n /** Forward selection-only caret moves (may exit re-edit). */\n handleCaretMove(offset: number | null): void {\n if (this.isDestroyed) return;\n this.core.handleCaretMove(offset);\n }\n\n /** Replace the bold param being re-edited. Returns true when applied. */\n replaceEditingRange(replacement: string): boolean {\n if (this.isDestroyed) return false;\n return this.core.replaceEditingRange(replacement);\n }\n\n /** Set the highlighted option index (typically driven by hover). */\n setActiveDropdownIndex(index: number): void {\n if (this.isDestroyed) return;\n this.core.setActiveDropdownIndex(index);\n }\n\n // === Lifecycle ===\n\n /**\n * Apply runtime changes to a subset of options. Event callbacks\n * (`onSubmit`, `onError`, etc.) cannot be swapped this way — they are\n * registered once at construction (matches the React hook's design). For\n * dynamic event reactivity, subscribe to the corresponding observable\n * (e.g. `text$` instead of `onChange`).\n */\n update(opts: AIAutocompleteControllerUpdate): void {\n if (this.isDestroyed) return;\n this.core.update(opts);\n if (opts.optionsPosition !== undefined) {\n this.optionsPosition$.next(opts.optionsPosition);\n }\n }\n\n /**\n * Release all resources — unsubscribes from the core, destroys the core,\n * and completes the internal state subject. Safe to call multiple times.\n * After destruction, action methods no-op silently.\n */\n destroy(): void {\n if (this.isDestroyed) return;\n this.isDestroyed = true;\n this.unsubscribeCore();\n this.core.destroy();\n this.rawState$.complete();\n }\n}\n\n// ===== Pure helpers — not part of the public surface =====\n\n/**\n * Shallow array equality. The vanilla store reassigns array fields on every\n * write (`store.set({ completedParams: [...prev, x] })`), so reference\n * equality alone would re-emit downstream even when the contents are\n * identical. Used for `completedParams$`, `suggestions$`, `suggestionPills$`,\n * and `segments$`.\n */\nfunction arrEq<T>(a: readonly T[], b: readonly T[]): boolean {\n if (a === b) return true;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\nfunction computeUiLoading(s: CoreState): boolean {\n return s.isLoading && !s.editingParam && !s.inSelectionAnimation;\n}\n\nfunction computeState(s: CoreState): AIAutocompleteControllerState {\n return {\n text: s.text,\n completedParams: s.completedParams,\n skippedParams: s.skippedParams,\n suggestionPills: s.actionableSuggestions,\n segments: s.segments,\n newParamId: s.newParamId,\n suggestions: s.suggestions,\n products: s.products,\n activeIndex: s.activeDropdownIndex,\n isLoading: computeUiLoading(s),\n isReady: s.isReady,\n isFocused: s.isFocused,\n isDropdownOpen: s.isDropdownOpen,\n placeholderText: s.placeholderText,\n error: s.error,\n editingParam: s.editingParam,\n editingAnchor: s.editingAnchor,\n caretOffset: s.caretOffset,\n };\n}\n\nfunction computeDropdown(\n s: CoreState,\n optionsPosition: \"above\" | \"below\",\n): AIAutocompleteDropdownState {\n const editingParam = s.editingParam;\n const activeSuggestion = s.actionableSuggestions[0];\n const dropdownPill: Suggestion | null = editingParam\n ? {\n type: editingParam.suggestionType,\n text: editingParam.suggestionPlaceholder,\n required: true,\n options: editingParam.options,\n }\n : null;\n const dropdownActivePill = dropdownPill ?? activeSuggestion;\n const dropdownPills = dropdownPill ? [dropdownPill] : s.actionableSuggestions;\n return {\n suggestions: dropdownActivePill ? [{ ...dropdownActivePill, options: s.filteredOptions }] : [],\n activeIndex: s.activeDropdownIndex,\n isOpen: s.isDropdownOpen,\n pills: dropdownPills,\n isActivePillSelected: s.isActivePillSelected,\n isLoading: computeUiLoading(s),\n isInputEmpty: s.text.trim().length === 0,\n products: s.products,\n isEditing: Boolean(editingParam),\n inSelectionAnimation: s.inSelectionAnimation,\n optionsPosition,\n };\n}\n","import {\n Directive,\n ElementRef,\n Input,\n inject,\n NgZone,\n type OnDestroy,\n type OnInit,\n Renderer2,\n} from \"@angular/core\";\nimport {\n extractPlainText,\n getCursorOffset,\n plainTextLength,\n renderEditableContent,\n setCursorOffset,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\nimport { Subject, takeUntil } from \"rxjs\";\nimport type { AIAutocompleteController } from \"../../controller/ai-autocomplete.controller\";\n\n/**\n * Module-level cache for the one-time plaintext-only feature detection.\n * Mirrors `supportsPlaintextOnly` in useContentEditableEditor.ts.\n */\nlet plaintextOnlyCache: boolean | undefined;\nfunction supportsPlaintextOnly(): boolean {\n if (plaintextOnlyCache !== undefined) return plaintextOnlyCache;\n if (typeof document === \"undefined\") return false;\n const probe = document.createElement(\"div\");\n probe.setAttribute(\"contenteditable\", \"plaintext-only\");\n plaintextOnlyCache = probe.contentEditable === \"plaintext-only\";\n return plaintextOnlyCache;\n}\n\n/**\n * Internal directive that owns every concern specific to running the\n * autocomplete on top of a contentEditable host: composition state, caret\n * tracking, selectionchange handling, `beforeinput` interception, paste\n * sanitization, plaintext-only feature detection, segment rendering,\n * post-promote refocus, and re-edit caret park.\n *\n * Mirrors `packages/react/src/hooks/useContentEditableEditor.ts` one-for-one.\n * Used only by the Tier 1 `<ai-autocomplete>` component — never exported.\n *\n * @internal\n */\n@Directive({\n selector: \"[aiaEditorHost]\",\n standalone: true,\n host: {\n role: \"combobox\",\n \"aria-autocomplete\": \"list\",\n \"aria-haspopup\": \"listbox\",\n spellcheck: \"true\",\n enterkeyhint: \"send\",\n tabindex: \"0\",\n \"(input)\": \"onInput()\",\n \"(keydown)\": \"onKeyDown($event)\",\n \"(compositionstart)\": \"onCompositionStart()\",\n \"(compositionend)\": \"onCompositionEnd()\",\n \"(paste)\": \"onPaste($event)\",\n \"(focus)\": \"onFocus()\",\n \"(blur)\": \"onBlur()\",\n },\n})\nexport class AIAutocompleteEditorHostDirective implements OnInit, OnDestroy {\n @Input(\"aiaEditorHost\") controller!: AIAutocompleteController;\n @Input() autoFocus = true;\n\n private readonly el = inject<ElementRef<HTMLDivElement>>(ElementRef);\n private readonly renderer = inject(Renderer2);\n private readonly zone = inject(NgZone);\n private readonly destroy$ = new Subject<void>();\n\n private composing = false;\n private lastInputAt = 0;\n private lastSeenParamId = \"\";\n private lastEditingId = \"\";\n private editingParamId: string | null = null;\n\n private documentSelectionListener?: () => void;\n private beforeInputListener?: (event: Event) => void;\n\n ngOnInit(): void {\n if (!this.controller) {\n throw new Error(\"[aiaEditorHost] requires a controller\");\n }\n\n const el = this.el.nativeElement;\n const ceMode = supportsPlaintextOnly() ? \"plaintext-only\" : \"true\";\n this.renderer.setAttribute(el, \"contenteditable\", ceMode);\n this.renderer.setAttribute(el, \"aria-controls\", this.controller.listboxId);\n this.renderer.setAttribute(el, \"suppress-content-editable-warning\", \"true\");\n\n // Auto-focus on mount. If the editor already has focus (e.g. from a\n // click that fired before our lifecycle ran), notify the controller\n // instead of stealing focus.\n if (this.autoFocus) {\n queueMicrotask(() => {\n if (typeof document === \"undefined\") return;\n if (document.activeElement === el) {\n this.controller.setFocused(true);\n } else {\n el.focus();\n }\n });\n }\n\n this.bindDocumentSelectionListener();\n this.bindBeforeInputListener();\n this.bindStateSubscription();\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n if (this.documentSelectionListener && typeof document !== \"undefined\") {\n document.removeEventListener(\"selectionchange\", this.documentSelectionListener);\n }\n if (this.beforeInputListener) {\n this.el.nativeElement.removeEventListener(\"beforeinput\", this.beforeInputListener);\n }\n }\n\n // === Host event handlers ===\n\n onCompositionStart(): void {\n this.composing = true;\n }\n\n onCompositionEnd(): void {\n this.composing = false;\n this.fireInput();\n }\n\n onInput(): void {\n this.lastInputAt = performance.now();\n this.fireInput();\n this.controller.handleCaretAfterInput(getCursorOffset(this.el.nativeElement));\n }\n\n onKeyDown(event: KeyboardEvent): void {\n this.controller.handleKeyDown(event);\n }\n\n onPaste(event: ClipboardEvent): void {\n event.preventDefault();\n const el = this.el.nativeElement;\n const text = (event.clipboardData?.getData(\"text/plain\") ?? \"\").replace(/\\r?\\n/g, \" \");\n if (!text) return;\n const doc = el.ownerDocument ?? document;\n const sel = doc.getSelection();\n if (!sel || sel.rangeCount === 0) return;\n const range = sel.getRangeAt(0);\n if (!el.contains(range.startContainer)) return;\n range.deleteContents();\n const node = doc.createTextNode(text);\n range.insertNode(node);\n range.setStartAfter(node);\n range.collapse(true);\n sel.removeAllRanges();\n sel.addRange(range);\n this.fireInput();\n }\n\n onFocus(): void {\n this.controller.setFocused(true);\n }\n\n onBlur(): void {\n this.controller.setFocused(false);\n }\n\n // === Internal helpers ===\n\n private fireInput(): void {\n if (this.composing) return;\n const el = this.el.nativeElement;\n const raw = extractPlainText(el);\n const shouldCapitalize = raw.length > 0 && raw[0] !== raw[0].toUpperCase();\n const next = shouldCapitalize ? raw[0].toUpperCase() + raw.slice(1) : raw;\n this.controller.handleTextChange(next);\n }\n\n private bindDocumentSelectionListener(): void {\n if (typeof document === \"undefined\") return;\n const el = this.el.nativeElement;\n // selectionchange fires on every keystroke and caret move — run outside\n // Angular's zone (§16.1) and re-enter only when we actually need to\n // notify the controller of a meaningful change.\n this.zone.runOutsideAngular(() => {\n const handler = (): void => {\n const sel = document.getSelection();\n if (!sel || sel.rangeCount === 0) return;\n if (!sel.anchorNode || !el.contains(sel.anchorNode)) return;\n const anchor = sel.anchorNode;\n const startEl =\n anchor.nodeType === Node.ELEMENT_NODE ? (anchor as Element) : anchor.parentElement;\n // Only a COLLAPSED selection means \"the caret landed in a chip\". A\n // range selection (Cmd+A, shift-arrow, drag) anchors at its start,\n // which lands inside the first `<strong>` whenever the input begins\n // with a chip — starting re-edit there parks the caret on that chip\n // and destroys the user's selection.\n const strong = sel.isCollapsed\n ? startEl?.closest<HTMLElement>('strong[data-seg=\"completed\"][data-param-id]')\n : null;\n // `DOMStringMap` is an index signature; bracket notation is required\n // by `noPropertyAccessFromIndexSignature`.\n const enclosing = strong?.dataset[\"paramId\"] ?? null;\n if (enclosing && enclosing !== this.editingParamId) {\n this.zone.run(() => this.controller.startEditingParam(enclosing));\n return;\n }\n if (performance.now() - this.lastInputAt < 50) return;\n this.zone.run(() => this.controller.handleCaretMove(getCursorOffset(el)));\n };\n this.documentSelectionListener = handler;\n document.addEventListener(\"selectionchange\", handler);\n });\n }\n\n private bindBeforeInputListener(): void {\n const el = this.el.nativeElement;\n // Native beforeinput — React's synthetic onBeforeInput is wired to the\n // legacy textInput event and doesn't fire reliably for delete* types.\n const handler = (event: Event): void => {\n const inputEvent = event as InputEvent;\n const t = inputEvent.inputType;\n if (t === \"insertParagraph\" || t === \"insertLineBreak\" || t === \"insertFromDrop\") {\n event.preventDefault();\n return;\n }\n if (t.startsWith(\"insert\") || t.startsWith(\"delete\")) {\n const replacement = t.startsWith(\"delete\") ? \"\" : (inputEvent.data ?? \"\");\n if (this.controller.replaceEditingRange(replacement)) {\n event.preventDefault();\n }\n }\n };\n this.beforeInputListener = handler;\n el.addEventListener(\"beforeinput\", handler);\n }\n\n private bindStateSubscription(): void {\n const el = this.el.nativeElement;\n this.controller.state$.pipe(takeUntil(this.destroy$)).subscribe((state) => {\n this.editingParamId = state.editingParam?.id ?? null;\n\n renderEditableContent({\n input: el,\n segments: state.segments,\n newParamId: state.newParamId,\n editingParamId: state.editingParam?.id ?? null,\n placeholderText: state.placeholderText,\n isFocused: state.isFocused,\n });\n\n // Post-promote refocus + caret-after-bold placement (mirrors React's\n // useLayoutEffect on newParamId).\n const currentParamId = state.newParamId ?? \"\";\n if (currentParamId && currentParamId !== this.lastSeenParamId) {\n this.lastSeenParamId = currentParamId;\n el.focus();\n const desired = state.caretOffset ?? plainTextLength(el);\n setCursorOffset(el, desired);\n } else if (!currentParamId) {\n this.lastSeenParamId = \"\";\n }\n\n // Re-edit caret park (mirrors React's useLayoutEffect on editingParam).\n const editingId = state.editingParam?.id ?? \"\";\n if (editingId && editingId !== this.lastEditingId && state.editingAnchor != null) {\n this.lastEditingId = editingId;\n setCursorOffset(el, state.editingAnchor);\n } else if (!editingId) {\n this.lastEditingId = \"\";\n }\n });\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Input,\n Output,\n ViewEncapsulation,\n} from \"@angular/core\";\n\n/**\n * Internal default submit button (up-arrow). Angular analogue of React's\n * `SubmitButton`. The default/custom/hidden branching stays in the parent\n * (`AIAutocompleteComponent`); this is only the built-in button.\n *\n * @internal\n */\n@Component({\n selector: \"aia-submit-button\",\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./submit-button.component.html\",\n styleUrls: [\"./submit-button.component.css\"],\n})\nexport class SubmitButtonComponent {\n @Input() disabled = false;\n @Output() readonly submit = new EventEmitter<MouseEvent>();\n\n onClick(event: MouseEvent): void {\n this.submit.emit(event);\n }\n}\n","<button\n type=\"button\"\n data-aia-submit=\"\"\n class=\"magicx-aia-submit-button\"\n [disabled]=\"disabled\"\n aria-label=\"Submit\"\n (click)=\"onClick($event)\"\n>\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\" role=\"img\" aria-label=\"Submit\">\n <path\n d=\"M9 14V4M9 4L4 9M9 4L14 9\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n</button>\n","import { CommonModule, isPlatformBrowser } from \"@angular/common\";\nimport {\n type AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n type ElementRef,\n EventEmitter,\n forwardRef,\n Input,\n inject,\n NgZone,\n type OnChanges,\n type OnDestroy,\n type OnInit,\n Output,\n PLATFORM_ID,\n type SimpleChanges,\n type TemplateRef,\n ViewChild,\n ViewEncapsulation,\n} from \"@angular/core\";\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport {\n type APIConfig,\n type AppearanceMode,\n type AutocompleteResult,\n buildSubmitResult,\n type CompletedParamState,\n extractPlainText,\n ModeController,\n type OptionOverrides,\n type Product,\n type ProductsConfig,\n setCursorOffset,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\nimport { AIAutocompleteDropdownComponent } from \"../ai-autocomplete-dropdown/ai-autocomplete-dropdown.component\";\nimport { AIAutocompleteController } from \"../controller/ai-autocomplete.controller\";\nimport { AIAutocompleteEditorHostDirective } from \"../internal/editor-host/editor-host.directive\";\nimport { PillListComponent } from \"../internal/pill-list/pill-list.component\";\nimport { SubmitButtonComponent } from \"../internal/submit-button/submit-button.component\";\n\n/**\n * Tier 1 component — `<ai-autocomplete>`. The Angular equivalent of React's\n * `<AIAutocomplete />`. Owns the contentEditable editor, inline pills, mode\n * controller, submit button slot, and an embedded\n * {@link AIAutocompleteController} that drives the dropdown.\n *\n * @public\n */\n@Component({\n selector: \"ai-autocomplete\",\n standalone: true,\n imports: [\n CommonModule,\n AIAutocompleteDropdownComponent,\n AIAutocompleteEditorHostDirective,\n PillListComponent,\n SubmitButtonComponent,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: \"./ai-autocomplete.component.html\",\n styleUrls: [\"./ai-autocomplete.component.css\"],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n useExisting: forwardRef(() => AIAutocompleteComponent),\n multi: true,\n },\n ],\n})\nexport class AIAutocompleteComponent\n implements OnInit, AfterViewInit, OnChanges, OnDestroy, ControlValueAccessor\n{\n // === Inputs (mirrors React's AIAutocompleteProps) ===\n\n @Input() apiConfig?: APIConfig;\n /**\n * Optional user context. Include whatever you know about the user — a\n * profile, preferences, workspace, anything — to personalize suggested\n * parameters and options to them. Bind a stable reference; the same swap\n * rule that applies to `apiConfig` applies here.\n */\n @Input() additionalContext?: Record<string, unknown>;\n @Input() optionOverrides?: OptionOverrides;\n @Input() maskCompletedText = false;\n @Input() columns?: number;\n /** Where unfilled pills render. Default: \"dropdown\". */\n @Input() pillPlacement: \"inline\" | \"dropdown\" | \"hidden\" = \"dropdown\";\n /** Color mode. \"auto\" follows prefers-color-scheme. Default: \"auto\". */\n @Input() mode: AppearanceMode = \"auto\";\n @Input() optionsPosition: \"above\" | \"below\" = \"below\";\n @Input() animations = true;\n @Input() dropdownTrigger?: \"auto\" | \"manual\" | \"hidden\";\n @Input() closeDropdownOnBlur?: boolean;\n @Input() showNonTappableOptions?: boolean;\n /**\n * When true (default), the dropdown's pill bar ends in a small \"skip\" button\n * that dismisses the active pill — same action as pressing → at the end of\n * the input. Set to false to hide it. When pills render elsewhere\n * (`pillPlacement: \"inline\"` / `\"hidden\"`) the bar renders as a skip-only\n * row holding just the button. Hidden while the input is empty — it appears\n * alongside the footer's \"→ to skip\" hint once the user has typed.\n */\n @Input() showSkipButton = true;\n /** Focus the editor on mount. Default: true. */\n @Input() autoFocus = true;\n /** Controlled-mode text value. */\n @Input() value?: string;\n /** Controlled-mode completed params. */\n @Input() completedParams?: CompletedParamState[];\n /**\n * Opt-in product strip. When set, the dropdown renders a horizontal row of\n * product cards below the options grid, fed by your own search endpoint on\n * the SDK's existing fetch cadence. Omit it and nothing about the dropdown\n * changes — no request, no markup, no layout shift.\n *\n * Bind a stable reference (a component field, not an inline object literal):\n * a new object on each change-detection pass reads as a swapped integration\n * and clears the current cards — the same rule that already applies to\n * `apiConfig` and `optionOverrides`.\n */\n @Input() products?: ProductsConfig;\n /**\n * Custom submit button. Pass a `<ng-template>` to replace the default arrow\n * button. Pass `null` to render no button. Default (`undefined`) renders\n * the built-in arrow.\n */\n @Input() submitButton?: TemplateRef<unknown> | null;\n\n // === Outputs ===\n\n /** Called on Enter or submit-button click. */\n @Output() readonly submitted = new EventEmitter<AutocompleteResult>();\n @Output() readonly errored = new EventEmitter<Error>();\n @Output() readonly valueChange = new EventEmitter<string>();\n @Output() readonly completedParamsChange = new EventEmitter<CompletedParamState[]>();\n @Output() readonly focused = new EventEmitter<void>();\n @Output() readonly blurred = new EventEmitter<void>();\n /**\n * Emitted when the user activates a product card. The SDK does not\n * navigate — you decide what a selection means. Modifier / middle clicks are\n * left to the browser (cmd-click still opens a tab) and don't emit.\n */\n @Output() readonly productSelect = new EventEmitter<Product>();\n\n // === View refs ===\n\n @ViewChild(\"container\", { static: true }) containerRef!: ElementRef<HTMLDivElement>;\n @ViewChild(\"editor\", { static: false }) editorRef?: ElementRef<HTMLDivElement>;\n @ViewChild(\"pillContainer\") pillContainerRef?: ElementRef<HTMLSpanElement>;\n\n // === Public state for the template ===\n\n controller!: AIAutocompleteController;\n /**\n * Concrete light/dark value bound to `[attr.data-mode]`. Seeded in ngOnInit\n * so the attribute is present during SSR (where ModeController, gated behind\n * isPlatformBrowser in ngAfterViewInit, never runs). On the browser the\n * ModeController's resolve callback keeps this in sync — so its runtime\n * prefers-color-scheme updates and this binding always agree (no clobber).\n */\n resolvedMode: \"light\" | \"dark\" = \"dark\";\n\n // === Internal ===\n\n private modeController?: ModeController;\n private resizeObserver?: ResizeObserver;\n private onChangeFn: (value: string) => void = noop;\n private onTouchedFn: () => void = noop;\n // Holds a value written by Reactive Forms before ngOnInit ran. Reactive\n // Forms can call writeValue() during dynamic form construction (e.g. when\n // a FormControl already holds a value at the moment the directive is\n // created). We stash the value here and flush it in ngOnInit *after*\n // the controller exists — otherwise the editor renders empty even though\n // the form had a value. `undefined` means \"no pending write\".\n private pendingWriteValue: string | undefined;\n\n // §16.9: prefer `inject()` over constructor-parameter DI for components.\n private readonly platformId = inject(PLATFORM_ID);\n private readonly zone = inject(NgZone);\n private readonly cdr = inject(ChangeDetectorRef);\n\n ngOnInit(): void {\n // Seed before the browser guard so SSR renders a concrete data-mode.\n this.resolvedMode = resolveInitialMode(this.mode);\n if (!isPlatformBrowser(this.platformId)) return;\n\n this.controller = new AIAutocompleteController({\n apiConfig: this.apiConfig,\n additionalContext: this.additionalContext,\n optionOverrides: this.optionOverrides,\n maskCompletedText: this.maskCompletedText,\n columns: this.columns,\n dropdownTrigger: this.dropdownTrigger,\n optionsPosition: this.optionsPosition,\n closeDropdownOnBlur: this.closeDropdownOnBlur,\n showNonTappableOptions: this.showNonTappableOptions,\n source: \"full-sdk\",\n products: this.products,\n value: this.value,\n completedParams: this.completedParams,\n onSubmit: (result) => this.handleSubmit(result),\n onError: (error) => this.errored.emit(error),\n onChange: (text) => {\n this.valueChange.emit(text);\n this.onChangeFn(text);\n },\n onParamsChange: (params) => this.completedParamsChange.emit(params),\n onFocus: () => this.focused.emit(),\n onProductSelect: (product) => this.productSelect.emit(product),\n onBlur: () => {\n this.blurred.emit();\n this.onTouchedFn();\n },\n setCursor: (offset) => {\n const editor = this.editorRef?.nativeElement;\n if (!editor) return;\n editor.focus();\n setCursorOffset(editor, offset);\n },\n });\n\n if (this.pendingWriteValue !== undefined) {\n this.controller.setValue(this.pendingWriteValue);\n this.pendingWriteValue = undefined;\n }\n }\n\n ngAfterViewInit(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n // ModeController writes `data-mode` to the element it's given. The CSS\n // selectors are scoped to `.magicx-aia[data-mode=\"...\"]` — which lives on\n // the inner `<div class=\"magicx-aia magicx-aia-container\" #container>`,\n // NOT the host `<ai-autocomplete>` element. The resolve callback mirrors\n // the value into `resolvedMode` so the `[attr.data-mode]` binding stays in\n // lockstep with ModeController — the binding handles SSR, ModeController\n // handles runtime prefers-color-scheme switches, and because they always\n // agree neither clobbers the other.\n this.modeController = new ModeController(\n this.containerRef.nativeElement,\n this.mode,\n (resolved) => {\n this.resolvedMode = resolved;\n this.cdr.markForCheck();\n },\n );\n\n // Pill-wrap detection — when the pill list wraps below the editor's last\n // line, drop its 8px left margin via a data attribute the CSS keys off.\n // Mirrors the React component's useLayoutEffect.\n if (typeof ResizeObserver !== \"undefined\") {\n this.zone.runOutsideAngular(() => {\n this.resizeObserver = new ResizeObserver(() => this.measurePillWrap());\n const editor = this.editorRef?.nativeElement;\n if (editor) this.resizeObserver.observe(editor);\n });\n this.measurePillWrap();\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.controller) return;\n // `SimpleChanges` is `{ [key: string]: SimpleChange }`, so per\n // `noPropertyAccessFromIndexSignature` each key lookup uses bracket\n // notation — this keeps the strictness contract that the rest of the\n // workspace enforces.\n // Controlled-mode propagation\n if (changes[\"value\"] && this.value !== undefined) {\n this.controller.setValue(this.value);\n }\n if (changes[\"completedParams\"] && this.completedParams !== undefined) {\n this.controller.setCompletedParams(this.completedParams);\n }\n // Reactive options\n if (\n changes[\"apiConfig\"] ||\n changes[\"additionalContext\"] ||\n changes[\"optionOverrides\"] ||\n changes[\"dropdownTrigger\"] ||\n changes[\"optionsPosition\"] ||\n changes[\"closeDropdownOnBlur\"] ||\n changes[\"showNonTappableOptions\"] ||\n changes[\"products\"]\n ) {\n this.controller.update({\n apiConfig: this.apiConfig,\n additionalContext: this.additionalContext,\n optionOverrides: this.optionOverrides,\n dropdownTrigger: this.dropdownTrigger,\n optionsPosition: this.optionsPosition,\n closeDropdownOnBlur: this.closeDropdownOnBlur,\n showNonTappableOptions: this.showNonTappableOptions,\n // Same reference on an unrelated change is a no-op in the core; only a\n // genuinely swapped (or removed) integration clears the strip.\n products: this.products,\n });\n }\n if (changes[\"mode\"]) {\n // Keep the binding correct even when ModeController doesn't exist yet\n // (SSR / pre-ngAfterViewInit). On the browser, setMode triggers the\n // resolve callback which sets the same value.\n this.resolvedMode = resolveInitialMode(this.mode);\n this.modeController?.setMode(this.mode);\n }\n }\n\n ngOnDestroy(): void {\n this.resizeObserver?.disconnect();\n this.modeController?.destroy();\n this.controller?.destroy();\n }\n\n // === Imperative API (exposed on the component instance via @ViewChild) ===\n\n /** Programmatically focus the editor. */\n focus(): void {\n this.editorRef?.nativeElement.focus();\n }\n\n /** Programmatically blur the editor. */\n blur(): void {\n this.editorRef?.nativeElement.blur();\n }\n\n /** Clear all state, rotate session, and re-fetch. */\n reset(): void {\n this.controller?.reset();\n }\n\n /**\n * Skip the active pill — same action as the dropdown's skip button / →.\n * Lets a consumer who hides the built-in button (`showSkipButton=false`)\n * drive skipping from their own UI.\n */\n skipActivePill(): void {\n this.controller?.skipActivePill();\n }\n\n /** Switch color mode at runtime. */\n setMode(mode: AppearanceMode): void {\n this.mode = mode;\n this.resolvedMode = resolveInitialMode(mode);\n this.modeController?.setMode(mode);\n this.cdr.markForCheck();\n }\n\n // === Template helpers ===\n\n /**\n * 'default' → render the built-in arrow button.\n * 'custom' → project the consumer-supplied TemplateRef.\n * 'hidden' → no button.\n */\n get submitButtonState(): \"default\" | \"custom\" | \"hidden\" {\n if (this.submitButton === null) return \"hidden\";\n if (this.submitButton === undefined) return \"default\";\n return \"custom\";\n }\n\n /** Narrowed accessor for *ngTemplateOutlet — never undefined. */\n get customSubmitTemplate(): TemplateRef<unknown> | null {\n return this.submitButton ?? null;\n }\n\n get showInlinePills(): boolean {\n return this.pillPlacement === \"inline\";\n }\n\n get showDropdownPills(): boolean {\n return this.pillPlacement === \"dropdown\";\n }\n\n /**\n * `true` when there's something to submit — driven by current segments\n * and completed params. Read off the live editor via the controller state.\n */\n canSubmit(state: { segments: { length: number }; completedParams: { length: number } }): boolean {\n return state.segments.length > 0 || state.completedParams.length > 0;\n }\n\n onWrapperClick(event: MouseEvent): void {\n // Clicking a pill should activate it without stealing focus elsewhere.\n const target = event.target as HTMLElement | null;\n if (target?.closest(\"[data-aia-pill]\")) return;\n this.focus();\n }\n\n onSubmitButtonClick(event: MouseEvent): void {\n event.stopPropagation();\n this.handleSubmitFromUserAction();\n }\n\n onSubmitSlotClick(event: MouseEvent): void {\n event.stopPropagation();\n this.handleSubmitFromUserAction();\n }\n\n onSelectPill(index: number): void {\n this.controller.setActivePill(index);\n }\n\n // === ControlValueAccessor ===\n\n writeValue(value: string | null): void {\n const next = value ?? \"\";\n if (!this.controller) {\n // Reactive Forms can call writeValue() before ngOnInit creates the\n // controller (dynamic form construction, or a FormControl that already\n // had a value at directive-creation time). Buffer the value; ngOnInit\n // flushes it as soon as the controller exists.\n this.pendingWriteValue = next;\n return;\n }\n this.controller.setValue(next);\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChangeFn = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouchedFn = fn;\n }\n\n setDisabledState(_disabled: boolean): void {\n // The contentEditable host doesn't have a native disabled attribute. For\n // v0.1 we accept the call so Angular's forms layer doesn't throw, but\n // the editor stays interactive. A future enhancement can toggle\n // contentEditable + ARIA disabled here.\n }\n\n // === Submit flow ===\n\n /**\n * Called by the controller's onSubmit callback (which fires from the\n * keyboard controller on Enter). Reads the live editor text — same trick\n * the React component uses — so the emitted query reflects whatever's in\n * the DOM right now, not a possibly-stale state snapshot.\n */\n private handleSubmit(_result: AutocompleteResult): void {\n const editor = this.editorRef?.nativeElement;\n if (!editor) return;\n const text = extractPlainText(editor);\n const state = this.controller.getState();\n const params = this.completedParams ?? state.completedParams;\n this.submitted.emit(buildSubmitResult(text, params, state.skippedParams));\n this.controller.reset();\n }\n\n private handleSubmitFromUserAction(): void {\n const state = this.controller.getState();\n if (!this.canSubmit(state)) return;\n // Synthesize the result for the submit-button click path; same shape\n // the controller would deliver from a keyboard Enter, so handleSubmit\n // can take either entry point.\n this.handleSubmit({\n query: state.text.trim(),\n raw_query: \"\",\n completed_params: [],\n });\n }\n\n private measurePillWrap(): void {\n const container = this.pillContainerRef?.nativeElement;\n const editor = this.editorRef?.nativeElement;\n if (!container || !editor) return;\n const inner = container.firstElementChild as HTMLElement | null;\n if (!inner) return;\n // Wrap detection: the pill row's top vs the editor's bottom. When the\n // pills sit on (or above) the editor's last line they're NOT wrapped —\n // keep the 8px margin so they don't butt against typed text or the\n // placeholder. This handles the empty-editor + placeholder case\n // naturally: the placeholder still occupies the editor's line box.\n const cRect = inner.getBoundingClientRect();\n const eRect = editor.getBoundingClientRect();\n const wrapped = cRect.top >= eRect.bottom - 2;\n this.zone.run(() => {\n if (wrapped) container.setAttribute(\"data-aia-pill-wrapped\", \"\");\n else container.removeAttribute(\"data-aia-pill-wrapped\");\n });\n }\n}\n\nfunction noop(): void {\n // Default no-op for CVA callbacks.\n}\n\n/**\n * Resolve a concrete light/dark value from the configured mode. Used to seed\n * the `data-mode` attribute synchronously (including during SSR, where\n * ModeController never runs). On the server `window` is undefined → defaults\n * to \"dark\" (matches the vanilla/React behavior).\n */\nfunction resolveInitialMode(mode: AppearanceMode): \"light\" | \"dark\" {\n if (mode !== \"auto\") return mode;\n if (typeof window === \"undefined\") return \"dark\";\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n}\n","<div\n #container\n class=\"magicx-aia magicx-aia-container\"\n [attr.data-pill-placement]=\"pillPlacement\"\n [attr.data-options-position]=\"optionsPosition\"\n [attr.data-animations]=\"animations ? 'on' : 'off'\"\n [attr.data-mode]=\"resolvedMode\"\n>\n <ai-autocomplete-dropdown\n *ngIf=\"controller\"\n [controller]=\"controller\"\n [showPills]=\"showDropdownPills\"\n [showSkipButton]=\"showSkipButton\"\n ></ai-autocomplete-dropdown>\n\n <div\n class=\"magicx-aia-input-wrapper\"\n (click)=\"onWrapperClick($event)\"\n (keyup)=\"$event.stopPropagation()\"\n >\n <div class=\"magicx-aia-editor-area\" data-aia-editor=\"\">\n <div\n #editor\n *ngIf=\"controller\"\n [aiaEditorHost]=\"controller\"\n [autoFocus]=\"autoFocus\"\n class=\"magicx-aia-input\"\n data-aia-input=\"\"\n ></div>\n\n <ng-container *ngIf=\"controller && showInlinePills\">\n <span\n #pillContainer\n class=\"magicx-aia-pill-list-container\"\n data-aia-pill-list-container=\"\"\n *ngIf=\"\n (controller.isLoading$ | async) ||\n ((controller.suggestionPills$ | async)?.length ?? 0) > 0\n \"\n >\n <aia-pill-list\n [pills]=\"(controller.suggestionPills$ | async) ?? []\"\n [activePillIndex]=\"0\"\n [activeSelected]=\"(controller.isActivePillSelected$ | async) ?? false\"\n [loading]=\"(controller.isLoading$ | async) ?? false\"\n (selectPill)=\"onSelectPill($event)\"\n ></aia-pill-list>\n </span>\n </ng-container>\n </div>\n\n <ng-container [ngSwitch]=\"submitButtonState\">\n <aia-submit-button\n *ngSwitchCase=\"'default'\"\n [disabled]=\"\n !(\n controller &&\n canSubmit({\n segments: (controller.segments$ | async) ?? [],\n completedParams: (controller.completedParams$ | async) ?? []\n })\n )\n \"\n (submit)=\"onSubmitButtonClick($event)\"\n ></aia-submit-button>\n\n <span\n *ngSwitchCase=\"'custom'\"\n data-aia-submit=\"\"\n class=\"magicx-aia-submit-slot\"\n (click)=\"onSubmitSlotClick($event)\"\n >\n <ng-container *ngTemplateOutlet=\"customSubmitTemplate\"></ng-container>\n </span>\n </ng-container>\n </div>\n</div>\n","import {\n Directive,\n ElementRef,\n forwardRef,\n Input,\n inject,\n type OnDestroy,\n type OnInit,\n Renderer2,\n} from \"@angular/core\";\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { Subject, takeUntil } from \"rxjs\";\nimport type { AIAutocompleteController } from \"../controller/ai-autocomplete.controller\";\n\n/**\n * Tier 2 input binder. Attach to a `<textarea>` or `<input>` and pass an\n * {@link AIAutocompleteController}:\n *\n * ```html\n * <textarea [aiaInput]=\"ac\"></textarea>\n * ```\n *\n * The directive wires the input's events (input/keydown/focus/blur) to the\n * controller, mirrors controller state into ARIA attributes\n * (`role=\"combobox\"`, `aria-expanded`, `aria-activedescendant`,\n * `aria-autocomplete`, `aria-controls`), and implements\n * {@link ControlValueAccessor} so the host element participates in Reactive\n * Forms out of the box:\n *\n * ```html\n * <textarea [aiaInput]=\"ac\" [formControl]=\"myControl\"></textarea>\n * ```\n *\n * Per the React hook's behavior, the first typed character is auto-capitalized\n * — typing \"h\" becomes \"H\" before being forwarded to the controller. The\n * cursor position is preserved across that rewrite.\n *\n * @public\n */\n@Directive({\n selector: \"[aiaInput]\",\n standalone: true,\n host: {\n role: \"combobox\",\n \"aria-autocomplete\": \"list\",\n \"(input)\": \"onInput($event)\",\n \"(keydown)\": \"onKeyDown($event)\",\n \"(keyup)\": \"onCaretMove()\",\n \"(mouseup)\": \"onCaretMove()\",\n \"(focus)\": \"onFocus()\",\n \"(blur)\": \"onBlur()\",\n },\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n useExisting: forwardRef(() => AIAutocompleteInputDirective),\n multi: true,\n },\n ],\n})\nexport class AIAutocompleteInputDirective implements OnInit, OnDestroy, ControlValueAccessor {\n /**\n * The {@link AIAutocompleteController} that owns the autocomplete state.\n * Required. The directive throws on init if this is missing.\n */\n @Input(\"aiaInput\") controller!: AIAutocompleteController;\n\n private readonly el = inject<ElementRef<HTMLInputElement | HTMLTextAreaElement>>(ElementRef);\n private readonly renderer = inject(Renderer2);\n private readonly destroy$ = new Subject<void>();\n\n private onChangeFn: (value: string) => void = noop;\n private onTouchedFn: () => void = noop;\n // Timestamp of the last `input` event. A `keyup`/`select` that fires within\n // this window is the tail of a keystroke, not a deliberate caret move, so we\n // skip the caret-move handler there (mirrors the editor host's selectionchange\n // guard). performance.now() is monotonic; 0 means \"no input yet\".\n private lastInputAt = 0;\n // Tracks the most-recently-promoted param so we only reposition the caret\n // once per option selection (mirrors the editor host's post-promote refocus).\n private lastSeenParamId = \"\";\n // Holds a value written by Reactive Forms before ngOnInit ran. Reactive\n // Forms can call writeValue() during dynamic form construction (e.g. when\n // a control is patched at the moment the directive is created), and our\n // controller binding may not be initialized yet. We stash the value here\n // and flush it into the controller in ngOnInit *before* subscribing to\n // text$, otherwise text$'s initial \"\" emission would clobber the form\n // value the textarea already shows. `undefined` means \"no pending write\".\n private pendingWriteValue: string | undefined;\n\n ngOnInit(): void {\n if (!this.controller) {\n throw new Error('[aiaInput] requires a controller — use `[aiaInput]=\"myController\"`.');\n }\n\n if (this.pendingWriteValue !== undefined) {\n this.controller.setValue(this.pendingWriteValue);\n this.pendingWriteValue = undefined;\n }\n\n const el = this.el.nativeElement;\n this.renderer.setAttribute(el, \"aria-controls\", this.controller.listboxId);\n\n // Sync editor text → DOM. Skips the write when values already match, so\n // user keystrokes don't fight with our writeback. Preserves the caret\n // position when we do write (and the element still has focus).\n this.controller.text$.pipe(takeUntil(this.destroy$)).subscribe((text) => {\n if (el.value === text) return;\n const wasFocused = typeof document !== \"undefined\" && document.activeElement === el;\n const start = el.selectionStart;\n const end = el.selectionEnd;\n this.renderer.setProperty(el, \"value\", text);\n if (wasFocused && start != null && end != null) {\n const clampedStart = Math.min(start, text.length);\n const clampedEnd = Math.min(end, text.length);\n try {\n el.setSelectionRange(clampedStart, clampedEnd);\n } catch {\n // `setSelectionRange` throws on some input types (e.g. \"number\");\n // safe to ignore — those inputs don't have a meaningful selection.\n }\n }\n });\n\n this.controller.isDropdownOpen$.pipe(takeUntil(this.destroy$)).subscribe((isOpen) => {\n this.renderer.setAttribute(el, \"aria-expanded\", String(isOpen));\n });\n\n this.controller.activeIndex$.pipe(takeUntil(this.destroy$)).subscribe((idx) => {\n if (idx >= 0) {\n this.renderer.setAttribute(\n el,\n \"aria-activedescendant\",\n `${this.controller.listboxId}-option-${idx}`,\n );\n } else {\n this.renderer.removeAttribute(el, \"aria-activedescendant\");\n }\n });\n\n // After an option selection promotes a param, the core appends its text and\n // stamps `caretOffset` at the end of the inserted text. The text$ subscriber\n // above writes the new value but *restores the pre-write caret* (correct for\n // typing echoes, wrong here), so we move the caret to the promoted position.\n // Keyed on newParamId so it fires once per selection, not on every tick.\n // Registered after text$ so the new value is in the DOM before we seek.\n this.controller.newParamId$.pipe(takeUntil(this.destroy$)).subscribe((id) => {\n const current = id ?? \"\";\n if (current && current !== this.lastSeenParamId) {\n this.lastSeenParamId = current;\n const offset = this.controller.getState().caretOffset ?? el.value.length;\n const clamped = Math.min(Math.max(offset, 0), el.value.length);\n // Only grab focus if we don't already have it — don't yank focus back\n // from wherever the user moved it after selecting (e.g. a host-app\n // button). setSelectionRange still positions the caret regardless.\n if (typeof document !== \"undefined\" && document.activeElement !== el) {\n el.focus();\n }\n try {\n el.setSelectionRange(clamped, clamped);\n } catch {\n // Some input types (e.g. \"number\") don't support setSelectionRange.\n }\n } else if (!current) {\n this.lastSeenParamId = \"\";\n }\n });\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n // === Event handlers (wired via host metadata above) ===\n\n /**\n * Auto-capitalizes the first character on the user's first keystroke so the\n * server receives \"Create\" instead of \"create\". Matches React's\n * `handleChange` in `useAIAutocomplete`. Skipped during IME composition so\n * we don't disrupt multi-keystroke input methods (Pinyin, Hangul, etc.).\n */\n onInput(event: Event): void {\n // Stamp the input time before anything else. The autocapitalize path below\n // calls setSelectionRange, which can synchronously fire a `select` event →\n // onCaretMove; stamping first ensures that event falls inside the guard\n // window and is treated as part of this keystroke, not a caret move.\n this.lastInputAt = performance.now();\n const target = event.target as HTMLInputElement | HTMLTextAreaElement;\n const raw = target.value;\n const isComposing = (event as InputEvent).isComposing === true;\n const shouldCapitalize = raw.length > 0 && !isComposing && raw[0] !== raw[0].toUpperCase();\n\n let next = raw;\n if (shouldCapitalize) {\n const start = target.selectionStart;\n const end = target.selectionEnd;\n next = raw[0].toUpperCase() + raw.slice(1);\n this.renderer.setProperty(target, \"value\", next);\n if (start != null && end != null) {\n try {\n target.setSelectionRange(start, end);\n } catch {\n // See note in ngOnInit's text$ subscriber.\n }\n }\n }\n\n this.controller.handleTextChange(next);\n // Sync the real caret into the core. The dropdown's auto-trigger gate only\n // opens when the caret is at the end of the text; without this, the core's\n // `caretOffset` stays pinned at whatever a prior promote/select set it to\n // and goes stale as the user keeps typing, wedging the dropdown closed.\n // selectionStart is null on some input types (number/email/color); treat\n // that as \"caret at end\" rather than feeding null into the core.\n this.controller.handleCaretAfterInput(target.selectionStart ?? target.value.length);\n this.onChangeFn(next);\n }\n\n onKeyDown(event: KeyboardEvent): void {\n this.controller.handleKeyDown(event);\n }\n\n /**\n * Caret moved by something other than typing — arrow keys, Home/End, or a\n * mouse click/drag (keyup + mouseup). Forward the new offset so the core can\n * re-evaluate the caret-at-end dropdown gate (and exit re-edit if the caret\n * left the region). We deliberately do NOT listen for the `select` event:\n * programmatic `setSelectionRange` calls (the text$ writeback, the post-select\n * caret reposition) fire it in jsdom/some browsers, which would re-enter here\n * and clobber `caretOffset`. `keyup`/`mouseup` only fire for real user input.\n * Skipped right after an `input` event, where the caret is already handled by\n * `handleCaretAfterInput` above.\n */\n onCaretMove(): void {\n if (performance.now() - this.lastInputAt < 50) return;\n const el = this.el.nativeElement;\n // selectionStart is null on some input types — treat as caret at end.\n this.controller.handleCaretMove(el.selectionStart ?? el.value.length);\n }\n\n onFocus(): void {\n this.controller.setFocused(true);\n }\n\n onBlur(): void {\n this.controller.setFocused(false);\n this.onTouchedFn();\n }\n\n // === ControlValueAccessor ===\n\n writeValue(value: string | null): void {\n const next = value ?? \"\";\n this.renderer.setProperty(this.el.nativeElement, \"value\", next);\n // If Angular calls writeValue() before ngOnInit (possible during dynamic\n // form construction), queue the value and let ngOnInit flush it. We\n // can't push it into the controller now because either the controller\n // binding hasn't resolved yet, or text$'s initial subscription would\n // overwrite it moments later.\n if (this.controller) {\n this.controller.setValue(next);\n } else {\n this.pendingWriteValue = next;\n }\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChangeFn = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouchedFn = fn;\n }\n\n setDisabledState(disabled: boolean): void {\n this.renderer.setProperty(this.el.nativeElement, \"disabled\", disabled);\n }\n}\n\nfunction noop(): void {\n // Default no-op callback for CVA — overwritten by Angular's form bridge.\n}\n","import { NgModule } from \"@angular/core\";\nimport { AIAutocompleteComponent } from \"./ai-autocomplete/ai-autocomplete.component\";\nimport { AIAutocompleteDropdownComponent } from \"./ai-autocomplete-dropdown/ai-autocomplete-dropdown.component\";\nimport { AIAutocompleteInputDirective } from \"./input/ai-autocomplete-input.directive\";\n\n/**\n * Convenience NgModule that re-exports every public component and directive\n * in this package. Standalone-first consumers can import the individual\n * symbols directly; legacy NgModule-based codebases import this once and\n * get everything.\n *\n * @public\n */\n@NgModule({\n imports: [AIAutocompleteComponent, AIAutocompleteDropdownComponent, AIAutocompleteInputDirective],\n exports: [AIAutocompleteComponent, AIAutocompleteDropdownComponent, AIAutocompleteInputDirective],\n})\nexport class AIAutocompleteModule {}\n","/**\n * Public API surface for @magicx-eng/ai-autocomplete-angular.\n *\n * Populated incrementally as features land. Only symbols re-exported here\n * are considered part of the package's public contract.\n */\n\n// === Re-exported wire types ===\nexport type {\n AccessTokenConfig,\n AccessTokenResult,\n APIConfig,\n APIKeyConfig,\n AppearanceMode,\n AutocompleteResult,\n CompletedParam,\n CompletedParamState,\n OptionOverrides,\n Product,\n ProductsConfig,\n Segment,\n SkippedParamState,\n Suggestion,\n SuggestionOption,\n TaskKind,\n} from \"@magicx-eng/ai-autocomplete-vanilla\";\n// === Submit-result builder (folds skipped params into completed_params) ===\nexport { buildSubmitResult, withSkippedParams } from \"@magicx-eng/ai-autocomplete-vanilla\";\n// === Tier 1: Full component ===\nexport { AIAutocompleteComponent } from \"./lib/ai-autocomplete\";\n// === Convenience NgModule ===\nexport { AIAutocompleteModule } from \"./lib/ai-autocomplete.module\";\n// === Tier 2: Dropdown component ===\nexport { AIAutocompleteDropdownComponent } from \"./lib/ai-autocomplete-dropdown\";\n// === Tier 2: Controller (headless logic class) ===\nexport { AIAutocompleteController } from \"./lib/controller\";\n// === Tier 2: Input binder + ControlValueAccessor ===\nexport { AIAutocompleteInputDirective } from \"./lib/input\";\n// === Angular-specific public types ===\nexport type {\n AIAutocompleteControllerOptions,\n AIAutocompleteControllerState,\n AIAutocompleteControllerUpdate,\n AIAutocompleteDropdownState,\n} from \"./lib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