"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const context_1 = require("./interop/context");
const fnPtrHandler_1 = require("./interop/fnPtrHandler");
const importer_1 = require("./interop/importer");
const wrapSassImporter_1 = require("./interop/importer/wrapSassImporter");
const interopUtility_1 = require("./interop/interopUtility");
const miscellaneous_1 = require("./interop/miscellaneous");
const wrapSassOptions_1 = require("./interop/options/wrapSassOptions");
const wrapSassContext_1 = require("./interop/wrapSassContext");
/**
 * Create SassFactory interface object through loaded libass wasm module.
 *
 * @param {SassAsmModule} asmModule wasm module
 * @returns {SassFactory}
 */
exports.sassLoader = (asmModule) => {
    const { cwrap } = asmModule;
    const cwrapCtx = wrapSassContext_1.wrapSassContext(cwrap);
    const cwrapOptions = wrapSassOptions_1.wrapSassOptions(cwrap);
    const cwrapImporter = wrapSassImporter_1.wrapSassImporter(cwrap);
    const interop = interopUtility_1.buildInteropUtility(asmModule);
    const fnPtrHandler = fnPtrHandler_1.getFnPtrHandler(asmModule);
    return {
        getVersion: miscellaneous_1.getVersion(asmModule),
        context: context_1.buildContext(cwrapCtx, cwrapOptions, cwrapImporter, interop),
        importer: importer_1.buildImporter(cwrapImporter, interop, fnPtrHandler),
        interop,
        raw: {
            context: cwrapCtx,
            options: cwrapOptions,
            importer: cwrapImporter
        }
    };
};
//# sourceMappingURL=sassLoader.js.map