import * as i7 from '@acorex/cdk/list-navigation';
import { AXListNavigationDirective, AXListNavigationItemDirective, AXListNavigationModule } from '@acorex/cdk/list-navigation';
import * as i2$1 from '@acorex/components/button';
import { AXButtonModule } from '@acorex/components/button';
import { AXChipsModule } from '@acorex/components/chips';
import * as i4 from '@acorex/cdk/common';
import { AXCommonModule } from '@acorex/cdk/common';
import * as i1 from '@acorex/components/decorators';
import { AXDecoratorModule } from '@acorex/components/decorators';
import { AXBasePageComponent } from '@acorex/components/page';
import * as i3$1 from '@acorex/components/search-box';
import { AXSearchBoxComponent, AXSearchBoxModule } from '@acorex/components/search-box';
import * as i9 from '@acorex/components/skeleton';
import { AXSkeletonModule } from '@acorex/components/skeleton';
import * as i4$1 from '@acorex/core/translation';
import { AXTranslationModule } from '@acorex/core/translation';
import { AXPThemeLayoutBlockComponent, AXPThemeLayoutListComponent, AXPThemeLayoutListItemComponent, AXPThemeLayoutListItemsGroupComponent, AXPThemeLayoutHeaderComponent, AXPStateMessageComponent } from '@acorex/platform/layout/components';
import * as i3 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { inject, viewChild, viewChildren, ChangeDetectionStrategy, Component } from '@angular/core';
import * as i2 from '@angular/forms';
import { FormsModule } from '@angular/forms';
import { first } from 'rxjs';
import { AXPGlobalSearchViewModel } from './acorex-modules-common.mjs';

