import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-BhqVmlhr.js';
import { d as defineCustomElement$8 } from './p-BfkakbtL.js';
import { d as defineCustomElement$7 } from './p-Bu11LCUv.js';
import { d as defineCustomElement$6 } from './p-Bw2J9lll.js';
import { d as defineCustomElement$5 } from './p-DiC-xcof.js';
import { d as defineCustomElement$4 } from './p-Cv0O724A.js';
import { d as defineCustomElement$3 } from './p-4rdrCxSX.js';
import { d as defineCustomElement$2 } from './p-V_F6lX0v.js';
import { d as defineCustomElement$1 } from './p-B_lMJn5K.js';

// Gets the days in a given month
const getMonthDays = (date) => {
    const month = date.getMonth();
    const year = date.getFullYear();
    const daysInMonth = new Date(year, month + 1, 0).getDate();
    return Array.from({ length: daysInMonth }, (_, i) => new Date(year, month, i + 1));
};
// Gets the remaining days from the previous month to display on the calendar
const getDaysFromPreviousMonth = (date) => {
    const firstDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay();
    const prevMonth = new Date(date.getFullYear(), date.getMonth(), 0); // Last day of previous month
    const dates = [];
    for (let i = 0; i < firstDayOfMonth; i++) {
        dates.unshift(new Date(prevMonth.getFullYear(), prevMonth.getMonth(), prevMonth.getDate() - i));
    }
    return dates;
};
// Gets the initial days from the next month to display on the calendar
const getDaysFromNextMonth = (date) => {
    const lastDayOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDay();
    const nextMonth = new Date(date.getFullYear(), date.getMonth() + 1, 1); // First day of next month
    const dates = [];
    for (let i = 0; i < (6 - lastDayOfMonth); i++) {
        dates.push(new Date(nextMonth.getFullYear(), nextMonth.getMonth(), nextMonth.getDate() + i));
    }
    return dates;
};
// const defineds = {
//   startOfWeek: startOfWeek(new Date()),
//   endOfWeek: endOfWeek(new Date()),
//   startOfLastWeek: startOfWeek(addDays(new Date(), -7)),
//   endOfLastWeek: endOfWeek(addDays(new Date(), -7)),
//   startOfToday: startOfDay(new Date()),
//   endOfToday: endOfDay(new Date()),
//   startOfYesterday: startOfDay(addDays(new Date(), -1)),
//   endOfYesterday: endOfDay(addDays(new Date(), -1)),
//   startOfMonth: startOfMonth(new Date()),
//   endOfMonth: endOfMonth(new Date()),
//   startOfLastMonth: startOfMonth(addMonths(new Date(), -1)),
//   endOfLastMonth: endOfMonth(addMonths(new Date(), -1)),
// };
// const staticRangeHandler = {
//   range: {},
//   isSelected(range) {
//     const definedRange = this.range();
//     return (
//       isSameDay(range.startDate, definedRange.startDate) &&
//       isSameDay(range.endDate, definedRange.endDate)
//     );
//   },
// };
const isValidDate = (dateString) => {
    // Match D/M/Y or DD/MM/YYYY format
    const regex = /^(0?[1-9]|[12][0-9]|3[01])\/(0?[1-9]|1[0-2])\/\d{4}$/;
    if (!regex.test(dateString))
        return false;
    // Parse and check validity
    const [day, month, year] = dateString.split('/').map(Number);
    const parsedDate = new Date(year, month - 1, day);
    return (parsedDate.getDate() === day &&
        parsedDate.getMonth() === month - 1 &&
        parsedDate.getFullYear() === year);
};
const formatDate = (date) => {
    const day = date.getDate();
    const month = date.getMonth() + 1; // Months are 0-indexed
    const year = date.getFullYear();
    return `${day}/${month}/${year}`;
};
const today = new Date();
const yesterday = new Date(today);
yesterday.setDate(yesterday.getDate() - 1);
const startOfToday = new Date(today);
startOfToday.setHours(0, 0, 0, 0);
const endOfToday = new Date(today);
endOfToday.setHours(23, 59, 59, 999);
const startOfYesterday = new Date(yesterday);
startOfYesterday.setHours(0, 0, 0, 0);
const endOfYesterday = new Date(yesterday);
endOfYesterday.setHours(23, 59, 59, 999);
const startOfWeek = new Date(today);
startOfWeek.setDate(today.getDate() - today.getDay());
const endOfWeek = new Date(today);
endOfWeek.setDate(today.getDate() + (6 - today.getDay()));
const startOfLastWeek = new Date(startOfWeek);
startOfLastWeek.setDate(startOfWeek.getDate() - 7);
const endOfLastWeek = new Date(endOfWeek);
endOfLastWeek.setDate(endOfWeek.getDate() - 7);
const startOfMonth = new Date(today);
startOfMonth.setDate(1);
const endOfMonth = new Date(today);
endOfMonth.setMonth(endOfMonth.getMonth() + 1, 0);
const startOfLastMonth = new Date(startOfMonth);
startOfLastMonth.setMonth(startOfLastMonth.getMonth() - 1, 1);
const endOfLastMonth = new Date(startOfMonth);
endOfLastMonth.setDate(endOfLastMonth.getDate() - 1);
const startOfLast3Months = new Date(startOfMonth);
startOfLast3Months.setMonth(startOfLast3Months.getMonth() - 3, 1);
const endOfLast3Months = new Date(startOfMonth);
endOfLast3Months.setDate(endOfLast3Months.getDate() - 1);
const startOfLast7Days = new Date(today);
startOfLast7Days.setDate(startOfLast7Days.getDate() - 6);
const startOfLast30Days = new Date(today);
startOfLast30Days.setDate(startOfLast30Days.getDate() - 29);
const startOfLast90Days = new Date(today);
startOfLast90Days.setDate(startOfLast90Days.getDate() - 89);
const defaultStaticRanges = [
    {
        label: {
            en: 'Today',
            ar: 'اليوم'
        },
        range: () => ({
            startDate: startOfToday,
            endDate: endOfToday,
        }),
    },
    {
        label: {
            en: 'Yesterday',
            ar: 'الأمس'
        },
        range: () => ({
            startDate: startOfYesterday,
            endDate: endOfYesterday,
        }),
    },
    {
        label: {
            en: 'This Week',
            ar: 'هذا الأسبوع'
        },
        range: () => ({
            startDate: startOfWeek,
            endDate: endOfWeek,
        }),
    },
    {
        label: {
            en: 'Last Week',
            ar: 'الأسبوع الماضي'
        },
        range: () => ({
            startDate: startOfLastWeek,
            endDate: endOfLastWeek,
        }),
    },
    {
        label: {
            en: 'This Month',
            ar: 'هذا الشهر'
        },
        range: () => ({
            startDate: startOfMonth,
            endDate: endOfMonth,
        }),
    },
    {
        label: {
            en: 'Last Month',
            ar: 'الشهر الماضي'
        },
        range: () => ({
            startDate: startOfLastMonth,
            endDate: endOfLastMonth,
        }),
    },
    {
        label: {
            en: 'Last 3 Months',
            ar: 'آخر 3 أشهر'
        },
        range: () => ({
            startDate: startOfLast3Months,
            endDate: endOfLast3Months,
        }),
    },
    {
        label: {
            en: 'Last 7 Days',
            ar: 'آخر 7 أيام'
        },
        range: () => ({
            startDate: startOfLast7Days,
            endDate: endOfToday,
        }),
    },
    {
        label: {
            en: 'Last 30 Days',
            ar: 'آخر 30 يوم'
        },
        range: () => ({
            startDate: startOfLast30Days,
            endDate: endOfToday,
        }),
    },
    {
        label: {
            en: 'Last 90 Days',
            ar: 'آخر 90 يوم'
        },
        range: () => ({
            startDate: startOfLast90Days,
            endDate: endOfToday,
        }),
    },
];
function compareDatesWithoutTime(date1, date2) {
    return (date1.getFullYear() === date2.getFullYear() &&
        date1.getMonth() === date2.getMonth() &&
        date1.getDate() === date2.getDate());
}
const validateInputDate = (date) => {
    // Regular expression to match the date format "Month Day, Year"
    const dateFormat = /^(?:January|February|March|April|May|June|July|August|September|October|November|December) (?:0?[1-9]|[12][0-9]|3[01]), (?:19|20)\d{2}$/;
    if (dateFormat.test(date)) {
        // Date format is valid
        console.log("date is valid");
        return true;
    }
    else {
        // Date format is invalid
        console.log("date is not valid");
        return false;
    }
};
const daysMap = {
    en: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
    ar: ["أحد", "إثنين", "ثلاثاء", "أربعاء", "خميس", "جمعة", "سبت"]
};
function sameDate(date1, date2) {
    return (date1.getFullYear() === date2.getFullYear() &&
        date1.getMonth() === date2.getMonth() &&
        date1.getDate() === date2.getDate());
}

const dgaDatepickerCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap\"); @import url(\"https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@100;200;300;400;500;600;700&display=swap\"); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}:focus{outline:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:\"\";content:none}table{border-collapse:collapse;border-spacing:0}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none}input[type=search]{-webkit-appearance:none;-moz-appearance:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}textarea{overflow:auto;vertical-align:top;resize:vertical}audio,canvas,video{display:inline-block;zoom:1;max-width:100%}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}a:active,a:hover{outline:0}img{border:0;-ms-interpolation-mode:bicubic;}figure{margin:0}form{margin:0}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0;white-space:normal;*margin-left:-7px;}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle;}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer;*overflow:visible;}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0;*height:13px;*width:13px;}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top;}table{border-collapse:collapse;border-spacing:0}html,button,input,select,textarea{color:#222}::-moz-selection{background:#b3d4fc;text-shadow:none}::selection{background:#b3d4fc;text-shadow:none}img{vertical-align:middle}fieldset{border:0;margin:0;padding:0}textarea{resize:vertical}.chromeframe{margin:0.2em 0;background:#ccc;color:#000;padding:0.2em 0}/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%;}*{box-sizing:border-box}body{margin:0}main{display:block}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0;}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px;}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}@font-face{font-family:\"IBMPlexSansArabic\";src:url(\"/assets/fonts/IBM-Plex-Sans-Arabic/IBMPlexSansArabic-Regular.woff2\") format(\"woff2\"), url(\"/assets/fonts/IBM-Plex-Sans-Arabic/IBMPlexSansArabic-Regular.woff\") format(\"woff\");font-weight:400;font-style:normal}@font-face{font-family:\"IBMPlexSansArabic\";src:url(\"/assets/fonts/IBM-Plex-Sans-Arabic/IBMPlexSansArabic-Medium.woff2\") format(\"woff2\"), url(\"/assets/fonts/IBM-Plex-Sans-Arabic/IBMPlexSansArabic-Medium.woff\") format(\"woff\");font-weight:500;font-style:normal}@font-face{font-family:\"IBMPlexSansArabic\";src:url(\"/assets/fonts/IBM-Plex-Sans-Arabic/IBMPlexSansArabic-SemiBold.woff2\") format(\"woff2\"), url(\"/assets/fonts/IBM-Plex-Sans-Arabic/IBMPlexSansArabic-SemiBold.woff\") format(\"woff\");font-weight:600;font-style:normal}@font-face{font-family:\"IBMPlexSansArabic\";src:url(\"/assets/fonts/IBM-Plex-Sans-Arabic/IBMPlexSansArabic-Bold.woff2\") format(\"woff2\"), url(\"/assets/fonts/IBM-Plex-Sans-Arabic/IBMPlexSansArabic-Bold.woff\") format(\"woff\");font-weight:700;font-style:normal;font-display:auto}body{font-family:\"IBMPlexSansArabic\"}a,a:active,a:focus{color:inherit;text-decoration:none}.display-2xl-regular{font:400 72px/90px \"IBMPlexSansArabic\"}.display-xl-regular{font:400 60px/72px \"IBMPlexSansArabic\"}.display-lg-regular{font:400 48px/60px \"IBMPlexSansArabic\"}.display-md-regular{font:400 36px/44px \"IBMPlexSansArabic\"}.display-sm-regular{font:400 30px/38px \"IBMPlexSansArabic\"}.display-xs-regular{font:400 24px/32px \"IBMPlexSansArabic\"}.text-xl-regular{font:400 20px/30px \"IBMPlexSansArabic\"}.text-lg-regular{font:400 18px/28px \"IBMPlexSansArabic\"}.text-md-regular,.date-cell__label{font:400 16px/24px \"IBMPlexSansArabic\"}.text-sm-regular,.dga-breadcrumb-dropdown-item{font:400 14px/20px \"IBMPlexSansArabic\"}.text-xs-regular{font:400 12px/18px \"IBMPlexSansArabic\"}.text-2xs-regular{font:400 10px/14px \"IBMPlexSansArabic\"}.display-2xl-medium{font:500 72px/90px \"IBMPlexSansArabic\"}.display-xl-medium{font:500 60px/72px \"IBMPlexSansArabic\"}.display-lg-medium{font:500 48px/60px \"IBMPlexSansArabic\"}.display-md-medium{font:500 36px/44px \"IBMPlexSansArabic\"}.display-sm-medium{font:500 30px/38px \"IBMPlexSansArabic\"}.display-xs-medium{font:500 24px/32px \"IBMPlexSansArabic\"}.text-xl-medium{font:500 20px/30px \"IBMPlexSansArabic\"}.text-lg-medium{font:500 18px/28px \"IBMPlexSansArabic\"}.text-md-medium,.date-picker__navigator-label{font:500 16px/24px \"IBMPlexSansArabic\"}.text-sm-medium{font:500 14px/20px \"IBMPlexSansArabic\"}.text-xs-medium{font:500 12px/18px \"IBMPlexSansArabic\"}.text-2xs-medium{font:500 10px/14px \"IBMPlexSansArabic\"}.display-2xl-semibold{font:600 72px/90px \"IBMPlexSansArabic\"}.display-xl-semibold{font:600 60px/72px \"IBMPlexSansArabic\"}.display-lg-semibold{font:600 48px/60px \"IBMPlexSansArabic\"}.display-md-semibold{font:600 36px/44px \"IBMPlexSansArabic\"}.display-sm-semibold{font:600 30px/38px \"IBMPlexSansArabic\"}.display-xs-semibold{font:600 24px/32px \"IBMPlexSansArabic\"}.text-xl-semibold{font:600 20px/30px \"IBMPlexSansArabic\"}.text-lg-semibold{font:600 18px/28px \"IBMPlexSansArabic\"}.text-md-semibold{font:600 16px/24px \"IBMPlexSansArabic\"}.text-sm-semibold{font:600 14px/20px \"IBMPlexSansArabic\"}.text-xs-semibold{font:600 12px/18px \"IBMPlexSansArabic\"}.text-2xs-semibold{font:600 10px/14px \"IBMPlexSansArabic\"}.display-2xl-bold{font:700 72px/90px \"IBMPlexSansArabic\"}.display-xl-bold{font:700 60px/72px \"IBMPlexSansArabic\"}.display-lg-bold{font:700 48px/60px \"IBMPlexSansArabic\"}.display-md-bold{font:700 36px/44px \"IBMPlexSansArabic\"}.display-sm-bold{font:700 30px/38px \"IBMPlexSansArabic\"}.display-xs-bold{font:700 24px/32px \"IBMPlexSansArabic\"}.text-xl-bold{font:700 20px/30px \"IBMPlexSansArabic\"}.text-lg-bold{font:700 18px/28px \"IBMPlexSansArabic\"}.text-md-bold,.date-cell--today .date-cell__label span{font:700 16px/24px \"IBMPlexSansArabic\"}.text-sm-bold{font:700 14px/20px \"IBMPlexSansArabic\"}.text-xs-bold{font:700 12px/18px \"IBMPlexSansArabic\"}.text-2xs-bold{font:700 10px/14px \"IBMPlexSansArabic\"}.dga-spacing-hor-0{height:0px}.dga-spacing-vert-0{width:0px}.dga-p-0{padding:0px}.dga-px-0{padding-inline:0px}.dga-py-0{padding-block:0px}.dga-pl-0{padding-left:0px}.dga-pr-0{padding-right:0px}.dga-pt-0{padding-top:0px}.dga-pb-0{padding-bottom:0px}.dga-mx-0{margin-inline:0px}.dga-my-0{margin-block:0px}.dga-ml-0{margin-left:0px}.dga-mr-0{margin-right:0px}.dga-mt-0{margin-top:0px}.dga-mb-0{margin-bottom:0px}.dga-spacing-hor-2{height:8px}.dga-spacing-vert-2{width:8px}.dga-p-2{padding:8px}.dga-px-2{padding-inline:8px}.dga-py-2{padding-block:8px}.dga-pl-2{padding-left:8px}.dga-pr-2{padding-right:8px}.dga-pt-2{padding-top:8px}.dga-pb-2{padding-bottom:8px}.dga-mx-2{margin-inline:8px}.dga-my-2{margin-block:8px}.dga-ml-2{margin-left:8px}.dga-mr-2{margin-right:8px}.dga-mt-2{margin-top:8px}.dga-mb-2{margin-bottom:8px}.dga-spacing-hor-4{height:16px}.dga-spacing-vert-4{width:16px}.dga-p-4{padding:16px}.dga-px-4{padding-inline:16px}.dga-py-4{padding-block:16px}.dga-pl-4{padding-left:16px}.dga-pr-4{padding-right:16px}.dga-pt-4{padding-top:16px}.dga-pb-4{padding-bottom:16px}.dga-mx-4{margin-inline:16px}.dga-my-4{margin-block:16px}.dga-ml-4{margin-left:16px}.dga-mr-4{margin-right:16px}.dga-mt-4{margin-top:16px}.dga-mb-4{margin-bottom:16px}.dga-spacing-hor-8{height:32px}.dga-spacing-vert-8{width:32px}.dga-p-8{padding:32px}.dga-px-8{padding-inline:32px}.dga-py-8{padding-block:32px}.dga-pl-8{padding-left:32px}.dga-pr-8{padding-right:32px}.dga-pt-8{padding-top:32px}.dga-pb-8{padding-bottom:32px}.dga-mx-8{margin-inline:32px}.dga-my-8{margin-block:32px}.dga-ml-8{margin-left:32px}.dga-mr-8{margin-right:32px}.dga-mt-8{margin-top:32px}.dga-mb-8{margin-bottom:32px}.dga-spacing-hor-12{height:48px}.dga-spacing-vert-12{width:48px}.dga-p-12{padding:48px}.dga-px-12{padding-inline:48px}.dga-py-12{padding-block:48px}.dga-pl-12{padding-left:48px}.dga-pr-12{padding-right:48px}.dga-pt-12{padding-top:48px}.dga-pb-12{padding-bottom:48px}.dga-mx-12{margin-inline:48px}.dga-my-12{margin-block:48px}.dga-ml-12{margin-left:48px}.dga-mr-12{margin-right:48px}.dga-mt-12{margin-top:48px}.dga-mb-12{margin-bottom:48px}.dga-spacing-hor-16{height:64px}.dga-spacing-vert-16{width:64px}.dga-p-16{padding:64px}.dga-px-16{padding-inline:64px}.dga-py-16{padding-block:64px}.dga-pl-16{padding-left:64px}.dga-pr-16{padding-right:64px}.dga-pt-16{padding-top:64px}.dga-pb-16{padding-bottom:64px}.dga-mx-16{margin-inline:64px}.dga-my-16{margin-block:64px}.dga-ml-16{margin-left:64px}.dga-mr-16{margin-right:64px}.dga-mt-16{margin-top:64px}.dga-mb-16{margin-bottom:64px}.dga-spacing-hor-24{height:96px}.dga-spacing-vert-24{width:96px}.dga-p-24{padding:96px}.dga-px-24{padding-inline:96px}.dga-py-24{padding-block:96px}.dga-pl-24{padding-left:96px}.dga-pr-24{padding-right:96px}.dga-pt-24{padding-top:96px}.dga-pb-24{padding-bottom:96px}.dga-mx-24{margin-inline:96px}.dga-my-24{margin-block:96px}.dga-ml-24{margin-left:96px}.dga-mr-24{margin-right:96px}.dga-mt-24{margin-top:96px}.dga-mb-24{margin-bottom:96px}.dga-spacing-hor-32{height:128px}.dga-spacing-vert-32{width:128px}.dga-p-32{padding:128px}.dga-px-32{padding-inline:128px}.dga-py-32{padding-block:128px}.dga-pl-32{padding-left:128px}.dga-pr-32{padding-right:128px}.dga-pt-32{padding-top:128px}.dga-pb-32{padding-bottom:128px}.dga-mx-32{margin-inline:128px}.dga-my-32{margin-block:128px}.dga-ml-32{margin-left:128px}.dga-mr-32{margin-right:128px}.dga-mt-32{margin-top:128px}.dga-mb-32{margin-bottom:128px}.dga-spacing-hor-40{height:160px}.dga-spacing-vert-40{width:160px}.dga-p-40{padding:160px}.dga-px-40{padding-inline:160px}.dga-py-40{padding-block:160px}.dga-pl-40{padding-left:160px}.dga-pr-40{padding-right:160px}.dga-pt-40{padding-top:160px}.dga-pb-40{padding-bottom:160px}.dga-mx-40{margin-inline:160px}.dga-my-40{margin-block:160px}.dga-ml-40{margin-left:160px}.dga-mr-40{margin-right:160px}.dga-mt-40{margin-top:160px}.dga-mb-40{margin-bottom:160px}.dga-spacing-hor-48{height:192px}.dga-spacing-vert-48{width:192px}.dga-p-48{padding:192px}.dga-px-48{padding-inline:192px}.dga-py-48{padding-block:192px}.dga-pl-48{padding-left:192px}.dga-pr-48{padding-right:192px}.dga-pt-48{padding-top:192px}.dga-pb-48{padding-bottom:192px}.dga-mx-48{margin-inline:192px}.dga-my-48{margin-block:192px}.dga-ml-48{margin-left:192px}.dga-mr-48{margin-right:192px}.dga-mt-48{margin-top:192px}.dga-mb-48{margin-bottom:192px}.dga-spacing-hor-56{height:224px}.dga-spacing-vert-56{width:224px}.dga-p-56{padding:224px}.dga-px-56{padding-inline:224px}.dga-py-56{padding-block:224px}.dga-pl-56{padding-left:224px}.dga-pr-56{padding-right:224px}.dga-pt-56{padding-top:224px}.dga-pb-56{padding-bottom:224px}.dga-mx-56{margin-inline:224px}.dga-my-56{margin-block:224px}.dga-ml-56{margin-left:224px}.dga-mr-56{margin-right:224px}.dga-mt-56{margin-top:224px}.dga-mb-56{margin-bottom:224px}.dga-spacing-hor-64{height:256px}.dga-spacing-vert-64{width:256px}.dga-p-64{padding:256px}.dga-px-64{padding-inline:256px}.dga-py-64{padding-block:256px}.dga-pl-64{padding-left:256px}.dga-pr-64{padding-right:256px}.dga-pt-64{padding-top:256px}.dga-pb-64{padding-bottom:256px}.dga-mx-64{margin-inline:256px}.dga-my-64{margin-block:256px}.dga-ml-64{margin-left:256px}.dga-mr-64{margin-right:256px}.dga-mt-64{margin-top:256px}.dga-mb-64{margin-bottom:256px}.dga-spacing-hor-72{height:288px}.dga-spacing-vert-72{width:288px}.dga-p-72{padding:288px}.dga-px-72{padding-inline:288px}.dga-py-72{padding-block:288px}.dga-pl-72{padding-left:288px}.dga-pr-72{padding-right:288px}.dga-pt-72{padding-top:288px}.dga-pb-72{padding-bottom:288px}.dga-mx-72{margin-inline:288px}.dga-my-72{margin-block:288px}.dga-ml-72{margin-left:288px}.dga-mr-72{margin-right:288px}.dga-mt-72{margin-top:288px}.dga-mb-72{margin-bottom:288px}.dga-spacing-hor-80{height:320px}.dga-spacing-vert-80{width:320px}.dga-p-80{padding:320px}.dga-px-80{padding-inline:320px}.dga-py-80{padding-block:320px}.dga-pl-80{padding-left:320px}.dga-pr-80{padding-right:320px}.dga-pt-80{padding-top:320px}.dga-pb-80{padding-bottom:320px}.dga-mx-80{margin-inline:320px}.dga-my-80{margin-block:320px}.dga-ml-80{margin-left:320px}.dga-mr-80{margin-right:320px}.dga-mt-80{margin-top:320px}.dga-mb-80{margin-bottom:320px}.dga-spacing-hor-88{height:352px}.dga-spacing-vert-88{width:352px}.dga-p-88{padding:352px}.dga-px-88{padding-inline:352px}.dga-py-88{padding-block:352px}.dga-pl-88{padding-left:352px}.dga-pr-88{padding-right:352px}.dga-pt-88{padding-top:352px}.dga-pb-88{padding-bottom:352px}.dga-mx-88{margin-inline:352px}.dga-my-88{margin-block:352px}.dga-ml-88{margin-left:352px}.dga-mr-88{margin-right:352px}.dga-mt-88{margin-top:352px}.dga-mb-88{margin-bottom:352px}.dga-spacing-hor-96{height:384px}.dga-spacing-vert-96{width:384px}.dga-p-96{padding:384px}.dga-px-96{padding-inline:384px}.dga-py-96{padding-block:384px}.dga-pl-96{padding-left:384px}.dga-pr-96{padding-right:384px}.dga-pt-96{padding-top:384px}.dga-pb-96{padding-bottom:384px}.dga-mx-96{margin-inline:384px}.dga-my-96{margin-block:384px}.dga-ml-96{margin-left:384px}.dga-mr-96{margin-right:384px}.dga-mt-96{margin-top:384px}.dga-mb-96{margin-bottom:384px}.dga-spacing-hor-104{height:416px}.dga-spacing-vert-104{width:416px}.dga-p-104{padding:416px}.dga-px-104{padding-inline:416px}.dga-py-104{padding-block:416px}.dga-pl-104{padding-left:416px}.dga-pr-104{padding-right:416px}.dga-pt-104{padding-top:416px}.dga-pb-104{padding-bottom:416px}.dga-mx-104{margin-inline:416px}.dga-my-104{margin-block:416px}.dga-ml-104{margin-left:416px}.dga-mr-104{margin-right:416px}.dga-mt-104{margin-top:416px}.dga-mb-104{margin-bottom:416px}.dga-spacing-hor-112{height:448px}.dga-spacing-vert-112{width:448px}.dga-p-112{padding:448px}.dga-px-112{padding-inline:448px}.dga-py-112{padding-block:448px}.dga-pl-112{padding-left:448px}.dga-pr-112{padding-right:448px}.dga-pt-112{padding-top:448px}.dga-pb-112{padding-bottom:448px}.dga-mx-112{margin-inline:448px}.dga-my-112{margin-block:448px}.dga-ml-112{margin-left:448px}.dga-mr-112{margin-right:448px}.dga-mt-112{margin-top:448px}.dga-mb-112{margin-bottom:448px}.dga-spacing-hor-120{height:480px}.dga-spacing-vert-120{width:480px}.dga-p-120{padding:480px}.dga-px-120{padding-inline:480px}.dga-py-120{padding-block:480px}.dga-pl-120{padding-left:480px}.dga-pr-120{padding-right:480px}.dga-pt-120{padding-top:480px}.dga-pb-120{padding-bottom:480px}.dga-mx-120{margin-inline:480px}.dga-my-120{margin-block:480px}.dga-ml-120{margin-left:480px}.dga-mr-120{margin-right:480px}.dga-mt-120{margin-top:480px}.dga-mb-120{margin-bottom:480px}.dga-radius-small{border-radius:2px}.dga-radius-small-t{border-radius:2px 2px 0 0}.dga-radius-small-tl{border-radius:2px 0px 0 0}.dga-radius-small-tr{border-radius:0px 2px 0 0}.dga-radius-small-b{border-radius:0 0 2px 2px}.dga-radius-small-bl{border-radius:0 0 2px 0px}.dga-radius-small-br{border-radius:0 0 0px 2px}.dga-radius-medium{border-radius:4px}.dga-radius-medium-t{border-radius:4px 4px 0 0}.dga-radius-medium-tl{border-radius:4px 0px 0 0}.dga-radius-medium-tr{border-radius:0px 4px 0 0}.dga-radius-medium-b{border-radius:0 0 4px 4px}.dga-radius-medium-bl{border-radius:0 0 4px 0px}.dga-radius-medium-br{border-radius:0 0 0px 4px}.dga-radius-large{border-radius:8px}.dga-radius-large-t{border-radius:8px 8px 0 0}.dga-radius-large-tl{border-radius:8px 0px 0 0}.dga-radius-large-tr{border-radius:0px 8px 0 0}.dga-radius-large-b{border-radius:0 0 8px 8px}.dga-radius-large-bl{border-radius:0 0 8px 0px}.dga-radius-large-br{border-radius:0 0 0px 8px}.dga-radius-xlarge{border-radius:12px}.dga-radius-xlarge-t{border-radius:12px 12px 0 0}.dga-radius-xlarge-tl{border-radius:12px 0px 0 0}.dga-radius-xlarge-tr{border-radius:0px 12px 0 0}.dga-radius-xlarge-b{border-radius:0 0 12px 12px}.dga-radius-xlarge-bl{border-radius:0 0 12px 0px}.dga-radius-xlarge-br{border-radius:0 0 0px 12px}.dga-radius-none{border-radius:0px}.dga-radius-circular{border-radius:100%}.dga-flex{display:flex}.dga-flex-column{display:flex;flex-direction:column}.dga-flex-center{display:flex;align-items:center;justify-content:center}.dga-flex-center-y{display:flex;align-items:center}.dga-flex-center-x{display:flex;justify-content:center}.dga-flex-between{display:flex;justify-content:space-between}.dga-flex-wrap{flex-wrap:wrap}.dga-flex-align-stretch{align-items:stretch}.dga-flex-align-start{align-items:flex-start}.dga-flex-align-end{align-items:flex-end}.dga-flex-justify-end{justify-content:flex-end}.dga-flex-justify-start{justify-content:flex-start}.dga-text-right{text-align:right}.dga-text-left{text-align:left}.dga-text-center{text-align:center}.dga-shadow-xs{box-shadow:var(--shadow-xs)}.dga-shadow-sm{box-shadow:var(--shadow-sm)}.dga-shadow-md{box-shadow:var(--shadow-md)}.dga-shadow-lg{box-shadow:var(--shadow-lg)}.dga-shadow-xl,.dga-breadcrumb-dropdown{box-shadow:var(--shadow-xl)}.dga-shadow-2xl,.date-picker-root{box-shadow:var(--shadow-2xl)}.dga-shadow-3xl{box-shadow:var(--shadow-3xl)}.dga-ver-divider{width:1px;height:48px;background:hsla(var(--colors-alpha-black)/20%);margin-inline:var(--spacing-xl)}@media only screen and (max-width: 37.5em){.dga-xs-hide{display:none}}.dga-flex-justify-start{justify-content:start}.dga-flex-justify-end{justify-content:end}.dga-flex-justify-center{justify-content:center}.dga-flex-justify-between{justify-content:between}.dga-flex-justify-around{justify-content:around}.dga-flex-align-start{align-items:start}.dga-flex-align-end{align-items:end}.dga-flex-align-center{align-items:center}.dga-flex-align-stretch{align-items:stretch}:host{display:block;width:fit-content}.date-picker-root{border-radius:var(--radius-8, 8px);background:var(--colors-base-white);width:fit-content;display:flex;gap:15px;padding:16px}.date-picker-root__quick-options .options-list{display:flex;flex-direction:column;gap:10px;margin-top:20px;list-style:none;min-width:120px}.date-picker-root__quick-options .options-list button{background:none;outline:none;border:0;cursor:pointer}.date-picker-root__main__inputs{width:100%;max-width:392px;display:flex;justify-content:space-between;gap:32px}.date-picker-root__main__inputs dga-text-input{height:fit-content;max-width:unset;min-width:unset;flex:1}.date-picker-root__main__inputs dga-text-input .input{height:40px;width:100%}.date-picker-root__main__buttons{margin-top:16px;border-top:1px solid gray;padding-top:16px;display:flex;justify-content:flex-end}.date-picker-root__main__content-wrapper{display:flex;gap:32px}.date-picker{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;max-width:392px}.date-picker__date-grid,.date-picker__weekdays{display:flex;flex-wrap:wrap;width:392px}.date-picker>month-navigator{width:100%}.date-picker__navigator{width:100%;display:flex;justify-content:space-between;align-items:center}.date-picker__navigator-label{position:relative;padding-left:20px;flex:1;color:var(--text-default, #161616)}.date-picker__navigator-buttons{display:flex;align-items:center}.date-picker__weekday{display:flex;width:56px;height:56px;justify-content:center;align-items:center;border:0;background-color:transparent}.date-cell{display:flex;width:56px;height:56px;justify-content:center;align-items:center;cursor:pointer;border:0;background-color:transparent}.date-cell__label{display:flex;width:100%;height:48px;flex-direction:column;justify-content:center;align-items:center;gap:var(--spacing-none);background-color:transparent;mix-blend-mode:multiply;color:var(--text-default)}.date-cell__label span{display:grid;place-items:center;width:48px;height:100%;border-radius:var(--radius-full)}.date-cell:hover .date-cell__label span{background:var(--form-datecell-today-background-hovered)}.date-cell:active .date-cell__label span,.date-cell.pressed .date-cell__label span{background:var(--form-datecell-today-background-pressed)}.date-cell--selected .date-cell__label span{color:var(--colors-base-white) !important;border-radius:var(--radius-full);background-color:var(--text-success)}.date-cell--selected:hover .date-cell__label span{background:var(--form-datecell-background-hovered)}.date-cell--selected:active .date-cell__label span,.date-cell--selected.pressed .date-cell__label span{background:var(--form-datecell-background-pressed)}.date-cell--today .date-cell__label span{border:2px solid var(--text-success);color:var(--text-success)}.date-cell--today:hover .date-cell__label span{background:var(--form-datecell-background-100)}.date-cell--today:active .date-cell__label span,.date-cell--today.pressed .date-cell__label span{background:var(--colors-brand-200)}.date-cell--disabled{opacity:0.5}.date-cell[disabled]{opacity:0.3}.date-cell .date-cell__label{position:relative}.date-cell--mid-range .date-cell__label{background-color:var(--form-datecell-background-100)}.date-cell--mid-range--first-child .date-cell__label::before{content:\"\";width:52px;height:48px;position:absolute;top:0;right:0;border-radius:50% 0 0 50%;background-color:var(--form-datecell-background-100);z-index:-1}[dir=rtl] .date-cell--mid-range--first-child .date-cell__label::before{border-radius:0 50% 50% 0;left:0;right:unset}.date-cell--mid-range--last-child .date-cell__label::before{content:\"\";width:52px;height:48px;position:absolute;top:0;left:0;border-radius:0 50% 50% 0;background-color:var(--form-datecell-background-100);z-index:-1}[dir=rtl] .date-cell--mid-range--last-child .date-cell__label::before{border-radius:50% 0 0 50%;right:0;left:unset}[dir=rtl] .date-picker__navigator-buttons dga-button-v2{transform:rotate(180deg)}.year-selector{cursor:pointer;display:inline-flex;align-items:center;position:relative}.year-selector:hover{text-decoration:underline}.year-selector .dropdown-arrow{margin-left:4px;width:10px;height:10px;display:inline-block;transition:transform 0.2s ease}.year-selector .dropdown-arrow.open{transform:rotate(180deg)}[dir=rtl] .year-selector .dropdown-arrow{margin-left:0;margin-right:4px}.dga-breadcrumb-dropdown{display:flex;flex-direction:column;list-style:none;z-index:50;scrollbar-width:4px;min-width:90px;width:fit-content;height:312px;overflow-y:auto;padding:var(--spacing-xs, 4px);flex-direction:column;align-items:flex-start;position:absolute;left:0;top:calc(100% + 4px);border-radius:var(--radius-sm);border:1px solid var(--border-neutral-secondary, #e5e7eb);background:var(--background-white, #fff)}.dga-breadcrumb-dropdown-item{display:flex;padding:var(--spacing-md, 8px);flex-direction:column;justify-content:center;align-items:flex-start;gap:var(--spacing-md, 8px);align-self:stretch;border-radius:var(--radius-sm, 4px);color:var(--link-neutral, #384250)}.dga-breadcrumb-dropdown-item:hover{border-radius:var(--radius-xs);background:var(--button-background-neutral-hovered);mix-blend-mode:multiply}.dga-breadcrumb-dropdown-item:active{border-radius:var(--radius-xs);background:var(--button-background-neutral-pressed, #e5e7eb);mix-blend-mode:multiply}.dga-breadcrumb-dropdown-item.selected-year{background:var(--button-background-neutral-pressed, #e5e7eb);mix-blend-mode:multiply}.dga-breadcrumb-dropdown-item>.dropdown__option-icon{opacity:0}.dga-breadcrumb-dropdown-item.selected-year>.dropdown__option-icon{opacity:1}";

