/**
 * Used in InputWithOptions.uni.driver only.
 *
 * Because popover content (with dropdown inside) is rendered conditionally, this proxy
 * updates some dropdown methods.
 */
export const dropdownLayoutDriverProxy = (drodownLayoutFromRoot, dropdownLayoutTestkit, popoverTestkit, inputDriver) => ({
    ...Object.keys(drodownLayoutFromRoot()).reduce((prev, current) => {
        return {
            ...prev,
            [current]: async (...args) => {
                const isPopoverShown = await popoverTestkit().isContentElementExists();
                if (current === 'isShown' || current === 'exists') {
                    return isPopoverShown;
                }
                if (current === 'getDropdown' || current === 'getDropdownItem') {
                    return isPopoverShown
                        ? //@ts-ignore
                            (await dropdownLayoutTestkit())[current](...args)
                        : { isDisplayed: () => false };
                }
                !isPopoverShown && (await inputDriver.click());
                //@ts-ignore
                return await (await dropdownLayoutTestkit())[current](...args);
            },
        };
    }, {}),
});
//# sourceMappingURL=InputWithOptions.proxy.driver.js.map