import * as i0 from '@angular/core';
import { Directive, EventEmitter, inject, Injector, effect, TemplateRef, ElementRef, ViewChild, ContentChild, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
import { MenuTriggerDirective, MenuComponent } from '@fundamental-ngx/core/menu';
import { Subscription, tap } from 'rxjs';
import { first } from 'rxjs/operators';
import { NgClass, NgTemplateOutlet } from '@angular/common';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { ButtonComponent } from '@fundamental-ngx/core/button';
import * as i1 from '@fundamental-ngx/core/content-density';
import { contentDensityObserverProviders } from '@fundamental-ngx/core/content-density';
import { FD_DEFAULT_ICON_FONT_FAMILY } from '@fundamental-ngx/core/icon';
import { FdTranslatePipe } from '@fundamental-ngx/i18n';

/**
 * Directive used to identify the template which will populate the main action button.
 * Used to achieve complex buttons that require more than a string.
 *```html
 *    <fd-button-split>
 *        <ng-template fd-button-split-action-title>
 *            <p>Paragraph 1</p>
 *            <p>Paragraph 2</p>
 *        </ng-template>
 *        <fd-menu>
 *             <li fd-menu-item>
 *               <a fd-menu-interactive [routerLink]="'/'">
 *                   <span fd-menu-title>option2</span>
 *               </a>
 *            </li>
 *            <li fd-menu-item>
 *               <a fd-menu-interactive [routerLink]="'/'">
 *                   <span fd-menu-title>option2</span>
 *               </a>
 *            </li>
 *        </fd-menu>
 *    </fd-button-split>
 *</fd-button-split>
 *```
 */
class SplitButtonActionTitle {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SplitButtonActionTitle, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
    static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: SplitButtonActionTitle, isStandalone: true, selector: "[fd-split-button-action-title]", ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SplitButtonActionTitle, decorators: [{
            type: Directive,
            args: [{
                    // TODO to be discussed
                    // eslint-disable-next-line @angular-eslint/directive-selector
                    selector: '[fd-split-button-action-title]',
                    standalone: true
                }]
        }] });

const splitButtonTextClass = 'fd-button-split__text';
const splitButtonTextClasses = [splitButtonTextClass];
/**
 * Split Button component, used to enhance standard HTML button and add possibility to put some dropdown with
 * additional options.
 *
 * ```html
 * <fd-split-button>
 *   <fd-menu>
 *       <li fd-menu-item>
 *           <div fd-menu-interactive>
 *               <span fd-menu-title>Option 1</span>
 *           </div>
 *       </li>
 *       <li fd-menu-item>
 *           <div fd-menu-interactive>
 *               <span fd-menu-title>Option 2</span>
 *           </div>
 *       </li>
 *    </fd-menu>
 *</fd-split-button>
 * ```
 */
