"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
(()=>{
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    useDatetimeVariable: ()=>useDatetimeVariable
});
const external_react_namespaceObject = require("react");
const external_react_i18next_namespaceObject = require("react-i18next");
const util_js_namespaceObject = require("../../../schema-component/antd/date-picker/util.js");
const useDatetimeVariable = function() {
    let { operator, schema, noDisabled } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
    const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
    const datetimeSettings = (0, external_react_namespaceObject.useMemo)(()=>{
        const operatorValue = (null == operator ? void 0 : operator.value) || '';
        const disabled = !noDisabled && ![
            'DatePicker',
            'DatePicker.RangePicker'
        ].includes(null == schema ? void 0 : schema['x-component']);
        const dateOptions = [
            {
                key: 'now',
                value: 'now',
                label: t('Current time'),
                disabled: !noDisabled && ((null == schema ? void 0 : schema['x-component']) !== 'DatePicker' || '$dateBetween' === operatorValue)
            },
            {
                key: 'yesterday',
                value: 'yesterday',
                label: t('Yesterday'),
                disabled
            },
            {
                key: 'today',
                value: 'today',
                label: t('Today'),
                disabled
            },
            {
                key: 'tomorrow',
                value: 'tomorrow',
                label: t('Tomorrow'),
                disabled
            },
            {
                key: 'lastIsoWeek',
                value: 'lastIsoWeek',
                label: t('Last week'),
                disabled
            },
            {
                key: 'thisIsoWeek',
                value: 'thisIsoWeek',
                label: t('This week'),
                disabled
            },
            {
                key: 'nextIsoWeek',
                value: 'nextIsoWeek',
                label: t('Next week'),
                disabled
            },
            {
                key: 'lastMonth',
                value: 'lastMonth',
                label: t('Last month'),
                disabled
            },
            {
                key: 'thisMonth',
                value: 'thisMonth',
                label: t('This month'),
                disabled
            },
            {
                key: 'nextMonth',
                value: 'nextMonth',
                label: t('Next month'),
                disabled
            },
            {
                key: 'lastQuarter',
                value: 'lastQuarter',
                label: t('Last quarter'),
                disabled
            },
            {
                key: 'thisQuarter',
                value: 'thisQuarter',
                label: t('This quarter'),
                disabled
            },
            {
                key: 'nextQuarter',
                value: 'nextQuarter',
                label: t('Next quarter'),
                disabled
            },
            {
                key: 'lastYear',
                value: 'lastYear',
                label: t('Last year'),
                disabled
            },
            {
                key: 'thisYear',
                value: 'thisYear',
                label: t('This year'),
                disabled
            },
            {
                key: 'nextYear',
                value: 'nextYear',
                label: t('Next year'),
                disabled
            },
            {
                key: 'last7Days',
                value: 'last7Days',
                label: t('Last 7 days'),
                disabled
            },
            {
                key: 'next7Days',
                value: 'next7Days',
                label: t('Next 7 days'),
                disabled
            },
            {
                key: 'last30Days',
                value: 'last30Days',
                label: t('Last 30 days'),
                disabled
            },
            {
                key: 'next30Days',
                value: 'next30Days',
                label: t('Next 30 days'),
                disabled
            },
            {
                key: 'last90Days',
                value: 'last90Days',
                label: t('Last 90 days'),
                disabled
            },
            {
                key: 'next90Days',
                value: 'next90Days',
                label: t('Next 90 days'),
                disabled
            }
        ];
        return {
            label: t('Date variables'),
            value: '$nDate',
            key: '$nDate',
            disabled: dateOptions.every((option)=>option.disabled),
            children: dateOptions
        };
    }, [
        null == schema ? void 0 : schema['x-component']
    ]);
    const datetimeCtx = (0, external_react_namespaceObject.useMemo)(()=>(0, util_js_namespaceObject.getDateRanges)(), []);
    return {
        datetimeSettings,
        datetimeCtx
    };
};
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
