import { __assign, __extends } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import { Component, Children, cloneElement } from 'react';
import PopoverContext from '../Context';
import Anchor from '../Anchor';
var PopoverTrigger = (function (_super) {
    __extends(PopoverTrigger, _super);
    function PopoverTrigger() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PopoverTrigger.prototype.getTriggerProps = function (_child) {
        return {};
    };
    PopoverTrigger.prototype.render = function () {
        var child = Children.only(this.props.children);
        if (!child) {
            throw new Error('Popover Trigger requires a child');
        }
        if (typeof child === 'number' || typeof child === 'string') {
            child = _jsx("span", __assign({ "data-zv": 'v10.0.12' }, { children: child }), void 0);
        }
        return _jsx(Anchor, { children: cloneElement(child, this.getTriggerProps(child)) }, void 0);
    };
    PopoverTrigger.contextType = PopoverContext;
    return PopoverTrigger;
}(Component));
export { PopoverTrigger };
export default PopoverTrigger;