class AXPGlobalSearchPopupComponent extends AXBasePageComponent {
    constructor() {
        super(...arguments);
        this.i18nScope = 'global-search';
        this.vm = inject(AXPGlobalSearchViewModel);
        this.text = null;
        this.list = viewChild(AXListNavigationDirective, ...(ngDevMode ? [{ debugName: "list" }] : []));
        this.searchBox = viewChild(AXSearchBoxComponent, ...(ngDevMode ? [{ debugName: "searchBox" }] : []));
        this.items = viewChildren(AXListNavigationItemDirective, ...(ngDevMode ? [{ debugName: "items" }] : []));
    }
    async handleTextChanged(e) {
        if (e.isUserInteraction) {
            await this.vm.search(e.value);
        }
    }
    ngOnInit() {
        super.ngOnInit();
        //
        this.vm.onItemSelected.pipe(first()).subscribe((item) => {
            this.close(item);
        });
    }
    handleSearchKeyDown(e) {
        const event = e.nativeEvent;
        switch (event.code) {
            case 'ArrowDown':
                const item = this.items()[0];
                if (item && this.list()) {
                    this.list()?.navigateTo(item);
                }
                event.preventDefault();
                event.stopPropagation();
                break;
        }
    }
    handleClearClick($event) {
        this.vm.clearRecentItems();
    }
    handleListKeyDown(e) {
        switch (e.code) {
            case 'ArrowUp': {
                const item = this.items()[0];
                if (item && this.list() && item.isActive()) {
                    this.searchBox()?.focus();
                }
                break;
            }
            case 'Escape': {
                this.searchBox()?.focus();
                e.preventDefault();
                e.stopPropagation();
                break;
            }
        }
    }
    handleItemKeyDown(e, item) {
        switch (e.code) {
            case 'Enter':
            case 'Space': {
                e.preventDefault();
                e.stopPropagation();
                this.vm.execute(item);
                break;
            }
        }
    }
    handlePinClick(e, item) {
        e.stopPropagation();
        this.vm.togglePin(item);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPGlobalSearchPopupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: AXPGlobalSearchPopupComponent, isStandalone: true, selector: "ng-component", providers: [AXPGlobalSearchViewModel], viewQueries: [{ propertyName: "list", first: true, predicate: AXListNavigationDirective, descendants: true, isSignal: true }, { propertyName: "searchBox", first: true, predicate: AXSearchBoxComponent, descendants: true, isSignal: true }, { propertyName: "items", predicate: AXListNavigationItemDirective, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<axp-layout-content *translate=\"let t\">\n  <axp-layout-header class=\"ax-lg\">\n    <ax-search-box\n      [axAutoFocus]\n      [look]=\"'none'\"\n      [ngModel]=\"vm.text()\"\n      (onValueChanged)=\"handleTextChanged($event)\"\n      [placeholder]=\"t('search-anything', { scope: i18nScope }) | async\"\n      (onKeyDown)=\"handleSearchKeyDown($event)\"\n    ></ax-search-box>\n    <div class=\"__close-button\">\n      <ax-button [look]=\"'blank'\" class=\"ax-rounded-full\" (onClick)=\"close()\">\n        <ax-icon icon=\"fa-light fa-xmark fa-sm\"></ax-icon>\n      </ax-button>\n    </div>\n  </axp-layout-header>\n\n  <!-- Results Area -->\n  <axp-layout-body>\n    @if (vm.isBusy()) {\n      <ng-container *ngTemplateOutlet=\"skeleton\"></ng-container>\n    } @else if (vm.isEmpty()) {\n      <ng-container *ngTemplateOutlet=\"empty\"></ng-container>\n    } @else if (vm.isWelcome()) {\n      <ng-container *ngTemplateOutlet=\"welcome\"></ng-container>\n    } @else if (vm.isStart()) {\n      <ng-container *ngTemplateOutlet=\"start\"></ng-container>\n    } @else {\n      <ng-container *ngTemplateOutlet=\"result\"></ng-container>\n    }\n  </axp-layout-body>\n\n  <!-- Skeleton Template -->\n  <ng-template #skeleton>\n    <div class=\"ax-flex ax-flex-col ax-gap-10 ax-p-8\">\n      @for (item of [1, 2, 3, 4, 5]; track $index) {\n        <div class=\"ax-flex ax-items-center ax-gap-4\">\n          <ax-skeleton [animated]=\"true\" class=\"ax-w-4 ax-h-4 ax-rounded-full\"></ax-skeleton>\n          <div class=\"ax-flex ax-flex-col ax-gap-2 ax-flex-1\">\n            <ax-skeleton [animated]=\"true\" class=\"ax-w-1/4 ax-h-2 ax-rounded\"></ax-skeleton>\n            <ax-skeleton [animated]=\"true\" class=\"ax-w-1/2 ax-h-2 ax-rounded\"></ax-skeleton>\n          </div>\n        </div>\n      }\n    </div>\n  </ng-template>\n\n  <!-- Empty Template -->\n  <ng-template #empty>\n    <axp-state-message\n      icon=\"fa-light fa-search\"\n      [title]=\"'@global-search:no-result.title'\"\n      [description]=\"'@global-search:no-result.message'\"\n    >\n    </axp-state-message>\n  </ng-template>\n\n  <!-- Welcome Template -->\n  <ng-template #welcome>\n    <axp-state-message\n      icon=\"fa-light fa-search\"\n      [title]=\"'@global-search:start.title'\"\n      [description]=\"'@global-search:start.message'\"\n    >\n    </axp-state-message>\n  </ng-template>\n\n  <!-- Start Template -->\n  <ng-template #start>\n    <!-- Pinned Items -->\n    <axp-layout-list\n      *translate=\"let t\"\n      class=\"ax-p-4 ax-divide-none\"\n      (keydown)=\"handleListKeyDown($event)\"\n      axListNavigation\n      #list=\"axListNavigation\"\n    >\n      @if (vm.pinnedItems().length > 0) {\n        <axp-layout-list-group>\n          <axp-layout-title>{{ t('pinned', { scope: i18nScope }) | async }}</axp-layout-title>\n          @for (item of vm.pinnedItems(); track $index) {\n            <axp-layout-list-item\n              (click)=\"vm.execute(item)\"\n              (keydown)=\"handleItemKeyDown($event, item)\"\n              class=\"ax-group\"\n              axListNavigationItem\n              #i=\"axListNavigationItem\"\n              [class.axp-state-focused]=\"i.isActive()\"\n            >\n              <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n            </axp-layout-list-item>\n          }\n        </axp-layout-list-group>\n      }\n      <!-- Recent Items -->\n      @if (vm.recentItems().length > 0) {\n        <axp-layout-list-group>\n          <axp-layout-header>\n            <axp-layout-prefix>\n              <axp-layout-title>{{ t('recent', { scope: i18nScope }) | async }}</axp-layout-title>\n            </axp-layout-prefix>\n            <axp-layout-prefix class=\"ax-xs\">\n              <ax-button\n                [text]=\"t('clear', { scope: i18nScope }) | async\"\n                look=\"blank\"\n                [color]=\"'default'\"\n                (onClick)=\"handleClearClick($event)\"\n              ></ax-button>\n            </axp-layout-prefix>\n          </axp-layout-header>\n          @for (item of vm.recentItems(); track $index) {\n            <axp-layout-list-item\n              (click)=\"vm.execute(item)\"\n              (keydown)=\"handleItemKeyDown($event, item)\"\n              class=\"ax-group\"\n              axListNavigationItem\n              #i=\"axListNavigationItem\"\n              [class.axp-state-focused]=\"i.isActive()\"\n            >\n              <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n            </axp-layout-list-item>\n          }\n        </axp-layout-list-group>\n      }\n    </axp-layout-list>\n  </ng-template>\n\n  <!-- Result Template -->\n  <ng-template #result>\n    <axp-layout-list\n      class=\"ax-p-4 ax-divide-none\"\n      (keydown)=\"handleListKeyDown($event)\"\n      axListNavigation\n      #list=\"axListNavigation\"\n    >\n      @for (group of vm.results(); track $index) {\n        <axp-layout-list-group>\n          <axp-layout-title> {{ t(group.title) | async }}</axp-layout-title>\n          @for (item of group.children; track $index) {\n            <axp-layout-list-item\n              (click)=\"vm.execute(item)\"\n              (keydown)=\"handleItemKeyDown($event, item)\"\n              class=\"ax-group\"\n              axListNavigationItem\n              #i=\"axListNavigationItem\"\n              [class.axp-state-focused]=\"i.isActive()\"\n            >\n              <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n            </axp-layout-list-item>\n          }\n        </axp-layout-list-group>\n      }\n    </axp-layout-list>\n  </ng-template>\n\n  <ng-template #listItem let-item=\"item\">\n    <axp-layout-prefix>\n      <ax-icon icon=\"fal {{ item.icon }}\"></ax-icon>\n    </axp-layout-prefix>\n    <axp-layout-content>\n      <axp-layout-title class=\"ax-group\">\n        <span>{{ t(item.title) | async }}</span>\n        <span class=\"ax-ms-3\" (click)=\"handlePinClick($event, item)\">\n          <i\n            [class.ax-invisible]=\"!vm.isPinned(item)\"\n            class=\"fa-light fa-thumbtack ax-rotate-45 group-hover:!ax-visible\"\n            [class.fa-solid]=\"vm.isPinned(item)\"\n          ></i>\n        </span>\n      </axp-layout-title>\n      @if (item.parent) {\n        <axp-layout-description>\n          {{ t(item.parent.title) | async }}\n        </axp-layout-description>\n      } @else if (item.description) {\n        <axp-layout-description>\n          {{ t(item.description) | async }}\n        </axp-layout-description>\n      }\n    </axp-layout-content>\n    <axp-layout-suffix>\n      <i class=\"far fa-chevron-right rtl:ax-rotate-180\"></i>\n    </axp-layout-suffix>\n  </ng-template>\n</axp-layout-content>\n", styles: [":host .ax-editor-container:focus-within{outline-style:none}:host>axp-layout-content{display:flex;flex-direction:column;background-color:rgb(var(--ax-sys-color-lightest-surface));color:rgb(var(--ax-sys-color-on-lightest-surface));border-color:rgb(var(--ax-sys-color-border-lightest-surface));width:90vw;max-width:36rem}@media (min-width: 640px){:host>axp-layout-content{width:80vw}}@media (min-width: 768px){:host>axp-layout-content{width:60vw}}@media (min-width: 1024px){:host>axp-layout-content{width:40vw}}@media (min-width: 1280px){:host>axp-layout-content{width:30vw}}:host>axp-layout-content>axp-layout-header{display:flex;flex-direction:row;align-items:center;justify-content:space-between;border-bottom-width:1px;background-color:rgb(var(--ax-sys-color-lighter-surface));color:rgb(var(--ax-sys-color-on-lighter-surface));border-color:rgb(var(--ax-sys-color-border-lighter-surface))}:host>axp-layout-content>axp-layout-header>.__close-button{position:absolute;inset-inline-end:1rem;top:1rem;--ax-sys-size-base: 2rem}:host>axp-layout-content>axp-layout-body{display:flex;flex-direction:column}:host>axp-layout-content>axp-layout-body>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}:host>axp-layout-content>axp-layout-body{overflow-y:auto;border-radius:.375rem;max-height:50vh;min-height:30vh}@media (min-width: 640px){:host>axp-layout-content>axp-layout-body{max-height:60vh;min-height:40vh}}@media (min-width: 768px){:host>axp-layout-content>axp-layout-body{max-height:70vh;min-height:50vh}}@media (min-width: 1024px){:host>axp-layout-content>axp-layout-body{max-height:80vh;min-height:40vh}}:host>axp-layout-content>axp-layout-body .axp-search-recent{display:flex;flex-direction:column;padding:1rem}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-header{margin-bottom:.5rem;display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:.875rem;line-height:1.25rem;font-weight:600}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-body{display:flex;flex-direction:row;flex-wrap:wrap;gap:.5rem;border-radius:.375rem}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon{display:flex;height:2.25rem;width:2.25rem;align-items:center;justify-content:center;border-radius:.375rem;background-color:rgb(var(--ax-sys-color-dark-surface));color:rgb(var(--ax-sys-color-on-dark-surface));border-color:rgb(var(--ax-sys-color-border-dark-surface))}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon:is(.ax-dark *){background-color:rgb(var(--ax-sys-color-darker-surface));color:rgb(var(--ax-sys-color-on-darker-surface));border-color:rgb(var(--ax-sys-color-border-darker-surface))}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon{font-size:1rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: 
                //
                AXSearchBoxModule }, { kind: "component", type: i3$1.AXSearchBoxComponent, selector: "ax-search-box", inputs: ["disabled", "readonly", "tabIndex", "placeholder", "value", "state", "name", "id", "look", "class", "delayTime", "type"], outputs: ["valueChange", "stateChange", "onValueChanged", "onBlur", "onFocus", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress"] }, { kind: "ngmodule", type: AXCommonModule }, { kind: "directive", type: i4.AXAutoFocusDirective, selector: "[axAutoFocus]", inputs: ["axAutoFocus", "axAutoFocusTime"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i1.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "directive", type: i4$1.AXTranslatorDirective, selector: "[translate]" }, { kind: "ngmodule", type: AXListNavigationModule }, { kind: "directive", type: i7.AXListNavigationDirective, selector: "[axListNavigation]", inputs: ["orientation"], outputs: ["onNavigationChanged", "onKeypress"], exportAs: ["axListNavigation"] }, { kind: "directive", type: i7.AXListNavigationItemDirective, selector: "[axListNavigationItem]", outputs: ["onKeypress"], exportAs: ["axListNavigationItem"] }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "ngmodule", type: 
                //
                AXSkeletonModule }, { kind: "component", type: i9.AXSkeletonComponent, selector: "ax-skeleton", inputs: ["animated"] }, { kind: "ngmodule", type: AXChipsModule }, { kind: "component", type: AXPThemeLayoutBlockComponent, selector: "    axp-page-content,     axp-page-footer-container,    axp-page-footer,    axp-page-header,    axp-page-header-container,    axp-page-toolbar,    axp-layout-content,     axp-layout-page-content,     axp-layout-sections,    axp-layout-body,    axp-layout-page-body,    axp-layout-prefix,    axp-layout-suffix,    axp-layout-title-bar,    axp-layout-title,     axp-layout-title-actions,     axp-layout-nav-button,     axp-layout-description,     axp-layout-breadcrumbs,    axp-layout-list-action,    " }, { kind: "component", type: AXPThemeLayoutListComponent, selector: "axp-layout-list" }, { kind: "component", type: AXPThemeLayoutListItemComponent, selector: "axp-layout-list-item" }, { kind: "component", type: AXPThemeLayoutListItemsGroupComponent, selector: "axp-layout-list-group" }, { kind: "component", type: AXPThemeLayoutHeaderComponent, selector: "axp-layout-header" }, { kind: "component", type: AXPStateMessageComponent, selector: "axp-state-message", inputs: ["mode", "icon", "title", "description", "variant"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPGlobalSearchPopupComponent, decorators: [{
            type: Component,
            args: [{ imports: [
                        CommonModule,
                        FormsModule,
                        //
                        AXSearchBoxModule,
                        AXCommonModule,
                        AXDecoratorModule,
                        AXTranslationModule,
                        AXListNavigationModule,
                        AXButtonModule,
                        //
                        AXSkeletonModule,
                        AXChipsModule,
                        AXPThemeLayoutBlockComponent,
                        AXPThemeLayoutListComponent,
                        AXPThemeLayoutListItemComponent,
                        AXPThemeLayoutListItemsGroupComponent,
                        AXPThemeLayoutHeaderComponent,
                        AXPStateMessageComponent,
                    ], changeDetection: ChangeDetectionStrategy.OnPush, providers: [AXPGlobalSearchViewModel], template: "<axp-layout-content *translate=\"let t\">\n  <axp-layout-header class=\"ax-lg\">\n    <ax-search-box\n      [axAutoFocus]\n      [look]=\"'none'\"\n      [ngModel]=\"vm.text()\"\n      (onValueChanged)=\"handleTextChanged($event)\"\n      [placeholder]=\"t('search-anything', { scope: i18nScope }) | async\"\n      (onKeyDown)=\"handleSearchKeyDown($event)\"\n    ></ax-search-box>\n    <div class=\"__close-button\">\n      <ax-button [look]=\"'blank'\" class=\"ax-rounded-full\" (onClick)=\"close()\">\n        <ax-icon icon=\"fa-light fa-xmark fa-sm\"></ax-icon>\n      </ax-button>\n    </div>\n  </axp-layout-header>\n\n  <!-- Results Area -->\n  <axp-layout-body>\n    @if (vm.isBusy()) {\n      <ng-container *ngTemplateOutlet=\"skeleton\"></ng-container>\n    } @else if (vm.isEmpty()) {\n      <ng-container *ngTemplateOutlet=\"empty\"></ng-container>\n    } @else if (vm.isWelcome()) {\n      <ng-container *ngTemplateOutlet=\"welcome\"></ng-container>\n    } @else if (vm.isStart()) {\n      <ng-container *ngTemplateOutlet=\"start\"></ng-container>\n    } @else {\n      <ng-container *ngTemplateOutlet=\"result\"></ng-container>\n    }\n  </axp-layout-body>\n\n  <!-- Skeleton Template -->\n  <ng-template #skeleton>\n    <div class=\"ax-flex ax-flex-col ax-gap-10 ax-p-8\">\n      @for (item of [1, 2, 3, 4, 5]; track $index) {\n        <div class=\"ax-flex ax-items-center ax-gap-4\">\n          <ax-skeleton [animated]=\"true\" class=\"ax-w-4 ax-h-4 ax-rounded-full\"></ax-skeleton>\n          <div class=\"ax-flex ax-flex-col ax-gap-2 ax-flex-1\">\n            <ax-skeleton [animated]=\"true\" class=\"ax-w-1/4 ax-h-2 ax-rounded\"></ax-skeleton>\n            <ax-skeleton [animated]=\"true\" class=\"ax-w-1/2 ax-h-2 ax-rounded\"></ax-skeleton>\n          </div>\n        </div>\n      }\n    </div>\n  </ng-template>\n\n  <!-- Empty Template -->\n  <ng-template #empty>\n    <axp-state-message\n      icon=\"fa-light fa-search\"\n      [title]=\"'@global-search:no-result.title'\"\n      [description]=\"'@global-search:no-result.message'\"\n    >\n    </axp-state-message>\n  </ng-template>\n\n  <!-- Welcome Template -->\n  <ng-template #welcome>\n    <axp-state-message\n      icon=\"fa-light fa-search\"\n      [title]=\"'@global-search:start.title'\"\n      [description]=\"'@global-search:start.message'\"\n    >\n    </axp-state-message>\n  </ng-template>\n\n  <!-- Start Template -->\n  <ng-template #start>\n    <!-- Pinned Items -->\n    <axp-layout-list\n      *translate=\"let t\"\n      class=\"ax-p-4 ax-divide-none\"\n      (keydown)=\"handleListKeyDown($event)\"\n      axListNavigation\n      #list=\"axListNavigation\"\n    >\n      @if (vm.pinnedItems().length > 0) {\n        <axp-layout-list-group>\n          <axp-layout-title>{{ t('pinned', { scope: i18nScope }) | async }}</axp-layout-title>\n          @for (item of vm.pinnedItems(); track $index) {\n            <axp-layout-list-item\n              (click)=\"vm.execute(item)\"\n              (keydown)=\"handleItemKeyDown($event, item)\"\n              class=\"ax-group\"\n              axListNavigationItem\n              #i=\"axListNavigationItem\"\n              [class.axp-state-focused]=\"i.isActive()\"\n            >\n              <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n            </axp-layout-list-item>\n          }\n        </axp-layout-list-group>\n      }\n      <!-- Recent Items -->\n      @if (vm.recentItems().length > 0) {\n        <axp-layout-list-group>\n          <axp-layout-header>\n            <axp-layout-prefix>\n              <axp-layout-title>{{ t('recent', { scope: i18nScope }) | async }}</axp-layout-title>\n            </axp-layout-prefix>\n            <axp-layout-prefix class=\"ax-xs\">\n              <ax-button\n                [text]=\"t('clear', { scope: i18nScope }) | async\"\n                look=\"blank\"\n                [color]=\"'default'\"\n                (onClick)=\"handleClearClick($event)\"\n              ></ax-button>\n            </axp-layout-prefix>\n          </axp-layout-header>\n          @for (item of vm.recentItems(); track $index) {\n            <axp-layout-list-item\n              (click)=\"vm.execute(item)\"\n              (keydown)=\"handleItemKeyDown($event, item)\"\n              class=\"ax-group\"\n              axListNavigationItem\n              #i=\"axListNavigationItem\"\n              [class.axp-state-focused]=\"i.isActive()\"\n            >\n              <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n            </axp-layout-list-item>\n          }\n        </axp-layout-list-group>\n      }\n    </axp-layout-list>\n  </ng-template>\n\n  <!-- Result Template -->\n  <ng-template #result>\n    <axp-layout-list\n      class=\"ax-p-4 ax-divide-none\"\n      (keydown)=\"handleListKeyDown($event)\"\n      axListNavigation\n      #list=\"axListNavigation\"\n    >\n      @for (group of vm.results(); track $index) {\n        <axp-layout-list-group>\n          <axp-layout-title> {{ t(group.title) | async }}</axp-layout-title>\n          @for (item of group.children; track $index) {\n            <axp-layout-list-item\n              (click)=\"vm.execute(item)\"\n              (keydown)=\"handleItemKeyDown($event, item)\"\n              class=\"ax-group\"\n              axListNavigationItem\n              #i=\"axListNavigationItem\"\n              [class.axp-state-focused]=\"i.isActive()\"\n            >\n              <ng-container [ngTemplateOutlet]=\"listItem\" [ngTemplateOutletContext]=\"{ item }\"></ng-container>\n            </axp-layout-list-item>\n          }\n        </axp-layout-list-group>\n      }\n    </axp-layout-list>\n  </ng-template>\n\n  <ng-template #listItem let-item=\"item\">\n    <axp-layout-prefix>\n      <ax-icon icon=\"fal {{ item.icon }}\"></ax-icon>\n    </axp-layout-prefix>\n    <axp-layout-content>\n      <axp-layout-title class=\"ax-group\">\n        <span>{{ t(item.title) | async }}</span>\n        <span class=\"ax-ms-3\" (click)=\"handlePinClick($event, item)\">\n          <i\n            [class.ax-invisible]=\"!vm.isPinned(item)\"\n            class=\"fa-light fa-thumbtack ax-rotate-45 group-hover:!ax-visible\"\n            [class.fa-solid]=\"vm.isPinned(item)\"\n          ></i>\n        </span>\n      </axp-layout-title>\n      @if (item.parent) {\n        <axp-layout-description>\n          {{ t(item.parent.title) | async }}\n        </axp-layout-description>\n      } @else if (item.description) {\n        <axp-layout-description>\n          {{ t(item.description) | async }}\n        </axp-layout-description>\n      }\n    </axp-layout-content>\n    <axp-layout-suffix>\n      <i class=\"far fa-chevron-right rtl:ax-rotate-180\"></i>\n    </axp-layout-suffix>\n  </ng-template>\n</axp-layout-content>\n", styles: [":host .ax-editor-container:focus-within{outline-style:none}:host>axp-layout-content{display:flex;flex-direction:column;background-color:rgb(var(--ax-sys-color-lightest-surface));color:rgb(var(--ax-sys-color-on-lightest-surface));border-color:rgb(var(--ax-sys-color-border-lightest-surface));width:90vw;max-width:36rem}@media (min-width: 640px){:host>axp-layout-content{width:80vw}}@media (min-width: 768px){:host>axp-layout-content{width:60vw}}@media (min-width: 1024px){:host>axp-layout-content{width:40vw}}@media (min-width: 1280px){:host>axp-layout-content{width:30vw}}:host>axp-layout-content>axp-layout-header{display:flex;flex-direction:row;align-items:center;justify-content:space-between;border-bottom-width:1px;background-color:rgb(var(--ax-sys-color-lighter-surface));color:rgb(var(--ax-sys-color-on-lighter-surface));border-color:rgb(var(--ax-sys-color-border-lighter-surface))}:host>axp-layout-content>axp-layout-header>.__close-button{position:absolute;inset-inline-end:1rem;top:1rem;--ax-sys-size-base: 2rem}:host>axp-layout-content>axp-layout-body{display:flex;flex-direction:column}:host>axp-layout-content>axp-layout-body>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}:host>axp-layout-content>axp-layout-body{overflow-y:auto;border-radius:.375rem;max-height:50vh;min-height:30vh}@media (min-width: 640px){:host>axp-layout-content>axp-layout-body{max-height:60vh;min-height:40vh}}@media (min-width: 768px){:host>axp-layout-content>axp-layout-body{max-height:70vh;min-height:50vh}}@media (min-width: 1024px){:host>axp-layout-content>axp-layout-body{max-height:80vh;min-height:40vh}}:host>axp-layout-content>axp-layout-body .axp-search-recent{display:flex;flex-direction:column;padding:1rem}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-header{margin-bottom:.5rem;display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:.875rem;line-height:1.25rem;font-weight:600}:host>axp-layout-content>axp-layout-body .axp-search-recent>axp-layout-body{display:flex;flex-direction:row;flex-wrap:wrap;gap:.5rem;border-radius:.375rem}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon{display:flex;height:2.25rem;width:2.25rem;align-items:center;justify-content:center;border-radius:.375rem;background-color:rgb(var(--ax-sys-color-dark-surface));color:rgb(var(--ax-sys-color-on-dark-surface));border-color:rgb(var(--ax-sys-color-border-dark-surface))}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon:is(.ax-dark *){background-color:rgb(var(--ax-sys-color-darker-surface));color:rgb(var(--ax-sys-color-on-darker-surface));border-color:rgb(var(--ax-sys-color-border-darker-surface))}:host>axp-layout-content axp-layout-list-item axp-layout-prefix ax-icon{font-size:1rem}\n"] }]
        }] });

export { AXPGlobalSearchPopupComponent };
//# sourceMappingURL=acorex-modules-common-search-popup.component-cQJ9z0zY.mjs.map
