@designsystem-se/af 37.0.2-beta.0 → 37.0.2

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 (372) hide show
  1. package/components/digi-bar-chart.js +1 -1
  2. package/components/digi-button.js +1 -1
  3. package/components/digi-calendar-datepicker.js +4 -4
  4. package/components/digi-calendar-week-view.js +1 -1
  5. package/components/digi-calendar.js +1 -1
  6. package/components/digi-chart-line.js +1 -1
  7. package/components/digi-code-block.js +1 -1
  8. package/components/digi-code-example.js +4 -4
  9. package/components/digi-context-menu.js +1 -1
  10. package/components/digi-dialog.js +3 -3
  11. package/components/digi-expandable-faq-item.js +1 -1
  12. package/components/digi-footer.js +1 -1
  13. package/components/digi-form-category-filter.js +1 -1
  14. package/components/digi-form-checkbox.js +1 -1
  15. package/components/digi-form-error-list.js +3 -3
  16. package/components/digi-form-file-upload.js +1 -1
  17. package/components/digi-form-filter.js +2 -2
  18. package/components/digi-form-input-search.js +1 -1
  19. package/components/digi-form-radiobutton.js +1 -1
  20. package/components/digi-form-radiogroup.js +1 -1
  21. package/components/digi-form-receipt.js +1 -1
  22. package/components/digi-form-select-filter.js +3 -3
  23. package/components/digi-form-select.js +1 -1
  24. package/components/digi-header-avatar.js +1 -1
  25. package/components/digi-header-navigation.js +2 -2
  26. package/components/digi-header.js +3 -3
  27. package/components/digi-info-card.js +2 -2
  28. package/components/digi-link-internal.js +1 -1
  29. package/components/digi-logo.js +1 -1
  30. package/components/digi-navigation-pagination.js +2 -2
  31. package/components/digi-navigation-sidebar-button.js +1 -1
  32. package/components/digi-navigation-sidebar.js +1 -1
  33. package/components/digi-navigation-vertical-menu-item.js +1 -1
  34. package/components/digi-notification-alert.js +1 -1
  35. package/components/digi-notification-error-page.js +1 -1
  36. package/components/digi-progress-indicator.js +1 -1
  37. package/components/digi-quote.js +1 -1
  38. package/components/digi-tag.js +1 -1
  39. package/components/digi-title-logo.js +1 -1
  40. package/components/digi-tools-feedback.js +3 -3
  41. package/components/digi-tools-theme-provider.js +5 -18
  42. package/components/index.js +1 -1
  43. package/components/{p-a79e144f.js → p-2ac136a0.js} +1 -1
  44. package/components/{p-7d3fb535.js → p-44f143ea.js} +2 -2
  45. package/components/p-4bad4fb0.js +7 -0
  46. package/components/{p-e756fda7.js → p-62a0008b.js} +2 -2
  47. package/components/{p-29f63312.js → p-7ff04204.js} +2 -2
  48. package/components/p-8bdc6d6b.js +157 -0
  49. package/components/{p-117e7b18.js → p-9466c4e0.js} +1 -1
  50. package/components/p-9dd1da8c.js +177 -0
  51. package/components/p-b57677c1.js +66 -0
  52. package/components/p-e8fc33ed.js +165 -0
  53. package/components/{p-d2a95a3e.js → p-f53eb01a.js} +1 -1
  54. package/custom-elements.json +0 -4
  55. package/dist/cjs/button-size.enum-1fd86b9e.js +7 -0
  56. package/dist/cjs/button-type.enum-406723db.js +8 -0
  57. package/dist/cjs/{code-example-variation.enum-1611825e.js → code-example-variation.enum-c6557727.js} +0 -6
  58. package/dist/cjs/digi-arbetsformedlingen.cjs.js +1 -1
  59. package/dist/cjs/digi-button_2.cjs.entry.js +262 -0
  60. package/dist/cjs/digi-calendar-datepicker.cjs.entry.js +2603 -0
  61. package/dist/cjs/digi-calendar-week-view.cjs.entry.js +51 -50
  62. package/dist/cjs/digi-calendar_2.cjs.entry.js +464 -0
  63. package/dist/cjs/digi-code-block_3.cjs.entry.js +244 -0
  64. package/dist/cjs/digi-code-example.cjs.entry.js +5 -4
  65. package/dist/cjs/digi-dialog.cjs.entry.js +20 -6
  66. package/dist/cjs/digi-expandable-faq-item.cjs.entry.js +97 -0
  67. package/dist/cjs/digi-footer.cjs.entry.js +18 -4
  68. package/dist/cjs/digi-form-category-filter.cjs.entry.js +121 -0
  69. package/dist/cjs/digi-form-error-list.cjs.entry.js +18 -4
  70. package/dist/cjs/digi-form-file-upload.cjs.entry.js +11 -10
  71. package/dist/cjs/digi-form-input-search.cjs.entry.js +8 -6
  72. package/dist/cjs/digi-form-input.cjs.entry.js +194 -0
  73. package/dist/cjs/digi-form-label_3.cjs.entry.js +129 -0
  74. package/dist/cjs/digi-form-radiogroup.cjs.entry.js +80 -0
  75. package/dist/cjs/digi-form-receipt.cjs.entry.js +18 -4
  76. package/dist/cjs/digi-form-select-filter.cjs.entry.js +568 -0
  77. package/dist/cjs/digi-form-select_2.cjs.entry.js +186 -0
  78. package/dist/cjs/digi-header-avatar.cjs.entry.js +1 -1
  79. package/dist/cjs/digi-header-navigation.cjs.entry.js +18 -4
  80. package/dist/cjs/digi-header.cjs.entry.js +19 -5
  81. package/dist/cjs/digi-icon-check.cjs.entry.js +30 -0
  82. package/dist/cjs/digi-icon-chevron-down.cjs.entry.js +30 -0
  83. package/dist/cjs/digi-icon-chevron-left_2.cjs.entry.js +53 -0
  84. package/dist/cjs/digi-icon-copy.cjs.entry.js +30 -0
  85. package/dist/cjs/digi-icon-minus_2.cjs.entry.js +53 -0
  86. package/dist/cjs/digi-icon-validation-error_2.cjs.entry.js +53 -0
  87. package/dist/cjs/digi-info-card.cjs.entry.js +1 -1
  88. package/dist/cjs/digi-layout-block_2.cjs.entry.js +92 -0
  89. package/dist/cjs/digi-link-internal.cjs.entry.js +1 -1
  90. package/dist/cjs/digi-link.cjs.entry.js +75 -0
  91. package/dist/cjs/digi-navigation-pagination.cjs.entry.js +18 -4
  92. package/dist/cjs/digi-navigation-vertical-menu-item.cjs.entry.js +150 -0
  93. package/dist/cjs/digi-navigation-vertical-menu.cjs.entry.js +177 -0
  94. package/dist/cjs/digi-notification-alert.cjs.entry.js +18 -4
  95. package/dist/cjs/digi-notification-error-page.cjs.entry.js +18 -4
  96. package/dist/cjs/digi-progress-indicator.cjs.entry.js +137 -0
  97. package/dist/cjs/digi-quote.cjs.entry.js +1 -1
  98. package/dist/cjs/digi-title-logo.cjs.entry.js +18 -4
  99. package/dist/cjs/digi-tools-feedback.cjs.entry.js +21 -7
  100. package/dist/cjs/digi-tools-theme-provider.cjs.entry.js +28 -0
  101. package/dist/cjs/digi-typography-heading-jumbo.cjs.entry.js +38 -0
  102. package/dist/cjs/digi-typography-preamble.cjs.entry.js +20 -0
  103. package/dist/cjs/digi-typography.cjs.entry.js +26 -0
  104. package/dist/cjs/digi-util-keydown-handler.cjs.entry.js +83 -0
  105. package/dist/cjs/digi-util-mutation-observer.cjs.entry.js +64 -0
  106. package/dist/cjs/expandable-faq-item-variation.enum-89427195.js +18 -0
  107. package/dist/cjs/form-checkbox-variation.enum-d2ca879e.js +19 -0
  108. package/dist/cjs/{form-validation-message-variation.enum-c5ec3e2d.js → form-file-upload-variation.enum-634cfae8.js} +0 -7
  109. package/dist/cjs/form-input-search-variation.enum-c50239bc.js +8 -0
  110. package/dist/cjs/{form-input-type.enum-1fb2180a.js → form-input-type.enum-9c8ee12a.js} +0 -14
  111. package/dist/cjs/form-input-variation.enum-c750520c.js +29 -0
  112. package/dist/cjs/form-radiogroup-validation.enum-03a17d4d.js +9 -0
  113. package/dist/cjs/form-select-variation.enum-528c1bf0.js +16 -0
  114. package/dist/cjs/form-validation-message-variation.enum-855ae0be.js +8 -0
  115. package/dist/cjs/index-7a477838.js +108 -4
  116. package/dist/cjs/{index-acb7b350.js → index-ac8e01b4.js} +19 -189
  117. package/dist/cjs/index-cad91a90.js +66 -0
  118. package/dist/cjs/index-e8333bcc.js +174 -0
  119. package/dist/cjs/index.cjs.js +166 -158
  120. package/dist/cjs/layout-container-max-width.enum-7e637f44.js +21 -0
  121. package/dist/cjs/loader.cjs.js +1 -1
  122. package/dist/cjs/navigation-vertical-menu-variation.enum-c237edd3.js +13 -0
  123. package/dist/cjs/progress-indicator-variation.enum-7cf8e0e4.js +13 -0
  124. package/dist/cjs/tools-theme-provider.brand.enum-bc855272.js +7 -0
  125. package/dist/cjs/typography-heading-jumbo-variation.enum-8677e099.js +17 -0
  126. package/dist/cjs/{typography-variation.enum-e41bd69d.js → typography-variation.enum-50512a4e.js} +0 -158
  127. package/dist/collection/components/_button/button/button.css +6 -6
  128. package/dist/collection/components/_calendar/calendar/calendar.css +2 -7
  129. package/dist/collection/components/_calendar/calendar-datepicker/calendar-datepicker.css +102 -347
  130. package/dist/collection/components/_code/code-example/code-example.css +0 -6
  131. package/dist/collection/components/_dialog/dialog/dialog.css +1 -1
  132. package/dist/collection/components/_expandable/expandable-faq-item/expandable-faq-item.css +2 -2
  133. package/dist/collection/components/_form/form-checkbox/form-checkbox.css +110 -355
  134. package/dist/collection/components/_form/form-checkbox/form-checkbox.js +23 -3
  135. package/dist/collection/components/_form/form-file-upload/form-file-upload.css +3 -4
  136. package/dist/collection/components/_form/form-radiobutton/form-radiobutton.css +7 -2
  137. package/dist/collection/components/_form/form-radiobutton/form-radiobutton.js +23 -3
  138. package/dist/collection/components/_form/form-radiogroup/form-radiogroup.css +4 -0
  139. package/dist/collection/components/_form/form-select/form-select.css +2 -2
  140. package/dist/collection/components/_form/form-select-filter/form-select-filter.css +1 -1
  141. package/dist/collection/components/_header/header-avatar/header-avatar.css +101 -346
  142. package/dist/collection/components/_info-card/info-card/info-card.css +2 -2
  143. package/dist/collection/components/_link/link-internal/link-internal.css +101 -346
  144. package/dist/collection/components/_navigation/navigation-vertical-menu-item/navigation-vertical-menu-item.css +3 -3
  145. package/dist/collection/components/_progress/progress-indicator/progress-indicator.css +3 -4
  146. package/dist/collection/components/_quote/quote/quote.css +2 -2
  147. package/dist/collection/components/_tools/tools-feedback/tools-feedback.css +1 -1
  148. package/dist/collection/components/_tools/tools-theme-provider/tools-theme-provider.css +2 -113
  149. package/dist/collection/components/_tools/tools-theme-provider/tools-theme-provider.js +2 -43
  150. package/dist/collection/design-tokens/components/_button.variables.scss +6 -6
  151. package/dist/collection/design-tokens/components/_calendar-datepicker.variables.scss +1 -1
  152. package/dist/collection/design-tokens/components/_calendar.variables.scss +2 -3
  153. package/dist/collection/design-tokens/components/_dialog.variables.scss +1 -1
  154. package/dist/collection/design-tokens/components/_expandable-faq-item.variables.scss +2 -2
  155. package/dist/collection/design-tokens/components/_form-checkbox.variables.scss +1 -1
  156. package/dist/collection/design-tokens/components/_form-file-upload.variables.scss +0 -2
  157. package/dist/collection/design-tokens/components/_form-select-filter.variables.scss +1 -1
  158. package/dist/collection/design-tokens/components/_form-select.variables.scss +2 -2
  159. package/dist/collection/design-tokens/components/_info-card.variables.scss +2 -2
  160. package/dist/collection/design-tokens/components/_navigation-vertical-menu-item.variables.scss +3 -3
  161. package/dist/collection/design-tokens/components/_quote.variables.scss +2 -2
  162. package/dist/collection/design-tokens/components/_tools-feedback.variables.scss +1 -1
  163. package/dist/collection/enums.js +0 -1
  164. package/dist/collection/styles/src/_alias.mixin.scss +128 -274
  165. package/dist/collection/styles/src/themes/_common.mixin.scss +0 -7
  166. package/dist/collection/styles/src/themes/_theme-af25.mixin.scss +0 -143
  167. package/dist/collection/styles/src/tokens-documentation/web-AF25.json +764 -1647
  168. package/dist/digi-arbetsformedlingen/design-tokens/components/_button.variables.scss +6 -6
  169. package/dist/digi-arbetsformedlingen/design-tokens/components/_calendar-datepicker.variables.scss +1 -1
  170. package/dist/digi-arbetsformedlingen/design-tokens/components/_calendar.variables.scss +2 -3
  171. package/dist/digi-arbetsformedlingen/design-tokens/components/_dialog.variables.scss +1 -1
  172. package/dist/digi-arbetsformedlingen/design-tokens/components/_expandable-faq-item.variables.scss +2 -2
  173. package/dist/digi-arbetsformedlingen/design-tokens/components/_form-checkbox.variables.scss +1 -1
  174. package/dist/digi-arbetsformedlingen/design-tokens/components/_form-file-upload.variables.scss +0 -2
  175. package/dist/digi-arbetsformedlingen/design-tokens/components/_form-select-filter.variables.scss +1 -1
  176. package/dist/digi-arbetsformedlingen/design-tokens/components/_form-select.variables.scss +2 -2
  177. package/dist/digi-arbetsformedlingen/design-tokens/components/_info-card.variables.scss +2 -2
  178. package/dist/digi-arbetsformedlingen/design-tokens/components/_navigation-vertical-menu-item.variables.scss +3 -3
  179. package/dist/digi-arbetsformedlingen/design-tokens/components/_quote.variables.scss +2 -2
  180. package/dist/digi-arbetsformedlingen/design-tokens/components/_tools-feedback.variables.scss +1 -1
  181. package/dist/digi-arbetsformedlingen/digi-arbetsformedlingen.css +1 -1
  182. package/dist/digi-arbetsformedlingen/digi-arbetsformedlingen.esm.js +1 -1
  183. package/dist/digi-arbetsformedlingen/index.esm.js +1 -1
  184. package/dist/digi-arbetsformedlingen/p-00219e81.entry.js +1 -0
  185. package/dist/digi-arbetsformedlingen/p-07985aef.entry.js +1 -0
  186. package/dist/digi-arbetsformedlingen/p-19c30198.entry.js +1 -0
  187. package/dist/digi-arbetsformedlingen/p-1f3345e9.js +1 -0
  188. package/dist/digi-arbetsformedlingen/p-1f956af8.js +1 -0
  189. package/dist/digi-arbetsformedlingen/p-24fe2189.js +1 -0
  190. package/dist/digi-arbetsformedlingen/p-260620fe.entry.js +1 -0
  191. package/dist/digi-arbetsformedlingen/p-2693c1d8.entry.js +1 -0
  192. package/dist/digi-arbetsformedlingen/p-2698dd2a.entry.js +1 -0
  193. package/dist/digi-arbetsformedlingen/p-2a86cc73.entry.js +1 -0
  194. package/dist/digi-arbetsformedlingen/p-2b7b69cd.entry.js +1 -0
  195. package/dist/digi-arbetsformedlingen/p-300aa9ef.js +1 -0
  196. package/dist/digi-arbetsformedlingen/p-33349e7e.entry.js +1 -0
  197. package/dist/digi-arbetsformedlingen/p-38627816.entry.js +1 -0
  198. package/dist/digi-arbetsformedlingen/p-3a76bfde.entry.js +1 -0
  199. package/dist/digi-arbetsformedlingen/p-3b20ec86.js +1 -0
  200. package/dist/digi-arbetsformedlingen/p-3d7fff3c.entry.js +1 -0
  201. package/dist/digi-arbetsformedlingen/p-41bc039f.entry.js +1 -0
  202. package/dist/digi-arbetsformedlingen/p-4bad4fb0.js +1 -0
  203. package/dist/digi-arbetsformedlingen/p-4e36c467.entry.js +1 -0
  204. package/dist/digi-arbetsformedlingen/p-51149879.entry.js +1 -0
  205. package/dist/digi-arbetsformedlingen/p-55f525dd.entry.js +1 -0
  206. package/dist/digi-arbetsformedlingen/p-57319a80.entry.js +1 -0
  207. package/dist/digi-arbetsformedlingen/p-57a0cc63.entry.js +1 -0
  208. package/dist/digi-arbetsformedlingen/p-5a602122.js +1 -0
  209. package/dist/digi-arbetsformedlingen/p-5d3383f9.entry.js +1 -0
  210. package/dist/digi-arbetsformedlingen/p-681e7beb.entry.js +1 -0
  211. package/dist/digi-arbetsformedlingen/p-6bd60ab6.entry.js +1 -0
  212. package/dist/digi-arbetsformedlingen/p-6d864e79.entry.js +1 -0
  213. package/dist/digi-arbetsformedlingen/p-75309c9a.entry.js +1 -0
  214. package/dist/digi-arbetsformedlingen/p-78c99e87.entry.js +1 -0
  215. package/dist/digi-arbetsformedlingen/p-7933b555.js +1 -0
  216. package/dist/digi-arbetsformedlingen/p-7aacd45f.js +1 -0
  217. package/dist/digi-arbetsformedlingen/p-8142cc73.js +1 -0
  218. package/dist/digi-arbetsformedlingen/p-826ad49e.entry.js +1 -0
  219. package/dist/digi-arbetsformedlingen/p-88b4d03a.js +1 -0
  220. package/dist/digi-arbetsformedlingen/p-89b457e8.entry.js +1 -0
  221. package/dist/digi-arbetsformedlingen/p-905ccb30.js +1 -0
  222. package/dist/digi-arbetsformedlingen/p-93766b5e.entry.js +1 -0
  223. package/dist/digi-arbetsformedlingen/p-95330112.entry.js +1 -0
  224. package/dist/digi-arbetsformedlingen/p-96987381.entry.js +1 -0
  225. package/dist/digi-arbetsformedlingen/p-9a6ea3b7.entry.js +1 -0
  226. package/dist/digi-arbetsformedlingen/p-9b7f0707.entry.js +1 -0
  227. package/dist/digi-arbetsformedlingen/p-9dd5d6c8.js +1 -0
  228. package/dist/digi-arbetsformedlingen/p-a34dfc04.entry.js +1 -0
  229. package/dist/digi-arbetsformedlingen/p-bc3d2778.js +1 -0
  230. package/dist/digi-arbetsformedlingen/p-c24aab43.entry.js +1 -0
  231. package/dist/digi-arbetsformedlingen/p-c29ab968.entry.js +1 -0
  232. package/dist/digi-arbetsformedlingen/p-c461917d.entry.js +1 -0
  233. package/dist/digi-arbetsformedlingen/p-c7949525.js +1 -0
  234. package/dist/digi-arbetsformedlingen/p-cd50f570.entry.js +1 -0
  235. package/dist/digi-arbetsformedlingen/p-cdf86efc.js +1 -0
  236. package/dist/digi-arbetsformedlingen/p-d055d564.entry.js +1 -0
  237. package/dist/digi-arbetsformedlingen/p-d1886fff.js +1 -0
  238. package/dist/digi-arbetsformedlingen/p-d4145a3e.entry.js +1 -0
  239. package/dist/digi-arbetsformedlingen/p-d5376b7c.entry.js +1 -0
  240. package/dist/digi-arbetsformedlingen/p-d7aa8315.entry.js +1 -0
  241. package/dist/digi-arbetsformedlingen/p-dc9b6144.entry.js +1 -0
  242. package/dist/digi-arbetsformedlingen/p-e6b65415.entry.js +1 -0
  243. package/dist/digi-arbetsformedlingen/p-e7e39ee7.entry.js +1 -0
  244. package/dist/digi-arbetsformedlingen/p-e844d4cc.entry.js +1 -0
  245. package/dist/digi-arbetsformedlingen/p-e9abb2b1.entry.js +1 -0
  246. package/dist/digi-arbetsformedlingen/p-ee4cb21a.js +1 -0
  247. package/dist/digi-arbetsformedlingen/p-ee9589e6.js +1 -0
  248. package/dist/digi-arbetsformedlingen/p-f40f4b2a.js +1 -0
  249. package/dist/digi-arbetsformedlingen/p-f447b984.js +1 -0
  250. package/dist/digi-arbetsformedlingen/p-f8391f37.entry.js +1 -0
  251. package/dist/digi-arbetsformedlingen/p-fdecd798.entry.js +1 -0
  252. package/dist/digi-arbetsformedlingen/styles/src/_alias.mixin.scss +128 -274
  253. package/dist/digi-arbetsformedlingen/styles/src/themes/_common.mixin.scss +0 -7
  254. package/dist/digi-arbetsformedlingen/styles/src/themes/_theme-af25.mixin.scss +0 -143
  255. package/dist/digi-arbetsformedlingen/styles/src/tokens-documentation/web-AF25.json +764 -1647
  256. package/dist/esm/button-size.enum-d5ff6ff3.js +7 -0
  257. package/dist/esm/button-type.enum-5250ae0b.js +8 -0
  258. package/dist/esm/{code-example-variation.enum-e656d235.js → code-example-variation.enum-e9f9fced.js} +1 -7
  259. package/dist/esm/digi-arbetsformedlingen.js +1 -1
  260. package/dist/esm/digi-button_2.entry.js +257 -0
  261. package/dist/esm/digi-calendar-datepicker.entry.js +2599 -0
  262. package/dist/esm/digi-calendar-week-view.entry.js +2 -1
  263. package/dist/esm/digi-calendar_2.entry.js +459 -0
  264. package/dist/esm/digi-code-block_3.entry.js +238 -0
  265. package/dist/esm/digi-code-example.entry.js +3 -2
  266. package/dist/esm/digi-dialog.entry.js +19 -5
  267. package/dist/esm/digi-expandable-faq-item.entry.js +93 -0
  268. package/dist/esm/digi-footer.entry.js +18 -4
  269. package/dist/esm/digi-form-category-filter.entry.js +117 -0
  270. package/dist/esm/digi-form-error-list.entry.js +18 -4
  271. package/dist/esm/digi-form-file-upload.entry.js +3 -2
  272. package/dist/esm/digi-form-input-search.entry.js +3 -1
  273. package/dist/esm/digi-form-input.entry.js +190 -0
  274. package/dist/esm/digi-form-label_3.entry.js +123 -0
  275. package/dist/esm/digi-form-radiogroup.entry.js +76 -0
  276. package/dist/esm/digi-form-receipt.entry.js +18 -4
  277. package/dist/esm/digi-form-select-filter.entry.js +564 -0
  278. package/dist/esm/digi-form-select_2.entry.js +181 -0
  279. package/dist/esm/digi-header-avatar.entry.js +1 -1
  280. package/dist/esm/digi-header-navigation.entry.js +18 -4
  281. package/dist/esm/digi-header.entry.js +18 -4
  282. package/dist/esm/digi-icon-check.entry.js +26 -0
  283. package/dist/esm/digi-icon-chevron-down.entry.js +26 -0
  284. package/dist/esm/digi-icon-chevron-left_2.entry.js +48 -0
  285. package/dist/esm/digi-icon-copy.entry.js +26 -0
  286. package/dist/esm/digi-icon-minus_2.entry.js +48 -0
  287. package/dist/esm/digi-icon-validation-error_2.entry.js +48 -0
  288. package/dist/esm/digi-info-card.entry.js +1 -1
  289. package/dist/esm/digi-layout-block_2.entry.js +87 -0
  290. package/dist/esm/digi-link-internal.entry.js +1 -1
  291. package/dist/esm/digi-link.entry.js +71 -0
  292. package/dist/esm/digi-navigation-pagination.entry.js +18 -4
  293. package/dist/esm/digi-navigation-vertical-menu-item.entry.js +146 -0
  294. package/dist/esm/digi-navigation-vertical-menu.entry.js +173 -0
  295. package/dist/esm/digi-notification-alert.entry.js +18 -4
  296. package/dist/esm/digi-notification-error-page.entry.js +18 -4
  297. package/dist/esm/digi-progress-indicator.entry.js +133 -0
  298. package/dist/esm/digi-quote.entry.js +1 -1
  299. package/dist/esm/digi-title-logo.entry.js +18 -4
  300. package/dist/esm/digi-tools-feedback.entry.js +19 -5
  301. package/dist/esm/digi-tools-theme-provider.entry.js +24 -0
  302. package/dist/esm/digi-typography-heading-jumbo.entry.js +34 -0
  303. package/dist/esm/digi-typography-preamble.entry.js +16 -0
  304. package/dist/esm/digi-typography.entry.js +22 -0
  305. package/dist/esm/digi-util-keydown-handler.entry.js +79 -0
  306. package/dist/esm/digi-util-mutation-observer.entry.js +60 -0
  307. package/dist/esm/expandable-faq-item-variation.enum-a8cb225b.js +18 -0
  308. package/dist/esm/form-checkbox-variation.enum-83e906fc.js +19 -0
  309. package/dist/esm/{form-validation-message-variation.enum-f7835fc5.js → form-file-upload-variation.enum-9c49ec5e.js} +1 -8
  310. package/dist/esm/form-input-search-variation.enum-f9d669f2.js +8 -0
  311. package/dist/esm/{form-input-type.enum-a6bba983.js → form-input-type.enum-3da3db27.js} +1 -15
  312. package/dist/esm/form-input-variation.enum-64d9450f.js +29 -0
  313. package/dist/esm/form-radiogroup-validation.enum-d790fc66.js +9 -0
  314. package/dist/esm/form-select-variation.enum-f2f6098d.js +16 -0
  315. package/dist/esm/form-validation-message-variation.enum-bcef8a9d.js +8 -0
  316. package/dist/esm/index-148a7577.js +108 -4
  317. package/dist/esm/{index-dc6b83f7.js → index-2fce392f.js} +3 -170
  318. package/dist/esm/index-5b6c95c6.js +63 -0
  319. package/dist/esm/index-8685f88d.js +170 -0
  320. package/dist/esm/index.js +18 -4
  321. package/dist/esm/layout-container-max-width.enum-c40018ac.js +21 -0
  322. package/dist/esm/loader.js +1 -1
  323. package/dist/esm/navigation-vertical-menu-variation.enum-c30b0ea9.js +13 -0
  324. package/dist/esm/progress-indicator-variation.enum-b12ba50a.js +13 -0
  325. package/dist/esm/tools-theme-provider.brand.enum-8c5a98c9.js +7 -0
  326. package/dist/esm/typography-heading-jumbo-variation.enum-eb737f1b.js +17 -0
  327. package/dist/esm/{typography-variation.enum-b07f76c9.js → typography-variation.enum-8c3ff25c.js} +1 -159
  328. package/dist/types/components/_form/form-checkbox/form-checkbox.d.ts +8 -0
  329. package/dist/types/components/_form/form-radiobutton/form-radiobutton.d.ts +8 -0
  330. package/dist/types/components/_tools/tools-theme-provider/tools-theme-provider.d.ts +0 -9
  331. package/dist/types/components.d.ts +0 -12
  332. package/dist/types/enums.d.ts +0 -1
  333. package/hydrate/index.js +57 -48
  334. package/hydrate/index.mjs +57 -48
  335. package/package.json +1 -1
  336. package/components/p-0d568c4b.js +0 -66
  337. package/components/p-5fd00d55.js +0 -143
  338. package/components/p-606ba731.js +0 -165
  339. package/components/p-d7ef9cb1.js +0 -13
  340. package/components/p-f77cb7ae.js +0 -163
  341. package/dist/cjs/digi-button_38.cjs.entry.js +0 -5759
  342. package/dist/cjs/digi-code-block.cjs.entry.js +0 -89
  343. package/dist/collection/components/_tools/tools-theme-provider/tools-theme-provider.theme.enum.js +0 -5
  344. package/dist/digi-arbetsformedlingen/p-0f543000.entry.js +0 -1
  345. package/dist/digi-arbetsformedlingen/p-13120f18.entry.js +0 -1
  346. package/dist/digi-arbetsformedlingen/p-180663ef.entry.js +0 -1
  347. package/dist/digi-arbetsformedlingen/p-1a619dd3.entry.js +0 -1
  348. package/dist/digi-arbetsformedlingen/p-26e8ea70.entry.js +0 -1
  349. package/dist/digi-arbetsformedlingen/p-3887bb40.js +0 -1
  350. package/dist/digi-arbetsformedlingen/p-52a3c86a.entry.js +0 -1
  351. package/dist/digi-arbetsformedlingen/p-53d9556b.js +0 -1
  352. package/dist/digi-arbetsformedlingen/p-54d9bd3e.entry.js +0 -1
  353. package/dist/digi-arbetsformedlingen/p-5ca38506.entry.js +0 -1
  354. package/dist/digi-arbetsformedlingen/p-64b65586.entry.js +0 -1
  355. package/dist/digi-arbetsformedlingen/p-67e32cc2.entry.js +0 -1
  356. package/dist/digi-arbetsformedlingen/p-76ec3619.entry.js +0 -1
  357. package/dist/digi-arbetsformedlingen/p-780519ec.entry.js +0 -1
  358. package/dist/digi-arbetsformedlingen/p-800b764b.entry.js +0 -1
  359. package/dist/digi-arbetsformedlingen/p-82225661.entry.js +0 -1
  360. package/dist/digi-arbetsformedlingen/p-920aee36.entry.js +0 -1
  361. package/dist/digi-arbetsformedlingen/p-9b6e8cf8.entry.js +0 -1
  362. package/dist/digi-arbetsformedlingen/p-a105d9fe.js +0 -1
  363. package/dist/digi-arbetsformedlingen/p-c64b4626.js +0 -1
  364. package/dist/digi-arbetsformedlingen/p-d9bcab5f.entry.js +0 -1
  365. package/dist/digi-arbetsformedlingen/p-e540b80f.entry.js +0 -1
  366. package/dist/digi-arbetsformedlingen/p-e5fee242.js +0 -1
  367. package/dist/digi-arbetsformedlingen/p-e7ee9bea.entry.js +0 -1
  368. package/dist/digi-arbetsformedlingen/p-f601908d.entry.js +0 -1
  369. package/dist/digi-arbetsformedlingen/p-fa44ce49.entry.js +0 -1
  370. package/dist/esm/digi-button_38.entry.js +0 -5718
  371. package/dist/esm/digi-code-block.entry.js +0 -85
  372. package/dist/types/components/_tools/tools-theme-provider/tools-theme-provider.theme.enum.d.ts +0 -4
