require("./Tooltip.css");
var $914a06b3a1c679bc$exports = require("./Provider.cjs");
var $8KZCJ$reactjsxruntime = require("react/jsx-runtime");
var $8KZCJ$reactariacomponents = require("react-aria-components");
var $8KZCJ$react = require("react");
var $8KZCJ$reactspectrumutils = require("@react-spectrum/utils");


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 += ' _pa11';
    else if (props.colorScheme === "light") rules += ' _pb11';
    else if (props.colorScheme === "light dark") rules += ' _pc11';
    else rules += ' _pN79Hzc11';
    rules += ' _Ca11';
    rules += ' eb11';
    rules += ' Le11';
    rules += ' MAyFGYc11';
    rules += ' _oa11';
    rules += ' uk11';
    rules += ' ucJ9TBTb11';
    rules += ' ud3Euai11';
    rules += ' uea11';
    rules += ' ugb11';
    rules += ' uhd11';
    rules += ' uje11';
    rules += ' u2NhKxcl11';
    rules += ' uic11';
    rules += ' -_6BNtrc-b11';
    rules += ' vx11';
    rules += ' xb11';
    rules += ' _xa11';
    rules += ' _Fd11';
    rules += ' _FnuYUweb11';
    rules += ' pr11';
    rules += ' plb11';
    rules += ' _kJ8iPYd11';
    rules += ' hXMFGYc11';
    rules += ' mlb11';
    rules += ' llb11';
    rules += ' _jlf11';
    rules += ' ilA11';
    rules += ' g011';
    rules += ' ob11';
    rules += ' nb11';
    rules += ' kb11';
    rules += ' jb11';
    rules += ' Sv11';
    rules += ' Rv11';
    rules += ' Tu7Fubd11';
    rules += ' Qu7Fubd11';
    rules += ' Yd11';
    rules += ' Xc11';
    if (props.isExiting) rules += ' _2c11';
    if (props.placement === "right") {
        if (props.isExiting) {
            rules += ' -_7PloMd-m11';
            rules += ' __Ya11';
        } else if (props.isEntering) {
            rules += ' -_7PloMd-m11';
            rules += ' __Ya11';
        }
    } else if (props.placement === "left") {
        if (props.isExiting) {
            rules += ' -_7PloMd-G11';
            rules += ' __Ya11';
        } else if (props.isEntering) {
            rules += ' -_7PloMd-G11';
            rules += ' __Ya11';
        }
    }
    if (props.placement === "bottom") {
        if (props.isExiting) {
            rules += ' -_8PloMd-l11';
            rules += ' __Ya11';
        } else if (props.isEntering) {
            rules += ' -_8PloMd-l11';
            rules += ' __Ya11';
        }
    } else if (props.placement === "top") {
        if (props.isExiting) {
            rules += ' -_8PloMd-F11';
            rules += ' __Ya11';
        } else if (props.isEntering) {
            rules += ' -_8PloMd-F11';
            rules += ' __Ya11';
        }
    }
    if (props.isExiting) rules += ' _Ia11';
    else if (props.isEntering) rules += ' _Ia11';
    rules += ' -nTSCV-LTAEPe11';
    rules += ' -M_-Mg11';
    rules += ' -_k_-l_kb11';
    rules += ' -h_-lhb11';
    return rules;
};
const $d3b6a84aebe66f8d$var$arrowStyles = function anonymous(props) {
    let rules = " ";
    rules += ' sb11';
    rules += ' tr11';
    rules += ' Zi11';
    rules += ' Ff11';
    if (props.placement === "right") rules += ' _Sd11';
    else if (props.placement === "left") rules += ' _Sa11';
    else if (props.placement === "bottom") rules += ' _Sc11';
    else if (props.placement === "top") rules += ' _Sb11';
    if (props.placement === "right") {
        rules += ' -_7PloMd-y11';
        rules += ' __Ya11';
    } else if (props.placement === "left") {
        rules += ' -_7PloMd-e11';
        rules += ' __Ya11';
    }
    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, $8KZCJ$reactspectrumutils.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$reactariacomponents.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$reactariacomponents.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$reactariacomponents.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$reactariacomponents.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
