import { AsyncPipe, NgIf } from '@angular/common';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { TuiAutoFocus } from '@taiga-ui/cdk/directives/auto-focus';
import { TUI_IS_MOBILE } from '@taiga-ui/cdk/tokens';
import { tuiCreateToken } from '@taiga-ui/cdk/utils/miscellaneous';
import { TuiButton } from '@taiga-ui/core/components/button';
import { TUI_CONFIRM_WORDS } from '@taiga-ui/kit/tokens';
import { injectContext, PolymorpheusComponent, PolymorpheusOutlet, } from '@taiga-ui/polymorpheus';
import * as i0 from "@angular/core";
// TODO: Remove selector in v5
class TuiConfirm {
    constructor() {
        this.isMobile = inject(TUI_IS_MOBILE);
        this.words$ = inject(TUI_CONFIRM_WORDS);
        this.context = injectContext();
    }
    get appearance() {
        return this.isMobile ? 'secondary' : 'flat';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiConfirm, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiConfirm, isStandalone: true, selector: "tui-confirm", ngImport: i0, template: "<p\n    *polymorpheusOutlet=\"context.data?.content as text; context: context\"\n    class=\"t-content\"\n    [innerHTML]=\"text\"\n></p>\n<footer\n    *ngIf=\"words$ | async as words\"\n    class=\"t-buttons\"\n>\n    <button\n        size=\"m\"\n        tuiButton\n        type=\"button\"\n        class=\"t-button\"\n        [appearance]=\"appearance\"\n        (click)=\"context.completeWith(false)\"\n    >\n        {{ context.data?.no || words.no }}\n    </button>\n    <button\n        size=\"m\"\n        tuiAutoFocus\n        tuiButton\n        type=\"button\"\n        class=\"t-button\"\n        [appearance]=\"context.data?.appearance || 'primary'\"\n        (click)=\"context.completeWith(true)\"\n    >\n        {{ context.data?.yes || words.yes }}\n    </button>\n</footer>\n", styles: [":host{display:block}.t-content:not(:empty){margin-block-end:.875rem;overflow-wrap:break-word}.t-buttons{display:flex;justify-content:flex-end;flex-wrap:wrap-reverse;margin:.375rem -.375rem -.375rem}.t-button{margin:.375rem;white-space:nowrap}:host-context(tui-root._mobile) .t-button{flex:1;overflow:visible}:host-context(tui-dialog[new]){margin-block-start:-.75rem}:host-context(tui-dialog[new]) .t-button{margin:0}:host-context(tui-dialog[new]) .t-buttons{margin-block-end:0;margin-inline-end:0;margin-inline-start:0}:host-context(tui-dialog[new]) .t-buttons:first-child{margin-block-start:2rem}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "directive", type: TuiAutoFocus, selector: "[tuiAutoFocus]", inputs: ["tuiAutoFocus"] }, { kind: "directive", type: TuiButton, selector: "a[tuiButton],button[tuiButton],a[tuiIconButton],button[tuiIconButton]", inputs: ["size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
export { TuiConfirm };
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiConfirm, decorators: [{
            type: Component,
            args: [{ standalone: true, selector: 'tui-confirm', imports: [AsyncPipe, NgIf, PolymorpheusOutlet, TuiAutoFocus, TuiButton], changeDetection: ChangeDetectionStrategy.OnPush, template: "<p\n    *polymorpheusOutlet=\"context.data?.content as text; context: context\"\n    class=\"t-content\"\n    [innerHTML]=\"text\"\n></p>\n<footer\n    *ngIf=\"words$ | async as words\"\n    class=\"t-buttons\"\n>\n    <button\n        size=\"m\"\n        tuiButton\n        type=\"button\"\n        class=\"t-button\"\n        [appearance]=\"appearance\"\n        (click)=\"context.completeWith(false)\"\n    >\n        {{ context.data?.no || words.no }}\n    </button>\n    <button\n        size=\"m\"\n        tuiAutoFocus\n        tuiButton\n        type=\"button\"\n        class=\"t-button\"\n        [appearance]=\"context.data?.appearance || 'primary'\"\n        (click)=\"context.completeWith(true)\"\n    >\n        {{ context.data?.yes || words.yes }}\n    </button>\n</footer>\n", styles: [":host{display:block}.t-content:not(:empty){margin-block-end:.875rem;overflow-wrap:break-word}.t-buttons{display:flex;justify-content:flex-end;flex-wrap:wrap-reverse;margin:.375rem -.375rem -.375rem}.t-button{margin:.375rem;white-space:nowrap}:host-context(tui-root._mobile) .t-button{flex:1;overflow:visible}:host-context(tui-dialog[new]){margin-block-start:-.75rem}:host-context(tui-dialog[new]) .t-button{margin:0}:host-context(tui-dialog[new]) .t-buttons{margin-block-end:0;margin-inline-end:0;margin-inline-start:0}:host-context(tui-dialog[new]) .t-buttons:first-child{margin-block-start:2rem}\n"] }]
        }] });
export const TUI_CONFIRM = new PolymorpheusComponent(TuiConfirm);
export const TUI_CONFIRM_DIALOG = tuiCreateToken(TUI_CONFIRM);
//# sourceMappingURL=data:application/json;base64, 