@@ -0,0 +1,2599 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-148a7577.js';
2
+ import { _ as _t } from './text-8f88c0f6.js';
3
+ import './badge-notification-shape.enum-e15a6245.js';
4
+ import { C as CalendarDatepickerValidation } from './typography-variation.enum-8c3ff25c.js';
5
+ import './badge-status-variation.enum-8d6370ff.js';
6
+ import './button-size.enum-d5ff6ff3.js';
7
+ import './button-type.enum-5250ae0b.js';
8
+ import './button-variation.enum-94fffdd6.js';
9
+ import './calendar-week-view-heading-level.enum-6774297c.js';
10
+ import './bar-chart-variation.enum-97c0b47f.js';
11
+ import './code-example-variation.enum-e9f9fced.js';
12
+ import './code-variation.enum-1eee7c7a.js';
13
+ import './expandable-accordion-header-level.enum-85681e2f.js';
14
+ import './expandable-faq-item-variation.enum-a8cb225b.js';
15
+ import './expandable-faq-variation.enum-6934c367.js';
16
+ import './footer-card-variation.enum-cc732148.js';
17
+ import './form-checkbox-variation.enum-83e906fc.js';
18
+ import './form-file-upload-variation.enum-9c49ec5e.js';
19
+ import './form-input-search-variation.enum-f9d669f2.js';
20
+ import './form-input-type.enum-3da3db27.js';
21
+ import { a as FormInputValidation } from './form-input-variation.enum-64d9450f.js';
22
+ import './form-radiogroup-validation.enum-d790fc66.js';
23
+ import './form-select-variation.enum-f2f6098d.js';
24
+ import './form-textarea-variation.enum-05017e8e.js';
25
+ import './form-validation-message-variation.enum-bcef8a9d.js';
26
+ import './info-card-multi-type.enum-07ee124f.js';
27
+ import './info-card-variation.enum-2ccc52c1.js';
28
+ import './layout-container-max-width.enum-c40018ac.js';
29
+ import './layout-block-variation.enum-b7a20db4.js';
30
+ import './layout-columns-variation.enum-34f7754e.js';
31
+ import './link-button-variation.enum-84d4976f.js';
32
+ import './list-type.enum-fbb331ad.js';
33
+ import './loader-skeleton-variation.enum-f9f867b4.js';
34
+ import './loader-spinner-size.enum-0b246fa0.js';
35
+ import './logo-variation.enum-5b68b79f.js';
36
+ import './media-figure-alignment.enum-a1d36567.js';
37
+ import './navigation-sidebar-variation.enum-8fead764.js';
38
+ import './navigation-vertical-menu-variation.enum-c30b0ea9.js';
39
+ import './progress-indicator-variation.enum-b12ba50a.js';
40
+ import './progress-list-item-variation.enum-384b9a3a.js';
41
+ import './progress-list-variation.enum-300bd89d.js';
42
+ import './progressbar-variation.enum-40adaab4.js';
43
+ import './quote-image-inner-position.enum-8e9b1e65.js';
44
+ import './table-variation.enum-dd9366b6.js';
45
+ import './tag-media-icon.enum-fefa191c.js';
46
+ import './tag-size.enum-403e0cd8.js';
47
+ import './tools-feedback-banner-type.enum-74b4e580.js';
48
+ import './tools-feedback-rating-variation.enum-29058ff2.js';
49
+ import './tools-theme-provider.brand.enum-8c5a98c9.js';
50
+ import './typography-heading-jumbo-variation.enum-eb737f1b.js';
51
+ import './typography-meta-variation.enum-1f7c2878.js';
52
+ import './typography-time-variation.enum-34c830ef.js';
53
+ import './util-breakpoint-observer-breakpoints.enum-6d004731.js';
54
+ import { r as randomIdGenerator } from './randomIdGenerator.util-56406f2e.js';
55
+ import { d as detectClickOutside } from './detectClickOutside.util-72594957.js';
56
+ import { r as requiredArgs, t as toDate, i as isValid } from './index-8685f88d.js';
57
+ import { t as toInteger, g as getUTCISOWeek, a as getUTCWeek, b as getUTCWeekYear, s as startOfUTCWeek, c as startOfUTCISOWeek, i as isProtectedWeekYearToken, d as throwProtectedError, e as isProtectedDayOfYearToken, f as subMilliseconds, h as getTimezoneOffsetInMilliseconds, j as defaultLocale, l as longFormatters } from './index-2fce392f.js';
58
+ import { i as isBefore, a as isAfter } from './index-5b6c95c6.js';
59
+ import './detectClosest.util-58a7504f.js';
60
+
61
+ function assign(target, dirtyObject) {
62
+ if (target == null) {
63
+ throw new TypeError('assign requires that input parameter not be null or undefined');
64
+ }
65
+
66
+ dirtyObject = dirtyObject || {};
67
+
68
+ for (var property in dirtyObject) {
69
+ if (Object.prototype.hasOwnProperty.call(dirtyObject, property)) {
70
+ target[property] = dirtyObject[property];
71
+ }
72
+ }
73
+
74
+ return target;
75
+ }
76
+
77
+ // See issue: https://github.com/date-fns/date-fns/issues/376
78
+
79
+ function setUTCDay(dirtyDate, dirtyDay, dirtyOptions) {
80
+ requiredArgs(2, arguments);
81
+ var options = dirtyOptions || {};
82
+ var locale = options.locale;
83
+ var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;
84
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
85
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
86
+
87
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
88
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
89
+ }
90
+
91
+ var date = toDate(dirtyDate);
92
+ var day = toInteger(dirtyDay);
93
+ var currentDay = date.getUTCDay();
94
+ var remainder = day % 7;
95
+ var dayIndex = (remainder + 7) % 7;
96
+ var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
97
+ date.setUTCDate(date.getUTCDate() + diff);
98
+ return date;
99
+ }
100
+
101
+ // See issue: https://github.com/date-fns/date-fns/issues/376
102
+
103
+ function setUTCISODay(dirtyDate, dirtyDay) {
104
+ requiredArgs(2, arguments);
105
+ var day = toInteger(dirtyDay);
106
+
107
+ if (day % 7 === 0) {
108
+ day = day - 7;
109
+ }
110
+
111
+ var weekStartsOn = 1;
112
+ var date = toDate(dirtyDate);
113
+ var currentDay = date.getUTCDay();
114
+ var remainder = day % 7;
115
+ var dayIndex = (remainder + 7) % 7;
116
+ var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;
117
+ date.setUTCDate(date.getUTCDate() + diff);
118
+ return date;
119
+ }
120
+
121
+ // See issue: https://github.com/date-fns/date-fns/issues/376
122
+
123
+ function setUTCISOWeek(dirtyDate, dirtyISOWeek) {
124
+ requiredArgs(2, arguments);
125
+ var date = toDate(dirtyDate);
126
+ var isoWeek = toInteger(dirtyISOWeek);
127
+ var diff = getUTCISOWeek(date) - isoWeek;
128
+ date.setUTCDate(date.getUTCDate() - diff * 7);
129
+ return date;
130
+ }
131
+
132
+ // See issue: https://github.com/date-fns/date-fns/issues/376
133
+
134
+ function setUTCWeek(dirtyDate, dirtyWeek, options) {
135
+ requiredArgs(2, arguments);
136
+ var date = toDate(dirtyDate);
137
+ var week = toInteger(dirtyWeek);
138
+ var diff = getUTCWeek(date, options) - week;
139
+ date.setUTCDate(date.getUTCDate() - diff * 7);
140
+ return date;
141
+ }
142
+
143
+ var MILLISECONDS_IN_HOUR = 3600000;
144
+ var MILLISECONDS_IN_MINUTE = 60000;
145
+ var MILLISECONDS_IN_SECOND = 1000;
146
+ var numericPatterns = {
147
+ month: /^(1[0-2]|0?\d)/,
148
+ // 0 to 12
149
+ date: /^(3[0-1]|[0-2]?\d)/,
150
+ // 0 to 31
151
+ dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
152
+ // 0 to 366
153
+ week: /^(5[0-3]|[0-4]?\d)/,
154
+ // 0 to 53
155
+ hour23h: /^(2[0-3]|[0-1]?\d)/,
156
+ // 0 to 23
157
+ hour24h: /^(2[0-4]|[0-1]?\d)/,
158
+ // 0 to 24
159
+ hour11h: /^(1[0-1]|0?\d)/,
160
+ // 0 to 11
161
+ hour12h: /^(1[0-2]|0?\d)/,
162
+ // 0 to 12
163
+ minute: /^[0-5]?\d/,
164
+ // 0 to 59
165
+ second: /^[0-5]?\d/,
166
+ // 0 to 59
167
+ singleDigit: /^\d/,
168
+ // 0 to 9
169
+ twoDigits: /^\d{1,2}/,
170
+ // 0 to 99
171
+ threeDigits: /^\d{1,3}/,
172
+ // 0 to 999
173
+ fourDigits: /^\d{1,4}/,
174
+ // 0 to 9999
175
+ anyDigitsSigned: /^-?\d+/,
176
+ singleDigitSigned: /^-?\d/,
177
+ // 0 to 9, -0 to -9
178
+ twoDigitsSigned: /^-?\d{1,2}/,
179
+ // 0 to 99, -0 to -99
180
+ threeDigitsSigned: /^-?\d{1,3}/,
181
+ // 0 to 999, -0 to -999
182
+ fourDigitsSigned: /^-?\d{1,4}/ // 0 to 9999, -0 to -9999
183
+
184
+ };
185
+ var timezonePatterns = {
186
+ basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
187
+ basic: /^([+-])(\d{2})(\d{2})|Z/,
188
+ basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
189
+ extended: /^([+-])(\d{2}):(\d{2})|Z/,
190
+ extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
191
+ };
192
+
193
+ function parseNumericPattern(pattern, string, valueCallback) {
194
+ var matchResult = string.match(pattern);
195
+
196
+ if (!matchResult) {
197
+ return null;
198
+ }
199
+
200
+ var value = parseInt(matchResult[0], 10);
201
+ return {
202
+ value: valueCallback ? valueCallback(value) : value,
203
+ rest: string.slice(matchResult[0].length)
204
+ };
205
+ }
206
+
207
+ function parseTimezonePattern(pattern, string) {
208
+ var matchResult = string.match(pattern);
209
+
210
+ if (!matchResult) {
211
+ return null;
212
+ } // Input is 'Z'
213
+
214
+
215
+ if (matchResult[0] === 'Z') {
216
+ return {
217
+ value: 0,
218
+ rest: string.slice(1)
219
+ };
220
+ }
221
+
222
+ var sign = matchResult[1] === '+' ? 1 : -1;
223
+ var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
224
+ var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
225
+ var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
226
+ return {
227
+ value: sign * (hours * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * MILLISECONDS_IN_SECOND),
228
+ rest: string.slice(matchResult[0].length)
229
+ };
230
+ }
231
+
232
+ function parseAnyDigitsSigned(string, valueCallback) {
233
+ return parseNumericPattern(numericPatterns.anyDigitsSigned, string, valueCallback);
234
+ }
235
+
236
+ function parseNDigits(n, string, valueCallback) {
237
+ switch (n) {
238
+ case 1:
239
+ return parseNumericPattern(numericPatterns.singleDigit, string, valueCallback);
240
+
241
+ case 2:
242
+ return parseNumericPattern(numericPatterns.twoDigits, string, valueCallback);
243
+
244
+ case 3:
245
+ return parseNumericPattern(numericPatterns.threeDigits, string, valueCallback);
246
+
247
+ case 4:
248
+ return parseNumericPattern(numericPatterns.fourDigits, string, valueCallback);
249
+
250
+ default:
251
+ return parseNumericPattern(new RegExp('^\\d{1,' + n + '}'), string, valueCallback);
252
+ }
253
+ }
254
+
255
+ function parseNDigitsSigned(n, string, valueCallback) {
256
+ switch (n) {
257
+ case 1:
258
+ return parseNumericPattern(numericPatterns.singleDigitSigned, string, valueCallback);
259
+
260
+ case 2:
261
+ return parseNumericPattern(numericPatterns.twoDigitsSigned, string, valueCallback);
262
+
263
+ case 3:
264
+ return parseNumericPattern(numericPatterns.threeDigitsSigned, string, valueCallback);
265
+
266
+ case 4:
267
+ return parseNumericPattern(numericPatterns.fourDigitsSigned, string, valueCallback);
268
+
269
+ default:
270
+ return parseNumericPattern(new RegExp('^-?\\d{1,' + n + '}'), string, valueCallback);
271
+ }
272
+ }
273
+
274
+ function dayPeriodEnumToHours(enumValue) {
275
+ switch (enumValue) {
276
+ case 'morning':
277
+ return 4;
278
+
279
+ case 'evening':
280
+ return 17;
281
+
282
+ case 'pm':
283
+ case 'noon':
284
+ case 'afternoon':
285
+ return 12;
286
+
287
+ case 'am':
288
+ case 'midnight':
289
+ case 'night':
290
+ default:
291
+ return 0;
292
+ }
293
+ }
294
+
295
+ function normalizeTwoDigitYear(twoDigitYear, currentYear) {
296
+ var isCommonEra = currentYear > 0; // Absolute number of the current year:
297
+ // 1 -> 1 AC
298
+ // 0 -> 1 BC
299
+ // -1 -> 2 BC
300
+
301
+ var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
302
+ var result;
303
+
304
+ if (absCurrentYear <= 50) {
305
+ result = twoDigitYear || 100;
306
+ } else {
307
+ var rangeEnd = absCurrentYear + 50;
308
+ var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;
309
+ var isPreviousCentury = twoDigitYear >= rangeEnd % 100;
310
+ result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
311
+ }
312
+
313
+ return isCommonEra ? result : 1 - result;
314
+ }
315
+
316
+ var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
317
+ var DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // User for validation
318
+
319
+ function isLeapYearIndex(year) {
320
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
321
+ }
322
+ /*
323
+ * | | Unit | | Unit |
324
+ * |-----|--------------------------------|-----|--------------------------------|
325
+ * | a | AM, PM | A* | Milliseconds in day |
326
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
327
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
328
+ * | d | Day of month | D | Day of year |
329
+ * | e | Local day of week | E | Day of week |
330
+ * | f | | F* | Day of week in month |
331
+ * | g* | Modified Julian day | G | Era |
332
+ * | h | Hour [1-12] | H | Hour [0-23] |
333
+ * | i! | ISO day of week | I! | ISO week of year |
334
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
335
+ * | k | Hour [1-24] | K | Hour [0-11] |
336
+ * | l* | (deprecated) | L | Stand-alone month |
337
+ * | m | Minute | M | Month |
338
+ * | n | | N | |
339
+ * | o! | Ordinal number modifier | O* | Timezone (GMT) |
340
+ * | p | | P | |
341
+ * | q | Stand-alone quarter | Q | Quarter |
342
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
343
+ * | s | Second | S | Fraction of second |
344
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
345
+ * | u | Extended year | U* | Cyclic year |
346
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
347
+ * | w | Local week of year | W* | Week of month |
348
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
349
+ * | y | Year (abs) | Y | Local week-numbering year |
350
+ * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
351
+ *
352
+ * Letters marked by * are not implemented but reserved by Unicode standard.
353
+ *
354
+ * Letters marked by ! are non-standard, but implemented by date-fns:
355
+ * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)
356
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
357
+ * i.e. 7 for Sunday, 1 for Monday, etc.
358
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
359
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
360
+ * `R` is supposed to be used in conjunction with `I` and `i`
361
+ * for universal ISO week-numbering date, whereas
362
+ * `Y` is supposed to be used in conjunction with `w` and `e`
363
+ * for week-numbering date specific to the locale.
364
+ */
365
+
366
+
367
+ var parsers = {
368
+ // Era
369
+ G: {
370
+ priority: 140,
371
+ parse: function (string, token, match, _options) {
372
+ switch (token) {
373
+ // AD, BC
374
+ case 'G':
375
+ case 'GG':
376
+ case 'GGG':
377
+ return match.era(string, {
378
+ width: 'abbreviated'
379
+ }) || match.era(string, {
380
+ width: 'narrow'
381
+ });
382
+ // A, B
383
+
384
+ case 'GGGGG':
385
+ return match.era(string, {
386
+ width: 'narrow'
387
+ });
388
+ // Anno Domini, Before Christ
389
+
390
+ case 'GGGG':
391
+ default:
392
+ return match.era(string, {
393
+ width: 'wide'
394
+ }) || match.era(string, {
395
+ width: 'abbreviated'
396
+ }) || match.era(string, {
397
+ width: 'narrow'
398
+ });
399
+ }
400
+ },
401
+ set: function (date, flags, value, _options) {
402
+ flags.era = value;
403
+ date.setUTCFullYear(value, 0, 1);
404
+ date.setUTCHours(0, 0, 0, 0);
405
+ return date;
406
+ },
407
+ incompatibleTokens: ['R', 'u', 't', 'T']
408
+ },
409
+ // Year
410
+ y: {
411
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns
412
+ // | Year | y | yy | yyy | yyyy | yyyyy |
413
+ // |----------|-------|----|-------|-------|-------|
414
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
415
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
416
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
417
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
418
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
419
+ priority: 130,
420
+ parse: function (string, token, match, _options) {
421
+ var valueCallback = function (year) {
422
+ return {
423
+ year: year,
424
+ isTwoDigitYear: token === 'yy'
425
+ };
426
+ };
427
+
428
+ switch (token) {
429
+ case 'y':
430
+ return parseNDigits(4, string, valueCallback);
431
+
432
+ case 'yo':
433
+ return match.ordinalNumber(string, {
434
+ unit: 'year',
435
+ valueCallback: valueCallback
436
+ });
437
+
438
+ default:
439
+ return parseNDigits(token.length, string, valueCallback);
440
+ }
441
+ },
442
+ validate: function (_date, value, _options) {
443
+ return value.isTwoDigitYear || value.year > 0;
444
+ },
445
+ set: function (date, flags, value, _options) {
446
+ var currentYear = date.getUTCFullYear();
447
+
448
+ if (value.isTwoDigitYear) {
449
+ var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
450
+ date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);
451
+ date.setUTCHours(0, 0, 0, 0);
452
+ return date;
453
+ }
454
+
455
+ var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
456
+ date.setUTCFullYear(year, 0, 1);
457
+ date.setUTCHours(0, 0, 0, 0);
458
+ return date;
459
+ },
460
+ incompatibleTokens: ['Y', 'R', 'u', 'w', 'I', 'i', 'e', 'c', 't', 'T']
461
+ },
462
+ // Local week-numbering year
463
+ Y: {
464
+ priority: 130,
465
+ parse: function (string, token, match, _options) {
466
+ var valueCallback = function (year) {
467
+ return {
468
+ year: year,
469
+ isTwoDigitYear: token === 'YY'
470
+ };
471
+ };
472
+
473
+ switch (token) {
474
+ case 'Y':
475
+ return parseNDigits(4, string, valueCallback);
476
+
477
+ case 'Yo':
478
+ return match.ordinalNumber(string, {
479
+ unit: 'year',
480
+ valueCallback: valueCallback
481
+ });
482
+
483
+ default:
484
+ return parseNDigits(token.length, string, valueCallback);
485
+ }
486
+ },
487
+ validate: function (_date, value, _options) {
488
+ return value.isTwoDigitYear || value.year > 0;
489
+ },
490
+ set: function (date, flags, value, options) {
491
+ var currentYear = getUTCWeekYear(date, options);
492
+
493
+ if (value.isTwoDigitYear) {
494
+ var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
495
+ date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);
496
+ date.setUTCHours(0, 0, 0, 0);
497
+ return startOfUTCWeek(date, options);
498
+ }
499
+
500
+ var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;
501
+ date.setUTCFullYear(year, 0, options.firstWeekContainsDate);
502
+ date.setUTCHours(0, 0, 0, 0);
503
+ return startOfUTCWeek(date, options);
504
+ },
505
+ incompatibleTokens: ['y', 'R', 'u', 'Q', 'q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']
506
+ },
507
+ // ISO week-numbering year
508
+ R: {
509
+ priority: 130,
510
+ parse: function (string, token, _match, _options) {
511
+ if (token === 'R') {
512
+ return parseNDigitsSigned(4, string);
513
+ }
514
+
515
+ return parseNDigitsSigned(token.length, string);
516
+ },
517
+ set: function (_date, _flags, value, _options) {
518
+ var firstWeekOfYear = new Date(0);
519
+ firstWeekOfYear.setUTCFullYear(value, 0, 4);
520
+ firstWeekOfYear.setUTCHours(0, 0, 0, 0);
521
+ return startOfUTCISOWeek(firstWeekOfYear);
522
+ },
523
+ incompatibleTokens: ['G', 'y', 'Y', 'u', 'Q', 'q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']
524
+ },
525
+ // Extended year
526
+ u: {
527
+ priority: 130,
528
+ parse: function (string, token, _match, _options) {
529
+ if (token === 'u') {
530
+ return parseNDigitsSigned(4, string);
531
+ }
532
+
533
+ return parseNDigitsSigned(token.length, string);
534
+ },
535
+ set: function (date, _flags, value, _options) {
536
+ date.setUTCFullYear(value, 0, 1);
537
+ date.setUTCHours(0, 0, 0, 0);
538
+ return date;
539
+ },
540
+ incompatibleTokens: ['G', 'y', 'Y', 'R', 'w', 'I', 'i', 'e', 'c', 't', 'T']
541
+ },
542
+ // Quarter
543
+ Q: {
544
+ priority: 120,
545
+ parse: function (string, token, match, _options) {
546
+ switch (token) {
547
+ // 1, 2, 3, 4
548
+ case 'Q':
549
+ case 'QQ':
550
+ // 01, 02, 03, 04
551
+ return parseNDigits(token.length, string);
552
+ // 1st, 2nd, 3rd, 4th
553
+
554
+ case 'Qo':
555
+ return match.ordinalNumber(string, {
556
+ unit: 'quarter'
557
+ });
558
+ // Q1, Q2, Q3, Q4
559
+
560
+ case 'QQQ':
561
+ return match.quarter(string, {
562
+ width: 'abbreviated',
563
+ context: 'formatting'
564
+ }) || match.quarter(string, {
565
+ width: 'narrow',
566
+ context: 'formatting'
567
+ });
568
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
569
+
570
+ case 'QQQQQ':
571
+ return match.quarter(string, {
572
+ width: 'narrow',
573
+ context: 'formatting'
574
+ });
575
+ // 1st quarter, 2nd quarter, ...
576
+
577
+ case 'QQQQ':
578
+ default:
579
+ return match.quarter(string, {
580
+ width: 'wide',
581
+ context: 'formatting'
582
+ }) || match.quarter(string, {
583
+ width: 'abbreviated',
584
+ context: 'formatting'
585
+ }) || match.quarter(string, {
586
+ width: 'narrow',
587
+ context: 'formatting'
588
+ });
589
+ }
590
+ },
591
+ validate: function (_date, value, _options) {
592
+ return value >= 1 && value <= 4;
593
+ },
594
+ set: function (date, _flags, value, _options) {
595
+ date.setUTCMonth((value - 1) * 3, 1);
596
+ date.setUTCHours(0, 0, 0, 0);
597
+ return date;
598
+ },
599
+ incompatibleTokens: ['Y', 'R', 'q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']
600
+ },
601
+ // Stand-alone quarter
602
+ q: {
603
+ priority: 120,
604
+ parse: function (string, token, match, _options) {
605
+ switch (token) {
606
+ // 1, 2, 3, 4
607
+ case 'q':
608
+ case 'qq':
609
+ // 01, 02, 03, 04
610
+ return parseNDigits(token.length, string);
611
+ // 1st, 2nd, 3rd, 4th
612
+
613
+ case 'qo':
614
+ return match.ordinalNumber(string, {
615
+ unit: 'quarter'
616
+ });
617
+ // Q1, Q2, Q3, Q4
618
+
619
+ case 'qqq':
620
+ return match.quarter(string, {
621
+ width: 'abbreviated',
622
+ context: 'standalone'
623
+ }) || match.quarter(string, {
624
+ width: 'narrow',
625
+ context: 'standalone'
626
+ });
627
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
628
+
629
+ case 'qqqqq':
630
+ return match.quarter(string, {
631
+ width: 'narrow',
632
+ context: 'standalone'
633
+ });
634
+ // 1st quarter, 2nd quarter, ...
635
+
636
+ case 'qqqq':
637
+ default:
638
+ return match.quarter(string, {
639
+ width: 'wide',
640
+ context: 'standalone'
641
+ }) || match.quarter(string, {
642
+ width: 'abbreviated',
643
+ context: 'standalone'
644
+ }) || match.quarter(string, {
645
+ width: 'narrow',
646
+ context: 'standalone'
647
+ });
648
+ }
649
+ },
650
+ validate: function (_date, value, _options) {
651
+ return value >= 1 && value <= 4;
652
+ },
653
+ set: function (date, _flags, value, _options) {
654
+ date.setUTCMonth((value - 1) * 3, 1);
655
+ date.setUTCHours(0, 0, 0, 0);
656
+ return date;
657
+ },
658
+ incompatibleTokens: ['Y', 'R', 'Q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']
659
+ },
660
+ // Month
661
+ M: {
662
+ priority: 110,
663
+ parse: function (string, token, match, _options) {
664
+ var valueCallback = function (value) {
665
+ return value - 1;
666
+ };
667
+
668
+ switch (token) {
669
+ // 1, 2, ..., 12
670
+ case 'M':
671
+ return parseNumericPattern(numericPatterns.month, string, valueCallback);
672
+ // 01, 02, ..., 12
673
+
674
+ case 'MM':
675
+ return parseNDigits(2, string, valueCallback);
676
+ // 1st, 2nd, ..., 12th
677
+
678
+ case 'Mo':
679
+ return match.ordinalNumber(string, {
680
+ unit: 'month',
681
+ valueCallback: valueCallback
682
+ });
683
+ // Jan, Feb, ..., Dec
684
+
685
+ case 'MMM':
686
+ return match.month(string, {
687
+ width: 'abbreviated',
688
+ context: 'formatting'
689
+ }) || match.month(string, {
690
+ width: 'narrow',
691
+ context: 'formatting'
692
+ });
693
+ // J, F, ..., D
694
+
695
+ case 'MMMMM':
696
+ return match.month(string, {
697
+ width: 'narrow',
698
+ context: 'formatting'
699
+ });
700
+ // January, February, ..., December
701
+
702
+ case 'MMMM':
703
+ default:
704
+ return match.month(string, {
705
+ width: 'wide',
706
+ context: 'formatting'
707
+ }) || match.month(string, {
708
+ width: 'abbreviated',
709
+ context: 'formatting'
710
+ }) || match.month(string, {
711
+ width: 'narrow',
712
+ context: 'formatting'
713
+ });
714
+ }
715
+ },
716
+ validate: function (_date, value, _options) {
717
+ return value >= 0 && value <= 11;
718
+ },
719
+ set: function (date, _flags, value, _options) {
720
+ date.setUTCMonth(value, 1);
721
+ date.setUTCHours(0, 0, 0, 0);
722
+ return date;
723
+ },
724
+ incompatibleTokens: ['Y', 'R', 'q', 'Q', 'L', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']
725
+ },
726
+ // Stand-alone month
727
+ L: {
728
+ priority: 110,
729
+ parse: function (string, token, match, _options) {
730
+ var valueCallback = function (value) {
731
+ return value - 1;
732
+ };
733
+
734
+ switch (token) {
735
+ // 1, 2, ..., 12
736
+ case 'L':
737
+ return parseNumericPattern(numericPatterns.month, string, valueCallback);
738
+ // 01, 02, ..., 12
739
+
740
+ case 'LL':
741
+ return parseNDigits(2, string, valueCallback);
742
+ // 1st, 2nd, ..., 12th
743
+
744
+ case 'Lo':
745
+ return match.ordinalNumber(string, {
746
+ unit: 'month',
747
+ valueCallback: valueCallback
748
+ });
749
+ // Jan, Feb, ..., Dec
750
+
751
+ case 'LLL':
752
+ return match.month(string, {
753
+ width: 'abbreviated',
754
+ context: 'standalone'
755
+ }) || match.month(string, {
756
+ width: 'narrow',
757
+ context: 'standalone'
758
+ });
759
+ // J, F, ..., D
760
+
761
+ case 'LLLLL':
762
+ return match.month(string, {
763
+ width: 'narrow',
764
+ context: 'standalone'
765
+ });
766
+ // January, February, ..., December
767
+
768
+ case 'LLLL':
769
+ default:
770
+ return match.month(string, {
771
+ width: 'wide',
772
+ context: 'standalone'
773
+ }) || match.month(string, {
774
+ width: 'abbreviated',
775
+ context: 'standalone'
776
+ }) || match.month(string, {
777
+ width: 'narrow',
778
+ context: 'standalone'
779
+ });
780
+ }
781
+ },
782
+ validate: function (_date, value, _options) {
783
+ return value >= 0 && value <= 11;
784
+ },
785
+ set: function (date, _flags, value, _options) {
786
+ date.setUTCMonth(value, 1);
787
+ date.setUTCHours(0, 0, 0, 0);
788
+ return date;
789
+ },
790
+ incompatibleTokens: ['Y', 'R', 'q', 'Q', 'M', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']
791
+ },
792
+ // Local week of year
793
+ w: {
794
+ priority: 100,
795
+ parse: function (string, token, match, _options) {
796
+ switch (token) {
797
+ case 'w':
798
+ return parseNumericPattern(numericPatterns.week, string);
799
+
800
+ case 'wo':
801
+ return match.ordinalNumber(string, {
802
+ unit: 'week'
803
+ });
804
+
805
+ default:
806
+ return parseNDigits(token.length, string);
807
+ }
808
+ },
809
+ validate: function (_date, value, _options) {
810
+ return value >= 1 && value <= 53;
811
+ },
812
+ set: function (date, _flags, value, options) {
813
+ return startOfUTCWeek(setUTCWeek(date, value, options), options);
814
+ },
815
+ incompatibleTokens: ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']
816
+ },
817
+ // ISO week of year
818
+ I: {
819
+ priority: 100,
820
+ parse: function (string, token, match, _options) {
821
+ switch (token) {
822
+ case 'I':
823
+ return parseNumericPattern(numericPatterns.week, string);
824
+
825
+ case 'Io':
826
+ return match.ordinalNumber(string, {
827
+ unit: 'week'
828
+ });
829
+
830
+ default:
831
+ return parseNDigits(token.length, string);
832
+ }
833
+ },
834
+ validate: function (_date, value, _options) {
835
+ return value >= 1 && value <= 53;
836
+ },
837
+ set: function (date, _flags, value, options) {
838
+ return startOfUTCISOWeek(setUTCISOWeek(date, value, options), options);
839
+ },
840
+ incompatibleTokens: ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']
841
+ },
842
+ // Day of the month
843
+ d: {
844
+ priority: 90,
845
+ subPriority: 1,
846
+ parse: function (string, token, match, _options) {
847
+ switch (token) {
848
+ case 'd':
849
+ return parseNumericPattern(numericPatterns.date, string);
850
+
851
+ case 'do':
852
+ return match.ordinalNumber(string, {
853
+ unit: 'date'
854
+ });
855
+
856
+ default:
857
+ return parseNDigits(token.length, string);
858
+ }
859
+ },
860
+ validate: function (date, value, _options) {
861
+ var year = date.getUTCFullYear();
862
+ var isLeapYear = isLeapYearIndex(year);
863
+ var month = date.getUTCMonth();
864
+
865
+ if (isLeapYear) {
866
+ return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
867
+ } else {
868
+ return value >= 1 && value <= DAYS_IN_MONTH[month];
869
+ }
870
+ },
871
+ set: function (date, _flags, value, _options) {
872
+ date.setUTCDate(value);
873
+ date.setUTCHours(0, 0, 0, 0);
874
+ return date;
875
+ },
876
+ incompatibleTokens: ['Y', 'R', 'q', 'Q', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']
877
+ },
878
+ // Day of year
879
+ D: {
880
+ priority: 90,
881
+ subPriority: 1,
882
+ parse: function (string, token, match, _options) {
883
+ switch (token) {
884
+ case 'D':
885
+ case 'DD':
886
+ return parseNumericPattern(numericPatterns.dayOfYear, string);
887
+
888
+ case 'Do':
889
+ return match.ordinalNumber(string, {
890
+ unit: 'date'
891
+ });
892
+
893
+ default:
894
+ return parseNDigits(token.length, string);
895
+ }
896
+ },
897
+ validate: function (date, value, _options) {
898
+ var year = date.getUTCFullYear();
899
+ var isLeapYear = isLeapYearIndex(year);
900
+
901
+ if (isLeapYear) {
902
+ return value >= 1 && value <= 366;
903
+ } else {
904
+ return value >= 1 && value <= 365;
905
+ }
906
+ },
907
+ set: function (date, _flags, value, _options) {
908
+ date.setUTCMonth(0, value);
909
+ date.setUTCHours(0, 0, 0, 0);
910
+ return date;
911
+ },
912
+ incompatibleTokens: ['Y', 'R', 'q', 'Q', 'M', 'L', 'w', 'I', 'd', 'E', 'i', 'e', 'c', 't', 'T']
913
+ },
914
+ // Day of week
915
+ E: {
916
+ priority: 90,
917
+ parse: function (string, token, match, _options) {
918
+ switch (token) {
919
+ // Tue
920
+ case 'E':
921
+ case 'EE':
922
+ case 'EEE':
923
+ return match.day(string, {
924
+ width: 'abbreviated',
925
+ context: 'formatting'
926
+ }) || match.day(string, {
927
+ width: 'short',
928
+ context: 'formatting'
929
+ }) || match.day(string, {
930
+ width: 'narrow',
931
+ context: 'formatting'
932
+ });
933
+ // T
934
+
935
+ case 'EEEEE':
936
+ return match.day(string, {
937
+ width: 'narrow',
938
+ context: 'formatting'
939
+ });
940
+ // Tu
941
+
942
+ case 'EEEEEE':
943
+ return match.day(string, {
944
+ width: 'short',
945
+ context: 'formatting'
946
+ }) || match.day(string, {
947
+ width: 'narrow',
948
+ context: 'formatting'
949
+ });
950
+ // Tuesday
951
+
952
+ case 'EEEE':
953
+ default:
954
+ return match.day(string, {
955
+ width: 'wide',
956
+ context: 'formatting'
957
+ }) || match.day(string, {
958
+ width: 'abbreviated',
959
+ context: 'formatting'
960
+ }) || match.day(string, {
961
+ width: 'short',
962
+ context: 'formatting'
963
+ }) || match.day(string, {
964
+ width: 'narrow',
965
+ context: 'formatting'
966
+ });
967
+ }
968
+ },
969
+ validate: function (_date, value, _options) {
970
+ return value >= 0 && value <= 6;
971
+ },
972
+ set: function (date, _flags, value, options) {
973
+ date = setUTCDay(date, value, options);
974
+ date.setUTCHours(0, 0, 0, 0);
975
+ return date;
976
+ },
977
+ incompatibleTokens: ['D', 'i', 'e', 'c', 't', 'T']
978
+ },
979
+ // Local day of week
980
+ e: {
981
+ priority: 90,
982
+ parse: function (string, token, match, options) {
983
+ var valueCallback = function (value) {
984
+ var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
985
+ return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
986
+ };
987
+
988
+ switch (token) {
989
+ // 3
990
+ case 'e':
991
+ case 'ee':
992
+ // 03
993
+ return parseNDigits(token.length, string, valueCallback);
994
+ // 3rd
995
+
996
+ case 'eo':
997
+ return match.ordinalNumber(string, {
998
+ unit: 'day',
999
+ valueCallback: valueCallback
1000
+ });
1001
+ // Tue
1002
+
1003
+ case 'eee':
1004
+ return match.day(string, {
1005
+ width: 'abbreviated',
1006
+ context: 'formatting'
1007
+ }) || match.day(string, {
1008
+ width: 'short',
1009
+ context: 'formatting'
1010
+ }) || match.day(string, {
1011
+ width: 'narrow',
1012
+ context: 'formatting'
1013
+ });
1014
+ // T
1015
+
1016
+ case 'eeeee':
1017
+ return match.day(string, {
1018
+ width: 'narrow',
1019
+ context: 'formatting'
1020
+ });
1021
+ // Tu
1022
+
1023
+ case 'eeeeee':
1024
+ return match.day(string, {
1025
+ width: 'short',
1026
+ context: 'formatting'
1027
+ }) || match.day(string, {
1028
+ width: 'narrow',
1029
+ context: 'formatting'
1030
+ });
1031
+ // Tuesday
1032
+
1033
+ case 'eeee':
1034
+ default:
1035
+ return match.day(string, {
1036
+ width: 'wide',
1037
+ context: 'formatting'
1038
+ }) || match.day(string, {
1039
+ width: 'abbreviated',
1040
+ context: 'formatting'
1041
+ }) || match.day(string, {
1042
+ width: 'short',
1043
+ context: 'formatting'
1044
+ }) || match.day(string, {
1045
+ width: 'narrow',
1046
+ context: 'formatting'
1047
+ });
1048
+ }
1049
+ },
1050
+ validate: function (_date, value, _options) {
1051
+ return value >= 0 && value <= 6;
1052
+ },
1053
+ set: function (date, _flags, value, options) {
1054
+ date = setUTCDay(date, value, options);
1055
+ date.setUTCHours(0, 0, 0, 0);
1056
+ return date;
1057
+ },
1058
+ incompatibleTokens: ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'c', 't', 'T']
1059
+ },
1060
+ // Stand-alone local day of week
1061
+ c: {
1062
+ priority: 90,
1063
+ parse: function (string, token, match, options) {
1064
+ var valueCallback = function (value) {
1065
+ var wholeWeekDays = Math.floor((value - 1) / 7) * 7;
1066
+ return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
1067
+ };
1068
+
1069
+ switch (token) {
1070
+ // 3
1071
+ case 'c':
1072
+ case 'cc':
1073
+ // 03
1074
+ return parseNDigits(token.length, string, valueCallback);
1075
+ // 3rd
1076
+
1077
+ case 'co':
1078
+ return match.ordinalNumber(string, {
1079
+ unit: 'day',
1080
+ valueCallback: valueCallback
1081
+ });
1082
+ // Tue
1083
+
1084
+ case 'ccc':
1085
+ return match.day(string, {
1086
+ width: 'abbreviated',
1087
+ context: 'standalone'
1088
+ }) || match.day(string, {
1089
+ width: 'short',
1090
+ context: 'standalone'
1091
+ }) || match.day(string, {
1092
+ width: 'narrow',
1093
+ context: 'standalone'
1094
+ });
1095
+ // T
1096
+
1097
+ case 'ccccc':
1098
+ return match.day(string, {
1099
+ width: 'narrow',
1100
+ context: 'standalone'
1101
+ });
1102
+ // Tu
1103
+
1104
+ case 'cccccc':
1105
+ return match.day(string, {
1106
+ width: 'short',
1107
+ context: 'standalone'
1108
+ }) || match.day(string, {
1109
+ width: 'narrow',
1110
+ context: 'standalone'
1111
+ });
1112
+ // Tuesday
1113
+
1114
+ case 'cccc':
1115
+ default:
1116
+ return match.day(string, {
1117
+ width: 'wide',
1118
+ context: 'standalone'
1119
+ }) || match.day(string, {
1120
+ width: 'abbreviated',
1121
+ context: 'standalone'
1122
+ }) || match.day(string, {
1123
+ width: 'short',
1124
+ context: 'standalone'
1125
+ }) || match.day(string, {
1126
+ width: 'narrow',
1127
+ context: 'standalone'
1128
+ });
1129
+ }
1130
+ },
1131
+ validate: function (_date, value, _options) {
1132
+ return value >= 0 && value <= 6;
1133
+ },
1134
+ set: function (date, _flags, value, options) {
1135
+ date = setUTCDay(date, value, options);
1136
+ date.setUTCHours(0, 0, 0, 0);
1137
+ return date;
1138
+ },
1139
+ incompatibleTokens: ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'e', 't', 'T']
1140
+ },
1141
+ // ISO day of week
1142
+ i: {
1143
+ priority: 90,
1144
+ parse: function (string, token, match, _options) {
1145
+ var valueCallback = function (value) {
1146
+ if (value === 0) {
1147
+ return 7;
1148
+ }
1149
+
1150
+ return value;
1151
+ };
1152
+
1153
+ switch (token) {
1154
+ // 2
1155
+ case 'i':
1156
+ case 'ii':
1157
+ // 02
1158
+ return parseNDigits(token.length, string);
1159
+ // 2nd
1160
+
1161
+ case 'io':
1162
+ return match.ordinalNumber(string, {
1163
+ unit: 'day'
1164
+ });
1165
+ // Tue
1166
+
1167
+ case 'iii':
1168
+ return match.day(string, {
1169
+ width: 'abbreviated',
1170
+ context: 'formatting',
1171
+ valueCallback: valueCallback
1172
+ }) || match.day(string, {
1173
+ width: 'short',
1174
+ context: 'formatting',
1175
+ valueCallback: valueCallback
1176
+ }) || match.day(string, {
1177
+ width: 'narrow',
1178
+ context: 'formatting',
1179
+ valueCallback: valueCallback
1180
+ });
1181
+ // T
1182
+
1183
+ case 'iiiii':
1184
+ return match.day(string, {
1185
+ width: 'narrow',
1186
+ context: 'formatting',
1187
+ valueCallback: valueCallback
1188
+ });
1189
+ // Tu
1190
+
1191
+ case 'iiiiii':
1192
+ return match.day(string, {
1193
+ width: 'short',
1194
+ context: 'formatting',
1195
+ valueCallback: valueCallback
1196
+ }) || match.day(string, {
1197
+ width: 'narrow',
1198
+ context: 'formatting',
1199
+ valueCallback: valueCallback
1200
+ });
1201
+ // Tuesday
1202
+
1203
+ case 'iiii':
1204
+ default:
1205
+ return match.day(string, {
1206
+ width: 'wide',
1207
+ context: 'formatting',
1208
+ valueCallback: valueCallback
1209
+ }) || match.day(string, {
1210
+ width: 'abbreviated',
1211
+ context: 'formatting',
1212
+ valueCallback: valueCallback
1213
+ }) || match.day(string, {
1214
+ width: 'short',
1215
+ context: 'formatting',
1216
+ valueCallback: valueCallback
1217
+ }) || match.day(string, {
1218
+ width: 'narrow',
1219
+ context: 'formatting',
1220
+ valueCallback: valueCallback
1221
+ });
1222
+ }
1223
+ },
1224
+ validate: function (_date, value, _options) {
1225
+ return value >= 1 && value <= 7;
1226
+ },
1227
+ set: function (date, _flags, value, options) {
1228
+ date = setUTCISODay(date, value, options);
1229
+ date.setUTCHours(0, 0, 0, 0);
1230
+ return date;
1231
+ },
1232
+ incompatibleTokens: ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'E', 'e', 'c', 't', 'T']
1233
+ },
1234
+ // AM or PM
1235
+ a: {
1236
+ priority: 80,
1237
+ parse: function (string, token, match, _options) {
1238
+ switch (token) {
1239
+ case 'a':
1240
+ case 'aa':
1241
+ case 'aaa':
1242
+ return match.dayPeriod(string, {
1243
+ width: 'abbreviated',
1244
+ context: 'formatting'
1245
+ }) || match.dayPeriod(string, {
1246
+ width: 'narrow',
1247
+ context: 'formatting'
1248
+ });
1249
+
1250
+ case 'aaaaa':
1251
+ return match.dayPeriod(string, {
1252
+ width: 'narrow',
1253
+ context: 'formatting'
1254
+ });
1255
+
1256
+ case 'aaaa':
1257
+ default:
1258
+ return match.dayPeriod(string, {
1259
+ width: 'wide',
1260
+ context: 'formatting'
1261
+ }) || match.dayPeriod(string, {
1262
+ width: 'abbreviated',
1263
+ context: 'formatting'
1264
+ }) || match.dayPeriod(string, {
1265
+ width: 'narrow',
1266
+ context: 'formatting'
1267
+ });
1268
+ }
1269
+ },
1270
+ set: function (date, _flags, value, _options) {
1271
+ date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
1272
+ return date;
1273
+ },
1274
+ incompatibleTokens: ['b', 'B', 'H', 'K', 'k', 't', 'T']
1275
+ },
1276
+ // AM, PM, midnight
1277
+ b: {
1278
+ priority: 80,
1279
+ parse: function (string, token, match, _options) {
1280
+ switch (token) {
1281
+ case 'b':
1282
+ case 'bb':
1283
+ case 'bbb':
1284
+ return match.dayPeriod(string, {
1285
+ width: 'abbreviated',
1286
+ context: 'formatting'
1287
+ }) || match.dayPeriod(string, {
1288
+ width: 'narrow',
1289
+ context: 'formatting'
1290
+ });
1291
+
1292
+ case 'bbbbb':
1293
+ return match.dayPeriod(string, {
1294
+ width: 'narrow',
1295
+ context: 'formatting'
1296
+ });
1297
+
1298
+ case 'bbbb':
1299
+ default:
1300
+ return match.dayPeriod(string, {
1301
+ width: 'wide',
1302
+ context: 'formatting'
1303
+ }) || match.dayPeriod(string, {
1304
+ width: 'abbreviated',
1305
+ context: 'formatting'
1306
+ }) || match.dayPeriod(string, {
1307
+ width: 'narrow',
1308
+ context: 'formatting'
1309
+ });
1310
+ }
1311
+ },
1312
+ set: function (date, _flags, value, _options) {
1313
+ date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
1314
+ return date;
1315
+ },
1316
+ incompatibleTokens: ['a', 'B', 'H', 'K', 'k', 't', 'T']
1317
+ },
1318
+ // in the morning, in the afternoon, in the evening, at night
1319
+ B: {
1320
+ priority: 80,
1321
+ parse: function (string, token, match, _options) {
1322
+ switch (token) {
1323
+ case 'B':
1324
+ case 'BB':
1325
+ case 'BBB':
1326
+ return match.dayPeriod(string, {
1327
+ width: 'abbreviated',
1328
+ context: 'formatting'
1329
+ }) || match.dayPeriod(string, {
1330
+ width: 'narrow',
1331
+ context: 'formatting'
1332
+ });
1333
+
1334
+ case 'BBBBB':
1335
+ return match.dayPeriod(string, {
1336
+ width: 'narrow',
1337
+ context: 'formatting'
1338
+ });
1339
+
1340
+ case 'BBBB':
1341
+ default:
1342
+ return match.dayPeriod(string, {
1343
+ width: 'wide',
1344
+ context: 'formatting'
1345
+ }) || match.dayPeriod(string, {
1346
+ width: 'abbreviated',
1347
+ context: 'formatting'
1348
+ }) || match.dayPeriod(string, {
1349
+ width: 'narrow',
1350
+ context: 'formatting'
1351
+ });
1352
+ }
1353
+ },
1354
+ set: function (date, _flags, value, _options) {
1355
+ date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);
1356
+ return date;
1357
+ },
1358
+ incompatibleTokens: ['a', 'b', 't', 'T']
1359
+ },
1360
+ // Hour [1-12]
1361
+ h: {
1362
+ priority: 70,
1363
+ parse: function (string, token, match, _options) {
1364
+ switch (token) {
1365
+ case 'h':
1366
+ return parseNumericPattern(numericPatterns.hour12h, string);
1367
+
1368
+ case 'ho':
1369
+ return match.ordinalNumber(string, {
1370
+ unit: 'hour'
1371
+ });
1372
+
1373
+ default:
1374
+ return parseNDigits(token.length, string);
1375
+ }
1376
+ },
1377
+ validate: function (_date, value, _options) {
1378
+ return value >= 1 && value <= 12;
1379
+ },
1380
+ set: function (date, _flags, value, _options) {
1381
+ var isPM = date.getUTCHours() >= 12;
1382
+
1383
+ if (isPM && value < 12) {
1384
+ date.setUTCHours(value + 12, 0, 0, 0);
1385
+ } else if (!isPM && value === 12) {
1386
+ date.setUTCHours(0, 0, 0, 0);
1387
+ } else {
1388
+ date.setUTCHours(value, 0, 0, 0);
1389
+ }
1390
+
1391
+ return date;
1392
+ },
1393
+ incompatibleTokens: ['H', 'K', 'k', 't', 'T']
1394
+ },
1395
+ // Hour [0-23]
1396
+ H: {
1397
+ priority: 70,
1398
+ parse: function (string, token, match, _options) {
1399
+ switch (token) {
1400
+ case 'H':
1401
+ return parseNumericPattern(numericPatterns.hour23h, string);
1402
+
1403
+ case 'Ho':
1404
+ return match.ordinalNumber(string, {
1405
+ unit: 'hour'
1406
+ });
1407
+
1408
+ default:
1409
+ return parseNDigits(token.length, string);
1410
+ }
1411
+ },
1412
+ validate: function (_date, value, _options) {
1413
+ return value >= 0 && value <= 23;
1414
+ },
1415
+ set: function (date, _flags, value, _options) {
1416
+ date.setUTCHours(value, 0, 0, 0);
1417
+ return date;
1418
+ },
1419
+ incompatibleTokens: ['a', 'b', 'h', 'K', 'k', 't', 'T']
1420
+ },
1421
+ // Hour [0-11]
1422
+ K: {
1423
+ priority: 70,
1424
+ parse: function (string, token, match, _options) {
1425
+ switch (token) {
1426
+ case 'K':
1427
+ return parseNumericPattern(numericPatterns.hour11h, string);
1428
+
1429
+ case 'Ko':
1430
+ return match.ordinalNumber(string, {
1431
+ unit: 'hour'
1432
+ });
1433
+
1434
+ default:
1435
+ return parseNDigits(token.length, string);
1436
+ }
1437
+ },
1438
+ validate: function (_date, value, _options) {
1439
+ return value >= 0 && value <= 11;
1440
+ },
1441
+ set: function (date, _flags, value, _options) {
1442
+ var isPM = date.getUTCHours() >= 12;
1443
+
1444
+ if (isPM && value < 12) {
1445
+ date.setUTCHours(value + 12, 0, 0, 0);
1446
+ } else {
1447
+ date.setUTCHours(value, 0, 0, 0);
1448
+ }
1449
+
1450
+ return date;
1451
+ },
1452
+ incompatibleTokens: ['a', 'b', 'h', 'H', 'k', 't', 'T']
1453
+ },
1454
+ // Hour [1-24]
1455
+ k: {
1456
+ priority: 70,
1457
+ parse: function (string, token, match, _options) {
1458
+ switch (token) {
1459
+ case 'k':
1460
+ return parseNumericPattern(numericPatterns.hour24h, string);
1461
+
1462
+ case 'ko':
1463
+ return match.ordinalNumber(string, {
1464
+ unit: 'hour'
1465
+ });
1466
+
1467
+ default:
1468
+ return parseNDigits(token.length, string);
1469
+ }
1470
+ },
1471
+ validate: function (_date, value, _options) {
1472
+ return value >= 1 && value <= 24;
1473
+ },
1474
+ set: function (date, _flags, value, _options) {
1475
+ var hours = value <= 24 ? value % 24 : value;
1476
+ date.setUTCHours(hours, 0, 0, 0);
1477
+ return date;
1478
+ },
1479
+ incompatibleTokens: ['a', 'b', 'h', 'H', 'K', 't', 'T']
1480
+ },
1481
+ // Minute
1482
+ m: {
1483
+ priority: 60,
1484
+ parse: function (string, token, match, _options) {
1485
+ switch (token) {
1486
+ case 'm':
1487
+ return parseNumericPattern(numericPatterns.minute, string);
1488
+
1489
+ case 'mo':
1490
+ return match.ordinalNumber(string, {
1491
+ unit: 'minute'
1492
+ });
1493
+
1494
+ default:
1495
+ return parseNDigits(token.length, string);
1496
+ }
1497
+ },
1498
+ validate: function (_date, value, _options) {
1499
+ return value >= 0 && value <= 59;
1500
+ },
1501
+ set: function (date, _flags, value, _options) {
1502
+ date.setUTCMinutes(value, 0, 0);
1503
+ return date;
1504
+ },
1505
+ incompatibleTokens: ['t', 'T']
1506
+ },
1507
+ // Second
1508
+ s: {
1509
+ priority: 50,
1510
+ parse: function (string, token, match, _options) {
1511
+ switch (token) {
1512
+ case 's':
1513
+ return parseNumericPattern(numericPatterns.second, string);
1514
+
1515
+ case 'so':
1516
+ return match.ordinalNumber(string, {
1517
+ unit: 'second'
1518
+ });
1519
+
1520
+ default:
1521
+ return parseNDigits(token.length, string);
1522
+ }
1523
+ },
1524
+ validate: function (_date, value, _options) {
1525
+ return value >= 0 && value <= 59;
1526
+ },
1527
+ set: function (date, _flags, value, _options) {
1528
+ date.setUTCSeconds(value, 0);
1529
+ return date;
1530
+ },
1531
+ incompatibleTokens: ['t', 'T']
1532
+ },
1533
+ // Fraction of second
1534
+ S: {
1535
+ priority: 30,
1536
+ parse: function (string, token, _match, _options) {
1537
+ var valueCallback = function (value) {
1538
+ return Math.floor(value * Math.pow(10, -token.length + 3));
1539
+ };
1540
+
1541
+ return parseNDigits(token.length, string, valueCallback);
1542
+ },
1543
+ set: function (date, _flags, value, _options) {
1544
+ date.setUTCMilliseconds(value);
1545
+ return date;
1546
+ },
1547
+ incompatibleTokens: ['t', 'T']
1548
+ },
1549
+ // Timezone (ISO-8601. +00:00 is `'Z'`)
1550
+ X: {
1551
+ priority: 10,
1552
+ parse: function (string, token, _match, _options) {
1553
+ switch (token) {
1554
+ case 'X':
1555
+ return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string);
1556
+
1557
+ case 'XX':
1558
+ return parseTimezonePattern(timezonePatterns.basic, string);
1559
+
1560
+ case 'XXXX':
1561
+ return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string);
1562
+
1563
+ case 'XXXXX':
1564
+ return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string);
1565
+
1566
+ case 'XXX':
1567
+ default:
1568
+ return parseTimezonePattern(timezonePatterns.extended, string);
1569
+ }
1570
+ },
1571
+ set: function (date, flags, value, _options) {
1572
+ if (flags.timestampIsSet) {
1573
+ return date;
1574
+ }
1575
+
1576
+ return new Date(date.getTime() - value);
1577
+ },
1578
+ incompatibleTokens: ['t', 'T', 'x']
1579
+ },
1580
+ // Timezone (ISO-8601)
1581
+ x: {
1582
+ priority: 10,
1583
+ parse: function (string, token, _match, _options) {
1584
+ switch (token) {
1585
+ case 'x':
1586
+ return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string);
1587
+
1588
+ case 'xx':
1589
+ return parseTimezonePattern(timezonePatterns.basic, string);
1590
+
1591
+ case 'xxxx':
1592
+ return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string);
1593
+
1594
+ case 'xxxxx':
1595
+ return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string);
1596
+
1597
+ case 'xxx':
1598
+ default:
1599
+ return parseTimezonePattern(timezonePatterns.extended, string);
1600
+ }
1601
+ },
1602
+ set: function (date, flags, value, _options) {
1603
+ if (flags.timestampIsSet) {
1604
+ return date;
1605
+ }
1606
+
1607
+ return new Date(date.getTime() - value);
1608
+ },
1609
+ incompatibleTokens: ['t', 'T', 'X']
1610
+ },
1611
+ // Seconds timestamp
1612
+ t: {
1613
+ priority: 40,
1614
+ parse: function (string, _token, _match, _options) {
1615
+ return parseAnyDigitsSigned(string);
1616
+ },
1617
+ set: function (_date, _flags, value, _options) {
1618
+ return [new Date(value * 1000), {
1619
+ timestampIsSet: true
1620
+ }];
1621
+ },
1622
+ incompatibleTokens: '*'
1623
+ },
1624
+ // Milliseconds timestamp
1625
+ T: {
1626
+ priority: 20,
1627
+ parse: function (string, _token, _match, _options) {
1628
+ return parseAnyDigitsSigned(string);
1629
+ },
1630
+ set: function (_date, _flags, value, _options) {
1631
+ return [new Date(value), {
1632
+ timestampIsSet: true
1633
+ }];
1634
+ },
1635
+ incompatibleTokens: '*'
1636
+ }
1637
+ };
1638
+ const parsers$1 = parsers;
1639
+
1640
+ var TIMEZONE_UNIT_PRIORITY = 10; // This RegExp consists of three parts separated by `|`:
1641
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
1642
+ // (one of the certain letters followed by `o`)
1643
+ // - (\w)\1* matches any sequences of the same letter
1644
+ // - '' matches two quote characters in a row
1645
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
1646
+ // except a single quote symbol, which ends the sequence.
1647
+ // Two quote characters do not end the sequence.
1648
+ // If there is no matching single quote
1649
+ // then the sequence will continue until the end of the string.
1650
+ // - . matches any single character unmatched by previous parts of the RegExps
1651
+
1652
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
1653
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
1654
+
1655
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
1656
+ var escapedStringRegExp = /^'([^]*?)'?$/;
1657
+ var doubleQuoteRegExp = /''/g;
1658
+ var notWhitespaceRegExp = /\S/;
1659
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
1660
+ /**
1661
+ * @name parse
1662
+ * @category Common Helpers
1663
+ * @summary Parse the date.
1664
+ *
1665
+ * @description
1666
+ * Return the date parsed from string using the given format string.
1667
+ *
1668
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
1669
+ * > See: https://git.io/fxCyr
1670
+ *
1671
+ * The characters in the format string wrapped between two single quotes characters (') are escaped.
1672
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
1673
+ *
1674
+ * Format of the format string is based on Unicode Technical Standard #35:
1675
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
1676
+ * with a few additions (see note 5 below the table).
1677
+ *
1678
+ * Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited
1679
+ * and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:
1680
+ *
1681
+ * ```javascript
1682
+ * parse('23 AM', 'HH a', new Date())
1683
+ * //=> RangeError: The format string mustn't contain `HH` and `a` at the same time
1684
+ * ```
1685
+ *
1686
+ * See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true
1687
+ *
1688
+ * Accepted format string patterns:
1689
+ * | Unit |Prior| Pattern | Result examples | Notes |
1690
+ * |---------------------------------|-----|---------|-----------------------------------|-------|
1691
+ * | Era | 140 | G..GGG | AD, BC | |
1692
+ * | | | GGGG | Anno Domini, Before Christ | 2 |
1693
+ * | | | GGGGG | A, B | |
1694
+ * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |
1695
+ * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |
1696
+ * | | | yy | 44, 01, 00, 17 | 4 |
1697
+ * | | | yyy | 044, 001, 123, 999 | 4 |
1698
+ * | | | yyyy | 0044, 0001, 1900, 2017 | 4 |
1699
+ * | | | yyyyy | ... | 2,4 |
1700
+ * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |
1701
+ * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |
1702
+ * | | | YY | 44, 01, 00, 17 | 4,6 |
1703
+ * | | | YYY | 044, 001, 123, 999 | 4 |
1704
+ * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |
1705
+ * | | | YYYYY | ... | 2,4 |
1706
+ * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |
1707
+ * | | | RR | -43, 01, 00, 17 | 4,5 |
1708
+ * | | | RRR | -043, 001, 123, 999, -999 | 4,5 |
1709
+ * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |
1710
+ * | | | RRRRR | ... | 2,4,5 |
1711
+ * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |
1712
+ * | | | uu | -43, 01, 99, -99 | 4 |
1713
+ * | | | uuu | -043, 001, 123, 999, -999 | 4 |
1714
+ * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |
1715
+ * | | | uuuuu | ... | 2,4 |
1716
+ * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |
1717
+ * | | | Qo | 1st, 2nd, 3rd, 4th | 5 |
1718
+ * | | | QQ | 01, 02, 03, 04 | |
1719
+ * | | | QQQ | Q1, Q2, Q3, Q4 | |
1720
+ * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
1721
+ * | | | QQQQQ | 1, 2, 3, 4 | 4 |
1722
+ * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |
1723
+ * | | | qo | 1st, 2nd, 3rd, 4th | 5 |
1724
+ * | | | qq | 01, 02, 03, 04 | |
1725
+ * | | | qqq | Q1, Q2, Q3, Q4 | |
1726
+ * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
1727
+ * | | | qqqqq | 1, 2, 3, 4 | 3 |
1728
+ * | Month (formatting) | 110 | M | 1, 2, ..., 12 | |
1729
+ * | | | Mo | 1st, 2nd, ..., 12th | 5 |
1730
+ * | | | MM | 01, 02, ..., 12 | |
1731
+ * | | | MMM | Jan, Feb, ..., Dec | |
1732
+ * | | | MMMM | January, February, ..., December | 2 |
1733
+ * | | | MMMMM | J, F, ..., D | |
1734
+ * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |
1735
+ * | | | Lo | 1st, 2nd, ..., 12th | 5 |
1736
+ * | | | LL | 01, 02, ..., 12 | |
1737
+ * | | | LLL | Jan, Feb, ..., Dec | |
1738
+ * | | | LLLL | January, February, ..., December | 2 |
1739
+ * | | | LLLLL | J, F, ..., D | |
1740
+ * | Local week of year | 100 | w | 1, 2, ..., 53 | |
1741
+ * | | | wo | 1st, 2nd, ..., 53th | 5 |
1742
+ * | | | ww | 01, 02, ..., 53 | |
1743
+ * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |
1744
+ * | | | Io | 1st, 2nd, ..., 53th | 5 |
1745
+ * | | | II | 01, 02, ..., 53 | 5 |
1746
+ * | Day of month | 90 | d | 1, 2, ..., 31 | |
1747
+ * | | | do | 1st, 2nd, ..., 31st | 5 |
1748
+ * | | | dd | 01, 02, ..., 31 | |
1749
+ * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |
1750
+ * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |
1751
+ * | | | DD | 01, 02, ..., 365, 366 | 7 |
1752
+ * | | | DDD | 001, 002, ..., 365, 366 | |
1753
+ * | | | DDDD | ... | 2 |
1754
+ * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |
1755
+ * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
1756
+ * | | | EEEEE | M, T, W, T, F, S, S | |
1757
+ * | | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
1758
+ * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |
1759
+ * | | | io | 1st, 2nd, ..., 7th | 5 |
1760
+ * | | | ii | 01, 02, ..., 07 | 5 |
1761
+ * | | | iii | Mon, Tue, Wed, ..., Sun | 5 |
1762
+ * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |
1763
+ * | | | iiiii | M, T, W, T, F, S, S | 5 |
1764
+ * | | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 5 |
1765
+ * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |
1766
+ * | | | eo | 2nd, 3rd, ..., 1st | 5 |
1767
+ * | | | ee | 02, 03, ..., 01 | |
1768
+ * | | | eee | Mon, Tue, Wed, ..., Sun | |
1769
+ * | | | eeee | Monday, Tuesday, ..., Sunday | 2 |
1770
+ * | | | eeeee | M, T, W, T, F, S, S | |
1771
+ * | | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
1772
+ * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |
1773
+ * | | | co | 2nd, 3rd, ..., 1st | 5 |
1774
+ * | | | cc | 02, 03, ..., 01 | |
1775
+ * | | | ccc | Mon, Tue, Wed, ..., Sun | |
1776
+ * | | | cccc | Monday, Tuesday, ..., Sunday | 2 |
1777
+ * | | | ccccc | M, T, W, T, F, S, S | |
1778
+ * | | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
1779
+ * | AM, PM | 80 | a..aaa | AM, PM | |
1780
+ * | | | aaaa | a.m., p.m. | 2 |
1781
+ * | | | aaaaa | a, p | |
1782
+ * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |
1783
+ * | | | bbbb | a.m., p.m., noon, midnight | 2 |
1784
+ * | | | bbbbb | a, p, n, mi | |
1785
+ * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |
1786
+ * | | | BBBB | at night, in the morning, ... | 2 |
1787
+ * | | | BBBBB | at night, in the morning, ... | |
1788
+ * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |
1789
+ * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |
1790
+ * | | | hh | 01, 02, ..., 11, 12 | |
1791
+ * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |
1792
+ * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |
1793
+ * | | | HH | 00, 01, 02, ..., 23 | |
1794
+ * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |
1795
+ * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |
1796
+ * | | | KK | 01, 02, ..., 11, 00 | |
1797
+ * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |
1798
+ * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |
1799
+ * | | | kk | 24, 01, 02, ..., 23 | |
1800
+ * | Minute | 60 | m | 0, 1, ..., 59 | |
1801
+ * | | | mo | 0th, 1st, ..., 59th | 5 |
1802
+ * | | | mm | 00, 01, ..., 59 | |
1803
+ * | Second | 50 | s | 0, 1, ..., 59 | |
1804
+ * | | | so | 0th, 1st, ..., 59th | 5 |
1805
+ * | | | ss | 00, 01, ..., 59 | |
1806
+ * | Seconds timestamp | 40 | t | 512969520 | |
1807
+ * | | | tt | ... | 2 |
1808
+ * | Fraction of second | 30 | S | 0, 1, ..., 9 | |
1809
+ * | | | SS | 00, 01, ..., 99 | |
1810
+ * | | | SSS | 000, 0001, ..., 999 | |
1811
+ * | | | SSSS | ... | 2 |
1812
+ * | Milliseconds timestamp | 20 | T | 512969520900 | |
1813
+ * | | | TT | ... | 2 |
1814
+ * | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |
1815
+ * | | | XX | -0800, +0530, Z | |
1816
+ * | | | XXX | -08:00, +05:30, Z | |
1817
+ * | | | XXXX | -0800, +0530, Z, +123456 | 2 |
1818
+ * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
1819
+ * | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |
1820
+ * | | | xx | -0800, +0530, +0000 | |
1821
+ * | | | xxx | -08:00, +05:30, +00:00 | 2 |
1822
+ * | | | xxxx | -0800, +0530, +0000, +123456 | |
1823
+ * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
1824
+ * | Long localized date | NA | P | 05/29/1453 | 5,8 |
1825
+ * | | | PP | May 29, 1453 | |
1826
+ * | | | PPP | May 29th, 1453 | |
1827
+ * | | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |
1828
+ * | Long localized time | NA | p | 12:00 AM | 5,8 |
1829
+ * | | | pp | 12:00:00 AM | |
1830
+ * | Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |
1831
+ * | | | PPpp | May 29, 1453, 12:00:00 AM | |
1832
+ * | | | PPPpp | May 29th, 1453 at ... | |
1833
+ * | | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |
1834
+ * Notes:
1835
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
1836
+ * are the same as "stand-alone" units, but are different in some languages.
1837
+ * "Formatting" units are declined according to the rules of the language
1838
+ * in the context of a date. "Stand-alone" units are always nominative singular.
1839
+ * In `format` function, they will produce different result:
1840
+ *
1841
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
1842
+ *
1843
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
1844
+ *
1845
+ * `parse` will try to match both formatting and stand-alone units interchangably.
1846
+ *
1847
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
1848
+ * the single quote characters (see below).
1849
+ * If the sequence is longer than listed in table:
1850
+ * - for numerical units (`yyyyyyyy`) `parse` will try to match a number
1851
+ * as wide as the sequence
1852
+ * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.
1853
+ * These variations are marked with "2" in the last column of the table.
1854
+ *
1855
+ * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
1856
+ * These tokens represent the shortest form of the quarter.
1857
+ *
1858
+ * 4. The main difference between `y` and `u` patterns are B.C. years:
1859
+ *
1860
+ * | Year | `y` | `u` |
1861
+ * |------|-----|-----|
1862
+ * | AC 1 | 1 | 1 |
1863
+ * | BC 1 | 1 | 0 |
1864
+ * | BC 2 | 2 | -1 |
1865
+ *
1866
+ * Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:
1867
+ *
1868
+ * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`
1869
+ *
1870
+ * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`
1871
+ *
1872
+ * while `uu` will just assign the year as is:
1873
+ *
1874
+ * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`
1875
+ *
1876
+ * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`
1877
+ *
1878
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
1879
+ * except local week-numbering years are dependent on `options.weekStartsOn`
1880
+ * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}
1881
+ * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).
1882
+ *
1883
+ * 5. These patterns are not in the Unicode Technical Standard #35:
1884
+ * - `i`: ISO day of week
1885
+ * - `I`: ISO week of year
1886
+ * - `R`: ISO week-numbering year
1887
+ * - `o`: ordinal number modifier
1888
+ * - `P`: long localized date
1889
+ * - `p`: long localized time
1890
+ *
1891
+ * 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
1892
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr
1893
+ *
1894
+ * 7. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
1895
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr
1896
+ *
1897
+ * 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based
1898
+ * on the given locale.
1899
+ *
1900
+ * using `en-US` locale: `P` => `MM/dd/yyyy`
1901
+ * using `en-US` locale: `p` => `hh:mm a`
1902
+ * using `pt-BR` locale: `P` => `dd/MM/yyyy`
1903
+ * using `pt-BR` locale: `p` => `HH:mm`
1904
+ *
1905
+ * Values will be assigned to the date in the descending order of its unit's priority.
1906
+ * Units of an equal priority overwrite each other in the order of appearance.
1907
+ *
1908
+ * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),
1909
+ * the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.
1910
+ *
1911
+ * `referenceDate` must be passed for correct work of the function.
1912
+ * If you're not sure which `referenceDate` to supply, create a new instance of Date:
1913
+ * `parse('02/11/2014', 'MM/dd/yyyy', new Date())`
1914
+ * In this case parsing will be done in the context of the current date.
1915
+ * If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,
1916
+ * then `Invalid Date` will be returned.
1917
+ *
1918
+ * The result may vary by locale.
1919
+ *
1920
+ * If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.
1921
+ *
1922
+ * If parsing failed, `Invalid Date` will be returned.
1923
+ * Invalid Date is a Date, whose time value is NaN.
1924
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
1925
+ *
1926
+ * ### v2.0.0 breaking changes:
1927
+ *
1928
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
1929
+ *
1930
+ * - Old `parse` was renamed to `toDate`.
1931
+ * Now `parse` is a new function which parses a string using a provided format.
1932
+ *
1933
+ * ```javascript
1934
+ * // Before v2.0.0
1935
+ * parse('2016-01-01')
1936
+ *
1937
+ * // v2.0.0 onward (toDate no longer accepts a string)
1938
+ * toDate(1392098430000) // Unix to timestamp
1939
+ * toDate(new Date(2014, 1, 11, 11, 30, 30)) // Cloning the date
1940
+ * parse('2016-01-01', 'yyyy-MM-dd', new Date())
1941
+ * ```
1942
+ *
1943
+ * @param {String} dateString - the string to parse
1944
+ * @param {String} formatString - the string of tokens
1945
+ * @param {Date|Number} referenceDate - defines values missing from the parsed dateString
1946
+ * @param {Object} [options] - an object with options.
1947
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
1948
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
1949
+ * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year
1950
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
1951
+ * see: https://git.io/fxCyr
1952
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
1953
+ * see: https://git.io/fxCyr
1954
+ * @returns {Date} the parsed date
1955
+ * @throws {TypeError} 3 arguments required
1956
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
1957
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
1958
+ * @throws {RangeError} `options.locale` must contain `match` property
1959
+ * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
1960
+ * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr
1961
+ * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
1962
+ * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr
1963
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
1964
+ *
1965
+ * @example
1966
+ * // Parse 11 February 2014 from middle-endian format:
1967
+ * var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())
1968
+ * //=> Tue Feb 11 2014 00:00:00
1969
+ *
1970
+ * @example
1971
+ * // Parse 28th of February in Esperanto locale in the context of 2010 year:
1972
+ * import eo from 'date-fns/locale/eo'
1973
+ * var result = parse('28-a de februaro', "do 'de' MMMM", new Date(2010, 0, 1), {
1974
+ * locale: eo
1975
+ * })
1976
+ * //=> Sun Feb 28 2010 00:00:00
1977
+ */
1978
+
1979
+ function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, dirtyOptions) {
1980
+ requiredArgs(3, arguments);
1981
+ var dateString = String(dirtyDateString);
1982
+ var formatString = String(dirtyFormatString);
1983
+ var options = dirtyOptions || {};
1984
+ var locale = options.locale || defaultLocale;
1985
+
1986
+ if (!locale.match) {
1987
+ throw new RangeError('locale must contain match property');
1988
+ }
1989
+
1990
+ var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate;
1991
+ var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);
1992
+ var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
1993
+
1994
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
1995
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
1996
+ }
1997
+
1998
+ var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;
1999
+ var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);
2000
+ var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2001
+
2002
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2003
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2004
+ }
2005
+
2006
+ if (formatString === '') {
2007
+ if (dateString === '') {
2008
+ return toDate(dirtyReferenceDate);
2009
+ } else {
2010
+ return new Date(NaN);
2011
+ }
2012
+ }
2013
+
2014
+ var subFnOptions = {
2015
+ firstWeekContainsDate: firstWeekContainsDate,
2016
+ weekStartsOn: weekStartsOn,
2017
+ locale: locale
2018
+ }; // If timezone isn't specified, it will be set to the system timezone
2019
+
2020
+ var setters = [{
2021
+ priority: TIMEZONE_UNIT_PRIORITY,
2022
+ subPriority: -1,
2023
+ set: dateToSystemTimezone,
2024
+ index: 0
2025
+ }];
2026
+ var i;
2027
+ var tokens = formatString.match(longFormattingTokensRegExp).map(function (substring) {
2028
+ var firstCharacter = substring[0];
2029
+
2030
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2031
+ var longFormatter = longFormatters[firstCharacter];
2032
+ return longFormatter(substring, locale.formatLong, subFnOptions);
2033
+ }
2034
+
2035
+ return substring;
2036
+ }).join('').match(formattingTokensRegExp);
2037
+ var usedTokens = [];
2038
+
2039
+ for (i = 0; i < tokens.length; i++) {
2040
+ var token = tokens[i];
2041
+
2042
+ if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token)) {
2043
+ throwProtectedError(token, formatString, dirtyDateString);
2044
+ }
2045
+
2046
+ if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
2047
+ throwProtectedError(token, formatString, dirtyDateString);
2048
+ }
2049
+
2050
+ var firstCharacter = token[0];
2051
+ var parser = parsers$1[firstCharacter];
2052
+
2053
+ if (parser) {
2054
+ var incompatibleTokens = parser.incompatibleTokens;
2055
+
2056
+ if (Array.isArray(incompatibleTokens)) {
2057
+ var incompatibleToken = void 0;
2058
+
2059
+ for (var _i = 0; _i < usedTokens.length; _i++) {
2060
+ var usedToken = usedTokens[_i].token;
2061
+
2062
+ if (incompatibleTokens.indexOf(usedToken) !== -1 || usedToken === firstCharacter) {
2063
+ incompatibleToken = usedTokens[_i];
2064
+ break;
2065
+ }
2066
+ }
2067
+
2068
+ if (incompatibleToken) {
2069
+ throw new RangeError("The format string mustn't contain `".concat(incompatibleToken.fullToken, "` and `").concat(token, "` at the same time"));
2070
+ }
2071
+ } else if (parser.incompatibleTokens === '*' && usedTokens.length) {
2072
+ throw new RangeError("The format string mustn't contain `".concat(token, "` and any other token at the same time"));
2073
+ }
2074
+
2075
+ usedTokens.push({
2076
+ token: firstCharacter,
2077
+ fullToken: token
2078
+ });
2079
+ var parseResult = parser.parse(dateString, token, locale.match, subFnOptions);
2080
+
2081
+ if (!parseResult) {
2082
+ return new Date(NaN);
2083
+ }
2084
+
2085
+ setters.push({
2086
+ priority: parser.priority,
2087
+ subPriority: parser.subPriority || 0,
2088
+ set: parser.set,
2089
+ validate: parser.validate,
2090
+ value: parseResult.value,
2091
+ index: setters.length
2092
+ });
2093
+ dateString = parseResult.rest;
2094
+ } else {
2095
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2096
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2097
+ } // Replace two single quote characters with one single quote character
2098
+
2099
+
2100
+ if (token === "''") {
2101
+ token = "'";
2102
+ } else if (firstCharacter === "'") {
2103
+ token = cleanEscapedString(token);
2104
+ } // Cut token from string, or, if string doesn't match the token, return Invalid Date
2105
+
2106
+
2107
+ if (dateString.indexOf(token) === 0) {
2108
+ dateString = dateString.slice(token.length);
2109
+ } else {
2110
+ return new Date(NaN);
2111
+ }
2112
+ }
2113
+ } // Check if the remaining input contains something other than whitespace
2114
+
2115
+
2116
+ if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) {
2117
+ return new Date(NaN);
2118
+ }
2119
+
2120
+ var uniquePrioritySetters = setters.map(function (setter) {
2121
+ return setter.priority;
2122
+ }).sort(function (a, b) {
2123
+ return b - a;
2124
+ }).filter(function (priority, index, array) {
2125
+ return array.indexOf(priority) === index;
2126
+ }).map(function (priority) {
2127
+ return setters.filter(function (setter) {
2128
+ return setter.priority === priority;
2129
+ }).sort(function (a, b) {
2130
+ return b.subPriority - a.subPriority;
2131
+ });
2132
+ }).map(function (setterArray) {
2133
+ return setterArray[0];
2134
+ });
2135
+ var date = toDate(dirtyReferenceDate);
2136
+
2137
+ if (isNaN(date)) {
2138
+ return new Date(NaN);
2139
+ } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2140
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2141
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/37
2142
+
2143
+
2144
+ var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date));
2145
+ var flags = {};
2146
+
2147
+ for (i = 0; i < uniquePrioritySetters.length; i++) {
2148
+ var setter = uniquePrioritySetters[i];
2149
+
2150
+ if (setter.validate && !setter.validate(utcDate, setter.value, subFnOptions)) {
2151
+ return new Date(NaN);
2152
+ }
2153
+
2154
+ var result = setter.set(utcDate, flags, setter.value, subFnOptions); // Result is tuple (date, flags)
2155
+
2156
+ if (result[0]) {
2157
+ utcDate = result[0];
2158
+ assign(flags, result[1]); // Result is date
2159
+ } else {
2160
+ utcDate = result;
2161
+ }
2162
+ }
2163
+
2164
+ return utcDate;
2165
+ }
2166
+
2167
+ function dateToSystemTimezone(date, flags) {
2168
+ if (flags.timestampIsSet) {
2169
+ return date;
2170
+ }
2171
+
2172
+ var convertedDate = new Date(0);
2173
+ convertedDate.setFullYear(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
2174
+ convertedDate.setHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
2175
+ return convertedDate;
2176
+ }
2177
+
2178
+ function cleanEscapedString(input) {
2179
+ return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
2180
+ }
2181
+
2182
+ const calendarDatepickerCss = ".sc-digi-calendar-datepicker:root{--digi--grayscale--0:#ffffff;--digi--grayscale--50:#fbfbfb;--digi--grayscale--100:#f4f4f4;--digi--grayscale--200:#ededed;--digi--grayscale--300:#e4e4e4;--digi--grayscale--400:#dddddd;--digi--grayscale--500:#cacaca;--digi--grayscale--600:#acacac;--digi--grayscale--700:#757575;--digi--grayscale--800:#5c5c5c;--digi--grayscale--900:#333333;--digi--grayscale--1000:#000000;--digi--sentiment--informative--200:#e9e9ff;--digi--sentiment--informative--500:#0A4DD1;--digi--sentiment--informative--700:#0058a3;--digi--sentiment--error--200:#fdeded;--digi--sentiment--error--500:#da0000;--digi--sentiment--error--700:#c7311a;--digi--sentiment--success--200:#e9f6ec;--digi--sentiment--success--500:#008A20;--digi--sentiment--success--700:#02703c;--digi--sentiment--warning--200:#fff398;--digi--sentiment--warning--50:#fffbdd;--digi--sentiment--warning--500:#ffe200;--digi--sentiment--warning--700:#ffc108;--digi--sentiment--warning--900:#664d00;--digi--misc--transparent:#ffffff00;--digi--animation--duration--base:var(--digi--global--animation--duration--base);--digi--animation--duration--small:var(--digi--global--animation--duration--short);--digi--animation--duration--large:var(--digi--global--animation--duration--longer);--digi--animation--duration--reduced:var(--digi--global--animation--duration--shortest);--digi--animation--duration--sweep:var(--digi--global--animation--duration--longest);--digi--animation--rotation--45:var(--digi--global--animation--rotation--smallest-2);--digi--animation--rotation--90:var(--digi--global--animation--rotation--smallest);--digi--animation--rotation--135:var(--digi--global--animation--rotation--smaller);--digi--animation--rotation--180:var(--digi--global--animation--rotation--small);--digi--animation--rotation--225:var(--digi--global--animation--rotation--base);--digi--animation--rotation--270:var(--digi--global--animation--rotation--large);--digi--animation--rotation--315:var(--digi--global--animation--rotation--larger);--digi--animation--rotation--360:var(--digi--global--animation--rotation--largest);--digi--global--animation--duration--base:.3s;--digi--global--animation--duration--short:.2s;--digi--global--animation--duration--shorter:.1s;--digi--global--animation--duration--shortest:.01s;--digi--global--animation--duration--long:.4s;--digi--global--animation--duration--longer:.5s;--digi--global--animation--duration--longest:4s;--digi--global--animation--rotation--smallest-2:0deg;--digi--global--animation--rotation--smallest:45deg;--digi--global--animation--rotation--smaller:90deg;--digi--global--animation--rotation--small:135deg;--digi--global--animation--rotation--base:180deg;--digi--global--animation--rotation--large:225deg;--digi--global--animation--rotation--larger:270deg;--digi--global--animation--rotation--largest:315deg;--digi--global--animation--rotation--largest-2:360deg;--digi--global--border-radius--base:6px;--digi--global--border-radius--small:4px;--digi--global--border-radius--smaller:3px;--digi--global--border-radius--smallest:2px;--digi--global--border-radius--smallest-2:1px;--digi--global--border-radius--smallest-3:0px;--digi--global--border-radius--large:8px;--digi--global--border-radius--larger:16px;--digi--global--border-radius--largest:32px;--digi--global--border-radius--largest-2:64px;--digi--global--border-width--base:2px;--digi--global--border-width--small:1px;--digi--global--border-width--smaller:0px;--digi--global--border-width--large:4px;--digi--global--border-width--larger:6px;--digi--global--border-width--largest:8px;--digi--global--border-width--largest-2:10px;--digi--global--border-style--solid:solid;--digi--global--border-style--none:none;--digi--global--border-style--dashed:dashed;--digi--global--spacing--base:16px;--digi--global--spacing--small:14px;--digi--global--spacing--smaller:12px;--digi--global--spacing--smallest:10px;--digi--global--spacing--smallest-2:8px;--digi--global--spacing--smallest-3:6px;--digi--global--spacing--smallest-4:4px;--digi--global--spacing--smallest-5:3px;--digi--global--spacing--smallest-6:2px;--digi--global--spacing--smallest-7:1px;--digi--global--spacing--large:18px;--digi--global--spacing--larger:20px;--digi--global--spacing---:22px;--digi--global--spacing--largest-2:24px;--digi--global--spacing--largest-3:28px;--digi--global--spacing--largest-4:32px;--digi--global--spacing--largest-5:40px;--digi--global--spacing--largest-6:48px;--digi--global--spacing--largest-7:56px;--digi--global--spacing--largest-8:64px;--digi--global--spacing--largest:22px;--digi--global--spacing--largest-3-5:30px;--digi--global--spacing--largest-9:72px;--digi--global--spacing--largest-10:80px;--digi--global--breakpoint--smallest-3:374px;--digi--global--breakpoint--smallest-2:375px;--digi--global--breakpoint--smallest:575px;--digi--global--breakpoint--smaller:576px;--digi--global--breakpoint--small:767px;--digi--global--breakpoint--medium:768px;--digi--global--breakpoint--large:991px;--digi--global--breakpoint--larger:992px;--digi--global--breakpoint--largest:1199px;--digi--global--breakpoint--largest-2:1200px;--digi--global--breakpoint--largest-3:1399px;--digi--global--breakpoint--largest-4:1400px;--digi--global--size--smaller:auto;--digi--global--size--small:36rem;--digi--global--size--base:48rem;--digi--global--size--large:62rem;--digi--global--size--larger:75rem;--digi--global--size--largest:87.5rem;--digi--global--text-width--small:31rem;--digi--global--text-width--base:35rem;--digi--global--text-width--large:40rem;--digi--global--text-width--larger:44rem;--digi--global--text-width--largest:48rem;--digi--global--text-width--largest-2:53rem;--digi--global--text-width--largest-3:61rem;--digi--global--text-width--largest-4:70rem;--digi--global--typography--line-height--base:1.5;--digi--global--typography--line-height--small:1;--digi--global--typography--line-height--large:2;--digi--global--typography--font-size--base:1rem;--digi--global--typography--font-size--small:0.875rem;--digi--global--typography--font-size--smaller:0.75rem;--digi--global--typography--font-size--large:1.125rem;--digi--global--typography--font-size--larger:1.25rem;--digi--global--typography--font-size--largest:1.375rem;--digi--global--typography--font-size--largest-2:1.5rem;--digi--global--typography--font-size--largest-3:1.75rem;--digi--global--typography--font-size--largest-4:2rem;--digi--global--typography--font-size--largest-5:2.25rem;--digi--global--typography--font-size--interaction-small:0.875rem;--digi--global--typography--font-size--interaction-medium:1rem;--digi--global--typography--font-size--interaction-large:1.125rem;--digi--global--typography--font-size--largest-6:2.5rem;--digi--global--typography--font-weight--regular:400;--digi--global--typography--font-weight--light:300;--digi--global--typography--font-weight--semibold:600;--digi--global--typography--font-weight--bold:700;--digi--global--typography--font-family--default:\"Open Sans\";--digi--global--typography--font-family--mono:Consolas, Monaco, \"Andale Mono\", \"Ubuntu Mono\", monospace;--digi--global--typography--text-decoration--default:none;--digi--global--typography--text-decoration--link:underline;--digi--border-radius--primary:var(--digi--global--border-radius--smallest-3);--digi--border-radius--secondary:var(--digi--global--border-radius--base);--digi--border-radius--tertiary:var(--digi--global--border-radius--smaller);--digi--border-radius--complementary-1:var(--digi--global--border-radius--largest);--digi--border-radius--complementary-2:var(--digi--global--border-radius--largest-2);--digi--border-radius--button:var(--digi--global--border-radius--base);--digi--border-radius--input:var(--digi--global--border-radius--smallest-3);--digi--border-radius--input-search:var(--digi--global--border-radius--base);--digi--border-radius--complementary-3:var(--digi--global--border-radius--larger);--digi--border-width--primary:var(--digi--global--border-width--small);--digi--border-width--secondary:var(--digi--global--border-width--base);--digi--border-width--complementary-1:var(--digi--global--border-width--largest);--digi--border-width--complementary-2:var(--digi--global--border-width--largest-2);--digi--border-width--input-regular:var(--digi--global--border-width--small);--digi--border-width--input-validation:var(--digi--global--border-width--base);--digi--border-width--button:var(--digi--global--border-width--small);--digi--border-style--primary:var(--digi--global--border-style--solid);--digi--border-style--secondary:var(--digi--global--border-style--none);--digi--padding--medium:var(--digi--global--spacing--base);--digi--padding--smaller:var(--digi--global--spacing--smallest-2);--digi--padding--small:var(--digi--global--spacing--smaller);--digi--padding--large:var(--digi--global--spacing--largest-2);--digi--padding--larger:var(--digi--global--spacing--largest-3);--digi--padding--largest:var(--digi--global--spacing--largest-4);--digi--padding--largest-2:var(--digi--global--spacing--largest-5);--digi--padding--largest-3:var(--digi--global--spacing--largest-6);--digi--margin--smaller:var(--digi--global--spacing--smallest-2);--digi--margin--small:var(--digi--global--spacing--smallest);--digi--margin--medium:var(--digi--global--spacing--base);--digi--margin--large:var(--digi--global--spacing--largest-2);--digi--margin--larger:var(--digi--global--spacing--largest-3);--digi--margin--largest:var(--digi--global--spacing--largest-4);--digi--margin--h1-small:var(--digi--global--spacing--base);--digi--margin--h1-medium:var(--digi--global--spacing--largest-2);--digi--margin--h1-large:var(--digi--global--spacing--largest-4);--digi--margin--h2-small:var(--digi--global--spacing--base);--digi--margin--h2-large:var(--digi--global--spacing--base);--digi--margin--h3-small:var(--digi--global--spacing--smallest-2);--digi--margin--h3-large:var(--digi--global--spacing--smallest-2);--digi--margin--h4-h6-small:var(--digi--global--spacing--smallest-2);--digi--margin--h4-h6-large:var(--digi--global--spacing--smallest-2);--digi--margin--text-small:var(--digi--global--spacing--largest-2);--digi--margin--text-large:var(--digi--global--spacing--largest-2);--digi--gutter--largest-3:var(--digi--global--spacing--largest-2);--digi--gutter--largest-2:var(--digi--global--spacing--larger);--digi--gutter--largest:var(--digi--global--spacing--base);--digi--gutter--larger:var(--digi--global--spacing--smaller);--digi--gutter--large:var(--digi--global--spacing--smallest);--digi--gutter--medium:var(--digi--global--spacing--smallest-2);--digi--gutter--small:var(--digi--global--spacing--smallest-3);--digi--gutter--smaller:var(--digi--global--spacing--smallest-4);--digi--gutter--smallest:var(--digi--global--spacing--smallest-5);--digi--gutter--smallest-2:var(--digi--global--spacing--smallest-6);--digi--gutter--smallest-3:var(--digi--global--spacing--smallest-7);--digi--gutter--button-block-small:var(--digi--global--spacing--smallest-3);--digi--gutter--button-block-medium:var(--digi--global--spacing--smallest-2);--digi--gutter--button-block-large:var(--digi--global--spacing--smallest);--digi--gutter--button-inline-small:var(--digi--global--spacing--smallest-2);--digi--gutter--button-inline-medium:var(--digi--global--spacing--base);--digi--gutter--button-inline-large:var(--digi--global--spacing--largest-2);--digi--gutter--icon:var(--digi--global--spacing--smallest);--digi--breakpoint--small-below:var(--digi--global--breakpoint--smallest);--digi--breakpoint--small:var(--digi--global--breakpoint--smaller);--digi--breakpoint--medium-below:var(--digi--global--breakpoint--small);--digi--breakpoint--medium:var(--digi--global--breakpoint--medium);--digi--breakpoint--large-below:var(--digi--global--breakpoint--large);--digi--breakpoint--large:var(--digi--global--breakpoint--larger);--digi--breakpoint--x-large-below:var(--digi--global--breakpoint--largest);--digi--breakpoint--x-large:var(--digi--global--breakpoint--largest-2);--digi--breakpoint--xx-large-below:var(--digi--global--breakpoint--largest-3);--digi--breakpoint--xx-large:var(--digi--global--breakpoint--largest-4);--digi--container-width--smaller:var(--digi--global--size--smaller);--digi--container-width--small:var(--digi--global--size--small);--digi--container-width--base:var(--digi--global--size--base);--digi--container-width--medium:var(--digi--global--size--base);--digi--container-width--large:var(--digi--global--size--large);--digi--container-width--larger:var(--digi--global--size--larger);--digi--container-width--largest:var(--digi--global--size--largest);--digi--container-gutter--smaller:var(--digi--global--spacing--base);--digi--container-gutter--small:var(--digi--global--spacing--large);--digi--container-gutter--base:var(--digi--global--spacing--base);--digi--container-gutter--medium:var(--digi--global--spacing--largest-2);--digi--container-gutter--large:var(--digi--global--spacing--base);--digi--container-gutter--larger:var(--digi--global--spacing--largest-3-5);--digi--container-gutter--largest:var(--digi--global--spacing--largest-5);--digi--paragraph-width--medium:var(--digi--global--text-width--base);--digi--paragraph-width--large:var(--digi--global--text-width--large);--digi--input-height--small:var(--digi--global--spacing--largest-4);--digi--input-height--medium:var(--digi--global--spacing--largest-5);--digi--input-height--large:var(--digi--global--spacing--largest-6);--digi--typography--body--font-size--desktop:var(--digi--global--typography--font-size--base);--digi--typography--body--font-size--desktop-large:var(--digi--global--typography--font-size--large);--digi--typography--body--font-size--mobile:var(--digi--global--typography--font-size--base);--digi--typography--body--font-weight--desktop:var(--digi--global--typography--font-weight--regular);--digi--typography--body--font-weight--desktop-large:var(--digi--global--typography--font-weight--regular);--digi--typography--body--font-weight--mobile:var(--digi--global--typography--font-weight--regular);--digi--typography--body--line-height--desktop:var(--digi--global--typography--line-height--base);--digi--typography--body--line-height--desktop-large:var(--digi--global--typography--line-height--base);--digi--typography--body--line-height--mobile:var(--digi--global--typography--line-height--base);--digi--typography--body--text-decoration--desktop:var(--digi--global--typography--text-decoration--default);--digi--typography--body--text-decoration--desktop-large:var(--digi--global--typography--text-decoration--default);--digi--typography--body--text-decoration--mobile:var(--digi--global--typography--text-decoration--default);--digi--typography--description--font-size--desktop:var(--digi--global--typography--font-size--base);--digi--typography--description--font-size--desktop-large:var(--digi--global--typography--font-size--large);--digi--typography--description--font-weight--desktop:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-1--font-size--desktop:var(--digi--global--typography--font-size--largest-4);--digi--typography--heading-1--font-size--desktop-large:var(--digi--global--typography--font-size--largest-6);--digi--typography--heading-1--font-size--mobile:var(--digi--global--typography--font-size--largest-3);--digi--typography--heading-1--font-weight--desktop:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-1--font-weight--desktop-large:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-1--font-weight--mobile:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-1--line-height--desktop:var(--digi--global--typography--line-height--base);--digi--typography--heading-1--line-height--desktop-large:var(--digi--global--typography--line-height--base);--digi--typography--heading-1--line-height--mobile:var(--digi--global--typography--line-height--base);--digi--typography--heading-1--text-decoration--desktop:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-1--text-decoration--desktop-large:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-1--text-decoration--mobile:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-2--font-size--desktop:var(--digi--global--typography--font-size--largest-2);--digi--typography--heading-2--font-size--desktop-large:var(--digi--global--typography--font-size--largest-3);--digi--typography--heading-2--font-size--mobile:var(--digi--global--typography--font-size--largest);--digi--typography--heading-2--font-weight--desktop:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-2--font-weight--desktop-large:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-2--font-weight--mobile:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-2--line-height--desktop:var(--digi--global--typography--line-height--base);--digi--typography--heading-2--line-height--desktop-large:var(--digi--global--typography--line-height--base);--digi--typography--heading-2--line-height--mobile:var(--digi--global--typography--line-height--base);--digi--typography--heading-2--text-decoration--desktop:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-2--text-decoration--desktop-large:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-2--text-decoration--mobile:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-3--font-size--desktop:var(--digi--global--typography--font-size--larger);--digi--typography--heading-3--font-size--desktop-large:var(--digi--global--typography--font-size--largest);--digi--typography--heading-3--font-size--mobile:var(--digi--global--typography--font-size--large);--digi--typography--heading-3--font-weight--desktop:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-3--font-weight--desktop-large:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-3--font-weight--mobile:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-3--line-height--desktop:var(--digi--global--typography--line-height--base);--digi--typography--heading-3--line-height--desktop-large:var(--digi--global--typography--line-height--base);--digi--typography--heading-3--line-height--mobile:var(--digi--global--typography--line-height--base);--digi--typography--heading-3--text-decoration--desktop:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-3--text-decoration--desktop-large:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-3--text-decoration--mobile:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-4--font-size--desktop:var(--digi--global--typography--font-size--base);--digi--typography--heading-4--font-size--desktop-large:var(--digi--global--typography--font-size--large);--digi--typography--heading-4--font-size--mobile:var(--digi--global--typography--font-size--base);--digi--typography--heading-4--font-weight--desktop:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-4--font-weight--desktop-large:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-4--font-weight--mobile:var(--digi--global--typography--font-weight--semibold);--digi--typography--heading-4--line-height--desktop:var(--digi--global--typography--line-height--base);--digi--typography--heading-4--line-height--desktop-large:var(--digi--global--typography--line-height--base);--digi--typography--heading-4--line-height--mobile:var(--digi--global--typography--line-height--base);--digi--typography--heading-4--text-decoration--desktop:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-4--text-decoration--desktop-large:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-4--text-decoration--mobile:var(--digi--global--typography--text-decoration--default);--digi--typography--heading-jumbo--font-size--desktop:var(--digi--global--typography--font-size--largest-4);--digi--typography--heading-jumbo--font-size--desktop-large:var(--digi--global--typography--font-size--largest-6);--digi--typography--heading-jumbo--font-weight--desktop:var(--digi--global--typography--font-weight--semibold);--digi--typography--input--font-size--desktop-large:var(--digi--global--typography--font-size--large);--digi--typography--label--font-size--desktop:var(--digi--global--typography--font-size--base);--digi--typography--label--font-weight--desktop:var(--digi--global--typography--font-weight--semibold);--digi--typography--label--font-weight--mobile:var(--digi--global--typography--font-weight--semibold);--digi--typography--label--line-height--desktop:var(--digi--global--typography--line-height--base);--digi--typography--label-description--font-size--desktop:var(--digi--global--typography--font-size--base);--digi--typography--label-description--line-height--desktop:var(--digi--global--typography--line-height--base);--digi--typography--link--font-size--desktop:var(--digi--global--typography--font-size--base);--digi--typography--link--font-size--desktop-large:var(--digi--global--typography--font-size--large);--digi--typography--link--font-size--mobile:var(--digi--global--typography--font-size--base);--digi--typography--link--font-weight--desktop:var(--digi--global--typography--font-weight--regular);--digi--typography--link--font-weight--desktop-large:var(--digi--global--typography--font-weight--regular);--digi--typography--link--font-weight--mobile:var(--digi--global--typography--font-weight--regular);--digi--typography--link--line-height--desktop:var(--digi--global--typography--line-height--base);--digi--typography--link--line-height--desktop-large:var(--digi--global--typography--line-height--base);--digi--typography--link--line-height--mobile:var(--digi--global--typography--line-height--base);--digi--typography--link--text-decoration--desktop:var(--digi--global--typography--text-decoration--link);--digi--typography--link--text-decoration--desktop-large:var(--digi--global--typography--text-decoration--link);--digi--typography--link--text-decoration--mobile:var(--digi--global--typography--text-decoration--link);--digi--typography--link-bold--font-weight--desktop:var(--digi--global--typography--font-weight--semibold);--digi--typography--preamble--font-size--desktop:var(--digi--global--typography--font-size--base);--digi--typography--preamble--font-size--mobile:var(--digi--global--typography--font-size--base);--digi--typography--preamble--font-weight--desktop:var(--digi--global--typography--font-weight--semibold);--digi--typography--preamble--line-height--mobile:var(--digi--global--typography--line-height--base);--digi--typography--preamble--line-height--desktop:var(--digi--global--typography--line-height--base);--digi--typography--accordion--font-size--desktop:var(--digi--global--typography--font-size--base);--digi--typography--accordion--font-size--mobile:var(--digi--global--typography--font-size--base);--digi--typography--accordion--font-weight--desktop:var(--digi--global--typography--font-weight--semibold);--digi--typography--tag--font-size--desktop:var(--digi--global--typography--font-size--small);--digi--typography--tag--font-size--mobile:var(--digi--global--typography--font-size--small);--digi--typography--tag--font-weight--desktop:var(--digi--global--typography--font-weight--regular);--digi--typography--breadcrumbs--font-size--desktop:var(--digi--global--typography--font-size--small);--digi--typography--breadcrumbs--text-decoration--desktop:var(--digi--global--typography--text-decoration--default);--digi--typography--title-logo--font-size--desktop:var(--digi--global--typography--font-size--largest-5);--digi--typography--title-logo--font-size--desktop-large:var(--digi--global--typography--font-size--largest-5);--digi--typography--title-logo--font-size--mobile:var(--digi--global--typography--font-size--largest-3);--digi--typography--title-logo--font-weight--desktop:var(--digi--global--typography--font-weight--bold);--digi--typography--button--font-size--desktop:var(--digi--global--typography--font-size--base);--digi--typography--button--font-size--desktop-large:var(--digi--global--typography--font-size--large);--digi--typography--button--font-weight--desktop:var(--digi--global--typography--font-weight--semibold);--digi--color--logotype-color:var(--digi--color--logotype-color--light);--digi--color--infographic--lineart:var(--digi--color--infographic--lineart--light);--digi--color--infographic--background:var(--digi--color--infographic--background--light);--digi--color--infographic--brand--primary:var(--digi--color--infographic--brand--primary--light);--digi--color--infographic--brand--secondary:var(--digi--color--infographic--brand--secondary--light);--digi--color--infographic--brand--tertiary:var(--digi--color--infographic--brand--tertiary--light);--digi--color--text--primary:var(--digi--color--text--primary--light);--digi--color--text--secondary:var(--digi--color--text--secondary--light);--digi--color--text--description:var(--digi--color--text--description--light);--digi--color--text--interactive--primary:var(--digi--color--text--interactive--primary--light);--digi--color--text--interactive--secondary:var(--digi--color--text--interactive--secondary--light);--digi--color--text--interactive--tertiary:var(--digi--color--text--interactive--tertiary--light);--digi--color--text--interactive--brand-primary:var(--digi--color--text--interactive--brand-primary--light);--digi--color--text--interactive--brand-secondary:var(--digi--color--text--interactive--brand-secondary--light);--digi--color--text--interactive--visited:var(--digi--color--text--interactive--visited--light);--digi--color--background--primary:var(--digi--color--background--primary--light);--digi--color--background--secondary:var(--digi--color--background--secondary--light);--digi--color--background--secondary-muted:var(--digi--color--background--secondary-muted--light);--digi--color--background--secondary-accent:var(--digi--color--background--secondary-accent--light);--digi--color--background--pop-out:var(--digi--color--background--pop-out--light);--digi--color--background--brand-primary:var(--digi--color--background--brand-primary--light);--digi--color--background--transparent:var(--digi--color--background--transparent--light);--digi--color--background--notification:var(--digi--color--background--notification--light);--digi--color--background--interactive--default--primary:var(--digi--color--background--interactive--default--primary--light);--digi--color--background--interactive--default--primary-inverted:var(--digi--color--background--interactive--default--primary-inverted--light);--digi--color--background--interactive--default--secondary:var(--digi--color--background--interactive--default--secondary--light);--digi--color--background--interactive--default--secondary-inverted:var(--digi--color--background--interactive--default--secondary-inverted--light);--digi--color--background--interactive--default--tertiary:var(--digi--color--background--interactive--default--tertiary--light);--digi--color--background--interactive--default--quaternary:var(--digi--color--background--interactive--default--quaternary--light);--digi--color--background--interactive--default--input-elements:var(--digi--color--background--interactive--default--input-elements--light);--digi--color--background--interactive--default--pop-out:var(--digi--color--background--interactive--default--pop-out--light);--digi--color--background--interactive--hover--primary:var(--digi--color--background--interactive--hover--primary--light);--digi--color--background--interactive--hover--secondary:var(--digi--color--background--interactive--hover--secondary--light);--digi--color--background--interactive--hover--tertiary:var(--digi--color--background--interactive--hover--tertiary--light);--digi--color--background--interactive--hover--quarternary:var(--digi--color--background--interactive--hover--quarternary--light);--digi--color--background--interactive--hover--inverted:var(--digi--color--background--interactive--hover--inverted--light);--digi--color--background--interactive--selected--primary:var(--digi--color--background--interactive--selected--primary--light);--digi--color--background--interactive--selected--secondary:var(--digi--color--background--interactive--selected--secondary--light);--digi--color--background--interactive--selected--tertiary:var(--digi--color--background--interactive--selected--tertiary--light);--digi--color--background--interactive--selected--on-menu-minus-button:var(--digi--color--background--interactive--selected--on-menu-minus-button--light);--digi--color--background--interactive--validation--success:var(--digi--color--background--interactive--validation--success--light);--digi--color--background--interactive--validation--warning:var(--digi--color--background--interactive--validation--warning--light);--digi--color--background--interactive--validation--error:var(--digi--color--background--interactive--validation--error--light);--digi--color--background--sentiment--error--primary:var(--digi--color--background--sentiment--error--primary--light);--digi--color--background--sentiment--error--secondary:var(--digi--color--background--sentiment--error--secondary--light);--digi--color--background--sentiment--error--tertiary:var(--digi--color--background--sentiment--error--tertiary--light);--digi--color--background--sentiment--success--primary:var(--digi--color--background--sentiment--success--primary--light);--digi--color--background--sentiment--success--secondary:var(--digi--color--background--sentiment--success--secondary--light);--digi--color--background--sentiment--success--tertiary:var(--digi--color--background--sentiment--success--tertiary--light);--digi--color--background--sentiment--warning--primary:var(--digi--color--background--sentiment--warning--primary--light);--digi--color--background--sentiment--warning--secondary:var(--digi--color--background--sentiment--warning--secondary--light);--digi--color--background--sentiment--warning--tertiary:var(--digi--color--background--sentiment--warning--tertiary--light);--digi--color--background--sentiment--warning--quarternary:var(--digi--color--background--sentiment--warning--quarternary--light);--digi--color--background--sentiment--info--primary:var(--digi--color--background--sentiment--info--primary--light);--digi--color--background--sentiment--info--secondary:var(--digi--color--background--sentiment--info--secondary--light);--digi--color--background--sentiment--info--tertiary:var(--digi--color--background--sentiment--info--tertiary--light);--digi--color--background--sentiment--neutral--primary:var(--digi--color--background--sentiment--neutral--primary--light);--digi--color--background--sentiment--neutral--secondary:var(--digi--color--background--sentiment--neutral--secondary--light);--digi--color--background--sentiment--neutral--tertiary:var(--digi--color--background--sentiment--neutral--tertiary--light);--digi--color--background--sentiment--beta--primary:var(--digi--color--background--sentiment--beta--primary--light);--digi--color--background--sentiment--beta--secondary:var(--digi--color--background--sentiment--beta--secondary--light);--digi--color--border--notification:var(--digi--color--border--notification--light);--digi--color--border--transparent:var(--digi--color--border--transparent--light);--digi--color--border--interactive--default--primary:var(--digi--color--border--interactive--default--primary--light);--digi--color--border--interactive--default--on-input:var(--digi--color--border--interactive--default--on-input--light);--digi--color--border--interactive--default--on-input-nuance:var(--digi--color--border--interactive--default--on-input-nuance--light);--digi--color--border--interactive--default--inverted:var(--digi--color--border--interactive--default--inverted--light);--digi--color--border--interactive--hover--primary:var(--digi--color--border--interactive--hover--primary--light);--digi--color--border--interactive--hover--secondary:var(--digi--color--border--interactive--hover--secondary--light);--digi--color--border--interactive--hover--inverted:var(--digi--color--border--interactive--hover--inverted--light);--digi--color--border--interactive--validation--success:var(--digi--color--border--interactive--validation--success--light);--digi--color--border--interactive--validation--warning:var(--digi--color--border--interactive--validation--warning--light);--digi--color--border--interactive--validation--error:var(--digi--color--border--interactive--validation--error--light);--digi--color--border--interactive--selected--primary:var(--digi--color--border--interactive--selected--primary--light);--digi--color--border--interactive--selected--secondary:var(--digi--color--border--interactive--selected--secondary--light);--digi--color--border--sentiment--error:var(--digi--color--border--sentiment--error--light);--digi--color--border--sentiment--success:var(--digi--color--border--sentiment--success--light);--digi--color--border--sentiment--warning:var(--digi--color--border--sentiment--warning--light);--digi--color--border--sentiment--info:var(--digi--color--border--sentiment--info--light);--digi--color--border--accent--primary:var(--digi--color--border--accent--primary--light);--digi--color--border--accent--secondary:var(--digi--color--border--accent--secondary--light);--digi--color--marking--navigation--selected:var(--digi--color--marking--navigation--selected--light);--digi--color--marking--navigation--level-active:var(--digi--color--marking--navigation--level-active--light);--digi--color--marking--navigation--level-inactive:var(--digi--color--marking--navigation--level-inactive--light);--digi--color--marking--indication--primary:var(--digi--color--marking--indication--primary--light);--digi--color--marking--indication--secondary:var(--digi--color--marking--indication--secondary--light);--digi--color--marking--indication--tertiary:var(--digi--color--marking--indication--tertiary--light);--digi--color--divider--primary:var(--digi--color--divider--primary--light);--digi--color--divider--secondary:var(--digi--color--divider--secondary--light);--digi--color--divider--on-brand-primary:var(--digi--color--divider--on-brand-primary--light);--digi--color--divider--cta:var(--digi--color--divider--cta--light);--digi--color--icon--primary:var(--digi--color--icon--primary--light);--digi--color--icon--secondary:var(--digi--color--icon--secondary--light);--digi--color--icon--cta:var(--digi--color--icon--cta--light);--digi--color--icon--brand-primary:var(--digi--color--icon--brand-primary--light);--digi--color--icon--brand-secondary:var(--digi--color--icon--brand-secondary--light);--digi--color--icon--validation--success:var(--digi--color--icon--validation--success--light);--digi--color--icon--validation--warning:var(--digi--color--icon--validation--warning--light);--digi--color--icon--validation--error:var(--digi--color--icon--validation--error--light);--digi--color--misc--spinner-path:var(--digi--color--misc--spinner-path--light);--digi--color--misc--skeleton:var(--digi--color--misc--skeleton--light);--digi--amethyst--500:#822998;--digi--granskott--150:#f2faf2;--digi--granskott--200:#ebf8eb;--digi--granskott--250:#ddf4dd;--digi--granskott--300:#cbecc9;--digi--granskott--350:#ace4ad;--digi--granskott--650:#1db920;--digi--granskott--700:#02a704;--digi--granskott--750:#018903;--digi--granskott--800:#016503;--digi--natthimmel--200:#e9f6fd;--digi--natthimmel--250:#ddf1fc;--digi--natthimmel--300:#c9e9fa;--digi--natthimmel--350:#abdef7;--digi--natthimmel--700:#043982;--digi--natthimmel--800:#091d54;--digi--natthimmel--900:#071744;--digi--norrsken--400:#aaf5ab;--digi--norrsken--500:#67ee6a;--digi--rallarros--300:#f8ddf5;--digi--rallarros--500:#ce1cbd;--digi--sapphire--500:#1616b2;--digi--color--logotype-color--light:var(--digi--granskott--700);--digi--color--infographic--lineart--light:var(--digi--grayscale--900);--digi--color--infographic--background--light:var(--digi--grayscale--0);--digi--color--infographic--brand--primary--light:var(--digi--granskott--700);--digi--color--infographic--brand--secondary--light:var(--digi--granskott--250);--digi--color--infographic--brand--tertiary--light:var(--digi--rallarros--500);--digi--color--text--primary--light:var(--digi--grayscale--900);--digi--color--text--secondary--light:var(--digi--grayscale--0);--digi--color--text--description--light:var(--digi--grayscale--800);--digi--color--text--interactive--primary--light:var(--digi--sapphire--500);--digi--color--text--interactive--secondary--light:var(--digi--grayscale--0);--digi--color--text--interactive--tertiary--light:var(--digi--grayscale--900);--digi--color--text--interactive--brand-primary--light:var(--digi--natthimmel--800);--digi--color--text--interactive--brand-secondary--light:var(--digi--norrsken--500);--digi--color--text--interactive--visited--light:var(--digi--amethyst--500);--digi--color--background--primary--light:var(--digi--grayscale--0);--digi--color--background--secondary--light:var(--digi--grayscale--100);--digi--color--background--secondary-muted--light:var(--digi--grayscale--50);--digi--color--background--secondary-accent--light:var(--digi--grayscale--400);--digi--color--background--pop-out--light:var(--digi--granskott--200);--digi--color--background--brand-primary--light:var(--digi--natthimmel--800);--digi--color--background--transparent--light:var(--digi--misc--transparent);--digi--color--background--notification--light:var(--digi--sentiment--error--500);--digi--color--background--interactive--default--primary--light:var(--digi--natthimmel--800);--digi--color--background--interactive--default--primary-inverted--light:var(--digi--norrsken--500);--digi--color--background--interactive--default--secondary--light:var(--digi--grayscale--0);--digi--color--background--interactive--default--secondary-inverted--light:var(--digi--misc--transparent);--digi--color--background--interactive--default--tertiary--light:var(--digi--grayscale--200);--digi--color--background--interactive--default--quaternary--light:var(--digi--grayscale--100);--digi--color--background--interactive--default--input-elements--light:var(--digi--grayscale--0);--digi--color--background--interactive--default--pop-out--light:var(--digi--granskott--150);--digi--color--background--interactive--hover--primary--light:var(--digi--natthimmel--700);--digi--color--background--interactive--hover--secondary--light:var(--digi--natthimmel--250);--digi--color--background--interactive--hover--tertiary--light:var(--digi--sapphire--500);--digi--color--background--interactive--hover--quarternary--light:var(--digi--grayscale--200);--digi--color--background--interactive--hover--inverted--light:var(--digi--norrsken--400);--digi--color--background--interactive--selected--primary--light:var(--digi--sentiment--success--500);--digi--color--background--interactive--selected--secondary--light:var(--digi--natthimmel--800);--digi--color--background--interactive--selected--tertiary--light:var(--digi--grayscale--200);--digi--color--background--interactive--selected--on-menu-minus-button--light:var(--digi--granskott--250);--digi--color--background--interactive--validation--success--light:var(--digi--sentiment--success--200);--digi--color--background--interactive--validation--warning--light:var(--digi--sentiment--warning--50);--digi--color--background--interactive--validation--error--light:var(--digi--sentiment--error--200);--digi--color--background--sentiment--error--primary--light:var(--digi--sentiment--error--500);--digi--color--background--sentiment--error--secondary--light:var(--digi--sentiment--error--700);--digi--color--background--sentiment--error--tertiary--light:var(--digi--sentiment--error--200);--digi--color--background--sentiment--success--primary--light:var(--digi--sentiment--success--500);--digi--color--background--sentiment--success--secondary--light:var(--digi--sentiment--success--700);--digi--color--background--sentiment--success--tertiary--light:var(--digi--sentiment--success--200);--digi--color--background--sentiment--warning--primary--light:var(--digi--sentiment--warning--500);--digi--color--background--sentiment--warning--secondary--light:var(--digi--sentiment--warning--700);--digi--color--background--sentiment--warning--tertiary--light:var(--digi--sentiment--warning--200);--digi--color--background--sentiment--warning--quarternary--light:var(--digi--sentiment--warning--50);--digi--color--background--sentiment--info--primary--light:var(--digi--sentiment--informative--500);--digi--color--background--sentiment--info--secondary--light:var(--digi--sentiment--informative--700);--digi--color--background--sentiment--info--tertiary--light:var(--digi--sentiment--informative--200);--digi--color--background--sentiment--neutral--primary--light:var(--digi--grayscale--700);--digi--color--background--sentiment--neutral--secondary--light:var(--digi--grayscale--400);--digi--color--background--sentiment--neutral--tertiary--light:var(--digi--grayscale--900);--digi--color--background--sentiment--beta--primary--light:var(--digi--rallarros--500);--digi--color--background--sentiment--beta--secondary--light:var(--digi--rallarros--300);--digi--color--border--notification--light:var(--digi--grayscale--0);--digi--color--border--transparent--light:var(--digi--misc--transparent);--digi--color--border--interactive--default--primary--light:var(--digi--natthimmel--800);--digi--color--border--interactive--default--on-input--light:var(--digi--grayscale--900);--digi--color--border--interactive--default--on-input-nuance--light:var(--digi--grayscale--800);--digi--color--border--interactive--default--inverted--light:var(--digi--norrsken--500);--digi--color--border--interactive--hover--primary--light:var(--digi--natthimmel--700);--digi--color--border--interactive--hover--secondary--light:var(--digi--natthimmel--800);--digi--color--border--interactive--hover--inverted--light:var(--digi--norrsken--400);--digi--color--border--interactive--validation--success--light:var(--digi--sentiment--success--500);--digi--color--border--interactive--validation--warning--light:var(--digi--sentiment--warning--900);--digi--color--border--interactive--validation--error--light:var(--digi--sentiment--error--500);--digi--color--border--interactive--selected--primary--light:var(--digi--sentiment--success--500);--digi--color--border--interactive--selected--secondary--light:var(--digi--natthimmel--800);--digi--color--border--sentiment--error--light:var(--digi--sentiment--error--500);--digi--color--border--sentiment--success--light:var(--digi--sentiment--success--500);--digi--color--border--sentiment--warning--light:var(--digi--sentiment--warning--500);--digi--color--border--sentiment--info--light:var(--digi--sentiment--informative--500);--digi--color--border--accent--primary--light:var(--digi--natthimmel--800);--digi--color--border--accent--secondary--light:var(--digi--granskott--700);--digi--color--marking--navigation--selected--light:var(--digi--granskott--700);--digi--color--marking--navigation--level-active--light:var(--digi--granskott--250);--digi--color--marking--navigation--level-inactive--light:var(--digi--grayscale--100);--digi--color--marking--indication--primary--light:var(--digi--sentiment--success--500);--digi--color--marking--indication--secondary--light:var(--digi--natthimmel--800);--digi--color--marking--indication--tertiary--light:var(--digi--grayscale--700);--digi--color--divider--primary--light:var(--digi--grayscale--400);--digi--color--divider--secondary--light:var(--digi--grayscale--200);--digi--color--divider--on-brand-primary--light:var(--digi--natthimmel--350);--digi--color--divider--cta--light:var(--digi--sapphire--500);--digi--color--icon--primary--light:var(--digi--grayscale--900);--digi--color--icon--secondary--light:var(--digi--grayscale--0);--digi--color--icon--cta--light:var(--digi--sapphire--500);--digi--color--icon--brand-primary--light:var(--digi--natthimmel--800);--digi--color--icon--brand-secondary--light:var(--digi--granskott--700);--digi--color--icon--validation--success--light:var(--digi--sentiment--success--500);--digi--color--icon--validation--warning--light:var(--digi--sentiment--warning--500);--digi--color--icon--validation--error--light:var(--digi--sentiment--error--500);--digi--color--misc--spinner-path--light:var(--digi--grayscale--400);--digi--color--misc--skeleton--light:var(--digi--grayscale--400);--digi--color--amber--200:#fff398;--digi--color--amber--50:#fffbdd;--digi--color--amber--500:#ffe200;--digi--color--amber--700:#ffc108;--digi--color--amber--900:#664d00;--digi--color--amethyst--500:#822998;--digi--color--forest--200:#e9f6ec;--digi--color--forest--500:#009322;--digi--color--forest--700:#02703c;--digi--color--indigo--200:#e9e9ff;--digi--color--indigo--500:#0000ff;--digi--color--indigo--700:#0058a3;--digi--color--jade--100:#bddfda;--digi--color--jade--200:#7fc1b6;--digi--color--jade--400:#379d8d;--digi--color--jade--50:#ddeeec;--digi--color--jade--500:#058470;--digi--color--jade--600:#046a5a;--digi--color--jade--700:#035548;--digi--color--jade--900:#02372f;--digi--color--leaf--100:#f1f7e5;--digi--color--leaf--200:#ddebc1;--digi--color--leaf--400:#aace65;--digi--color--leaf--500:#95c23e;--digi--color--leaf--600:#779b32;--digi--color--moon--0:#ffffff;--digi--color--pear--500:#b7ee4a;--digi--color--pear--600:#a7d943;--digi--color--rose--100:#f4cada;--digi--color--rose--200:#e997b7;--digi--color--rose--400:#dd5c8e;--digi--color--rose--50:#f9e4ec;--digi--color--rose--500:#d43372;--digi--color--rose--600:#bd2e65;--digi--color--rose--700:#882149;--digi--color--rose--900:#54172e;--digi--color--ruby--200:#fdeded;--digi--color--ruby--500:#da0000;--digi--color--ruby--700:#c7311a;--digi--color--sapphire--500:#1616b2;--digi--color--stratos--100:#dddde9;--digi--color--stratos--400:#33337b;--digi--color--stratos--500:#00005a;--digi--color--stratos--600:#000048;--digi--color--water--200:#f1f8fe;--digi--color--water--500:#bdd3e7;--digi--color--water--700:#0058a3;--digi--color--logotype-color--light--af18:var(--digi--color--leaf--500);--digi--color--infographic--lineart--light--af18:var(--digi--grayscale--900);--digi--color--infographic--background--light--af18:var(--digi--grayscale--0);--digi--color--infographic--brand--primary--light--af18:var(--digi--color--leaf--500);--digi--color--infographic--brand--secondary--light--af18:var(--digi--color--leaf--200);--digi--color--infographic--brand--tertiary--light--af18:var(--digi--color--rose--500);--digi--color--text--primary--light--af18:var(--digi--grayscale--900);--digi--color--text--secondary--light--af18:var(--digi--grayscale--0);--digi--color--text--description--light--af18:var(--digi--grayscale--800);--digi--color--text--interactive--primary--light--af18:var(--digi--color--sapphire--500);--digi--color--text--interactive--secondary--light--af18:var(--digi--grayscale--0);--digi--color--text--interactive--tertiary--light--af18:var(--digi--grayscale--900);--digi--color--text--interactive--brand-primary--light--af18:var(--digi--color--stratos--500);--digi--color--text--interactive--brand-secondary--light--af18:var(--digi--color--leaf--500);--digi--color--text--interactive--visited--light--af18:var(--digi--color--amethyst--500);--digi--color--background--primary--light--af18:var(--digi--grayscale--0);--digi--color--background--secondary--light--af18:var(--digi--grayscale--100);--digi--color--background--secondary-muted--light--af18:var(--digi--grayscale--50);--digi--color--background--secondary-accent--light--af18:var(--digi--grayscale--400);--digi--color--background--pop-out--light--af18:var(--digi--color--leaf--100);--digi--color--background--brand-primary--light--af18:var(--digi--color--stratos--500);--digi--color--background--transparent--light--af18:var(--digi--misc--transparent);--digi--color--background--notification--light--af18:var(--digi--sentiment--error--500);--digi--color--background--interactive--default--primary--light--af18:var(--digi--color--stratos--500);--digi--color--background--interactive--default--primary-inverted--light--af18:var(--digi--color--leaf--500);--digi--color--background--interactive--default--secondary--light--af18:var(--digi--grayscale--0);--digi--color--background--interactive--default--secondary-inverted--light--af18:var(--digi--misc--transparent);--digi--color--background--interactive--default--tertiary--light--af18:var(--digi--grayscale--200);--digi--color--background--interactive--default--quaternary--light--af18:var(--digi--grayscale--100);--digi--color--background--interactive--default--input-elements--light--af18:var(--digi--grayscale--0);--digi--color--background--interactive--default--pop-out--light--af18:var(--digi--color--leaf--100);--digi--color--background--interactive--hover--primary--light--af18:var(--digi--color--water--700);--digi--color--background--interactive--hover--secondary--light--af18:var(--digi--color--water--500);--digi--color--background--interactive--hover--tertiary--light--af18:var(--digi--color--sapphire--500);--digi--color--background--interactive--hover--quarternary--light--af18:var(--digi--grayscale--200);--digi--color--background--interactive--hover--inverted--light--af18:var(--digi--color--pear--500);--digi--color--background--interactive--selected--primary--light--af18:var(--digi--sentiment--success--500);--digi--color--background--interactive--selected--secondary--light--af18:var(--digi--color--stratos--500);--digi--color--background--interactive--selected--tertiary--light--af18:var(--digi--grayscale--200);--digi--color--background--interactive--selected--on-menu-minus-button--light--af18:var(--digi--color--leaf--200);--digi--color--background--interactive--validation--success--light--af18:var(--digi--sentiment--success--200);--digi--color--background--interactive--validation--warning--light--af18:var(--digi--sentiment--warning--50);--digi--color--background--interactive--validation--error--light--af18:var(--digi--sentiment--error--200);--digi--color--background--sentiment--error--primary--light--af18:var(--digi--sentiment--error--500);--digi--color--background--sentiment--error--secondary--light--af18:var(--digi--sentiment--error--700);--digi--color--background--sentiment--error--tertiary--light--af18:var(--digi--sentiment--error--200);--digi--color--background--sentiment--success--primary--light--af18:var(--digi--sentiment--success--500);--digi--color--background--sentiment--success--secondary--light--af18:var(--digi--sentiment--success--700);--digi--color--background--sentiment--success--tertiary--light--af18:var(--digi--sentiment--success--200);--digi--color--background--sentiment--warning--primary--light--af18:var(--digi--sentiment--warning--500);--digi--color--background--sentiment--warning--secondary--light--af18:var(--digi--sentiment--warning--700);--digi--color--background--sentiment--warning--tertiary--light--af18:var(--digi--sentiment--warning--200);--digi--color--background--sentiment--warning--quarternary--light--af18:var(--digi--sentiment--warning--50);--digi--color--background--sentiment--info--primary--light--af18:var(--digi--sentiment--informative--500);--digi--color--background--sentiment--info--secondary--light--af18:var(--digi--sentiment--informative--700);--digi--color--background--sentiment--info--tertiary--light--af18:var(--digi--sentiment--informative--200);--digi--color--background--sentiment--neutral--primary--light--af18:var(--digi--grayscale--700);--digi--color--background--sentiment--neutral--secondary--light--af18:var(--digi--grayscale--400);--digi--color--background--sentiment--neutral--tertiary--light--af18:var(--digi--grayscale--900);--digi--color--background--sentiment--beta--primary--light--af18:var(--digi--color--rose--500);--digi--color--background--sentiment--beta--secondary--light--af18:var(--digi--color--rose--100);--digi--color--border--notification--light--af18:var(--digi--grayscale--0);--digi--color--border--transparent--light--af18:var(--digi--misc--transparent);--digi--color--border--interactive--default--primary--light--af18:var(--digi--color--stratos--500);--digi--color--border--interactive--default--on-input--light--af18:var(--digi--grayscale--900);--digi--color--border--interactive--default--on-input-nuance--light--af18:var(--digi--grayscale--800);--digi--color--border--interactive--default--inverted--light--af18:var(--digi--color--leaf--500);--digi--color--border--interactive--hover--primary--light--af18:var(--digi--color--water--700);--digi--color--border--interactive--hover--secondary--light--af18:var(--digi--color--stratos--500);--digi--color--border--interactive--hover--inverted--light--af18:var(--digi--color--pear--500);--digi--color--border--interactive--validation--success--light--af18:var(--digi--sentiment--success--500);--digi--color--border--interactive--validation--warning--light--af18:var(--digi--sentiment--warning--900);--digi--color--border--interactive--validation--error--light--af18:var(--digi--sentiment--error--500);--digi--color--border--interactive--selected--primary--light--af18:var(--digi--sentiment--success--500);--digi--color--border--interactive--selected--secondary--light--af18:var(--digi--color--stratos--500);--digi--color--border--sentiment--error--light--af18:var(--digi--sentiment--error--500);--digi--color--border--sentiment--success--light--af18:var(--digi--sentiment--success--500);--digi--color--border--sentiment--warning--light--af18:var(--digi--sentiment--warning--500);--digi--color--border--sentiment--info--light--af18:var(--digi--sentiment--informative--500);--digi--color--border--accent--primary--light--af18:var(--digi--color--stratos--500);--digi--color--border--accent--secondary--light--af18:var(--digi--color--leaf--500);--digi--color--marking--navigation--selected--light--af18:var(--digi--color--leaf--500);--digi--color--marking--navigation--level-active--light--af18:var(--digi--color--leaf--200);--digi--color--marking--navigation--level-inactive--light--af18:var(--digi--grayscale--100);--digi--color--marking--indication--primary--light--af18:var(--digi--sentiment--success--500);--digi--color--marking--indication--secondary--light--af18:var(--digi--color--stratos--500);--digi--color--marking--indication--tertiary--light--af18:var(--digi--grayscale--700);--digi--color--divider--primary--light--af18:var(--digi--grayscale--400);--digi--color--divider--secondary--light--af18:var(--digi--grayscale--200);--digi--color--divider--on-brand-primary--light--af18:var(--digi--color--stratos--400);--digi--color--divider--cta--light--af18:var(--digi--color--sapphire--500);--digi--color--icon--primary--light--af18:var(--digi--grayscale--900);--digi--color--icon--secondary--light--af18:var(--digi--grayscale--0);--digi--color--icon--cta--light--af18:var(--digi--color--sapphire--500);--digi--color--icon--brand-primary--light--af18:var(--digi--color--stratos--500);--digi--color--icon--brand-secondary--light--af18:var(--digi--color--leaf--500);--digi--color--icon--validation--success--light--af18:var(--digi--sentiment--success--500);--digi--color--icon--validation--warning--light--af18:var(--digi--sentiment--warning--500);--digi--color--icon--validation--error--light--af18:var(--digi--sentiment--error--500);--digi--color--misc--spinner-path--light--af18:var(--digi--grayscale--400);--digi--color--misc--skeleton--light--af18:var(--digi--grayscale--400)}body.sc-digi-calendar-datepicker{font-size:1rem;font-family:\"Open Sans\", Arial, sans-serif}.sc-digi-calendar-datepicker-h{--digi--datepicker--max-width:18.75rem;--digi--datepicker--border-radius:0.25rem;--digi--datepicker--calendar--max-width:20.25rem;--digi--datepicker--calendar--show-week--max-width:23.375rem;--digi--datepicker--calendar-shadow:0 0.125rem 0.375rem 0 rgba(0, 0, 0, 0.7);--digi--datepicker--calendar--background-color:var(--digi--color--background--interactive--default--secondary);--digi--datepicker--input-icon--width:0.875rem;--digi--datepicker--input-icon--horizontal-padding:0.75rem;--digi--datepicker--input-icon--vertical-padding:var(--digi--global--spacing--smallest-2);--digi--datepicker--input--inline-start:var(--digi--gutter--medium);--digi--datepicker--input--inline-end:calc(var(--digi--datepicker--input-icon--width) + var(--digi--datepicker--input-icon--horizontal-padding) * 2);box-sizing:content-box}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker.sc-digi-calendar-datepicker{position:relative;pointer-events:none}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__input-field.sc-digi-calendar-datepicker{position:relative;max-width:var(--digi--datepicker--max-width);pointer-events:auto}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__input-field.sc-digi-calendar-datepicker .digi-calendar-datepicker__inactive.sc-digi-calendar-datepicker{--digi--form-input--background--empty:var(--digi--datepicker--input--inactive-background)}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__input-field.sc-digi-calendar-datepicker .digi-calendar-datepicker__input-button.sc-digi-calendar-datepicker{background:var(--digi--color--background--primary);height:var(--digi--form-input--height--medium);color:inherit;border:1px solid var(--digi--color--border--interactive--default--on-input);border-left:none;padding:0;font:inherit;outline:inherit;cursor:pointer}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__input-field.sc-digi-calendar-datepicker .digi-calendar-datepicker__input-button.sc-digi-calendar-datepicker .digi-calendar-datepicker__button-icon.sc-digi-calendar-datepicker{box-sizing:content-box;width:var(--digi--datepicker--input-icon--width);padding:var(--digi--datepicker--input-icon--vertical-padding) var(--digi--datepicker--input-icon--horizontal-padding)}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__input-field.sc-digi-calendar-datepicker .digi-calendar-datepicker__input-button.sc-digi-calendar-datepicker svg.sc-digi-calendar-datepicker{color:var(--digi--color--icon--brand-primary)}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__input-field.sc-digi-calendar-datepicker .digi-calendar-datepicker__input-button.sc-digi-calendar-datepicker:focus-visible{outline:2px solid black;outline-offset:2px;box-shadow:0px 0px 0px 5px white}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__input-field.sc-digi-calendar-datepicker .digi-calendar-datepicker__input-button.sc-digi-calendar-datepicker:hover,.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__input-field.sc-digi-calendar-datepicker .digi-calendar-datepicker__input-button.sc-digi-calendar-datepicker:focus{background:var(--digi--color--background--interactive--hover--secondary)}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__calendar.sc-digi-calendar-datepicker{max-width:var(--digi--datepicker--calendar--max-width);height:0px;border-radius:var(--digi--datepicker--border-radius);overflow:hidden;z-index:1}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__show-week-numbers.sc-digi-calendar-datepicker .digi-calendar-datepicker__calendar.sc-digi-calendar-datepicker{max-width:var(--digi--datepicker--calendar--show-week--max-width)}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__show-calendar.sc-digi-calendar-datepicker .digi-calendar-datepicker__calendar.sc-digi-calendar-datepicker{height:auto;background-color:var(--digi--datepicker--calendar--background-color);box-shadow:var(--digi--datepicker--calendar-shadow);position:absolute;top:var(--digi--datepicker--calendar--popup-top);left:0;pointer-events:auto}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__input-component.sc-digi-calendar-datepicker{--digi--form-input--padding:0 var(--digi--datepicker--input--inline-end) 0 var(--digi--datepicker--input--inline-start)}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__selected-date-alert.sc-digi-calendar-datepicker{border:0;clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sc-digi-calendar-datepicker-h .digi-calendar-datepicker__sr-instructions.sc-digi-calendar-datepicker{border:0;clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}";
2183
+ const DigiCalendarDatepickerStyle0 = calendarDatepickerCss;
2184
+
2185
+ const CalendarDatepicker = class {
2186
+ constructor(hostRef) {
2187
+ registerInstance(this, hostRef);
2188
+ this.afOnDateChange = createEvent(this, "afOnDateChange", 7);
2189
+ this.afOnDateChangeRawText = createEvent(this, "afOnDateChangeRawText", 7);
2190
+ this.afOnValidationChange = createEvent(this, "afOnValidationChange", 7);
2191
+ this.futureYears = 10;
2192
+ this.screenReaderUpdateTrigger = false;
2193
+ this.showWrongFormatError = false;
2194
+ this.showDisabledDateError = false;
2195
+ this.showCalendar = false;
2196
+ this.userInput = '';
2197
+ this.afId = randomIdGenerator('digi-calendar-datepicker');
2198
+ this.afLabel = _t.calendar.datepicker.label;
2199
+ this.afLabelDescription = undefined;
2200
+ this.afName = undefined;
2201
+ this.afOpenCalendarAriaLabel = _t.calendar.datepicker.openCalendarAriaLabel;
2202
+ this.afCloseCalendarAriaLabel = _t.calendar.datepicker.closeCalendarAriaLabel;
2203
+ this.afValidation = CalendarDatepickerValidation.NEUTRAL;
2204
+ this.afValidationText = undefined;
2205
+ this.afValidationWrongFormat = _t.calendar.datepicker.validationWrongFormat;
2206
+ this.afValidationDisabledDate = _t.calendar.datepicker.validationDisabledDate;
2207
+ this.afRequired = undefined;
2208
+ this.afDisableValidation = false;
2209
+ this.afRequiredText = undefined;
2210
+ this.afSelectedDates = [];
2211
+ this.afYearSelect = false;
2212
+ this.value = [];
2213
+ this.afMinDate = undefined;
2214
+ this.afMaxDate = undefined;
2215
+ this.afShowWeekNumber = false;
2216
+ this.afMultipleDates = false;
2217
+ this.afCloseOnSelect = false;
2218
+ this.afOpenCalendarTo = undefined;
2219
+ this.afErrorMessageIsAlert = true;
2220
+ }
2221
+ afDisableValidationChangeHandler(newVal) {
2222
+ if (!newVal) {
2223
+ const dates = this.userInput !== ''
2224
+ ? this.parseInputString(this.userInput)
2225
+ : this.afSelectedDates;
2226
+ this.validateInputAndShowErrors(dates);
2227
+ }
2228
+ else {
2229
+ this.showWrongFormatError = false;
2230
+ this.showDisabledDateError = false;
2231
+ }
2232
+ }
2233
+ afSelectedDatesChangeHandler(newVal) {
2234
+ if (!this.afDisableValidation && newVal.length > 0) {
2235
+ this.validateInputAndShowErrors(newVal);
2236
+ }
2237
+ }
2238
+ valueChangeHandler(newVal) {
2239
+ if (this.afDisableValidation && this.afSelectedDates.length > 0) {
2240
+ this.afSelectedDates = [];
2241
+ }
2242
+ /**
2243
+ * Behövde lägga till den här förändringen för att angular med value accessor betedde sig märkligt vid onBlur av input-fält. Den reagerade när man lämnade fältet även fast fältet var tomt (pratar om watchern). Så behövde bygga en guard/gatekeeper som kontrollerar värdet först. Ska inte påverka manuell-, eller autovalidering.
2244
+ */
2245
+ if (Array.isArray(newVal) &&
2246
+ newVal.every((d) => d instanceof Date && !isNaN(d.getTime()))) {
2247
+ this.afSelectedDates = newVal;
2248
+ this.userInput = '';
2249
+ }
2250
+ }
2251
+ afMinDateChangeHandler(newVal) {
2252
+ if (!this.afDisableValidation && newVal) {
2253
+ this.validateInputAndShowErrors(this.afSelectedDates);
2254
+ }
2255
+ }
2256
+ afMaxDateChangeHandler(newVal) {
2257
+ if (!this.afDisableValidation && newVal) {
2258
+ this.validateInputAndShowErrors(this.afSelectedDates);
2259
+ }
2260
+ }
2261
+ afMultipleDatesChangeHandler() {
2262
+ var _a;
2263
+ if (!this.afMultipleDates && this.afSelectedDates.length > 1) {
2264
+ this.afSelectedDates = this.afSelectedDates.slice(-1);
2265
+ this.value = (_a = this.afSelectedDates) !== null && _a !== void 0 ? _a : [];
2266
+ }
2267
+ }
2268
+ get errorMessageIsAlert() {
2269
+ return (this.afErrorMessageIsAlert !== false &&
2270
+ this.afErrorMessageIsAlert !== 'false');
2271
+ }
2272
+ clickHandler(e) {
2273
+ const target = e.target;
2274
+ const selector = `#${this.afId}-datepicker`;
2275
+ if (detectClickOutside(target, selector)) {
2276
+ this.showCalendar = false;
2277
+ }
2278
+ }
2279
+ /**
2280
+ * Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till själva input-elementet.
2281
+ * @en Listens for when focus is set on the custom element and propagates it down to the actual input element.
2282
+ */
2283
+ focusOnInput() {
2284
+ this._input.focus();
2285
+ }
2286
+ connectedCallback() {
2287
+ this.hostElement.addEventListener('keyup', this.keyUpHandler.bind(this));
2288
+ }
2289
+ disconnectedCallback() {
2290
+ this.hostElement.removeEventListener('keyup', this.keyUpHandler.bind(this));
2291
+ }
2292
+ componentDidLoad() {
2293
+ var _a;
2294
+ if ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) {
2295
+ this.setValue(this.value);
2296
+ }
2297
+ }
2298
+ componentDidUpdate() {
2299
+ if (this.showCalendar) {
2300
+ this.positionCalendar();
2301
+ }
2302
+ }
2303
+ get cssModifiers() {
2304
+ return {
2305
+ 'digi-calendar-datepicker__show-week-numbers': this.afShowWeekNumber,
2306
+ 'digi-calendar-datepicker__show-error': this.hasBuiltInValidationError() || this.hasCustomValidationError(),
2307
+ 'digi-calendar-datepicker__show-calendar': this.showCalendar
2308
+ };
2309
+ }
2310
+ keyUpHandler(e) {
2311
+ if (e.key === 'Escape' && this.showCalendar) {
2312
+ this.showCalendar = false;
2313
+ this.focusOnCalendarButton();
2314
+ e.stopPropagation();
2315
+ }
2316
+ }
2317
+ focusOnCalendarInput() {
2318
+ const input = this.hostElement.querySelector(`#${this.afId}-datepicker input`);
2319
+ input === null || input === void 0 ? void 0 : input.focus();
2320
+ }
2321
+ focusOnCalendarButton() {
2322
+ const calendarButton = this.hostElement.querySelector(`#${this.afId}-button`);
2323
+ calendarButton.focus();
2324
+ }
2325
+ positionCalendar() {
2326
+ const btn = this.hostElement.querySelector(`#${this.afId}-button`);
2327
+ const datepickerEl = this.hostElement.querySelector(`#${this.afId}-datepicker`);
2328
+ if (!btn || !datepickerEl)
2329
+ return;
2330
+ const btnRect = btn.getBoundingClientRect();
2331
+ const containerRect = datepickerEl.getBoundingClientRect();
2332
+ datepickerEl.style.setProperty('--digi--datepicker--calendar--popup-top', `${btnRect.bottom - containerRect.top + 5}px`);
2333
+ }
2334
+ toggleCalendar() {
2335
+ if (!this.showCalendar) {
2336
+ this.positionCalendar();
2337
+ }
2338
+ this.showCalendar = !this.showCalendar;
2339
+ if (this.showCalendar) {
2340
+ this.screenReaderUpdateTrigger = !this.screenReaderUpdateTrigger;
2341
+ }
2342
+ }
2343
+ parseInputString(value) {
2344
+ return value
2345
+ .split(new RegExp(`[&,]|${_t.and}`, 'g'))
2346
+ .map((text) => this.parseDateString(text.trim()));
2347
+ }
2348
+ resetValueAndState() {
2349
+ this.showWrongFormatError = false;
2350
+ this.showDisabledDateError = false;
2351
+ this.setValue([]);
2352
+ this.afOnDateChange.emit([]);
2353
+ this.afSelectedDates = [];
2354
+ }
2355
+ removeDuplicateDates(dates) {
2356
+ const seen = new Set();
2357
+ return dates.filter((date) => {
2358
+ if (!(date instanceof Date) || isNaN(date.getTime())) {
2359
+ return true;
2360
+ }
2361
+ const key = date.toISOString().split('T')[0]; // yyyy-mm-dd
2362
+ if (seen.has(key)) {
2363
+ return false;
2364
+ }
2365
+ seen.add(key);
2366
+ return true;
2367
+ });
2368
+ }
2369
+ validateInputAndShowErrors(dates) {
2370
+ this.showWrongFormatError = !!dates.find((date) => !isValid(date));
2371
+ this.showDisabledDateError = !!dates.find((date) => !this.isDateSelectable(date));
2372
+ const inputIsValid = !this.showWrongFormatError && !this.showDisabledDateError;
2373
+ this.afOnValidationChange.emit({
2374
+ isValid: inputIsValid,
2375
+ validationText: inputIsValid
2376
+ ? undefined
2377
+ : this.showWrongFormatError
2378
+ ? this.afValidationWrongFormat
2379
+ : this.afValidationDisabledDate
2380
+ });
2381
+ }
2382
+ setValue(value) {
2383
+ this.afSelectedDates = value;
2384
+ this.value = value;
2385
+ }
2386
+ parseInput(evt) {
2387
+ let newValue = '';
2388
+ if (evt.detail && typeof evt.detail.value === 'string') {
2389
+ newValue = evt.detail.value;
2390
+ }
2391
+ else if (evt.target && evt.target.value != null) {
2392
+ newValue = evt.target.value;
2393
+ }
2394
+ this.userInput = newValue;
2395
+ if (newValue === '') {
2396
+ this.resetValueAndState();
2397
+ return;
2398
+ }
2399
+ let dates = this.parseInputString(newValue);
2400
+ // Single dates - acceptera inte flera datum inskrivna
2401
+ if (!this.afDisableValidation &&
2402
+ !this.afMultipleDates &&
2403
+ dates.length > 1) {
2404
+ this.showWrongFormatError = true;
2405
+ this.afOnValidationChange.emit({
2406
+ isValid: false,
2407
+ validationText: this.afValidationWrongFormat
2408
+ });
2409
+ return;
2410
+ }
2411
+ // Multiple dates - filtrera bort dubbletter
2412
+ if (!this.afDisableValidation && this.afMultipleDates) {
2413
+ const uniqueDates = this.removeDuplicateDates(dates);
2414
+ if (uniqueDates.length !== dates.length) {
2415
+ dates = uniqueDates;
2416
+ this.userInput = this.datesToInputString(dates);
2417
+ }
2418
+ }
2419
+ this.setValue(dates);
2420
+ if (!this.afDisableValidation) {
2421
+ this.validateInputAndShowErrors(dates);
2422
+ }
2423
+ this.afOnDateChange.emit(dates);
2424
+ }
2425
+ parseCalendar(evt) {
2426
+ if (!(evt === null || evt === void 0 ? void 0 : evt.detail))
2427
+ return;
2428
+ if (!this.afDisableValidation) {
2429
+ this.showWrongFormatError = false;
2430
+ this.showDisabledDateError = false;
2431
+ }
2432
+ this.userInput = '';
2433
+ this.setValue(evt.detail);
2434
+ this.afOnDateChangeRawText.emit(this.inputValue);
2435
+ if (this.afCloseOnSelect) {
2436
+ this.toggleCalendar();
2437
+ this.focusOnCalendarButton();
2438
+ }
2439
+ this.afOnDateChange.emit(this.afSelectedDates);
2440
+ }
2441
+ /*
2442
+
2443
+ Metoden överskrider JavaScripts inbyggda "isValid"-funktion, då den tillåter att ex., "1" är rätt format medans ex., "13" är fel format vid YYYY-MM-DD krav på inmatat format.
2444
+
2445
+ */
2446
+ parseDateString(s) {
2447
+ const raw = s.trim().replace(/[./]/g, '-');
2448
+ // 1) yyyy-MM-dd
2449
+ if (/^\d{4}-\d{2}-\d{2}$/.test(raw)) {
2450
+ const d = parse(raw, 'yyyy-MM-dd', new Date());
2451
+ return isValid(d) ? d : new Date(NaN);
2452
+ }
2453
+ // 2) yyyymmdd
2454
+ if (/^\d{8}$/.test(raw)) {
2455
+ const yyyy = raw.slice(0, 4);
2456
+ const mm = raw.slice(4, 6);
2457
+ const dd = raw.slice(6, 8);
2458
+ const d = parse(`${yyyy}-${mm}-${dd}`, 'yyyy-MM-dd', new Date());
2459
+ return isValid(d) ? d : new Date(NaN);
2460
+ }
2461
+ // 3) yymmdd (map to full year using the previous futureYears logic)
2462
+ if (/^\d{6}$/.test(raw)) {
2463
+ const yy = raw.slice(0, 2);
2464
+ const mm = raw.slice(2, 4);
2465
+ const dd = raw.slice(4, 6);
2466
+ const yyyy = this.getFullYear(yy);
2467
+ const d = parse(`${yyyy}-${mm}-${dd}`, 'yyyy-MM-dd', new Date());
2468
+ return isValid(d) ? d : new Date(NaN);
2469
+ }
2470
+ // Everything else is invalid (so "1" and "25" will now be "Fel format")
2471
+ return new Date(NaN);
2472
+ }
2473
+ getFullYear(s) {
2474
+ if (s.length === 4)
2475
+ return s;
2476
+ const y = new Date().getFullYear().toString();
2477
+ return parseInt(s) > parseInt(y.slice(-2)) + this.futureYears
2478
+ ? parseInt(y.slice(0, -2)) - 1 + s
2479
+ : y.slice(0, -2) + s;
2480
+ }
2481
+ isDateSelectable(date) {
2482
+ if (this.afMinDate && this.isBefore(date, this.afMinDate))
2483
+ return false;
2484
+ if (this.afMaxDate && this.isAfter(date, this.afMaxDate))
2485
+ return false;
2486
+ return true;
2487
+ }
2488
+ isBefore(a, b) {
2489
+ return isBefore(this.dateWithoutTime(a), this.dateWithoutTime(b));
2490
+ }
2491
+ isAfter(a, b) {
2492
+ return isAfter(this.dateWithoutTime(a), this.dateWithoutTime(b));
2493
+ }
2494
+ dateWithoutTime(date) {
2495
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
2496
+ }
2497
+ hasBuiltInValidationError() {
2498
+ return this.showWrongFormatError || this.showDisabledDateError;
2499
+ }
2500
+ hasCustomValidationError() {
2501
+ return (this.afValidation &&
2502
+ this.afValidation !== CalendarDatepickerValidation.NEUTRAL);
2503
+ }
2504
+ getErrorText() {
2505
+ if (this.hasBuiltInValidationError()) {
2506
+ return this.showWrongFormatError
2507
+ ? this.afValidationWrongFormat
2508
+ : this.afValidationDisabledDate;
2509
+ }
2510
+ if (this.hasCustomValidationError()) {
2511
+ return this.afValidationText;
2512
+ }
2513
+ }
2514
+ get inputValue() {
2515
+ if (this.userInput !== '') {
2516
+ return this.userInput;
2517
+ }
2518
+ // otherwise format your real selected dates
2519
+ const sorted = this.afSelectedDates
2520
+ .slice()
2521
+ .sort((a, b) => (this.isBefore(a, b) ? -1 : 1));
2522
+ return this.datesToInputString(sorted);
2523
+ }
2524
+ datesToInputString(dates) {
2525
+ return dates.every((date) => date instanceof Date && !isNaN(date.getTime()))
2526
+ ? dates
2527
+ .map((date) => date.toLocaleDateString(_t.locale))
2528
+ .flatMap((date, index, all) => {
2529
+ const isLast = index == all.length - 1;
2530
+ const isFirst = index === 0;
2531
+ if (isFirst) {
2532
+ return date;
2533
+ }
2534
+ else if (isLast) {
2535
+ return [` ${_t.and} `, date];
2536
+ }
2537
+ else {
2538
+ return [', ', date];
2539
+ }
2540
+ })
2541
+ .join('')
2542
+ : '';
2543
+ }
2544
+ get getSelectedDates() {
2545
+ if (!this.afDisableValidation && this.hasBuiltInValidationError()) {
2546
+ return [];
2547
+ }
2548
+ return this.afSelectedDates;
2549
+ }
2550
+ render() {
2551
+ return (h(Host, { key: 'e6dcf21e94a0cf58081b2cc351291a9489eadcb6', tabindex: -1 }, h("div", { key: '4040e430dd3c55e9ed0a0e6ed5aa69dea906e7c3', class: Object.assign({ 'digi-calendar-datepicker': true }, this.cssModifiers), id: `${this.afId}-datepicker` }, h("div", { key: '823f9480cb8a77c1e3cecdc1f3982e426ab2e658', class: "digi-calendar-datepicker__input-field" }, h("digi-form-input", { key: '454ca3d0a8d489826891da25bba8d9e0359c1df0', ref: (el) => (this._input = el), class: 'digi-calendar-datepicker__input-component', afLabel: this.afLabel, afLabelDescription: this.afLabelDescription, afName: this.afName, afValue: this.inputValue, afValidation: this.hasBuiltInValidationError()
2552
+ ? FormInputValidation.ERROR
2553
+ : this.afValidation, afValidationText: this.getErrorText(), afId: this.afId, afAriaDescribedby: `${this.afId}--validation-message`, afRequired: this.afRequired, afRequiredText: this.afRequiredText, onAfOnChange: (evt) => {
2554
+ evt.stopImmediatePropagation();
2555
+ this.parseInput(evt);
2556
+ }, onAfOnBlur: (evt) => {
2557
+ evt.stopImmediatePropagation();
2558
+ this.afOnDateChangeRawText.emit(this.inputValue);
2559
+ }, onKeyDown: (e) => {
2560
+ // Focus trap: Catch backwards tab from input field and direct it to date button.
2561
+ if (!this.showCalendar || e.key !== 'Tab' || !e.shiftKey)
2562
+ return;
2563
+ if (e.target.tagName !== 'INPUT')
2564
+ return;
2565
+ e.preventDefault();
2566
+ const focusableDateButton = this.hostElement.querySelector('.digi-calendar__date[tabindex="0"]');
2567
+ focusableDateButton === null || focusableDateButton === void 0 ? void 0 : focusableDateButton.focus();
2568
+ } }, h("button", { key: '0ea8d3a9092c41f96a0cf24a2cdc4aa764e40bce', id: this.afId + '-button', class: "digi-calendar-datepicker__input-button", slot: "button", "aria-label": this.showCalendar
2569
+ ? this.afCloseCalendarAriaLabel
2570
+ : this.afOpenCalendarAriaLabel, "aria-controls": "calendar-popup", "aria-expanded": this.showCalendar ? 'true' : 'false', onClick: () => this.toggleCalendar(), type: "button" }, h("digi-icon-calendar-alt", { key: '31ceefc7f2be65159840b1ba6d998a71ba0c5543', class: "digi-calendar-datepicker__button-icon", slot: "icon" })))), h("div", { key: 'f8105569c6065a353300f87d1eabd88a10227081', class: "digi-calendar-datepicker__calendar", id: "calendar-popup" }, h("p", { key: 'b7e3556711de8ddb43a17874dada58193341ffcc', role: "alert", class: "digi-calendar-datepicker__sr-instructions" }, this.showCalendar
2571
+ ? `${_t.calendar.screenReaderInstructions}${this.screenReaderUpdateTrigger ? '\u200B' : ''}`
2572
+ : ''), h("digi-calendar", { key: '55286f75c9ff74bb5f11a5098d06aac6f5120017', afActive: this.showCalendar, afShowWeekNumber: this.afShowWeekNumber, afMultipleDates: this.afMultipleDates, afYearSelect: this.afYearSelect, afSelectedDates: this.getSelectedDates, afMinDate: this.afMinDate, afMaxDate: this.afMaxDate, "aria-hidden": !this.showCalendar, afOpenCalendarTo: this.afOpenCalendarTo, onAfOnDateSelectedChange: (evt) => {
2573
+ evt.stopImmediatePropagation();
2574
+ this.parseCalendar(evt);
2575
+ }, onKeyDown: (e) => {
2576
+ // Focus trap: Catch forward tab from last focusable element in calendar and direct it to the input.
2577
+ if (!this.showCalendar || e.key !== 'Tab' || e.shiftKey)
2578
+ return;
2579
+ if (!e.target.classList.contains('digi-calendar__date'))
2580
+ return;
2581
+ e.preventDefault();
2582
+ this.focusOnCalendarInput();
2583
+ } })), this.afCloseOnSelect && !this.afMultipleDates && (h("div", { key: 'f3d56c38d789cb0874ef1510e9ddd3e618255a76', class: "digi-calendar-datepicker__selected-date-alert", role: this.errorMessageIsAlert ? 'alert' : null }, this.afSelectedDates.length > 0
2584
+ ? `${_t.calendar.datepicker.selectedDate}: ${this.datesToInputString(this.afSelectedDates)}`
2585
+ : '')))));
2586
+ }
2587
+ get hostElement() { return getElement(this); }
2588
+ static get watchers() { return {
2589
+ "afDisableValidation": ["afDisableValidationChangeHandler"],
2590
+ "afSelectedDates": ["afSelectedDatesChangeHandler"],
2591
+ "value": ["valueChangeHandler"],
2592
+ "afMinDate": ["afMinDateChangeHandler"],
2593
+ "afMaxDate": ["afMaxDateChangeHandler"],
2594
+ "afMultipleDates": ["afMultipleDatesChangeHandler"]
2595
+ }; }
2596
+ };
2597
+ CalendarDatepicker.style = DigiCalendarDatepickerStyle0;
2598
+
2599
+ export { CalendarDatepicker as digi_calendar_datepicker };