const DgaDatepicker = /*@__PURE__*/ proxyCustomElement(class DgaDatepicker extends H {
    constructor() {
        super();
        this.__registerHost();
        this.change = createEvent(this, "change");
        this.RTL = false;
        this.initialDate = new Date();
        this.range = false;
        this.dualMonthView = false;
        this.inputField = false;
        this.submitButton = false;
        this.qickOptions = false;
        // @Prop() onChange?: (event?: any) => void = () => { };
        // value;
        // onChange = () => {};
        // @Prop() onSubmit = () => {};
        // @Prop() onCancel = () => {};
        this.onSubmit = () => { };
        this.onCancel = () => { };
        this.currentMonth = this.initialDate;
        // @State() selectedDate: Date | null = null;
        this.selectedDate = this.value || new Date();
        this.rangeDates = {};
        this.inputDates = {
            startDate: '',
            endDate: '',
        };
        this.handlePrevClick = () => {
            const prevMonth = new Date(this.currentMonth.getFullYear(), this.currentMonth.getMonth() - 1, 1);
            // this.monthChange.emit(prevMonth);
            this.handleChangeMonth(prevMonth);
        };
        this.handleNextClick = () => {
            const nextMonth = new Date(this.currentMonth.getFullYear(), this.currentMonth.getMonth() + 1, 1);
            // this.monthChange.emit(nextMonth);
            this.handleChangeMonth(nextMonth);
        };
    }
    watchSelectedDate(newDate, oldDate) {
        if (newDate !== oldDate) {
            // this.onChange(newDate);
            this.change.emit(newDate);
        }
    }
    watchValue(newValue, oldValue) {
        if (newValue !== oldValue && newValue != this.selectedDate) {
            this.selectedDate = newValue;
            this.currentMonth = new Date(newValue.getFullYear(), newValue.getMonth(), 1);
        }
    }
    get nextMonth() {
        return new Date(this.currentMonth.getFullYear(), this.currentMonth.getMonth() + 1);
    }
    get days() {
        return [
            ...getDaysFromPreviousMonth(this.currentMonth).slice(0, 2),
            ...getMonthDays(this.currentMonth),
            ...getDaysFromNextMonth(this.currentMonth).slice(0, 2),
        ];
    }
    get nextMonthDays() {
        return [
            ...getDaysFromPreviousMonth(this.nextMonth).slice(0, 2),
            ...getMonthDays(this.nextMonth),
            ...getDaysFromNextMonth(this.nextMonth).slice(0, 2),
        ];
    }
    formatDate(date) {
        if (!date)
            return '';
        const dateObj = new Date(date);
        const monthNames = [
            'January', 'February', 'March', 'April', 'May', 'June',
            'July', 'August', 'September', 'October', 'November', 'December',
        ];
        return `${monthNames[dateObj.getMonth()]} ${dateObj.getDate()}, ${dateObj.getFullYear()}`;
    }
    handleSelectDate(date) {
        if (this.range) {
            if (!this.rangeDates.startDate) {
                this.rangeDates = { startDate: date };
            }
            else if (!this.rangeDates.endDate) {
                if (date >= this.rangeDates.startDate) {
                    this.rangeDates = Object.assign(Object.assign({}, this.rangeDates), { endDate: date });
                }
                else {
                    this.rangeDates = { startDate: date };
                }
            }
            else {
                this.rangeDates = { startDate: date, endDate: null };
            }
        }
        else {
            this.selectedDate = date;
        }
    }
    handleInputDate(event) {
        const inputElement = event.target;
        const { name, value } = inputElement;
        this.inputDates = Object.assign(Object.assign({}, this.inputDates), { [name]: value });
    }
    handleChangeMonth(newMonth) {
        this.currentMonth = newMonth;
    }
    isMidRange(date) {
        console.log(date > this.rangeDates.startDate, date < this.rangeDates.endDate);
        if (this.range && this.rangeDates.startDate && this.rangeDates.endDate) {
            return date > this.rangeDates.startDate && date < this.rangeDates.endDate && !sameDate(date, this.rangeDates.startDate) && !sameDate(date, this.rangeDates.endDate);
        }
        return false;
    }
    isFirstRangeChild(date) {
        if (this.range && this.rangeDates.startDate && this.rangeDates.endDate && !sameDate(this.rangeDates.startDate, this.rangeDates.endDate)) {
            return this.rangeDates.startDate.getTime() !== this.rangeDates.endDate.getTime()
                && sameDate(date, this.rangeDates.startDate);
        }
        return false;
    }
    isLastRangeChild(date) {
        console.log(this.rangeDates, "this.rangeDatesthis.rangeDates");
        if (this.range && this.rangeDates.startDate && this.rangeDates.endDate && !sameDate(this.rangeDates.startDate, this.rangeDates.endDate)) {
            return this.rangeDates.startDate.getTime() !== this.rangeDates.endDate.getTime()
                && sameDate(date, this.rangeDates.endDate);
        }
        return false;
    }
    componentDidLoad() {
        if (this.inputField) {
            if (this.rangeDates.startDate) {
                this.inputDates = Object.assign(Object.assign({}, this.inputDates), { startDate: this.formatDate(this.rangeDates.startDate) });
            }
            if (this.rangeDates.endDate) {
                this.inputDates = Object.assign(Object.assign({}, this.inputDates), { endDate: this.formatDate(this.rangeDates.endDate) });
            }
            else {
                this.inputDates = Object.assign(Object.assign({}, this.inputDates), { endDate: '' });
            }
        }
    }
    render() {
        return (h(Host, { key: 'ff1973f77a1c37af4452c03eb262a70a4f9f4c56' }, h("div", { key: '9d117678dd3f5a7d85808fe0e625652816825057', class: "date-picker-root dga-flex-column", "data-dual-view": this.dualMonthView, dir: this.RTL ? 'rtl' : 'ltr' }, h("div", { key: 'b824fff3adbe73b95ed4f9b6c0611980594e5158', class: "dga-flex" }, this.qickOptions && this.range && (h("div", { key: '4783e252014fb986e6a7b2517f6cdd7df5d22a8f', class: "date-picker-root__quick-options" }, h("span", { key: '7e789b20f1e128e531f7f7071259573326fe11f5', class: "text-md-regular" }, this.RTL ? 'اختصارات' : 'Qick options'), h("ul", { key: 'd17fec67c84a27495a2ea1c01004bd77124f22ea', class: "options-list" }, defaultStaticRanges.map(({ label, range }) => (h("li", { key: label[this.RTL ? 'ar' : 'en'] }, h("button", { class: "text-md-medium", onClick: () => {
                this.rangeDates = range();
                console.log(range, "rrrrrrrrrrrrrrrrrrrraaaaaaaaaaaaaaaaaange");
            } }, label[this.RTL ? 'ar' : 'en']))))))), h("div", { key: '16474410f663c2edcc2c69f8aa68e66a2eb084dc', class: "date-picker-root__main" }, this.inputField && (h("div", { key: 'eab55df8dd6def84a6c15af6f1eeda4d300f37d0', class: "date-picker-root__main__inputs" }, h("dga-text-input", { key: '43aeee9099f3f0c5a9dfb44d0d45878fd623e2f0', placeholder: "Month DD, YYYY", name: "startDate", value: this.inputDates.startDate, onChange: (e) => this.handleInputDate(e), onBlur: (e) => {
                if (validateInputDate(e.target.value)) {
                    const date = new Date(e.target.value);
                    if (this.range) {
                        if (!this.rangeDates.startDate) {
                            this.rangeDates = { startDate: date };
                        }
                        else if (this.rangeDates.endDate) {
                            if (date >= this.rangeDates.endDate) {
                                this.rangeDates = { startDate: date, endDate: date };
                            }
                            else {
                                this.rangeDates = Object.assign(Object.assign({}, this.rangeDates), { startDate: date });
                            }
                        }
                        else {
                            this.rangeDates = { startDate: date, endDate: null };
                        }
                    }
                    else {
                        this.selectedDate = date;
                    }
                }
            } }), this.range && (h("dga-text-input", { key: '1dd40bd74a2f122114e7913106db8c2d4bdb5959', placeholder: "Month DD, YYYY", name: "endDate", value: this.inputDates.endDate, onChange: (e) => this.handleInputDate(e), onBlur: (e) => {
                if (validateInputDate(e.target.value)) {
                    const date = new Date(e.target.value);
                    if (this.range) {
                        if (!this.rangeDates.endDate) {
                            if (!this.rangeDates.startDate) {
                                this.rangeDates = { startDate: date, endDate: null };
                            }
                            else if (date <= this.rangeDates.startDate) {
                                this.rangeDates = {
                                    startDate: date,
                                    endDate: this.rangeDates.startDate,
                                };
                            }
                        }
                        else if (this.rangeDates.startDate) {
                            if (date <= this.rangeDates.startDate) {
                                this.rangeDates = {
                                    startDate: date,
                                    endDate: this.rangeDates.startDate,
                                };
                            }
                            else {
                                this.rangeDates = Object.assign(Object.assign({}, this.rangeDates), { endDate: date });
                            }
                        }
                        else {
                            this.rangeDates = { startDate: date, endDate: null };
                        }
                    }
                    else {
                        this.selectedDate = date;
                    }
                }
            } })))), h("div", { key: '4d243d30846b117a07d314fb563c48be43eaaf96', class: "date-picker-root__main__content-wrapper" }, h("div", { key: '31d9e24857aac90f85bbb17a33eccdfc252e6fde', class: "date-picker" }, h("month-navigator", { key: '7cfc6b1178f318afb9dbf33d8d4c7a7b20a19806', RTL: this.RTL, currentMonth: this.currentMonth, onChange: (date) => this.handleChangeMonth(date), showArrows: !this.dualMonthView }), h("div", { key: 'e2d47c064dd5b770753745bca90dbc4bd0d6da59', class: "date-picker__weekdays" }, daysMap[this.RTL ? 'ar' : 'en'].map((day) => (h("div", { key: day, class: "date-picker__weekday" }, day)))), h("div", { key: '188d2e8c93d38361a0490b2b989502911896cfca', class: "date-picker__date-grid" }, this.days.map((date) => (h("date-cell", { key: date.toString(), date: date, isCurrentMonth: date.getMonth() === this.currentMonth.getMonth(), isSelected: (this.range)
                ? (!!this.rangeDates.startDate &&
                    compareDatesWithoutTime(date, this.rangeDates.startDate)) ||
                    (!!this.rangeDates.endDate &&
                        compareDatesWithoutTime(date, this.rangeDates.endDate))
                : this.selectedDate
                    ? compareDatesWithoutTime(date, this.selectedDate)
                    : false, isToday: new Date().toDateString() === date.toDateString(), isFirstRangeChild: this.isFirstRangeChild(date), isLastRangeChild: this.isLastRangeChild(date), midRange: this.isMidRange(date), onSelect: (date) => this.handleSelectDate(date) }))))), this.dualMonthView && (h("div", { key: '531be6e61309c3cc489a2668b002821966d68eb9', class: "date-picker" }, h("month-navigator", { key: 'f647bf7958f5475332bb75717fb4318e1e880c9b', currentMonth: this.nextMonth, onChange: (date) => {
                const newMonth = date.getMonth() === this.currentMonth.getMonth()
                    ? new Date(this.currentMonth.getFullYear(), this.currentMonth.getMonth() - 1)
                    : new Date(this.currentMonth.getFullYear(), this.currentMonth.getMonth() + 1);
                this.handleChangeMonth(newMonth);
            }, showArrows: true }), h("div", { key: '8269cd5e831bd7d9bbf6eb72801280259ff4f8cb', class: "date-picker__weekdays" }, ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map((day) => (h("div", { key: day, class: "date-picker__weekday" }, day)))), h("div", { key: '5747bed30156172b36c9907529b6587b9db9ee2c', class: "date-picker__date-grid" }, this.nextMonthDays.map((date) => (h("date-cell", { key: date.toString(), date: date, isCurrentMonth: date.getMonth() === this.nextMonth.getMonth(), isSelected: this.range
                ? (!!this.rangeDates.startDate &&
                    date.getTime() ===
                        this.rangeDates.startDate.getTime()) ||
                    (!!this.rangeDates.endDate &&
                        date.getTime() === this.rangeDates.endDate.getTime())
                : this.selectedDate
                    ? date.getTime() === this.selectedDate.getTime()
                    : false, isToday: new Date().toDateString() === date.toDateString(), midRange: this.isMidRange(date), isFirstRangeChild: this.isFirstRangeChild(date), isLastRangeChild: this.isLastRangeChild(date), onSelect: (date) => this.handleSelectDate(date) }))))))))), this.submitButton && (h("div", { key: '9f6d5deee7ebd72c185068d932c2ec2730cc79b6', class: "date-picker-root__main__buttons" }, h("dga-button-v2", { key: '0cc092fd53f8066ed4f17f012bd771d4fcf52b0f', label: "Cancel", onClick: this.onCancel, size: "lg", variant: "secondary-outline" }), h("dga-button-v2", { key: 'f95ef90aaa253dd2fc41135b1fbc9573e58e9d16', label: "Submit", onClick: this.onSubmit, size: "lg", variant: "neutral" }))))));
    }
    static get watchers() { return {
        "selectedDate": ["watchSelectedDate"],
        "value": ["watchValue"]
    }; }
    static get style() { return dgaDatepickerCss; }
}, [0, "dga-datepicker", {
        "RTL": [4, "r-t-l"],
        "initialDate": [16, "initial-date"],
        "range": [4],
        "dualMonthView": [4, "dual-month-view"],
        "inputField": [4, "input-field"],
        "submitButton": [4, "submit-button"],
        "qickOptions": [4, "qick-options"],
        "value": [16],
        "onSubmit": [16, "on-submit"],
        "onCancel": [16, "on-cancel"],
        "currentMonth": [32],
        "selectedDate": [32],
        "rangeDates": [32],
        "inputDates": [32]
    }, undefined, {
        "selectedDate": ["watchSelectedDate"],
        "value": ["watchValue"]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["dga-datepicker", "date-cell", "dga-button-v2", "dga-helper-text", "dga-icon", "dga-icon-v2", "dga-label", "dga-text-input", "month-navigator"];
    components.forEach(tagName => { switch (tagName) {
        case "dga-datepicker":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, DgaDatepicker);
            }
            break;
        case "date-cell":
            if (!customElements.get(tagName)) {
                defineCustomElement$8();
            }
            break;
        case "dga-button-v2":
            if (!customElements.get(tagName)) {
                defineCustomElement$7();
            }
            break;
        case "dga-helper-text":
            if (!customElements.get(tagName)) {
                defineCustomElement$6();
            }
            break;
        case "dga-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$5();
            }
            break;
        case "dga-icon-v2":
            if (!customElements.get(tagName)) {
                defineCustomElement$4();
            }
            break;
        case "dga-label":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "dga-text-input":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
        case "month-navigator":
            if (!customElements.get(tagName)) {
                defineCustomElement$1();
            }
            break;
    } });
}

export { DgaDatepicker as D, defineCustomElement as d, formatDate as f, isValidDate as i };
