/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { ObservableCollection$1 } from "igniteui-webcomponents-core";
import { PrimaryKeyValue } from "./PrimaryKeyValue";
import { PropertyChangedEventArgs, delegateCombine, Number_$type, fromEnum, markType } from "igniteui-webcomponents-core";
import { NotifyCollectionChangedEventArgs } from "igniteui-webcomponents-core";
import { Dictionary$2 } from "igniteui-webcomponents-core";
/**
 * @hidden
 */
export let GridSelectedKeysCollection = /*@__PURE__*/ (() => {
    class GridSelectedKeysCollection extends ObservableCollection$1 {
        constructor() {
            super(PrimaryKeyValue.$, 0);
            this.af = false;
            this.ag = new Dictionary$2(PrimaryKeyValue.$, Number_$type, 0);
            this.ah = new Dictionary$2(Number_$type, PrimaryKeyValue.$, 0);
        }
        get ae() {
            return this;
        }
        aj(a) {
            this.collectionChanged = delegateCombine(this.collectionChanged, a);
        }
        n(a) {
            super.n(a);
            this.ag.addItem(a, this.count - 1);
            this.ah.addItem(this.count - 1, a);
        }
        o(a) {
            let b = this.count;
            super.o(a);
            for (let c of fromEnum(a)) {
                this.ag.addItem(c, b);
                this.ah.addItem(b, c);
                b++;
            }
        }
        p() {
            super.p();
            this.ag.clear();
            this.ah.clear();
        }
        u(a) {
            if (this.ah.containsKey(a)) {
                let b = this.ah.item(a);
                this.ag.removeItem(b);
                this.ah.removeItem(a);
                for (let c = a + 1; c < this.count; c++) {
                    if (this.ah.containsKey(c)) {
                        let d = this.ah.item(c);
                        this.ah.removeItem(c);
                        this.ah.addItem(c - 1, d);
                        this.ag.item(d, c - 1);
                    }
                }
            }
            let e = this._inner[a];
            if (a == 0) {
                this._inner.shift();
            }
            else {
                this._inner.splice(a, 1);
            }
            this.ad(new PropertyChangedEventArgs("Count"));
            this.ad(new PropertyChangedEventArgs("Item[]"));
            if (!this.af) {
                this.ac(new NotifyCollectionChangedEventArgs(1, 1, e, a));
            }
        }
        v(index_, numToRemove_) {
            super.v(index_, numToRemove_);
            for (let a = index_; a < index_ + numToRemove_; a++) {
                if (this.ah.containsKey(a)) {
                    let b = this.ah.item(a);
                    this.ag.removeItem(b);
                    this.ah.removeItem(a);
                }
            }
        }
        x(a, b) {
            super.x(a, b);
            if (this.ah.containsKey(a)) {
                let c = this.ah.item(a);
                this.ah.item(a, b);
                this.ag.removeItem(c);
                this.ag.addItem(b, a);
            }
        }
        r(a, b) {
            super.r(a, b);
            for (let c = a; c < this.count; c++) {
                let d = this._inner[c];
                if (this.ag.containsKey(d)) {
                    this.ag.item(d, c);
                    this.ah.removeItem(c);
                    this.ah.addItem(c, d);
                }
                else {
                    this.ag.addItem(d, c);
                    this.ah.addItem(c, d);
                }
            }
        }
        ai(a) {
            if (this.ag.containsKey(a)) {
                return this.ag.item(a);
            }
            return -1;
        }
    }
    GridSelectedKeysCollection.$t = /*@__PURE__*/ markType(GridSelectedKeysCollection, 'GridSelectedKeysCollection', /*@__PURE__*/ ObservableCollection$1.$.specialize(PrimaryKeyValue.$));
    return GridSelectedKeysCollection;
})();
//# sourceMappingURL=GridSelectedKeysCollection.js.map
