require("./RangeCalendar.css");
var $e9e9a0d15c3364d7$exports = require("./Calendar.cjs");
var $6367bc87eb7d24ad$exports = require("./Content.cjs");
var $a0b996a550bb0891$exports = require("./Field.cjs");
var $4526404114e78c80$exports = require("./intlStrings.cjs");
var $ac757a4c2bd72aee$exports = require("../../icons/useSpectrumContextProps.cjs");
var $3M0RL$reactjsxruntime = require("react/jsx-runtime");
var $3M0RL$reactariacomponentsRangeCalendar = require("react-aria-components/RangeCalendar");
var $3M0RL$reactariacomponentsslots = require("react-aria-components/slots");
var $3M0RL$react = require("react");
var $3M0RL$reactariacomponentsText = require("react-aria-components/Text");
var $3M0RL$reactariauseLocalizedStringFormatter = require("react-aria/useLocalizedStringFormatter");


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}

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

$parcel$export(module.exports, "RangeCalendarContext", () => $ad2936801c627ac5$export$233dd9682e1ad64b);
$parcel$export(module.exports, "RangeCalendar", () => $ad2936801c627ac5$export$a4f5c8b89d277a8d);
/*
 * 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 $ad2936801c627ac5$export$233dd9682e1ad64b = /*#__PURE__*/ (0, $3M0RL$react.createContext)(null);
const $ad2936801c627ac5$var$calendarStyles = function anonymous(props, overrides) {
    let rules = " ";
    let width = false;
    let maxWidth = false;
    let matches = String(overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L)[^\s]+/g);
    for (let p of matches){
        if (p[1] === "Z") width = true;
        if (p[1] === "L") maxWidth = true;
        rules += p[0];
    }
    rules += ' sd12';
    if (props.isMultiMonth) rules += ' -_4DHzJc-e4mUs12';
    else rules += ' -_4DHzJc-0u6p5b12';
    rules += ' _ta12';
    rules += ' Uj12';
    rules += ' qj12';
    rules += ' __ca12';
    rules += ' -uq4sQ-Sp12';
    rules += ' -LnVzy-ZC12';
    if (props.isMultiMonth) rules += ' -cYDWLb-ZFFQGNb12';
    else rules += ' -cYDWLb-ZnqRBTd12';
    if (props.isMultiMonth) {
        if (!width) rules += ' ZJ12';
    } else if (!width) rules += ' ZRqDA2c12';
    if (props.isMultiMonth) {
        if (!maxWidth) rules += ' Le4mUs12';
    } else if (!maxWidth) rules += ' La12';
    return rules;
};
const $ad2936801c627ac5$export$a4f5c8b89d277a8d = /*#__PURE__*/ (0, $3M0RL$react.forwardRef)(function RangeCalendar(props, ref) {
    [props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $ad2936801c627ac5$export$233dd9682e1ad64b);
    let { visibleMonths: visibleMonths = 1, errorMessage: errorMessage, UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className, styles: styles, ...otherProps } = props;
    let stringFormatter = (0, $3M0RL$reactariauseLocalizedStringFormatter.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    let isMultiMonth = visibleMonths > 1;
    return /*#__PURE__*/ (0, $3M0RL$reactjsxruntime.jsx)((0, $3M0RL$reactariacomponentsRangeCalendar.RangeCalendar), {
        ...otherProps,
        ref: ref,
        visibleDuration: {
            months: visibleMonths
        },
        style: {
            ...UNSAFE_style,
            '--num-calendars': visibleMonths
        },
        className: (UNSAFE_className || '') + $ad2936801c627ac5$var$calendarStyles({
            isMultiMonth: isMultiMonth
        }, styles),
        children: ({ isInvalid: isInvalid, isDisabled: isDisabled })=>{
            return /*#__PURE__*/ (0, $3M0RL$reactjsxruntime.jsxs)((0, $3M0RL$reactjsxruntime.Fragment), {
                children: [
                    /*#__PURE__*/ (0, $3M0RL$reactjsxruntime.jsx)((0, $3M0RL$reactariacomponentsslots.Provider), {
                        values: [
                            [
                                (0, $6367bc87eb7d24ad$exports.HeaderContext),
                                null
                            ],
                            [
                                (0, $6367bc87eb7d24ad$exports.HeadingContext),
                                null
                            ]
                        ],
                        children: /*#__PURE__*/ (0, $3M0RL$reactjsxruntime.jsx)((0, $e9e9a0d15c3364d7$exports.CalendarHeader), {})
                    }),
                    /*#__PURE__*/ (0, $3M0RL$reactjsxruntime.jsx)("div", {
                        className: " sd12 _tc12 Uj12 qj12 ed12",
                        children: Array.from({
                            length: visibleMonths
                        }).map((_, i)=>/*#__PURE__*/ (0, $3M0RL$reactjsxruntime.jsx)((0, $e9e9a0d15c3364d7$exports.CalendarGrid), {
                                months: i
                            }, i))
                    }),
                    isInvalid && /*#__PURE__*/ (0, $3M0RL$reactjsxruntime.jsx)((0, $3M0RL$reactariacomponentsText.Text), {
                        slot: "errorMessage",
                        className: (0, $a0b996a550bb0891$exports.helpTextStyles)({
                            isInvalid: isInvalid,
                            isDisabled: isDisabled,
                            size: 'M'
                        }),
                        children: errorMessage || stringFormatter.format('calendar.invalidSelection', {
                            selectedCount: 2
                        })
                    })
                ]
            });
        }
    });
});


//# sourceMappingURL=RangeCalendar.cjs.map
