import * as i0 from '@angular/core';
import { EventEmitter, Component, SkipSelf, Inject, Optional, Output, NgModule } from '@angular/core';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i2 from '@angular/forms';
import { FormsModule } from '@angular/forms';
import * as i3 from 'ngx-bootstrap/pagination';
import { PaginationModule as PaginationModule$1 } from 'ngx-bootstrap/pagination';
import { PROP_BOOLEAN, PROP_STRING, PROP_ANY, PROP_NUMBER, register, StylableComponent, DEBOUNCE_TIMES, styler, getOrderByExpr, unsupportedStatePersistenceTypes, WidgetRef, provideAsWidgetRef, WmComponentsModule } from '@wm/components/base';
import { debounce, isDefined, AppConstants, DataSource, triggerFn, $appDigest, $watch, switchClass } from '@wm/core';
import { forEach, isArray, isEmpty, get, isString, isNull } from 'lodash-es';

const registerProps = () => {
    register('wm-pagination', new Map([
        ['boundarylinks', { value: false, ...PROP_BOOLEAN }],
        ['class', PROP_STRING],
        ['dataset', PROP_ANY],
        ['directionlinks', { value: true, ...PROP_BOOLEAN }],
        ['forceellipses', { value: true, ...PROP_BOOLEAN }],
        ['maxResults', PROP_NUMBER],
        ['maxsize', { value: 5, ...PROP_NUMBER }],
        ['name', PROP_STRING],
        ['navigation', { value: 'Basic', ...PROP_STRING }],
        ['navigationalign', { value: 'left', ...PROP_STRING }],
        ['navigationsize', PROP_STRING],
        ['show', { value: true, ...PROP_BOOLEAN }],
        ['showrecordcount', PROP_BOOLEAN],
        ['tabindex', { value: 0, ...PROP_NUMBER }]
    ]));
};

