import * as i0 from '@angular/core';
import { inject, input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
import { TranslatePipe } from '@ngx-translate/core';
import { ZIconComponent } from '@shival99/z-ui/components/z-icon';
import { ZTranslateService } from '@shival99/z-ui/services';
import { zMergeClasses } from '@shival99/z-ui/utils';
import { cva } from 'class-variance-authority';

const zEmptyContainerVariants = cva('col-span-full flex flex-col items-center justify-center px-2', {
    variants: {
        zSize: {
            sm: 'py-8',
            default: 'py-12',
            lg: 'py-16',
        },
        zType: {
            empty: '',
            error: 'bg-destructive/5 rounded-lg border border-destructive/20',
        },
    },
    defaultVariants: {
        zSize: 'default',
        zType: 'empty',
    },
});
const zEmptyIconVariants = cva('text-center', {
    variants: {
        zSize: {
            sm: 'mb-2',
            default: 'mb-4',
            lg: 'mb-6',
        },
        zType: {
            empty: 'text-muted-foreground/50',
            error: 'text-destructive/70',
        },
    },
    defaultVariants: {
        zSize: 'default',
        zType: 'empty',
    },
});
const zEmptyMessageVariants = cva('text-center font-medium', {
    variants: {
        zSize: {
            sm: 'text-xs',
            default: 'text-sm',
            lg: 'text-base',
        },
        zType: {
            empty: 'text-muted-foreground',
            error: 'text-destructive',
        },
    },
    defaultVariants: {
        zSize: 'default',
        zType: 'empty',
    },
});
const zEmptyDescriptionVariants = cva('mt-1.5 text-center', {
    variants: {
        zSize: {
            sm: 'text-xs',
            default: 'text-xs',
            lg: 'text-sm',
        },
        zType: {
            empty: 'text-muted-foreground/70',
            error: 'text-destructive/60',
        },
    },
    defaultVariants: {
        zSize: 'default',
        zType: 'empty',
    },
});

const ERROR_ICON = 'lucideServerCrash';
const ERROR_MESSAGE_KEY = 'i18n_z_ui_empty_error_message';
const ERROR_DESCRIPTION_KEY = 'i18n_z_ui_empty_error_description';
class ZEmptyComponent {
    _translate = inject(ZTranslateService);
    class = input('', ...(ngDevMode ? [{ debugName: "class" }] : []));
    zType = input('empty', ...(ngDevMode ? [{ debugName: "zType" }] : []));
    zIcon = input('lucidePackageOpen', ...(ngDevMode ? [{ debugName: "zIcon" }] : []));
    zIconSize = input('40', ...(ngDevMode ? [{ debugName: "zIconSize" }] : []));
    zSize = input('default', ...(ngDevMode ? [{ debugName: "zSize" }] : []));
    zMessage = input('', ...(ngDevMode ? [{ debugName: "zMessage" }] : []));
    zDescription = input('', ...(ngDevMode ? [{ debugName: "zDescription" }] : []));
    containerClasses = computed(() => zMergeClasses(zEmptyContainerVariants({ zSize: this.zSize(), zType: this.zType() }), this.class()), ...(ngDevMode ? [{ debugName: "containerClasses" }] : []));
    iconClasses = computed(() => zEmptyIconVariants({ zSize: this.zSize(), zType: this.zType() }), ...(ngDevMode ? [{ debugName: "iconClasses" }] : []));
    messageClasses = computed(() => zEmptyMessageVariants({ zSize: this.zSize(), zType: this.zType() }), ...(ngDevMode ? [{ debugName: "messageClasses" }] : []));
    descriptionClasses = computed(() => zEmptyDescriptionVariants({ zSize: this.zSize(), zType: this.zType() }), ...(ngDevMode ? [{ debugName: "descriptionClasses" }] : []));
    displayIcon = computed(() => {
        if (this.zType() === 'error') {
            return ERROR_ICON;
        }
        return this.zIcon();
    }, ...(ngDevMode ? [{ debugName: "displayIcon" }] : []));
    displayMessage = computed(() => {
        this._translate.currentLang();
        const type = this.zType();
        const message = this.zMessage();
        if (type === 'error') {
            return this._translate.instant(ERROR_MESSAGE_KEY);
        }
        if (message) {
            return message;
        }
        return this._translate.instant('i18n_z_ui_empty_no_data');
    }, ...(ngDevMode ? [{ debugName: "displayMessage" }] : []));
    displayDescription = computed(() => {
        this._translate.currentLang();
        const type = this.zType();
        const description = this.zDescription();
        if (type === 'error') {
            return this._translate.instant(ERROR_DESCRIPTION_KEY);
        }
        return description;
    }, ...(ngDevMode ? [{ debugName: "displayDescription" }] : []));
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZEmptyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.9", type: ZEmptyComponent, isStandalone: true, selector: "z-empty", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, zType: { classPropertyName: "zType", publicName: "zType", isSignal: true, isRequired: false, transformFunction: null }, zIcon: { classPropertyName: "zIcon", publicName: "zIcon", isSignal: true, isRequired: false, transformFunction: null }, zIconSize: { classPropertyName: "zIconSize", publicName: "zIconSize", isSignal: true, isRequired: false, transformFunction: null }, zSize: { classPropertyName: "zSize", publicName: "zSize", isSignal: true, isRequired: false, transformFunction: null }, zMessage: { classPropertyName: "zMessage", publicName: "zMessage", isSignal: true, isRequired: false, transformFunction: null }, zDescription: { classPropertyName: "zDescription", publicName: "zDescription", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "z-empty" }, ngImport: i0, template: "<div [class]=\"containerClasses()\">\n  <z-icon [zType]=\"displayIcon()\" [zSize]=\"zIconSize()\" [class]=\"iconClasses()\" />\n  <p [class]=\"messageClasses()\">{{ displayMessage() | translate }}</p>\n  @if (displayDescription()) {\n    <p [class]=\"descriptionClasses()\">{{ displayDescription() | translate }}</p>\n  }\n  <ng-content />\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: ZIconComponent, selector: "z-icon, [z-icon]", inputs: ["class", "zType", "zAnimatedType", "zAnimate", "zAnimationTrigger", "zSize", "zStrokeWidth", "zSvg"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: ZEmptyComponent, decorators: [{
            type: Component,
            args: [{ selector: 'z-empty', imports: [ZIconComponent, TranslatePipe], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
                        class: 'z-empty',
                    }, template: "<div [class]=\"containerClasses()\">\n  <z-icon [zType]=\"displayIcon()\" [zSize]=\"zIconSize()\" [class]=\"iconClasses()\" />\n  <p [class]=\"messageClasses()\">{{ displayMessage() | translate }}</p>\n  @if (displayDescription()) {\n    <p [class]=\"descriptionClasses()\">{{ displayDescription() | translate }}</p>\n  }\n  <ng-content />\n</div>\n" }]
        }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], zType: [{ type: i0.Input, args: [{ isSignal: true, alias: "zType", required: false }] }], zIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "zIcon", required: false }] }], zIconSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "zIconSize", required: false }] }], zSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "zSize", required: false }] }], zMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "zMessage", required: false }] }], zDescription: [{ type: i0.Input, args: [{ isSignal: true, alias: "zDescription", required: false }] }] } });

/**
 * Generated bundle index. Do not edit.
 */

export { ZEmptyComponent, zEmptyContainerVariants, zEmptyDescriptionVariants, zEmptyIconVariants, zEmptyMessageVariants };
//# sourceMappingURL=shival99-z-ui-components-z-empty.mjs.map
