@arsedizioni/ars-utils 22.5.49 → 22.5.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +15 -15
  2. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +42 -42
  3. package/fesm2022/arsedizioni-ars-utils-core.date.mjs +178 -8
  4. package/fesm2022/arsedizioni-ars-utils-core.date.mjs.map +1 -1
  5. package/fesm2022/arsedizioni-ars-utils-core.markdown.mjs +3 -3
  6. package/fesm2022/arsedizioni-ars-utils-core.mjs +48 -48
  7. package/fesm2022/arsedizioni-ars-utils-core.validators.mjs +42 -42
  8. package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +15 -15
  9. package/fesm2022/arsedizioni-ars-utils-support.common.mjs +9 -9
  10. package/fesm2022/arsedizioni-ars-utils-ui.controls.date.mjs +6 -6
  11. package/fesm2022/arsedizioni-ars-utils-ui.controls.mjs +9 -9
  12. package/fesm2022/arsedizioni-ars-utils-ui.controls.tree.mjs +3 -3
  13. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs +18 -18
  14. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs +12 -12
  15. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs +9 -9
  16. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs +15 -15
  17. package/fesm2022/arsedizioni-ars-utils-ui.files.mjs +12 -12
  18. package/fesm2022/arsedizioni-ars-utils-ui.filters.mjs +3 -3
  19. package/fesm2022/arsedizioni-ars-utils-ui.help.mjs +9 -9
  20. package/fesm2022/arsedizioni-ars-utils-ui.mjs +61 -61
  21. package/fesm2022/arsedizioni-ars-utils-ui.navigation.mjs +3 -3
  22. package/fesm2022/arsedizioni-ars-utils-ui.notifications.mjs +6 -6
  23. package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs +6 -6
  24. package/fesm2022/arsedizioni-ars-utils-ui.paginator.mjs +3 -3
  25. package/fesm2022/arsedizioni-ars-utils-ui.shell.mjs +9 -9
  26. package/fesm2022/arsedizioni-ars-utils-ui.tinymce.mjs +9 -9
  27. package/package.json +1 -1
  28. package/types/arsedizioni-ars-utils-clipper.ui.d.ts +1 -1
  29. package/types/arsedizioni-ars-utils-core.date.d.ts +58 -1
  30. package/types/arsedizioni-ars-utils-ui.controls.d.ts +1 -1
  31. package/types/arsedizioni-ars-utils-ui.navigation.d.ts +1 -1
@@ -3,7 +3,8 @@ import { inject, Injectable, makeEnvironmentProviders, InjectionToken } from '@a
3
3
  import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
4
4
  import { TZDate } from '@date-fns/tz';
5
5
  import { format, getYear, getMonth, getDate, getDay, getDaysInMonth, parseISO, parse, addYears, addMonths, addDays, isDate, isValid, addSeconds } from 'date-fns';
6
- import { HTTP_INTERCEPTORS } from '@angular/common/http';
6
+ import { HTTP_INTERCEPTORS, HttpResponse } from '@angular/common/http';
7
+ import { map } from 'rxjs';
7
8
 
8
9
  /**
9
10
  * Creates an array of the given length, filling each slot with the result of `valueFunction`.
@@ -397,10 +398,10 @@ class DateFnsAdapter extends DateAdapter {
397
398
  }
398
399
  return null;
399
400
  }
400
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: DateFnsAdapter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
401
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: DateFnsAdapter }); }
401
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: DateFnsAdapter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
402
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: DateFnsAdapter }); }
402
403
  }
403
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: DateFnsAdapter, decorators: [{
404
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: DateFnsAdapter, decorators: [{
404
405
  type: Injectable
405
406
  }], ctorParameters: () => [] });
406
407
  /**
@@ -438,6 +439,15 @@ const ARS_TIME_ZONE = new InjectionToken('ARS_TIME_ZONE', {
438
439
  });
439
440
  /** Naive local datetime pattern (no timezone designator): the server reads it as DateTimeKind.Unspecified. */
440
441
  const NAIVE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss";
442
+ /**
443
+ * What a string has to look like to be read back as a date: an ISO 8601 calendar date, optionally
444
+ * followed by a time and by `Z` or an offset. Anchored at both ends, so a string that merely
445
+ * *contains* a date ("Circolare del 2026-09-07") is left alone.
446
+ */
447
+ const ISO_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,7}))?)?(Z|[+-]\d{2}:?\d{2})?)?$/;
448
+ /** Shortest string that can be a date (`2026-09-07`), and the longest one worth testing. */
449
+ const MIN_ISO_LENGTH = 10;
450
+ const MAX_ISO_LENGTH = 33;
441
451
  /**
442
452
  * Returns `true` for payloads that must be forwarded untouched
443
453
  * (binary or already-encoded bodies).
@@ -550,10 +560,10 @@ class ArsLocalDateInterceptor {
550
560
  intercept(req, next) {
551
561
  return next.handle(localizeRequest(req, this.timeZone));
552
562
  }
553
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ArsLocalDateInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
554
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ArsLocalDateInterceptor }); }
563
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ArsLocalDateInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
564
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ArsLocalDateInterceptor }); }
555
565
  }
556
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ArsLocalDateInterceptor, decorators: [{
566
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ArsLocalDateInterceptor, decorators: [{
557
567
  type: Injectable
558
568
  }] });
559
569
  /**
@@ -579,6 +589,166 @@ function provideArsLocalDates(timeZone = DEFAULT_TIME_ZONE) {
579
589
  { provide: HTTP_INTERCEPTORS, useClass: ArsLocalDateInterceptor, multi: true },
580
590
  ]);
581
591
  }
592
+ /**
593
+ * Reads an ISO string back into a `Date`, or returns `undefined` when it is not one.
594
+ *
595
+ * The mirror image of {@link normalizeDates}. A value that carries `Z` or an offset names an
596
+ * instant and is parsed as it stands; a naive one is a wall-clock value in `timeZone` — that is
597
+ * what the request side wrote, and what `System.Text.Json` emits for a `DateTime` with
598
+ * `Kind = Unspecified` — so it is rebuilt component by component through {@link TZDate}.
599
+ *
600
+ * Reading a naive value with `new Date(s)` instead would be right for a datetime and wrong for a
601
+ * bare date: the ECMAScript spec reads `2026-09-07` as UTC midnight and `2026-09-07T00:00:00` as
602
+ * local midnight. That difference is the off-by-one-day this file exists to prevent, arriving from
603
+ * the other direction.
604
+ *
605
+ * @param value - The string to read.
606
+ * @param timeZone - IANA timezone the naive values are expressed in.
607
+ * @returns The date, or `undefined` when the string is not an ISO date.
608
+ */
609
+ function parseLocalDate(value, timeZone) {
610
+ const m = ISO_DATE_PATTERN.exec(value);
611
+ if (!m)
612
+ return undefined;
613
+ const [, year, month, day, hours, minutes, seconds, fraction, zone] = m;
614
+ const date = zone
615
+ ? new Date(value)
616
+ : new Date(new TZDate(+year, +month - 1, +day, hours ? +hours : 0, minutes ? +minutes : 0, seconds ? +seconds : 0, fraction ? +fraction.slice(0, 3).padEnd(3, '0') : 0, timeZone).getTime());
617
+ if (isNaN(date.getTime()))
618
+ return undefined;
619
+ // "2026-02-31" matches the pattern and rolls over to March: a day that does not exist was not a
620
+ // date to begin with, and the original string says more than a wrong Date would.
621
+ if (!zone) {
622
+ const check = new TZDate(date.getTime(), timeZone);
623
+ if (check.getFullYear() !== +year || check.getMonth() !== +month - 1 || check.getDate() !== +day) {
624
+ return undefined;
625
+ }
626
+ }
627
+ return date;
628
+ }
629
+ /**
630
+ * Recursively replaces every ISO date string found in `value` with a `Date`, returning a NEW
631
+ * structure, exactly as {@link normalizeDates} does on the way out.
632
+ *
633
+ * Only whole strings are considered, and only inside an object or an array: a top-level string
634
+ * body — a rendered document, a plain-text answer — is never touched.
635
+ *
636
+ * @param value - The value to revive (object, array or primitive).
637
+ * @param timeZone - IANA timezone the naive values are expressed in.
638
+ * @param seen - Guard against circular references.
639
+ * @returns The revived value.
640
+ */
641
+ function reviveDates(value, timeZone, seen) {
642
+ if (typeof value === 'string') {
643
+ if (value.length < MIN_ISO_LENGTH || value.length > MAX_ISO_LENGTH)
644
+ return value;
645
+ return parseLocalDate(value, timeZone) ?? value;
646
+ }
647
+ if (value === null || typeof value !== 'object')
648
+ return value;
649
+ if (value instanceof Date || isOpaqueBody(value))
650
+ return value;
651
+ // Circular reference: leave it as is rather than looping forever.
652
+ if (seen.has(value))
653
+ return value;
654
+ seen.add(value);
655
+ if (Array.isArray(value)) {
656
+ return value.map(item => reviveDates(item, timeZone, seen));
657
+ }
658
+ const source = value;
659
+ const result = {};
660
+ for (const key of Object.keys(source)) {
661
+ result[key] = reviveDates(source[key], timeZone, seen);
662
+ }
663
+ return result;
664
+ }
665
+ /**
666
+ * Rewrites a response body, if any, replacing ISO date strings with Dates.
667
+ * Shared by the functional and the class-based interceptor.
668
+ * @param event - The event coming back from the chain.
669
+ * @param timeZone - IANA timezone the naive values are expressed in.
670
+ * @returns The original event when there is nothing to convert, a clone otherwise.
671
+ */
672
+ function localizeResponse(event, timeZone) {
673
+ if (!(event instanceof HttpResponse))
674
+ return event;
675
+ const body = event.body;
676
+ if (body === null || typeof body !== 'object' || isOpaqueBody(body))
677
+ return event;
678
+ return event.clone({ body: reviveDates(body, timeZone, new WeakSet()) });
679
+ }
680
+ /**
681
+ * Functional interceptor that reads every ISO date string in a response body back into a `Date`.
682
+ *
683
+ * WHY: models declare `Date`, but `HttpClient` only runs `JSON.parse`, which has no notion of
684
+ * dates, so without this every one of those properties holds a `string` at runtime and the declared
685
+ * type is a promise nobody keeps. It goes unnoticed for a long time — Angular's `date` pipe accepts
686
+ * strings and {@link DateFnsAdapter.deserialize} parses them for the datepickers — until somebody
687
+ * calls a method of `Date` on one and gets a `TypeError`, or writes
688
+ * `x.someDate = new Date(x.someDate)` to work around it one call site at a time.
689
+ *
690
+ * Together with {@link arsLocalDateInterceptor} it closes the serialisation boundary: no call site
691
+ * has to convert anything, in either direction.
692
+ *
693
+ * NOT registered by {@link provideArsLocalDates}, on purpose: turning strings into Dates changes
694
+ * what an application already reading those fields receives, so it stays opt-in and each
695
+ * application decides when to take it. Register it explicitly, or use
696
+ * {@link provideArsLocalDateResponses}.
697
+ *
698
+ * @example
699
+ * provideHttpClient(withInterceptors([
700
+ * arsLocalDateInterceptor,
701
+ * arsLocalDateResponseInterceptor,
702
+ * ]));
703
+ */
704
+ const arsLocalDateResponseInterceptor = (req, next) => {
705
+ const timeZone = inject(ARS_TIME_ZONE);
706
+ return next(req).pipe(map(event => localizeResponse(event, timeZone)));
707
+ };
708
+ /**
709
+ * Class-based twin of {@link arsLocalDateResponseInterceptor}, for the same reason
710
+ * {@link ArsLocalDateInterceptor} exists: only a class can be contributed through
711
+ * `HTTP_INTERCEPTORS` by an `EnvironmentProviders`.
712
+ *
713
+ * REQUIRES `withInterceptorsFromDi()` in the application's `provideHttpClient()`.
714
+ */
715
+ class ArsLocalDateResponseInterceptor {
716
+ constructor() {
717
+ this.timeZone = inject(ARS_TIME_ZONE);
718
+ }
719
+ /**
720
+ * Revives the dates of the response before handing it to the caller.
721
+ * @param req - The outgoing request.
722
+ * @param next - The next handler in the chain.
723
+ */
724
+ intercept(req, next) {
725
+ return next.handle(req).pipe(map(event => localizeResponse(event, this.timeZone)));
726
+ }
727
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ArsLocalDateResponseInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
728
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ArsLocalDateResponseInterceptor }); }
729
+ }
730
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: ArsLocalDateResponseInterceptor, decorators: [{
731
+ type: Injectable
732
+ }] });
733
+ /**
734
+ * Standalone providers for date deserialisation coming back from the backend.
735
+ *
736
+ * Registers {@link ArsLocalDateResponseInterceptor}, the counterpart of
737
+ * {@link provideArsLocalDates}. Kept separate because it is the half that changes what existing
738
+ * code receives: an application whose models declare those fields as `string` has to be looked at
739
+ * before switching it on.
740
+ *
741
+ * IMPORTANT: the application MUST call `withInterceptorsFromDi()`, otherwise these providers have
742
+ * no effect at all (no error is raised).
743
+ *
744
+ * @param timeZone - IANA timezone name (default: `Europe/Rome`).
745
+ */
746
+ function provideArsLocalDateResponses(timeZone = DEFAULT_TIME_ZONE) {
747
+ return makeEnvironmentProviders([
748
+ { provide: ARS_TIME_ZONE, useValue: timeZone },
749
+ { provide: HTTP_INTERCEPTORS, useClass: ArsLocalDateResponseInterceptor, multi: true },
750
+ ]);
751
+ }
582
752
  /**
583
753
  * Formats a date as a date-only ISO string (`yyyy-MM-dd`) using its wall-clock
584
754
  * calendar day in the given timezone. Use it for query-string parameters and for
@@ -616,5 +786,5 @@ function toLocalDateTimeString(value, timeZone = DEFAULT_TIME_ZONE) {
616
786
  * Generated bundle index. Do not edit.
617
787
  */
