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R,EAASQ,SAAQH,KAAUL,EAASQ,OAAS,EACrDlC,EAAU0B,EAAS1B,WAAU+B,KAAUL,EAAS1B,SAAW,EAC3DmC,EAAUT,EAASS,WAAUJ,KAAUL,EAASS,SAAW,EAE3DmB,ECnCS,SAASC,EAAU9B,EAAWkB,IAC3ChB,OAAa,EAAGC,WAChB,IAAIgB,KAASb,KAAUY,GACvB,SAAOL,KAAUb,GAAYmB,EAC/B,CD+B0BW,CAAUpE,EAAM6C,EAAiB,GAARF,GAE7C0B,KAAkBC,KAAQH,EAAmBvD,EAAe,EAARkC,GAIpDyB,EAAyB,KADVvB,EAAyB,IADzBnC,EAAkB,GAARkC,IAI7B,OADgB,IAAIhF,KAAKsG,EAAgBd,UAAYgB,EAEvD,yEE5Ce,SAASD,EAAQhC,EAAWkB,IACzChB,OAAa,EAAGC,WAChB,IAAIgB,KAASb,KAAUY,GACvB,SAAOH,KAAQf,GAAYmB,EAC7B","names":["InfoPopoverComponent","constructor","this","static","selectors","i0","createCustomInputControlValueAccessor","extendedInputComponent","provide","NG_VALUE_ACCESSOR","useExisting","forwardRef","multi","DateInputComponent","localeService","bsDatepickerConfig","adaptivePosition","showWeekNumbers","containerClass","dateInputFormat","isAnimated","defineLocale","esLocale","use","ngOnChanges","changes","maxDate","currentValue","Date","minDate","ngOnInit","dateControl","UntypedFormControl","initializeWithValue","initialValue","initializeDateControlValue","placeholder","valueToSet","Array","isArray","length","writeValue","updateValueAndValidity","value","rangeStartDate","rangeEndDate","setValue","emitEvent","onUserKeyDown","keyEvent","input","target","key","test","preventDefault","onUserType","inputEvent","day","month","year","split","date","parse","isValid","registerOnChange","fn","valueChanges","subscribe","range","endDate","sub","add","removeTime","days","minutes","endDateName","startDateName","registerOnTouched","markAsTouched","setDisabledState","isDisabled","disable","onlySelf","enable","id","label","join","toLowerCase","dateString","toISOString","onChangeStartDate","updateControlValue","onChangeEndDate","_angular_core__WEBPACK_IMPORTED_MODULE_0__","_typeof","obj","Symbol","iterator","prototype","dirtyDate","duration","requiredArgs","arguments","NaN","years","toInteger","months","weeks","hours","seconds","toDate","dateWithMonths","addMonths","dateWithDays","addDays","msToAdd","getTime","dirtyAmount","amount","isNaN","setDate","getDate","dayOfMonth","endOfDesiredMonth","setMonth","getMonth","setFullYear","getFullYear","dateWithoutMonths","subMonths","dateWithoutDays","subDays","mstoSub"],"sourceRoot":"webpack:///","sources":["./src/shared/Components/InfoPopover/info-popover.component.ts","./src/shared/Components/InfoPopover/info-popover.component.html","./src/shared/Components/form-input.component.ts","./src/shared/FormShared/Components/DateInput/date-input.component.html","./src/shared/FormShared/Components/DateInput/date-input.component.ts","./node_modules/date-fns/esm/add/index.js","./node_modules/date-fns/esm/addDays/index.js","./node_modules/date-fns/esm/addMonths/index.js","./node_modules/date-fns/esm/sub/index.js","./node_modules/date-fns/esm/subMonths/index.js","./node_modules/date-fns/esm/subDays/index.js"],"sourcesContent":["import { Component, Input, TemplateRef } from \"@angular/core\";\n\n@Component({\n selector: \"app-info-popover\",\n templateUrl: \"./info-popover.component.html\",\n styleUrls: [\"./info-popover.component.scss\"],\n})\nexport class InfoPopoverComponent {\n @Input() public breakLine = true;\n @Input() public content: string | TemplateRef;\n}\n","\n","/* eslint-disable @typescript-eslint/no-empty-function */\nimport { Component, forwardRef } from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from \"@angular/forms\";\nexport const createCustomInputControlValueAccessor = (extendedInputComponent: unknown): any => {\n return {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => extendedInputComponent),\n multi: true,\n };\n};\n\n@Component({\n template: \"\",\n})\nexport class FormInputComponent implements ControlValueAccessor {\n protected _value: T;\n public disabled = false;\n // Placeholders for the callbacks which are later provided\n // by the Control Value Accessor\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected onChangeCallback = (value: T): void => {};\n protected onTouchedCallback = (): void => {};\n\n public get value(): T {\n return this._value;\n }\n\n public set value(v: T) {\n if (this._value !== v) {\n this._value = v;\n this.onChangeCallback(v);\n }\n }\n\n // implements ControlValueAccessor interface\n public writeValue(value: T): void {\n this.value = value;\n }\n\n // implements ControlValueAccessor interface - not used, used for touch input\n public registerOnTouched(fn: () => void): void {\n this.onTouchedCallback = fn;\n }\n\n // implements ControlValueAccessor interface\n public registerOnChange(fn: (value: T) => void): void {\n this.onChangeCallback = fn;\n }\n\n public setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n // disable other components here\n }\n}\n","
\n \n\n \n \n \n
\n\n\n \n\n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n
\n","import { Component, Input, OnChanges, OnInit, SimpleChanges, TemplateRef } from \"@angular/core\";\nimport { UntypedFormControl, ControlValueAccessor } from \"@angular/forms\";\nimport { add, isValid, parse, sub } from \"date-fns\";\nimport { defineLocale } from \"ngx-bootstrap/chronos\";\nimport { BsLocaleService, BsDatepickerConfig } from \"ngx-bootstrap/datepicker\";\nimport { esLocale } from \"ngx-bootstrap/locale\";\n\nimport { createCustomInputControlValueAccessor } from \"@shared/Components/form-input.component\";\n\n@Component({\n selector: \"app-date-input\",\n templateUrl: \"./date-input.component.html\",\n providers: [createCustomInputControlValueAccessor(DateInputComponent)],\n})\nexport class DateInputComponent implements OnInit, OnChanges, ControlValueAccessor {\n public dateControl: UntypedFormControl;\n\n // Used for range inputs in mobile\n public rangeStartDate: Date;\n public rangeEndDate: Date;\n\n @Input() public label: string = \"Fecha\";\n @Input() public placeholder: string = \"Seleccione una fecha\";\n @Input() public range: boolean = false;\n @Input() public maxDate: Date | \"now\";\n @Input() public minDate: Date | \"now\";\n @Input() public info?: string | TemplateRef;\n\n @Input() public startDateName = \"fechaDesde\";\n @Input() public endDateName = \"fechaHasta\";\n\n @Input() public requiredMark: boolean;\n @Input() public showColonAfterLabel: boolean = true;\n\n @Input() public initializeWithValue: boolean = false;\n @Input() public initialValue: Date | [Date, Date] | string;\n\n public bsConfig: Partial = {\n adaptivePosition: true,\n showWeekNumbers: false,\n containerClass: \"theme-dark-blue\",\n dateInputFormat: \"DD MMMM YYYY\",\n isAnimated: true,\n };\n\n constructor(private localeService: BsLocaleService, private bsDatepickerConfig: BsDatepickerConfig) {\n defineLocale(\"es\", esLocale);\n this.localeService.use(\"es\");\n this.bsDatepickerConfig.dateInputFormat = \"DD MMMM YYYY\";\n }\n public ngOnChanges(changes: SimpleChanges): void {\n const maxDate = changes.maxDate?.currentValue;\n if (maxDate && maxDate === \"now\") {\n this.maxDate = new Date();\n }\n if (changes.minDate) {\n const minDate = changes.minDate.currentValue;\n if (minDate === \"now\") {\n this.minDate = new Date();\n }\n }\n }\n\n public ngOnInit(): void {\n this.dateControl = new UntypedFormControl();\n if (this.initializeWithValue && this.initialValue) {\n this.initializeDateControlValue();\n }\n if (!this.placeholder) {\n this.placeholder = \"Seleccione una fecha\";\n }\n }\n\n private initializeDateControlValue(): void {\n let valueToSet = this.initialValue;\n\n // Check if initialValue is a string and needs parsing\n if (typeof this.initialValue === \"string\") {\n valueToSet = new Date(this.initialValue);\n }\n // Alternatively, handle a range of dates\n else if (Array.isArray(this.initialValue) && this.initialValue.length === 2) {\n const start = new Date(this.initialValue[0]);\n const end = new Date(this.initialValue[1]);\n valueToSet = [start, end];\n }\n\n this.writeValue(valueToSet);\n this.dateControl.updateValueAndValidity();\n }\n\n public writeValue(value: Date | [Date, Date] | string): void {\n if (value && Array.isArray(value) && value.length === 2) {\n this.rangeStartDate = new Date(value[0]);\n this.rangeEndDate = new Date(value[1]);\n this.dateControl.setValue([this.rangeStartDate, this.rangeEndDate], { emitEvent: true });\n }\n if (value && value instanceof Date) {\n this.dateControl.setValue(value);\n }\n }\n\n public onUserKeyDown(keyEvent: KeyboardEvent): void {\n const input = keyEvent.target as HTMLInputElement;\n const value = input.value;\n const key = keyEvent.key;\n\n // Only allow numeric characters and backspace\n if (!/^\\d$/.test(key) && key !== \"Backspace\") {\n keyEvent.preventDefault();\n return;\n }\n\n // Automatically insert \"/\" after the second and fourth characters\n if ((value.length === 2 || value.length === 5) && key !== \"Backspace\") {\n input.value += \"/\";\n }\n }\n\n public onUserType(inputEvent: InputEvent): void {\n const dateFormat = \"dd/MM/yyyy\";\n const value = (inputEvent as any).target.value;\n const [day, month, year] = value.split(\"/\");\n const date = parse(`${day}/${month}/${year}`, dateFormat, new Date());\n const isValidDate = day?.length && month?.length && year?.length === 4 && isValid(date);\n\n if (isValidDate) {\n this.dateControl.setValue(date);\n }\n }\n\n public registerOnChange(fn: (value: any) => void): void {\n this.dateControl.valueChanges.subscribe((value) => {\n if (this.range && Array.isArray(value)) {\n if (value[0] && value[1]) {\n const endDate = sub(add(this.removeTime(value[1]), { days: 1 }), { minutes: 1 });\n fn({\n [this.endDateName]: endDate,\n [this.startDateName]: this.removeTime(value[0]),\n });\n }\n } else {\n fn(this.removeTime(value));\n }\n });\n }\n\n public registerOnTouched(fn: () => void): void {\n this.dateControl.markAsTouched();\n fn();\n }\n\n public setDisabledState?(isDisabled: boolean): void {\n isDisabled\n ? this.dateControl.disable({ emitEvent: false, onlySelf: true })\n : this.dateControl.enable({ emitEvent: false, onlySelf: true });\n }\n\n public get id(): string {\n return this.label.split(\" \").join(\"-\").toLowerCase();\n }\n\n private removeTime(date: Date) {\n if (!date) {\n return null;\n }\n\n const dateString = date.toISOString().split(\"T\")[0];\n return parse(dateString, \"yyyy-MM-dd\", new Date());\n }\n\n public onChangeStartDate(date: Date): void {\n this.rangeStartDate = date;\n this.updateControlValue();\n }\n\n public onChangeEndDate(date: Date): void {\n this.rangeEndDate = date;\n this.updateControlValue();\n }\n\n private updateControlValue(): void {\n if (this.rangeStartDate && this.rangeEndDate) {\n this.dateControl.setValue([this.rangeStartDate, this.rangeEndDate]);\n }\n }\n}\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport addDays from \"../addDays/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n\n/**\n * @name add\n * @category Common Helpers\n * @summary Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.\n *\n * @description\n * Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n *\n * | Key | Description |\n * |----------------|------------------------------------|\n * | years | Amount of years to be added |\n * | months | Amount of months to be added |\n * | weeks | Amount of weeks to be added |\n * | days | Amount of days to be added |\n * | hours | Amount of hours to be added |\n * | minutes | Amount of minutes to be added |\n * | seconds | Amount of seconds to be added |\n *\n * All values default to 0\n *\n * @returns {Date} the new date with the seconds added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add the following duration to 1 September 2014, 10:19:50\n * const result = add(new Date(2014, 8, 1, 10, 19, 50), {\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30,\n * })\n * //=> Thu Jun 15 2017 15:29:20\n */\nexport default function add(dirtyDate, duration) {\n requiredArgs(2, arguments);\n if (!duration || _typeof(duration) !== 'object') return new Date(NaN);\n var years = duration.years ? toInteger(duration.years) : 0;\n var months = duration.months ? toInteger(duration.months) : 0;\n var weeks = duration.weeks ? toInteger(duration.weeks) : 0;\n var days = duration.days ? toInteger(duration.days) : 0;\n var hours = duration.hours ? toInteger(duration.hours) : 0;\n var minutes = duration.minutes ? toInteger(duration.minutes) : 0;\n var seconds = duration.seconds ? toInteger(duration.seconds) : 0; // Add years and months\n\n var date = toDate(dirtyDate);\n var dateWithMonths = months || years ? addMonths(date, months + years * 12) : date; // Add weeks and days\n\n var dateWithDays = days || weeks ? addDays(dateWithMonths, days + weeks * 7) : dateWithMonths; // Add days, hours, minutes and seconds\n\n var minutesToAdd = minutes + hours * 60;\n var secondsToAdd = seconds + minutesToAdd * 60;\n var msToAdd = secondsToAdd * 1000;\n var finalDate = new Date(dateWithDays.getTime() + msToAdd);\n return finalDate;\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addDays\n * @category Day Helpers\n * @summary Add the specified number of days to the given date.\n *\n * @description\n * Add the specified number of days to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} - the new date with the days added\n * @throws {TypeError} - 2 arguments required\n *\n * @example\n * // Add 10 days to 1 September 2014:\n * const result = addDays(new Date(2014, 8, 1), 10)\n * //=> Thu Sep 11 2014 00:00:00\n */\n\nexport default function addDays(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n\n if (!amount) {\n // If 0 days, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n\n date.setDate(date.getDate() + amount);\n return date;\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addMonths\n * @category Month Helpers\n * @summary Add the specified number of months to the given date.\n *\n * @description\n * Add the specified number of months to the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the months added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 5 months to 1 September 2014:\n * const result = addMonths(new Date(2014, 8, 1), 5)\n * //=> Sun Feb 01 2015 00:00:00\n */\n\nexport default function addMonths(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var amount = toInteger(dirtyAmount);\n\n if (isNaN(amount)) {\n return new Date(NaN);\n }\n\n if (!amount) {\n // If 0 months, no-op to avoid changing times in the hour before end of DST\n return date;\n }\n\n var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for\n // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and\n // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we\n // want except that dates will wrap around the end of a month, meaning that\n // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So\n // we'll default to the end of the desired month by adding 1 to the desired\n // month and using a date of 0 to back up one day to the end of the desired\n // month.\n\n var endOfDesiredMonth = new Date(date.getTime());\n endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);\n var daysInMonth = endOfDesiredMonth.getDate();\n\n if (dayOfMonth >= daysInMonth) {\n // If we're already at the end of the month, then this is the correct date\n // and we're done.\n return endOfDesiredMonth;\n } else {\n // Otherwise, we now know that setting the original day-of-month value won't\n // cause an overflow, so set the desired day-of-month. Note that we can't\n // just set the date of `endOfDesiredMonth` because that object may have had\n // its time changed in the unusual case where where a DST transition was on\n // the last day of the month and its local time was in the hour skipped or\n // repeated next to a DST transition. So we use `date` instead which is\n // guaranteed to still have the original time.\n date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);\n return date;\n }\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport subDays from \"../subDays/index.js\";\nimport subMonths from \"../subMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name sub\n * @category Common Helpers\n * @summary Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.\n *\n * @description\n * Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be subtracted\n *\n * | Key | Description |\n * |---------|------------------------------------|\n * | years | Amount of years to be subtracted |\n * | months | Amount of months to be subtracted |\n * | weeks | Amount of weeks to be subtracted |\n * | days | Amount of days to be subtracted |\n * | hours | Amount of hours to be subtracted |\n * | minutes | Amount of minutes to be subtracted |\n * | seconds | Amount of seconds to be subtracted |\n *\n * All values default to 0\n *\n * @returns {Date} the new date with the seconds subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract the following duration from 15 June 2017 15:29:20\n * const result = sub(new Date(2017, 5, 15, 15, 29, 20), {\n * years: 2,\n * months: 9,\n * weeks: 1,\n * days: 7,\n * hours: 5,\n * minutes: 9,\n * seconds: 30\n * })\n * //=> Mon Sep 1 2014 10:19:50\n */\n\nexport default function sub(date, duration) {\n requiredArgs(2, arguments);\n if (!duration || _typeof(duration) !== 'object') return new Date(NaN);\n var years = duration.years ? toInteger(duration.years) : 0;\n var months = duration.months ? toInteger(duration.months) : 0;\n var weeks = duration.weeks ? toInteger(duration.weeks) : 0;\n var days = duration.days ? toInteger(duration.days) : 0;\n var hours = duration.hours ? toInteger(duration.hours) : 0;\n var minutes = duration.minutes ? toInteger(duration.minutes) : 0;\n var seconds = duration.seconds ? toInteger(duration.seconds) : 0; // Subtract years and months\n\n var dateWithoutMonths = subMonths(date, months + years * 12); // Subtract weeks and days\n\n var dateWithoutDays = subDays(dateWithoutMonths, days + weeks * 7); // Subtract hours, minutes and seconds\n\n var minutestoSub = minutes + hours * 60;\n var secondstoSub = seconds + minutestoSub * 60;\n var mstoSub = secondstoSub * 1000;\n var finalDate = new Date(dateWithoutDays.getTime() - mstoSub);\n return finalDate;\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name subMonths\n * @category Month Helpers\n * @summary Subtract the specified number of months from the given date.\n *\n * @description\n * Subtract the specified number of months from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the months subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 5 months from 1 February 2015:\n * const result = subMonths(new Date(2015, 1, 1), 5)\n * //=> Mon Sep 01 2014 00:00:00\n */\n\nexport default function subMonths(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMonths(dirtyDate, -amount);\n}","import addDays from \"../addDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\n/**\n * @name subDays\n * @category Day Helpers\n * @summary Subtract the specified number of days from the given date.\n *\n * @description\n * Subtract the specified number of days from the given date.\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the days subtracted\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Subtract 10 days from 1 September 2014:\n * const result = subDays(new Date(2014, 8, 1), 10)\n * //=> Fri Aug 22 2014 00:00:00\n */\n\nexport default function subDays(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addDays(dirtyDate, -amount);\n}"],"x_google_ignoreList":[5,6,7,8,9,10]}