"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ojChart = exports.OjChart = void 0;
const __1 = require("../../");
const OjChart_1 = require("./OjChart");
Object.defineProperty(exports, "OjChart", { enumerable: true, get: function () { return OjChart_1.OjChart; } });
/**
 * Retrieve an instance of [OjChart](../classes/elements.OjChart.html).
 * @example
 * ```javascript
 * import { ojChart } from '@oracle/oraclejet-webdriver/elements';
 * const el = await ojChart(driver, By.id('my-oj-chart'));
 * ```
 * @param driver A WebDriver/WebElement instance from where the element will be
 * searched. If WebDriver is passed, the element will be searched globally in the
 * document. If WebElement is passed, the search will be relative to this element.
 * @param by The locator with which to find the element
 */
async function ojChart(driver, by) {
    const webEl = await driver.findElement(by);
    // Check that the element is of type OjChart
    if (!(webEl instanceof OjChart_1.OjChart)) {
        const tagName = await webEl.getTagName();
        let supplemental = '';
        if (webEl.constructor.name === 'OjChart') {
            supplemental = 'You likely have multiple installations of this package.';
        }
        throw Error(`ojChart(${by}) created ${webEl.constructor.name} for <${tagName}>, but expected ${OjChart_1.OjChart.name}. ${supplemental}`);
    }
    return webEl;
}
exports.ojChart = ojChart;
(0, __1.register)('oj-chart', OjChart_1.OjChart);
//# sourceMappingURL=index.js.map