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