"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ojColorSpectrum = exports.OjColorSpectrum = void 0;
const __1 = require("../../");
const OjColorSpectrum_1 = require("./OjColorSpectrum");
Object.defineProperty(exports, "OjColorSpectrum", { enumerable: true, get: function () { return OjColorSpectrum_1.OjColorSpectrum; } });
/**
 * Retrieve an instance of [OjColorSpectrum](../classes/elements.OjColorSpectrum.html).
 * @example
 * ```javascript
 * import { ojColorSpectrum } from '@oracle/oraclejet-webdriver/elements';
 * const el = await ojColorSpectrum(driver, By.id('my-oj-color-spectrum'));
 * ```
 * @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 ojColorSpectrum(driver, by) {
    const webEl = await driver.findElement(by);
    // Check that the element is of type OjColorSpectrum
    if (!(webEl instanceof OjColorSpectrum_1.OjColorSpectrum)) {
        const tagName = await webEl.getTagName();
        let supplemental = '';
        if (webEl.constructor.name === 'OjColorSpectrum') {
            supplemental = 'You likely have multiple installations of this package.';
        }
        throw Error(`ojColorSpectrum(${by}) created ${webEl.constructor.name} for <${tagName}>, but expected ${OjColorSpectrum_1.OjColorSpectrum.name}. ${supplemental}`);
    }
    return webEl;
}
exports.ojColorSpectrum = ojColorSpectrum;
(0, __1.register)('oj-color-spectrum', OjColorSpectrum_1.OjColorSpectrum);
//# sourceMappingURL=index.js.map