618
788
 
619
- export { ARS_TIME_ZONE, ArsLocalDateInterceptor, DEFAULT_TIME_ZONE, DateFnsAdapter, MAT_DATE_FNS_FORMATS, arsLocalDateInterceptor, provideArsDateFns, provideArsLocalDates, toLocalDateOnlyString, toLocalDateTimeString };
789
+ export { ARS_TIME_ZONE, ArsLocalDateInterceptor, ArsLocalDateResponseInterceptor, DEFAULT_TIME_ZONE, DateFnsAdapter, MAT_DATE_FNS_FORMATS, arsLocalDateInterceptor, arsLocalDateResponseInterceptor, provideArsDateFns, provideArsLocalDateResponses, provideArsLocalDates, toLocalDateOnlyString, toLocalDateTimeString };
620
790
  //# sourceMappingURL=arsedizioni-ars-utils-core.date.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"arsedizioni-ars-utils-core.date.mjs","sources":["../../../projects/ars-utils/core.date/dateFnsAdapter.module.ts","../../../projects/ars-utils/core.date/dateInterceptor.ts","../../../projects/ars-utils/core.date/public_api.ts","../../../projects/ars-utils/core.date/arsedizioni-ars-utils-core.date.ts"],"sourcesContent":["import { EnvironmentProviders, inject, Injectable, makeEnvironmentProviders } from '@angular/core';\r\nimport { DateAdapter, MatDateFormats, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';\r\nimport { TZDate } from '@date-fns/tz';\r\nimport {\r\n Locale,\r\n getMonth,\r\n getYear,\r\n getDate,\r\n getDay,\r\n getDaysInMonth,\r\n addYears,\r\n addMonths,\r\n addDays,\r\n addSeconds,\r\n isValid,\r\n isDate,\r\n format,\r\n parseISO,\r\n parse,\r\n} from 'date-fns';\r\n\r\n\r\n/**\r\n * Creates an array of the given length, filling each slot with the result of `valueFunction`.\r\n * @param length - Number of elements to create.\r\n * @param valueFunction - Factory called with each index to produce the element value.\r\n * @returns Typed array of `length` elements.\r\n */\r\nfunction range<T>(length: number, valueFunction: (index: number) => T): T[] {\r\n const valuesArray = Array(length);\r\n for (let i = 0; i < length; i++) {\r\n valuesArray[i] = valueFunction(i);\r\n }\r\n return valuesArray;\r\n}\r\n\r\n// date-fns doesn't have a way to read/print month names or days of the week directly,\r\n// so we get them by formatting a date with a format that produces the desired month/day.\r\nconst MONTH_FORMATS = {\r\n long: 'LLLL',\r\n short: 'LLL',\r\n narrow: 'LLLLL',\r\n};\r\n\r\nconst DAY_OF_WEEK_FORMATS = {\r\n long: 'EEEE',\r\n short: 'EEE',\r\n narrow: 'EEEEE',\r\n};\r\n\r\nexport const MAT_DATE_FNS_FORMATS: MatDateFormats = {\r\n parse: {\r\n dateInput: 'P',\r\n timeInput: ['p', 'HH:mm', 'H:mm'],\r\n },\r\n display: {\r\n dateInput: 'P',\r\n monthYearLabel: 'LLL uuuu',\r\n dateA11yLabel: 'PP',\r\n monthYearA11yLabel: 'LLLL uuuu',\r\n timeInput: 'p',\r\n timeOptionLabel: 'p',\r\n },\r\n};\r\n\r\n\r\n/**\r\n * date-fns adapter that integrates Angular Material's date picker with the date-fns library,\r\n * applying `Europe/Rome` timezone for all parsed and created dates.\r\n */\r\n@Injectable()\r\nexport class DateFnsAdapter extends DateAdapter<Date, Locale> {\r\n constructor() {\r\n super();\r\n const matDateLocale = inject(MAT_DATE_LOCALE, { optional: true });\r\n if (matDateLocale && typeof matDateLocale === 'object') {\r\n this.setLocale(matDateLocale as Locale);\r\n }\r\n }\r\n\r\n /**\r\n * Wraps a date/instant into a Europe/Rome TZDate whose JSON serialisation emits a\r\n * naive local datetime string (\"yyyy-MM-dd'T'HH:mm:ss\") instead of a UTC instant,\r\n * so the wall-clock value the user entered is preserved end-to-end (no timezone shift).\r\n * @param value - The source Date or Unix timestamp in milliseconds.\r\n * @returns a Europe/Rome TZDate whose toJSON yields a naive local datetime string.\r\n */\r\n private static toLocal(value: Date | number): Date {\r\n const ms = typeof value === 'number' ? value : value.getTime();\r\n const t = new TZDate(ms, 'Europe/Rome');\r\n Object.defineProperty(t, 'toJSON', {\r\n value: () => format(t, \"yyyy-MM-dd'T'HH:mm:ss\"),\r\n enumerable: false,\r\n configurable: true,\r\n writable: true,\r\n });\r\n return t;\r\n }\r\n\r\n /**\r\n * Returns the year component of the given date.\r\n * @param date - The source date.\r\n */\r\n getYear(date: Date): number {\r\n return getYear(date);\r\n }\r\n\r\n /**\r\n * Returns the zero-based month index of the given date (0 = January).\r\n * @param date - The source date.\r\n */\r\n getMonth(date: Date): number {\r\n return getMonth(date);\r\n }\r\n\r\n /**\r\n * Returns the day-of-month of the given date (1-based).\r\n * @param date - The source date.\r\n */\r\n getDate(date: Date): number {\r\n return getDate(date);\r\n }\r\n\r\n /**\r\n * Returns the day-of-week of the given date (0 = Sunday).\r\n * @param date - The source date.\r\n */\r\n getDayOfWeek(date: Date): number {\r\n return getDay(date);\r\n }\r\n\r\n /**\r\n * Returns an array of 12 month name strings formatted for the active locale.\r\n * @param style - One of `'long'`, `'short'`, or `'narrow'`.\r\n */\r\n getMonthNames(style: 'long' | 'short' | 'narrow'): string[] {\r\n const pattern = MONTH_FORMATS[style];\r\n return range(12, i => this.format(new Date(2017, i, 1), pattern));\r\n }\r\n\r\n /**\r\n * Returns an array of 31 day-of-month label strings formatted using `Intl.DateTimeFormat`\r\n * when available, falling back to plain numeric strings.\r\n */\r\n getDateNames(): string[] {\r\n const dtf =\r\n typeof Intl !== 'undefined'\r\n ? new Intl.DateTimeFormat(this.locale?.code, {\r\n day: 'numeric',\r\n timeZone: 'utc',\r\n })\r\n : null;\r\n\r\n return range(31, i => {\r\n if (dtf) {\r\n // date-fns doesn't appear to support this functionality.\r\n // Fall back to `Intl` on supported browsers.\r\n const date = new Date();\r\n date.setUTCFullYear(2017, 0, i + 1);\r\n date.setUTCHours(0, 0, 0, 0);\r\n return dtf.format(date).replace(/[\\u200e\\u200f]/g, '');\r\n }\r\n\r\n return String(i + 1);\r\n });\r\n }\r\n\r\n /**\r\n * Returns an array of 7 day-of-week name strings formatted for the active locale.\r\n * @param style - One of `'long'`, `'short'`, or `'narrow'`.\r\n */\r\n getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {\r\n const pattern = DAY_OF_WEEK_FORMATS[style];\r\n return range(7, i => this.format(new Date(2017, 0, i + 1), pattern));\r\n }\r\n\r\n /**\r\n * Returns the four-digit year string for the given date.\r\n * @param date - The source date.\r\n */\r\n getYearName(date: Date): string {\r\n return this.format(date, 'y');\r\n }\r\n\r\n /**\r\n * Returns the first day of the week for the active locale (0 = Sunday, 1 = Monday, …).\r\n */\r\n getFirstDayOfWeek(): number {\r\n return this.locale?.options?.weekStartsOn ?? 0;\r\n }\r\n\r\n /**\r\n * Returns the number of days in the month of the given date.\r\n * @param date - The source date.\r\n */\r\n getNumDaysInMonth(date: Date): number {\r\n return getDaysInMonth(date);\r\n }\r\n\r\n /**\r\n * Creates an independent copy of the given date.\r\n * @param date - The date to clone.\r\n */\r\n clone(date: Date): Date {\r\n return DateFnsAdapter.toLocal(date.getTime());\r\n }\r\n\r\n /**\r\n * Creates a `Date` in the `Europe/Rome` timezone for the given year, month, and day.\r\n * Throws an `Error` when any component is out of range.\r\n * @param year - Full four-digit year.\r\n * @param month - Zero-based month index (0 = January, 11 = December).\r\n * @param date - Day-of-month (1-based).\r\n */\r\n createDate(year: number, month: number, date: number): Date {\r\n if (month < 0 || month > 11) {\r\n throw Error(`Invalid month index \"${month}\". Month index has to be between 0 and 11.`);\r\n }\r\n\r\n if (date < 1) {\r\n throw Error(`Invalid date \"${date}\". Date has to be greater than 0.`);\r\n }\r\n\r\n if (month < 0 || month > 11) {\r\n throw Error(`Invalid month index \"${month}\". Month index has to be between 0 and 11.`);\r\n }\r\n\r\n const result = new TZDate(year, month, date, 0, 0, 0, 0, 'Europe/Rome');\r\n\r\n if (result.getMonth() !== month) {\r\n throw Error(`Invalid date \"${date}\" for month with index \"${month}\".`);\r\n }\r\n\r\n return DateFnsAdapter.toLocal(result);\r\n }\r\n\r\n /**\r\n * Returns the current date and time in the Europe/Rome timezone, preserving the wall-clock value.\r\n */\r\n today(): Date {\r\n return DateFnsAdapter.toLocal(new Date());\r\n }\r\n\r\n /**\r\n * Parses a value into a `Date`.\r\n * - Strings are first attempted as ISO 8601, then matched against each format in `parseFormat`.\r\n * - Numbers are treated as Unix timestamps (milliseconds).\r\n * - Existing `Date` instances are cloned.\r\n * @param value - The value to parse.\r\n * @param parseFormat - A format string or an array of format strings (date-fns tokens).\r\n * @returns A valid `Date` in `Europe/Rome`, an invalid sentinel, or `null` for unrecognised input.\r\n */\r\n parse(value: unknown, parseFormat: string | string[]): Date | null {\r\n if (value === null || value === undefined) {\r\n return null;\r\n }\r\n if (typeof value === 'string') {\r\n const trimmedValue = value.trim();\r\n if (trimmedValue.length === 0) {\r\n return null;\r\n }\r\n const iso8601Date = parseISO(trimmedValue);\r\n if (this.isValid(iso8601Date)) {\r\n return DateFnsAdapter.toLocal(iso8601Date);\r\n }\r\n\r\n const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];\r\n\r\n if (!formats.length) {\r\n throw Error('Formats array must not be empty.');\r\n }\r\n\r\n for (const currentFormat of formats) {\r\n const fromFormat = parse(trimmedValue, currentFormat, new TZDate(new Date(), 'Europe/Rome'), {\r\n locale: this.locale\r\n });\r\n if (this.isValid(fromFormat)) {\r\n return DateFnsAdapter.toLocal(fromFormat);\r\n }\r\n\r\n }\r\n\r\n return this.invalid();\r\n } else if (typeof value === 'number') {\r\n return DateFnsAdapter.toLocal(value);\r\n } else if (value instanceof Date) {\r\n return this.clone(value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Formats a `Date` using the given date-fns display format string.\r\n * Throws an `Error` when `date` is not valid.\r\n * @param date - The date to format.\r\n * @param displayFormat - A date-fns format string (e.g. `'P'`, `'LLL uuuu'`).\r\n */\r\n format(date: Date, displayFormat: string): string {\r\n if (!this.isValid(date)) {\r\n throw Error('DateFnsAdapter: Cannot format invalid date.');\r\n }\r\n\r\n return format(date, displayFormat, { locale: this.locale });\r\n }\r\n\r\n /**\r\n * Adds the given number of whole years to a date.\r\n * @param date - The base date.\r\n * @param years - Number of years to add (can be negative).\r\n */\r\n addCalendarYears(date: Date, years: number): Date {\r\n return DateFnsAdapter.toLocal(addYears(date, years));\r\n }\r\n\r\n /**\r\n * Adds the given number of whole months to a date.\r\n * @param date - The base date.\r\n * @param months - Number of months to add (can be negative).\r\n */\r\n addCalendarMonths(date: Date, months: number): Date {\r\n return DateFnsAdapter.toLocal(addMonths(date, months));\r\n }\r\n\r\n /**\r\n * Adds the given number of whole days to a date.\r\n * @param date - The base date.\r\n * @param days - Number of days to add (can be negative).\r\n */\r\n addCalendarDays(date: Date, days: number): Date {\r\n return DateFnsAdapter.toLocal(addDays(date, days));\r\n }\r\n\r\n /**\r\n * Serialises a date to an ISO 8601 date-only string (`yyyy-MM-dd`) using its Europe/Rome calendar day,\r\n * independent of the browser timezone.\r\n * @param date - The date to serialise.\r\n * @returns the yyyy-MM-dd string for the date in Europe/Rome.\r\n */\r\n toIso8601(date: Date): string {\r\n return format(new TZDate(date, 'Europe/Rome'), 'yyyy-MM-dd');\r\n }\r\n\r\n /**\r\n * Returns the given value when it is a valid `Date`, or `null` for an empty string.\r\n * Deserialises valid ISO 8601 strings into `Date` instances.\r\n * Delegates all other values to the base-class implementation.\r\n * @param value - The raw value to deserialise.\r\n */\r\n override deserialize(value: unknown): Date | null {\r\n if (value === null || value === undefined) {\r\n return null;\r\n }\r\n if (typeof value === 'string') {\r\n const trimmedValue = value.trim();\r\n if (trimmedValue.length === 0) {\r\n return null;\r\n }\r\n const date = parseISO(trimmedValue);\r\n if (this.isValid(date)) {\r\n return DateFnsAdapter.toLocal(date);\r\n }\r\n }\r\n return super.deserialize(value);\r\n }\r\n\r\n /**\r\n * Returns `true` when `obj` is an instance of `Date`.\r\n * @param obj - The object to test.\r\n */\r\n isDateInstance(obj: unknown): boolean {\r\n return isDate(obj);\r\n }\r\n\r\n /**\r\n * Returns `true` when `date` represents a valid point in time.\r\n * @param date - The date to validate.\r\n */\r\n isValid(date: Date): boolean {\r\n return isValid(date);\r\n }\r\n\r\n /**\r\n * Returns a sentinel `Date` that represents an invalid date (`new Date(NaN)`).\r\n */\r\n invalid(): Date {\r\n return new Date(NaN);\r\n }\r\n\r\n /**\r\n * Returns the hours component (0-23) of the given date.\r\n * @param date - The source date.\r\n */\r\n override getHours(date: Date): number {\r\n return date.getHours();\r\n }\r\n\r\n /**\r\n * Returns the minutes component (0-59) of the given date.\r\n * @param date - The source date.\r\n */\r\n override getMinutes(date: Date): number {\r\n return date.getMinutes();\r\n }\r\n\r\n /**\r\n * Returns the seconds component (0-59) of the given date.\r\n * @param date - The source date.\r\n */\r\n override getSeconds(date: Date): number {\r\n return date.getSeconds();\r\n }\r\n\r\n /**\r\n * Returns a clone of `target` with its time-of-day set to the given hours/minutes/seconds,\r\n * keeping the date part unchanged.\r\n * @param target - The date whose time should be set.\r\n * @param hours - New hours (0-23).\r\n * @param minutes - New minutes (0-59).\r\n * @param seconds - New seconds (0-59).\r\n */\r\n override setTime(target: Date, hours: number, minutes: number, seconds: number): Date {\r\n const clone = this.clone(target);\r\n clone.setHours(hours, minutes, seconds, 0);\r\n return clone;\r\n }\r\n\r\n /**\r\n * Adds the given number of seconds to a date.\r\n * @param date - The base date.\r\n * @param amount - Number of seconds to add (can be negative).\r\n */\r\n override addSeconds(date: Date, amount: number): Date {\r\n return DateFnsAdapter.toLocal(addSeconds(date, amount));\r\n }\r\n\r\n /**\r\n * Parses a time-only value into a `Date` (today's date, in `Europe/Rome`, with the parsed\r\n * time-of-day set). The wall-clock time is preserved exactly as entered.\r\n * @param value - The value to parse (a string, or an existing `Date`).\r\n * @param parseFormat - A format string or an array of format strings (date-fns tokens).\r\n * @returns the parsed Date, an invalid sentinel, or null for unrecognised input.\r\n */\r\n override parseTime(value: unknown, parseFormat: string | string[]): Date | null {\r\n if (typeof value === 'string' && value.length > 0) {\r\n const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];\r\n\r\n if (!formats.length) {\r\n throw Error('Formats array must not be empty.');\r\n }\r\n\r\n const referenceDate = new TZDate(new Date(), 'Europe/Rome');\r\n for (const currentFormat of formats) {\r\n const fromFormat = parse(value, currentFormat, referenceDate, { locale: this.locale });\r\n if (this.isValid(fromFormat)) {\r\n return DateFnsAdapter.toLocal(fromFormat);\r\n }\r\n }\r\n\r\n return this.invalid();\r\n } else if (value instanceof Date) {\r\n return this.clone(value);\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Standalone providers for the ARS date-fns adapter.\r\n *\r\n * Configures Angular Material to use {@link DateFnsAdapter} (Europe/Rome timezone)\r\n * and the matching {@link MAT_DATE_FNS_FORMATS}. Also supports `mat-timepicker` since\r\n * {@link DateFnsAdapter} implements the time-related `DateAdapter` methods.\r\n *\r\n * @example\r\n * bootstrapApplication(AppComponent, {\r\n * providers: [provideArsDateFns()]\r\n * });\r\n */\r\nexport function provideArsDateFns(): EnvironmentProviders {\r\n return makeEnvironmentProviders([\r\n {\r\n provide: DateAdapter,\r\n useClass: DateFnsAdapter\r\n },\r\n { provide: MAT_DATE_FORMATS, useValue: MAT_DATE_FNS_FORMATS }\r\n ]);\r\n}\r\n","import { HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpHandlerFn, HttpInterceptor, HttpInterceptorFn, HttpRequest } from '@angular/common/http';\nimport { EnvironmentProviders, inject, Injectable, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport { TZDate } from '@date-fns/tz';\nimport { format } from 'date-fns';\nimport { Observable } from 'rxjs';\n\n\n/** Default application timezone: all dates are serialised as Europe/Rome wall-clock values. */\nexport const DEFAULT_TIME_ZONE = 'Europe/Rome';\n\n/**\n * IANA timezone used to serialise dates towards the backend.\n * Override it in the application providers to run the same code in another zone:\n * `{ provide: ARS_TIME_ZONE, useValue: 'Europe/Zurich' }`.\n */\nexport const ARS_TIME_ZONE = new InjectionToken<string>('ARS_TIME_ZONE', {\n providedIn: 'root',\n factory: () => DEFAULT_TIME_ZONE,\n});\n\n/** Naive local datetime pattern (no timezone designator): the server reads it as DateTimeKind.Unspecified. */\nconst NAIVE_PATTERN = \"yyyy-MM-dd'T'HH:mm:ss\";\n\n\n/**\n * Returns `true` for payloads that must be forwarded untouched\n * (binary or already-encoded bodies).\n * @param body - The request body to test.\n */\nfunction isOpaqueBody(body: unknown): boolean {\n return (\n body instanceof FormData ||\n body instanceof Blob ||\n body instanceof ArrayBuffer ||\n ArrayBuffer.isView(body) ||\n body instanceof URLSearchParams ||\n typeof body === 'string'\n );\n}\n\n/**\n * Recursively replaces every `Date` found in `value` with its naive local\n * datetime string, returning a NEW structure: the original object graph — and\n * therefore any bound form model — is never mutated.\n *\n * @param value - The value to normalise (object, array, Date or primitive).\n * @param timeZone - IANA timezone used to compute the wall-clock value.\n * @param seen - Guard against circular references.\n * @returns The normalised value, safe to hand over to `JSON.stringify`.\n */\nfunction normalizeDates(value: unknown, timeZone: string, seen: WeakSet<object>): unknown {\n if (value instanceof Date) {\n // Invalid dates would make format() throw a RangeError: send null instead.\n if (isNaN(value.getTime())) return null;\n return format(new TZDate(value.getTime(), timeZone), NAIVE_PATTERN);\n }\n\n if (value === null || typeof value !== 'object') return value;\n if (isOpaqueBody(value)) return value;\n\n // Circular reference: leave it as is, JSON.stringify will report it anyway.\n if (seen.has(value)) return value;\n seen.add(value);\n\n if (Array.isArray(value)) {\n return value.map(item => normalizeDates(item, timeZone, seen));\n }\n\n const source = value as Record<string, unknown>;\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(source)) {\n result[key] = normalizeDates(source[key], timeZone, seen);\n }\n return result;\n}\n\n/**\n * Rewrites the request body, if any, replacing Dates with naive local strings.\n * Shared by the functional and the class-based interceptor.\n * @param req - The outgoing request.\n * @param timeZone - IANA timezone used to compute the wall-clock value.\n * @returns The original request when there is nothing to convert, a clone otherwise.\n */\nfunction localizeRequest(req: HttpRequest<unknown>, timeZone: string): HttpRequest<unknown> {\n const body = req.body;\n if (body === null || body === undefined || isOpaqueBody(body)) return req;\n return req.clone({ body: normalizeDates(body, timeZone, new WeakSet<object>()) });\n}\n\n\n/**\n * Functional interceptor that serialises every `Date` in an outgoing request\n * body as a naive local datetime string (`yyyy-MM-ddTHH:mm:ss`: no `Z`, no offset).\n *\n * WHY: `JSON.stringify` calls `Date.prototype.toJSON`, which emits a UTC instant.\n * A date picked as 29/07/2026 00:00 in Rome (UTC+2) becomes\n * `2026-07-28T22:00:00.000Z`, so the server stores the 28th — the classic\n * \"off by one day\" bug. Sending the wall-clock value instead makes\n * System.Text.Json produce a `DateTime` with `Kind = Unspecified` and the exact\n * day/time the user selected.\n *\n * This is the single serialisation boundary of the application: no call site has\n * to convert anything, and it also covers dates that lost a per-instance\n * `toJSON` along the way (e.g. after `structuredClone`).\n *\n * Register it explicitly in `provideHttpClient(withInterceptors([...]))`.\n * If you would rather have the library register it for you, use\n * {@link provideArsLocalDates} instead.\n *\n * @example\n * provideHttpClient(withInterceptors([\n * arsLocalDateInterceptor,\n * evolutionAuthInterceptor(...),\n * ]));\n */\nexport const arsLocalDateInterceptor: HttpInterceptorFn = (\n req: HttpRequest<unknown>,\n next: HttpHandlerFn\n): Observable<HttpEvent<unknown>> => next(localizeRequest(req, inject(ARS_TIME_ZONE)));\n\n\n/**\n * Class-based twin of {@link arsLocalDateInterceptor}.\n *\n * Exists because a functional `HttpInterceptorFn` can ONLY be registered inside\n * `provideHttpClient(withInterceptors([...]))`, while a class registered on the\n * `HTTP_INTERCEPTORS` multi-token can be contributed by any `EnvironmentProviders` —\n * which is what lets {@link provideArsLocalDates} (and `provideArsDateFns`) wire it up\n * on their own.\n *\n * REQUIRES `withInterceptorsFromDi()` in the application's `provideHttpClient()`:\n * without it Angular never reads `HTTP_INTERCEPTORS` and this interceptor is\n * silently skipped.\n */\n@Injectable()\nexport class ArsLocalDateInterceptor implements HttpInterceptor {\n private readonly timeZone = inject(ARS_TIME_ZONE);\n\n /**\n * Normalises the request body before handing it to the next handler.\n * @param req - The outgoing request.\n * @param next - The next handler in the chain.\n */\n intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {\n return next.handle(localizeRequest(req, this.timeZone));\n }\n}\n\n\n/**\n * Standalone providers for date serialisation towards the backend.\n *\n * Registers {@link ArsLocalDateInterceptor} so that every `Date` in a request\n * body travels as a naive local datetime string instead of a UTC instant.\n *\n * IMPORTANT: the application MUST call `withInterceptorsFromDi()`, otherwise\n * these providers have no effect at all (no error is raised).\n *\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n *\n * @example\n * providers: [\n * provideArsLocalDates(),\n * provideHttpClient(withInterceptors([evolutionAuthInterceptor(...)]), withInterceptorsFromDi()),\n * ]\n */\nexport function provideArsLocalDates(timeZone: string = DEFAULT_TIME_ZONE): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: ARS_TIME_ZONE, useValue: timeZone },\n { provide: HTTP_INTERCEPTORS, useClass: ArsLocalDateInterceptor, multi: true },\n ]);\n}\n\n\n/**\n * Formats a date as a date-only ISO string (`yyyy-MM-dd`) using its wall-clock\n * calendar day in the given timezone. Use it for query-string parameters and for\n * DTO fields mapped to a .NET `DateOnly`, which the interceptor cannot detect.\n *\n * @param value - The date to serialise.\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n * @returns The `yyyy-MM-dd` string, or `undefined` for empty/invalid input.\n */\nexport function toLocalDateOnlyString(value?: Date | null, timeZone: string = DEFAULT_TIME_ZONE): string | undefined {\n if (!value || isNaN(value.getTime())) return undefined;\n return format(new TZDate(value.getTime(), timeZone), 'yyyy-MM-dd');\n}\n\n/**\n * Formats a date as a naive local datetime string (`yyyy-MM-ddTHH:mm:ss`), the\n * same representation produced by the interceptor. Useful for query-string\n * parameters, which never pass through the request body.\n *\n * @param value - The date to serialise.\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n * @returns The naive datetime string, or `undefined` for empty/invalid input.\n */\nexport function toLocalDateTimeString(value?: Date | null, timeZone: string = DEFAULT_TIME_ZONE): string | undefined {\n if (!value || isNaN(value.getTime())) return undefined;\n return format(new TZDate(value.getTime(), timeZone), NAIVE_PATTERN);\n}","/*\r\n * Public API Surface of @arsedizioni/ars-utils/core.date\r\n */\r\nexport * from './dateFnsAdapter.module';\r\nexport * from './dateInterceptor';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAsBA;;;;;AAKG;AACH,SAAS,KAAK,CAAI,MAAc,EAAE,aAAmC,EAAA;AACjE,IAAA,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;AACjC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;QAC7B,WAAW,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC;IACrC;AACA,IAAA,OAAO,WAAW;AACtB;AAEA;AACA;AACA,MAAM,aAAa,GAAG;AAClB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,MAAM,EAAE,OAAO;CAClB;AAED,MAAM,mBAAmB,GAAG;AACxB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,MAAM,EAAE,OAAO;CAClB;AAEM,MAAM,oBAAoB,GAAmB;AAChD,IAAA,KAAK,EAAE;AACH,QAAA,SAAS,EAAE,GAAG;AACd,QAAA,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC;AACpC,KAAA;AACD,IAAA,OAAO,EAAE;AACL,QAAA,SAAS,EAAE,GAAG;AACd,QAAA,cAAc,EAAE,UAAU;AAC1B,QAAA,aAAa,EAAE,IAAI;AACnB,QAAA,kBAAkB,EAAE,WAAW;AAC/B,QAAA,SAAS,EAAE,GAAG;AACd,QAAA,eAAe,EAAE,GAAG;AACvB,KAAA;;AAIL;;;AAGG;AAEG,MAAO,cAAe,SAAQ,WAAyB,CAAA;AACzD,IAAA,WAAA,GAAA;AACI,QAA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AACvE;;ACxMA;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"arsedizioni-ars-utils-core.date.mjs","sources":["../../../projects/ars-utils/core.date/dateFnsAdapter.module.ts","../../../projects/ars-utils/core.date/dateInterceptor.ts","../../../projects/ars-utils/core.date/public_api.ts","../../../projects/ars-utils/core.date/arsedizioni-ars-utils-core.date.ts"],"sourcesContent":["import { EnvironmentProviders, inject, Injectable, makeEnvironmentProviders } from '@angular/core';\r\nimport { DateAdapter, MatDateFormats, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';\r\nimport { TZDate } from '@date-fns/tz';\r\nimport {\r\n Locale,\r\n getMonth,\r\n getYear,\r\n getDate,\r\n getDay,\r\n getDaysInMonth,\r\n addYears,\r\n addMonths,\r\n addDays,\r\n addSeconds,\r\n isValid,\r\n isDate,\r\n format,\r\n parseISO,\r\n parse,\r\n} from 'date-fns';\r\n\r\n\r\n/**\r\n * Creates an array of the given length, filling each slot with the result of `valueFunction`.\r\n * @param length - Number of elements to create.\r\n * @param valueFunction - Factory called with each index to produce the element value.\r\n * @returns Typed array of `length` elements.\r\n */\r\nfunction range<T>(length: number, valueFunction: (index: number) => T): T[] {\r\n const valuesArray = Array(length);\r\n for (let i = 0; i < length; i++) {\r\n valuesArray[i] = valueFunction(i);\r\n }\r\n return valuesArray;\r\n}\r\n\r\n// date-fns doesn't have a way to read/print month names or days of the week directly,\r\n// so we get them by formatting a date with a format that produces the desired month/day.\r\nconst MONTH_FORMATS = {\r\n long: 'LLLL',\r\n short: 'LLL',\r\n narrow: 'LLLLL',\r\n};\r\n\r\nconst DAY_OF_WEEK_FORMATS = {\r\n long: 'EEEE',\r\n short: 'EEE',\r\n narrow: 'EEEEE',\r\n};\r\n\r\nexport const MAT_DATE_FNS_FORMATS: MatDateFormats = {\r\n parse: {\r\n dateInput: 'P',\r\n timeInput: ['p', 'HH:mm', 'H:mm'],\r\n },\r\n display: {\r\n dateInput: 'P',\r\n monthYearLabel: 'LLL uuuu',\r\n dateA11yLabel: 'PP',\r\n monthYearA11yLabel: 'LLLL uuuu',\r\n timeInput: 'p',\r\n timeOptionLabel: 'p',\r\n },\r\n};\r\n\r\n\r\n/**\r\n * date-fns adapter that integrates Angular Material's date picker with the date-fns library,\r\n * applying `Europe/Rome` timezone for all parsed and created dates.\r\n */\r\n@Injectable()\r\nexport class DateFnsAdapter extends DateAdapter<Date, Locale> {\r\n constructor() {\r\n super();\r\n const matDateLocale = inject(MAT_DATE_LOCALE, { optional: true });\r\n if (matDateLocale && typeof matDateLocale === 'object') {\r\n this.setLocale(matDateLocale as Locale);\r\n }\r\n }\r\n\r\n /**\r\n * Wraps a date/instant into a Europe/Rome TZDate whose JSON serialisation emits a\r\n * naive local datetime string (\"yyyy-MM-dd'T'HH:mm:ss\") instead of a UTC instant,\r\n * so the wall-clock value the user entered is preserved end-to-end (no timezone shift).\r\n * @param value - The source Date or Unix timestamp in milliseconds.\r\n * @returns a Europe/Rome TZDate whose toJSON yields a naive local datetime string.\r\n */\r\n private static toLocal(value: Date | number): Date {\r\n const ms = typeof value === 'number' ? value : value.getTime();\r\n const t = new TZDate(ms, 'Europe/Rome');\r\n Object.defineProperty(t, 'toJSON', {\r\n value: () => format(t, \"yyyy-MM-dd'T'HH:mm:ss\"),\r\n enumerable: false,\r\n configurable: true,\r\n writable: true,\r\n });\r\n return t;\r\n }\r\n\r\n /**\r\n * Returns the year component of the given date.\r\n * @param date - The source date.\r\n */\r\n getYear(date: Date): number {\r\n return getYear(date);\r\n }\r\n\r\n /**\r\n * Returns the zero-based month index of the given date (0 = January).\r\n * @param date - The source date.\r\n */\r\n getMonth(date: Date): number {\r\n return getMonth(date);\r\n }\r\n\r\n /**\r\n * Returns the day-of-month of the given date (1-based).\r\n * @param date - The source date.\r\n */\r\n getDate(date: Date): number {\r\n return getDate(date);\r\n }\r\n\r\n /**\r\n * Returns the day-of-week of the given date (0 = Sunday).\r\n * @param date - The source date.\r\n */\r\n getDayOfWeek(date: Date): number {\r\n return getDay(date);\r\n }\r\n\r\n /**\r\n * Returns an array of 12 month name strings formatted for the active locale.\r\n * @param style - One of `'long'`, `'short'`, or `'narrow'`.\r\n */\r\n getMonthNames(style: 'long' | 'short' | 'narrow'): string[] {\r\n const pattern = MONTH_FORMATS[style];\r\n return range(12, i => this.format(new Date(2017, i, 1), pattern));\r\n }\r\n\r\n /**\r\n * Returns an array of 31 day-of-month label strings formatted using `Intl.DateTimeFormat`\r\n * when available, falling back to plain numeric strings.\r\n */\r\n getDateNames(): string[] {\r\n const dtf =\r\n typeof Intl !== 'undefined'\r\n ? new Intl.DateTimeFormat(this.locale?.code, {\r\n day: 'numeric',\r\n timeZone: 'utc',\r\n })\r\n : null;\r\n\r\n return range(31, i => {\r\n if (dtf) {\r\n // date-fns doesn't appear to support this functionality.\r\n // Fall back to `Intl` on supported browsers.\r\n const date = new Date();\r\n date.setUTCFullYear(2017, 0, i + 1);\r\n date.setUTCHours(0, 0, 0, 0);\r\n return dtf.format(date).replace(/[\\u200e\\u200f]/g, '');\r\n }\r\n\r\n return String(i + 1);\r\n });\r\n }\r\n\r\n /**\r\n * Returns an array of 7 day-of-week name strings formatted for the active locale.\r\n * @param style - One of `'long'`, `'short'`, or `'narrow'`.\r\n */\r\n getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[] {\r\n const pattern = DAY_OF_WEEK_FORMATS[style];\r\n return range(7, i => this.format(new Date(2017, 0, i + 1), pattern));\r\n }\r\n\r\n /**\r\n * Returns the four-digit year string for the given date.\r\n * @param date - The source date.\r\n */\r\n getYearName(date: Date): string {\r\n return this.format(date, 'y');\r\n }\r\n\r\n /**\r\n * Returns the first day of the week for the active locale (0 = Sunday, 1 = Monday, …).\r\n */\r\n getFirstDayOfWeek(): number {\r\n return this.locale?.options?.weekStartsOn ?? 0;\r\n }\r\n\r\n /**\r\n * Returns the number of days in the month of the given date.\r\n * @param date - The source date.\r\n */\r\n getNumDaysInMonth(date: Date): number {\r\n return getDaysInMonth(date);\r\n }\r\n\r\n /**\r\n * Creates an independent copy of the given date.\r\n * @param date - The date to clone.\r\n */\r\n clone(date: Date): Date {\r\n return DateFnsAdapter.toLocal(date.getTime());\r\n }\r\n\r\n /**\r\n * Creates a `Date` in the `Europe/Rome` timezone for the given year, month, and day.\r\n * Throws an `Error` when any component is out of range.\r\n * @param year - Full four-digit year.\r\n * @param month - Zero-based month index (0 = January, 11 = December).\r\n * @param date - Day-of-month (1-based).\r\n */\r\n createDate(year: number, month: number, date: number): Date {\r\n if (month < 0 || month > 11) {\r\n throw Error(`Invalid month index \"${month}\". Month index has to be between 0 and 11.`);\r\n }\r\n\r\n if (date < 1) {\r\n throw Error(`Invalid date \"${date}\". Date has to be greater than 0.`);\r\n }\r\n\r\n if (month < 0 || month > 11) {\r\n throw Error(`Invalid month index \"${month}\". Month index has to be between 0 and 11.`);\r\n }\r\n\r\n const result = new TZDate(year, month, date, 0, 0, 0, 0, 'Europe/Rome');\r\n\r\n if (result.getMonth() !== month) {\r\n throw Error(`Invalid date \"${date}\" for month with index \"${month}\".`);\r\n }\r\n\r\n return DateFnsAdapter.toLocal(result);\r\n }\r\n\r\n /**\r\n * Returns the current date and time in the Europe/Rome timezone, preserving the wall-clock value.\r\n */\r\n today(): Date {\r\n return DateFnsAdapter.toLocal(new Date());\r\n }\r\n\r\n /**\r\n * Parses a value into a `Date`.\r\n * - Strings are first attempted as ISO 8601, then matched against each format in `parseFormat`.\r\n * - Numbers are treated as Unix timestamps (milliseconds).\r\n * - Existing `Date` instances are cloned.\r\n * @param value - The value to parse.\r\n * @param parseFormat - A format string or an array of format strings (date-fns tokens).\r\n * @returns A valid `Date` in `Europe/Rome`, an invalid sentinel, or `null` for unrecognised input.\r\n */\r\n parse(value: unknown, parseFormat: string | string[]): Date | null {\r\n if (value === null || value === undefined) {\r\n return null;\r\n }\r\n if (typeof value === 'string') {\r\n const trimmedValue = value.trim();\r\n if (trimmedValue.length === 0) {\r\n return null;\r\n }\r\n const iso8601Date = parseISO(trimmedValue);\r\n if (this.isValid(iso8601Date)) {\r\n return DateFnsAdapter.toLocal(iso8601Date);\r\n }\r\n\r\n const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];\r\n\r\n if (!formats.length) {\r\n throw Error('Formats array must not be empty.');\r\n }\r\n\r\n for (const currentFormat of formats) {\r\n const fromFormat = parse(trimmedValue, currentFormat, new TZDate(new Date(), 'Europe/Rome'), {\r\n locale: this.locale\r\n });\r\n if (this.isValid(fromFormat)) {\r\n return DateFnsAdapter.toLocal(fromFormat);\r\n }\r\n\r\n }\r\n\r\n return this.invalid();\r\n } else if (typeof value === 'number') {\r\n return DateFnsAdapter.toLocal(value);\r\n } else if (value instanceof Date) {\r\n return this.clone(value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Formats a `Date` using the given date-fns display format string.\r\n * Throws an `Error` when `date` is not valid.\r\n * @param date - The date to format.\r\n * @param displayFormat - A date-fns format string (e.g. `'P'`, `'LLL uuuu'`).\r\n */\r\n format(date: Date, displayFormat: string): string {\r\n if (!this.isValid(date)) {\r\n throw Error('DateFnsAdapter: Cannot format invalid date.');\r\n }\r\n\r\n return format(date, displayFormat, { locale: this.locale });\r\n }\r\n\r\n /**\r\n * Adds the given number of whole years to a date.\r\n * @param date - The base date.\r\n * @param years - Number of years to add (can be negative).\r\n */\r\n addCalendarYears(date: Date, years: number): Date {\r\n return DateFnsAdapter.toLocal(addYears(date, years));\r\n }\r\n\r\n /**\r\n * Adds the given number of whole months to a date.\r\n * @param date - The base date.\r\n * @param months - Number of months to add (can be negative).\r\n */\r\n addCalendarMonths(date: Date, months: number): Date {\r\n return DateFnsAdapter.toLocal(addMonths(date, months));\r\n }\r\n\r\n /**\r\n * Adds the given number of whole days to a date.\r\n * @param date - The base date.\r\n * @param days - Number of days to add (can be negative).\r\n */\r\n addCalendarDays(date: Date, days: number): Date {\r\n return DateFnsAdapter.toLocal(addDays(date, days));\r\n }\r\n\r\n /**\r\n * Serialises a date to an ISO 8601 date-only string (`yyyy-MM-dd`) using its Europe/Rome calendar day,\r\n * independent of the browser timezone.\r\n * @param date - The date to serialise.\r\n * @returns the yyyy-MM-dd string for the date in Europe/Rome.\r\n */\r\n toIso8601(date: Date): string {\r\n return format(new TZDate(date, 'Europe/Rome'), 'yyyy-MM-dd');\r\n }\r\n\r\n /**\r\n * Returns the given value when it is a valid `Date`, or `null` for an empty string.\r\n * Deserialises valid ISO 8601 strings into `Date` instances.\r\n * Delegates all other values to the base-class implementation.\r\n * @param value - The raw value to deserialise.\r\n */\r\n override deserialize(value: unknown): Date | null {\r\n if (value === null || value === undefined) {\r\n return null;\r\n }\r\n if (typeof value === 'string') {\r\n const trimmedValue = value.trim();\r\n if (trimmedValue.length === 0) {\r\n return null;\r\n }\r\n const date = parseISO(trimmedValue);\r\n if (this.isValid(date)) {\r\n return DateFnsAdapter.toLocal(date);\r\n }\r\n }\r\n return super.deserialize(value);\r\n }\r\n\r\n /**\r\n * Returns `true` when `obj` is an instance of `Date`.\r\n * @param obj - The object to test.\r\n */\r\n isDateInstance(obj: unknown): boolean {\r\n return isDate(obj);\r\n }\r\n\r\n /**\r\n * Returns `true` when `date` represents a valid point in time.\r\n * @param date - The date to validate.\r\n */\r\n isValid(date: Date): boolean {\r\n return isValid(date);\r\n }\r\n\r\n /**\r\n * Returns a sentinel `Date` that represents an invalid date (`new Date(NaN)`).\r\n */\r\n invalid(): Date {\r\n return new Date(NaN);\r\n }\r\n\r\n /**\r\n * Returns the hours component (0-23) of the given date.\r\n * @param date - The source date.\r\n */\r\n override getHours(date: Date): number {\r\n return date.getHours();\r\n }\r\n\r\n /**\r\n * Returns the minutes component (0-59) of the given date.\r\n * @param date - The source date.\r\n */\r\n override getMinutes(date: Date): number {\r\n return date.getMinutes();\r\n }\r\n\r\n /**\r\n * Returns the seconds component (0-59) of the given date.\r\n * @param date - The source date.\r\n */\r\n override getSeconds(date: Date): number {\r\n return date.getSeconds();\r\n }\r\n\r\n /**\r\n * Returns a clone of `target` with its time-of-day set to the given hours/minutes/seconds,\r\n * keeping the date part unchanged.\r\n * @param target - The date whose time should be set.\r\n * @param hours - New hours (0-23).\r\n * @param minutes - New minutes (0-59).\r\n * @param seconds - New seconds (0-59).\r\n */\r\n override setTime(target: Date, hours: number, minutes: number, seconds: number): Date {\r\n const clone = this.clone(target);\r\n clone.setHours(hours, minutes, seconds, 0);\r\n return clone;\r\n }\r\n\r\n /**\r\n * Adds the given number of seconds to a date.\r\n * @param date - The base date.\r\n * @param amount - Number of seconds to add (can be negative).\r\n */\r\n override addSeconds(date: Date, amount: number): Date {\r\n return DateFnsAdapter.toLocal(addSeconds(date, amount));\r\n }\r\n\r\n /**\r\n * Parses a time-only value into a `Date` (today's date, in `Europe/Rome`, with the parsed\r\n * time-of-day set). The wall-clock time is preserved exactly as entered.\r\n * @param value - The value to parse (a string, or an existing `Date`).\r\n * @param parseFormat - A format string or an array of format strings (date-fns tokens).\r\n * @returns the parsed Date, an invalid sentinel, or null for unrecognised input.\r\n */\r\n override parseTime(value: unknown, parseFormat: string | string[]): Date | null {\r\n if (typeof value === 'string' && value.length > 0) {\r\n const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];\r\n\r\n if (!formats.length) {\r\n throw Error('Formats array must not be empty.');\r\n }\r\n\r\n const referenceDate = new TZDate(new Date(), 'Europe/Rome');\r\n for (const currentFormat of formats) {\r\n const fromFormat = parse(value, currentFormat, referenceDate, { locale: this.locale });\r\n if (this.isValid(fromFormat)) {\r\n return DateFnsAdapter.toLocal(fromFormat);\r\n }\r\n }\r\n\r\n return this.invalid();\r\n } else if (value instanceof Date) {\r\n return this.clone(value);\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Standalone providers for the ARS date-fns adapter.\r\n *\r\n * Configures Angular Material to use {@link DateFnsAdapter} (Europe/Rome timezone)\r\n * and the matching {@link MAT_DATE_FNS_FORMATS}. Also supports `mat-timepicker` since\r\n * {@link DateFnsAdapter} implements the time-related `DateAdapter` methods.\r\n *\r\n * @example\r\n * bootstrapApplication(AppComponent, {\r\n * providers: [provideArsDateFns()]\r\n * });\r\n */\r\nexport function provideArsDateFns(): EnvironmentProviders {\r\n return makeEnvironmentProviders([\r\n {\r\n provide: DateAdapter,\r\n useClass: DateFnsAdapter\r\n },\r\n { provide: MAT_DATE_FORMATS, useValue: MAT_DATE_FNS_FORMATS }\r\n ]);\r\n}\r\n","import { HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpHandlerFn, HttpInterceptor, HttpInterceptorFn, HttpRequest, HttpResponse } from '@angular/common/http';\nimport { EnvironmentProviders, inject, Injectable, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport { TZDate } from '@date-fns/tz';\nimport { format } from 'date-fns';\nimport { map, Observable } from 'rxjs';\n\n\n/** Default application timezone: all dates are serialised as Europe/Rome wall-clock values. */\nexport const DEFAULT_TIME_ZONE = 'Europe/Rome';\n\n/**\n * IANA timezone used to serialise dates towards the backend.\n * Override it in the application providers to run the same code in another zone:\n * `{ provide: ARS_TIME_ZONE, useValue: 'Europe/Zurich' }`.\n */\nexport const ARS_TIME_ZONE = new InjectionToken<string>('ARS_TIME_ZONE', {\n providedIn: 'root',\n factory: () => DEFAULT_TIME_ZONE,\n});\n\n/** Naive local datetime pattern (no timezone designator): the server reads it as DateTimeKind.Unspecified. */\nconst NAIVE_PATTERN = \"yyyy-MM-dd'T'HH:mm:ss\";\n\n/**\n * What a string has to look like to be read back as a date: an ISO 8601 calendar date, optionally\n * followed by a time and by `Z` or an offset. Anchored at both ends, so a string that merely\n * *contains* a date (\"Circolare del 2026-09-07\") is left alone.\n */\nconst ISO_DATE_PATTERN =\n /^(\\d{4})-(\\d{2})-(\\d{2})(?:[T ](\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{1,7}))?)?(Z|[+-]\\d{2}:?\\d{2})?)?$/;\n\n/** Shortest string that can be a date (`2026-09-07`), and the longest one worth testing. */\nconst MIN_ISO_LENGTH = 10;\nconst MAX_ISO_LENGTH = 33;\n\n\n/**\n * Returns `true` for payloads that must be forwarded untouched\n * (binary or already-encoded bodies).\n * @param body - The request body to test.\n */\nfunction isOpaqueBody(body: unknown): boolean {\n return (\n body instanceof FormData ||\n body instanceof Blob ||\n body instanceof ArrayBuffer ||\n ArrayBuffer.isView(body) ||\n body instanceof URLSearchParams ||\n typeof body === 'string'\n );\n}\n\n/**\n * Recursively replaces every `Date` found in `value` with its naive local\n * datetime string, returning a NEW structure: the original object graph — and\n * therefore any bound form model — is never mutated.\n *\n * @param value - The value to normalise (object, array, Date or primitive).\n * @param timeZone - IANA timezone used to compute the wall-clock value.\n * @param seen - Guard against circular references.\n * @returns The normalised value, safe to hand over to `JSON.stringify`.\n */\nfunction normalizeDates(value: unknown, timeZone: string, seen: WeakSet<object>): unknown {\n if (value instanceof Date) {\n // Invalid dates would make format() throw a RangeError: send null instead.\n if (isNaN(value.getTime())) return null;\n return format(new TZDate(value.getTime(), timeZone), NAIVE_PATTERN);\n }\n\n if (value === null || typeof value !== 'object') return value;\n if (isOpaqueBody(value)) return value;\n\n // Circular reference: leave it as is, JSON.stringify will report it anyway.\n if (seen.has(value)) return value;\n seen.add(value);\n\n if (Array.isArray(value)) {\n return value.map(item => normalizeDates(item, timeZone, seen));\n }\n\n const source = value as Record<string, unknown>;\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(source)) {\n result[key] = normalizeDates(source[key], timeZone, seen);\n }\n return result;\n}\n\n/**\n * Rewrites the request body, if any, replacing Dates with naive local strings.\n * Shared by the functional and the class-based interceptor.\n * @param req - The outgoing request.\n * @param timeZone - IANA timezone used to compute the wall-clock value.\n * @returns The original request when there is nothing to convert, a clone otherwise.\n */\nfunction localizeRequest(req: HttpRequest<unknown>, timeZone: string): HttpRequest<unknown> {\n const body = req.body;\n if (body === null || body === undefined || isOpaqueBody(body)) return req;\n return req.clone({ body: normalizeDates(body, timeZone, new WeakSet<object>()) });\n}\n\n\n/**\n * Functional interceptor that serialises every `Date` in an outgoing request\n * body as a naive local datetime string (`yyyy-MM-ddTHH:mm:ss`: no `Z`, no offset).\n *\n * WHY: `JSON.stringify` calls `Date.prototype.toJSON`, which emits a UTC instant.\n * A date picked as 29/07/2026 00:00 in Rome (UTC+2) becomes\n * `2026-07-28T22:00:00.000Z`, so the server stores the 28th — the classic\n * \"off by one day\" bug. Sending the wall-clock value instead makes\n * System.Text.Json produce a `DateTime` with `Kind = Unspecified` and the exact\n * day/time the user selected.\n *\n * This is the single serialisation boundary of the application: no call site has\n * to convert anything, and it also covers dates that lost a per-instance\n * `toJSON` along the way (e.g. after `structuredClone`).\n *\n * Register it explicitly in `provideHttpClient(withInterceptors([...]))`.\n * If you would rather have the library register it for you, use\n * {@link provideArsLocalDates} instead.\n *\n * @example\n * provideHttpClient(withInterceptors([\n * arsLocalDateInterceptor,\n * evolutionAuthInterceptor(...),\n * ]));\n */\nexport const arsLocalDateInterceptor: HttpInterceptorFn = (\n req: HttpRequest<unknown>,\n next: HttpHandlerFn\n): Observable<HttpEvent<unknown>> => next(localizeRequest(req, inject(ARS_TIME_ZONE)));\n\n\n/**\n * Class-based twin of {@link arsLocalDateInterceptor}.\n *\n * Exists because a functional `HttpInterceptorFn` can ONLY be registered inside\n * `provideHttpClient(withInterceptors([...]))`, while a class registered on the\n * `HTTP_INTERCEPTORS` multi-token can be contributed by any `EnvironmentProviders` —\n * which is what lets {@link provideArsLocalDates} (and `provideArsDateFns`) wire it up\n * on their own.\n *\n * REQUIRES `withInterceptorsFromDi()` in the application's `provideHttpClient()`:\n * without it Angular never reads `HTTP_INTERCEPTORS` and this interceptor is\n * silently skipped.\n */\n@Injectable()\nexport class ArsLocalDateInterceptor implements HttpInterceptor {\n private readonly timeZone = inject(ARS_TIME_ZONE);\n\n /**\n * Normalises the request body before handing it to the next handler.\n * @param req - The outgoing request.\n * @param next - The next handler in the chain.\n */\n intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {\n return next.handle(localizeRequest(req, this.timeZone));\n }\n}\n\n\n/**\n * Standalone providers for date serialisation towards the backend.\n *\n * Registers {@link ArsLocalDateInterceptor} so that every `Date` in a request\n * body travels as a naive local datetime string instead of a UTC instant.\n *\n * IMPORTANT: the application MUST call `withInterceptorsFromDi()`, otherwise\n * these providers have no effect at all (no error is raised).\n *\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n *\n * @example\n * providers: [\n * provideArsLocalDates(),\n * provideHttpClient(withInterceptors([evolutionAuthInterceptor(...)]), withInterceptorsFromDi()),\n * ]\n */\nexport function provideArsLocalDates(timeZone: string = DEFAULT_TIME_ZONE): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: ARS_TIME_ZONE, useValue: timeZone },\n { provide: HTTP_INTERCEPTORS, useClass: ArsLocalDateInterceptor, multi: true },\n ]);\n}\n\n\n/**\n * Reads an ISO string back into a `Date`, or returns `undefined` when it is not one.\n *\n * The mirror image of {@link normalizeDates}. A value that carries `Z` or an offset names an\n * instant and is parsed as it stands; a naive one is a wall-clock value in `timeZone` — that is\n * what the request side wrote, and what `System.Text.Json` emits for a `DateTime` with\n * `Kind = Unspecified` — so it is rebuilt component by component through {@link TZDate}.\n *\n * Reading a naive value with `new Date(s)` instead would be right for a datetime and wrong for a\n * bare date: the ECMAScript spec reads `2026-09-07` as UTC midnight and `2026-09-07T00:00:00` as\n * local midnight. That difference is the off-by-one-day this file exists to prevent, arriving from\n * the other direction.\n *\n * @param value - The string to read.\n * @param timeZone - IANA timezone the naive values are expressed in.\n * @returns The date, or `undefined` when the string is not an ISO date.\n */\nfunction parseLocalDate(value: string, timeZone: string): Date | undefined {\n const m = ISO_DATE_PATTERN.exec(value);\n if (!m) return undefined;\n\n const [, year, month, day, hours, minutes, seconds, fraction, zone] = m;\n const date = zone\n ? new Date(value)\n : new Date(new TZDate(\n +year, +month - 1, +day,\n hours ? +hours : 0, minutes ? +minutes : 0, seconds ? +seconds : 0,\n fraction ? +fraction.slice(0, 3).padEnd(3, '0') : 0,\n timeZone).getTime());\n\n if (isNaN(date.getTime())) return undefined;\n\n // \"2026-02-31\" matches the pattern and rolls over to March: a day that does not exist was not a\n // date to begin with, and the original string says more than a wrong Date would.\n if (!zone) {\n const check = new TZDate(date.getTime(), timeZone);\n if (check.getFullYear() !== +year || check.getMonth() !== +month - 1 || check.getDate() !== +day) {\n return undefined;\n }\n }\n return date;\n}\n\n/**\n * Recursively replaces every ISO date string found in `value` with a `Date`, returning a NEW\n * structure, exactly as {@link normalizeDates} does on the way out.\n *\n * Only whole strings are considered, and only inside an object or an array: a top-level string\n * body — a rendered document, a plain-text answer — is never touched.\n *\n * @param value - The value to revive (object, array or primitive).\n * @param timeZone - IANA timezone the naive values are expressed in.\n * @param seen - Guard against circular references.\n * @returns The revived value.\n */\nfunction reviveDates(value: unknown, timeZone: string, seen: WeakSet<object>): unknown {\n if (typeof value === 'string') {\n if (value.length < MIN_ISO_LENGTH || value.length > MAX_ISO_LENGTH) return value;\n return parseLocalDate(value, timeZone) ?? value;\n }\n\n if (value === null || typeof value !== 'object') return value;\n if (value instanceof Date || isOpaqueBody(value)) return value;\n\n // Circular reference: leave it as is rather than looping forever.\n if (seen.has(value)) return value;\n seen.add(value);\n\n if (Array.isArray(value)) {\n return value.map(item => reviveDates(item, timeZone, seen));\n }\n\n const source = value as Record<string, unknown>;\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(source)) {\n result[key] = reviveDates(source[key], timeZone, seen);\n }\n return result;\n}\n\n/**\n * Rewrites a response body, if any, replacing ISO date strings with Dates.\n * Shared by the functional and the class-based interceptor.\n * @param event - The event coming back from the chain.\n * @param timeZone - IANA timezone the naive values are expressed in.\n * @returns The original event when there is nothing to convert, a clone otherwise.\n */\nfunction localizeResponse(event: HttpEvent<unknown>, timeZone: string): HttpEvent<unknown> {\n if (!(event instanceof HttpResponse)) return event;\n const body = event.body;\n if (body === null || typeof body !== 'object' || isOpaqueBody(body)) return event;\n return event.clone({ body: reviveDates(body, timeZone, new WeakSet<object>()) });\n}\n\n\n/**\n * Functional interceptor that reads every ISO date string in a response body back into a `Date`.\n *\n * WHY: models declare `Date`, but `HttpClient` only runs `JSON.parse`, which has no notion of\n * dates, so without this every one of those properties holds a `string` at runtime and the declared\n * type is a promise nobody keeps. It goes unnoticed for a long time — Angular's `date` pipe accepts\n * strings and {@link DateFnsAdapter.deserialize} parses them for the datepickers — until somebody\n * calls a method of `Date` on one and gets a `TypeError`, or writes\n * `x.someDate = new Date(x.someDate)` to work around it one call site at a time.\n *\n * Together with {@link arsLocalDateInterceptor} it closes the serialisation boundary: no call site\n * has to convert anything, in either direction.\n *\n * NOT registered by {@link provideArsLocalDates}, on purpose: turning strings into Dates changes\n * what an application already reading those fields receives, so it stays opt-in and each\n * application decides when to take it. Register it explicitly, or use\n * {@link provideArsLocalDateResponses}.\n *\n * @example\n * provideHttpClient(withInterceptors([\n * arsLocalDateInterceptor,\n * arsLocalDateResponseInterceptor,\n * ]));\n */\nexport const arsLocalDateResponseInterceptor: HttpInterceptorFn = (\n req: HttpRequest<unknown>,\n next: HttpHandlerFn\n): Observable<HttpEvent<unknown>> => {\n const timeZone = inject(ARS_TIME_ZONE);\n return next(req).pipe(map(event => localizeResponse(event, timeZone)));\n};\n\n\n/**\n * Class-based twin of {@link arsLocalDateResponseInterceptor}, for the same reason\n * {@link ArsLocalDateInterceptor} exists: only a class can be contributed through\n * `HTTP_INTERCEPTORS` by an `EnvironmentProviders`.\n *\n * REQUIRES `withInterceptorsFromDi()` in the application's `provideHttpClient()`.\n */\n@Injectable()\nexport class ArsLocalDateResponseInterceptor implements HttpInterceptor {\n private readonly timeZone = inject(ARS_TIME_ZONE);\n\n /**\n * Revives the dates of the response before handing it to the caller.\n * @param req - The outgoing request.\n * @param next - The next handler in the chain.\n */\n intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {\n return next.handle(req).pipe(map(event => localizeResponse(event, this.timeZone)));\n }\n}\n\n\n/**\n * Standalone providers for date deserialisation coming back from the backend.\n *\n * Registers {@link ArsLocalDateResponseInterceptor}, the counterpart of\n * {@link provideArsLocalDates}. Kept separate because it is the half that changes what existing\n * code receives: an application whose models declare those fields as `string` has to be looked at\n * before switching it on.\n *\n * IMPORTANT: the application MUST call `withInterceptorsFromDi()`, otherwise these providers have\n * no effect at all (no error is raised).\n *\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n */\nexport function provideArsLocalDateResponses(timeZone: string = DEFAULT_TIME_ZONE): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: ARS_TIME_ZONE, useValue: timeZone },\n { provide: HTTP_INTERCEPTORS, useClass: ArsLocalDateResponseInterceptor, multi: true },\n ]);\n}\n\n\n/**\n * Formats a date as a date-only ISO string (`yyyy-MM-dd`) using its wall-clock\n * calendar day in the given timezone. Use it for query-string parameters and for\n * DTO fields mapped to a .NET `DateOnly`, which the interceptor cannot detect.\n *\n * @param value - The date to serialise.\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n * @returns The `yyyy-MM-dd` string, or `undefined` for empty/invalid input.\n */\nexport function toLocalDateOnlyString(value?: Date | null, timeZone: string = DEFAULT_TIME_ZONE): string | undefined {\n if (!value || isNaN(value.getTime())) return undefined;\n return format(new TZDate(value.getTime(), timeZone), 'yyyy-MM-dd');\n}\n\n/**\n * Formats a date as a naive local datetime string (`yyyy-MM-ddTHH:mm:ss`), the\n * same representation produced by the interceptor. Useful for query-string\n * parameters, which never pass through the request body.\n *\n * @param value - The date to serialise.\n * @param timeZone - IANA timezone name (default: `Europe/Rome`).\n * @returns The naive datetime string, or `undefined` for empty/invalid input.\n */\nexport function toLocalDateTimeString(value?: Date | null, timeZone: string = DEFAULT_TIME_ZONE): string | undefined {\n if (!value || isNaN(value.getTime())) return undefined;\n return format(new TZDate(value.getTime(), timeZone), NAIVE_PATTERN);\n}","/*\r\n * Public API Surface of @arsedizioni/ars-utils/core.date\r\n */\r\nexport * from './dateFnsAdapter.module';\r\nexport * from './dateInterceptor';\r\n","/**\n * Generated bund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AAC,OAAO,EAAE,CAAC;AAAE,QAAA,OAAO,SAAS;AACtD,IAAA,OAAO,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE,aAAa,CAAC;AACvE;;AC/XA;;AAEG;;ACFH;;AAEG;;;;"}
@@ -568,10 +568,10 @@ class FormatMarkdownPipe {
568
568
  transform(value) {
569
569
  return this.sanitizer.bypassSecurityTrustHtml(MarkdownUtils.toHtml(value ?? '', { escapeHtml: false }));
570
570
  }
571
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: FormatMarkdownPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
572
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.1.4", ngImport: i0, type: FormatMarkdownPipe, isStandalone: true, name: "formatMarkdown" }); }
571
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: FormatMarkdownPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
572
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.1.5", ngImport: i0, type: FormatMarkdownPipe, isStandalone: true, name: "formatMarkdown" }); }
573
573
  }
574
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: FormatMarkdownPipe, decorators: [{
574
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: FormatMarkdownPipe, decorators: [{
575
575
  type: Pipe,
576
576
  args: [{
577
577
  name: 'formatMarkdown',