"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Semifunctional_1 = require("../../../../../Class/Semifunctional");
const _ids_1 = require("../../../../_ids");
class ToDataUrl extends Semifunctional_1.Semifunctional {
    constructor(system) {
        super({
            fi: ['canvas', 'quality', 'type'],
            fo: ['url'],
            i: [],
            o: ['done'],
        }, {
            input: {
                canvas: {
                    ref: true,
                },
            },
            output: {
                url: {},
            },
        }, system, _ids_1.ID_TO_DATA_URL);
    }
    async f({ canvas, quality, type }, done, fail) {
        let url;
        try {
            url = await canvas.toDataUrl(type, quality);
        }
        catch (err) {
            fail(err.message);
            return;
        }
        done({
            url,
        });
    }
    b() {
        this._output.done.push(true);
    }
}
exports.default = ToDataUrl;
//# sourceMappingURL=index.js.map