"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Functional_1 = require("../../../../../Class/Functional");
const _ids_1 = require("../../../../_ids");
class At0 extends Functional_1.Functional {
    constructor(system) {
        super({
            i: ['a', 'i'],
            o: ['a[i]'],
        }, {
            input: {
                a: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_AT_0);
    }
    async f({ a, i }, done, fail) {
        let _a_i;
        try {
            const l = await a.length();
            if (i >= 0 && i < l) {
                _a_i = await a.at(i);
            }
            else {
                fail('index out of boundary');
                return;
            }
        }
        catch (err) {
            fail(err.message.toLowerCase());
            return;
        }
        done({ 'a[i]': _a_i });
    }
}
exports.default = At0;
//# sourceMappingURL=index.js.map