require("./Tooltip.css");
var $914a06b3a1c679bc$exports = require("./Provider.cjs");
var $150382364eecc4bc$exports = require("./useDOMRef.cjs");
var $8KZCJ$reactjsxruntime = require("react/jsx-runtime");
var $8KZCJ$reactariacomponentsTooltip = require("react-aria-components/Tooltip");
var $8KZCJ$react = require("react");
var $8KZCJ$reactariaI18nProvider = require("react-aria/I18nProvider");


function $parcel$export(e, n, v, s) {
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}

$parcel$export(module.exports, "Tooltip", () => $d3b6a84aebe66f8d$export$28c660c63b792dea);
$parcel$export(module.exports, "TooltipTrigger", () => $d3b6a84aebe66f8d$export$8c610744efcf8a1d);
/*
 * Copyright 2024 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */ 





const $d3b6a84aebe66f8d$var$tooltip = function anonymous(props) {
    let rules = " ";
    if (props.colorScheme === "dark") rules += ' -ICUGx-_pa12';
    else if (props.colorScheme === "light") rules += ' -ICUGx-_pb12';
    else if (props.colorScheme === "light dark") rules += ' -ICUGx-_pc12';
    rules += ' _pK8eoyd12';
    rules += ' _Ca12';
    rules += ' eb12';
    rules += ' Le12';
    rules += ' MAyFGYc12';
    rules += ' _oa12';
    rules += ' uk12';
    rules += ' ucJ9TBTb12';
    rules += ' ud3Euai12';
    rules += ' uea12';
    rules += ' ugb12';
    rules += ' uhd12';
    rules += ' uje12';
    rules += ' u2NhKxcl12';
    rules += ' uic12';
    rules += ' -_6BNtrc-b12';
    rules += ' vx12';
    rules += ' xb12';
    rules += ' _xa12';
    rules += ' _Fd12';
    rules += ' _FnuYUweb12';
    rules += ' pr12';
    rules += ' plb12';
    rules += ' _kJ8iPYd12';
    rules += ' hXMFGYc12';
    rules += ' mlb12';
    rules += ' llb12';
    rules += ' _jlf12';
    rules += ' ilA12';
    rules += ' g012';
    rules += ' ob12';
    rules += ' nb12';
    rules += ' kb12';
    rules += ' jb12';
    rules += ' Sv12';
    rules += ' Rv12';
    rules += ' Tu7Fubd12';
    rules += ' Qu7Fubd12';
    rules += ' Yd12';
    rules += ' Xc12';
    if (props.isExiting) rules += ' _2c12';
    if (props.placement === "right") {
        if (props.isExiting) {
            rules += ' -_7PloMd-m12';
            rules += ' __Ya12';
        } else if (props.isEntering) {
            rules += ' -_7PloMd-m12';
            rules += ' __Ya12';
        }
    } else if (props.placement === "left") {
        if (props.isExiting) {
            rules += ' -_7PloMd-G12';
            rules += ' __Ya12';
        } else if (props.isEntering) {
            rules += ' -_7PloMd-G12';
            rules += ' __Ya12';
        }
    }
    if (props.placement === "bottom") {
        if (props.isExiting) {
            rules += ' -_8PloMd-l12';
            rules += ' __Ya12';
        } else if (props.isEntering) {
            rules += ' -_8PloMd-l12';
            rules += ' __Ya12';
        }
    } else if (props.placement === "top") {
        if (props.isExiting) {
            rules += ' -_8PloMd-F12';
            rules += ' __Ya12';
        } else if (props.isEntering) {
            rules += ' -_8PloMd-F12';
            rules += ' __Ya12';
        }
    }
    if (props.isExiting) rules += ' _Ia12';
    else if (props.isEntering) rules += ' _Ia12';
    rules += ' -nTSCV-LTAEPe12';
    rules += ' -M_-Mg12';
    rules += ' -_k_-l_kb12';
    rules += ' -h_-lhb12';
    return rules;
};
const $d3b6a84aebe66f8d$var$arrowStyles = function anonymous(props) {
    let rules = " ";
    rules += ' sb12';
    rules += ' tr12';
    rules += ' Zi12';
    rules += ' Ff12';
    if (props.placement === "right") rules += ' _Sd12';
    else if (props.placement === "left") rules += ' _Sa12';
    else if (props.placement === "bottom") rules += ' _Sc12';
    else if (props.placement === "top") rules += ' _Sb12';
    if (props.placement === "right") {
        rules += ' -_7PloMd-y12';
        rules += ' __Ya12';
    } else if (props.placement === "left") {
        rules += ' -_7PloMd-e12';
        rules += ' __Ya12';
    }
    return rules;
};
let $d3b6a84aebe66f8d$var$InternalTooltipTriggerContext = /*#__PURE__*/ (0, $8KZCJ$react.createContext)({});
const $d3b6a84aebe66f8d$export$28c660c63b792dea = /*#__PURE__*/ (0, $8KZCJ$react.forwardRef)(function Tooltip(props, ref) {
    let { children: children, UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '' } = props;
    let domRef = (0, $150382364eecc4bc$exports.useDOMRef)(ref);
    let { containerPadding: containerPadding, crossOffset: crossOffset, placement: placement = 'top', shouldFlip: shouldFlip } = (0, $8KZCJ$react.useContext)($d3b6a84aebe66f8d$var$InternalTooltipTriggerContext);
    let colorScheme = (0, $8KZCJ$react.useContext)((0, $914a06b3a1c679bc$exports.ColorSchemeContext));
    let { locale: locale, direction: direction } = (0, $8KZCJ$reactariaI18nProvider.useLocale)();
    let [borderRadius, setBorderRadius] = (0, $8KZCJ$react.useState)(0);
    // TODO: should we pass through lang and dir props in RAC?
    let tooltipRef = (0, $8KZCJ$react.useCallback)((el)=>{
        domRef.current = el;
        if (el) {
            el.lang = locale;
            el.dir = direction;
            let spectrumBorderRadius = typeof window !== 'undefined' ? window.getComputedStyle(el).borderRadius : '';
            if (spectrumBorderRadius !== '') setBorderRadius(parseInt(spectrumBorderRadius, 10));
        }
    }, [
        locale,
        direction,
        domRef
    ]);
    return /*#__PURE__*/ (0, $8KZCJ$reactjsxruntime.jsx)((0, $8KZCJ$reactariacomponentsTooltip.Tooltip), {
        ...props,
        arrowBoundaryOffset: borderRadius,
        containerPadding: containerPadding,
        crossOffset: crossOffset,
        offset: 9,
        placement: placement,
        shouldFlip: shouldFlip,
        ref: tooltipRef,
        style: UNSAFE_style,
        className: (renderProps)=>UNSAFE_className + $d3b6a84aebe66f8d$var$tooltip({
                ...renderProps,
                colorScheme: colorScheme
            }),
        children: (renderProps)=>/*#__PURE__*/ (0, $8KZCJ$reactjsxruntime.jsxs)((0, $8KZCJ$reactjsxruntime.Fragment), {
                children: [
                    /*#__PURE__*/ (0, $8KZCJ$reactjsxruntime.jsx)((0, $8KZCJ$reactariacomponentsTooltip.OverlayArrow), {
                        className: "",
                        children: /*#__PURE__*/ (0, $8KZCJ$reactjsxruntime.jsx)("svg", {
                            className: $d3b6a84aebe66f8d$var$arrowStyles(renderProps),
                            xmlns: "http://www.w3.org/2000/svg",
                            viewBox: "0 0 10 5",
                            children: /*#__PURE__*/ (0, $8KZCJ$reactjsxruntime.jsx)("path", {
                                d: "M4.29289 4.29289L0 0H10L5.70711 4.29289C5.31658 4.68342 4.68342 4.68342 4.29289 4.29289Z"
                            })
                        })
                    }),
                    children
                ]
            })
    });
});
function $d3b6a84aebe66f8d$export$8c610744efcf8a1d(props) {
    let { containerPadding: containerPadding, crossOffset: crossOffset, placement: placement, shouldFlip: shouldFlip, ...triggerProps } = props;
    return /*#__PURE__*/ (0, $8KZCJ$reactjsxruntime.jsx)((0, $8KZCJ$reactariacomponentsTooltip.TooltipTrigger), {
        ...triggerProps,
        children: /*#__PURE__*/ (0, $8KZCJ$reactjsxruntime.jsx)($d3b6a84aebe66f8d$var$InternalTooltipTriggerContext.Provider, {
            value: {
                containerPadding: containerPadding,
                crossOffset: crossOffset,
                placement: placement,
                shouldFlip: shouldFlip
            },
            children: props.children
        })
    });
}
function $d3b6a84aebe66f8d$export$92ee03cda75aac2b(props) {
    return /*#__PURE__*/ (0, $8KZCJ$reactjsxruntime.jsx)("div", {});
}


//# sourceMappingURL=Tooltip.cjs.map
