"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBaseUrlDetails = getBaseUrlDetails;
// @ts-expect-error
const ypath_1 = __importDefault(require("@ytsaurus/interface-helpers/lib/ypath"));
function getBaseUrlDetails(uiSettings, key) {
    const { [key]: baseUrl } = uiSettings;
    if (!baseUrl) {
        return {};
    }
    const testing = ypath_1.default.get(baseUrl, '/@testing');
    const use_cors = ypath_1.default.get(baseUrl, '/@use_cors');
    const res = typeof baseUrl === 'string' ? baseUrl : baseUrl?.$value;
    return {
        baseUrl: res.endsWith('/') ? res.slice(0, -1) : res,
        testing,
        use_cors,
    };
}
