import { __generator } from "tslib";
import { ensureBool } from "igniteui-angular-core";
import { IgxChartSummaryDescription } from "./igx-chart-summary-description";
import { ChartSummaryDescriptionCollection as ChartSummaryDescriptionCollection_internal } from "./ChartSummaryDescriptionCollection";
var IgxChartSummaryDescriptionCollection = /** @class */ /*@__PURE__*/ (function () {
    function IgxChartSummaryDescriptionCollection() {
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    IgxChartSummaryDescriptionCollection.prototype.createImplementation = function () {
        return new ChartSummaryDescriptionCollection_internal();
    };
    Object.defineProperty(IgxChartSummaryDescriptionCollection.prototype, "i", {
        get: function () {
            return this._implementation;
        },
        enumerable: false,
        configurable: true
    });
    IgxChartSummaryDescriptionCollection.prototype.onImplementationCreated = function () {
    };
    IgxChartSummaryDescriptionCollection.prototype._provideImplementation = function (i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    };
    IgxChartSummaryDescriptionCollection.prototype.item = function (index, value) {
        var int = null;
        if (value !== undefined) {
            int = this.i.set(index, value == null ? null : value.i);
        }
        else {
            int = this.i.get(index);
        }
        var ext = null;
        if (int != null) {
            ext = int.externalObject;
            if (!ext) {
                ext = new IgxChartSummaryDescription();
                ext._implementation = int;
                int.externalObject = ext;
            }
        }
        return ext;
    };
    Object.defineProperty(IgxChartSummaryDescriptionCollection.prototype, "count", {
        get: function () {
            return this.i.size();
        },
        enumerable: false,
        configurable: true
    });
    IgxChartSummaryDescriptionCollection.prototype.toArray = function () {
        var arr = [];
        for (var i = 0; i < this.count; i++) {
            arr[i] = this.item(i);
        }
        return arr;
    };
    IgxChartSummaryDescriptionCollection.prototype[Symbol.iterator] = function () {
        var i, item;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    i = 0;
                    _a.label = 1;
                case 1:
                    if (!(i < this.count))
                        return [3 /*break*/, 4];
                    item = this.item(i);
                    if (item.externalObject) {
                        item = item.externalObject;
                    }
                    return [4 /*yield*/, item];
                case 2:
                    _a.sent();
                    _a.label = 3;
                case 3:
                    i++;
                    return [3 /*break*/, 1];
                case 4: return [2 /*return*/];
            }
        });
    };
    Object.defineProperty(IgxChartSummaryDescriptionCollection.prototype, "shouldDetachOnTargetChange", {
        /**
     * Gets or sets whether this collection should detach the sync when the target collection changes.
    */
        get: function () {
            return this.i.i;
        },
        set: function (v) {
            this.i.i = ensureBool(v);
        },
        enumerable: false,
        configurable: true
    });
    IgxChartSummaryDescriptionCollection.prototype.findByName = function (name) {
        if (this.findEphemera) {
            if (name && name.indexOf("@@e:") == 0) {
                return this.findEphemera(name);
            }
        }
        return null;
    };
    IgxChartSummaryDescriptionCollection.prototype.add = function (item) {
        var iv = this.i.g((item == null ? null : item.i));
        return (iv);
    };
    IgxChartSummaryDescriptionCollection.prototype.insert = function (index, item) {
        this.i.o(index, (item == null ? null : item.i));
    };
    IgxChartSummaryDescriptionCollection.prototype.clear = function () {
        this.i.n();
    };
    IgxChartSummaryDescriptionCollection.prototype.indexOf = function (item) {
        var iv = this.i.k((item == null ? null : item.i));
        return (iv);
    };
    IgxChartSummaryDescriptionCollection.prototype.remove = function (item) {
        var iv = this.i.h((item == null ? null : item.i));
        return (iv);
    };
    IgxChartSummaryDescriptionCollection.prototype.removeAt = function (index) {
        var iv = this.i.b(index);
        var ret = null;
        if (iv && iv.externalObject) {
            ret = iv.externalObject;
        }
        else {
            if (iv) {
                var e = new IgxChartSummaryDescription();
                e._implementation = iv;
                iv.externalObject = e;
                ret = e;
            }
        }
        return ret;
    };
    return IgxChartSummaryDescriptionCollection;
}());
export { IgxChartSummaryDescriptionCollection };
