"use strict";
/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Widget
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.PopoutWidget = void 0;
const React = require("react");
const ReactDOM = require("react-dom");
const Widget_1 = require("../../layout/widget/Widget");
const ContentContainer_1 = require("../../layout/widget/ContentContainer");
const usePopoutsStore_1 = require("./usePopoutsStore");
/** @internal */
function PopoutWidget() {
    const widgetId = React.useContext(Widget_1.WidgetIdContext);
    const popoutContainer = (0, usePopoutsStore_1.usePopoutsStore)((state) => widgetId ? state.popouts[widgetId] : undefined);
    if (!popoutContainer)
        return null;
    return ReactDOM.createPortal(React.createElement(ContentContainer_1.WidgetContentContainer, null), popoutContainer);
}
exports.PopoutWidget = PopoutWidget;
//# sourceMappingURL=PopoutWidget.js.map