"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Semifunctional_1 = require("../../../Class/Semifunctional");
const FormData_1 = require("../../../wrap/FormData");
const _ids_1 = require("../../_ids");
class FormData_ extends Semifunctional_1.Semifunctional {
    constructor(system) {
        super({
            fi: ['data'],
            fo: ['form'],
            i: ['done'],
            o: [],
        }, {
            output: {
                form: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_FORM_DATA);
        this.__ = ['U'];
    }
    f(i, done) {
        const { data } = i;
        const form_ = new FormData();
        for (const key in data) {
            if (data.hasOwnProperty(key)) {
                const value = data[key];
                form_.append(key, value);
            }
        }
        const form = (0, FormData_1.wrapFormData)(form_, this.__system);
        done({
            form,
        });
    }
    onIterDataInputData(name, data) {
        super.onIterDataInputData(name, data);
        // if (name === 'done') {
        this._forward_all_empty();
        this._backward_all();
        this._backward('done');
        // }
    }
}
exports.default = FormData_;
//# sourceMappingURL=index.js.map