"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Functional_1 = require("../../../../../Class/Functional");
const _ids_1 = require("../../../../_ids");
class CreateObjectURI extends Functional_1.Functional {
    constructor(system) {
        super({
            i: ['blob', 'init'],
            o: ['url'],
        }, {
            input: {
                blob: {
                    ref: true,
                },
            },
        }, system, _ids_1.ID_CREATE_OBJECT_URL);
    }
    async f({ blob, init }, done) {
        const { api: { url: { createObjectURL }, }, } = this.__system;
        let url;
        const _blob = await blob.blob();
        try {
            url = await createObjectURL(_blob);
        }
        catch (err) {
            done(undefined, err.message);
            return;
        }
        done({ url });
    }
}
exports.default = CreateObjectURI;
//# sourceMappingURL=index.js.map