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