"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("../..");
var index_1 = require("./index");
var PDFAcroForm = /** @class */ (function () {
    function PDFAcroForm(dict) {
        this.dict = dict;
    }
    PDFAcroForm.fromDict = function (dict) {
        if (!dict.has(core_1.PDFName.of('Fields'))) {
            dict.set(core_1.PDFName.of('Fields'), dict.context.obj([]));
        }
        return new PDFAcroForm(dict);
    };
    PDFAcroForm.prototype.Fields = function () {
        var fieldDicts = this.dict
            .lookup(core_1.PDFName.of('Fields'), core_1.PDFArray)
            .lookupElements(core_1.PDFDict);
        var fields = new Array(fieldDicts.length);
        for (var idx = 0, len = fieldDicts.length; idx < len; idx++) {
            fields[idx] = index_1.PDFAcroField.fromDict(fieldDicts[idx]);
        }
        return fields;
    };
    PDFAcroForm.prototype.NeedsAppearances = function () {
        return this.dict.lookupMaybe(core_1.PDFName.of('NeedsAppearances'), core_1.PDFBool);
    };
    PDFAcroForm.prototype.SigFlags = function () {
        return this.dict.lookupMaybe(core_1.PDFName.of('SigFlags'), core_1.PDFNumber);
    };
    PDFAcroForm.prototype.DR = function () {
        return this.dict.lookupMaybe(core_1.PDFName.of('DR'), core_1.PDFDict);
    };
    PDFAcroForm.prototype.DA = function () {
        return this.dict.lookupMaybe(core_1.PDFName.of('DA'), core_1.PDFString);
    };
    PDFAcroForm.prototype.Q = function () {
        return this.dict.lookupMaybe(core_1.PDFName.of('Q'), core_1.PDFNumber);
    };
    PDFAcroForm.prototype.XFA = function () {
        return this.dict.lookup(core_1.PDFName.of('XFA'));
    };
    return PDFAcroForm;
}());
exports.default = PDFAcroForm;
//# sourceMappingURL=PDFAcroForm.js.map