const _c0 = ["wmPagination", ""];
const _c1 = a0 => ({ "disabled": a0 });
const _c2 = () => ({ standalone: true });
function PaginationComponent_ul_0_li_31_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "li", 23)(1, "a", 24);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate2("", ctx_r1.appLocale.LABEL_TOTAL_RECORDS, ": ", ctx_r1.dataSize, "");
} }
function PaginationComponent_ul_0_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "ul")(1, "li", 6)(2, "a", 7);
    i0.ɵɵlistener("click", function PaginationComponent_ul_0_Template_a_click_2_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.navigatePage("first", $event)); });
    i0.ɵɵelementStart(3, "span", 8);
    i0.ɵɵelement(4, "i", 9);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "span", 10);
    i0.ɵɵtext(6);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(7, "li", 6)(8, "a", 11);
    i0.ɵɵlistener("click", function PaginationComponent_ul_0_Template_a_click_8_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.navigatePage("prev", $event)); });
    i0.ɵɵelementStart(9, "span", 8);
    i0.ɵɵelement(10, "i", 12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(11, "span", 10);
    i0.ɵɵtext(12);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(13, "li", 13)(14, "a", 14)(15, "input", 15);
    i0.ɵɵtwoWayListener("ngModelChange", function PaginationComponent_ul_0_Template_input_ngModelChange_15_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); i0.ɵɵtwoWayBindingSet(ctx_r1.dn.currentPage, $event) || (ctx_r1.dn.currentPage = $event); return i0.ɵɵresetView($event); });
    i0.ɵɵlistener("keydown", function PaginationComponent_ul_0_Template_input_keydown_15_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onKeyDown($event)); })("change", function PaginationComponent_ul_0_Template_input_change_15_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onModelChange($event)); });
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(16, "li", 16)(17, "a", 17);
    i0.ɵɵtext(18);
    i0.ɵɵelementEnd()();
    i0.ɵɵelementStart(19, "li", 6)(20, "a", 18);
    i0.ɵɵlistener("click", function PaginationComponent_ul_0_Template_a_click_20_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.navigatePage("next", $event)); });
    i0.ɵɵelementStart(21, "span", 8);
    i0.ɵɵelement(22, "i", 19);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(23, "span", 10);
    i0.ɵɵtext(24);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(25, "li", 6)(26, "a", 20);
    i0.ɵɵlistener("click", function PaginationComponent_ul_0_Template_a_click_26_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.navigatePage("last", $event)); });
    i0.ɵɵelementStart(27, "span", 8);
    i0.ɵɵelement(28, "i", 21);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(29, "span", 10);
    i0.ɵɵtext(30);
    i0.ɵɵelementEnd()()();
    i0.ɵɵtemplate(31, PaginationComponent_ul_0_li_31_Template, 3, 2, "li", 22);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵclassMapInterpolate1("pagination advanced ", ctx_r1.navigationClass, "");
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(26, _c1, ctx_r1.isDisableFirst));
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", ctx_r1.appLocale.LABEL_FIRST);
    i0.ɵɵattribute("aria-disabled", ctx_r1.isDisableFirst);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate1("Go to first page ", ctx_r1.isDisableFirst ? " , Disabled" : "", "");
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(28, _c1, ctx_r1.isDisablePrevious));
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", ctx_r1.appLocale.LABEL_PREVIOUS);
    i0.ɵɵattribute("aria-disabled", ctx_r1.isDisablePrevious);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate1("Go to previous page ", ctx_r1.isDisablePrevious ? ", Disabled" : "", "");
    i0.ɵɵadvance(3);
    i0.ɵɵtwoWayProperty("ngModel", ctx_r1.dn.currentPage);
    i0.ɵɵproperty("disabled", ctx_r1.isDisableCurrent)("ngModelOptions", i0.ɵɵpureFunction0(30, _c2));
    i0.ɵɵattribute("aria-label", "Showing Page " + ctx_r1.dn.currentPage + " of " + ctx_r1.pageCount);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("hidden", ctx_r1.isDisableCount);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" / ", ctx_r1.pageCount, "");
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(31, _c1, ctx_r1.isDisableNext));
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", ctx_r1.appLocale.LABEL_NEXT);
    i0.ɵɵattribute("aria-disabled", ctx_r1.isDisableNext);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate1("Go to next page ", ctx_r1.isDisableNext ? " , Disabled" : "", "");
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(33, _c1, ctx_r1.isDisableLast));
    i0.ɵɵadvance();
    i0.ɵɵproperty("title", ctx_r1.appLocale.LABEL_LAST);
    i0.ɵɵattribute("aria-disabled", ctx_r1.isDisableLast);
    i0.ɵɵadvance(4);
    i0.ɵɵtextInterpolate1("Go to last page ", ctx_r1.isDisableLast ? " , Disabled" : "", "");
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngIf", ctx_r1.showrecordcount);
} }
function PaginationComponent_ul_1_Template(rf, ctx) { if (rf & 1) {
    const _r3 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "ul")(1, "li", 25)(2, "a", 26);
    i0.ɵɵlistener("click", function PaginationComponent_ul_1_Template_a_click_2_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.navigatePage("prev", $event)); });
    i0.ɵɵelementStart(3, "span", 8);
    i0.ɵɵelement(4, "i", 12);
    i0.ɵɵelementEnd();
    i0.ɵɵtext(5);
    i0.ɵɵelementStart(6, "span", 10);
    i0.ɵɵtext(7);
    i0.ɵɵelementEnd()()();
    i0.ɵɵelementStart(8, "li", 27)(9, "a", 26);
    i0.ɵɵlistener("click", function PaginationComponent_ul_1_Template_a_click_9_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.navigatePage("next", $event)); });
    i0.ɵɵelementStart(10, "span", 8);
    i0.ɵɵelement(11, "i", 19);
    i0.ɵɵelementEnd();
    i0.ɵɵtext(12);
    i0.ɵɵelementStart(13, "span", 10);
    i0.ɵɵtext(14);
    i0.ɵɵelementEnd()()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵclassMapInterpolate1("pager ", ctx_r1.navigationClass, "");
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(11, _c1, ctx_r1.isDisablePrevious));
    i0.ɵɵadvance();
    i0.ɵɵattribute("aria-disabled", ctx_r1.isDisablePrevious);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" ", ctx_r1.appLocale.LABEL_PREVIOUS, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.isDisablePrevious ? " , Disabled" : "");
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(13, _c1, ctx_r1.isDisableNext));
    i0.ɵɵadvance();
    i0.ɵɵattribute("aria-disabled", ctx_r1.isDisableNext);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1(" ", ctx_r1.appLocale.LABEL_NEXT, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(ctx_r1.isDisableNext ? " , Disabled" : "");
} }
function PaginationComponent_pagination_2_Template(rf, ctx) { if (rf & 1) {
    const _r4 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "pagination", 28);
    i0.ɵɵlistener("pageChanged", function PaginationComponent_pagination_2_Template_pagination_pageChanged_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.pageChanged($event)); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    const pageTemplate_r5 = i0.ɵɵreference(5);
    const prevTemplate_r6 = i0.ɵɵreference(7);
    const nextTemplate_r7 = i0.ɵɵreference(9);
    i0.ɵɵproperty("ngClass", ctx_r1.navigationClass)("itemsPerPage", ctx_r1.maxResults)("totalItems", ctx_r1.dataSize)("ngModelOptions", i0.ɵɵpureFunction0(12, _c2))("ngModel", ctx_r1.dn.currentPage)("boundaryLinks", ctx_r1.boundarylinks)("maxSize", ctx_r1.maxsize)("directionLinks", ctx_r1.directionlinks)("customPreviousTemplate", prevTemplate_r6)("customNextTemplate", nextTemplate_r7)("customPageTemplate", pageTemplate_r5);
    i0.ɵɵattribute("aria-label", "Showing Page " + ctx_r1.dn.currentPage + " of " + ctx_r1.pageCount + " pages");
} }
function PaginationComponent_ul_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "ul", 29)(1, "li", 30)(2, "a", 24);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd()()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate2("", ctx_r1.appLocale.LABEL_TOTAL_RECORDS, ": ", ctx_r1.dataSize, "");
} }
function PaginationComponent_ng_template_4_span_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 10);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const page_r8 = i0.ɵɵnextContext().$implicit;
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ", Showing page " + page_r8.number + " of " + ctx_r1.pageCount, "");
} }
function PaginationComponent_ng_template_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 10);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
    i0.ɵɵtext(2);
    i0.ɵɵtemplate(3, PaginationComponent_ng_template_4_span_3_Template, 2, 1, "span", 31);
} if (rf & 2) {
    const page_r8 = ctx.$implicit;
    i0.ɵɵattribute("data-isacitvepage", page_r8.active);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate("Page ");
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", page_r8.number, " ");
    i0.ɵɵadvance();
    i0.ɵɵproperty("ngIf", page_r8.active);
} }
function PaginationComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 10);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const disabled_r9 = ctx.disabled;
    i0.ɵɵattribute("data-isdisabled", disabled_r9);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1("Go to Previous page ", disabled_r9 ? ", Disabled" : "", "");
} }
function PaginationComponent_ng_template_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 10);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const disabled_r10 = ctx.disabled;
    i0.ɵɵattribute("data-isdisabled", disabled_r10);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1("Go to Next page ", disabled_r10 ? ", Disabled" : "", "");
} }
const DEFAULT_CLS = 'app-datanavigator clearfix';
const WIDGET_CONFIG = { widgetType: 'wm-pagination', hostClass: DEFAULT_CLS };
const sizeClasses = {
    'Pager': {
        'small': 'pager-sm',
        'large': 'pager-lg'
    },
    'Basic': {
        'small': 'pagination-sm',
        'large': 'pagination-lg'
    },
    'Classic': {
        'small': 'pagination-sm',
        'large': 'pagination-lg'
    }
};
class PaginationComponent extends StylableComponent {
    static { this.initializeProps = registerProps(); }
    _setAriaForBasicNavigation() {
        forEach(this.nativeElement.getElementsByTagName('a'), (item) => {
            item.setAttribute('href', 'javascript:void(0);');
            const childNode = item.querySelector('span');
            if (childNode?.dataset.isacitvepage === "true") {
                item.setAttribute('aria-current', 'true');
            }
            if (childNode?.dataset.isdisabled === "true") {
                item.setAttribute('aria-disabled', 'true');
            }
            else {
                item.removeAttribute('aria-disabled');
            }
        });
    }
    constructor(inj, parent, explicitContext) {
        super(inj, WIDGET_CONFIG, explicitContext);
        this.parent = parent;
        this.resultEmitter = new EventEmitter();
        this.maxResultsEmitter = new EventEmitter();
        this.dn = {
            currentPage: 1
        };
        this.pageCount = 0;
        this.isDisableNext = true;
        this.isDisablePrevious = true;
        this.isDisableFirst = true;
        this.isDisableLast = true;
        this._debouncedApplyDataset = debounce(() => this.widget.dataset = this.dataset, DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME);
        this._debouncedPageChanged = debounce(event => {
            const currentPage = event && event.page;
            // Do not call goToPage if page has not changed
            if (currentPage !== this.dn.currentPage) {
                const inst = this.parent || this;
                this.dn.currentPage = currentPage;
                inst.invokeEventCallback('paginationchange', { $event: undefined, $index: this.dn.currentPage });
                this.goToPage();
                if (this.navigation === 'Basic') {
                    this._setAriaForBasicNavigation();
                }
            }
        }, DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME);
        styler(this.nativeElement, this);
    }
    setResult(result) {
        // TODO: Emit event only if result is changed
        this.result = result;
        this.resultEmitter.emit(this.result);
    }
    // Update navigationClass based on navigation and navigationSize props
    updateNavSize() {
        const sizeCls = sizeClasses[this.navcontrols];
        if (sizeCls && this.navigationsize) {
            this.navigationClass = sizeCls[this.navigationsize];
        }
        else {
            this.navigationClass = '';
        }
    }
    // Function to reset the paging values to default.
    resetPageNavigation() {
        this.pageCount = 0;
        this.dn.currentPage = 1;
        this.dataSize = 0;
    }
    /*Function to calculate the paging values.*/
    calculatePagingValues() {
        this.pageCount = (this.dataSize > this.maxResults) ? (Math.ceil(this.dataSize / this.maxResults)) : (this.dataSize < 0 ? 0 : 1);
        this.dn.currentPage = this.dn.currentPage || 1;
    }
    /*Function to set default values to the paging parameters*/
    setDefaultPagingValues(dataSize, maxResults, currentPage) {
        /*If neither 'dataSize' nor 'maxResults' is set, then set default values to the paging parameters.*/
        if (!dataSize && !maxResults) {
            this.pageCount = 1;
            this.dn.currentPage = 1;
            this.maxResults = dataSize;
            this.dataSize = dataSize;
        }
        else { /*Else, set the specified values and recalculate paging parameters.*/
            this.maxResults = maxResults || this.maxResults;
            this.dataSize = isDefined(dataSize) ? dataSize : this.dataSize;
            this.dn.currentPage = currentPage || this.dn.currentPage;
            this.calculatePagingValues();
        }
        this.maxResultsEmitter.emit(this.maxResults);
    }
    /*Function to check the dataSize and manipulate the navigator accordingly.*/
    checkDataSize(dataSize, numberOfElements, size) {
        /*If the dataSize is -1 or Integer.MAX_VALUE( which is 2147483647), then the total number of records is not known.
         * Hence,
         * 1. Hide the 'Total Record Count'.
         * 2. Disable the 'GoToLastPage' link as the page number of the last page is not known.*/
        if (dataSize === -1 || dataSize === AppConstants.INT_MAX_VALUE) {
            this.prevshowrecordcount = this.showrecordcount;
            this.isDisableLast = true;
            this.isDisableCount = true;
            this.showrecordcount = false;
            // If number of records in current page is less than the max records size, this is the last page. So disable next button.
            if (numberOfElements < size) {
                this.isDisableNext = true;
            }
        }
        else {
            this.isDisableCount = false;
            this.showrecordcount = this.prevshowrecordcount || this.showrecordcount;
        }
    }
    /*Function to disable navigation based on the current and total pages.*/
    disableNavigation() {
        const isCurrentPageFirst = (this.dn.currentPage === 1), isCurrentPageLast = (this.dn.currentPage === this.pageCount);
        if (!this.pagination?.next) {
            this.isDisableFirst = this.isDisablePrevious = isCurrentPageFirst;
            this.isDisableNext = this.isDisableLast = isCurrentPageLast;
        }
        else {
            // WMS-18867: In case of server side pagination, for pager type pagination depend on prev and next flags which are set by developer
            this.isDisableFirst = this.isDisablePrevious = !this.pagination.prev;
            this.isDisableNext = this.isDisableLast = !this.pagination.next;
        }
        this.isDisableCurrent = isCurrentPageFirst && isCurrentPageLast;
        // In case of client side pagination, when load more reaches last page hide the on-demand grid ele
        if (this.dataset && this.dataset.length && this.isDisableNext && this.parent.onDemandLoad && this.parent.widgetType === 'wm-table') {
            this.parent.callDataGridMethod('hideLoadingIndicator', this.isDisableNext, this.parent.infScroll);
        }
    }
    /*Function to check if the variable bound to the data-navigator has paging.*/
    isDataSourceHasPaging() {
        return this.datasource && this.datasource.execute(DataSource.Operation.IS_PAGEABLE);
    }
    // Set the result for client side pagination
    setNonPageableData(newVal) {
        let dataSize, maxResults, currentPage, startIndex;
        dataSize = isArray(newVal) ? newVal.length : (isEmpty(newVal) ? 0 : 1);
        maxResults = (this.options && this.options.maxResults) || dataSize;
        // For static variable, keep the current page. For other variables without pagination reset the page to 1
        // Fix for [WMS-23263]: gridOptions.isNextPageData flag is false when dataset is changed from script, so setting current page to 1
        if (this.datasource && (this.datasource.execute(DataSource.Operation.IS_API_AWARE) || (this.parent.widgetType === 'wm-table' && (this.parent.gridOptions.isNavTypeScrollOrOndemand() && (get(this.parent, 'gridOptions.lastActionPerformed') === this.parent.gridOptions.ACTIONS.DATASET_UPDATE || !get(this.parent, 'gridOptions.isNextPageData')))))) {
            currentPage = 1;
        }
        else {
            currentPage = this.dn.currentPage || 1;
        }
        this.setDefaultPagingValues(dataSize, maxResults, currentPage);
        this.disableNavigation();
        startIndex = (this.dn.currentPage - 1) * this.maxResults;
        this.setResult(isArray(newVal) ? newVal.slice(startIndex, startIndex + this.maxResults) : newVal);
    }
    /*Function to set the values needed for pagination*/
    setPagingValues(newVal) {
        let dataSize, maxResults, currentPage, dataSource;
        let variableOptions = {};
        // Store the data in __fullData. This is used for client side searching witvah out modifying the actual dataset.
        this.__fullData = newVal;
        /*Check for sanity*/
        if (this.binddataset) {
            dataSource = this.datasource || {};
            variableOptions = dataSource._options || {};
            /*Check for number of elements in the data set*/
            if (newVal) {
                if (this.isDataSourceHasPaging()) {
                    this.pagination = this.datasource.execute(DataSource.Operation.GET_PAGING_OPTIONS) || {};
                    // If "filterFields" and "sortOptions" have been set, then set them so that the filters can be retained while fetching data upon page navigation.
                    this.filterFields = variableOptions.filterFields || {};
                    this.logicalOp = variableOptions.logicalOp || '';
                    this.sortOptions = variableOptions.orderBy ||
                        (isArray(this.pagination.sort) ? getOrderByExpr(this.pagination.sort) : '');
                    dataSize = this.pagination.totalElements;
                    maxResults = this.pagination.size;
                    if (this.pagination.numberOfElements > 0) {
                        if (isDefined(this.pagination.number)) { // number is page number received from backend
                            this.dn.currentPage = this.pagination.number + 1;
                        }
                        currentPage = this.dn.currentPage || 1;
                    }
                    else {
                        currentPage = 1;
                    }
                    /* Sending pageCount undefined to calculate it again for query.*/
                    this.setDefaultPagingValues(dataSize, maxResults, currentPage);
                    this.disableNavigation();
                    this.checkDataSize(dataSize, this.pagination.numberOfElements, this.pagination.size);
                    this.setResult(newVal);
                }
                else if (!isString(newVal)) {
                    this.setNonPageableData(newVal);
                }
            }
            else {
                this.setResult(newVal);
                this.resetPageNavigation();
            }
            if (this.navigation === 'Basic') {
                this._setAriaForBasicNavigation();
            }
        }
        else {
            if (newVal && !isString(newVal)) {
                this.setNonPageableData(newVal);
            }
        }
    }
    /*Function to check if the current page is the first page*/
    isFirstPage() {
        return (this.dn.currentPage === 1 || !this.dn.currentPage);
    }
    /*Function to check if the current page is the last page*/
    isLastPage() {
        return (this.dn.currentPage === this.pageCount);
    }
    /*Function to navigate to the last page*/
    goToLastPage(isRefresh, event, callback) {
        if (!this.isLastPage()) {
            this.dn.currentPage = this.pageCount;
            this.goToPage(event, callback);
        }
        else if (isRefresh) {
            this.goToPage(event, callback);
        }
    }
    /*Function to navigate to the first page*/
    goToFirstPage(isRefresh, event, callback) {
        if (!this.isFirstPage()) {
            this.dn.currentPage = 1;
            this.goToPage(event, callback);
        }
        else if (isRefresh) {
            this.goToPage(event, callback);
        }
    }
    /*Function to navigate to the current page*/
    goToPage(event, callback) {
        this.firstRow = (this.dn.currentPage - 1) * this.maxResults;
        const mode = this.parent.statePersistence.computeMode(this.statehandler);
        if (mode && mode.toLowerCase() !== 'none' && (this.parent.widgetType === 'wm-table' || this.parent.widgetType === 'wm-list')) {
            this.parent._selectedItemsExist = true;
            if (this.isFirstPage()) {
                this.parent.statePersistence.removeWidgetState(this.parent, 'pagination');
            }
            else {
                if (unsupportedStatePersistenceTypes.indexOf(this.parent.navigation) < 0) {
                    this.parent.statePersistence.setWidgetState(this.parent, { pagination: this.dn.currentPage });
                }
                else if (this.parent.widgetType === 'wm-list' || this.parent.widgetType === 'wm-table') {
                    console.warn('Retain State handling on Widget ' + this.parent.name + ' is not supported for current pagination type.');
                }
            }
            this.parent.currentpage = this.dn.currentPage;
            this.parent.nativeElement?.setAttribute('currentpage', this.dn.currentPage);
        }
        // call getPageData after checking state config so that Static Variables can use it
        this.getPageData(event, callback);
    }
    /*Function to be invoked after the data of the page has been fetched.*/
    onPageDataReady(event, data, callback) {
        this.disableNavigation();
        this.invokeSetRecord(event, data);
        triggerFn(callback);
    }
    /*Function to get data for the current page*/
    getPageData(event, callback) {
        let data, startIndex;
        if (this.isDataSourceHasPaging()) {
            /**
             * In table component, in case of on demand and scroll pagination
             * When there is a change in data item which is not in current page
             * Fetch the items of the page where the change is made
             * */
            let pageIndex = this.dn.currentPage;
            if (this.isEditNotInCurrentPage() && this.parent.gridOptions.lastActionPerformed !== 'delete') {
                pageIndex = this.parent.actionRowPage;
            }
            this.datasource.execute(DataSource.Operation.LIST_RECORDS, {
                'page': pageIndex,
                'filterFields': this.filterFields,
                'orderBy': this.sortOptions,
                'logicalOp': this.logicalOp,
                'matchMode': 'anywhereignorecase'
            }).then(response => {
                this.onPageDataReady(event, response && response.data, callback);
                $appDigest();
            }, error => {
                // If error is undefined, do not show any message as this may be discarded request
                if (error) {
                    // TODO: Handle Error
                    // wmToaster.show('error', 'ERROR', 'Unable to get data of page -' + this.dn.currentPage + ':' + error);
                }
            });
        }
        else {
            if (this.isEditNotInCurrentPage()) {
                startIndex = (this.parent.actionRowPage - 1) * this.maxResults;
            }
            else {
                startIndex = (this.dn.currentPage - 1) * this.maxResults;
            }
            data = isArray(this.__fullData) ? this.__fullData.slice(startIndex, startIndex + this.maxResults) : this.__fullData;
            this.setResult(data);
            this.onPageDataReady(event, data, callback);
        }
    }
    /*
    Function to check if the edit action is performed on the previous page data of the table
    */
    isEditNotInCurrentPage() {
        const pageIndex = this.dn.currentPage;
        return this.parent.widgetType === 'wm-table' && pageIndex === this.parent.currentPage &&
            this.parent.actionRowPage && this.parent.actionRowPage < pageIndex;
    }
    invokeSetRecord(event, data) {
        // Trigger the event handler if exists.
        const pageInfo = {
            currentPage: this.dn.currentPage,
            size: this.maxResults,
            totalElements: this.dataSize,
            totalPages: this.pageCount
        };
        if (this.parent) {
            this.parent.invokeEventCallback('setrecord', { $event: event, $data: data, $index: this.dn.currentPage, pageInfo, data });
        }
        else {
            this.invokeEventCallback('setrecord', { $event: event, $data: data, $index: this.dn.currentPage, pageInfo, data });
        }
    }
    /*Function to validate the page input.
     In case of invalid input, navigate to the appropriate page; also return false.
     In case of valid input, return true.*/
    validateCurrentPage(event, callback) {
        /*If the value entered is greater than the last page number or invalid value, then highlighting the field showing error.*/
        if (event && (isNaN(this.dn.currentPage) || this.dn.currentPage <= 0 || (this.pageCount && (this.dn.currentPage > this.pageCount || isNull(this.dn.currentPage))))) {
            if (this.dn.currentPage <= 0) {
                this.dn.currentPage = 1;
            }
            else if (this.dn.currentPage > this.pageCount) {
                this.dn.currentPage = this.pageCount;
            }
            return false;
        }
        return true;
    }
    onModelChange(event) {
        if (!this.validateCurrentPage(event)) {
            return;
        }
        this.goToPage(event);
    }
    onKeyDown(event) {
        const targetEle = $(event.target).closest('a');
        if (event.code === 'KeyE') {
            targetEle.addClass('ng-invalid');
            return false;
        }
        targetEle.removeClass('ng-invalid');
        return true;
    }
    pageChanged(event) {
        this._debouncedPageChanged(event);
    }
    /*Function to navigate to the respective pages.*/
    navigatePage(index, event, isRefresh, callback) {
        // when navigated to next page turn on the isDataLoading flag to show the loading indicator
        if (isDefined(this.parent.isDataLoading) && !this.isDisableNext) {
            this.parent.isDataLoading = true;
            // In case of infinite scroll calling the showLoadingIndicator method to update the loading message immediately when navigated to next page
            if (this.parent.infScroll) {
                this.parent.variableInflight = true;
                this.parent.callDataGridMethod('showLoadingIndicator', this.parent.loadingdatamsg, true);
            }
        }
        // reset the last action performed to "scroll" and isDatasetUpdated to false
        if (this.parent.widgetType === 'wm-table' && this.parent.gridOptions.isNavTypeScrollOrOndemand()) {
            this.parent.gridOptions.setLastActionPerformed(this.parent.gridOptions.ACTIONS.DEFAULT);
            this.parent.gridOptions.setIsDatasetUpdated(false);
        }
        this.invokeEventCallback('paginationchange', { $event: undefined, $index: this.dn.currentPage });
        // Convert the current page to a valid page number.
        this.dn.currentPage = +this.dn.currentPage;
        switch (index) {
            case 'first':
                this.goToFirstPage(isRefresh, event, callback);
                return;
            case 'prev':
                /*Return if already on the first page.*/
                if (!this.pagination?.next && (this.isFirstPage() || !this.validateCurrentPage(event, callback))) {
                    return;
                }
                else if (this.pagination?.next) { // WMS-18867: For server side pagination, skipping the regular flow and enabling isNext flag in pagination metadata
                    this.datasource.pagination.isNext = false;
                    this.datasource.pagination.isPrev = true;
                }
                /*Decrement the current page by 1.*/
                this.dn.currentPage -= 1;
                break;
            case 'next':
                /*Return if already on the last page.*/
                if (!this.pagination?.next && (this.isLastPage() || !this.validateCurrentPage(event, callback))) {
                    return;
                }
                else if (this.pagination?.next) { // WMS-18867: For server side pagination, skipping the regular flow and enabling isPrev flag in pagination metadata
                    this.datasource.pagination.isNext = true;
                    this.datasource.pagination.isPrev = false;
                }
                /*Increment the current page by 1.*/
                this.dn.currentPage += 1;
                break;
            case 'last':
                this.goToLastPage(isRefresh, event, callback);
                return;
            default:
                break;
        }
        /*Navigate to the current page.*/
        this.goToPage(event, callback);
    }
    setBindDataSet(binddataset, parent, dataSource, dataset, binddatasource, datasetBoundExpr, statehandler) {
        const parts = binddataset.split('.');
        let bindPagingOptions;
        this.statehandler = statehandler;
        if (parts[0] === 'Variables' || parts[0] === 'Widgets') {
            bindPagingOptions = `${parts[0]}.${parts[1]}.pagination`;
        }
        if (!binddatasource && dataset && !datasetBoundExpr) {
            this.dataset = dataset;
            this._debouncedApplyDataset();
            return;
        }
        this.binddataset = binddataset;
        setTimeout(() => {
            // watching for dataset changes even when dataset is bound to "item." (i.e. by checking for datasetBoundExpr)
            // item context is passed as dataSource here
            // [Todo-CSP]: check if same expr fn is generated by parent widget (list, table)
            this.registerDestroyListener($watch(binddataset, parent, datasetBoundExpr ? dataSource : {}, nv => {
                if (nv) {
                    this.dataset = nv;
                    this._debouncedApplyDataset();
                }
                else {
                    // WMS-19285: Setting dataset on proxy only to handle propertychange handler call for undefined cases
                    this.widget.dataset = nv;
                }
            }));
            // Register a watch on paging options. Call dataset property change handler even if paging options changes to reflect pagination state
            if (!bindPagingOptions) {
                return;
            }
            //[Todo-CSP]: either generate watch expr fn or register an event from the datasource itself
            this.registerDestroyListener($watch(bindPagingOptions, parent, {}, () => this._debouncedApplyDataset()));
        });
        // apply datasource only when dataset is not bound to "item.FIELD"
        if (!datasetBoundExpr) {
            this.datasource = dataSource;
        }
    }
    // Set the datasource of pagination from the parent widget
    setDataSource(dataSource) {
        this.datasource = dataSource;
    }
    onPropertyChange(key, nv, ov) {
        if (key === 'dataset') {
            let data;
            if (this.parent && this.parent.onDataNavigatorDataSetChange) {
                data = this.parent.onDataNavigatorDataSetChange(nv);
            }
            else {
                data = nv;
            }
            // Set last action performed to "dataset_update" whenever dataset is changed in table component
            if (this.parent.widgetType === 'wm-table') {
                this.parent._triggeredByUser = false;
            }
            // When the dataset is not in current page, but in previous ones directly set the result without setting page values
            if (this.isEditNotInCurrentPage()) {
                this.setResult(data);
            }
            else {
                this.setPagingValues(data);
            }
        }
        else if (key === 'navigation') {
            if (nv === 'Advanced') { // Support for older projects where navigation type was advanced instead of clasic
                this.navigation = 'Classic';
            }
            this.updateNavSize();
            this.navcontrols = nv;
        }
        else if (key === 'navigationsize') {
            this.updateNavSize();
        }
        else if (key === 'navigationalign') {
            switchClass(this.nativeElement, `text-${nv}`, `text-${ov}`);
        }
        else if (key === 'maxResults') {
            this.setPagingValues(this.dataset);
        }
        else {
            super.onPropertyChange(key, nv, ov);
        }
    }
    ngAfterViewInit() {
        const paginationElem = this.nativeElement;
        paginationElem.onclick = (event) => {
            event.stopPropagation();
        };
    }
    static { this.ɵfac = function PaginationComponent_Factory(t) { return new (t || PaginationComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(WidgetRef, 4), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: PaginationComponent, selectors: [["", "wmPagination", ""]], outputs: { resultEmitter: "resultEmitter", maxResultsEmitter: "maxResultsEmitter" }, features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(PaginationComponent)
            ]), i0.ɵɵInheritDefinitionFeature], attrs: _c0, decls: 10, vars: 4, consts: [["pageTemplate", ""], ["prevTemplate", ""], ["nextTemplate", ""], [3, "class", 4, "ngIf"], ["class", "pagination basic", "role", "navigation", "firstText", "Firtst", "lastText", "Last", 3, "ngClass", "itemsPerPage", "totalItems", "ngModelOptions", "ngModel", "boundaryLinks", "maxSize", "directionLinks", "customPreviousTemplate", "customNextTemplate", "customPageTemplate", "pageChanged", 4, "ngIf"], ["class", "pagination", 4, "ngIf"], [3, "ngClass"], ["name", "first", "href", "javascript:void(0);", 3, "click", "title"], ["aria-hidden", "true"], [1, "wi", "wi-first-page"], [1, "sr-only"], ["name", "prev", "href", "javascript:void(0);", 3, "click", "title"], [1, "wi", "wi-chevron-left"], [1, "pagecount", "disabled"], ["href", "javascript:void(0);"], ["type", "number", 1, "form-control", 3, "ngModelChange", "keydown", "change", "ngModel", "disabled", "ngModelOptions"], [1, "disabled"], [3, "hidden"], ["name", "next", "href", "javascript:void(0);", 3, "click", "title"], [1, "wi", "wi-chevron-right"], ["name", "last", "href", "javascript:void(0);", 3, "click", "title"], [1, "wi", "wi-last-page"], ["class", "totalcount disabled", 4, "ngIf"], [1, "totalcount", "disabled"], ["href", "javascript:void(0);", "tabindex", "-1", "aria-disabled", "true"], [1, "previous", 3, "ngClass"], ["href", "javascript:void(0);", 3, "click"], [1, "next", 3, "ngClass"], ["role", "navigation", "firstText", "Firtst", "lastText", "Last", 1, "pagination", "basic", 3, "pageChanged", "ngClass", "itemsPerPage", "totalItems", "ngModelOptions", "ngModel", "boundaryLinks", "maxSize", "directionLinks", "customPreviousTemplate", "customNextTemplate", "customPageTemplate"], [1, "pagination"], [1, "totalcount", "disabled", "basiccount"], ["class", "sr-only", 4, "ngIf"]], template: function PaginationComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵtemplate(0, PaginationComponent_ul_0_Template, 32, 35, "ul", 3)(1, PaginationComponent_ul_1_Template, 15, 15, "ul", 3)(2, PaginationComponent_pagination_2_Template, 1, 13, "pagination", 4)(3, PaginationComponent_ul_3_Template, 4, 2, "ul", 5)(4, PaginationComponent_ng_template_4_Template, 4, 4, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor)(6, PaginationComponent_ng_template_6_Template, 2, 2, "ng-template", null, 1, i0.ɵɵtemplateRefExtractor)(8, PaginationComponent_ng_template_8_Template, 2, 2, "ng-template", null, 2, i0.ɵɵtemplateRefExtractor);
        } if (rf & 2) {
            i0.ɵɵproperty("ngIf", ctx.navcontrols === "Classic");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.navcontrols === "Pager");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.navcontrols === "Basic");
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.navcontrols === "Basic" && ctx.showrecordcount);
        } }, dependencies: [i1.NgClass, i1.NgIf, i2.DefaultValueAccessor, i2.NumberValueAccessor, i2.NgControlStatus, i2.NgModel, i3.PaginationComponent], encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PaginationComponent, [{
        type: Component,
        args: [{ selector: '[wmPagination]', providers: [
                    provideAsWidgetRef(PaginationComponent)
                ], template: "\n<ul class=\"pagination advanced {{navigationClass}}\" *ngIf=\"navcontrols === 'Classic'\">\n    <li [ngClass]=\"{'disabled':isDisableFirst}\">\n        <a [title]=\"appLocale.LABEL_FIRST\" name=\"first\" href=\"javascript:void(0);\"\n           [attr.aria-disabled]=\"isDisableFirst\"\n           (click)=\"navigatePage('first', $event)\">\n            <span aria-hidden=\"true\"><i class=\"wi wi-first-page\"></i></span>\n            <span class=\"sr-only\">Go to first page {{ isDisableFirst ? ' , Disabled' : ''}}</span>\n        </a>\n    </li>\n    <li [ngClass]=\"{'disabled':isDisablePrevious}\">\n        <a [title]=\"appLocale.LABEL_PREVIOUS\" name=\"prev\" href=\"javascript:void(0);\"\n            [attr.aria-disabled]=\"isDisablePrevious\"\n            (click)=\"navigatePage('prev', $event)\">\n            <span aria-hidden=\"true\"><i class=\"wi wi-chevron-left\"></i></span>\n            <span class=\"sr-only\">Go to previous page {{ isDisablePrevious ? ', Disabled' : ''}}</span>\n        </a>\n    </li>\n    <li class=\"pagecount disabled\">\n        <a href=\"javascript:void(0);\">\n            <input [(ngModel)]=\"dn.currentPage\" [attr.aria-label]=\"'Showing Page ' + dn.currentPage + ' of ' + pageCount\" [disabled]=\"isDisableCurrent\"\n                   [ngModelOptions]=\"{standalone: true}\"\n                   type=\"number\"\n                  (keydown)=\"onKeyDown($event)\" (change)=\"onModelChange($event)\" class=\"form-control\"/>\n        </a>\n    </li>\n    <li class=\"disabled\">\n        <a [hidden]=\"isDisableCount\"> / {{pageCount}}</a>\n    </li>\n    <li [ngClass]=\"{'disabled':isDisableNext}\">\n        <a [title]=\"appLocale.LABEL_NEXT\" name=\"next\" href=\"javascript:void(0);\"\n           [attr.aria-disabled]=\"isDisableNext\"\n           (click)=\"navigatePage('next', $event)\">\n            <span aria-hidden=\"true\"><i class=\"wi wi-chevron-right\"></i></span>\n            <span class=\"sr-only\">Go to next page {{ isDisableNext ? ' , Disabled' : ''}}</span>\n        </a>\n    </li>\n    <li [ngClass]=\"{'disabled':isDisableLast}\">\n        <a [title]=\"appLocale.LABEL_LAST\" name=\"last\" href=\"javascript:void(0);\"\n           [attr.aria-disabled]=\"isDisableLast\"\n           (click)=\"navigatePage('last', $event)\">\n            <span aria-hidden=\"true\"><i class=\"wi wi-last-page\"></i></span>\n            <span class=\"sr-only\">Go to last page {{ isDisableLast ? ' , Disabled' : ''}}</span>\n        </a>\n    </li>\n    <li *ngIf=\"showrecordcount\" class=\"totalcount disabled\">\n        <a href=\"javascript:void(0);\" tabindex=\"-1\" aria-disabled=\"true\">{{appLocale.LABEL_TOTAL_RECORDS}}: {{dataSize}}</a>\n    </li>\n</ul>\n<ul class=\"pager {{navigationClass}}\" *ngIf=\"navcontrols === 'Pager'\">\n    <li class=\"previous\" [ngClass]=\"{'disabled':isDisablePrevious}\">\n        <a href=\"javascript:void(0);\" (click)=\"navigatePage('prev', $event)\"\n           [attr.aria-disabled]=\"isDisablePrevious\">\n            <span aria-hidden=\"true\"><i class=\"wi wi-chevron-left\"></i></span>\n            {{appLocale.LABEL_PREVIOUS}}\n            <span class=\"sr-only\">{{ isDisablePrevious ? ' , Disabled' : ''}}</span>\n        </a>\n    </li>\n    <li class=\"next\" [ngClass]=\"{'disabled':isDisableNext}\">\n        <a href=\"javascript:void(0);\" (click)=\"navigatePage('next', $event)\"\n           [attr.aria-disabled]=\"isDisableNext\">\n            <span aria-hidden=\"true\"><i class=\"wi wi-chevron-right\"></i></span>\n            {{appLocale.LABEL_NEXT}}\n            <span class=\"sr-only\">{{ isDisableNext ? ' , Disabled' : ''}}</span>\n        </a>\n    </li>\n</ul>\n\n<pagination class=\"pagination basic\" [ngClass]=\"navigationClass\" *ngIf=\"navcontrols === 'Basic'\" role=\"navigation\"\n            [itemsPerPage]=\"maxResults\" [totalItems]=\"dataSize\"\n            (pageChanged)=\"pageChanged($event)\" [ngModelOptions]=\"{standalone:true}\" [ngModel]=\"dn.currentPage\"\n            [attr.aria-label]=\"'Showing Page ' + dn.currentPage + ' of ' + pageCount + ' pages'\"\n            [boundaryLinks]=\"boundarylinks\" [maxSize]=\"maxsize\"\n            [directionLinks]=\"directionlinks\"\n            firstText=\"Firtst\" lastText=\"Last\"\n            [customPreviousTemplate]=\"prevTemplate\"\n            [customNextTemplate]=\"nextTemplate\"\n            [customPageTemplate]=\"pageTemplate\"></pagination>\n\n<ul *ngIf=\"navcontrols === 'Basic' && showrecordcount\" class=\"pagination\">\n    <li class=\"totalcount disabled basiccount\">\n        <a href=\"javascript:void(0);\" tabindex=\"-1\" aria-disabled=\"true\">{{appLocale.LABEL_TOTAL_RECORDS}}: {{dataSize}}</a>\n    </li>\n</ul>\n\n<ng-template #pageTemplate let-page>\n    <span class=\"sr-only\" [attr.data-isacitvepage]=\"page.active\">{{'Page '}}</span>\n    {{page.number}}\n    <span class=\"sr-only\" *ngIf=\"page.active\"> {{', Showing page ' + page.number + ' of ' + pageCount}}</span>\n</ng-template>\n<ng-template #prevTemplate let-disabled=\"disabled\">\n    <span class=\"sr-only\" [attr.data-isdisabled]=\"disabled\">Go to Previous page {{disabled ? ', Disabled' : ''}}</span>\n</ng-template>\n<ng-template #nextTemplate let-disabled=\"disabled\">\n    <span class=\"sr-only\" [attr.data-isdisabled]=\"disabled\">Go to Next page {{disabled ? ', Disabled' : ''}}</span>\n</ng-template>\n" }]
    }], () => [{ type: i0.Injector }, { type: undefined, decorators: [{
                type: SkipSelf
            }, {
                type: Inject,
                args: [WidgetRef]
            }] }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], { resultEmitter: [{
            type: Output
        }], maxResultsEmitter: [{
            type: Output
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(PaginationComponent, { className: "PaginationComponent", filePath: "pagination.component.ts", lineNumber: 41 }); })();

const components = [
    PaginationComponent
];
class PaginationModule {
    static { this.ɵfac = function PaginationModule_Factory(t) { return new (t || PaginationModule)(); }; }
    static { this.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: PaginationModule }); }
    static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
            FormsModule,
            PaginationModule$1,
            WmComponentsModule] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PaginationModule, [{
        type: NgModule,
        args: [{
                imports: [
                    CommonModule,
                    FormsModule,
                    PaginationModule$1,
                    WmComponentsModule
                ],
                declarations: [...components],
                exports: [...components]
            }]
    }], null, null); })();
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(PaginationModule, { declarations: [PaginationComponent], imports: [CommonModule,
        FormsModule,
        PaginationModule$1,
        WmComponentsModule], exports: [PaginationComponent] }); })();

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

export { PaginationComponent, PaginationModule };
//# sourceMappingURL=index.mjs.map