class SplitButtonComponent {
    /** @hidden */
    get typeClass() {
        return this.fdType ? `fd-button-split--${this.fdType}` : '';
    }
    /** @hidden */
    constructor(_cdRef, _destroyRef, _contentDensityObserver, _renderer) {
        this._cdRef = _cdRef;
        this._destroyRef = _destroyRef;
        this._contentDensityObserver = _contentDensityObserver;
        this._renderer = _renderer;
        /** The icon to include in the button. See the icon page for the list of icons. */
        this.glyph = 'slim-arrow-down';
        /** Glyph font family */
        this.glyphFont = FD_DEFAULT_ICON_FONT_FAMILY;
        /** Whether or not the element should keep a fixed width. The width could change if the text changes length. */
        this.fixedWidth = true;
        /** Event sent when primary button is clicked */
        this.primaryButtonClicked = new EventEmitter();
        /** @hidden */
        this._menuItemSubscriptions = new Subscription();
        /** @hidden */
        this._menuSubscription = new Subscription();
        /** @hidden */
        this._contentDensitySubscription = new Subscription();
        /** @hidden */
        this._menuActivePathSubscription = new Subscription();
        /** @hidden */
        this._injector = inject(Injector);
        /** @hidden */
        this._addButtonTextClass = () => {
            const textSpanElement = this.mainActionBtn?.nativeElement.querySelector('.fd-button__text');
            if (!textSpanElement) {
                return;
            }
            splitButtonTextClasses.forEach((_class) => this._renderer.removeClass(textSpanElement, _class));
            this._renderer.addClass(textSpanElement, splitButtonTextClass);
        };
    }
    /** @hidden Emits event when main button is clicked */
    onMainButtonClick(event) {
        this.primaryButtonClicked.emit(event);
        if (this.selected) {
            this.selected.elementRef.nativeElement.click();
        }
        else if (this.mainAction && this.mainAction.callback) {
            this.mainAction.callback();
        }
        event.stopPropagation();
    }
    /** @hidden */
    ngAfterContentInit() {
        this.menu.menuItems.forEach((item) => {
            item.menuInteractive._fromSplitButton = true;
        });
        this._setupMenuSubscription();
        this._setupMenuItemSubscriptions();
        this._handleMainActionObject();
        if (!this.mainActionTitle && !this.titleTemplate && !this.selected) {
            this.selectMenuItem(this.menu.menuItems[0]);
        }
        else if (!this.mainActionTitle && this.selected) {
            this.selectMenuItem(this.selected);
        }
        this._menuActivePathSubscription.add(this.menu.activePath.subscribe((items) => {
            const lastItem = items[items.length - 1];
            if (lastItem && !lastItem.submenu) {
                this.menu.close();
                this._focusTriggerElement();
            }
        }));
    }
    /** @hidden */
    ngAfterViewInit() {
        this._contentDensityObserver.isCompact$
            .pipe(tap(this._addButtonTextClass), takeUntilDestroyed(this._destroyRef))
            .subscribe();
    }
    /** @hidden */
    ngOnChanges(changes) {
        if ('selected' in changes) {
            this.selectMenuItem(this.selected);
        }
        if ('mainAction' in changes) {
            this._handleMainActionObject();
        }
    }
    /** @hidden */
    ngOnDestroy() {
        this._menuItemSubscriptions.unsubscribe();
        this._menuSubscription.unsubscribe();
        this._contentDensitySubscription.unsubscribe();
        this._menuActivePathSubscription.unsubscribe();
    }
    /** Function called to select a menu item for the split button. */
    selectMenuItem(menuItem) {
        if (menuItem && (!this.mainAction || !this.mainAction.keepMainAction)) {
            menuItem.setSelected(true);
        }
    }
    /**
     * Wrapper gets focused programmatically by menu
     * when the "escape" button is pressed.
     * In this case we need to transit focus to the "more actions" button
     */
    _onGroupFocused() {
        this._focusTriggerElement();
    }
    /** @hidden */
    _getMainButtonWidth() {
        if (this.mainActionBtn && this.mainActionBtn.nativeElement) {
            this.mainButtonWidth = this.mainActionBtn.nativeElement.getBoundingClientRect().width + 'px';
        }
    }
    /** @hidden */
    _setupMenuItemSubscriptions() {
        this.menu.menuItems.forEach((menuItem) => {
            menuItem.onSelect.pipe(first()).subscribe(() => {
                if (this.fixedWidth) {
                    this._getMainButtonWidth();
                }
            });
            this._menuItemSubscriptions.add(menuItem.onSelect.subscribe(() => {
                this._handleMenuItemSelection(menuItem);
            }));
        });
    }
    /** @hidden */
    _handleMenuItemSelection(menuItem) {
        if (!this.mainAction || !this.mainAction.keepMainAction) {
            this.selected = menuItem;
            this.menu.menuItems.forEach((item) => {
                item.setSelected(false, true);
            });
            menuItem.setSelected(true, true);
            this.titleTemplate = null;
            this.mainActionTitle = menuItem.menuItemTitle.title;
            this._cdRef.detectChanges();
        }
    }
    /** @hidden */
    _setupMenuSubscription() {
        // React to menu items changes using effect with signal
        effect(() => {
            // Read the signal to track it
            const menuItems = this.menu.menuItems;
            // Only rebuild subscriptions if menu items actually exist
            if (menuItems.length > 0) {
                this._menuItemSubscriptions.unsubscribe();
                this._menuItemSubscriptions.closed = false;
                this._setupMenuItemSubscriptions();
            }
        }, { injector: this._injector });
        // call markForCheck once menu open state gets changed
        this._menuSubscription.add(this.menu.isOpenChange.subscribe(() => this._cdRef.markForCheck()));
    }
    /** @hidden */
    _handleMainActionObject() {
        if (this.mainAction && typeof this.mainAction.mainActionTitle === 'string') {
            this.mainActionTitle = this.mainAction.mainActionTitle;
        }
        else if (this.mainAction && this.mainAction.mainActionTitle instanceof TemplateRef) {
            this.titleTemplate = this.mainAction.mainActionTitle;
        }
    }
    /** @hidden */
    _focusTriggerElement() {
        this.menuActionBtn?.nativeElement.focus();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SplitButtonComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.DestroyRef }, { token: i1.ContentDensityObserver }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.0", type: SplitButtonComponent, isStandalone: true, selector: "fd-split-button", inputs: { glyph: "glyph", glyphFont: "glyphFont", disabled: "disabled", fdType: "fdType", expandButtonTitle: "expandButtonTitle", selected: "selected", fixedWidth: "fixedWidth", mainAction: "mainAction", arialLabel: "arialLabel" }, outputs: { primaryButtonClicked: "primaryButtonClicked" }, providers: [contentDensityObserverProviders()], queries: [{ propertyName: "titleTemplate", first: true, predicate: SplitButtonActionTitle, descendants: true, read: TemplateRef }, { propertyName: "menu", first: true, predicate: MenuComponent, descendants: true }], viewQueries: [{ propertyName: "mainActionBtn", first: true, predicate: ["mainActionButton"], descendants: true, read: ElementRef }, { propertyName: "menuActionBtn", first: true, predicate: ["menuActionButton"], descendants: true, read: ElementRef }], usesOnChanges: true, ngImport: i0, template: "<div\n    class=\"fd-button-split fd-has-margin-right-small\"\n    [ngClass]=\"typeClass\"\n    role=\"group\"\n    tabindex=\"-1\"\n    [attr.aria-label]=\"arialLabel || ('coreSplitButton.arialLabel' | fdTranslate)()\"\n    [fdMenuTrigger]=\"menu\"\n    (focus)=\"_onGroupFocused()\"\n>\n    <button\n        fd-button\n        #mainActionButton\n        [label]=\"mainActionTitle\"\n        [style.width]=\"mainButtonWidth\"\n        [fdType]=\"fdType\"\n        [disabled]=\"disabled\"\n        (click)=\"onMainButtonClick($event)\"\n    >\n        <ng-template [ngTemplateOutlet]=\"titleTemplate\"></ng-template>\n    </button>\n\n    <button\n        fd-button\n        #menuActionButton\n        [glyph]=\"glyph\"\n        [glyphFont]=\"glyphFont\"\n        [fdType]=\"fdType\"\n        [disabled]=\"disabled\"\n        [ariaLabel]=\"('coreSplitButton.expandButtonAriaLabel' | fdTranslate)()\"\n        [attr.title]=\"expandButtonTitle || ('coreSplitButton.expandButtonAriaLabel' | fdTranslate)()\"\n        [class.is-active]=\"menu.isOpen()\"\n    ></button>\n    <ng-content select=\"fd-menu\"></ng-content>\n</div>\n", styles: [".fd-button-split{--fdButtonSplit_Separator_Offset:2.125rem;border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;position:relative;vertical-align:middle}.fd-button-split:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Default_Shadow_Color)}.fd-button-split:after,.fd-button-split:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-button-split:before{background:var(--sapButton_Background);border-radius:var(--sapButton_BorderCornerRadius);-webkit-box-shadow:inset 0 0 0 var(--sapButton_BorderWidth) var(--fdButtonPrioritizedBorderColor,var(--sapButton_BorderColor));box-shadow:inset 0 0 0 var(--sapButton_BorderWidth) var(--fdButtonPrioritizedBorderColor,var(--sapButton_BorderColor));content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split:after{background:var(--sapButton_TextColor);content:\"\";display:var(--fdButton_Menu_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split.is-hover:after,.fd-button-split:hover:after{display:none}.fd-button-split[dir=rtl]:after,[dir=rtl] .fd-button-split:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split>button{margin-block:0;margin-inline:0;--fdButtonPrioritizedBorderColor:var(--fdButton_Split_Border_Color);--fdButtonPrioritizedBackgroundColor:var(--fdButton_Split_Background_Color)}.fd-button-split>button:first-of-type{-webkit-margin-end:var(--fdButton_Menu_Offset);display:-webkit-box;display:-ms-flexbox;display:flex;margin-inline-end:var(--fdButton_Menu_Offset);-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;border-radius:var(--fdButton_Border_Radius_Left);justify-content:flex-start}.fd-button-split>button:first-of-type.is-focus,.fd-button-split>button:first-of-type:focus{z-index:5}.fd-button-split>button:first-of-type.is-focus:after,.fd-button-split>button:first-of-type:focus:after{border-radius:var(--fdButton_Border_Radius_Outline_Left)}.fd-button-split>button:first-of-type[dir=rtl],[dir=rtl] .fd-button-split>button:first-of-type{border-radius:var(--fdButton_Border_Radius_Left_RTL)}.fd-button-split>button:first-of-type[dir=rtl].is-focus,.fd-button-split>button:first-of-type[dir=rtl]:focus,[dir=rtl] .fd-button-split>button:first-of-type.is-focus,[dir=rtl] .fd-button-split>button:first-of-type:focus{z-index:5}.fd-button-split>button:first-of-type[dir=rtl].is-focus:after,.fd-button-split>button:first-of-type[dir=rtl]:focus:after,[dir=rtl] .fd-button-split>button:first-of-type.is-focus:after,[dir=rtl] .fd-button-split>button:first-of-type:focus:after{border-radius:var(--fdButton_Border_Radius_Outline_Left_RTL)}.fd-button-split>button:nth-of-type(2){border-radius:var(--fdButton_Border_Radius_Right)}.fd-button-split>button:nth-of-type(2).is-focus,.fd-button-split>button:nth-of-type(2):focus{z-index:5}.fd-button-split>button:nth-of-type(2).is-focus:after,.fd-button-split>button:nth-of-type(2):focus:after{border-radius:var(--fdButton_Border_Radius_Outline_Right)}.fd-button-split>button:nth-of-type(2)[dir=rtl],[dir=rtl] .fd-button-split>button:nth-of-type(2){border-radius:var(--fdButton_Border_Radius_Right_RTL)}.fd-button-split>button:nth-of-type(2)[dir=rtl].is-focus,.fd-button-split>button:nth-of-type(2)[dir=rtl]:focus,[dir=rtl] .fd-button-split>button:nth-of-type(2).is-focus,[dir=rtl] .fd-button-split>button:nth-of-type(2):focus{z-index:5}.fd-button-split>button:nth-of-type(2)[dir=rtl].is-focus:after,.fd-button-split>button:nth-of-type(2)[dir=rtl]:focus:after,[dir=rtl] .fd-button-split>button:nth-of-type(2).is-focus:after,[dir=rtl] .fd-button-split>button:nth-of-type(2):focus:after{border-radius:var(--fdButton_Border_Radius_Outline_Right_RTL)}.fd-button-split>button.is-hover,.fd-button-split>button:hover{-webkit-box-shadow:none;box-shadow:none;z-index:1}.fd-button-split--emphasized{position:relative}.fd-button-split--emphasized:before{background:var(--sapButton_Emphasized_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--emphasized:after{background:var(--sapButton_Emphasized_TextColor);content:\"\";display:var(--fdButton_Menu_Emphasized_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--emphasized.is-hover:after,.fd-button-split--emphasized:hover:after{display:var(--fdButton_Menu_Emphasized_Hover_Separator_Display)}.fd-button-split--emphasized[dir=rtl]:after,[dir=rtl] .fd-button-split--emphasized:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--emphasized:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Emphasized_Shadow_Color)}.fd-button-split--transparent{position:relative}.fd-button-split--transparent:before{background:var(--sapButton_Lite_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--transparent:after{background:var(--sapButton_Lite_TextColor);content:\"\";display:var(--fdButton_Menu_Transparent_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--transparent[dir=rtl]:after,[dir=rtl] .fd-button-split--transparent:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--transparent:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Transparent_Border_Color)}.fd-button-split--ghost{position:relative}.fd-button-split--ghost:before{background:var(--fdButton_Ghost_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--ghost:after{background:var(--sapButton_TextColor);content:\"\";display:var(--fdButton_Menu_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--ghost[dir=rtl]:after,[dir=rtl] .fd-button-split--ghost:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--ghost:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Transparent_Border_Color)}.fd-button-split--positive{position:relative}.fd-button-split--positive:before{background:var(--sapButton_Accept_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--positive:after{background:var(--sapButton_Accept_TextColor);content:\"\";display:var(--fdButton_Menu_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--positive[dir=rtl]:after,[dir=rtl] .fd-button-split--positive:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--positive:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Positive_Shadow_Color)}.fd-button-split--negative{position:relative}.fd-button-split--negative:before{background:var(--sapButton_Reject_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--negative:after{background:var(--sapButton_Reject_TextColor);content:\"\";display:var(--fdButton_Menu_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--negative[dir=rtl]:after,[dir=rtl] .fd-button-split--negative:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--negative:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Negative_Shadow_Color)}.fd-button-split--attention{position:relative}.fd-button-split--attention:before{background:var(--sapButton_Attention_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--attention:after{background:var(--sapButton_Attention_TextColor);content:\"\";display:var(--fdButton_Menu_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--attention[dir=rtl]:after,[dir=rtl] .fd-button-split--attention:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--attention:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Attention_Shadow_Color)}.fd-button-split .fd-button-split__text{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);color:inherit;display:block;font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;line-height:normal;margin-block:0;margin-inline:0;max-width:var(--fdButtonSplit_Text_Max_Width,8.5rem);overflow:hidden;padding-block:0;padding-inline:0;text-overflow:ellipsis;white-space:nowrap}.fd-button-split .fd-button-split__text:after,.fd-button-split .fd-button-split__text:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-button-split--emphasized>button:first-of-type{-webkit-margin-end:var(--fdButton_Menu_Emphasized_Margin);margin-inline-end:var(--fdButton_Menu_Emphasized_Margin)}.fd-button-split--emphasized .fd-button-split__text{font-family:var(--sapButton_Emphasized_FontFamily);font-weight:400}.fd-button-split[class*=-compact],.fd-button-split[class*=-condensed],[class*=-compact] .fd-button-split:not([class*=-cozy]),[class*=-condensed] .fd-button-split:not([class*=-cozy]){--fdButtonSplit_Text_Max_Width:9rem;--fdButtonSplit_Separator_Offset:1.875rem}\n/*! Bundled license information:\n\nfundamental-styles/dist/button-split.css:\n  (*!\n   * Fundamental Library Styles v0.41.7\n   * Copyright (c) 2026 SAP SE or an SAP affiliate company.\n   * Licensed under Apache License 2.0 (https://github.com/SAP/fundamental-styles/blob/main/LICENSE)\n   *)\n*/\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: MenuTriggerDirective, selector: "[fdMenuTrigger]", inputs: ["fdMenuTrigger"] }, { kind: "component", type: ButtonComponent, selector: "button[fd-button], a[fd-button], span[fd-button]", inputs: ["id"], exportAs: ["fd-button"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: FdTranslatePipe, name: "fdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SplitButtonComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fd-split-button', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [contentDensityObserverProviders()], imports: [NgClass, MenuTriggerDirective, ButtonComponent, NgTemplateOutlet, FdTranslatePipe], template: "<div\n    class=\"fd-button-split fd-has-margin-right-small\"\n    [ngClass]=\"typeClass\"\n    role=\"group\"\n    tabindex=\"-1\"\n    [attr.aria-label]=\"arialLabel || ('coreSplitButton.arialLabel' | fdTranslate)()\"\n    [fdMenuTrigger]=\"menu\"\n    (focus)=\"_onGroupFocused()\"\n>\n    <button\n        fd-button\n        #mainActionButton\n        [label]=\"mainActionTitle\"\n        [style.width]=\"mainButtonWidth\"\n        [fdType]=\"fdType\"\n        [disabled]=\"disabled\"\n        (click)=\"onMainButtonClick($event)\"\n    >\n        <ng-template [ngTemplateOutlet]=\"titleTemplate\"></ng-template>\n    </button>\n\n    <button\n        fd-button\n        #menuActionButton\n        [glyph]=\"glyph\"\n        [glyphFont]=\"glyphFont\"\n        [fdType]=\"fdType\"\n        [disabled]=\"disabled\"\n        [ariaLabel]=\"('coreSplitButton.expandButtonAriaLabel' | fdTranslate)()\"\n        [attr.title]=\"expandButtonTitle || ('coreSplitButton.expandButtonAriaLabel' | fdTranslate)()\"\n        [class.is-active]=\"menu.isOpen()\"\n    ></button>\n    <ng-content select=\"fd-menu\"></ng-content>\n</div>\n", styles: [".fd-button-split{--fdButtonSplit_Separator_Offset:2.125rem;border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;position:relative;vertical-align:middle}.fd-button-split:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Default_Shadow_Color)}.fd-button-split:after,.fd-button-split:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-button-split:before{background:var(--sapButton_Background);border-radius:var(--sapButton_BorderCornerRadius);-webkit-box-shadow:inset 0 0 0 var(--sapButton_BorderWidth) var(--fdButtonPrioritizedBorderColor,var(--sapButton_BorderColor));box-shadow:inset 0 0 0 var(--sapButton_BorderWidth) var(--fdButtonPrioritizedBorderColor,var(--sapButton_BorderColor));content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split:after{background:var(--sapButton_TextColor);content:\"\";display:var(--fdButton_Menu_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split.is-hover:after,.fd-button-split:hover:after{display:none}.fd-button-split[dir=rtl]:after,[dir=rtl] .fd-button-split:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split>button{margin-block:0;margin-inline:0;--fdButtonPrioritizedBorderColor:var(--fdButton_Split_Border_Color);--fdButtonPrioritizedBackgroundColor:var(--fdButton_Split_Background_Color)}.fd-button-split>button:first-of-type{-webkit-margin-end:var(--fdButton_Menu_Offset);display:-webkit-box;display:-ms-flexbox;display:flex;margin-inline-end:var(--fdButton_Menu_Offset);-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:start;-ms-flex-pack:start;border-radius:var(--fdButton_Border_Radius_Left);justify-content:flex-start}.fd-button-split>button:first-of-type.is-focus,.fd-button-split>button:first-of-type:focus{z-index:5}.fd-button-split>button:first-of-type.is-focus:after,.fd-button-split>button:first-of-type:focus:after{border-radius:var(--fdButton_Border_Radius_Outline_Left)}.fd-button-split>button:first-of-type[dir=rtl],[dir=rtl] .fd-button-split>button:first-of-type{border-radius:var(--fdButton_Border_Radius_Left_RTL)}.fd-button-split>button:first-of-type[dir=rtl].is-focus,.fd-button-split>button:first-of-type[dir=rtl]:focus,[dir=rtl] .fd-button-split>button:first-of-type.is-focus,[dir=rtl] .fd-button-split>button:first-of-type:focus{z-index:5}.fd-button-split>button:first-of-type[dir=rtl].is-focus:after,.fd-button-split>button:first-of-type[dir=rtl]:focus:after,[dir=rtl] .fd-button-split>button:first-of-type.is-focus:after,[dir=rtl] .fd-button-split>button:first-of-type:focus:after{border-radius:var(--fdButton_Border_Radius_Outline_Left_RTL)}.fd-button-split>button:nth-of-type(2){border-radius:var(--fdButton_Border_Radius_Right)}.fd-button-split>button:nth-of-type(2).is-focus,.fd-button-split>button:nth-of-type(2):focus{z-index:5}.fd-button-split>button:nth-of-type(2).is-focus:after,.fd-button-split>button:nth-of-type(2):focus:after{border-radius:var(--fdButton_Border_Radius_Outline_Right)}.fd-button-split>button:nth-of-type(2)[dir=rtl],[dir=rtl] .fd-button-split>button:nth-of-type(2){border-radius:var(--fdButton_Border_Radius_Right_RTL)}.fd-button-split>button:nth-of-type(2)[dir=rtl].is-focus,.fd-button-split>button:nth-of-type(2)[dir=rtl]:focus,[dir=rtl] .fd-button-split>button:nth-of-type(2).is-focus,[dir=rtl] .fd-button-split>button:nth-of-type(2):focus{z-index:5}.fd-button-split>button:nth-of-type(2)[dir=rtl].is-focus:after,.fd-button-split>button:nth-of-type(2)[dir=rtl]:focus:after,[dir=rtl] .fd-button-split>button:nth-of-type(2).is-focus:after,[dir=rtl] .fd-button-split>button:nth-of-type(2):focus:after{border-radius:var(--fdButton_Border_Radius_Outline_Right_RTL)}.fd-button-split>button.is-hover,.fd-button-split>button:hover{-webkit-box-shadow:none;box-shadow:none;z-index:1}.fd-button-split--emphasized{position:relative}.fd-button-split--emphasized:before{background:var(--sapButton_Emphasized_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--emphasized:after{background:var(--sapButton_Emphasized_TextColor);content:\"\";display:var(--fdButton_Menu_Emphasized_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--emphasized.is-hover:after,.fd-button-split--emphasized:hover:after{display:var(--fdButton_Menu_Emphasized_Hover_Separator_Display)}.fd-button-split--emphasized[dir=rtl]:after,[dir=rtl] .fd-button-split--emphasized:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--emphasized:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Emphasized_Shadow_Color)}.fd-button-split--transparent{position:relative}.fd-button-split--transparent:before{background:var(--sapButton_Lite_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--transparent:after{background:var(--sapButton_Lite_TextColor);content:\"\";display:var(--fdButton_Menu_Transparent_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--transparent[dir=rtl]:after,[dir=rtl] .fd-button-split--transparent:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--transparent:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Transparent_Border_Color)}.fd-button-split--ghost{position:relative}.fd-button-split--ghost:before{background:var(--fdButton_Ghost_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--ghost:after{background:var(--sapButton_TextColor);content:\"\";display:var(--fdButton_Menu_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--ghost[dir=rtl]:after,[dir=rtl] .fd-button-split--ghost:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--ghost:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Transparent_Border_Color)}.fd-button-split--positive{position:relative}.fd-button-split--positive:before{background:var(--sapButton_Accept_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--positive:after{background:var(--sapButton_Accept_TextColor);content:\"\";display:var(--fdButton_Menu_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--positive[dir=rtl]:after,[dir=rtl] .fd-button-split--positive:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--positive:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Positive_Shadow_Color)}.fd-button-split--negative{position:relative}.fd-button-split--negative:before{background:var(--sapButton_Reject_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--negative:after{background:var(--sapButton_Reject_TextColor);content:\"\";display:var(--fdButton_Menu_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--negative[dir=rtl]:after,[dir=rtl] .fd-button-split--negative:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--negative:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Negative_Shadow_Color)}.fd-button-split--attention{position:relative}.fd-button-split--attention:before{background:var(--sapButton_Attention_Background);border-radius:var(--sapButton_BorderCornerRadius);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.fd-button-split--attention:after{background:var(--sapButton_Attention_TextColor);content:\"\";display:var(--fdButton_Menu_Separator_Display);height:var(--fdButton_Menu_Transparent_Separator_Height);margin-block:0;margin-inline:.125rem;position:absolute;right:var(--fdButtonSplit_Separator_Offset);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:var(--sapButton_BorderWidth);z-index:10}.fd-button-split--attention[dir=rtl]:after,[dir=rtl] .fd-button-split--attention:after{left:var(--fdButtonSplit_Separator_Offset);right:auto}.fd-button-split--attention:before{--fdButtonPrioritizedBorderColor:var(--fdButton_Menu_Attention_Shadow_Color)}.fd-button-split .fd-button-split__text{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);color:inherit;display:block;font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;line-height:normal;margin-block:0;margin-inline:0;max-width:var(--fdButtonSplit_Text_Max_Width,8.5rem);overflow:hidden;padding-block:0;padding-inline:0;text-overflow:ellipsis;white-space:nowrap}.fd-button-split .fd-button-split__text:after,.fd-button-split .fd-button-split__text:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-button-split--emphasized>button:first-of-type{-webkit-margin-end:var(--fdButton_Menu_Emphasized_Margin);margin-inline-end:var(--fdButton_Menu_Emphasized_Margin)}.fd-button-split--emphasized .fd-button-split__text{font-family:var(--sapButton_Emphasized_FontFamily);font-weight:400}.fd-button-split[class*=-compact],.fd-button-split[class*=-condensed],[class*=-compact] .fd-button-split:not([class*=-cozy]),[class*=-condensed] .fd-button-split:not([class*=-cozy]){--fdButtonSplit_Text_Max_Width:9rem;--fdButtonSplit_Separator_Offset:1.875rem}\n/*! Bundled license information:\n\nfundamental-styles/dist/button-split.css:\n  (*!\n   * Fundamental Library Styles v0.41.7\n   * Copyright (c) 2026 SAP SE or an SAP affiliate company.\n   * Licensed under Apache License 2.0 (https://github.com/SAP/fundamental-styles/blob/main/LICENSE)\n   *)\n*/\n"] }]
        }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.DestroyRef }, { type: i1.ContentDensityObserver }, { type: i0.Renderer2 }], propDecorators: { glyph: [{
                type: Input
            }], glyphFont: [{
                type: Input
            }], disabled: [{
                type: Input
            }], fdType: [{
                type: Input
            }], expandButtonTitle: [{
                type: Input
            }], selected: [{
                type: Input
            }], fixedWidth: [{
                type: Input
            }], mainAction: [{
                type: Input
            }], arialLabel: [{
                type: Input
            }], primaryButtonClicked: [{
                type: Output
            }], titleTemplate: [{
                type: ContentChild,
                args: [SplitButtonActionTitle, { read: TemplateRef }]
            }], menu: [{
                type: ContentChild,
                args: [MenuComponent]
            }], mainActionBtn: [{
                type: ViewChild,
                args: ['mainActionButton', { read: ElementRef }]
            }], menuActionBtn: [{
                type: ViewChild,
                args: ['menuActionButton', { read: ElementRef }]
            }] } });

/**
 * @deprecated
 * Use individual component imports.
 */
class SplitButtonModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SplitButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.0", ngImport: i0, type: SplitButtonModule, imports: [SplitButtonComponent, SplitButtonActionTitle], exports: [SplitButtonComponent, SplitButtonActionTitle] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SplitButtonModule, imports: [SplitButtonComponent] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SplitButtonModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [SplitButtonComponent, SplitButtonActionTitle],
                    exports: [SplitButtonComponent, SplitButtonActionTitle]
                }]
        }] });

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

export { SplitButtonActionTitle, SplitButtonComponent, SplitButtonModule, splitButtonTextClass };
//# sourceMappingURL=fundamental-ngx-core-split-button.mjs.map
