"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeCore = void 0;
const logger_1 = require("@applitools/logger");
const core_base_1 = require("@applitools/core-base");
const get_viewport_size_1 = require("../automation/get-viewport-size");
const set_viewport_size_1 = require("../automation/set-viewport-size");
const locate_1 = require("../automation/locate");
const locate_text_1 = require("../automation/locate-text");
const extract_text_1 = require("../automation/extract-text");
const get_nml_client_1 = require("../automation/get-nml-client");
const get_ufg_client_1 = require("./get-ufg-client");
const open_eyes_1 = require("./open-eyes");
const utils = __importStar(require("@applitools/utils"));
function makeCore({ spec, clients, base: defaultBase, concurrency, fetchConcurrency, agentId = 'core-ufg', cwd = process.cwd(), logger: defaultLogger, asyncCache, }) {
    const logger = (0, logger_1.makeLogger)({ logger: defaultLogger, format: { label: 'core-ufg' } });
    logger.log(`Core ufg is initialized ${defaultBase ? 'with' : 'without'} custom base core`);
    const base = defaultBase !== null && defaultBase !== void 0 ? defaultBase : (0, core_base_1.makeCore)({ agentId, concurrency, cwd, logger });
    return utils.general.extend(base, core => {
        return {
            type: 'ufg',
            base: base,
            getViewportSize: spec && (0, get_viewport_size_1.makeGetViewportSize)({ spec, logger }),
            setViewportSize: spec && (0, set_viewport_size_1.makeSetViewportSize)({ spec, logger }),
            locate: (0, locate_1.makeLocate)({ spec, core, logger }),
            locateText: (0, locate_text_1.makeLocateText)({ spec, core, logger }),
            extractText: (0, extract_text_1.makeExtractText)({ spec, core, logger }),
            getUFGClient: (0, get_ufg_client_1.makeGetUFGClient)({ client: clients === null || clients === void 0 ? void 0 : clients.ufg, fetchConcurrency, asyncCache, logger }),
            getNMLClient: (0, get_nml_client_1.makeGetNMLClient)({ client: clients === null || clients === void 0 ? void 0 : clients.nml, logger }),
            openEyes: (0, open_eyes_1.makeOpenEyes)({ spec, core, logger }),
        };
    });
}
exports.makeCore = makeCore;
