@ng-bootstrap/ng-bootstrap
Version:
Angular powered Bootstrap
1 lines • 265 kB
Source Map (JSON)
{"version":3,"file":"ng-bootstrap-ng-bootstrap-datepicker.mjs","sources":["../../../src/datepicker/ngb-date.ts","../../../src/datepicker/ngb-calendar.ts","../../../src/datepicker/datepicker-tools.ts","../../../src/datepicker/datepicker-i18n.ts","../../../src/datepicker/datepicker-service.ts","../../../src/datepicker/datepicker-view-model.ts","../../../src/datepicker/datepicker-config.ts","../../../src/datepicker/adapters/ngb-date-adapter.ts","../../../src/datepicker/datepicker-keyboard-service.ts","../../../src/datepicker/datepicker-day-view.ts","../../../src/datepicker/datepicker-navigation-select.ts","../../../src/datepicker/datepicker-navigation.ts","../../../src/datepicker/datepicker.ts","../../../src/datepicker/ngb-date-parser-formatter.ts","../../../src/datepicker/datepicker-input-config.ts","../../../src/datepicker/datepicker-input.ts","../../../src/datepicker/hijri/ngb-calendar-hijri.ts","../../../src/datepicker/hijri/ngb-calendar-islamic-civil.ts","../../../src/datepicker/hijri/ngb-calendar-islamic-umalqura.ts","../../../src/datepicker/jalali/jalali.ts","../../../src/datepicker/jalali/ngb-calendar-persian.ts","../../../src/datepicker/hebrew/hebrew.ts","../../../src/datepicker/hebrew/ngb-calendar-hebrew.ts","../../../src/datepicker/hebrew/datepicker-i18n-hebrew.ts","../../../src/datepicker/buddhist/buddhist.ts","../../../src/datepicker/buddhist/ngb-calendar-buddhist.ts","../../../src/datepicker/ethiopian/ethiopian.ts","../../../src/datepicker/ethiopian/ngb-calendar-ethiopian.ts","../../../src/datepicker/ethiopian/datepicker-i18n-amharic.ts","../../../src/datepicker/adapters/ngb-date-native-adapter.ts","../../../src/datepicker/adapters/ngb-date-native-utc-adapter.ts","../../../src/datepicker/datepicker.module.ts","../../../src/datepicker/ng-bootstrap-ng-bootstrap-datepicker.ts"],"sourcesContent":["import { NgbDateStruct } from './ngb-date-struct';\nimport { isInteger } from './_ngb-ngbootstrap-utilities.mjs';\n\n/**\n * A simple class that represents a date that datepicker also uses internally.\n *\n * It is the implementation of the `NgbDateStruct` interface that adds some convenience methods,\n * like `.equals()`, `.before()`, etc.\n *\n * All datepicker APIs consume `NgbDateStruct`, but return `NgbDate`.\n *\n * In many cases it is simpler to manipulate these objects together with\n * [`NgbCalendar`](#/components/datepicker/api#NgbCalendar) than native JS Dates.\n *\n * See the [date format overview](#/components/datepicker/overview#date-model) for more details.\n *\n * @since 3.0.0\n */\nexport class NgbDate implements NgbDateStruct {\n\t/**\n\t * The year, for example 2016\n\t */\n\tyear: number;\n\n\t/**\n\t * The month, for example 1=Jan ... 12=Dec as in ISO 8601\n\t */\n\tmonth: number;\n\n\t/**\n\t * The day of month, starting with 1\n\t */\n\tday: number;\n\n\t/**\n\t * A **static method** that creates a new date object from the `NgbDateStruct`,\n\t *\n\t * ex. `NgbDate.from({year: 2000, month: 5, day: 1})`.\n\t *\n\t * If the `date` is already of `NgbDate` type, the method will return the same object.\n\t */\n\tstatic from(date?: NgbDateStruct | null): NgbDate | null {\n\t\tif (date instanceof NgbDate) {\n\t\t\treturn date;\n\t\t}\n\t\treturn date ? new NgbDate(date.year, date.month, date.day) : null;\n\t}\n\n\tconstructor(year: number, month: number, day: number) {\n\t\tthis.year = isInteger(year) ? year : <any>null;\n\t\tthis.month = isInteger(month) ? month : <any>null;\n\t\tthis.day = isInteger(day) ? day : <any>null;\n\t}\n\n\t/**\n\t * Checks if the current date is equal to another date.\n\t */\n\tequals(other?: NgbDateStruct | null): boolean {\n\t\treturn other != null && this.year === other.year && this.month === other.month && this.day === other.day;\n\t}\n\n\t/**\n\t * Checks if the current date is before another date.\n\t */\n\tbefore(other?: NgbDateStruct | null): boolean {\n\t\tif (!other) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (this.year === other.year) {\n\t\t\tif (this.month === other.month) {\n\t\t\t\treturn this.day === other.day ? false : this.day < other.day;\n\t\t\t} else {\n\t\t\t\treturn this.month < other.month;\n\t\t\t}\n\t\t} else {\n\t\t\treturn this.year < other.year;\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the current date is after another date.\n\t */\n\tafter(other?: NgbDateStruct | null): boolean {\n\t\tif (!other) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.year === other.year) {\n\t\t\tif (this.month === other.month) {\n\t\t\t\treturn this.day === other.day ? false : this.day > other.day;\n\t\t\t} else {\n\t\t\t\treturn this.month > other.month;\n\t\t\t}\n\t\t} else {\n\t\t\treturn this.year > other.year;\n\t\t}\n\t}\n}\n","import { NgbDate } from './ngb-date';\nimport { Injectable } from '@angular/core';\nimport { isInteger } from './_ngb-ngbootstrap-utilities.mjs';\n\nexport function fromJSDate(jsDate: Date) {\n\treturn new NgbDate(jsDate.getFullYear(), jsDate.getMonth() + 1, jsDate.getDate());\n}\nexport function toJSDate(date: NgbDate) {\n\tconst jsDate = new Date(date.year, date.month - 1, date.day, 12);\n\t// this is done avoid 30 -> 1930 conversion\n\tif (!isNaN(jsDate.getTime())) {\n\t\tjsDate.setFullYear(date.year);\n\t}\n\treturn jsDate;\n}\n\nexport type NgbPeriod = 'y' | 'm' | 'd';\n\nexport function NGB_DATEPICKER_CALENDAR_FACTORY() {\n\treturn new NgbCalendarGregorian();\n}\n\n/**\n * A service that represents the calendar used by the datepicker.\n *\n * The default implementation uses the Gregorian calendar. You can inject it in your own\n * implementations if necessary to simplify `NgbDate` calculations.\n */\n@Injectable({ providedIn: 'root', useFactory: NGB_DATEPICKER_CALENDAR_FACTORY })\nexport abstract class NgbCalendar {\n\t/**\n\t * Returns the number of days per week.\n\t */\n\tabstract getDaysPerWeek(): number;\n\n\t/**\n\t * Returns an array of months per year.\n\t *\n\t * With default calendar we use ISO 8601 and return [1, 2, ..., 12];\n\t */\n\tabstract getMonths(year?: number): number[];\n\n\t/**\n\t * Returns the number of weeks per month.\n\t */\n\tabstract getWeeksPerMonth(): number;\n\n\t/**\n\t * Returns the weekday number for a given day.\n\t *\n\t * With the default calendar we use ISO 8601: 'weekday' is 1=Mon ... 7=Sun\n\t */\n\tabstract getWeekday(date: NgbDate): number;\n\n\t/**\n\t * Adds a number of years, months or days to a given date.\n\t *\n\t * * `period` can be `y`, `m` or `d` and defaults to day.\n\t * * `number` defaults to 1.\n\t *\n\t * Always returns a new date.\n\t */\n\tabstract getNext(date: NgbDate, period?: NgbPeriod, number?: number): NgbDate;\n\n\t/**\n\t * Subtracts a number of years, months or days from a given date.\n\t *\n\t * * `period` can be `y`, `m` or `d` and defaults to day.\n\t * * `number` defaults to 1.\n\t *\n\t * Always returns a new date.\n\t */\n\tabstract getPrev(date: NgbDate, period?: NgbPeriod, number?: number): NgbDate;\n\n\t/**\n\t * Returns the week number for a given week.\n\t */\n\tabstract getWeekNumber(week: readonly NgbDate[], firstDayOfWeek: number): number;\n\n\t/**\n\t * Returns the today's date.\n\t */\n\tabstract getToday(): NgbDate;\n\n\t/**\n\t * Checks if a date is valid in the current calendar.\n\t */\n\tabstract isValid(date?: NgbDate | null): boolean;\n}\n\n@Injectable()\nexport class NgbCalendarGregorian extends NgbCalendar {\n\tgetDaysPerWeek() {\n\t\treturn 7;\n\t}\n\n\tgetMonths() {\n\t\treturn [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];\n\t}\n\n\tgetWeeksPerMonth() {\n\t\treturn 6;\n\t}\n\n\tgetNext(date: NgbDate, period: NgbPeriod = 'd', number = 1) {\n\t\tlet jsDate = toJSDate(date);\n\t\tlet checkMonth = true;\n\t\tlet expectedMonth = jsDate.getMonth();\n\n\t\tswitch (period) {\n\t\t\tcase 'y':\n\t\t\t\tjsDate.setFullYear(jsDate.getFullYear() + number);\n\t\t\t\tbreak;\n\t\t\tcase 'm':\n\t\t\t\texpectedMonth += number;\n\t\t\t\tjsDate.setMonth(expectedMonth);\n\t\t\t\texpectedMonth = expectedMonth % 12;\n\t\t\t\tif (expectedMonth < 0) {\n\t\t\t\t\texpectedMonth = expectedMonth + 12;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'd':\n\t\t\t\tjsDate.setDate(jsDate.getDate() + number);\n\t\t\t\tcheckMonth = false;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn date;\n\t\t}\n\n\t\tif (checkMonth && jsDate.getMonth() !== expectedMonth) {\n\t\t\t// this means the destination month has less days than the initial month\n\t\t\t// let's go back to the end of the previous month:\n\t\t\tjsDate.setDate(0);\n\t\t}\n\n\t\treturn fromJSDate(jsDate);\n\t}\n\n\tgetPrev(date: NgbDate, period: NgbPeriod = 'd', number = 1) {\n\t\treturn this.getNext(date, period, -number);\n\t}\n\n\tgetWeekday(date: NgbDate) {\n\t\tlet jsDate = toJSDate(date);\n\t\tlet day = jsDate.getDay();\n\t\t// in JS Date Sun=0, in ISO 8601 Sun=7\n\t\treturn day === 0 ? 7 : day;\n\t}\n\n\tgetWeekNumber(week: readonly NgbDate[], firstDayOfWeek: number) {\n\t\t// in JS Date Sun=0, in ISO 8601 Sun=7\n\t\tif (firstDayOfWeek === 7) {\n\t\t\tfirstDayOfWeek = 0;\n\t\t}\n\n\t\tconst thursdayIndex = (4 + 7 - firstDayOfWeek) % 7;\n\t\tlet date = week[thursdayIndex];\n\n\t\tconst jsDate = toJSDate(date);\n\t\tjsDate.setDate(jsDate.getDate() + 4 - (jsDate.getDay() || 7)); // Thursday\n\t\tconst time = jsDate.getTime();\n\t\tjsDate.setMonth(0); // Compare with Jan 1\n\t\tjsDate.setDate(1);\n\t\treturn Math.floor(Math.round((time - jsDate.getTime()) / 86400000) / 7) + 1;\n\t}\n\n\tgetToday(): NgbDate {\n\t\treturn fromJSDate(new Date());\n\t}\n\n\tisValid(date?: NgbDate | null): boolean {\n\t\tif (!date || !isInteger(date.year) || !isInteger(date.month) || !isInteger(date.day)) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// year 0 doesn't exist in Gregorian calendar\n\t\tif (date.year === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst jsDate = toJSDate(date);\n\n\t\treturn (\n\t\t\t!isNaN(jsDate.getTime()) &&\n\t\t\tjsDate.getFullYear() === date.year &&\n\t\t\tjsDate.getMonth() + 1 === date.month &&\n\t\t\tjsDate.getDate() === date.day\n\t\t);\n\t}\n}\n","import { NgbDate } from './ngb-date';\nimport { DatepickerViewModel, DayViewModel, MonthViewModel } from './datepicker-view-model';\nimport { NgbCalendar } from './ngb-calendar';\nimport { NgbDatepickerI18n } from './datepicker-i18n';\n\nexport function isChangedDate(prev?: NgbDate | null, next?: NgbDate | null): boolean {\n\treturn !dateComparator(prev, next);\n}\n\nexport function isChangedMonth(prev?: NgbDate | null, next?: NgbDate | null): boolean {\n\treturn !prev && !next ? false : !prev || !next ? true : prev.year !== next.year || prev.month !== next.month;\n}\n\nexport function dateComparator(prev?: NgbDate | null, next?: NgbDate | null): boolean {\n\treturn (!prev && !next) || (!!prev && !!next && prev.equals(next));\n}\n\nexport function checkMinBeforeMax(minDate?: NgbDate | null, maxDate?: NgbDate | null): void {\n\tif (maxDate && minDate && maxDate.before(minDate)) {\n\t\tthrow new Error(`'maxDate' ${maxDate} should be greater than 'minDate' ${minDate}`);\n\t}\n}\n\nexport function checkDateInRange(\n\tdate?: NgbDate | null,\n\tminDate?: NgbDate | null,\n\tmaxDate?: NgbDate | null,\n): NgbDate | null {\n\tif (date && minDate && date.before(minDate)) {\n\t\treturn minDate;\n\t}\n\tif (date && maxDate && date.after(maxDate)) {\n\t\treturn maxDate;\n\t}\n\n\treturn date || null;\n}\n\nexport function isDateSelectable(date: NgbDate | null | undefined, state: DatepickerViewModel) {\n\tconst { minDate, maxDate, disabled, markDisabled } = state;\n\treturn !(\n\t\tdate === null ||\n\t\tdate === undefined ||\n\t\tdisabled ||\n\t\t(markDisabled && markDisabled(date, { year: date.year, month: date.month })) ||\n\t\t(minDate && date.before(minDate)) ||\n\t\t(maxDate && date.after(maxDate))\n\t);\n}\n\nexport function generateSelectBoxMonths(\n\tcalendar: NgbCalendar,\n\tdate: NgbDate,\n\tminDate: NgbDate | null,\n\tmaxDate: NgbDate | null,\n) {\n\tif (!date) {\n\t\treturn [];\n\t}\n\n\tlet months = calendar.getMonths(date.year);\n\n\tif (minDate && date.year === minDate.year) {\n\t\tconst index = months.findIndex((month) => month === minDate.month);\n\t\tmonths = months.slice(index);\n\t}\n\n\tif (maxDate && date.year === maxDate.year) {\n\t\tconst index = months.findIndex((month) => month === maxDate.month);\n\t\tmonths = months.slice(0, index + 1);\n\t}\n\n\treturn months;\n}\n\nexport function generateSelectBoxYears(date: NgbDate, minDate: NgbDate | null, maxDate: NgbDate | null) {\n\tif (!date) {\n\t\treturn [];\n\t}\n\n\tconst start = minDate ? Math.max(minDate.year, date.year - 500) : date.year - 10;\n\tconst end = maxDate ? Math.min(maxDate.year, date.year + 500) : date.year + 10;\n\n\tconst length = end - start + 1;\n\tconst numbers = Array(length);\n\tfor (let i = 0; i < length; i++) {\n\t\tnumbers[i] = start + i;\n\t}\n\n\treturn numbers;\n}\n\nexport function nextMonthDisabled(calendar: NgbCalendar, date: NgbDate, maxDate: NgbDate | null) {\n\tconst nextDate = Object.assign(calendar.getNext(date, 'm'), { day: 1 });\n\treturn maxDate != null && nextDate.after(maxDate);\n}\n\nexport function prevMonthDisabled(calendar: NgbCalendar, date: NgbDate, minDate: NgbDate | null) {\n\tconst prevDate = Object.assign(calendar.getPrev(date, 'm'), { day: 1 });\n\treturn (\n\t\tminDate != null &&\n\t\t((prevDate.year === minDate.year && prevDate.month < minDate.month) ||\n\t\t\t(prevDate.year < minDate.year && minDate.month === 1))\n\t);\n}\n\nexport function buildMonths(\n\tcalendar: NgbCalendar,\n\tdate: NgbDate,\n\tstate: DatepickerViewModel,\n\ti18n: NgbDatepickerI18n,\n\tforce: boolean,\n): MonthViewModel[] {\n\tconst { displayMonths, months } = state;\n\t// move old months to a temporary array\n\tconst monthsToReuse = months.splice(0, months.length);\n\n\t// generate new first dates, nullify or reuse months\n\tconst firstDates = Array.from({ length: displayMonths }, (_, i) => {\n\t\tconst firstDate = Object.assign(calendar.getNext(date, 'm', i), { day: 1 });\n\t\tmonths[i] = <any>null;\n\n\t\tif (!force) {\n\t\t\tconst reusedIndex = monthsToReuse.findIndex((month) => month.firstDate.equals(firstDate));\n\t\t\t// move reused month back to months\n\t\t\tif (reusedIndex !== -1) {\n\t\t\t\tmonths[i] = monthsToReuse.splice(reusedIndex, 1)[0];\n\t\t\t}\n\t\t}\n\n\t\treturn firstDate;\n\t});\n\n\t// rebuild nullified months\n\tfirstDates.forEach((firstDate, i) => {\n\t\tif (months[i] === null) {\n\t\t\tmonths[i] = buildMonth(calendar, firstDate, state, i18n, monthsToReuse.shift() || ({} as MonthViewModel));\n\t\t}\n\t});\n\n\treturn months;\n}\n\nexport function buildMonth(\n\tcalendar: NgbCalendar,\n\tdate: NgbDate,\n\tstate: DatepickerViewModel,\n\ti18n: NgbDatepickerI18n,\n\tmonth: MonthViewModel = {} as MonthViewModel,\n): MonthViewModel {\n\tconst {\n\t\tdayTemplateData,\n\t\tminDate,\n\t\tmaxDate,\n\t\tfirstDayOfWeek,\n\t\tmarkDisabled,\n\t\toutsideDays,\n\t\tweekdayWidth,\n\t\tweekdaysVisible,\n\t} = state;\n\tconst calendarToday = calendar.getToday();\n\n\tmonth.firstDate = <any>null;\n\tmonth.lastDate = <any>null;\n\tmonth.number = date.month;\n\tmonth.year = date.year;\n\tmonth.weeks = month.weeks || [];\n\tmonth.weekdays = month.weekdays || [];\n\n\tdate = getFirstViewDate(calendar, date, firstDayOfWeek);\n\n\t// clearing weekdays, if not visible\n\tif (!weekdaysVisible) {\n\t\tmonth.weekdays.length = 0;\n\t}\n\n\t// month has weeks\n\tfor (let week = 0; week < calendar.getWeeksPerMonth(); week++) {\n\t\tlet weekObject = month.weeks[week];\n\t\tif (!weekObject) {\n\t\t\tweekObject = month.weeks[week] = { number: 0, days: [], collapsed: true };\n\t\t}\n\t\tconst days = weekObject.days;\n\n\t\t// week has days\n\t\tfor (let day = 0; day < calendar.getDaysPerWeek(); day++) {\n\t\t\tif (week === 0 && weekdaysVisible) {\n\t\t\t\tmonth.weekdays[day] = i18n.getWeekdayLabel(calendar.getWeekday(date), weekdayWidth);\n\t\t\t}\n\n\t\t\tconst newDate = new NgbDate(date.year, date.month, date.day);\n\t\t\tconst nextDate = calendar.getNext(newDate);\n\n\t\t\tconst ariaLabel = i18n.getDayAriaLabel(newDate);\n\n\t\t\t// marking date as disabled\n\t\t\tlet disabled = !!((minDate && newDate.before(minDate)) || (maxDate && newDate.after(maxDate)));\n\t\t\tif (!disabled && markDisabled) {\n\t\t\t\tdisabled = markDisabled(newDate, { month: month.number, year: month.year });\n\t\t\t}\n\n\t\t\t// today\n\t\t\tlet today = newDate.equals(calendarToday);\n\n\t\t\t// adding user-provided data to the context\n\t\t\tlet contextUserData = dayTemplateData\n\t\t\t\t? dayTemplateData(newDate, { month: month.number, year: month.year })\n\t\t\t\t: undefined;\n\n\t\t\t// saving first date of the month\n\t\t\tif (month.firstDate === null && newDate.month === month.number) {\n\t\t\t\tmonth.firstDate = newDate;\n\t\t\t}\n\n\t\t\t// saving last date of the month\n\t\t\tif (newDate.month === month.number && nextDate.month !== month.number) {\n\t\t\t\tmonth.lastDate = newDate;\n\t\t\t}\n\n\t\t\tlet dayObject = days[day];\n\t\t\tif (!dayObject) {\n\t\t\t\tdayObject = days[day] = {} as DayViewModel;\n\t\t\t}\n\t\t\tdayObject.date = newDate;\n\t\t\tdayObject.context = Object.assign(dayObject.context || {}, {\n\t\t\t\t$implicit: newDate,\n\t\t\t\tdate: newDate,\n\t\t\t\tdata: contextUserData,\n\t\t\t\tcurrentMonth: month.number,\n\t\t\t\tcurrentYear: month.year,\n\t\t\t\tdisabled,\n\t\t\t\tfocused: false,\n\t\t\t\tselected: false,\n\t\t\t\ttoday,\n\t\t\t});\n\t\t\tdayObject.tabindex = -1;\n\t\t\tdayObject.ariaLabel = ariaLabel;\n\t\t\tdayObject.hidden = false;\n\n\t\t\tdate = nextDate;\n\t\t}\n\n\t\tweekObject.number = calendar.getWeekNumber(\n\t\t\tdays.map((day) => day.date),\n\t\t\tfirstDayOfWeek,\n\t\t);\n\n\t\t// marking week as collapsed\n\t\tweekObject.collapsed =\n\t\t\toutsideDays === 'collapsed' &&\n\t\t\tdays[0].date.month !== month.number &&\n\t\t\tdays[days.length - 1].date.month !== month.number;\n\t}\n\n\treturn month;\n}\n\nexport function getFirstViewDate(calendar: NgbCalendar, date: NgbDate, firstDayOfWeek: number): NgbDate {\n\tconst daysPerWeek = calendar.getDaysPerWeek();\n\tconst firstMonthDate = new NgbDate(date.year, date.month, 1);\n\tconst dayOfWeek = calendar.getWeekday(firstMonthDate) % daysPerWeek;\n\treturn calendar.getPrev(firstMonthDate, 'd', (daysPerWeek + dayOfWeek - firstDayOfWeek) % daysPerWeek);\n}\n","import { inject, Injectable, LOCALE_ID } from '@angular/core';\nimport { formatDate } from '@angular/common';\nimport { NgbDateStruct } from './ngb-date-struct';\n\n/**\n * A service supplying i18n data to the datepicker component.\n *\n * The default implementation of this service uses the Angular locale and registered locale data for\n * weekdays and month names (as explained in the Angular i18n guide).\n *\n * It also provides a way to i18n data that depends on calendar calculations, like aria labels, day, week and year\n * numerals. For other static labels the datepicker uses the default Angular i18n.\n *\n * See the [i18n demo](#/components/datepicker/examples#i18n) and\n * [Hebrew calendar demo](#/components/datepicker/calendars#hebrew) on how to extend this class and define\n * a custom provider for i18n.\n */\n@Injectable({\n\tprovidedIn: 'root',\n\tuseFactory: () => new NgbDatepickerI18nDefault(),\n})\nexport abstract class NgbDatepickerI18n {\n\t/**\n\t * Returns the weekday label using specified width\n\t *\n\t * @since 9.1.0\n\t */\n\tabstract getWeekdayLabel(weekday: number, width?: Exclude<Intl.DateTimeFormatOptions['weekday'], undefined>): string;\n\n\t/**\n\t * Returns the short month name to display in the date picker navigation.\n\t *\n\t * With default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec.\n\t */\n\tabstract getMonthShortName(month: number, year?: number): string;\n\n\t/**\n\t * Returns the full month name to display in the date picker navigation.\n\t *\n\t * With default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec.\n\t */\n\tabstract getMonthFullName(month: number, year?: number): string;\n\n\t/**\n\t * Returns the text label to display above the day view.\n\t *\n\t * @since 9.1.0\n\t */\n\tgetMonthLabel(date: NgbDateStruct): string {\n\t\treturn `${this.getMonthFullName(date.month, date.year)} ${this.getYearNumerals(date.year)}`;\n\t}\n\n\t/**\n\t * Returns the value of the `aria-label` attribute for a specific date.\n\t *\n\t * @since 2.0.0\n\t */\n\tabstract getDayAriaLabel(date: NgbDateStruct): string;\n\n\t/**\n\t * Returns the textual representation of a day that is rendered in a day cell.\n\t *\n\t * @since 3.0.0\n\t */\n\tgetDayNumerals(date: NgbDateStruct): string {\n\t\treturn `${date.day}`;\n\t}\n\n\t/**\n\t * Returns the textual representation of a week number rendered by datepicker.\n\t *\n\t * @since 3.0.0\n\t */\n\tgetWeekNumerals(weekNumber: number): string {\n\t\treturn `${weekNumber}`;\n\t}\n\n\t/**\n\t * Returns the textual representation of a year that is rendered in the datepicker year select box.\n\t *\n\t * @since 3.0.0\n\t */\n\tgetYearNumerals(year: number): string {\n\t\treturn `${year}`;\n\t}\n\n\t/**\n\t * Returns the week label to display in the heading of the month view.\n\t *\n\t * @since 9.1.0\n\t */\n\tgetWeekLabel(): string {\n\t\treturn '';\n\t}\n}\n\n/**\n * A service providing default implementation for the datepicker i18n.\n * It can be used as a base implementation if necessary.\n *\n * @since 9.1.0\n */\n@Injectable()\nexport class NgbDatepickerI18nDefault extends NgbDatepickerI18n {\n\tprivate _locale = inject(LOCALE_ID);\n\n\tprivate _monthsShort = [...Array(12).keys()].map((month) =>\n\t\tIntl.DateTimeFormat(this._locale, { month: 'short', timeZone: 'UTC' }).format(Date.UTC(2000, month)),\n\t);\n\tprivate _monthsFull = [...Array(12).keys()].map((month) =>\n\t\tIntl.DateTimeFormat(this._locale, { month: 'long', timeZone: 'UTC' }).format(Date.UTC(2000, month)),\n\t);\n\n\tgetWeekdayLabel(\n\t\tweekday: number,\n\t\twidth: Exclude<Intl.DateTimeFormatOptions['weekday'], undefined> = 'narrow',\n\t): string {\n\t\t// 1 MAY 2000 is a Monday\n\t\tconst weekdays = [1, 2, 3, 4, 5, 6, 7].map((day) =>\n\t\t\tIntl.DateTimeFormat(this._locale, { weekday: width, timeZone: 'UTC' }).format(Date.UTC(2000, 4, day)),\n\t\t);\n\n\t\t// `weekday` is 1 (Mon) to 7 (Sun)\n\t\treturn weekdays[weekday - 1] || '';\n\t}\n\n\tgetMonthShortName(month: number): string {\n\t\treturn this._monthsShort[month - 1] || '';\n\t}\n\n\tgetMonthFullName(month: number): string {\n\t\treturn this._monthsFull[month - 1] || '';\n\t}\n\n\tgetDayAriaLabel(date: NgbDateStruct): string {\n\t\tconst jsDate = new Date(date.year, date.month - 1, date.day);\n\t\treturn formatDate(jsDate, 'fullDate', this._locale);\n\t}\n}\n","import { NgbCalendar } from './ngb-calendar';\nimport { NgbDate } from './ngb-date';\nimport { NgbDateStruct } from './ngb-date-struct';\nimport { DatepickerViewModel, NgbDayTemplateData, NgbMarkDisabled } from './datepicker-view-model';\nimport { inject, Injectable } from '@angular/core';\nimport { isInteger, toInteger } from './_ngb-ngbootstrap-utilities.mjs';\nimport { Observable, Subject } from 'rxjs';\nimport {\n\tbuildMonths,\n\tcheckDateInRange,\n\tcheckMinBeforeMax,\n\tgenerateSelectBoxMonths,\n\tgenerateSelectBoxYears,\n\tisChangedDate,\n\tisChangedMonth,\n\tisDateSelectable,\n\tnextMonthDisabled,\n\tprevMonthDisabled,\n} from './datepicker-tools';\n\nimport { filter } from 'rxjs/operators';\nimport { NgbDatepickerI18n } from './datepicker-i18n';\n\nexport type DatepickerServiceInputs = Partial<{\n\tdayTemplateData: NgbDayTemplateData;\n\tdisplayMonths: number;\n\tdisabled: boolean;\n\tfirstDayOfWeek: number;\n\tfocusVisible: boolean;\n\tmarkDisabled: NgbMarkDisabled;\n\tmaxDate: NgbDate | null;\n\tminDate: NgbDate | null;\n\tnavigation: 'select' | 'arrows' | 'none';\n\toutsideDays: 'visible' | 'collapsed' | 'hidden';\n\tweekdays: Exclude<Intl.DateTimeFormatOptions['weekday'], undefined> | boolean;\n}>;\n\n@Injectable()\nexport class NgbDatepickerService {\n\tprivate _VALIDATORS: {\n\t\t[K in keyof DatepickerServiceInputs]: (v: DatepickerServiceInputs[K]) => Partial<DatepickerViewModel> | void;\n\t} = {\n\t\tdayTemplateData: (dayTemplateData: NgbDayTemplateData) => {\n\t\t\tif (this._state.dayTemplateData !== dayTemplateData) {\n\t\t\t\treturn { dayTemplateData };\n\t\t\t}\n\t\t},\n\t\tdisplayMonths: (displayMonths: number) => {\n\t\t\tdisplayMonths = toInteger(displayMonths);\n\t\t\tif (isInteger(displayMonths) && displayMonths > 0 && this._state.displayMonths !== displayMonths) {\n\t\t\t\treturn { displayMonths };\n\t\t\t}\n\t\t},\n\t\tdisabled: (disabled: boolean) => {\n\t\t\tif (this._state.disabled !== disabled) {\n\t\t\t\treturn { disabled };\n\t\t\t}\n\t\t},\n\t\tfirstDayOfWeek: (firstDayOfWeek: number) => {\n\t\t\tfirstDayOfWeek = toInteger(firstDayOfWeek);\n\t\t\tif (isInteger(firstDayOfWeek) && firstDayOfWeek >= 0 && this._state.firstDayOfWeek !== firstDayOfWeek) {\n\t\t\t\treturn { firstDayOfWeek };\n\t\t\t}\n\t\t},\n\t\tfocusVisible: (focusVisible: boolean) => {\n\t\t\tif (this._state.focusVisible !== focusVisible && !this._state.disabled) {\n\t\t\t\treturn { focusVisible };\n\t\t\t}\n\t\t},\n\t\tmarkDisabled: (markDisabled: NgbMarkDisabled) => {\n\t\t\tif (this._state.markDisabled !== markDisabled) {\n\t\t\t\treturn { markDisabled };\n\t\t\t}\n\t\t},\n\t\tmaxDate: (date: NgbDate | null) => {\n\t\t\tconst maxDate = this.toValidDate(date, null);\n\t\t\tif (isChangedDate(this._state.maxDate, maxDate)) {\n\t\t\t\treturn { maxDate };\n\t\t\t}\n\t\t},\n\t\tminDate: (date: NgbDate | null) => {\n\t\t\tconst minDate = this.toValidDate(date, null);\n\t\t\tif (isChangedDate(this._state.minDate, minDate)) {\n\t\t\t\treturn { minDate };\n\t\t\t}\n\t\t},\n\t\tnavigation: (navigation: 'select' | 'arrows' | 'none') => {\n\t\t\tif (this._state.navigation !== navigation) {\n\t\t\t\treturn { navigation };\n\t\t\t}\n\t\t},\n\t\toutsideDays: (outsideDays: 'visible' | 'collapsed' | 'hidden') => {\n\t\t\tif (this._state.outsideDays !== outsideDays) {\n\t\t\t\treturn { outsideDays };\n\t\t\t}\n\t\t},\n\t\tweekdays: (weekdays: boolean | Exclude<Intl.DateTimeFormatOptions['weekday'], undefined>) => {\n\t\t\tconst weekdayWidth = weekdays === true || weekdays === false ? 'narrow' : weekdays;\n\t\t\tconst weekdaysVisible = weekdays === true || weekdays === false ? weekdays : true;\n\t\t\tif (this._state.weekdayWidth !== weekdayWidth || this._state.weekdaysVisible !== weekdaysVisible) {\n\t\t\t\treturn { weekdayWidth, weekdaysVisible };\n\t\t\t}\n\t\t},\n\t};\n\n\tprivate _calendar = inject(NgbCalendar);\n\tprivate _i18n = inject(NgbDatepickerI18n);\n\n\tprivate _model$ = new Subject<DatepickerViewModel>();\n\n\tprivate _dateSelect$ = new Subject<NgbDate>();\n\n\tprivate _state: DatepickerViewModel = {\n\t\tdayTemplateData: null,\n\t\tmarkDisabled: null,\n\t\tmaxDate: null,\n\t\tminDate: null,\n\t\tdisabled: false,\n\t\tdisplayMonths: 1,\n\t\tfirstDate: null,\n\t\tfirstDayOfWeek: 1,\n\t\tlastDate: null,\n\t\tfocusDate: null,\n\t\tfocusVisible: false,\n\t\tmonths: [],\n\t\tnavigation: 'select',\n\t\toutsideDays: 'visible',\n\t\tprevDisabled: false,\n\t\tnextDisabled: false,\n\t\tselectedDate: null,\n\t\tselectBoxes: { years: [], months: [] },\n\t\tweekdayWidth: 'narrow',\n\t\tweekdaysVisible: true,\n\t};\n\n\tget model$(): Observable<DatepickerViewModel> {\n\t\treturn this._model$.pipe(filter((model) => model.months.length > 0));\n\t}\n\n\tget dateSelect$(): Observable<NgbDate> {\n\t\treturn this._dateSelect$.pipe(filter((date) => date !== null));\n\t}\n\n\tset(options: DatepickerServiceInputs) {\n\t\tlet patch = Object.keys(options)\n\t\t\t.map((key) => this._VALIDATORS[key](options[key]))\n\t\t\t.reduce((obj, part) => ({ ...obj, ...part }), {});\n\n\t\tif (Object.keys(patch).length > 0) {\n\t\t\tthis._nextState(patch);\n\t\t}\n\t}\n\n\tfocus(date?: NgbDate | null) {\n\t\tconst focusedDate = this.toValidDate(date, null);\n\t\tif (focusedDate != null && !this._state.disabled && isChangedDate(this._state.focusDate, focusedDate)) {\n\t\t\tthis._nextState({ focusDate: date });\n\t\t}\n\t}\n\n\tfocusSelect() {\n\t\tif (isDateSelectable(this._state.focusDate, this._state)) {\n\t\t\tthis.select(this._state.focusDate, { emitEvent: true });\n\t\t}\n\t}\n\n\topen(date?: NgbDate | null) {\n\t\tconst firstDate = this.toValidDate(date, this._calendar.getToday());\n\t\tif (\n\t\t\tfirstDate != null &&\n\t\t\t!this._state.disabled &&\n\t\t\t(!this._state.firstDate || isChangedMonth(this._state.firstDate, firstDate))\n\t\t) {\n\t\t\tthis._nextState({ firstDate });\n\t\t}\n\t}\n\n\tselect(date?: NgbDate | null, options: { emitEvent?: boolean } = {}) {\n\t\tconst selectedDate = this.toValidDate(date, null);\n\t\tif (selectedDate != null && !this._state.disabled) {\n\t\t\tif (isChangedDate(this._state.selectedDate, selectedDate)) {\n\t\t\t\tthis._nextState({ selectedDate });\n\t\t\t}\n\n\t\t\tif (options.emitEvent && isDateSelectable(selectedDate, this._state)) {\n\t\t\t\tthis._dateSelect$.next(selectedDate);\n\t\t\t}\n\t\t}\n\t}\n\n\ttoValidDate(date?: NgbDateStruct | null, defaultValue?: NgbDate | null): NgbDate | null {\n\t\tconst ngbDate = NgbDate.from(date);\n\t\tif (defaultValue === undefined) {\n\t\t\tdefaultValue = this._calendar.getToday();\n\t\t}\n\t\treturn this._calendar.isValid(ngbDate) ? ngbDate : defaultValue;\n\t}\n\n\tgetMonth(struct: NgbDateStruct) {\n\t\tfor (let month of this._state.months) {\n\t\t\tif (struct.month === month.number && struct.year === month.year) {\n\t\t\t\treturn month;\n\t\t\t}\n\t\t}\n\t\tthrow new Error(`month ${struct.month} of year ${struct.year} not found`);\n\t}\n\n\tprivate _nextState(patch: Partial<DatepickerViewModel>) {\n\t\tconst newState = this._updateState(patch);\n\t\tthis._patchContexts(newState);\n\t\tthis._state = newState;\n\t\tthis._model$.next(this._state);\n\t}\n\n\tprivate _patchContexts(state: DatepickerViewModel) {\n\t\tconst { months, displayMonths, selectedDate, focusDate, focusVisible, disabled, outsideDays } = state;\n\t\tstate.months.forEach((month) => {\n\t\t\tmonth.weeks.forEach((week) => {\n\t\t\t\tweek.days.forEach((day) => {\n\t\t\t\t\t// patch focus flag\n\t\t\t\t\tif (focusDate) {\n\t\t\t\t\t\tday.context.focused = focusDate.equals(day.date) && focusVisible;\n\t\t\t\t\t}\n\n\t\t\t\t\t// calculating tabindex\n\t\t\t\t\tday.tabindex =\n\t\t\t\t\t\t!disabled && focusDate && day.date.equals(focusDate) && focusDate.month === month.number ? 0 : -1;\n\n\t\t\t\t\t// override context disabled\n\t\t\t\t\tif (disabled === true) {\n\t\t\t\t\t\tday.context.disabled = true;\n\t\t\t\t\t}\n\n\t\t\t\t\t// patch selection flag\n\t\t\t\t\tif (selectedDate !== undefined) {\n\t\t\t\t\t\tday.context.selected = selectedDate !== null && selectedDate.equals(day.date);\n\t\t\t\t\t}\n\n\t\t\t\t\t// visibility\n\t\t\t\t\tif (month.number !== day.date.month) {\n\t\t\t\t\t\tday.hidden =\n\t\t\t\t\t\t\toutsideDays === 'hidden' ||\n\t\t\t\t\t\t\toutsideDays === 'collapsed' ||\n\t\t\t\t\t\t\t(displayMonths > 1 &&\n\t\t\t\t\t\t\t\tday.date.after(months[0].firstDate) &&\n\t\t\t\t\t\t\t\tday.date.before(months[displayMonths - 1].lastDate));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate _updateState(patch: Partial<DatepickerViewModel>): DatepickerViewModel {\n\t\t// patching fields\n\t\tconst state = Object.assign({}, this._state, patch);\n\n\t\tlet startDate = state.firstDate;\n\n\t\t// min/max dates changed\n\t\tif ('minDate' in patch || 'maxDate' in patch) {\n\t\t\tcheckMinBeforeMax(state.minDate, state.maxDate);\n\t\t\tstate.focusDate = checkDateInRange(state.focusDate, state.minDate, state.maxDate);\n\t\t\tstate.firstDate = checkDateInRange(state.firstDate, state.minDate, state.maxDate);\n\t\t\tstartDate = state.focusDate;\n\t\t}\n\n\t\t// disabled\n\t\tif ('disabled' in patch) {\n\t\t\tstate.focusVisible = false;\n\t\t}\n\n\t\t// initial rebuild via 'select()'\n\t\tif ('selectedDate' in patch && this._state.months.length === 0) {\n\t\t\tstartDate = state.selectedDate;\n\t\t}\n\n\t\t// terminate early if only focus visibility was changed\n\t\tif ('focusVisible' in patch) {\n\t\t\treturn state;\n\t\t}\n\n\t\t// focus date changed\n\t\tif ('focusDate' in patch) {\n\t\t\tstate.focusDate = checkDateInRange(state.focusDate, state.minDate, state.maxDate);\n\t\t\tstartDate = state.focusDate;\n\n\t\t\t// nothing to rebuild if only focus changed and it is still visible\n\t\t\tif (\n\t\t\t\tstate.months.length !== 0 &&\n\t\t\t\tstate.focusDate &&\n\t\t\t\t!state.focusDate.before(state.firstDate) &&\n\t\t\t\t!state.focusDate.after(state.lastDate)\n\t\t\t) {\n\t\t\t\treturn state;\n\t\t\t}\n\t\t}\n\n\t\t// first date changed\n\t\tif ('firstDate' in patch) {\n\t\t\tstate.firstDate = checkDateInRange(state.firstDate, state.minDate, state.maxDate);\n\t\t\tstartDate = state.firstDate;\n\t\t}\n\n\t\t// rebuilding months\n\t\tif (startDate) {\n\t\t\tconst forceRebuild =\n\t\t\t\t'dayTemplateData' in patch ||\n\t\t\t\t'firstDayOfWeek' in patch ||\n\t\t\t\t'markDisabled' in patch ||\n\t\t\t\t'minDate' in patch ||\n\t\t\t\t'maxDate' in patch ||\n\t\t\t\t'disabled' in patch ||\n\t\t\t\t'outsideDays' in patch ||\n\t\t\t\t'weekdaysVisible' in patch;\n\n\t\t\tconst months = buildMonths(this._calendar, startDate, state, this._i18n, forceRebuild);\n\n\t\t\t// updating months and boundary dates\n\t\t\tstate.months = months;\n\t\t\tstate.firstDate = months[0].firstDate;\n\t\t\tstate.lastDate = months[months.length - 1].lastDate;\n\n\t\t\t// reset selected date if 'markDisabled' returns true\n\t\t\tif ('selectedDate' in patch && !isDateSelectable(state.selectedDate, state)) {\n\t\t\t\tstate.selectedDate = null;\n\t\t\t}\n\n\t\t\t// adjusting focus after months were built\n\t\t\tif ('firstDate' in patch) {\n\t\t\t\tif (!state.focusDate || state.focusDate.before(state.firstDate) || state.focusDate.after(state.lastDate)) {\n\t\t\t\t\tstate.focusDate = startDate;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// adjusting months/years for the select box navigation\n\t\t\tconst yearChanged = !this._state.firstDate || this._state.firstDate.year !== state.firstDate.year;\n\t\t\tconst monthChanged = !this._state.firstDate || this._state.firstDate.month !== state.firstDate.month;\n\t\t\tif (state.navigation === 'select') {\n\t\t\t\t// years -> boundaries (min/max were changed)\n\t\t\t\tif ('minDate' in patch || 'maxDate' in patch || state.selectBoxes.years.length === 0 || yearChanged) {\n\t\t\t\t\tstate.selectBoxes.years = generateSelectBoxYears(state.firstDate, state.minDate, state.maxDate);\n\t\t\t\t}\n\n\t\t\t\t// months -> when current year or boundaries change\n\t\t\t\tif ('minDate' in patch || 'maxDate' in patch || state.selectBoxes.months.length === 0 || yearChanged) {\n\t\t\t\t\tstate.selectBoxes.months = generateSelectBoxMonths(\n\t\t\t\t\t\tthis._calendar,\n\t\t\t\t\t\tstate.firstDate,\n\t\t\t\t\t\tstate.minDate,\n\t\t\t\t\t\tstate.maxDate,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstate.selectBoxes = { years: [], months: [] };\n\t\t\t}\n\n\t\t\t// updating navigation arrows -> boundaries change (min/max) or month/year changes\n\t\t\tif (\n\t\t\t\t(state.navigation === 'arrows' || state.navigation === 'select') &&\n\t\t\t\t(monthChanged || yearChanged || 'minDate' in patch || 'maxDate' in patch || 'disabled' in patch)\n\t\t\t) {\n\t\t\t\tstate.prevDisabled = state.disabled || prevMonthDisabled(this._calendar, state.firstDate, state.minDate);\n\t\t\t\tstate.nextDisabled = state.disabled || nextMonthDisabled(this._calendar, state.lastDate, state.maxDate);\n\t\t\t}\n\t\t}\n\n\t\treturn state;\n\t}\n}\n","import { NgbDate } from './ngb-date';\nimport { NgbDateStruct } from './ngb-date-struct';\nimport { DayTemplateContext } from './datepicker-day-template-context';\n\nexport type NgbMarkDisabled = (date: NgbDateStruct, current?: { year: number; month: number }) => boolean;\nexport type NgbDayTemplateData = (date: NgbDateStruct, current?: { year: number; month: number }) => any;\n\nexport type DayViewModel = {\n\tdate: NgbDate;\n\tcontext: DayTemplateContext;\n\ttabindex: number;\n\tariaLabel: string;\n\thidden: boolean;\n};\n\nexport type WeekViewModel = {\n\tnumber: number;\n\tdays: DayViewModel[];\n\tcollapsed: boolean;\n};\n\nexport type MonthViewModel = {\n\tfirstDate: NgbDate;\n\tlastDate: NgbDate;\n\tnumber: number;\n\tyear: number;\n\tweeks: WeekViewModel[];\n\tweekdays: string[];\n};\n\nexport type DatepickerViewModel = {\n\tdayTemplateData: NgbDayTemplateData | null;\n\tdisabled: boolean;\n\tdisplayMonths: number;\n\tfirstDate: NgbDate | null;\n\tfirstDayOfWeek: number;\n\tfocusDate: NgbDate | null;\n\tfocusVisible: boolean;\n\tlastDate: NgbDate | null;\n\tmarkDisabled: NgbMarkDisabled | null;\n\tmaxDate: NgbDate | null;\n\tminDate: NgbDate | null;\n\tmonths: MonthViewModel[];\n\tnavigation: 'select' | 'arrows' | 'none';\n\toutsideDays: 'visible' | 'collapsed' | 'hidden';\n\tprevDisabled: boolean;\n\tnextDisabled: boolean;\n\tselectBoxes: {\n\t\tyears: number[];\n\t\tmonths: number[];\n\t};\n\tselectedDate: NgbDate | null;\n\tweekdayWidth: Exclude<Intl.DateTimeFormatOptions['weekday'], undefined>;\n\tweekdaysVisible: boolean;\n};\n\nexport enum NavigationEvent {\n\tPREV,\n\tNEXT,\n}\n","import { Injectable, TemplateRef } from '@angular/core';\nimport { DayTemplateContext } from './datepicker-day-template-context';\nimport { NgbDateStruct } from './ngb-date-struct';\n\n/**\n * A configuration service for the [`NgbDatepicker`](#/components/datepicker/api#NgbDatepicker) component.\n *\n * You can inject this service, typically in your root component, and customize the values of its properties in\n * order to provide default values for all the datepickers used in the application.\n */\n@Injectable({ providedIn: 'root' })\nexport class NgbDatepickerConfig {\n\tdayTemplate: TemplateRef<DayTemplateContext>;\n\tdayTemplateData: (date: NgbDateStruct, current?: { year: number; month: number }) => any;\n\tfooterTemplate: TemplateRef<any>;\n\tdisplayMonths = 1;\n\tfirstDayOfWeek = 1;\n\tmarkDisabled: (date: NgbDateStruct, current?: { year: number; month: number }) => boolean;\n\tminDate: NgbDateStruct;\n\tmaxDate: NgbDateStruct;\n\tnavigation: 'select' | 'arrows' | 'none' = 'select';\n\toutsideDays: 'visible' | 'collapsed' | 'hidden' = 'visible';\n\tshowWeekNumbers = false;\n\tstartDate: { year: number; month: number; day?: number };\n\tweekdays: Exclude<Intl.DateTimeFormatOptions['weekday'], undefined> | boolean = 'narrow';\n}\n","import { Injectable } from '@angular/core';\nimport { NgbDateStruct } from '../ngb-date-struct';\nimport { isInteger } from './_ngb-ngbootstrap-utilities.mjs';\n\nexport function NGB_DATEPICKER_DATE_ADAPTER_FACTORY() {\n\treturn new NgbDateStructAdapter();\n}\n\n/**\n * An abstract service that does the conversion between the internal datepicker `NgbDateStruct` model and\n * any provided user date model `D`, ex. a string, a native date, etc.\n *\n * The adapter is used **only** for conversion when binding datepicker to a form control,\n * ex. `[(ngModel)]=\"userDateModel\"`. Here `userDateModel` can be of any type.\n *\n * The default datepicker implementation assumes we use `NgbDateStruct` as a user model.\n *\n * See the [date format overview](#/components/datepicker/overview#date-model) for more details\n * and the [custom adapter demo](#/components/datepicker/examples#adapter) for an example.\n */\n@Injectable({ providedIn: 'root', useFactory: NGB_DATEPICKER_DATE_ADAPTER_FACTORY })\nexport abstract class NgbDateAdapter<D> {\n\t/**\n\t * Converts a user-model date of type `D` to an `NgbDateStruct` for internal use.\n\t */\n\tabstract fromModel(value: D | null): NgbDateStruct | null;\n\n\t/**\n\t * Converts an internal `NgbDateStruct` date to a user-model date of type `D`.\n\t */\n\tabstract toModel(date: NgbDateStruct | null): D | null;\n}\n\n@Injectable()\nexport class NgbDateStructAdapter extends NgbDateAdapter<NgbDateStruct> {\n\t/**\n\t * Converts a NgbDateStruct value into NgbDateStruct value\n\t */\n\tfromModel(date: NgbDateStruct | null): NgbDateStruct | null {\n\t\treturn date && isInteger(date.year) && isInteger(date.month) && isInteger(date.day)\n\t\t\t? { year: date.year, month: date.month, day: date.day }\n\t\t\t: null;\n\t}\n\n\t/**\n\t * Converts a NgbDateStruct value into NgbDateStruct value\n\t */\n\ttoModel(date: NgbDateStruct | null): NgbDateStruct | null {\n\t\treturn date && isInteger(date.year) && isInteger(date.month) && isInteger(date.day)\n\t\t\t? { year: date.year, month: date.month, day: date.day }\n\t\t\t: null;\n\t}\n}\n","import { Injectable } from '@angular/core';\nimport { NgbDatepicker } from './datepicker';\n\n/**\n * A service that represents the keyboard navigation.\n *\n * Default keyboard shortcuts [are documented in the overview](#/components/datepicker/overview#keyboard-shortcuts)\n *\n * @since 5.2.0\n */\n@Injectable({ providedIn: 'root' })\nexport class NgbDatepickerKeyboardService {\n\t/**\n\t * Processes a keyboard event.\n\t */\n\tprocessKey(event: KeyboardEvent, datepicker: NgbDatepicker) {\n\t\tconst { state, calendar } = datepicker;\n\t\tswitch (event.key) {\n\t\t\tcase 'PageUp':\n\t\t\t\tdatepicker.focusDate(calendar.getPrev(state.focusedDate, event.shiftKey ? 'y' : 'm', 1));\n\t\t\t\tbreak;\n\t\t\tcase 'PageDown':\n\t\t\t\tdatepicker.focusDate(calendar.getNext(state.focusedDate, event.shiftKey ? 'y' : 'm', 1));\n\t\t\t\tbreak;\n\t\t\tcase 'End':\n\t\t\t\tdatepicker.focusDate(event.shiftKey ? state.maxDate : state.lastDate);\n\t\t\t\tbreak;\n\t\t\tcase 'Home':\n\t\t\t\tdatepicker.focusDate(event.shiftKey ? state.minDate : state.firstDate);\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowLeft':\n\t\t\t\tdatepicker.focusDate(calendar.getPrev(state.focusedDate, 'd', 1));\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowUp':\n\t\t\t\tdatepicker.focusDate(calendar.getPrev(state.focusedDate, 'd', calendar.getDaysPerWeek()));\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowRight':\n\t\t\t\tdatepicker.focusDate(calendar.getNext(state.focusedDate, 'd', 1));\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowDown':\n\t\t\t\tdatepicker.focusDate(calendar.getNext(state.focusedDate, 'd', calendar.getDaysPerWeek()));\n\t\t\t\tbreak;\n\t\t\tcase 'Enter':\n\t\t\tcase ' ':\n\t\t\t\tdatepicker.focusSelect();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t}\n}\n","import { ChangeDetectionStrategy, Component, inject, Input, ViewEncapsulation } from '@angular/core';\nimport { NgbDate } from './ngb-date';\nimport { NgbDatepickerI18n } from './datepicker-i18n';\n\n@Component({\n\tselector: '[ngbDatepickerDayView]',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tencapsulation: ViewEncapsulation.None,\n\tstyleUrl: './datepicker-day-view.scss',\n\thost: {\n\t\tclass: 'btn-light',\n\t\t'[class.bg-primary]': 'selected',\n\t\t'[class.text-white]': 'selected',\n\t\t'[class.text-muted]': 'isMuted()',\n\t\t'[class.outside]': 'isMuted()',\n\t\t'[class.active]': 'focused',\n\t},\n\ttemplate: `{{ i18n.getDayNumerals(date) }}`,\n})\nexport class NgbDatepickerDayView {\n\ti18n = inject(NgbDatepickerI18n);\n\n\t@Input() currentMonth: number;\n\t@Input() date: NgbDate;\n\t@Input() disabled: boolean;\n\t@Input() focused: boolean;\n\t@Input() selected: boolean;\n\n\tisMuted() {\n\t\treturn !this.selected && (this.date.month !== this.currentMonth || this.disabled);\n\t}\n}\n","import {\n\tAfterViewChecked,\n\tChangeDetectionStrategy,\n\tComponent,\n\tElementRef,\n\tEventEmitter,\n\tinject,\n\tInput,\n\tOutput,\n\tViewChild,\n\tViewEncapsulation,\n} from '@angular/core';\nimport { NgbDate } from './ngb-date';\nimport { toInteger } from './_ngb-ngbootstrap-utilities.mjs';\nimport { NgbDatepickerI18n } from './datepicker-i18n';\n\n@Component({\n\tselector: 'ngb-datepicker-navigation-select',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tencapsulation: ViewEncapsulation.None,\n\tstyleUrl: './datepicker-navigation-select.scss',\n\ttemplate: `\n\t\t<select\n\t\t\t#month\n\t\t\t[disabled]=\"disabled\"\n\t\t\tclass=\"form-select\"\n\t\t\ti18n-aria-label=\"@@ngb.datepicker.select-month\"\n\t\t\taria-label=\"Select month\"\n\t\t\ti18n-title=\"@@ngb.datepicker.select-month\"\n\t\t\ttitle=\"Select month\"\n\t\t\t(change)=\"changeMonth($any($event).target.value)\"\n\t\t>\n\t\t\t@for (m of months; track m) {\n\t\t\t\t<option [attr.aria-label]=\"i18n.getMonthFullName(m, date.year)\" [value]=\"m\">{{\n\t\t\t\t\ti18n.getMonthShortName(m, date.year)\n\t\t\t\t}}</option>\n\t\t\t}</select\n\t\t><select\n\t\t\t#year\n\t\t\t[disabled]=\"disabled\"\n\t\t\tclass=\"form-select\"\n\t\t\ti18n-aria-label=\"@@ngb.datepicker.select-year\"\n\t\t\taria-label=\"Select year\"\n\t\t\ti18n-title=\"@@ngb.datepicker.select-year\"\n\t\t\ttitle=\"Select year\"\n\t\t\t(change)=\"changeYear($any($event).target.value)\"\n\t\t>\n\t\t\t@for (y of years; track y) {\n\t\t\t\t<option [value]=\"y\">{{ i18n.getYearNumerals(y) }}</option>\n\t\t\t}\n\t\t</select>\n\t`,\n})\nexport class NgbDatepickerNavigationSelect implements AfterViewChecked {\n\tprivate _month = -1;\n\tprivate _year = -1;\n\n\ti18n = inject(NgbDatepickerI18n);\n\n\t@Input() date: NgbDate;\n\t@Input() disabled: boolean;\n\t@Input() months: number[];\n\t@Input() years: number[];\n\n\t@Output() select = new EventEmitter<NgbDate>();\n\n\t@ViewChild('month', { static: true, read: ElementRef }) monthSelect: ElementRef<HTMLSelectElement>;\n\t@ViewChild('year', { static: true, read: ElementRef }) yearSelect: ElementRef<HTMLSelectElement>;\n\n\tchangeMonth(month: string) {\n\t\tthis.select.emit(new NgbDate(this.date.year, toInteger(month), 1));\n\t}\n\n\tchangeYear(year: string) {\n\t\tthis.select.emit(new NgbDate(toInteger(year), this.date.month, 1));\n\t}\n\n\tngAfterViewChecked() {\n\t\tif (this.date) {\n\t\t\tif (this.date.month !== this._month) {\n\t\t\t\tthis._month = this.date.month;\n\t\t\t\tthis.monthSelect.nativeElement.value = `${this._month}`;\n\t\t\t}\n\t\t\tif (this.date.year !== this._year) {\n\t\t\t\tthis._year = this.date.year;\n\t\t\t\tthis.yearSelect.nativeElement.value = `${this._year}`;\n\t\t\t}\n\t\t}\n\t}\n}\n","import {\n\tChangeDetectionStrategy,\n\tComponent,\n\tEventEmitter,\n\tinject,\n\tInput,\n\tOutput,\n\tViewEncapsulation,\n} from '@angular/core';\nimport { MonthViewModel, NavigationEvent } from './datepicker-view-model';\nimport { NgbDate } from './ngb-date';\nimport { NgbDatepickerI18n } from './datepicker-i18n';\nimport { NgbDatepickerNavigationSelect } from './datepicker-navigation-select';\n\n@Component({\n\tselector: 'ngb-datepicker-navigation',\n\timports: [NgbDatepickerNavigationSelect],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tencapsulation: ViewEncapsulation.None,\n\tstyleUrl: './datepicker-navigation.scss',\n\ttemplate: `\n\t\t<div class=\"ngb-dp-arrow ngb-dp-arrow-prev\">\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"btn btn-link ngb-dp-arrow-btn\"\n\t\t\t\t(click)=\"onClickPrev($event)\"\n\t\t\t\t[disabled]=\"prevDisabled\"\n\t\t\t\ti18n-aria-label=\"@@ngb.datepicker.previous-month\"\n\t\t\t\taria-label=\"Previous month\"\n\t\t\t\ti18n-title=\"@@ngb.datepicker.previous-month\"\n\t\t\t\ttitle=\"Previous month\"\n\t\t\t>\n\t\t\t\t<span class=\"ngb-dp-navigation-chevron\"></span>\n\t\t\t</button>\n\t\t</div>\n\t\t@if (showSelect) {\n\t\t\t<ngb-datepicker-navigation-select\n\t\t\t\tclass=\"ngb-dp-navigation-select\"\n\t\t\t\t[date]=\"date\"\n\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t[months]=\"selectBoxes.months\"\n\t\t\t\t[years]=\"selectBoxes.years\"\n\t\t\t\t(select)=\"select.emit($event)\"\n\t\t\t/>\n\t\t}\n\n\t\t@if (!showSelect) {\n\t\t\t@for (month of months; track idMonth(month); let i = $index) {\n\t\t\t\t@if (i > 0) {\n\t\t\t\t\t<div class=\"ngb-dp-arrow\"></div>\n\t\t\t\t}\n\t\t\t\t<div class=\"ngb-dp-month-name\">\n\t\t\t\t\t{{ i18n.getMonthLabel(month.firstDate) }}\n\t\t\t\t</div>\n\t\t\t\t@if (i !== months.length - 1) {\n\t\t\t\t\t<div class=\"ngb-dp-arrow\"></div>\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t<div class=\"visually-hidden\" aria-live=\"polite\">\n\t\t\t@for (month of months; track idMonth(month)) {\n\t\t\t\t<span>{{ i18n.getMonthLabel(month.firstDate) }}</span>\n\t\t\t}\n\t\t</div>\n\n\t\t<div class=\"ngb-dp-arrow ngb-dp-arrow-next\">\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"btn btn-link ngb-dp-arrow-btn\"\n\t\t\t\t(click)=\"onClickNext($event)\"\n\t\t\t\t[disabled]=\"nextDisabled\"\n\t\t\t\ti18n-aria-label=\"@@ngb.datepicker.next-month\"\n\t\t\t\taria-label=\"Next month\"\n\t\t\t\ti18n-title=\"@@ngb.datepicker.next-month\"\n\t\t\t\ttitle=\"Next month\"\n\t\t\t>\n\t\t\t\t<span class=\"ngb-dp-navigation-chevron\"></span>\n\t\t\t</button>\n\t\t</div>\n\t`,\n})\nexport class NgbDatepickerNavigation {\n\tnavigation = NavigationEvent;\n\n\ti18n = inject(NgbDatepickerI18n);\n\n\t@Input() date: NgbDate;\n\t@Input() disabled: boolean;\n\t@Input() months: MonthViewModel[] = [];\n\t@Input() showSelect: boolean;\n\t@Input() prevDisabled: boolean;\n\t@Input() nextDisabled: boolean;\n\t@Input() selectBoxes: { years: number[]; months: number[] };\n\n\t@Output() navigate = new EventEmitter<NavigationEvent>();\n\t@Output() select = new EventEmitter<NgbDate>();\n\n\tonClickPrev(event: MouseEvent) {\n\t\t(event.currentTarget as HTMLElement).focus();\n\t\tthis.navigate.emit(this.navigation.PREV);\n\t}\n\n\tonClickNext(event: MouseEvent) {\n\t\t(event.currentTarget as HTMLElement).focus();\n\t\tthis.navigate.emit(this.navigation.NEXT);\n\t}\n\n\tidMonth(month: MonthViewModel) {\n\t\treturn month;\n\t}\n}\n","import { fromEvent, merge } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport {\n\tafterNextRender,\n\tAfterViewInit,\n\tChangeDetectionStrategy,\n\tChangeDetectorRef,\n\tComponent,\n\tContentChild,\n\tDestroyRef,\n\tDirective,\n\tElementRef,\n\tEventEmitter,\n\tforwardRef,\n\tinject,\n\tInjector,\n\tInput,\n\tNgZone,\n\tOnChanges,\n\tOnInit,\n\tOutput,\n\tSimpleChanges,\n\tTemplateRef,\n\tViewChild,\n\tViewEncapsulation,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { NgbCalendar } from './ngb-calendar';\nimpo