@rededor/cura 0.5.4 → 1.0.0-alpha.0

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 (640) hide show
  1. package/dist/assets/icons/iconset-default-list.ts +1 -1
  2. package/dist/assets/icons/iconset-default-tmp.svg +8 -0
  3. package/dist/assets/icons/iconset-default.svg +1 -1
  4. package/dist/cjs/app-globals-bcffd819.js +511 -0
  5. package/dist/cjs/app-globals-bcffd819.js.map +1 -0
  6. package/dist/cjs/cura-accordion_9.cjs.entry.js +544 -0
  7. package/dist/cjs/cura-accordion_9.cjs.entry.js.map +1 -0
  8. package/dist/cjs/cura-alert.cjs.entry.js +57 -55
  9. package/dist/cjs/cura-alert.cjs.entry.js.map +1 -1
  10. package/dist/cjs/cura-avatar.cjs.entry.js +68 -0
  11. package/dist/cjs/cura-avatar.cjs.entry.js.map +1 -0
  12. package/dist/cjs/cura-button-outline.cjs.entry.js +102 -71
  13. package/dist/cjs/cura-button-outline.cjs.entry.js.map +1 -1
  14. package/dist/cjs/cura-button-select.cjs.entry.js +91 -85
  15. package/dist/cjs/cura-button-select.cjs.entry.js.map +1 -1
  16. package/dist/cjs/cura-button-transparent_2.cjs.entry.js +4055 -0
  17. package/dist/cjs/cura-button-transparent_2.cjs.entry.js.map +1 -0
  18. package/dist/cjs/cura-calendar.cjs.entry.js +3913 -0
  19. package/dist/cjs/cura-calendar.cjs.entry.js.map +1 -0
  20. package/dist/cjs/cura-card.cjs.entry.js +53 -0
  21. package/dist/cjs/cura-card.cjs.entry.js.map +1 -0
  22. package/dist/cjs/cura-checkbox.cjs.entry.js +168 -131
  23. package/dist/cjs/cura-checkbox.cjs.entry.js.map +1 -1
  24. package/dist/cjs/cura-display.cjs.entry.js +63 -62
  25. package/dist/cjs/cura-display.cjs.entry.js.map +1 -1
  26. package/dist/cjs/cura-dropdown-search-option-title.cjs.entry.js +22 -0
  27. package/dist/cjs/cura-dropdown-search-option-title.cjs.entry.js.map +1 -0
  28. package/dist/cjs/cura-dropdown-search-option.cjs.entry.js +55 -0
  29. package/dist/cjs/cura-dropdown-search-option.cjs.entry.js.map +1 -0
  30. package/dist/cjs/cura-dropdown-search.cjs.entry.js +209 -0
  31. package/dist/cjs/cura-dropdown-search.cjs.entry.js.map +1 -0
  32. package/dist/cjs/cura-forms.definitions-c164f1b8.js +20 -0
  33. package/dist/cjs/cura-forms.definitions-c164f1b8.js.map +1 -0
  34. package/dist/cjs/cura-icon.definitions-8d714f6a.js +21 -0
  35. package/dist/cjs/cura-icon.definitions-8d714f6a.js.map +1 -0
  36. package/dist/cjs/cura-icons-view.cjs.entry.js +24 -23
  37. package/dist/cjs/cura-icons-view.cjs.entry.js.map +1 -1
  38. package/dist/cjs/cura-radio.cjs.entry.js +142 -103
  39. package/dist/cjs/cura-radio.cjs.entry.js.map +1 -1
  40. package/dist/cjs/cura-select_2.cjs.entry.js +325 -0
  41. package/dist/cjs/cura-select_2.cjs.entry.js.map +1 -0
  42. package/dist/cjs/cura-switch.cjs.entry.js +113 -78
  43. package/dist/cjs/cura-switch.cjs.entry.js.map +1 -1
  44. package/dist/cjs/cura.cjs.js +13 -22
  45. package/dist/cjs/cura.cjs.js.map +1 -1
  46. package/dist/cjs/index-5b63ff7a.js +1529 -0
  47. package/dist/cjs/index-5b63ff7a.js.map +1 -0
  48. package/dist/cjs/index.cjs.js +1 -1
  49. package/dist/cjs/index.cjs.js.map +1 -1
  50. package/dist/cjs/loader.cjs.js +6 -31
  51. package/dist/cjs/loader.cjs.js.map +1 -1
  52. package/dist/collection/api/cura-api.js +30 -30
  53. package/dist/collection/api/cura-api.js.map +1 -1
  54. package/dist/collection/api/cura-api.type.js +2 -2
  55. package/dist/collection/api/cura-api.type.js.map +1 -1
  56. package/dist/collection/api/modules/cura-theme-breakpoints-module.js +10 -10
  57. package/dist/collection/api/modules/cura-theme-breakpoints-module.js.map +1 -1
  58. package/dist/collection/api/modules/cura-theme-colors-module.js +72 -72
  59. package/dist/collection/api/modules/cura-theme-colors-module.js.map +1 -1
  60. package/dist/collection/api/modules/cura-theme-fonts-module.js +28 -28
  61. package/dist/collection/api/modules/cura-theme-fonts-module.js.map +1 -1
  62. package/dist/collection/api/modules/cura-theme-module.js +66 -66
  63. package/dist/collection/api/modules/cura-theme-module.js.map +1 -1
  64. package/dist/collection/api/modules/cura-theme-spacing-module.js +9 -9
  65. package/dist/collection/api/modules/cura-theme-spacing-module.js.map +1 -1
  66. package/dist/collection/api/theme-presets/static.js +63 -63
  67. package/dist/collection/api/theme-presets/static.js.map +1 -1
  68. package/dist/collection/api/theme-presets/theme-default.js +41 -41
  69. package/dist/collection/api/theme-presets/theme-default.js.map +1 -1
  70. package/dist/collection/api/theme-presets/theme-legacy-default.js +24 -24
  71. package/dist/collection/api/theme-presets/theme-legacy-default.js.map +1 -1
  72. package/dist/collection/api/theme-presets/theme-maternity.js +38 -38
  73. package/dist/collection/api/theme-presets/theme-maternity.js.map +1 -1
  74. package/dist/collection/api/theme-presets/theme-oncology.js +46 -46
  75. package/dist/collection/api/theme-presets/theme-oncology.js.map +1 -1
  76. package/dist/collection/api/theme-presets/theme-presets.js +8 -8
  77. package/dist/collection/api/theme-presets/theme-presets.js.map +1 -1
  78. package/dist/collection/assets/icons/iconset-default-list.js +1 -1
  79. package/dist/collection/assets/icons/iconset-default-list.js.map +1 -1
  80. package/dist/collection/assets/icons/iconset-default-tmp.svg +8 -0
  81. package/dist/collection/assets/icons/iconset-default.svg +1 -1
  82. package/dist/collection/assets/images/avatar/doctor-default.svg +8 -0
  83. package/dist/collection/assets/images/avatar/dora-default.svg +5 -0
  84. package/dist/collection/assets/images/avatar/patient-default.svg +12 -0
  85. package/dist/collection/assets/images/avatar/unit-default.svg +9 -0
  86. package/dist/collection/assets/images/logoCura.svg +15 -0
  87. package/dist/collection/assets-raw/icons/default/contacts.svg +3 -0
  88. package/dist/collection/assets-raw/icons/default/scheduleCancel.svg +3 -0
  89. package/dist/collection/collection-manifest.json +29 -21
  90. package/dist/collection/components/accordion/cura-accordion/cura-accordion.js +267 -267
  91. package/dist/collection/components/accordion/cura-accordion/cura-accordion.js.map +1 -1
  92. package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js +127 -127
  93. package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js.map +1 -1
  94. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js +196 -196
  95. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js.map +1 -1
  96. package/dist/collection/components/buttons/cura-button/cura-button.css +112 -46
  97. package/dist/collection/components/buttons/cura-button/cura-button.js +368 -306
  98. package/dist/collection/components/buttons/cura-button/cura-button.js.map +1 -1
  99. package/dist/collection/components/buttons/cura-button/cura-button.stories.js +184 -159
  100. package/dist/collection/components/buttons/cura-button/cura-button.stories.js.map +1 -1
  101. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.css +37 -64
  102. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js +374 -306
  103. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js.map +1 -1
  104. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js +184 -159
  105. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js.map +1 -1
  106. package/dist/collection/components/buttons/cura-button-select/cura-button-select.css +36 -23
  107. package/dist/collection/components/buttons/cura-button-select/cura-button-select.js +265 -260
  108. package/dist/collection/components/buttons/cura-button-select/cura-button-select.js.map +1 -1
  109. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.css +32 -50
  110. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +339 -306
  111. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js.map +1 -1
  112. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js +172 -159
  113. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js.map +1 -1
  114. package/dist/collection/components/cura-alert/cura-alert.js +182 -164
  115. package/dist/collection/components/cura-alert/cura-alert.js.map +1 -1
  116. package/dist/collection/components/cura-alert/cura-alert.stories.js +90 -77
  117. package/dist/collection/components/cura-alert/cura-alert.stories.js.map +1 -1
  118. package/dist/collection/components/cura-avatar/cura-avatar.css +24 -0
  119. package/dist/collection/components/cura-avatar/cura-avatar.definitions.js +7 -0
  120. package/dist/collection/components/cura-avatar/cura-avatar.definitions.js.map +1 -0
  121. package/dist/collection/components/cura-avatar/cura-avatar.js +231 -0
  122. package/dist/collection/components/cura-avatar/cura-avatar.js.map +1 -0
  123. package/dist/collection/components/cura-avatar/cura-avatar.stories.js +198 -0
  124. package/dist/collection/components/cura-avatar/cura-avatar.stories.js.map +1 -0
  125. package/dist/collection/components/cura-calendar/cura-calendar.css +181 -0
  126. package/dist/collection/components/cura-calendar/cura-calendar.js +681 -0
  127. package/dist/collection/components/cura-calendar/cura-calendar.js.map +1 -0
  128. package/dist/collection/components/cura-calendar/cura-calendar.stories.js +126 -0
  129. package/dist/collection/components/cura-calendar/cura-calendar.stories.js.map +1 -0
  130. package/dist/collection/components/cura-card/cura-card.css +175 -0
  131. package/dist/collection/components/cura-card/cura-card.js +201 -0
  132. package/dist/collection/components/cura-card/cura-card.js.map +1 -0
  133. package/dist/collection/components/cura-card/cura-card.stories.js +127 -0
  134. package/dist/collection/components/cura-card/cura-card.stories.js.map +1 -0
  135. package/dist/collection/components/cura-icon/cura-icon.definitions.js +11 -11
  136. package/dist/collection/components/cura-icon/cura-icon.definitions.js.map +1 -1
  137. package/dist/collection/components/cura-icon/cura-icon.js +151 -151
  138. package/dist/collection/components/cura-icon/cura-icon.js.map +1 -1
  139. package/dist/collection/components/cura-icon/cura-icon.stories.js +60 -60
  140. package/dist/collection/components/cura-icon/cura-icon.stories.js.map +1 -1
  141. package/dist/collection/components/cura-icons-view/cura-icons-view.js +37 -37
  142. package/dist/collection/components/cura-icons-view/cura-icons-view.js.map +1 -1
  143. package/dist/collection/components/cura-icons-view/cura-icons-view.stories.js +7 -7
  144. package/dist/collection/components/cura-icons-view/cura-icons-view.stories.js.map +1 -1
  145. package/dist/collection/components/cura-page-template/cura-page-template.js +52 -52
  146. package/dist/collection/components/cura-page-template/cura-page-template.js.map +1 -1
  147. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.css +19 -11
  148. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +457 -427
  149. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js.map +1 -1
  150. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.stories.js +170 -170
  151. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.stories.js.map +1 -1
  152. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.css +50 -0
  153. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js +136 -0
  154. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js.map +1 -0
  155. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.js +56 -0
  156. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.js.map +1 -0
  157. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.css +10 -0
  158. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.js +19 -0
  159. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.js.map +1 -0
  160. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.css +149 -0
  161. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js +384 -0
  162. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js.map +1 -0
  163. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.stories.js +181 -0
  164. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.stories.js.map +1 -0
  165. package/dist/collection/components/forms/cura-forms.definitions.js +12 -12
  166. package/dist/collection/components/forms/cura-forms.definitions.js.map +1 -1
  167. package/dist/collection/components/forms/cura-input-text/cura-input-text.css +849 -139
  168. package/dist/collection/components/forms/cura-input-text/cura-input-text.js +732 -641
  169. package/dist/collection/components/forms/cura-input-text/cura-input-text.js.map +1 -1
  170. package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js +217 -196
  171. package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js.map +1 -1
  172. package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js +40 -40
  173. package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js.map +1 -1
  174. package/dist/collection/components/forms/cura-label/cura-label.js +187 -187
  175. package/dist/collection/components/forms/cura-label/cura-label.js.map +1 -1
  176. package/dist/collection/components/forms/cura-label/cura-label.stories.js +108 -108
  177. package/dist/collection/components/forms/cura-label/cura-label.stories.js.map +1 -1
  178. package/dist/collection/components/forms/cura-radio/cura-radio.js +395 -363
  179. package/dist/collection/components/forms/cura-radio/cura-radio.js.map +1 -1
  180. package/dist/collection/components/forms/cura-radio/cura-radio.stories.js +150 -150
  181. package/dist/collection/components/forms/cura-radio/cura-radio.stories.js.map +1 -1
  182. package/dist/collection/components/forms/cura-select/cura-select.css +519 -0
  183. package/dist/collection/components/forms/cura-select/cura-select.js +444 -0
  184. package/dist/collection/components/forms/cura-select/cura-select.js.map +1 -0
  185. package/dist/collection/components/forms/cura-select/cura-select.stories.js +144 -0
  186. package/dist/collection/components/forms/cura-select/cura-select.stories.js.map +1 -0
  187. package/dist/collection/components/forms/cura-select-options/cura-select-option.css +28 -0
  188. package/dist/collection/components/forms/cura-select-options/cura-select-option.js +138 -0
  189. package/dist/collection/components/forms/cura-select-options/cura-select-option.js.map +1 -0
  190. package/dist/collection/components/forms/cura-switch/cura-switch.css +88 -24
  191. package/dist/collection/components/forms/cura-switch/cura-switch.js +292 -264
  192. package/dist/collection/components/forms/cura-switch/cura-switch.js.map +1 -1
  193. package/dist/collection/components/forms/cura-switch/cura-switch.stories.js +115 -115
  194. package/dist/collection/components/forms/cura-switch/cura-switch.stories.js.map +1 -1
  195. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js +74 -74
  196. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js.map +1 -1
  197. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.stories.js +41 -41
  198. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.stories.js.map +1 -1
  199. package/dist/collection/components/text/cura-display/cura-display.js +174 -174
  200. package/dist/collection/components/text/cura-display/cura-display.js.map +1 -1
  201. package/dist/collection/components/text/cura-display/cura-display.stories.js +97 -97
  202. package/dist/collection/components/text/cura-display/cura-display.stories.js.map +1 -1
  203. package/dist/collection/components/text/cura-heading/cura-heading.js +220 -220
  204. package/dist/collection/components/text/cura-heading/cura-heading.js.map +1 -1
  205. package/dist/collection/components/text/cura-heading/cura-heading.stories.js +117 -117
  206. package/dist/collection/components/text/cura-heading/cura-heading.stories.js.map +1 -1
  207. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +168 -168
  208. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js.map +1 -1
  209. package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js +98 -98
  210. package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js.map +1 -1
  211. package/dist/collection/index.js +1 -1
  212. package/dist/collection/index.js.map +1 -1
  213. package/dist/collection/rededor-cura-start.js +7 -7
  214. package/dist/collection/rededor-cura-start.js.map +1 -1
  215. package/dist/collection/utils/utils.js +11 -11
  216. package/dist/collection/utils/utils.js.map +1 -1
  217. package/dist/components/cura-accordion-item.d.ts +2 -2
  218. package/dist/components/cura-accordion-item.js +62 -61
  219. package/dist/components/cura-accordion-item.js.map +1 -1
  220. package/dist/components/cura-accordion.d.ts +2 -2
  221. package/dist/components/cura-accordion.js +108 -104
  222. package/dist/components/cura-accordion.js.map +1 -1
  223. package/dist/components/cura-alert.d.ts +2 -2
  224. package/dist/components/cura-alert.js +93 -88
  225. package/dist/components/cura-alert.js.map +1 -1
  226. package/dist/components/cura-avatar.d.ts +11 -0
  227. package/dist/components/cura-avatar.js +95 -0
  228. package/dist/components/cura-avatar.js.map +1 -0
  229. package/dist/components/cura-button-outline.d.ts +2 -2
  230. package/dist/components/cura-button-outline.js +147 -109
  231. package/dist/components/cura-button-outline.js.map +1 -1
  232. package/dist/components/cura-button-select.d.ts +2 -2
  233. package/dist/components/cura-button-select.js +129 -113
  234. package/dist/components/cura-button-select.js.map +1 -1
  235. package/dist/components/cura-button-transparent.d.ts +2 -2
  236. package/dist/components/cura-button-transparent.js +1 -116
  237. package/dist/components/cura-button-transparent.js.map +1 -1
  238. package/dist/components/cura-button-transparent2.js +144 -0
  239. package/dist/components/cura-button-transparent2.js.map +1 -0
  240. package/dist/components/cura-button.d.ts +2 -2
  241. package/dist/components/cura-button.js +145 -109
  242. package/dist/components/cura-button.js.map +1 -1
  243. package/dist/components/cura-calendar.d.ts +11 -0
  244. package/dist/components/cura-calendar.js +3969 -0
  245. package/dist/components/cura-calendar.js.map +1 -0
  246. package/dist/components/cura-card.d.ts +11 -0
  247. package/dist/components/cura-card.js +75 -0
  248. package/dist/components/cura-card.js.map +1 -0
  249. package/dist/components/cura-checkbox.d.ts +2 -2
  250. package/dist/components/cura-checkbox.js +210 -174
  251. package/dist/components/cura-checkbox.js.map +1 -1
  252. package/dist/components/cura-display.d.ts +2 -2
  253. package/dist/components/cura-display.js +85 -81
  254. package/dist/components/cura-display.js.map +1 -1
  255. package/dist/components/cura-dropdown-search-option-title.d.ts +11 -0
  256. package/dist/components/cura-dropdown-search-option-title.js +42 -0
  257. package/dist/components/cura-dropdown-search-option-title.js.map +1 -0
  258. package/dist/components/cura-dropdown-search-option.d.ts +11 -0
  259. package/dist/components/cura-dropdown-search-option.js +82 -0
  260. package/dist/components/cura-dropdown-search-option.js.map +1 -0
  261. package/dist/components/cura-dropdown-search.d.ts +11 -0
  262. package/dist/components/cura-dropdown-search.js +272 -0
  263. package/dist/components/cura-dropdown-search.js.map +1 -0
  264. package/dist/components/cura-forms.definitions.js +12 -12
  265. package/dist/components/cura-forms.definitions.js.map +1 -1
  266. package/dist/components/cura-heading.d.ts +2 -2
  267. package/dist/components/cura-heading2.js +97 -93
  268. package/dist/components/cura-heading2.js.map +1 -1
  269. package/dist/components/cura-icon.d.ts +2 -2
  270. package/dist/components/cura-icon2.js +74 -69
  271. package/dist/components/cura-icon2.js.map +1 -1
  272. package/dist/components/cura-icons-view.d.ts +2 -2
  273. package/dist/components/cura-icons-view.js +57 -56
  274. package/dist/components/cura-icons-view.js.map +1 -1
  275. package/dist/components/cura-input-text.d.ts +2 -2
  276. package/dist/components/cura-input-text.js +1 -3954
  277. package/dist/components/cura-input-text.js.map +1 -1
  278. package/dist/{cjs/cura-input-text.cjs.entry.js → components/cura-input-text2.js} +393 -283
  279. package/dist/components/cura-input-text2.js.map +1 -0
  280. package/dist/components/cura-label.d.ts +2 -2
  281. package/dist/components/cura-label2.js +81 -77
  282. package/dist/components/cura-label2.js.map +1 -1
  283. package/dist/components/cura-loader-circle.d.ts +2 -2
  284. package/dist/components/cura-loader-circle2.js +41 -40
  285. package/dist/components/cura-loader-circle2.js.map +1 -1
  286. package/dist/components/cura-page-template.d.ts +2 -2
  287. package/dist/components/cura-page-template.js +36 -35
  288. package/dist/components/cura-page-template.js.map +1 -1
  289. package/dist/components/cura-paragraph.d.ts +2 -2
  290. package/dist/components/cura-paragraph2.js +79 -75
  291. package/dist/components/cura-paragraph2.js.map +1 -1
  292. package/dist/components/cura-radio.d.ts +2 -2
  293. package/dist/components/cura-radio.js +176 -139
  294. package/dist/components/cura-radio.js.map +1 -1
  295. package/dist/components/cura-select-option.d.ts +11 -0
  296. package/dist/components/cura-select-option.js +8 -0
  297. package/dist/components/cura-select-option.js.map +1 -0
  298. package/dist/components/cura-select-option2.js +87 -0
  299. package/dist/components/cura-select-option2.js.map +1 -0
  300. package/dist/components/cura-select.d.ts +11 -0
  301. package/dist/components/cura-select.js +8 -0
  302. package/dist/components/cura-select.js.map +1 -0
  303. package/dist/components/cura-select2.js +308 -0
  304. package/dist/components/cura-select2.js.map +1 -0
  305. package/dist/components/cura-switch.d.ts +2 -2
  306. package/dist/components/cura-switch.js +138 -105
  307. package/dist/components/cura-switch.js.map +1 -1
  308. package/dist/components/index.d.ts +6 -0
  309. package/dist/components/index.js +482 -466
  310. package/dist/components/index.js.map +1 -1
  311. package/dist/cura/cura.esm.js +1 -1
  312. package/dist/cura/cura.esm.js.map +1 -1
  313. package/dist/cura/index.esm.js.map +1 -1
  314. package/dist/cura/p-12d75346.entry.js +2 -0
  315. package/dist/cura/p-12d75346.entry.js.map +1 -0
  316. package/dist/cura/p-2176f253.entry.js +2 -0
  317. package/dist/cura/p-2176f253.entry.js.map +1 -0
  318. package/dist/cura/p-22292bfa.entry.js +2 -0
  319. package/dist/cura/p-22292bfa.entry.js.map +1 -0
  320. package/dist/cura/p-2a8be665.entry.js +2 -0
  321. package/dist/cura/p-2a8be665.entry.js.map +1 -0
  322. package/dist/cura/p-2d70b515.entry.js +2 -0
  323. package/dist/cura/p-2d70b515.entry.js.map +1 -0
  324. package/dist/cura/p-3c2ebc3a.entry.js +2 -0
  325. package/dist/cura/p-3c2ebc3a.entry.js.map +1 -0
  326. package/dist/cura/p-45a0a5e8.entry.js +2 -0
  327. package/dist/cura/p-45a0a5e8.entry.js.map +1 -0
  328. package/dist/cura/p-586bbe43.js +3 -0
  329. package/dist/cura/p-586bbe43.js.map +1 -0
  330. package/dist/cura/p-5d8e3ee3.entry.js +2 -0
  331. package/dist/cura/p-5d8e3ee3.entry.js.map +1 -0
  332. package/dist/cura/{p-f8fffdc1.js → p-70c369b1.js} +1 -1
  333. package/dist/cura/p-70c369b1.js.map +1 -0
  334. package/dist/cura/p-7c41f034.entry.js +2 -0
  335. package/dist/cura/p-7c41f034.entry.js.map +1 -0
  336. package/dist/cura/p-8cecf9e5.entry.js +2 -0
  337. package/dist/cura/p-8cecf9e5.entry.js.map +1 -0
  338. package/dist/cura/p-94b5c3b3.entry.js +2 -0
  339. package/dist/cura/p-94b5c3b3.entry.js.map +1 -0
  340. package/dist/cura/p-a5456007.entry.js +2 -0
  341. package/dist/cura/p-a5456007.entry.js.map +1 -0
  342. package/dist/cura/{p-c791725b.js → p-a7221f0c.js} +1 -1
  343. package/dist/{esm-es5/cura-icon.definitions-a63d1862.js.map → cura/p-a7221f0c.js.map} +1 -1
  344. package/dist/cura/p-cd757625.entry.js +2 -0
  345. package/dist/cura/p-cd757625.entry.js.map +1 -0
  346. package/dist/cura/p-de870781.entry.js +2 -0
  347. package/dist/cura/p-de870781.entry.js.map +1 -0
  348. package/dist/cura/p-e661bcca.entry.js +2 -0
  349. package/dist/cura/p-e661bcca.entry.js.map +1 -0
  350. package/dist/cura/p-ee7388a5.entry.js +2 -0
  351. package/dist/cura/p-ee7388a5.entry.js.map +1 -0
  352. package/dist/cura/{p-3688570d.js → p-f9b8f665.js} +1 -1
  353. package/dist/{esm-es5/cura-forms.definitions-0f774253.js.map → cura/p-f9b8f665.js.map} +1 -1
  354. package/dist/cura/p-fb9bece3.entry.js +2 -0
  355. package/dist/cura/p-fb9bece3.entry.js.map +1 -0
  356. package/dist/esm/app-globals-f2da2b14.js +509 -0
  357. package/dist/esm/app-globals-f2da2b14.js.map +1 -0
  358. package/dist/esm/cura-accordion_9.entry.js +532 -0
  359. package/dist/esm/cura-accordion_9.entry.js.map +1 -0
  360. package/dist/esm/cura-alert.entry.js +57 -55
  361. package/dist/esm/cura-alert.entry.js.map +1 -1
  362. package/dist/esm/cura-avatar.entry.js +64 -0
  363. package/dist/esm/cura-avatar.entry.js.map +1 -0
  364. package/dist/esm/cura-button-outline.entry.js +102 -71
  365. package/dist/esm/cura-button-outline.entry.js.map +1 -1
  366. package/dist/esm/cura-button-select.entry.js +91 -85
  367. package/dist/esm/cura-button-select.entry.js.map +1 -1
  368. package/dist/esm/{cura-input-text.entry.js → cura-button-transparent_2.entry.js} +423 -276
  369. package/dist/esm/cura-button-transparent_2.entry.js.map +1 -0
  370. package/dist/esm/cura-calendar.entry.js +3909 -0
  371. package/dist/esm/cura-calendar.entry.js.map +1 -0
  372. package/dist/esm/cura-card.entry.js +49 -0
  373. package/dist/esm/cura-card.entry.js.map +1 -0
  374. package/dist/esm/cura-checkbox.entry.js +168 -131
  375. package/dist/esm/cura-checkbox.entry.js.map +1 -1
  376. package/dist/esm/cura-display.entry.js +63 -62
  377. package/dist/esm/cura-display.entry.js.map +1 -1
  378. package/dist/esm/cura-dropdown-search-option-title.entry.js +18 -0
  379. package/dist/esm/cura-dropdown-search-option-title.entry.js.map +1 -0
  380. package/dist/esm/cura-dropdown-search-option.entry.js +51 -0
  381. package/dist/esm/cura-dropdown-search-option.entry.js.map +1 -0
  382. package/dist/esm/cura-dropdown-search.entry.js +205 -0
  383. package/dist/esm/cura-dropdown-search.entry.js.map +1 -0
  384. package/dist/esm/cura-forms.definitions-2f963167.js +18 -0
  385. package/dist/esm/cura-forms.definitions-2f963167.js.map +1 -0
  386. package/dist/esm/cura-icon.definitions-aaa4e80f.js +18 -0
  387. package/dist/esm/cura-icon.definitions-aaa4e80f.js.map +1 -0
  388. package/dist/esm/cura-icons-view.entry.js +24 -23
  389. package/dist/esm/cura-icons-view.entry.js.map +1 -1
  390. package/dist/esm/cura-radio.entry.js +142 -103
  391. package/dist/esm/cura-radio.entry.js.map +1 -1
  392. package/dist/esm/cura-select_2.entry.js +320 -0
  393. package/dist/esm/cura-select_2.entry.js.map +1 -0
  394. package/dist/esm/cura-switch.entry.js +113 -78
  395. package/dist/esm/cura-switch.entry.js.map +1 -1
  396. package/dist/esm/cura.js +14 -23
  397. package/dist/esm/cura.js.map +1 -1
  398. package/dist/esm/index-b6c443d5.js +1500 -0
  399. package/dist/esm/index-b6c443d5.js.map +1 -0
  400. package/dist/esm/index.js +1 -1
  401. package/dist/esm/index.js.map +1 -1
  402. package/dist/esm/loader.js +8 -33
  403. package/dist/esm/loader.js.map +1 -1
  404. package/dist/index.js +1 -1
  405. package/dist/loader/cdn.js +1 -3
  406. package/dist/loader/index.cjs.js +1 -3
  407. package/dist/loader/index.d.ts +4 -1
  408. package/dist/loader/index.es2017.js +1 -3
  409. package/dist/loader/index.js +1 -3
  410. package/dist/types/api/cura-api.d.ts +3 -3
  411. package/dist/types/api/cura-api.type.d.ts +44 -44
  412. package/dist/types/api/modules/cura-theme-breakpoints-module.d.ts +3 -3
  413. package/dist/types/api/modules/cura-theme-colors-module.d.ts +46 -46
  414. package/dist/types/api/modules/cura-theme-fonts-module.d.ts +22 -22
  415. package/dist/types/api/modules/cura-theme-module.d.ts +25 -25
  416. package/dist/types/api/modules/cura-theme-spacing-module.d.ts +4 -4
  417. package/dist/types/api/theme-presets/static.d.ts +62 -62
  418. package/dist/types/api/theme-presets/theme-default.d.ts +38 -38
  419. package/dist/types/api/theme-presets/theme-legacy-default.d.ts +38 -38
  420. package/dist/types/api/theme-presets/theme-maternity.d.ts +38 -38
  421. package/dist/types/api/theme-presets/theme-oncology.d.ts +45 -45
  422. package/dist/types/api/theme-presets/theme-presets.d.ts +175 -175
  423. package/dist/types/components/accordion/cura-accordion/cura-accordion.d.ts +37 -37
  424. package/dist/types/components/accordion/cura-accordion/cura-accordion.stories.d.ts +140 -140
  425. package/dist/types/components/accordion/cura-accordion-item/cura-accordion-item.d.ts +27 -27
  426. package/dist/types/components/buttons/cura-button/cura-button.d.ts +70 -59
  427. package/dist/types/components/buttons/cura-button/cura-button.stories.d.ts +184 -155
  428. package/dist/types/components/buttons/cura-button-outline/cura-button-outline.d.ts +70 -59
  429. package/dist/types/components/buttons/cura-button-outline/cura-button-outline.stories.d.ts +184 -155
  430. package/dist/types/components/buttons/cura-button-select/cura-button-select.d.ts +48 -47
  431. package/dist/types/components/buttons/cura-button-transparent/cura-button-transparent.d.ts +65 -59
  432. package/dist/types/components/buttons/cura-button-transparent/cura-button-transparent.stories.d.ts +169 -155
  433. package/dist/types/components/cura-alert/cura-alert.d.ts +14 -13
  434. package/dist/types/components/cura-alert/cura-alert.stories.d.ts +85 -70
  435. package/dist/types/components/cura-avatar/cura-avatar.d.ts +24 -0
  436. package/dist/types/components/cura-avatar/cura-avatar.definitions.d.ts +14 -0
  437. package/dist/types/components/cura-avatar/cura-avatar.stories.d.ts +167 -0
  438. package/dist/types/components/cura-calendar/cura-calendar.d.ts +323 -0
  439. package/dist/types/components/cura-calendar/cura-calendar.stories.d.ts +128 -0
  440. package/dist/types/components/cura-card/cura-card.d.ts +48 -0
  441. package/dist/types/components/cura-card/cura-card.stories.d.ts +98 -0
  442. package/dist/types/components/cura-icon/cura-icon.d.ts +12 -12
  443. package/dist/types/components/cura-icon/cura-icon.definitions.d.ts +44 -44
  444. package/dist/types/components/cura-icon/cura-icon.stories.d.ts +56 -56
  445. package/dist/types/components/cura-icons-view/cura-icons-view.d.ts +6 -6
  446. package/dist/types/components/cura-icons-view/cura-icons-view.stories.d.ts +3 -3
  447. package/dist/types/components/cura-page-template/cura-page-template.d.ts +6 -6
  448. package/dist/types/components/forms/cura-checkbox/cura-checkbox.d.ts +111 -95
  449. package/dist/types/components/forms/cura-checkbox/cura-checkbox.stories.d.ts +193 -193
  450. package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.d.ts +27 -0
  451. package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.d.ts +44 -0
  452. package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.d.ts +3 -0
  453. package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.d.ts +103 -0
  454. package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.stories.d.ts +112 -0
  455. package/dist/types/components/forms/cura-forms.definitions.d.ts +12 -12
  456. package/dist/types/components/forms/cura-input-text/cura-input-text.d.ts +169 -132
  457. package/dist/types/components/forms/cura-input-text/cura-input-text.stories.d.ts +241 -218
  458. package/dist/types/components/forms/cura-input-text/mask-presets/input-mask-presets.d.ts +1 -2
  459. package/dist/types/components/forms/cura-label/cura-label.d.ts +52 -52
  460. package/dist/types/components/forms/cura-label/cura-label.stories.d.ts +112 -112
  461. package/dist/types/components/forms/cura-radio/cura-radio.d.ts +96 -74
  462. package/dist/types/components/forms/cura-radio/cura-radio.stories.d.ts +162 -162
  463. package/dist/types/components/forms/cura-select/cura-select.d.ts +176 -0
  464. package/dist/types/components/forms/cura-select/cura-select.stories.d.ts +156 -0
  465. package/dist/types/components/forms/cura-select-options/cura-select-option.d.ts +17 -0
  466. package/dist/types/components/forms/cura-switch/cura-switch.d.ts +78 -57
  467. package/dist/types/components/forms/cura-switch/cura-switch.stories.d.ts +121 -121
  468. package/dist/types/components/loaders/cura-loader-circle/cura-loader-circle.d.ts +21 -21
  469. package/dist/types/components/loaders/cura-loader-circle/cura-loader-circle.stories.d.ts +35 -35
  470. package/dist/types/components/text/cura-display/cura-display.d.ts +47 -47
  471. package/dist/types/components/text/cura-display/cura-display.stories.d.ts +101 -101
  472. package/dist/types/components/text/cura-heading/cura-heading.d.ts +58 -58
  473. package/dist/types/components/text/cura-heading/cura-heading.stories.d.ts +127 -127
  474. package/dist/types/components/text/cura-paragraph/cura-paragraph.d.ts +47 -47
  475. package/dist/types/components/text/cura-paragraph/cura-paragraph.stories.d.ts +99 -99
  476. package/dist/types/components.d.ts +689 -13
  477. package/dist/types/index.d.ts +4 -4
  478. package/dist/types/rededor-cura-start.d.ts +4 -4
  479. package/dist/types/stencil-public-runtime.d.ts +51 -15
  480. package/package.json +5 -5
  481. package/dist/cjs/app-globals-2988084b.js +0 -511
  482. package/dist/cjs/app-globals-2988084b.js.map +0 -1
  483. package/dist/cjs/css-shim-83cf0349.js +0 -8
  484. package/dist/cjs/css-shim-83cf0349.js.map +0 -1
  485. package/dist/cjs/cura-accordion_8.cjs.entry.js +0 -445
  486. package/dist/cjs/cura-accordion_8.cjs.entry.js.map +0 -1
  487. package/dist/cjs/cura-button-transparent.cjs.entry.js +0 -83
  488. package/dist/cjs/cura-button-transparent.cjs.entry.js.map +0 -1
  489. package/dist/cjs/cura-forms.definitions-11be2ebd.js +0 -20
  490. package/dist/cjs/cura-forms.definitions-11be2ebd.js.map +0 -1
  491. package/dist/cjs/cura-icon.definitions-b73b0178.js +0 -21
  492. package/dist/cjs/cura-icon.definitions-b73b0178.js.map +0 -1
  493. package/dist/cjs/cura-input-text.cjs.entry.js.map +0 -1
  494. package/dist/cjs/cura-label.cjs.entry.js +0 -69
  495. package/dist/cjs/cura-label.cjs.entry.js.map +0 -1
  496. package/dist/cjs/index-7616f620.js +0 -2281
  497. package/dist/cjs/index-7616f620.js.map +0 -1
  498. package/dist/cjs/shadow-css-8baae635.js +0 -391
  499. package/dist/cjs/shadow-css-8baae635.js.map +0 -1
  500. package/dist/collection/utils/utils.spec.js +0 -16
  501. package/dist/collection/utils/utils.spec.js.map +0 -1
  502. package/dist/cura/cura.js +0 -133
  503. package/dist/cura/p-118112e5.system.js +0 -14
  504. package/dist/cura/p-118112e5.system.js.map +0 -1
  505. package/dist/cura/p-120926c5.system.js +0 -2
  506. package/dist/cura/p-120926c5.system.js.map +0 -1
  507. package/dist/cura/p-1228e771.entry.js +0 -2
  508. package/dist/cura/p-1228e771.entry.js.map +0 -1
  509. package/dist/cura/p-183305c3.js +0 -2
  510. package/dist/cura/p-183305c3.js.map +0 -1
  511. package/dist/cura/p-2d42ccf4.entry.js +0 -2
  512. package/dist/cura/p-2d42ccf4.entry.js.map +0 -1
  513. package/dist/cura/p-3688570d.js.map +0 -1
  514. package/dist/cura/p-36a83bc7.system.js +0 -3
  515. package/dist/cura/p-36a83bc7.system.js.map +0 -1
  516. package/dist/cura/p-3f3355f3.system.entry.js +0 -2
  517. package/dist/cura/p-3f3355f3.system.entry.js.map +0 -1
  518. package/dist/cura/p-3f5de5e2.entry.js +0 -2
  519. package/dist/cura/p-3f5de5e2.entry.js.map +0 -1
  520. package/dist/cura/p-3f6aaefc.system.js +0 -2
  521. package/dist/cura/p-3f6aaefc.system.js.map +0 -1
  522. package/dist/cura/p-48426f60.system.js +0 -2
  523. package/dist/cura/p-48426f60.system.js.map +0 -1
  524. package/dist/cura/p-4db87e8d.system.entry.js +0 -2
  525. package/dist/cura/p-4db87e8d.system.entry.js.map +0 -1
  526. package/dist/cura/p-51e00a16.entry.js +0 -2
  527. package/dist/cura/p-51e00a16.entry.js.map +0 -1
  528. package/dist/cura/p-72a9ed55.entry.js +0 -2
  529. package/dist/cura/p-72a9ed55.entry.js.map +0 -1
  530. package/dist/cura/p-75b2e4d1.system.entry.js +0 -2
  531. package/dist/cura/p-75b2e4d1.system.entry.js.map +0 -1
  532. package/dist/cura/p-880917c1.entry.js +0 -2
  533. package/dist/cura/p-880917c1.entry.js.map +0 -1
  534. package/dist/cura/p-8d959fb2.entry.js +0 -2
  535. package/dist/cura/p-8d959fb2.entry.js.map +0 -1
  536. package/dist/cura/p-9471c93e.system.entry.js +0 -2
  537. package/dist/cura/p-9471c93e.system.entry.js.map +0 -1
  538. package/dist/cura/p-98014544.entry.js +0 -2
  539. package/dist/cura/p-98014544.entry.js.map +0 -1
  540. package/dist/cura/p-98352c92.system.entry.js +0 -2
  541. package/dist/cura/p-98352c92.system.entry.js.map +0 -1
  542. package/dist/cura/p-a32889a4.system.js +0 -2
  543. package/dist/cura/p-a32889a4.system.js.map +0 -1
  544. package/dist/cura/p-ab8c9a8f.system.entry.js +0 -2
  545. package/dist/cura/p-ab8c9a8f.system.entry.js.map +0 -1
  546. package/dist/cura/p-ad194144.entry.js +0 -2
  547. package/dist/cura/p-ad194144.entry.js.map +0 -1
  548. package/dist/cura/p-b0e13882.system.entry.js +0 -2
  549. package/dist/cura/p-b0e13882.system.entry.js.map +0 -1
  550. package/dist/cura/p-ba66d7be.js +0 -3
  551. package/dist/cura/p-ba66d7be.js.map +0 -1
  552. package/dist/cura/p-bb3f9d05.entry.js +0 -2
  553. package/dist/cura/p-bb3f9d05.entry.js.map +0 -1
  554. package/dist/cura/p-beab48cd.js +0 -13
  555. package/dist/cura/p-beab48cd.js.map +0 -1
  556. package/dist/cura/p-c791725b.js.map +0 -1
  557. package/dist/cura/p-cb4e2a0c.system.entry.js +0 -2
  558. package/dist/cura/p-cb4e2a0c.system.entry.js.map +0 -1
  559. package/dist/cura/p-d3f9c888.system.js +0 -2
  560. package/dist/cura/p-d3f9c888.system.js.map +0 -1
  561. package/dist/cura/p-e5e259fd.system.entry.js +0 -2
  562. package/dist/cura/p-e5e259fd.system.entry.js.map +0 -1
  563. package/dist/cura/p-edeffbfc.entry.js +0 -2
  564. package/dist/cura/p-edeffbfc.entry.js.map +0 -1
  565. package/dist/cura/p-f51705c2.system.entry.js +0 -2
  566. package/dist/cura/p-f51705c2.system.entry.js.map +0 -1
  567. package/dist/cura/p-f89f2ecc.system.entry.js +0 -2
  568. package/dist/cura/p-f89f2ecc.system.entry.js.map +0 -1
  569. package/dist/cura/p-f8fffdc1.js.map +0 -1
  570. package/dist/cura/p-fc4ba4ce.system.js +0 -2
  571. package/dist/cura/p-fc4ba4ce.system.js.map +0 -1
  572. package/dist/cura/p-fef52079.entry.js +0 -2
  573. package/dist/cura/p-fef52079.entry.js.map +0 -1
  574. package/dist/cura/p-ffd41520.system.entry.js +0 -2
  575. package/dist/cura/p-ffd41520.system.entry.js.map +0 -1
  576. package/dist/esm/app-globals-29001758.js +0 -509
  577. package/dist/esm/app-globals-29001758.js.map +0 -1
  578. package/dist/esm/css-shim-d13f0738.js +0 -6
  579. package/dist/esm/css-shim-d13f0738.js.map +0 -1
  580. package/dist/esm/cura-accordion_8.entry.js +0 -434
  581. package/dist/esm/cura-accordion_8.entry.js.map +0 -1
  582. package/dist/esm/cura-button-transparent.entry.js +0 -79
  583. package/dist/esm/cura-button-transparent.entry.js.map +0 -1
  584. package/dist/esm/cura-forms.definitions-0f774253.js +0 -18
  585. package/dist/esm/cura-forms.definitions-0f774253.js.map +0 -1
  586. package/dist/esm/cura-icon.definitions-a63d1862.js +0 -18
  587. package/dist/esm/cura-icon.definitions-a63d1862.js.map +0 -1
  588. package/dist/esm/cura-input-text.entry.js.map +0 -1
  589. package/dist/esm/cura-label.entry.js +0 -65
  590. package/dist/esm/cura-label.entry.js.map +0 -1
  591. package/dist/esm/index-81f1a268.js +0 -2249
  592. package/dist/esm/index-81f1a268.js.map +0 -1
  593. package/dist/esm/polyfills/core-js.js +0 -11
  594. package/dist/esm/polyfills/css-shim.js +0 -1
  595. package/dist/esm/polyfills/dom.js +0 -79
  596. package/dist/esm/polyfills/es5-html-element.js +0 -1
  597. package/dist/esm/polyfills/index.js +0 -34
  598. package/dist/esm/polyfills/system.js +0 -6
  599. package/dist/esm/shadow-css-07b0c8c8.js +0 -389
  600. package/dist/esm/shadow-css-07b0c8c8.js.map +0 -1
  601. package/dist/esm-es5/app-globals-29001758.js +0 -2
  602. package/dist/esm-es5/app-globals-29001758.js.map +0 -1
  603. package/dist/esm-es5/css-shim-d13f0738.js +0 -2
  604. package/dist/esm-es5/css-shim-d13f0738.js.map +0 -1
  605. package/dist/esm-es5/cura-accordion_8.entry.js +0 -2
  606. package/dist/esm-es5/cura-accordion_8.entry.js.map +0 -1
  607. package/dist/esm-es5/cura-alert.entry.js +0 -2
  608. package/dist/esm-es5/cura-alert.entry.js.map +0 -1
  609. package/dist/esm-es5/cura-button-outline.entry.js +0 -2
  610. package/dist/esm-es5/cura-button-outline.entry.js.map +0 -1
  611. package/dist/esm-es5/cura-button-select.entry.js +0 -2
  612. package/dist/esm-es5/cura-button-select.entry.js.map +0 -1
  613. package/dist/esm-es5/cura-button-transparent.entry.js +0 -2
  614. package/dist/esm-es5/cura-button-transparent.entry.js.map +0 -1
  615. package/dist/esm-es5/cura-checkbox.entry.js +0 -2
  616. package/dist/esm-es5/cura-checkbox.entry.js.map +0 -1
  617. package/dist/esm-es5/cura-display.entry.js +0 -2
  618. package/dist/esm-es5/cura-display.entry.js.map +0 -1
  619. package/dist/esm-es5/cura-forms.definitions-0f774253.js +0 -2
  620. package/dist/esm-es5/cura-icon.definitions-a63d1862.js +0 -2
  621. package/dist/esm-es5/cura-icons-view.entry.js +0 -2
  622. package/dist/esm-es5/cura-icons-view.entry.js.map +0 -1
  623. package/dist/esm-es5/cura-input-text.entry.js +0 -2
  624. package/dist/esm-es5/cura-input-text.entry.js.map +0 -1
  625. package/dist/esm-es5/cura-label.entry.js +0 -2
  626. package/dist/esm-es5/cura-label.entry.js.map +0 -1
  627. package/dist/esm-es5/cura-radio.entry.js +0 -2
  628. package/dist/esm-es5/cura-radio.entry.js.map +0 -1
  629. package/dist/esm-es5/cura-switch.entry.js +0 -2
  630. package/dist/esm-es5/cura-switch.entry.js.map +0 -1
  631. package/dist/esm-es5/cura.js +0 -2
  632. package/dist/esm-es5/cura.js.map +0 -1
  633. package/dist/esm-es5/index-81f1a268.js +0 -3
  634. package/dist/esm-es5/index-81f1a268.js.map +0 -1
  635. package/dist/esm-es5/index.js +0 -2
  636. package/dist/esm-es5/index.js.map +0 -1
  637. package/dist/esm-es5/loader.js +0 -2
  638. package/dist/esm-es5/loader.js.map +0 -1
  639. package/dist/esm-es5/shadow-css-07b0c8c8.js +0 -13
  640. package/dist/esm-es5/shadow-css-07b0c8c8.js.map +0 -1
@@ -0,0 +1,3909 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-b6c443d5.js';
2
+
3
+ function _typeof(o) {
4
+ "@babel/helpers - typeof";
5
+
6
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
7
+ return typeof o;
8
+ } : function (o) {
9
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
10
+ }, _typeof(o);
11
+ }
12
+
13
+ function toInteger(dirtyNumber) {
14
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
15
+ return NaN;
16
+ }
17
+ var number = Number(dirtyNumber);
18
+ if (isNaN(number)) {
19
+ return number;
20
+ }
21
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
22
+ }
23
+
24
+ function requiredArgs(required, args) {
25
+ if (args.length < required) {
26
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
27
+ }
28
+ }
29
+
30
+ /**
31
+ * @name toDate
32
+ * @category Common Helpers
33
+ * @summary Convert the given argument to an instance of Date.
34
+ *
35
+ * @description
36
+ * Convert the given argument to an instance of Date.
37
+ *
38
+ * If the argument is an instance of Date, the function returns its clone.
39
+ *
40
+ * If the argument is a number, it is treated as a timestamp.
41
+ *
42
+ * If the argument is none of the above, the function returns Invalid Date.
43
+ *
44
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
45
+ *
46
+ * @param {Date|Number} argument - the value to convert
47
+ * @returns {Date} the parsed date in the local time zone
48
+ * @throws {TypeError} 1 argument required
49
+ *
50
+ * @example
51
+ * // Clone the date:
52
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
53
+ * //=> Tue Feb 11 2014 11:30:30
54
+ *
55
+ * @example
56
+ * // Convert the timestamp to date:
57
+ * const result = toDate(1392098430000)
58
+ * //=> Tue Feb 11 2014 11:30:30
59
+ */
60
+ function toDate(argument) {
61
+ requiredArgs(1, arguments);
62
+ var argStr = Object.prototype.toString.call(argument);
63
+
64
+ // Clone the date
65
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
66
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
67
+ return new Date(argument.getTime());
68
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
69
+ return new Date(argument);
70
+ } else {
71
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
72
+ // eslint-disable-next-line no-console
73
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
74
+ // eslint-disable-next-line no-console
75
+ console.warn(new Error().stack);
76
+ }
77
+ return new Date(NaN);
78
+ }
79
+ }
80
+
81
+ /**
82
+ * @name addDays
83
+ * @category Day Helpers
84
+ * @summary Add the specified number of days to the given date.
85
+ *
86
+ * @description
87
+ * Add the specified number of days to the given date.
88
+ *
89
+ * @param {Date|Number} date - the date to be changed
90
+ * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
91
+ * @returns {Date} - the new date with the days added
92
+ * @throws {TypeError} - 2 arguments required
93
+ *
94
+ * @example
95
+ * // Add 10 days to 1 September 2014:
96
+ * const result = addDays(new Date(2014, 8, 1), 10)
97
+ * //=> Thu Sep 11 2014 00:00:00
98
+ */
99
+ function addDays(dirtyDate, dirtyAmount) {
100
+ requiredArgs(2, arguments);
101
+ var date = toDate(dirtyDate);
102
+ var amount = toInteger(dirtyAmount);
103
+ if (isNaN(amount)) {
104
+ return new Date(NaN);
105
+ }
106
+ if (!amount) {
107
+ // If 0 days, no-op to avoid changing times in the hour before end of DST
108
+ return date;
109
+ }
110
+ date.setDate(date.getDate() + amount);
111
+ return date;
112
+ }
113
+
114
+ /**
115
+ * @name addMonths
116
+ * @category Month Helpers
117
+ * @summary Add the specified number of months to the given date.
118
+ *
119
+ * @description
120
+ * Add the specified number of months to the given date.
121
+ *
122
+ * @param {Date|Number} date - the date to be changed
123
+ * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
124
+ * @returns {Date} the new date with the months added
125
+ * @throws {TypeError} 2 arguments required
126
+ *
127
+ * @example
128
+ * // Add 5 months to 1 September 2014:
129
+ * const result = addMonths(new Date(2014, 8, 1), 5)
130
+ * //=> Sun Feb 01 2015 00:00:00
131
+ */
132
+ function addMonths(dirtyDate, dirtyAmount) {
133
+ requiredArgs(2, arguments);
134
+ var date = toDate(dirtyDate);
135
+ var amount = toInteger(dirtyAmount);
136
+ if (isNaN(amount)) {
137
+ return new Date(NaN);
138
+ }
139
+ if (!amount) {
140
+ // If 0 months, no-op to avoid changing times in the hour before end of DST
141
+ return date;
142
+ }
143
+ var dayOfMonth = date.getDate();
144
+
145
+ // The JS Date object supports date math by accepting out-of-bounds values for
146
+ // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
147
+ // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
148
+ // want except that dates will wrap around the end of a month, meaning that
149
+ // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
150
+ // we'll default to the end of the desired month by adding 1 to the desired
151
+ // month and using a date of 0 to back up one day to the end of the desired
152
+ // month.
153
+ var endOfDesiredMonth = new Date(date.getTime());
154
+ endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
155
+ var daysInMonth = endOfDesiredMonth.getDate();
156
+ if (dayOfMonth >= daysInMonth) {
157
+ // If we're already at the end of the month, then this is the correct date
158
+ // and we're done.
159
+ return endOfDesiredMonth;
160
+ } else {
161
+ // Otherwise, we now know that setting the original day-of-month value won't
162
+ // cause an overflow, so set the desired day-of-month. Note that we can't
163
+ // just set the date of `endOfDesiredMonth` because that object may have had
164
+ // its time changed in the unusual case where where a DST transition was on
165
+ // the last day of the month and its local time was in the hour skipped or
166
+ // repeated next to a DST transition. So we use `date` instead which is
167
+ // guaranteed to still have the original time.
168
+ date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
169
+ return date;
170
+ }
171
+ }
172
+
173
+ /**
174
+ * @name addMilliseconds
175
+ * @category Millisecond Helpers
176
+ * @summary Add the specified number of milliseconds to the given date.
177
+ *
178
+ * @description
179
+ * Add the specified number of milliseconds to the given date.
180
+ *
181
+ * @param {Date|Number} date - the date to be changed
182
+ * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
183
+ * @returns {Date} the new date with the milliseconds added
184
+ * @throws {TypeError} 2 arguments required
185
+ *
186
+ * @example
187
+ * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
188
+ * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
189
+ * //=> Thu Jul 10 2014 12:45:30.750
190
+ */
191
+ function addMilliseconds(dirtyDate, dirtyAmount) {
192
+ requiredArgs(2, arguments);
193
+ var timestamp = toDate(dirtyDate).getTime();
194
+ var amount = toInteger(dirtyAmount);
195
+ return new Date(timestamp + amount);
196
+ }
197
+
198
+ var defaultOptions = {};
199
+ function getDefaultOptions() {
200
+ return defaultOptions;
201
+ }
202
+
203
+ /**
204
+ * @name startOfWeek
205
+ * @category Week Helpers
206
+ * @summary Return the start of a week for the given date.
207
+ *
208
+ * @description
209
+ * Return the start of a week for the given date.
210
+ * The result will be in the local timezone.
211
+ *
212
+ * @param {Date|Number} date - the original date
213
+ * @param {Object} [options] - an object with options.
214
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
215
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
216
+ * @returns {Date} the start of a week
217
+ * @throws {TypeError} 1 argument required
218
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
219
+ *
220
+ * @example
221
+ * // The start of a week for 2 September 2014 11:55:00:
222
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
223
+ * //=> Sun Aug 31 2014 00:00:00
224
+ *
225
+ * @example
226
+ * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
227
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
228
+ * //=> Mon Sep 01 2014 00:00:00
229
+ */
230
+ function startOfWeek(dirtyDate, options) {
231
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
232
+ requiredArgs(1, arguments);
233
+ var defaultOptions = getDefaultOptions();
234
+ var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
235
+
236
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
237
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
238
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
239
+ }
240
+ var date = toDate(dirtyDate);
241
+ var day = date.getDay();
242
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
243
+ date.setDate(date.getDate() - diff);
244
+ date.setHours(0, 0, 0, 0);
245
+ return date;
246
+ }
247
+
248
+ /**
249
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
250
+ * They usually appear for dates that denote time before the timezones were introduced
251
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
252
+ * and GMT+01:00:00 after that date)
253
+ *
254
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
255
+ * which would lead to incorrect calculations.
256
+ *
257
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
258
+ */
259
+ function getTimezoneOffsetInMilliseconds(date) {
260
+ var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
261
+ utcDate.setUTCFullYear(date.getFullYear());
262
+ return date.getTime() - utcDate.getTime();
263
+ }
264
+
265
+ /**
266
+ * @name startOfDay
267
+ * @category Day Helpers
268
+ * @summary Return the start of a day for the given date.
269
+ *
270
+ * @description
271
+ * Return the start of a day for the given date.
272
+ * The result will be in the local timezone.
273
+ *
274
+ * @param {Date|Number} date - the original date
275
+ * @returns {Date} the start of a day
276
+ * @throws {TypeError} 1 argument required
277
+ *
278
+ * @example
279
+ * // The start of a day for 2 September 2014 11:55:00:
280
+ * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
281
+ * //=> Tue Sep 02 2014 00:00:00
282
+ */
283
+ function startOfDay(dirtyDate) {
284
+ requiredArgs(1, arguments);
285
+ var date = toDate(dirtyDate);
286
+ date.setHours(0, 0, 0, 0);
287
+ return date;
288
+ }
289
+
290
+ /**
291
+ * Days in 1 week.
292
+ *
293
+ * @name daysInWeek
294
+ * @constant
295
+ * @type {number}
296
+ * @default
297
+ */
298
+
299
+ /**
300
+ * Milliseconds in 1 minute
301
+ *
302
+ * @name millisecondsInMinute
303
+ * @constant
304
+ * @type {number}
305
+ * @default
306
+ */
307
+ var millisecondsInMinute = 60000;
308
+
309
+ /**
310
+ * Milliseconds in 1 hour
311
+ *
312
+ * @name millisecondsInHour
313
+ * @constant
314
+ * @type {number}
315
+ * @default
316
+ */
317
+ var millisecondsInHour = 3600000;
318
+
319
+ /**
320
+ * @name isSameDay
321
+ * @category Day Helpers
322
+ * @summary Are the given dates in the same day (and year and month)?
323
+ *
324
+ * @description
325
+ * Are the given dates in the same day (and year and month)?
326
+ *
327
+ * @param {Date|Number} dateLeft - the first date to check
328
+ * @param {Date|Number} dateRight - the second date to check
329
+ * @returns {Boolean} the dates are in the same day (and year and month)
330
+ * @throws {TypeError} 2 arguments required
331
+ *
332
+ * @example
333
+ * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?
334
+ * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))
335
+ * //=> true
336
+ *
337
+ * @example
338
+ * // Are 4 September and 4 October in the same day?
339
+ * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))
340
+ * //=> false
341
+ *
342
+ * @example
343
+ * // Are 4 September, 2014 and 4 September, 2015 in the same day?
344
+ * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))
345
+ * //=> false
346
+ */
347
+ function isSameDay(dirtyDateLeft, dirtyDateRight) {
348
+ requiredArgs(2, arguments);
349
+ var dateLeftStartOfDay = startOfDay(dirtyDateLeft);
350
+ var dateRightStartOfDay = startOfDay(dirtyDateRight);
351
+ return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();
352
+ }
353
+
354
+ /**
355
+ * @name isDate
356
+ * @category Common Helpers
357
+ * @summary Is the given value a date?
358
+ *
359
+ * @description
360
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
361
+ *
362
+ * @param {*} value - the value to check
363
+ * @returns {boolean} true if the given value is a date
364
+ * @throws {TypeError} 1 arguments required
365
+ *
366
+ * @example
367
+ * // For a valid date:
368
+ * const result = isDate(new Date())
369
+ * //=> true
370
+ *
371
+ * @example
372
+ * // For an invalid date:
373
+ * const result = isDate(new Date(NaN))
374
+ * //=> true
375
+ *
376
+ * @example
377
+ * // For some value:
378
+ * const result = isDate('2014-02-31')
379
+ * //=> false
380
+ *
381
+ * @example
382
+ * // For an object:
383
+ * const result = isDate({})
384
+ * //=> false
385
+ */
386
+ function isDate(value) {
387
+ requiredArgs(1, arguments);
388
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
389
+ }
390
+
391
+ /**
392
+ * @name isValid
393
+ * @category Common Helpers
394
+ * @summary Is the given date valid?
395
+ *
396
+ * @description
397
+ * Returns false if argument is Invalid Date and true otherwise.
398
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
399
+ * Invalid Date is a Date, whose time value is NaN.
400
+ *
401
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
402
+ *
403
+ * @param {*} date - the date to check
404
+ * @returns {Boolean} the date is valid
405
+ * @throws {TypeError} 1 argument required
406
+ *
407
+ * @example
408
+ * // For the valid date:
409
+ * const result = isValid(new Date(2014, 1, 31))
410
+ * //=> true
411
+ *
412
+ * @example
413
+ * // For the value, convertable into a date:
414
+ * const result = isValid(1393804800000)
415
+ * //=> true
416
+ *
417
+ * @example
418
+ * // For the invalid date:
419
+ * const result = isValid(new Date(''))
420
+ * //=> false
421
+ */
422
+ function isValid(dirtyDate) {
423
+ requiredArgs(1, arguments);
424
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
425
+ return false;
426
+ }
427
+ var date = toDate(dirtyDate);
428
+ return !isNaN(Number(date));
429
+ }
430
+
431
+ /**
432
+ * @name endOfMonth
433
+ * @category Month Helpers
434
+ * @summary Return the end of a month for the given date.
435
+ *
436
+ * @description
437
+ * Return the end of a month for the given date.
438
+ * The result will be in the local timezone.
439
+ *
440
+ * @param {Date|Number} date - the original date
441
+ * @returns {Date} the end of a month
442
+ * @throws {TypeError} 1 argument required
443
+ *
444
+ * @example
445
+ * // The end of a month for 2 September 2014 11:55:00:
446
+ * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
447
+ * //=> Tue Sep 30 2014 23:59:59.999
448
+ */
449
+ function endOfMonth(dirtyDate) {
450
+ requiredArgs(1, arguments);
451
+ var date = toDate(dirtyDate);
452
+ var month = date.getMonth();
453
+ date.setFullYear(date.getFullYear(), month + 1, 0);
454
+ date.setHours(23, 59, 59, 999);
455
+ return date;
456
+ }
457
+
458
+ /**
459
+ * @name eachDayOfInterval
460
+ * @category Interval Helpers
461
+ * @summary Return the array of dates within the specified time interval.
462
+ *
463
+ * @description
464
+ * Return the array of dates within the specified time interval.
465
+ *
466
+ * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
467
+ * @param {Object} [options] - an object with options.
468
+ * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.
469
+ * @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end
470
+ * @throws {TypeError} 1 argument required
471
+ * @throws {RangeError} `options.step` must be a number greater than 1
472
+ * @throws {RangeError} The start of an interval cannot be after its end
473
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
474
+ *
475
+ * @example
476
+ * // Each day between 6 October 2014 and 10 October 2014:
477
+ * const result = eachDayOfInterval({
478
+ * start: new Date(2014, 9, 6),
479
+ * end: new Date(2014, 9, 10)
480
+ * })
481
+ * //=> [
482
+ * // Mon Oct 06 2014 00:00:00,
483
+ * // Tue Oct 07 2014 00:00:00,
484
+ * // Wed Oct 08 2014 00:00:00,
485
+ * // Thu Oct 09 2014 00:00:00,
486
+ * // Fri Oct 10 2014 00:00:00
487
+ * // ]
488
+ */
489
+ function eachDayOfInterval(dirtyInterval, options) {
490
+ var _options$step;
491
+ requiredArgs(1, arguments);
492
+ var interval = dirtyInterval || {};
493
+ var startDate = toDate(interval.start);
494
+ var endDate = toDate(interval.end);
495
+ var endTime = endDate.getTime();
496
+
497
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
498
+ if (!(startDate.getTime() <= endTime)) {
499
+ throw new RangeError('Invalid interval');
500
+ }
501
+ var dates = [];
502
+ var currentDate = startDate;
503
+ currentDate.setHours(0, 0, 0, 0);
504
+ var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);
505
+ if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');
506
+ while (currentDate.getTime() <= endTime) {
507
+ dates.push(toDate(currentDate));
508
+ currentDate.setDate(currentDate.getDate() + step);
509
+ currentDate.setHours(0, 0, 0, 0);
510
+ }
511
+ return dates;
512
+ }
513
+
514
+ /**
515
+ * @name eachMonthOfInterval
516
+ * @category Interval Helpers
517
+ * @summary Return the array of months within the specified time interval.
518
+ *
519
+ * @description
520
+ * Return the array of months within the specified time interval.
521
+ *
522
+ * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
523
+ * @returns {Date[]} the array with starts of months from the month of the interval start to the month of the interval end
524
+ * @throws {TypeError} 1 argument required
525
+ * @throws {RangeError} The start of an interval cannot be after its end
526
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
527
+ *
528
+ * @example
529
+ * // Each month between 6 February 2014 and 10 August 2014:
530
+ * const result = eachMonthOfInterval({
531
+ * start: new Date(2014, 1, 6),
532
+ * end: new Date(2014, 7, 10)
533
+ * })
534
+ * //=> [
535
+ * // Sat Feb 01 2014 00:00:00,
536
+ * // Sat Mar 01 2014 00:00:00,
537
+ * // Tue Apr 01 2014 00:00:00,
538
+ * // Thu May 01 2014 00:00:00,
539
+ * // Sun Jun 01 2014 00:00:00,
540
+ * // Tue Jul 01 2014 00:00:00,
541
+ * // Fri Aug 01 2014 00:00:00
542
+ * // ]
543
+ */
544
+ function eachMonthOfInterval(dirtyInterval) {
545
+ requiredArgs(1, arguments);
546
+ var interval = dirtyInterval || {};
547
+ var startDate = toDate(interval.start);
548
+ var endDate = toDate(interval.end);
549
+ var endTime = endDate.getTime();
550
+ var dates = [];
551
+
552
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
553
+ if (!(startDate.getTime() <= endTime)) {
554
+ throw new RangeError('Invalid interval');
555
+ }
556
+ var currentDate = startDate;
557
+ currentDate.setHours(0, 0, 0, 0);
558
+ currentDate.setDate(1);
559
+ while (currentDate.getTime() <= endTime) {
560
+ dates.push(toDate(currentDate));
561
+ currentDate.setMonth(currentDate.getMonth() + 1);
562
+ }
563
+ return dates;
564
+ }
565
+
566
+ /**
567
+ * @name startOfMonth
568
+ * @category Month Helpers
569
+ * @summary Return the start of a month for the given date.
570
+ *
571
+ * @description
572
+ * Return the start of a month for the given date.
573
+ * The result will be in the local timezone.
574
+ *
575
+ * @param {Date|Number} date - the original date
576
+ * @returns {Date} the start of a month
577
+ * @throws {TypeError} 1 argument required
578
+ *
579
+ * @example
580
+ * // The start of a month for 2 September 2014 11:55:00:
581
+ * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
582
+ * //=> Mon Sep 01 2014 00:00:00
583
+ */
584
+ function startOfMonth(dirtyDate) {
585
+ requiredArgs(1, arguments);
586
+ var date = toDate(dirtyDate);
587
+ date.setDate(1);
588
+ date.setHours(0, 0, 0, 0);
589
+ return date;
590
+ }
591
+
592
+ /**
593
+ * @name startOfYear
594
+ * @category Year Helpers
595
+ * @summary Return the start of a year for the given date.
596
+ *
597
+ * @description
598
+ * Return the start of a year for the given date.
599
+ * The result will be in the local timezone.
600
+ *
601
+ * @param {Date|Number} date - the original date
602
+ * @returns {Date} the start of a year
603
+ * @throws {TypeError} 1 argument required
604
+ *
605
+ * @example
606
+ * // The start of a year for 2 September 2014 11:55:00:
607
+ * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
608
+ * //=> Wed Jan 01 2014 00:00:00
609
+ */
610
+ function startOfYear(dirtyDate) {
611
+ requiredArgs(1, arguments);
612
+ var cleanDate = toDate(dirtyDate);
613
+ var date = new Date(0);
614
+ date.setFullYear(cleanDate.getFullYear(), 0, 1);
615
+ date.setHours(0, 0, 0, 0);
616
+ return date;
617
+ }
618
+
619
+ /**
620
+ * @name endOfWeek
621
+ * @category Week Helpers
622
+ * @summary Return the end of a week for the given date.
623
+ *
624
+ * @description
625
+ * Return the end of a week for the given date.
626
+ * The result will be in the local timezone.
627
+ *
628
+ * @param {Date|Number} date - the original date
629
+ * @param {Object} [options] - an object with options.
630
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
631
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
632
+ * @returns {Date} the end of a week
633
+ * @throws {TypeError} 1 argument required
634
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
635
+ *
636
+ * @example
637
+ * // The end of a week for 2 September 2014 11:55:00:
638
+ * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
639
+ * //=> Sat Sep 06 2014 23:59:59.999
640
+ *
641
+ * @example
642
+ * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
643
+ * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
644
+ * //=> Sun Sep 07 2014 23:59:59.999
645
+ */
646
+ function endOfWeek(dirtyDate, options) {
647
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
648
+ requiredArgs(1, arguments);
649
+ var defaultOptions = getDefaultOptions();
650
+ var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
651
+
652
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
653
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
654
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
655
+ }
656
+ var date = toDate(dirtyDate);
657
+ var day = date.getDay();
658
+ var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
659
+ date.setDate(date.getDate() + diff);
660
+ date.setHours(23, 59, 59, 999);
661
+ return date;
662
+ }
663
+
664
+ /**
665
+ * @name subMilliseconds
666
+ * @category Millisecond Helpers
667
+ * @summary Subtract the specified number of milliseconds from the given date.
668
+ *
669
+ * @description
670
+ * Subtract the specified number of milliseconds from the given date.
671
+ *
672
+ * @param {Date|Number} date - the date to be changed
673
+ * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
674
+ * @returns {Date} the new date with the milliseconds subtracted
675
+ * @throws {TypeError} 2 arguments required
676
+ *
677
+ * @example
678
+ * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
679
+ * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
680
+ * //=> Thu Jul 10 2014 12:45:29.250
681
+ */
682
+ function subMilliseconds(dirtyDate, dirtyAmount) {
683
+ requiredArgs(2, arguments);
684
+ var amount = toInteger(dirtyAmount);
685
+ return addMilliseconds(dirtyDate, -amount);
686
+ }
687
+
688
+ var MILLISECONDS_IN_DAY = 86400000;
689
+ function getUTCDayOfYear(dirtyDate) {
690
+ requiredArgs(1, arguments);
691
+ var date = toDate(dirtyDate);
692
+ var timestamp = date.getTime();
693
+ date.setUTCMonth(0, 1);
694
+ date.setUTCHours(0, 0, 0, 0);
695
+ var startOfYearTimestamp = date.getTime();
696
+ var difference = timestamp - startOfYearTimestamp;
697
+ return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
698
+ }
699
+
700
+ function startOfUTCISOWeek(dirtyDate) {
701
+ requiredArgs(1, arguments);
702
+ var weekStartsOn = 1;
703
+ var date = toDate(dirtyDate);
704
+ var day = date.getUTCDay();
705
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
706
+ date.setUTCDate(date.getUTCDate() - diff);
707
+ date.setUTCHours(0, 0, 0, 0);
708
+ return date;
709
+ }
710
+
711
+ function getUTCISOWeekYear(dirtyDate) {
712
+ requiredArgs(1, arguments);
713
+ var date = toDate(dirtyDate);
714
+ var year = date.getUTCFullYear();
715
+ var fourthOfJanuaryOfNextYear = new Date(0);
716
+ fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
717
+ fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
718
+ var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
719
+ var fourthOfJanuaryOfThisYear = new Date(0);
720
+ fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
721
+ fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
722
+ var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
723
+ if (date.getTime() >= startOfNextYear.getTime()) {
724
+ return year + 1;
725
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
726
+ return year;
727
+ } else {
728
+ return year - 1;
729
+ }
730
+ }
731
+
732
+ function startOfUTCISOWeekYear(dirtyDate) {
733
+ requiredArgs(1, arguments);
734
+ var year = getUTCISOWeekYear(dirtyDate);
735
+ var fourthOfJanuary = new Date(0);
736
+ fourthOfJanuary.setUTCFullYear(year, 0, 4);
737
+ fourthOfJanuary.setUTCHours(0, 0, 0, 0);
738
+ var date = startOfUTCISOWeek(fourthOfJanuary);
739
+ return date;
740
+ }
741
+
742
+ var MILLISECONDS_IN_WEEK$1 = 604800000;
743
+ function getUTCISOWeek(dirtyDate) {
744
+ requiredArgs(1, arguments);
745
+ var date = toDate(dirtyDate);
746
+ var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
747
+
748
+ // Round the number of days to the nearest integer
749
+ // because the number of milliseconds in a week is not constant
750
+ // (e.g. it's different in the week of the daylight saving time clock shift)
751
+ return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;
752
+ }
753
+
754
+ function startOfUTCWeek(dirtyDate, options) {
755
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
756
+ requiredArgs(1, arguments);
757
+ var defaultOptions = getDefaultOptions();
758
+ var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
759
+
760
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
761
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
762
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
763
+ }
764
+ var date = toDate(dirtyDate);
765
+ var day = date.getUTCDay();
766
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
767
+ date.setUTCDate(date.getUTCDate() - diff);
768
+ date.setUTCHours(0, 0, 0, 0);
769
+ return date;
770
+ }
771
+
772
+ function getUTCWeekYear(dirtyDate, options) {
773
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
774
+ requiredArgs(1, arguments);
775
+ var date = toDate(dirtyDate);
776
+ var year = date.getUTCFullYear();
777
+ var defaultOptions = getDefaultOptions();
778
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
779
+
780
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
781
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
782
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
783
+ }
784
+ var firstWeekOfNextYear = new Date(0);
785
+ firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
786
+ firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
787
+ var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
788
+ var firstWeekOfThisYear = new Date(0);
789
+ firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
790
+ firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
791
+ var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
792
+ if (date.getTime() >= startOfNextYear.getTime()) {
793
+ return year + 1;
794
+ } else if (date.getTime() >= startOfThisYear.getTime()) {
795
+ return year;
796
+ } else {
797
+ return year - 1;
798
+ }
799
+ }
800
+
801
+ function startOfUTCWeekYear(dirtyDate, options) {
802
+ var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
803
+ requiredArgs(1, arguments);
804
+ var defaultOptions = getDefaultOptions();
805
+ var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
806
+ var year = getUTCWeekYear(dirtyDate, options);
807
+ var firstWeek = new Date(0);
808
+ firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
809
+ firstWeek.setUTCHours(0, 0, 0, 0);
810
+ var date = startOfUTCWeek(firstWeek, options);
811
+ return date;
812
+ }
813
+
814
+ var MILLISECONDS_IN_WEEK = 604800000;
815
+ function getUTCWeek(dirtyDate, options) {
816
+ requiredArgs(1, arguments);
817
+ var date = toDate(dirtyDate);
818
+ var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
819
+
820
+ // Round the number of days to the nearest integer
821
+ // because the number of milliseconds in a week is not constant
822
+ // (e.g. it's different in the week of the daylight saving time clock shift)
823
+ return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
824
+ }
825
+
826
+ function addLeadingZeros(number, targetLength) {
827
+ var sign = number < 0 ? '-' : '';
828
+ var output = Math.abs(number).toString();
829
+ while (output.length < targetLength) {
830
+ output = '0' + output;
831
+ }
832
+ return sign + output;
833
+ }
834
+
835
+ /*
836
+ * | | Unit | | Unit |
837
+ * |-----|--------------------------------|-----|--------------------------------|
838
+ * | a | AM, PM | A* | |
839
+ * | d | Day of month | D | |
840
+ * | h | Hour [1-12] | H | Hour [0-23] |
841
+ * | m | Minute | M | Month |
842
+ * | s | Second | S | Fraction of second |
843
+ * | y | Year (abs) | Y | |
844
+ *
845
+ * Letters marked by * are not implemented but reserved by Unicode standard.
846
+ */
847
+ var formatters$2 = {
848
+ // Year
849
+ y: function y(date, token) {
850
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
851
+ // | Year | y | yy | yyy | yyyy | yyyyy |
852
+ // |----------|-------|----|-------|-------|-------|
853
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
854
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
855
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
856
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
857
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
858
+
859
+ var signedYear = date.getUTCFullYear();
860
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
861
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
862
+ return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
863
+ },
864
+ // Month
865
+ M: function M(date, token) {
866
+ var month = date.getUTCMonth();
867
+ return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
868
+ },
869
+ // Day of the month
870
+ d: function d(date, token) {
871
+ return addLeadingZeros(date.getUTCDate(), token.length);
872
+ },
873
+ // AM or PM
874
+ a: function a(date, token) {
875
+ var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
876
+ switch (token) {
877
+ case 'a':
878
+ case 'aa':
879
+ return dayPeriodEnumValue.toUpperCase();
880
+ case 'aaa':
881
+ return dayPeriodEnumValue;
882
+ case 'aaaaa':
883
+ return dayPeriodEnumValue[0];
884
+ case 'aaaa':
885
+ default:
886
+ return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
887
+ }
888
+ },
889
+ // Hour [1-12]
890
+ h: function h(date, token) {
891
+ return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
892
+ },
893
+ // Hour [0-23]
894
+ H: function H(date, token) {
895
+ return addLeadingZeros(date.getUTCHours(), token.length);
896
+ },
897
+ // Minute
898
+ m: function m(date, token) {
899
+ return addLeadingZeros(date.getUTCMinutes(), token.length);
900
+ },
901
+ // Second
902
+ s: function s(date, token) {
903
+ return addLeadingZeros(date.getUTCSeconds(), token.length);
904
+ },
905
+ // Fraction of second
906
+ S: function S(date, token) {
907
+ var numberOfDigits = token.length;
908
+ var milliseconds = date.getUTCMilliseconds();
909
+ var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
910
+ return addLeadingZeros(fractionalSeconds, token.length);
911
+ }
912
+ };
913
+ const formatters$3 = formatters$2;
914
+
915
+ var dayPeriodEnum = {
916
+ am: 'am',
917
+ pm: 'pm',
918
+ midnight: 'midnight',
919
+ noon: 'noon',
920
+ morning: 'morning',
921
+ afternoon: 'afternoon',
922
+ evening: 'evening',
923
+ night: 'night'
924
+ };
925
+ /*
926
+ * | | Unit | | Unit |
927
+ * |-----|--------------------------------|-----|--------------------------------|
928
+ * | a | AM, PM | A* | Milliseconds in day |
929
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
930
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
931
+ * | d | Day of month | D | Day of year |
932
+ * | e | Local day of week | E | Day of week |
933
+ * | f | | F* | Day of week in month |
934
+ * | g* | Modified Julian day | G | Era |
935
+ * | h | Hour [1-12] | H | Hour [0-23] |
936
+ * | i! | ISO day of week | I! | ISO week of year |
937
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
938
+ * | k | Hour [1-24] | K | Hour [0-11] |
939
+ * | l* | (deprecated) | L | Stand-alone month |
940
+ * | m | Minute | M | Month |
941
+ * | n | | N | |
942
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
943
+ * | p! | Long localized time | P! | Long localized date |
944
+ * | q | Stand-alone quarter | Q | Quarter |
945
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
946
+ * | s | Second | S | Fraction of second |
947
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
948
+ * | u | Extended year | U* | Cyclic year |
949
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
950
+ * | w | Local week of year | W* | Week of month |
951
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
952
+ * | y | Year (abs) | Y | Local week-numbering year |
953
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
954
+ *
955
+ * Letters marked by * are not implemented but reserved by Unicode standard.
956
+ *
957
+ * Letters marked by ! are non-standard, but implemented by date-fns:
958
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
959
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
960
+ * i.e. 7 for Sunday, 1 for Monday, etc.
961
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
962
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
963
+ * `R` is supposed to be used in conjunction with `I` and `i`
964
+ * for universal ISO week-numbering date, whereas
965
+ * `Y` is supposed to be used in conjunction with `w` and `e`
966
+ * for week-numbering date specific to the locale.
967
+ * - `P` is long localized date format
968
+ * - `p` is long localized time format
969
+ */
970
+
971
+ var formatters = {
972
+ // Era
973
+ G: function G(date, token, localize) {
974
+ var era = date.getUTCFullYear() > 0 ? 1 : 0;
975
+ switch (token) {
976
+ // AD, BC
977
+ case 'G':
978
+ case 'GG':
979
+ case 'GGG':
980
+ return localize.era(era, {
981
+ width: 'abbreviated'
982
+ });
983
+ // A, B
984
+ case 'GGGGG':
985
+ return localize.era(era, {
986
+ width: 'narrow'
987
+ });
988
+ // Anno Domini, Before Christ
989
+ case 'GGGG':
990
+ default:
991
+ return localize.era(era, {
992
+ width: 'wide'
993
+ });
994
+ }
995
+ },
996
+ // Year
997
+ y: function y(date, token, localize) {
998
+ // Ordinal number
999
+ if (token === 'yo') {
1000
+ var signedYear = date.getUTCFullYear();
1001
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
1002
+ var year = signedYear > 0 ? signedYear : 1 - signedYear;
1003
+ return localize.ordinalNumber(year, {
1004
+ unit: 'year'
1005
+ });
1006
+ }
1007
+ return formatters$3.y(date, token);
1008
+ },
1009
+ // Local week-numbering year
1010
+ Y: function Y(date, token, localize, options) {
1011
+ var signedWeekYear = getUTCWeekYear(date, options);
1012
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
1013
+ var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
1014
+
1015
+ // Two digit year
1016
+ if (token === 'YY') {
1017
+ var twoDigitYear = weekYear % 100;
1018
+ return addLeadingZeros(twoDigitYear, 2);
1019
+ }
1020
+
1021
+ // Ordinal number
1022
+ if (token === 'Yo') {
1023
+ return localize.ordinalNumber(weekYear, {
1024
+ unit: 'year'
1025
+ });
1026
+ }
1027
+
1028
+ // Padding
1029
+ return addLeadingZeros(weekYear, token.length);
1030
+ },
1031
+ // ISO week-numbering year
1032
+ R: function R(date, token) {
1033
+ var isoWeekYear = getUTCISOWeekYear(date);
1034
+
1035
+ // Padding
1036
+ return addLeadingZeros(isoWeekYear, token.length);
1037
+ },
1038
+ // Extended year. This is a single number designating the year of this calendar system.
1039
+ // The main difference between `y` and `u` localizers are B.C. years:
1040
+ // | Year | `y` | `u` |
1041
+ // |------|-----|-----|
1042
+ // | AC 1 | 1 | 1 |
1043
+ // | BC 1 | 1 | 0 |
1044
+ // | BC 2 | 2 | -1 |
1045
+ // Also `yy` always returns the last two digits of a year,
1046
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
1047
+ u: function u(date, token) {
1048
+ var year = date.getUTCFullYear();
1049
+ return addLeadingZeros(year, token.length);
1050
+ },
1051
+ // Quarter
1052
+ Q: function Q(date, token, localize) {
1053
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
1054
+ switch (token) {
1055
+ // 1, 2, 3, 4
1056
+ case 'Q':
1057
+ return String(quarter);
1058
+ // 01, 02, 03, 04
1059
+ case 'QQ':
1060
+ return addLeadingZeros(quarter, 2);
1061
+ // 1st, 2nd, 3rd, 4th
1062
+ case 'Qo':
1063
+ return localize.ordinalNumber(quarter, {
1064
+ unit: 'quarter'
1065
+ });
1066
+ // Q1, Q2, Q3, Q4
1067
+ case 'QQQ':
1068
+ return localize.quarter(quarter, {
1069
+ width: 'abbreviated',
1070
+ context: 'formatting'
1071
+ });
1072
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1073
+ case 'QQQQQ':
1074
+ return localize.quarter(quarter, {
1075
+ width: 'narrow',
1076
+ context: 'formatting'
1077
+ });
1078
+ // 1st quarter, 2nd quarter, ...
1079
+ case 'QQQQ':
1080
+ default:
1081
+ return localize.quarter(quarter, {
1082
+ width: 'wide',
1083
+ context: 'formatting'
1084
+ });
1085
+ }
1086
+ },
1087
+ // Stand-alone quarter
1088
+ q: function q(date, token, localize) {
1089
+ var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
1090
+ switch (token) {
1091
+ // 1, 2, 3, 4
1092
+ case 'q':
1093
+ return String(quarter);
1094
+ // 01, 02, 03, 04
1095
+ case 'qq':
1096
+ return addLeadingZeros(quarter, 2);
1097
+ // 1st, 2nd, 3rd, 4th
1098
+ case 'qo':
1099
+ return localize.ordinalNumber(quarter, {
1100
+ unit: 'quarter'
1101
+ });
1102
+ // Q1, Q2, Q3, Q4
1103
+ case 'qqq':
1104
+ return localize.quarter(quarter, {
1105
+ width: 'abbreviated',
1106
+ context: 'standalone'
1107
+ });
1108
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1109
+ case 'qqqqq':
1110
+ return localize.quarter(quarter, {
1111
+ width: 'narrow',
1112
+ context: 'standalone'
1113
+ });
1114
+ // 1st quarter, 2nd quarter, ...
1115
+ case 'qqqq':
1116
+ default:
1117
+ return localize.quarter(quarter, {
1118
+ width: 'wide',
1119
+ context: 'standalone'
1120
+ });
1121
+ }
1122
+ },
1123
+ // Month
1124
+ M: function M(date, token, localize) {
1125
+ var month = date.getUTCMonth();
1126
+ switch (token) {
1127
+ case 'M':
1128
+ case 'MM':
1129
+ return formatters$3.M(date, token);
1130
+ // 1st, 2nd, ..., 12th
1131
+ case 'Mo':
1132
+ return localize.ordinalNumber(month + 1, {
1133
+ unit: 'month'
1134
+ });
1135
+ // Jan, Feb, ..., Dec
1136
+ case 'MMM':
1137
+ return localize.month(month, {
1138
+ width: 'abbreviated',
1139
+ context: 'formatting'
1140
+ });
1141
+ // J, F, ..., D
1142
+ case 'MMMMM':
1143
+ return localize.month(month, {
1144
+ width: 'narrow',
1145
+ context: 'formatting'
1146
+ });
1147
+ // January, February, ..., December
1148
+ case 'MMMM':
1149
+ default:
1150
+ return localize.month(month, {
1151
+ width: 'wide',
1152
+ context: 'formatting'
1153
+ });
1154
+ }
1155
+ },
1156
+ // Stand-alone month
1157
+ L: function L(date, token, localize) {
1158
+ var month = date.getUTCMonth();
1159
+ switch (token) {
1160
+ // 1, 2, ..., 12
1161
+ case 'L':
1162
+ return String(month + 1);
1163
+ // 01, 02, ..., 12
1164
+ case 'LL':
1165
+ return addLeadingZeros(month + 1, 2);
1166
+ // 1st, 2nd, ..., 12th
1167
+ case 'Lo':
1168
+ return localize.ordinalNumber(month + 1, {
1169
+ unit: 'month'
1170
+ });
1171
+ // Jan, Feb, ..., Dec
1172
+ case 'LLL':
1173
+ return localize.month(month, {
1174
+ width: 'abbreviated',
1175
+ context: 'standalone'
1176
+ });
1177
+ // J, F, ..., D
1178
+ case 'LLLLL':
1179
+ return localize.month(month, {
1180
+ width: 'narrow',
1181
+ context: 'standalone'
1182
+ });
1183
+ // January, February, ..., December
1184
+ case 'LLLL':
1185
+ default:
1186
+ return localize.month(month, {
1187
+ width: 'wide',
1188
+ context: 'standalone'
1189
+ });
1190
+ }
1191
+ },
1192
+ // Local week of year
1193
+ w: function w(date, token, localize, options) {
1194
+ var week = getUTCWeek(date, options);
1195
+ if (token === 'wo') {
1196
+ return localize.ordinalNumber(week, {
1197
+ unit: 'week'
1198
+ });
1199
+ }
1200
+ return addLeadingZeros(week, token.length);
1201
+ },
1202
+ // ISO week of year
1203
+ I: function I(date, token, localize) {
1204
+ var isoWeek = getUTCISOWeek(date);
1205
+ if (token === 'Io') {
1206
+ return localize.ordinalNumber(isoWeek, {
1207
+ unit: 'week'
1208
+ });
1209
+ }
1210
+ return addLeadingZeros(isoWeek, token.length);
1211
+ },
1212
+ // Day of the month
1213
+ d: function d(date, token, localize) {
1214
+ if (token === 'do') {
1215
+ return localize.ordinalNumber(date.getUTCDate(), {
1216
+ unit: 'date'
1217
+ });
1218
+ }
1219
+ return formatters$3.d(date, token);
1220
+ },
1221
+ // Day of year
1222
+ D: function D(date, token, localize) {
1223
+ var dayOfYear = getUTCDayOfYear(date);
1224
+ if (token === 'Do') {
1225
+ return localize.ordinalNumber(dayOfYear, {
1226
+ unit: 'dayOfYear'
1227
+ });
1228
+ }
1229
+ return addLeadingZeros(dayOfYear, token.length);
1230
+ },
1231
+ // Day of week
1232
+ E: function E(date, token, localize) {
1233
+ var dayOfWeek = date.getUTCDay();
1234
+ switch (token) {
1235
+ // Tue
1236
+ case 'E':
1237
+ case 'EE':
1238
+ case 'EEE':
1239
+ return localize.day(dayOfWeek, {
1240
+ width: 'abbreviated',
1241
+ context: 'formatting'
1242
+ });
1243
+ // T
1244
+ case 'EEEEE':
1245
+ return localize.day(dayOfWeek, {
1246
+ width: 'narrow',
1247
+ context: 'formatting'
1248
+ });
1249
+ // Tu
1250
+ case 'EEEEEE':
1251
+ return localize.day(dayOfWeek, {
1252
+ width: 'short',
1253
+ context: 'formatting'
1254
+ });
1255
+ // Tuesday
1256
+ case 'EEEE':
1257
+ default:
1258
+ return localize.day(dayOfWeek, {
1259
+ width: 'wide',
1260
+ context: 'formatting'
1261
+ });
1262
+ }
1263
+ },
1264
+ // Local day of week
1265
+ e: function e(date, token, localize, options) {
1266
+ var dayOfWeek = date.getUTCDay();
1267
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1268
+ switch (token) {
1269
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
1270
+ case 'e':
1271
+ return String(localDayOfWeek);
1272
+ // Padded numerical value
1273
+ case 'ee':
1274
+ return addLeadingZeros(localDayOfWeek, 2);
1275
+ // 1st, 2nd, ..., 7th
1276
+ case 'eo':
1277
+ return localize.ordinalNumber(localDayOfWeek, {
1278
+ unit: 'day'
1279
+ });
1280
+ case 'eee':
1281
+ return localize.day(dayOfWeek, {
1282
+ width: 'abbreviated',
1283
+ context: 'formatting'
1284
+ });
1285
+ // T
1286
+ case 'eeeee':
1287
+ return localize.day(dayOfWeek, {
1288
+ width: 'narrow',
1289
+ context: 'formatting'
1290
+ });
1291
+ // Tu
1292
+ case 'eeeeee':
1293
+ return localize.day(dayOfWeek, {
1294
+ width: 'short',
1295
+ context: 'formatting'
1296
+ });
1297
+ // Tuesday
1298
+ case 'eeee':
1299
+ default:
1300
+ return localize.day(dayOfWeek, {
1301
+ width: 'wide',
1302
+ context: 'formatting'
1303
+ });
1304
+ }
1305
+ },
1306
+ // Stand-alone local day of week
1307
+ c: function c(date, token, localize, options) {
1308
+ var dayOfWeek = date.getUTCDay();
1309
+ var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1310
+ switch (token) {
1311
+ // Numerical value (same as in `e`)
1312
+ case 'c':
1313
+ return String(localDayOfWeek);
1314
+ // Padded numerical value
1315
+ case 'cc':
1316
+ return addLeadingZeros(localDayOfWeek, token.length);
1317
+ // 1st, 2nd, ..., 7th
1318
+ case 'co':
1319
+ return localize.ordinalNumber(localDayOfWeek, {
1320
+ unit: 'day'
1321
+ });
1322
+ case 'ccc':
1323
+ return localize.day(dayOfWeek, {
1324
+ width: 'abbreviated',
1325
+ context: 'standalone'
1326
+ });
1327
+ // T
1328
+ case 'ccccc':
1329
+ return localize.day(dayOfWeek, {
1330
+ width: 'narrow',
1331
+ context: 'standalone'
1332
+ });
1333
+ // Tu
1334
+ case 'cccccc':
1335
+ return localize.day(dayOfWeek, {
1336
+ width: 'short',
1337
+ context: 'standalone'
1338
+ });
1339
+ // Tuesday
1340
+ case 'cccc':
1341
+ default:
1342
+ return localize.day(dayOfWeek, {
1343
+ width: 'wide',
1344
+ context: 'standalone'
1345
+ });
1346
+ }
1347
+ },
1348
+ // ISO day of week
1349
+ i: function i(date, token, localize) {
1350
+ var dayOfWeek = date.getUTCDay();
1351
+ var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
1352
+ switch (token) {
1353
+ // 2
1354
+ case 'i':
1355
+ return String(isoDayOfWeek);
1356
+ // 02
1357
+ case 'ii':
1358
+ return addLeadingZeros(isoDayOfWeek, token.length);
1359
+ // 2nd
1360
+ case 'io':
1361
+ return localize.ordinalNumber(isoDayOfWeek, {
1362
+ unit: 'day'
1363
+ });
1364
+ // Tue
1365
+ case 'iii':
1366
+ return localize.day(dayOfWeek, {
1367
+ width: 'abbreviated',
1368
+ context: 'formatting'
1369
+ });
1370
+ // T
1371
+ case 'iiiii':
1372
+ return localize.day(dayOfWeek, {
1373
+ width: 'narrow',
1374
+ context: 'formatting'
1375
+ });
1376
+ // Tu
1377
+ case 'iiiiii':
1378
+ return localize.day(dayOfWeek, {
1379
+ width: 'short',
1380
+ context: 'formatting'
1381
+ });
1382
+ // Tuesday
1383
+ case 'iiii':
1384
+ default:
1385
+ return localize.day(dayOfWeek, {
1386
+ width: 'wide',
1387
+ context: 'formatting'
1388
+ });
1389
+ }
1390
+ },
1391
+ // AM or PM
1392
+ a: function a(date, token, localize) {
1393
+ var hours = date.getUTCHours();
1394
+ var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1395
+ switch (token) {
1396
+ case 'a':
1397
+ case 'aa':
1398
+ return localize.dayPeriod(dayPeriodEnumValue, {
1399
+ width: 'abbreviated',
1400
+ context: 'formatting'
1401
+ });
1402
+ case 'aaa':
1403
+ return localize.dayPeriod(dayPeriodEnumValue, {
1404
+ width: 'abbreviated',
1405
+ context: 'formatting'
1406
+ }).toLowerCase();
1407
+ case 'aaaaa':
1408
+ return localize.dayPeriod(dayPeriodEnumValue, {
1409
+ width: 'narrow',
1410
+ context: 'formatting'
1411
+ });
1412
+ case 'aaaa':
1413
+ default:
1414
+ return localize.dayPeriod(dayPeriodEnumValue, {
1415
+ width: 'wide',
1416
+ context: 'formatting'
1417
+ });
1418
+ }
1419
+ },
1420
+ // AM, PM, midnight, noon
1421
+ b: function b(date, token, localize) {
1422
+ var hours = date.getUTCHours();
1423
+ var dayPeriodEnumValue;
1424
+ if (hours === 12) {
1425
+ dayPeriodEnumValue = dayPeriodEnum.noon;
1426
+ } else if (hours === 0) {
1427
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
1428
+ } else {
1429
+ dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
1430
+ }
1431
+ switch (token) {
1432
+ case 'b':
1433
+ case 'bb':
1434
+ return localize.dayPeriod(dayPeriodEnumValue, {
1435
+ width: 'abbreviated',
1436
+ context: 'formatting'
1437
+ });
1438
+ case 'bbb':
1439
+ return localize.dayPeriod(dayPeriodEnumValue, {
1440
+ width: 'abbreviated',
1441
+ context: 'formatting'
1442
+ }).toLowerCase();
1443
+ case 'bbbbb':
1444
+ return localize.dayPeriod(dayPeriodEnumValue, {
1445
+ width: 'narrow',
1446
+ context: 'formatting'
1447
+ });
1448
+ case 'bbbb':
1449
+ default:
1450
+ return localize.dayPeriod(dayPeriodEnumValue, {
1451
+ width: 'wide',
1452
+ context: 'formatting'
1453
+ });
1454
+ }
1455
+ },
1456
+ // in the morning, in the afternoon, in the evening, at night
1457
+ B: function B(date, token, localize) {
1458
+ var hours = date.getUTCHours();
1459
+ var dayPeriodEnumValue;
1460
+ if (hours >= 17) {
1461
+ dayPeriodEnumValue = dayPeriodEnum.evening;
1462
+ } else if (hours >= 12) {
1463
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
1464
+ } else if (hours >= 4) {
1465
+ dayPeriodEnumValue = dayPeriodEnum.morning;
1466
+ } else {
1467
+ dayPeriodEnumValue = dayPeriodEnum.night;
1468
+ }
1469
+ switch (token) {
1470
+ case 'B':
1471
+ case 'BB':
1472
+ case 'BBB':
1473
+ return localize.dayPeriod(dayPeriodEnumValue, {
1474
+ width: 'abbreviated',
1475
+ context: 'formatting'
1476
+ });
1477
+ case 'BBBBB':
1478
+ return localize.dayPeriod(dayPeriodEnumValue, {
1479
+ width: 'narrow',
1480
+ context: 'formatting'
1481
+ });
1482
+ case 'BBBB':
1483
+ default:
1484
+ return localize.dayPeriod(dayPeriodEnumValue, {
1485
+ width: 'wide',
1486
+ context: 'formatting'
1487
+ });
1488
+ }
1489
+ },
1490
+ // Hour [1-12]
1491
+ h: function h(date, token, localize) {
1492
+ if (token === 'ho') {
1493
+ var hours = date.getUTCHours() % 12;
1494
+ if (hours === 0) hours = 12;
1495
+ return localize.ordinalNumber(hours, {
1496
+ unit: 'hour'
1497
+ });
1498
+ }
1499
+ return formatters$3.h(date, token);
1500
+ },
1501
+ // Hour [0-23]
1502
+ H: function H(date, token, localize) {
1503
+ if (token === 'Ho') {
1504
+ return localize.ordinalNumber(date.getUTCHours(), {
1505
+ unit: 'hour'
1506
+ });
1507
+ }
1508
+ return formatters$3.H(date, token);
1509
+ },
1510
+ // Hour [0-11]
1511
+ K: function K(date, token, localize) {
1512
+ var hours = date.getUTCHours() % 12;
1513
+ if (token === 'Ko') {
1514
+ return localize.ordinalNumber(hours, {
1515
+ unit: 'hour'
1516
+ });
1517
+ }
1518
+ return addLeadingZeros(hours, token.length);
1519
+ },
1520
+ // Hour [1-24]
1521
+ k: function k(date, token, localize) {
1522
+ var hours = date.getUTCHours();
1523
+ if (hours === 0) hours = 24;
1524
+ if (token === 'ko') {
1525
+ return localize.ordinalNumber(hours, {
1526
+ unit: 'hour'
1527
+ });
1528
+ }
1529
+ return addLeadingZeros(hours, token.length);
1530
+ },
1531
+ // Minute
1532
+ m: function m(date, token, localize) {
1533
+ if (token === 'mo') {
1534
+ return localize.ordinalNumber(date.getUTCMinutes(), {
1535
+ unit: 'minute'
1536
+ });
1537
+ }
1538
+ return formatters$3.m(date, token);
1539
+ },
1540
+ // Second
1541
+ s: function s(date, token, localize) {
1542
+ if (token === 'so') {
1543
+ return localize.ordinalNumber(date.getUTCSeconds(), {
1544
+ unit: 'second'
1545
+ });
1546
+ }
1547
+ return formatters$3.s(date, token);
1548
+ },
1549
+ // Fraction of second
1550
+ S: function S(date, token) {
1551
+ return formatters$3.S(date, token);
1552
+ },
1553
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1554
+ X: function X(date, token, _localize, options) {
1555
+ var originalDate = options._originalDate || date;
1556
+ var timezoneOffset = originalDate.getTimezoneOffset();
1557
+ if (timezoneOffset === 0) {
1558
+ return 'Z';
1559
+ }
1560
+ switch (token) {
1561
+ // Hours and optional minutes
1562
+ case 'X':
1563
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1564
+
1565
+ // Hours, minutes and optional seconds without `:` delimiter
1566
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1567
+ // so this token always has the same output as `XX`
1568
+ case 'XXXX':
1569
+ case 'XX':
1570
+ // Hours and minutes without `:` delimiter
1571
+ return formatTimezone(timezoneOffset);
1572
+
1573
+ // Hours, minutes and optional seconds with `:` delimiter
1574
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1575
+ // so this token always has the same output as `XXX`
1576
+ case 'XXXXX':
1577
+ case 'XXX': // Hours and minutes with `:` delimiter
1578
+ default:
1579
+ return formatTimezone(timezoneOffset, ':');
1580
+ }
1581
+ },
1582
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1583
+ x: function x(date, token, _localize, options) {
1584
+ var originalDate = options._originalDate || date;
1585
+ var timezoneOffset = originalDate.getTimezoneOffset();
1586
+ switch (token) {
1587
+ // Hours and optional minutes
1588
+ case 'x':
1589
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1590
+
1591
+ // Hours, minutes and optional seconds without `:` delimiter
1592
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1593
+ // so this token always has the same output as `xx`
1594
+ case 'xxxx':
1595
+ case 'xx':
1596
+ // Hours and minutes without `:` delimiter
1597
+ return formatTimezone(timezoneOffset);
1598
+
1599
+ // Hours, minutes and optional seconds with `:` delimiter
1600
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1601
+ // so this token always has the same output as `xxx`
1602
+ case 'xxxxx':
1603
+ case 'xxx': // Hours and minutes with `:` delimiter
1604
+ default:
1605
+ return formatTimezone(timezoneOffset, ':');
1606
+ }
1607
+ },
1608
+ // Timezone (GMT)
1609
+ O: function O(date, token, _localize, options) {
1610
+ var originalDate = options._originalDate || date;
1611
+ var timezoneOffset = originalDate.getTimezoneOffset();
1612
+ switch (token) {
1613
+ // Short
1614
+ case 'O':
1615
+ case 'OO':
1616
+ case 'OOO':
1617
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1618
+ // Long
1619
+ case 'OOOO':
1620
+ default:
1621
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1622
+ }
1623
+ },
1624
+ // Timezone (specific non-location)
1625
+ z: function z(date, token, _localize, options) {
1626
+ var originalDate = options._originalDate || date;
1627
+ var timezoneOffset = originalDate.getTimezoneOffset();
1628
+ switch (token) {
1629
+ // Short
1630
+ case 'z':
1631
+ case 'zz':
1632
+ case 'zzz':
1633
+ return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
1634
+ // Long
1635
+ case 'zzzz':
1636
+ default:
1637
+ return 'GMT' + formatTimezone(timezoneOffset, ':');
1638
+ }
1639
+ },
1640
+ // Seconds timestamp
1641
+ t: function t(date, token, _localize, options) {
1642
+ var originalDate = options._originalDate || date;
1643
+ var timestamp = Math.floor(originalDate.getTime() / 1000);
1644
+ return addLeadingZeros(timestamp, token.length);
1645
+ },
1646
+ // Milliseconds timestamp
1647
+ T: function T(date, token, _localize, options) {
1648
+ var originalDate = options._originalDate || date;
1649
+ var timestamp = originalDate.getTime();
1650
+ return addLeadingZeros(timestamp, token.length);
1651
+ }
1652
+ };
1653
+ function formatTimezoneShort(offset, dirtyDelimiter) {
1654
+ var sign = offset > 0 ? '-' : '+';
1655
+ var absOffset = Math.abs(offset);
1656
+ var hours = Math.floor(absOffset / 60);
1657
+ var minutes = absOffset % 60;
1658
+ if (minutes === 0) {
1659
+ return sign + String(hours);
1660
+ }
1661
+ var delimiter = dirtyDelimiter || '';
1662
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1663
+ }
1664
+ function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
1665
+ if (offset % 60 === 0) {
1666
+ var sign = offset > 0 ? '-' : '+';
1667
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1668
+ }
1669
+ return formatTimezone(offset, dirtyDelimiter);
1670
+ }
1671
+ function formatTimezone(offset, dirtyDelimiter) {
1672
+ var delimiter = dirtyDelimiter || '';
1673
+ var sign = offset > 0 ? '-' : '+';
1674
+ var absOffset = Math.abs(offset);
1675
+ var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
1676
+ var minutes = addLeadingZeros(absOffset % 60, 2);
1677
+ return sign + hours + delimiter + minutes;
1678
+ }
1679
+ const formatters$1 = formatters;
1680
+
1681
+ var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
1682
+ switch (pattern) {
1683
+ case 'P':
1684
+ return formatLong.date({
1685
+ width: 'short'
1686
+ });
1687
+ case 'PP':
1688
+ return formatLong.date({
1689
+ width: 'medium'
1690
+ });
1691
+ case 'PPP':
1692
+ return formatLong.date({
1693
+ width: 'long'
1694
+ });
1695
+ case 'PPPP':
1696
+ default:
1697
+ return formatLong.date({
1698
+ width: 'full'
1699
+ });
1700
+ }
1701
+ };
1702
+ var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
1703
+ switch (pattern) {
1704
+ case 'p':
1705
+ return formatLong.time({
1706
+ width: 'short'
1707
+ });
1708
+ case 'pp':
1709
+ return formatLong.time({
1710
+ width: 'medium'
1711
+ });
1712
+ case 'ppp':
1713
+ return formatLong.time({
1714
+ width: 'long'
1715
+ });
1716
+ case 'pppp':
1717
+ default:
1718
+ return formatLong.time({
1719
+ width: 'full'
1720
+ });
1721
+ }
1722
+ };
1723
+ var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
1724
+ var matchResult = pattern.match(/(P+)(p+)?/) || [];
1725
+ var datePattern = matchResult[1];
1726
+ var timePattern = matchResult[2];
1727
+ if (!timePattern) {
1728
+ return dateLongFormatter(pattern, formatLong);
1729
+ }
1730
+ var dateTimeFormat;
1731
+ switch (datePattern) {
1732
+ case 'P':
1733
+ dateTimeFormat = formatLong.dateTime({
1734
+ width: 'short'
1735
+ });
1736
+ break;
1737
+ case 'PP':
1738
+ dateTimeFormat = formatLong.dateTime({
1739
+ width: 'medium'
1740
+ });
1741
+ break;
1742
+ case 'PPP':
1743
+ dateTimeFormat = formatLong.dateTime({
1744
+ width: 'long'
1745
+ });
1746
+ break;
1747
+ case 'PPPP':
1748
+ default:
1749
+ dateTimeFormat = formatLong.dateTime({
1750
+ width: 'full'
1751
+ });
1752
+ break;
1753
+ }
1754
+ return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
1755
+ };
1756
+ var longFormatters = {
1757
+ p: timeLongFormatter,
1758
+ P: dateTimeLongFormatter
1759
+ };
1760
+ const longFormatters$1 = longFormatters;
1761
+
1762
+ var protectedDayOfYearTokens = ['D', 'DD'];
1763
+ var protectedWeekYearTokens = ['YY', 'YYYY'];
1764
+ function isProtectedDayOfYearToken(token) {
1765
+ return protectedDayOfYearTokens.indexOf(token) !== -1;
1766
+ }
1767
+ function isProtectedWeekYearToken(token) {
1768
+ return protectedWeekYearTokens.indexOf(token) !== -1;
1769
+ }
1770
+ function throwProtectedError(token, format, input) {
1771
+ if (token === 'YYYY') {
1772
+ throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1773
+ } else if (token === 'YY') {
1774
+ throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1775
+ } else if (token === 'D') {
1776
+ throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1777
+ } else if (token === 'DD') {
1778
+ throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
1779
+ }
1780
+ }
1781
+
1782
+ var formatDistanceLocale$1 = {
1783
+ lessThanXSeconds: {
1784
+ one: 'less than a second',
1785
+ other: 'less than {{count}} seconds'
1786
+ },
1787
+ xSeconds: {
1788
+ one: '1 second',
1789
+ other: '{{count}} seconds'
1790
+ },
1791
+ halfAMinute: 'half a minute',
1792
+ lessThanXMinutes: {
1793
+ one: 'less than a minute',
1794
+ other: 'less than {{count}} minutes'
1795
+ },
1796
+ xMinutes: {
1797
+ one: '1 minute',
1798
+ other: '{{count}} minutes'
1799
+ },
1800
+ aboutXHours: {
1801
+ one: 'about 1 hour',
1802
+ other: 'about {{count}} hours'
1803
+ },
1804
+ xHours: {
1805
+ one: '1 hour',
1806
+ other: '{{count}} hours'
1807
+ },
1808
+ xDays: {
1809
+ one: '1 day',
1810
+ other: '{{count}} days'
1811
+ },
1812
+ aboutXWeeks: {
1813
+ one: 'about 1 week',
1814
+ other: 'about {{count}} weeks'
1815
+ },
1816
+ xWeeks: {
1817
+ one: '1 week',
1818
+ other: '{{count}} weeks'
1819
+ },
1820
+ aboutXMonths: {
1821
+ one: 'about 1 month',
1822
+ other: 'about {{count}} months'
1823
+ },
1824
+ xMonths: {
1825
+ one: '1 month',
1826
+ other: '{{count}} months'
1827
+ },
1828
+ aboutXYears: {
1829
+ one: 'about 1 year',
1830
+ other: 'about {{count}} years'
1831
+ },
1832
+ xYears: {
1833
+ one: '1 year',
1834
+ other: '{{count}} years'
1835
+ },
1836
+ overXYears: {
1837
+ one: 'over 1 year',
1838
+ other: 'over {{count}} years'
1839
+ },
1840
+ almostXYears: {
1841
+ one: 'almost 1 year',
1842
+ other: 'almost {{count}} years'
1843
+ }
1844
+ };
1845
+ var formatDistance$2 = function formatDistance(token, count, options) {
1846
+ var result;
1847
+ var tokenValue = formatDistanceLocale$1[token];
1848
+ if (typeof tokenValue === 'string') {
1849
+ result = tokenValue;
1850
+ } else if (count === 1) {
1851
+ result = tokenValue.one;
1852
+ } else {
1853
+ result = tokenValue.other.replace('{{count}}', count.toString());
1854
+ }
1855
+ if (options !== null && options !== void 0 && options.addSuffix) {
1856
+ if (options.comparison && options.comparison > 0) {
1857
+ return 'in ' + result;
1858
+ } else {
1859
+ return result + ' ago';
1860
+ }
1861
+ }
1862
+ return result;
1863
+ };
1864
+ const formatDistance$3 = formatDistance$2;
1865
+
1866
+ function buildFormatLongFn(args) {
1867
+ return function () {
1868
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1869
+ // TODO: Remove String()
1870
+ var width = options.width ? String(options.width) : args.defaultWidth;
1871
+ var format = args.formats[width] || args.formats[args.defaultWidth];
1872
+ return format;
1873
+ };
1874
+ }
1875
+
1876
+ var dateFormats$2 = {
1877
+ full: 'EEEE, MMMM do, y',
1878
+ long: 'MMMM do, y',
1879
+ medium: 'MMM d, y',
1880
+ short: 'MM/dd/yyyy'
1881
+ };
1882
+ var timeFormats$2 = {
1883
+ full: 'h:mm:ss a zzzz',
1884
+ long: 'h:mm:ss a z',
1885
+ medium: 'h:mm:ss a',
1886
+ short: 'h:mm a'
1887
+ };
1888
+ var dateTimeFormats$2 = {
1889
+ full: "{{date}} 'at' {{time}}",
1890
+ long: "{{date}} 'at' {{time}}",
1891
+ medium: '{{date}}, {{time}}',
1892
+ short: '{{date}}, {{time}}'
1893
+ };
1894
+ var formatLong$4 = {
1895
+ date: buildFormatLongFn({
1896
+ formats: dateFormats$2,
1897
+ defaultWidth: 'full'
1898
+ }),
1899
+ time: buildFormatLongFn({
1900
+ formats: timeFormats$2,
1901
+ defaultWidth: 'full'
1902
+ }),
1903
+ dateTime: buildFormatLongFn({
1904
+ formats: dateTimeFormats$2,
1905
+ defaultWidth: 'full'
1906
+ })
1907
+ };
1908
+ const formatLong$5 = formatLong$4;
1909
+
1910
+ var formatRelativeLocale$1 = {
1911
+ lastWeek: "'last' eeee 'at' p",
1912
+ yesterday: "'yesterday at' p",
1913
+ today: "'today at' p",
1914
+ tomorrow: "'tomorrow at' p",
1915
+ nextWeek: "eeee 'at' p",
1916
+ other: 'P'
1917
+ };
1918
+ var formatRelative$2 = function formatRelative(token, _date, _baseDate, _options) {
1919
+ return formatRelativeLocale$1[token];
1920
+ };
1921
+ const formatRelative$3 = formatRelative$2;
1922
+
1923
+ function buildLocalizeFn(args) {
1924
+ return function (dirtyIndex, options) {
1925
+ var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
1926
+ var valuesArray;
1927
+ if (context === 'formatting' && args.formattingValues) {
1928
+ var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1929
+ var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
1930
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
1931
+ } else {
1932
+ var _defaultWidth = args.defaultWidth;
1933
+ var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
1934
+ valuesArray = args.values[_width] || args.values[_defaultWidth];
1935
+ }
1936
+ var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
1937
+ // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
1938
+ return valuesArray[index];
1939
+ };
1940
+ }
1941
+
1942
+ var eraValues$1 = {
1943
+ narrow: ['B', 'A'],
1944
+ abbreviated: ['BC', 'AD'],
1945
+ wide: ['Before Christ', 'Anno Domini']
1946
+ };
1947
+ var quarterValues$1 = {
1948
+ narrow: ['1', '2', '3', '4'],
1949
+ abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
1950
+ wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
1951
+ };
1952
+
1953
+ // Note: in English, the names of days of the week and months are capitalized.
1954
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1955
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1956
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1957
+ var monthValues$1 = {
1958
+ narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
1959
+ abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
1960
+ wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
1961
+ };
1962
+ var dayValues$1 = {
1963
+ narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
1964
+ short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1965
+ abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1966
+ wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
1967
+ };
1968
+ var dayPeriodValues$1 = {
1969
+ narrow: {
1970
+ am: 'a',
1971
+ pm: 'p',
1972
+ midnight: 'mi',
1973
+ noon: 'n',
1974
+ morning: 'morning',
1975
+ afternoon: 'afternoon',
1976
+ evening: 'evening',
1977
+ night: 'night'
1978
+ },
1979
+ abbreviated: {
1980
+ am: 'AM',
1981
+ pm: 'PM',
1982
+ midnight: 'midnight',
1983
+ noon: 'noon',
1984
+ morning: 'morning',
1985
+ afternoon: 'afternoon',
1986
+ evening: 'evening',
1987
+ night: 'night'
1988
+ },
1989
+ wide: {
1990
+ am: 'a.m.',
1991
+ pm: 'p.m.',
1992
+ midnight: 'midnight',
1993
+ noon: 'noon',
1994
+ morning: 'morning',
1995
+ afternoon: 'afternoon',
1996
+ evening: 'evening',
1997
+ night: 'night'
1998
+ }
1999
+ };
2000
+ var formattingDayPeriodValues$1 = {
2001
+ narrow: {
2002
+ am: 'a',
2003
+ pm: 'p',
2004
+ midnight: 'mi',
2005
+ noon: 'n',
2006
+ morning: 'in the morning',
2007
+ afternoon: 'in the afternoon',
2008
+ evening: 'in the evening',
2009
+ night: 'at night'
2010
+ },
2011
+ abbreviated: {
2012
+ am: 'AM',
2013
+ pm: 'PM',
2014
+ midnight: 'midnight',
2015
+ noon: 'noon',
2016
+ morning: 'in the morning',
2017
+ afternoon: 'in the afternoon',
2018
+ evening: 'in the evening',
2019
+ night: 'at night'
2020
+ },
2021
+ wide: {
2022
+ am: 'a.m.',
2023
+ pm: 'p.m.',
2024
+ midnight: 'midnight',
2025
+ noon: 'noon',
2026
+ morning: 'in the morning',
2027
+ afternoon: 'in the afternoon',
2028
+ evening: 'in the evening',
2029
+ night: 'at night'
2030
+ }
2031
+ };
2032
+ var ordinalNumber$1 = function ordinalNumber(dirtyNumber, _options) {
2033
+ var number = Number(dirtyNumber);
2034
+
2035
+ // If ordinal numbers depend on context, for example,
2036
+ // if they are different for different grammatical genders,
2037
+ // use `options.unit`.
2038
+ //
2039
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
2040
+ // 'day', 'hour', 'minute', 'second'.
2041
+
2042
+ var rem100 = number % 100;
2043
+ if (rem100 > 20 || rem100 < 10) {
2044
+ switch (rem100 % 10) {
2045
+ case 1:
2046
+ return number + 'st';
2047
+ case 2:
2048
+ return number + 'nd';
2049
+ case 3:
2050
+ return number + 'rd';
2051
+ }
2052
+ }
2053
+ return number + 'th';
2054
+ };
2055
+ var localize$2 = {
2056
+ ordinalNumber: ordinalNumber$1,
2057
+ era: buildLocalizeFn({
2058
+ values: eraValues$1,
2059
+ defaultWidth: 'wide'
2060
+ }),
2061
+ quarter: buildLocalizeFn({
2062
+ values: quarterValues$1,
2063
+ defaultWidth: 'wide',
2064
+ argumentCallback: function argumentCallback(quarter) {
2065
+ return quarter - 1;
2066
+ }
2067
+ }),
2068
+ month: buildLocalizeFn({
2069
+ values: monthValues$1,
2070
+ defaultWidth: 'wide'
2071
+ }),
2072
+ day: buildLocalizeFn({
2073
+ values: dayValues$1,
2074
+ defaultWidth: 'wide'
2075
+ }),
2076
+ dayPeriod: buildLocalizeFn({
2077
+ values: dayPeriodValues$1,
2078
+ defaultWidth: 'wide',
2079
+ formattingValues: formattingDayPeriodValues$1,
2080
+ defaultFormattingWidth: 'wide'
2081
+ })
2082
+ };
2083
+ const localize$3 = localize$2;
2084
+
2085
+ function buildMatchFn(args) {
2086
+ return function (string) {
2087
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2088
+ var width = options.width;
2089
+ var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
2090
+ var matchResult = string.match(matchPattern);
2091
+ if (!matchResult) {
2092
+ return null;
2093
+ }
2094
+ var matchedString = matchResult[0];
2095
+ var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
2096
+ var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
2097
+ return pattern.test(matchedString);
2098
+ }) : findKey(parsePatterns, function (pattern) {
2099
+ return pattern.test(matchedString);
2100
+ });
2101
+ var value;
2102
+ value = args.valueCallback ? args.valueCallback(key) : key;
2103
+ value = options.valueCallback ? options.valueCallback(value) : value;
2104
+ var rest = string.slice(matchedString.length);
2105
+ return {
2106
+ value: value,
2107
+ rest: rest
2108
+ };
2109
+ };
2110
+ }
2111
+ function findKey(object, predicate) {
2112
+ for (var key in object) {
2113
+ if (object.hasOwnProperty(key) && predicate(object[key])) {
2114
+ return key;
2115
+ }
2116
+ }
2117
+ return undefined;
2118
+ }
2119
+ function findIndex(array, predicate) {
2120
+ for (var key = 0; key < array.length; key++) {
2121
+ if (predicate(array[key])) {
2122
+ return key;
2123
+ }
2124
+ }
2125
+ return undefined;
2126
+ }
2127
+
2128
+ function buildMatchPatternFn(args) {
2129
+ return function (string) {
2130
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2131
+ var matchResult = string.match(args.matchPattern);
2132
+ if (!matchResult) return null;
2133
+ var matchedString = matchResult[0];
2134
+ var parseResult = string.match(args.parsePattern);
2135
+ if (!parseResult) return null;
2136
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
2137
+ value = options.valueCallback ? options.valueCallback(value) : value;
2138
+ var rest = string.slice(matchedString.length);
2139
+ return {
2140
+ value: value,
2141
+ rest: rest
2142
+ };
2143
+ };
2144
+ }
2145
+
2146
+ var matchOrdinalNumberPattern$1 = /^(\d+)(th|st|nd|rd)?/i;
2147
+ var parseOrdinalNumberPattern$1 = /\d+/i;
2148
+ var matchEraPatterns$1 = {
2149
+ narrow: /^(b|a)/i,
2150
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
2151
+ wide: /^(before christ|before common era|anno domini|common era)/i
2152
+ };
2153
+ var parseEraPatterns$1 = {
2154
+ any: [/^b/i, /^(a|c)/i]
2155
+ };
2156
+ var matchQuarterPatterns$1 = {
2157
+ narrow: /^[1234]/i,
2158
+ abbreviated: /^q[1234]/i,
2159
+ wide: /^[1234](th|st|nd|rd)? quarter/i
2160
+ };
2161
+ var parseQuarterPatterns$1 = {
2162
+ any: [/1/i, /2/i, /3/i, /4/i]
2163
+ };
2164
+ var matchMonthPatterns$1 = {
2165
+ narrow: /^[jfmasond]/i,
2166
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
2167
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
2168
+ };
2169
+ var parseMonthPatterns$1 = {
2170
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
2171
+ any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
2172
+ };
2173
+ var matchDayPatterns$1 = {
2174
+ narrow: /^[smtwf]/i,
2175
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
2176
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
2177
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
2178
+ };
2179
+ var parseDayPatterns$1 = {
2180
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
2181
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
2182
+ };
2183
+ var matchDayPeriodPatterns$1 = {
2184
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
2185
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
2186
+ };
2187
+ var parseDayPeriodPatterns$1 = {
2188
+ any: {
2189
+ am: /^a/i,
2190
+ pm: /^p/i,
2191
+ midnight: /^mi/i,
2192
+ noon: /^no/i,
2193
+ morning: /morning/i,
2194
+ afternoon: /afternoon/i,
2195
+ evening: /evening/i,
2196
+ night: /night/i
2197
+ }
2198
+ };
2199
+ var match$2 = {
2200
+ ordinalNumber: buildMatchPatternFn({
2201
+ matchPattern: matchOrdinalNumberPattern$1,
2202
+ parsePattern: parseOrdinalNumberPattern$1,
2203
+ valueCallback: function valueCallback(value) {
2204
+ return parseInt(value, 10);
2205
+ }
2206
+ }),
2207
+ era: buildMatchFn({
2208
+ matchPatterns: matchEraPatterns$1,
2209
+ defaultMatchWidth: 'wide',
2210
+ parsePatterns: parseEraPatterns$1,
2211
+ defaultParseWidth: 'any'
2212
+ }),
2213
+ quarter: buildMatchFn({
2214
+ matchPatterns: matchQuarterPatterns$1,
2215
+ defaultMatchWidth: 'wide',
2216
+ parsePatterns: parseQuarterPatterns$1,
2217
+ defaultParseWidth: 'any',
2218
+ valueCallback: function valueCallback(index) {
2219
+ return index + 1;
2220
+ }
2221
+ }),
2222
+ month: buildMatchFn({
2223
+ matchPatterns: matchMonthPatterns$1,
2224
+ defaultMatchWidth: 'wide',
2225
+ parsePatterns: parseMonthPatterns$1,
2226
+ defaultParseWidth: 'any'
2227
+ }),
2228
+ day: buildMatchFn({
2229
+ matchPatterns: matchDayPatterns$1,
2230
+ defaultMatchWidth: 'wide',
2231
+ parsePatterns: parseDayPatterns$1,
2232
+ defaultParseWidth: 'any'
2233
+ }),
2234
+ dayPeriod: buildMatchFn({
2235
+ matchPatterns: matchDayPeriodPatterns$1,
2236
+ defaultMatchWidth: 'any',
2237
+ parsePatterns: parseDayPeriodPatterns$1,
2238
+ defaultParseWidth: 'any'
2239
+ })
2240
+ };
2241
+ const match$3 = match$2;
2242
+
2243
+ /**
2244
+ * @type {Locale}
2245
+ * @category Locales
2246
+ * @summary English locale (United States).
2247
+ * @language English
2248
+ * @iso-639-2 eng
2249
+ * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
2250
+ * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
2251
+ */
2252
+ var locale$2 = {
2253
+ code: 'en-US',
2254
+ formatDistance: formatDistance$3,
2255
+ formatLong: formatLong$5,
2256
+ formatRelative: formatRelative$3,
2257
+ localize: localize$3,
2258
+ match: match$3,
2259
+ options: {
2260
+ weekStartsOn: 0 /* Sunday */,
2261
+ firstWeekContainsDate: 1
2262
+ }
2263
+ };
2264
+ const defaultLocale = locale$2;
2265
+
2266
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
2267
+ // (one of the certain letters followed by `o`)
2268
+ // - (\w)\1* matches any sequences of the same letter
2269
+ // - '' matches two quote characters in a row
2270
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
2271
+ // except a single quote symbol, which ends the sequence.
2272
+ // Two quote characters do not end the sequence.
2273
+ // If there is no matching single quote
2274
+ // then the sequence will continue until the end of the string.
2275
+ // - . matches any single character unmatched by previous parts of the RegExps
2276
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
2277
+
2278
+ // This RegExp catches symbols escaped by quotes, and also
2279
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
2280
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
2281
+ var escapedStringRegExp = /^'([^]*?)'?$/;
2282
+ var doubleQuoteRegExp = /''/g;
2283
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
2284
+
2285
+ /**
2286
+ * @name format
2287
+ * @category Common Helpers
2288
+ * @summary Format the date.
2289
+ *
2290
+ * @description
2291
+ * Return the formatted date string in the given format. The result may vary by locale.
2292
+ *
2293
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
2294
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2295
+ *
2296
+ * The characters wrapped between two single quotes characters (') are escaped.
2297
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
2298
+ * (see the last example)
2299
+ *
2300
+ * Format of the string is based on Unicode Technical Standard #35:
2301
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
2302
+ * with a few additions (see note 7 below the table).
2303
+ *
2304
+ * Accepted patterns:
2305
+ * | Unit | Pattern | Result examples | Notes |
2306
+ * |---------------------------------|---------|-----------------------------------|-------|
2307
+ * | Era | G..GGG | AD, BC | |
2308
+ * | | GGGG | Anno Domini, Before Christ | 2 |
2309
+ * | | GGGGG | A, B | |
2310
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
2311
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
2312
+ * | | yy | 44, 01, 00, 17 | 5 |
2313
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
2314
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
2315
+ * | | yyyyy | ... | 3,5 |
2316
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
2317
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
2318
+ * | | YY | 44, 01, 00, 17 | 5,8 |
2319
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
2320
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
2321
+ * | | YYYYY | ... | 3,5 |
2322
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
2323
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
2324
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
2325
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
2326
+ * | | RRRRR | ... | 3,5,7 |
2327
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
2328
+ * | | uu | -43, 01, 1900, 2017 | 5 |
2329
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
2330
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
2331
+ * | | uuuuu | ... | 3,5 |
2332
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
2333
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
2334
+ * | | QQ | 01, 02, 03, 04 | |
2335
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
2336
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
2337
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
2338
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
2339
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
2340
+ * | | qq | 01, 02, 03, 04 | |
2341
+ * | | qqq | Q1, Q2, Q3, Q4 | |
2342
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
2343
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
2344
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
2345
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
2346
+ * | | MM | 01, 02, ..., 12 | |
2347
+ * | | MMM | Jan, Feb, ..., Dec | |
2348
+ * | | MMMM | January, February, ..., December | 2 |
2349
+ * | | MMMMM | J, F, ..., D | |
2350
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
2351
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
2352
+ * | | LL | 01, 02, ..., 12 | |
2353
+ * | | LLL | Jan, Feb, ..., Dec | |
2354
+ * | | LLLL | January, February, ..., December | 2 |
2355
+ * | | LLLLL | J, F, ..., D | |
2356
+ * | Local week of year | w | 1, 2, ..., 53 | |
2357
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
2358
+ * | | ww | 01, 02, ..., 53 | |
2359
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
2360
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
2361
+ * | | II | 01, 02, ..., 53 | 7 |
2362
+ * | Day of month | d | 1, 2, ..., 31 | |
2363
+ * | | do | 1st, 2nd, ..., 31st | 7 |
2364
+ * | | dd | 01, 02, ..., 31 | |
2365
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
2366
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
2367
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
2368
+ * | | DDD | 001, 002, ..., 365, 366 | |
2369
+ * | | DDDD | ... | 3 |
2370
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
2371
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
2372
+ * | | EEEEE | M, T, W, T, F, S, S | |
2373
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
2374
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
2375
+ * | | io | 1st, 2nd, ..., 7th | 7 |
2376
+ * | | ii | 01, 02, ..., 07 | 7 |
2377
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
2378
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
2379
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
2380
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
2381
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
2382
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
2383
+ * | | ee | 02, 03, ..., 01 | |
2384
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
2385
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
2386
+ * | | eeeee | M, T, W, T, F, S, S | |
2387
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
2388
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
2389
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
2390
+ * | | cc | 02, 03, ..., 01 | |
2391
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
2392
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
2393
+ * | | ccccc | M, T, W, T, F, S, S | |
2394
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
2395
+ * | AM, PM | a..aa | AM, PM | |
2396
+ * | | aaa | am, pm | |
2397
+ * | | aaaa | a.m., p.m. | 2 |
2398
+ * | | aaaaa | a, p | |
2399
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
2400
+ * | | bbb | am, pm, noon, midnight | |
2401
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
2402
+ * | | bbbbb | a, p, n, mi | |
2403
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
2404
+ * | | BBBB | at night, in the morning, ... | 2 |
2405
+ * | | BBBBB | at night, in the morning, ... | |
2406
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
2407
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
2408
+ * | | hh | 01, 02, ..., 11, 12 | |
2409
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
2410
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
2411
+ * | | HH | 00, 01, 02, ..., 23 | |
2412
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
2413
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
2414
+ * | | KK | 01, 02, ..., 11, 00 | |
2415
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
2416
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
2417
+ * | | kk | 24, 01, 02, ..., 23 | |
2418
+ * | Minute | m | 0, 1, ..., 59 | |
2419
+ * | | mo | 0th, 1st, ..., 59th | 7 |
2420
+ * | | mm | 00, 01, ..., 59 | |
2421
+ * | Second | s | 0, 1, ..., 59 | |
2422
+ * | | so | 0th, 1st, ..., 59th | 7 |
2423
+ * | | ss | 00, 01, ..., 59 | |
2424
+ * | Fraction of second | S | 0, 1, ..., 9 | |
2425
+ * | | SS | 00, 01, ..., 99 | |
2426
+ * | | SSS | 000, 001, ..., 999 | |
2427
+ * | | SSSS | ... | 3 |
2428
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
2429
+ * | | XX | -0800, +0530, Z | |
2430
+ * | | XXX | -08:00, +05:30, Z | |
2431
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
2432
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
2433
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
2434
+ * | | xx | -0800, +0530, +0000 | |
2435
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
2436
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
2437
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
2438
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
2439
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
2440
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
2441
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
2442
+ * | Seconds timestamp | t | 512969520 | 7 |
2443
+ * | | tt | ... | 3,7 |
2444
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
2445
+ * | | TT | ... | 3,7 |
2446
+ * | Long localized date | P | 04/29/1453 | 7 |
2447
+ * | | PP | Apr 29, 1453 | 7 |
2448
+ * | | PPP | April 29th, 1453 | 7 |
2449
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
2450
+ * | Long localized time | p | 12:00 AM | 7 |
2451
+ * | | pp | 12:00:00 AM | 7 |
2452
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
2453
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
2454
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
2455
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
2456
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
2457
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
2458
+ * Notes:
2459
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
2460
+ * are the same as "stand-alone" units, but are different in some languages.
2461
+ * "Formatting" units are declined according to the rules of the language
2462
+ * in the context of a date. "Stand-alone" units are always nominative singular:
2463
+ *
2464
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
2465
+ *
2466
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
2467
+ *
2468
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
2469
+ * the single quote characters (see below).
2470
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
2471
+ * the output will be the same as default pattern for this unit, usually
2472
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
2473
+ * are marked with "2" in the last column of the table.
2474
+ *
2475
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
2476
+ *
2477
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
2478
+ *
2479
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
2480
+ *
2481
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
2482
+ *
2483
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
2484
+ *
2485
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
2486
+ * The output will be padded with zeros to match the length of the pattern.
2487
+ *
2488
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
2489
+ *
2490
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
2491
+ * These tokens represent the shortest form of the quarter.
2492
+ *
2493
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
2494
+ *
2495
+ * | Year | `y` | `u` |
2496
+ * |------|-----|-----|
2497
+ * | AC 1 | 1 | 1 |
2498
+ * | BC 1 | 1 | 0 |
2499
+ * | BC 2 | 2 | -1 |
2500
+ *
2501
+ * Also `yy` always returns the last two digits of a year,
2502
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
2503
+ *
2504
+ * | Year | `yy` | `uu` |
2505
+ * |------|------|------|
2506
+ * | 1 | 01 | 01 |
2507
+ * | 14 | 14 | 14 |
2508
+ * | 376 | 76 | 376 |
2509
+ * | 1453 | 53 | 1453 |
2510
+ *
2511
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
2512
+ * except local week-numbering years are dependent on `options.weekStartsOn`
2513
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
2514
+ * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
2515
+ *
2516
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
2517
+ * so right now these tokens fall back to GMT timezones.
2518
+ *
2519
+ * 7. These patterns are not in the Unicode Technical Standard #35:
2520
+ * - `i`: ISO day of week
2521
+ * - `I`: ISO week of year
2522
+ * - `R`: ISO week-numbering year
2523
+ * - `t`: seconds timestamp
2524
+ * - `T`: milliseconds timestamp
2525
+ * - `o`: ordinal number modifier
2526
+ * - `P`: long localized date
2527
+ * - `p`: long localized time
2528
+ *
2529
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
2530
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2531
+ *
2532
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
2533
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2534
+ *
2535
+ * @param {Date|Number} date - the original date
2536
+ * @param {String} format - the string of tokens
2537
+ * @param {Object} [options] - an object with options.
2538
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
2539
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
2540
+ * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
2541
+ * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
2542
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2543
+ * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
2544
+ * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2545
+ * @returns {String} the formatted date string
2546
+ * @throws {TypeError} 2 arguments required
2547
+ * @throws {RangeError} `date` must not be Invalid Date
2548
+ * @throws {RangeError} `options.locale` must contain `localize` property
2549
+ * @throws {RangeError} `options.locale` must contain `formatLong` property
2550
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
2551
+ * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
2552
+ * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2553
+ * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2554
+ * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2555
+ * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
2556
+ * @throws {RangeError} format string contains an unescaped latin alphabet character
2557
+ *
2558
+ * @example
2559
+ * // Represent 11 February 2014 in middle-endian format:
2560
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
2561
+ * //=> '02/11/2014'
2562
+ *
2563
+ * @example
2564
+ * // Represent 2 July 2014 in Esperanto:
2565
+ * import { eoLocale } from 'date-fns/locale/eo'
2566
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
2567
+ * locale: eoLocale
2568
+ * })
2569
+ * //=> '2-a de julio 2014'
2570
+ *
2571
+ * @example
2572
+ * // Escape string by single quote characters:
2573
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
2574
+ * //=> "3 o'clock"
2575
+ */
2576
+
2577
+ function format(dirtyDate, dirtyFormatStr, options) {
2578
+ var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
2579
+ requiredArgs(2, arguments);
2580
+ var formatStr = String(dirtyFormatStr);
2581
+ var defaultOptions = getDefaultOptions();
2582
+ var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
2583
+ var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
2584
+
2585
+ // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
2586
+ if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
2587
+ throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
2588
+ }
2589
+ var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
2590
+
2591
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
2592
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
2593
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
2594
+ }
2595
+ if (!locale.localize) {
2596
+ throw new RangeError('locale must contain localize property');
2597
+ }
2598
+ if (!locale.formatLong) {
2599
+ throw new RangeError('locale must contain formatLong property');
2600
+ }
2601
+ var originalDate = toDate(dirtyDate);
2602
+ if (!isValid(originalDate)) {
2603
+ throw new RangeError('Invalid time value');
2604
+ }
2605
+
2606
+ // Convert the date in system timezone to the same date in UTC+00:00 timezone.
2607
+ // This ensures that when UTC functions will be implemented, locales will be compatible with them.
2608
+ // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
2609
+ var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
2610
+ var utcDate = subMilliseconds(originalDate, timezoneOffset);
2611
+ var formatterOptions = {
2612
+ firstWeekContainsDate: firstWeekContainsDate,
2613
+ weekStartsOn: weekStartsOn,
2614
+ locale: locale,
2615
+ _originalDate: originalDate
2616
+ };
2617
+ var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
2618
+ var firstCharacter = substring[0];
2619
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
2620
+ var longFormatter = longFormatters$1[firstCharacter];
2621
+ return longFormatter(substring, locale.formatLong);
2622
+ }
2623
+ return substring;
2624
+ }).join('').match(formattingTokensRegExp).map(function (substring) {
2625
+ // Replace two single quote characters with one single quote character
2626
+ if (substring === "''") {
2627
+ return "'";
2628
+ }
2629
+ var firstCharacter = substring[0];
2630
+ if (firstCharacter === "'") {
2631
+ return cleanEscapedString(substring);
2632
+ }
2633
+ var formatter = formatters$1[firstCharacter];
2634
+ if (formatter) {
2635
+ if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
2636
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2637
+ }
2638
+ if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
2639
+ throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
2640
+ }
2641
+ return formatter(utcDate, substring, locale.localize, formatterOptions);
2642
+ }
2643
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
2644
+ throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
2645
+ }
2646
+ return substring;
2647
+ }).join('');
2648
+ return result;
2649
+ }
2650
+ function cleanEscapedString(input) {
2651
+ var matched = input.match(escapedStringRegExp);
2652
+ if (!matched) {
2653
+ return input;
2654
+ }
2655
+ return matched[1].replace(doubleQuoteRegExp, "'");
2656
+ }
2657
+
2658
+ /**
2659
+ * @name getDay
2660
+ * @category Weekday Helpers
2661
+ * @summary Get the day of the week of the given date.
2662
+ *
2663
+ * @description
2664
+ * Get the day of the week of the given date.
2665
+ *
2666
+ * @param {Date|Number} date - the given date
2667
+ * @returns {0|1|2|3|4|5|6} the day of week, 0 represents Sunday
2668
+ * @throws {TypeError} 1 argument required
2669
+ *
2670
+ * @example
2671
+ * // Which day of the week is 29 February 2012?
2672
+ * const result = getDay(new Date(2012, 1, 29))
2673
+ * //=> 3
2674
+ */
2675
+ function getDay(dirtyDate) {
2676
+ requiredArgs(1, arguments);
2677
+ var date = toDate(dirtyDate);
2678
+ var day = date.getDay();
2679
+ return day;
2680
+ }
2681
+
2682
+ /**
2683
+ * @name getMonth
2684
+ * @category Month Helpers
2685
+ * @summary Get the month of the given date.
2686
+ *
2687
+ * @description
2688
+ * Get the month of the given date.
2689
+ *
2690
+ * @param {Date|Number} date - the given date
2691
+ * @returns {Number} the month
2692
+ * @throws {TypeError} 1 argument required
2693
+ *
2694
+ * @example
2695
+ * // Which month is 29 February 2012?
2696
+ * const result = getMonth(new Date(2012, 1, 29))
2697
+ * //=> 1
2698
+ */
2699
+ function getMonth(dirtyDate) {
2700
+ requiredArgs(1, arguments);
2701
+ var date = toDate(dirtyDate);
2702
+ var month = date.getMonth();
2703
+ return month;
2704
+ }
2705
+
2706
+ /**
2707
+ * @name getYear
2708
+ * @category Year Helpers
2709
+ * @summary Get the year of the given date.
2710
+ *
2711
+ * @description
2712
+ * Get the year of the given date.
2713
+ *
2714
+ * @param {Date|Number} date - the given date
2715
+ * @returns {Number} the year
2716
+ * @throws {TypeError} 1 argument required
2717
+ *
2718
+ * @example
2719
+ * // Which year is 2 July 2014?
2720
+ * const result = getYear(new Date(2014, 6, 2))
2721
+ * //=> 2014
2722
+ */
2723
+ function getYear(dirtyDate) {
2724
+ requiredArgs(1, arguments);
2725
+ return toDate(dirtyDate).getFullYear();
2726
+ }
2727
+
2728
+ /**
2729
+ * @name isAfter
2730
+ * @category Common Helpers
2731
+ * @summary Is the first date after the second one?
2732
+ *
2733
+ * @description
2734
+ * Is the first date after the second one?
2735
+ *
2736
+ * @param {Date|Number} date - the date that should be after the other one to return true
2737
+ * @param {Date|Number} dateToCompare - the date to compare with
2738
+ * @returns {Boolean} the first date is after the second date
2739
+ * @throws {TypeError} 2 arguments required
2740
+ *
2741
+ * @example
2742
+ * // Is 10 July 1989 after 11 February 1987?
2743
+ * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
2744
+ * //=> true
2745
+ */
2746
+ function isAfter(dirtyDate, dirtyDateToCompare) {
2747
+ requiredArgs(2, arguments);
2748
+ var date = toDate(dirtyDate);
2749
+ var dateToCompare = toDate(dirtyDateToCompare);
2750
+ return date.getTime() > dateToCompare.getTime();
2751
+ }
2752
+
2753
+ /**
2754
+ * @name isBefore
2755
+ * @category Common Helpers
2756
+ * @summary Is the first date before the second one?
2757
+ *
2758
+ * @description
2759
+ * Is the first date before the second one?
2760
+ *
2761
+ * @param {Date|Number} date - the date that should be before the other one to return true
2762
+ * @param {Date|Number} dateToCompare - the date to compare with
2763
+ * @returns {Boolean} the first date is before the second date
2764
+ * @throws {TypeError} 2 arguments required
2765
+ *
2766
+ * @example
2767
+ * // Is 10 July 1989 before 11 February 1987?
2768
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
2769
+ * //=> false
2770
+ */
2771
+ function isBefore(dirtyDate, dirtyDateToCompare) {
2772
+ requiredArgs(2, arguments);
2773
+ var date = toDate(dirtyDate);
2774
+ var dateToCompare = toDate(dirtyDateToCompare);
2775
+ return date.getTime() < dateToCompare.getTime();
2776
+ }
2777
+
2778
+ /**
2779
+ * @name isToday
2780
+ * @category Day Helpers
2781
+ * @summary Is the given date today?
2782
+ * @pure false
2783
+ *
2784
+ * @description
2785
+ * Is the given date today?
2786
+ *
2787
+ * > ⚠️ Please note that this function is not present in the FP submodule as
2788
+ * > it uses `Date.now()` internally hence impure and can't be safely curried.
2789
+ *
2790
+ * @param {Date|Number} date - the date to check
2791
+ * @returns {Boolean} the date is today
2792
+ * @throws {TypeError} 1 argument required
2793
+ *
2794
+ * @example
2795
+ * // If today is 6 October 2014, is 6 October 14:00:00 today?
2796
+ * const result = isToday(new Date(2014, 9, 6, 14, 0))
2797
+ * //=> true
2798
+ */
2799
+ function isToday(dirtyDate) {
2800
+ requiredArgs(1, arguments);
2801
+ return isSameDay(dirtyDate, Date.now());
2802
+ }
2803
+
2804
+ /**
2805
+ * @name subDays
2806
+ * @category Day Helpers
2807
+ * @summary Subtract the specified number of days from the given date.
2808
+ *
2809
+ * @description
2810
+ * Subtract the specified number of days from the given date.
2811
+ *
2812
+ * @param {Date|Number} date - the date to be changed
2813
+ * @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
2814
+ * @returns {Date} the new date with the days subtracted
2815
+ * @throws {TypeError} 2 arguments required
2816
+ *
2817
+ * @example
2818
+ * // Subtract 10 days from 1 September 2014:
2819
+ * const result = subDays(new Date(2014, 8, 1), 10)
2820
+ * //=> Fri Aug 22 2014 00:00:00
2821
+ */
2822
+ function subDays(dirtyDate, dirtyAmount) {
2823
+ requiredArgs(2, arguments);
2824
+ var amount = toInteger(dirtyAmount);
2825
+ return addDays(dirtyDate, -amount);
2826
+ }
2827
+
2828
+ /**
2829
+ * @name parseISO
2830
+ * @category Common Helpers
2831
+ * @summary Parse ISO string
2832
+ *
2833
+ * @description
2834
+ * Parse the given string in ISO 8601 format and return an instance of Date.
2835
+ *
2836
+ * Function accepts complete ISO 8601 formats as well as partial implementations.
2837
+ * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
2838
+ *
2839
+ * If the argument isn't a string, the function cannot parse the string or
2840
+ * the values are invalid, it returns Invalid Date.
2841
+ *
2842
+ * @param {String} argument - the value to convert
2843
+ * @param {Object} [options] - an object with options.
2844
+ * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
2845
+ * @returns {Date} the parsed date in the local time zone
2846
+ * @throws {TypeError} 1 argument required
2847
+ * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
2848
+ *
2849
+ * @example
2850
+ * // Convert string '2014-02-11T11:30:30' to date:
2851
+ * const result = parseISO('2014-02-11T11:30:30')
2852
+ * //=> Tue Feb 11 2014 11:30:30
2853
+ *
2854
+ * @example
2855
+ * // Convert string '+02014101' to date,
2856
+ * // if the additional number of digits in the extended year format is 1:
2857
+ * const result = parseISO('+02014101', { additionalDigits: 1 })
2858
+ * //=> Fri Apr 11 2014 00:00:00
2859
+ */
2860
+ function parseISO(argument, options) {
2861
+ var _options$additionalDi;
2862
+ requiredArgs(1, arguments);
2863
+ var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
2864
+ if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
2865
+ throw new RangeError('additionalDigits must be 0, 1 or 2');
2866
+ }
2867
+ if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
2868
+ return new Date(NaN);
2869
+ }
2870
+ var dateStrings = splitDateString(argument);
2871
+ var date;
2872
+ if (dateStrings.date) {
2873
+ var parseYearResult = parseYear(dateStrings.date, additionalDigits);
2874
+ date = parseDate(parseYearResult.restDateString, parseYearResult.year);
2875
+ }
2876
+ if (!date || isNaN(date.getTime())) {
2877
+ return new Date(NaN);
2878
+ }
2879
+ var timestamp = date.getTime();
2880
+ var time = 0;
2881
+ var offset;
2882
+ if (dateStrings.time) {
2883
+ time = parseTime(dateStrings.time);
2884
+ if (isNaN(time)) {
2885
+ return new Date(NaN);
2886
+ }
2887
+ }
2888
+ if (dateStrings.timezone) {
2889
+ offset = parseTimezone(dateStrings.timezone);
2890
+ if (isNaN(offset)) {
2891
+ return new Date(NaN);
2892
+ }
2893
+ } else {
2894
+ var dirtyDate = new Date(timestamp + time);
2895
+ // js parsed string assuming it's in UTC timezone
2896
+ // but we need it to be parsed in our timezone
2897
+ // so we use utc values to build date in our timezone.
2898
+ // Year values from 0 to 99 map to the years 1900 to 1999
2899
+ // so set year explicitly with setFullYear.
2900
+ var result = new Date(0);
2901
+ result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
2902
+ result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
2903
+ return result;
2904
+ }
2905
+ return new Date(timestamp + time + offset);
2906
+ }
2907
+ var patterns = {
2908
+ dateTimeDelimiter: /[T ]/,
2909
+ timeZoneDelimiter: /[Z ]/i,
2910
+ timezone: /([Z+-].*)$/
2911
+ };
2912
+ var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
2913
+ var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
2914
+ var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
2915
+ function splitDateString(dateString) {
2916
+ var dateStrings = {};
2917
+ var array = dateString.split(patterns.dateTimeDelimiter);
2918
+ var timeString;
2919
+
2920
+ // The regex match should only return at maximum two array elements.
2921
+ // [date], [time], or [date, time].
2922
+ if (array.length > 2) {
2923
+ return dateStrings;
2924
+ }
2925
+ if (/:/.test(array[0])) {
2926
+ timeString = array[0];
2927
+ } else {
2928
+ dateStrings.date = array[0];
2929
+ timeString = array[1];
2930
+ if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
2931
+ dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
2932
+ timeString = dateString.substr(dateStrings.date.length, dateString.length);
2933
+ }
2934
+ }
2935
+ if (timeString) {
2936
+ var token = patterns.timezone.exec(timeString);
2937
+ if (token) {
2938
+ dateStrings.time = timeString.replace(token[1], '');
2939
+ dateStrings.timezone = token[1];
2940
+ } else {
2941
+ dateStrings.time = timeString;
2942
+ }
2943
+ }
2944
+ return dateStrings;
2945
+ }
2946
+ function parseYear(dateString, additionalDigits) {
2947
+ var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)');
2948
+ var captures = dateString.match(regex);
2949
+ // Invalid ISO-formatted year
2950
+ if (!captures) return {
2951
+ year: NaN,
2952
+ restDateString: ''
2953
+ };
2954
+ var year = captures[1] ? parseInt(captures[1]) : null;
2955
+ var century = captures[2] ? parseInt(captures[2]) : null;
2956
+
2957
+ // either year or century is null, not both
2958
+ return {
2959
+ year: century === null ? year : century * 100,
2960
+ restDateString: dateString.slice((captures[1] || captures[2]).length)
2961
+ };
2962
+ }
2963
+ function parseDate(dateString, year) {
2964
+ // Invalid ISO-formatted year
2965
+ if (year === null) return new Date(NaN);
2966
+ var captures = dateString.match(dateRegex);
2967
+ // Invalid ISO-formatted string
2968
+ if (!captures) return new Date(NaN);
2969
+ var isWeekDate = !!captures[4];
2970
+ var dayOfYear = parseDateUnit(captures[1]);
2971
+ var month = parseDateUnit(captures[2]) - 1;
2972
+ var day = parseDateUnit(captures[3]);
2973
+ var week = parseDateUnit(captures[4]);
2974
+ var dayOfWeek = parseDateUnit(captures[5]) - 1;
2975
+ if (isWeekDate) {
2976
+ if (!validateWeekDate(year, week, dayOfWeek)) {
2977
+ return new Date(NaN);
2978
+ }
2979
+ return dayOfISOWeekYear(year, week, dayOfWeek);
2980
+ } else {
2981
+ var date = new Date(0);
2982
+ if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
2983
+ return new Date(NaN);
2984
+ }
2985
+ date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
2986
+ return date;
2987
+ }
2988
+ }
2989
+ function parseDateUnit(value) {
2990
+ return value ? parseInt(value) : 1;
2991
+ }
2992
+ function parseTime(timeString) {
2993
+ var captures = timeString.match(timeRegex);
2994
+ if (!captures) return NaN; // Invalid ISO-formatted time
2995
+
2996
+ var hours = parseTimeUnit(captures[1]);
2997
+ var minutes = parseTimeUnit(captures[2]);
2998
+ var seconds = parseTimeUnit(captures[3]);
2999
+ if (!validateTime(hours, minutes, seconds)) {
3000
+ return NaN;
3001
+ }
3002
+ return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
3003
+ }
3004
+ function parseTimeUnit(value) {
3005
+ return value && parseFloat(value.replace(',', '.')) || 0;
3006
+ }
3007
+ function parseTimezone(timezoneString) {
3008
+ if (timezoneString === 'Z') return 0;
3009
+ var captures = timezoneString.match(timezoneRegex);
3010
+ if (!captures) return 0;
3011
+ var sign = captures[1] === '+' ? -1 : 1;
3012
+ var hours = parseInt(captures[2]);
3013
+ var minutes = captures[3] && parseInt(captures[3]) || 0;
3014
+ if (!validateTimezone(hours, minutes)) {
3015
+ return NaN;
3016
+ }
3017
+ return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
3018
+ }
3019
+ function dayOfISOWeekYear(isoWeekYear, week, day) {
3020
+ var date = new Date(0);
3021
+ date.setUTCFullYear(isoWeekYear, 0, 4);
3022
+ var fourthOfJanuaryDay = date.getUTCDay() || 7;
3023
+ var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
3024
+ date.setUTCDate(date.getUTCDate() + diff);
3025
+ return date;
3026
+ }
3027
+
3028
+ // Validation functions
3029
+
3030
+ // February is null to handle the leap year (using ||)
3031
+ var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
3032
+ function isLeapYearIndex(year) {
3033
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
3034
+ }
3035
+ function validateDate(year, month, date) {
3036
+ return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
3037
+ }
3038
+ function validateDayOfYearDate(year, dayOfYear) {
3039
+ return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
3040
+ }
3041
+ function validateWeekDate(_year, week, day) {
3042
+ return week >= 1 && week <= 53 && day >= 0 && day <= 6;
3043
+ }
3044
+ function validateTime(hours, minutes, seconds) {
3045
+ if (hours === 24) {
3046
+ return minutes === 0 && seconds === 0;
3047
+ }
3048
+ return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
3049
+ }
3050
+ function validateTimezone(_hours, minutes) {
3051
+ return minutes >= 0 && minutes <= 59;
3052
+ }
3053
+
3054
+ /**
3055
+ * @name subMonths
3056
+ * @category Month Helpers
3057
+ * @summary Subtract the specified number of months from the given date.
3058
+ *
3059
+ * @description
3060
+ * Subtract the specified number of months from the given date.
3061
+ *
3062
+ * @param {Date|Number} date - the date to be changed
3063
+ * @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
3064
+ * @returns {Date} the new date with the months subtracted
3065
+ * @throws {TypeError} 2 arguments required
3066
+ *
3067
+ * @example
3068
+ * // Subtract 5 months from 1 February 2015:
3069
+ * const result = subMonths(new Date(2015, 1, 1), 5)
3070
+ * //=> Mon Sep 01 2014 00:00:00
3071
+ */
3072
+ function subMonths(dirtyDate, dirtyAmount) {
3073
+ requiredArgs(2, arguments);
3074
+ var amount = toInteger(dirtyAmount);
3075
+ return addMonths(dirtyDate, -amount);
3076
+ }
3077
+
3078
+ var dateFormats$1 = {
3079
+ full: 'EEEE, d MMMM yyyy',
3080
+ long: 'd MMMM yyyy',
3081
+ medium: 'd MMM yyyy',
3082
+ short: 'dd/MM/yyyy'
3083
+ };
3084
+ var timeFormats$1 = {
3085
+ full: 'h:mm:ss a zzzz',
3086
+ long: 'h:mm:ss a z',
3087
+ medium: 'h:mm:ss a',
3088
+ short: 'h:mm a'
3089
+ };
3090
+ var dateTimeFormats$1 = {
3091
+ full: "{{date}} 'at' {{time}}",
3092
+ long: "{{date}} 'at' {{time}}",
3093
+ medium: '{{date}}, {{time}}',
3094
+ short: '{{date}}, {{time}}'
3095
+ };
3096
+ var formatLong$2 = {
3097
+ date: buildFormatLongFn({
3098
+ formats: dateFormats$1,
3099
+ defaultWidth: 'full'
3100
+ }),
3101
+ time: buildFormatLongFn({
3102
+ formats: timeFormats$1,
3103
+ defaultWidth: 'full'
3104
+ }),
3105
+ dateTime: buildFormatLongFn({
3106
+ formats: dateTimeFormats$1,
3107
+ defaultWidth: 'full'
3108
+ })
3109
+ };
3110
+ const formatLong$3 = formatLong$2;
3111
+
3112
+ /**
3113
+ * @type {Locale}
3114
+ * @category Locales
3115
+ * @summary English locale (Australia).
3116
+ * @language English
3117
+ * @iso-639-2 eng
3118
+ * @author Julien Malige [@JulienMalige]{@link https://github.com/JulienMalige}
3119
+ */
3120
+ var locale$1 = {
3121
+ code: 'en-AU',
3122
+ formatDistance: formatDistance$3,
3123
+ formatLong: formatLong$3,
3124
+ formatRelative: formatRelative$3,
3125
+ localize: localize$3,
3126
+ match: match$3,
3127
+ options: {
3128
+ weekStartsOn: 1 /* Monday */,
3129
+ firstWeekContainsDate: 4
3130
+ }
3131
+ };
3132
+ const enAU = locale$1;
3133
+
3134
+ var formatDistanceLocale = {
3135
+ lessThanXSeconds: {
3136
+ one: 'menos de um segundo',
3137
+ other: 'menos de {{count}} segundos'
3138
+ },
3139
+ xSeconds: {
3140
+ one: '1 segundo',
3141
+ other: '{{count}} segundos'
3142
+ },
3143
+ halfAMinute: 'meio minuto',
3144
+ lessThanXMinutes: {
3145
+ one: 'menos de um minuto',
3146
+ other: 'menos de {{count}} minutos'
3147
+ },
3148
+ xMinutes: {
3149
+ one: '1 minuto',
3150
+ other: '{{count}} minutos'
3151
+ },
3152
+ aboutXHours: {
3153
+ one: 'cerca de 1 hora',
3154
+ other: 'cerca de {{count}} horas'
3155
+ },
3156
+ xHours: {
3157
+ one: '1 hora',
3158
+ other: '{{count}} horas'
3159
+ },
3160
+ xDays: {
3161
+ one: '1 dia',
3162
+ other: '{{count}} dias'
3163
+ },
3164
+ aboutXWeeks: {
3165
+ one: 'cerca de 1 semana',
3166
+ other: 'cerca de {{count}} semanas'
3167
+ },
3168
+ xWeeks: {
3169
+ one: '1 semana',
3170
+ other: '{{count}} semanas'
3171
+ },
3172
+ aboutXMonths: {
3173
+ one: 'cerca de 1 mês',
3174
+ other: 'cerca de {{count}} meses'
3175
+ },
3176
+ xMonths: {
3177
+ one: '1 mês',
3178
+ other: '{{count}} meses'
3179
+ },
3180
+ aboutXYears: {
3181
+ one: 'cerca de 1 ano',
3182
+ other: 'cerca de {{count}} anos'
3183
+ },
3184
+ xYears: {
3185
+ one: '1 ano',
3186
+ other: '{{count}} anos'
3187
+ },
3188
+ overXYears: {
3189
+ one: 'mais de 1 ano',
3190
+ other: 'mais de {{count}} anos'
3191
+ },
3192
+ almostXYears: {
3193
+ one: 'quase 1 ano',
3194
+ other: 'quase {{count}} anos'
3195
+ }
3196
+ };
3197
+ var formatDistance = function formatDistance(token, count, options) {
3198
+ var result;
3199
+ var tokenValue = formatDistanceLocale[token];
3200
+ if (typeof tokenValue === 'string') {
3201
+ result = tokenValue;
3202
+ } else if (count === 1) {
3203
+ result = tokenValue.one;
3204
+ } else {
3205
+ result = tokenValue.other.replace('{{count}}', String(count));
3206
+ }
3207
+ if (options !== null && options !== void 0 && options.addSuffix) {
3208
+ if (options.comparison && options.comparison > 0) {
3209
+ return 'em ' + result;
3210
+ } else {
3211
+ return 'há ' + result;
3212
+ }
3213
+ }
3214
+ return result;
3215
+ };
3216
+ const formatDistance$1 = formatDistance;
3217
+
3218
+ var dateFormats = {
3219
+ full: "EEEE, d 'de' MMMM 'de' y",
3220
+ long: "d 'de' MMMM 'de' y",
3221
+ medium: 'd MMM y',
3222
+ short: 'dd/MM/yyyy'
3223
+ };
3224
+ var timeFormats = {
3225
+ full: 'HH:mm:ss zzzz',
3226
+ long: 'HH:mm:ss z',
3227
+ medium: 'HH:mm:ss',
3228
+ short: 'HH:mm'
3229
+ };
3230
+ var dateTimeFormats = {
3231
+ full: "{{date}} 'às' {{time}}",
3232
+ long: "{{date}} 'às' {{time}}",
3233
+ medium: '{{date}}, {{time}}',
3234
+ short: '{{date}}, {{time}}'
3235
+ };
3236
+ var formatLong = {
3237
+ date: buildFormatLongFn({
3238
+ formats: dateFormats,
3239
+ defaultWidth: 'full'
3240
+ }),
3241
+ time: buildFormatLongFn({
3242
+ formats: timeFormats,
3243
+ defaultWidth: 'full'
3244
+ }),
3245
+ dateTime: buildFormatLongFn({
3246
+ formats: dateTimeFormats,
3247
+ defaultWidth: 'full'
3248
+ })
3249
+ };
3250
+ const formatLong$1 = formatLong;
3251
+
3252
+ var formatRelativeLocale = {
3253
+ lastWeek: function lastWeek(date) {
3254
+ var weekday = date.getUTCDay();
3255
+ var last = weekday === 0 || weekday === 6 ? 'último' : 'última';
3256
+ return "'" + last + "' eeee 'às' p";
3257
+ },
3258
+ yesterday: "'ontem às' p",
3259
+ today: "'hoje às' p",
3260
+ tomorrow: "'amanhã às' p",
3261
+ nextWeek: "eeee 'às' p",
3262
+ other: 'P'
3263
+ };
3264
+ var formatRelative = function formatRelative(token, date, _baseDate, _options) {
3265
+ var format = formatRelativeLocale[token];
3266
+ if (typeof format === 'function') {
3267
+ return format(date);
3268
+ }
3269
+ return format;
3270
+ };
3271
+ const formatRelative$1 = formatRelative;
3272
+
3273
+ var eraValues = {
3274
+ narrow: ['AC', 'DC'],
3275
+ abbreviated: ['AC', 'DC'],
3276
+ wide: ['antes de cristo', 'depois de cristo']
3277
+ };
3278
+ var quarterValues = {
3279
+ narrow: ['1', '2', '3', '4'],
3280
+ abbreviated: ['T1', 'T2', 'T3', 'T4'],
3281
+ wide: ['1º trimestre', '2º trimestre', '3º trimestre', '4º trimestre']
3282
+ };
3283
+ var monthValues = {
3284
+ narrow: ['j', 'f', 'm', 'a', 'm', 'j', 'j', 'a', 's', 'o', 'n', 'd'],
3285
+ abbreviated: ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez'],
3286
+ wide: ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro']
3287
+ };
3288
+ var dayValues = {
3289
+ narrow: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'],
3290
+ short: ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sab'],
3291
+ abbreviated: ['domingo', 'segunda', 'terça', 'quarta', 'quinta', 'sexta', 'sábado'],
3292
+ wide: ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado']
3293
+ };
3294
+ var dayPeriodValues = {
3295
+ narrow: {
3296
+ am: 'a',
3297
+ pm: 'p',
3298
+ midnight: 'mn',
3299
+ noon: 'md',
3300
+ morning: 'manhã',
3301
+ afternoon: 'tarde',
3302
+ evening: 'tarde',
3303
+ night: 'noite'
3304
+ },
3305
+ abbreviated: {
3306
+ am: 'AM',
3307
+ pm: 'PM',
3308
+ midnight: 'meia-noite',
3309
+ noon: 'meio-dia',
3310
+ morning: 'manhã',
3311
+ afternoon: 'tarde',
3312
+ evening: 'tarde',
3313
+ night: 'noite'
3314
+ },
3315
+ wide: {
3316
+ am: 'a.m.',
3317
+ pm: 'p.m.',
3318
+ midnight: 'meia-noite',
3319
+ noon: 'meio-dia',
3320
+ morning: 'manhã',
3321
+ afternoon: 'tarde',
3322
+ evening: 'tarde',
3323
+ night: 'noite'
3324
+ }
3325
+ };
3326
+ var formattingDayPeriodValues = {
3327
+ narrow: {
3328
+ am: 'a',
3329
+ pm: 'p',
3330
+ midnight: 'mn',
3331
+ noon: 'md',
3332
+ morning: 'da manhã',
3333
+ afternoon: 'da tarde',
3334
+ evening: 'da tarde',
3335
+ night: 'da noite'
3336
+ },
3337
+ abbreviated: {
3338
+ am: 'AM',
3339
+ pm: 'PM',
3340
+ midnight: 'meia-noite',
3341
+ noon: 'meio-dia',
3342
+ morning: 'da manhã',
3343
+ afternoon: 'da tarde',
3344
+ evening: 'da tarde',
3345
+ night: 'da noite'
3346
+ },
3347
+ wide: {
3348
+ am: 'a.m.',
3349
+ pm: 'p.m.',
3350
+ midnight: 'meia-noite',
3351
+ noon: 'meio-dia',
3352
+ morning: 'da manhã',
3353
+ afternoon: 'da tarde',
3354
+ evening: 'da tarde',
3355
+ night: 'da noite'
3356
+ }
3357
+ };
3358
+ var ordinalNumber = function ordinalNumber(dirtyNumber, options) {
3359
+ var number = Number(dirtyNumber);
3360
+ if ((options === null || options === void 0 ? void 0 : options.unit) === 'week') {
3361
+ return number + 'ª';
3362
+ }
3363
+ return number + 'º';
3364
+ };
3365
+ var localize = {
3366
+ ordinalNumber: ordinalNumber,
3367
+ era: buildLocalizeFn({
3368
+ values: eraValues,
3369
+ defaultWidth: 'wide'
3370
+ }),
3371
+ quarter: buildLocalizeFn({
3372
+ values: quarterValues,
3373
+ defaultWidth: 'wide',
3374
+ argumentCallback: function argumentCallback(quarter) {
3375
+ return quarter - 1;
3376
+ }
3377
+ }),
3378
+ month: buildLocalizeFn({
3379
+ values: monthValues,
3380
+ defaultWidth: 'wide'
3381
+ }),
3382
+ day: buildLocalizeFn({
3383
+ values: dayValues,
3384
+ defaultWidth: 'wide'
3385
+ }),
3386
+ dayPeriod: buildLocalizeFn({
3387
+ values: dayPeriodValues,
3388
+ defaultWidth: 'wide',
3389
+ formattingValues: formattingDayPeriodValues,
3390
+ defaultFormattingWidth: 'wide'
3391
+ })
3392
+ };
3393
+ const localize$1 = localize;
3394
+
3395
+ var matchOrdinalNumberPattern = /^(\d+)[ºªo]?/i;
3396
+ var parseOrdinalNumberPattern = /\d+/i;
3397
+ var matchEraPatterns = {
3398
+ narrow: /^(ac|dc|a|d)/i,
3399
+ abbreviated: /^(a\.?\s?c\.?|d\.?\s?c\.?)/i,
3400
+ wide: /^(antes de cristo|depois de cristo)/i
3401
+ };
3402
+ var parseEraPatterns = {
3403
+ any: [/^ac/i, /^dc/i],
3404
+ wide: [/^antes de cristo/i, /^depois de cristo/i]
3405
+ };
3406
+ var matchQuarterPatterns = {
3407
+ narrow: /^[1234]/i,
3408
+ abbreviated: /^T[1234]/i,
3409
+ wide: /^[1234](º)? trimestre/i
3410
+ };
3411
+ var parseQuarterPatterns = {
3412
+ any: [/1/i, /2/i, /3/i, /4/i]
3413
+ };
3414
+ var matchMonthPatterns = {
3415
+ narrow: /^[jfmajsond]/i,
3416
+ abbreviated: /^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,
3417
+ wide: /^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i
3418
+ };
3419
+ var parseMonthPatterns = {
3420
+ narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
3421
+ any: [/^ja/i, /^fev/i, /^mar/i, /^abr/i, /^mai/i, /^jun/i, /^jul/i, /^ago/i, /^set/i, /^out/i, /^nov/i, /^dez/i]
3422
+ };
3423
+ var matchDayPatterns = {
3424
+ narrow: /^(dom|[23456]ª?|s[aá]b)/i,
3425
+ short: /^(dom|[23456]ª?|s[aá]b)/i,
3426
+ abbreviated: /^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,
3427
+ wide: /^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i
3428
+ };
3429
+ var parseDayPatterns = {
3430
+ short: [/^d/i, /^2/i, /^3/i, /^4/i, /^5/i, /^6/i, /^s[aá]/i],
3431
+ narrow: [/^d/i, /^2/i, /^3/i, /^4/i, /^5/i, /^6/i, /^s[aá]/i],
3432
+ any: [/^d/i, /^seg/i, /^t/i, /^qua/i, /^qui/i, /^sex/i, /^s[aá]b/i]
3433
+ };
3434
+ var matchDayPeriodPatterns = {
3435
+ narrow: /^(a|p|mn|md|(da) (manhã|tarde|noite))/i,
3436
+ any: /^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i
3437
+ };
3438
+ var parseDayPeriodPatterns = {
3439
+ any: {
3440
+ am: /^a/i,
3441
+ pm: /^p/i,
3442
+ midnight: /^mn|^meia[-\s]noite/i,
3443
+ noon: /^md|^meio[-\s]dia/i,
3444
+ morning: /manhã/i,
3445
+ afternoon: /tarde/i,
3446
+ evening: /tarde/i,
3447
+ night: /noite/i
3448
+ }
3449
+ };
3450
+ var match = {
3451
+ ordinalNumber: buildMatchPatternFn({
3452
+ matchPattern: matchOrdinalNumberPattern,
3453
+ parsePattern: parseOrdinalNumberPattern,
3454
+ valueCallback: function valueCallback(value) {
3455
+ return parseInt(value, 10);
3456
+ }
3457
+ }),
3458
+ era: buildMatchFn({
3459
+ matchPatterns: matchEraPatterns,
3460
+ defaultMatchWidth: 'wide',
3461
+ parsePatterns: parseEraPatterns,
3462
+ defaultParseWidth: 'any'
3463
+ }),
3464
+ quarter: buildMatchFn({
3465
+ matchPatterns: matchQuarterPatterns,
3466
+ defaultMatchWidth: 'wide',
3467
+ parsePatterns: parseQuarterPatterns,
3468
+ defaultParseWidth: 'any',
3469
+ valueCallback: function valueCallback(index) {
3470
+ return index + 1;
3471
+ }
3472
+ }),
3473
+ month: buildMatchFn({
3474
+ matchPatterns: matchMonthPatterns,
3475
+ defaultMatchWidth: 'wide',
3476
+ parsePatterns: parseMonthPatterns,
3477
+ defaultParseWidth: 'any'
3478
+ }),
3479
+ day: buildMatchFn({
3480
+ matchPatterns: matchDayPatterns,
3481
+ defaultMatchWidth: 'wide',
3482
+ parsePatterns: parseDayPatterns,
3483
+ defaultParseWidth: 'any'
3484
+ }),
3485
+ dayPeriod: buildMatchFn({
3486
+ matchPatterns: matchDayPeriodPatterns,
3487
+ defaultMatchWidth: 'any',
3488
+ parsePatterns: parseDayPeriodPatterns,
3489
+ defaultParseWidth: 'any'
3490
+ })
3491
+ };
3492
+ const match$1 = match;
3493
+
3494
+ /**
3495
+ * @type {Locale}
3496
+ * @category Locales
3497
+ * @summary Portuguese locale (Brazil).
3498
+ * @language Portuguese
3499
+ * @iso-639-2 por
3500
+ * @author Lucas Duailibe [@duailibe]{@link https://github.com/duailibe}
3501
+ * @author Yago Carballo [@yagocarballo]{@link https://github.com/YagoCarballo}
3502
+ */
3503
+ var locale = {
3504
+ code: 'pt-BR',
3505
+ formatDistance: formatDistance$1,
3506
+ formatLong: formatLong$1,
3507
+ formatRelative: formatRelative$1,
3508
+ localize: localize$1,
3509
+ match: match$1,
3510
+ options: {
3511
+ weekStartsOn: 0 /* Sunday */,
3512
+ firstWeekContainsDate: 1
3513
+ }
3514
+ };
3515
+ const ptBR = locale;
3516
+
3517
+ const curaCalendarCss = ":host{display:block;width:var(--width)}:host .calendar{display:flex;flex-direction:column;gap:5px;width:var(--width);padding:0 12px 12px 12px;min-width:300px;border:1px solid var(--neutral-light);border-radius:4px;overflow:hidden;background:#fff;box-shadow:0 4px 8px var(--neutral-light);font-family:var(--font-family)}:host .header{position:relative;padding:12px 0}:host .header::after{content:\"\";position:absolute;bottom:0;left:2px;right:2px;border-bottom:2px dotted var(--neutral-light)}:host .month-year{display:flex;padding:12px 8px;justify-content:space-between;align-self:stretch}:host .month-year.dropdown{padding:0%}:host .select{display:flex;padding:0px 12px;justify-content:center;align-items:center;gap:6px;flex:1 0 0}:host .drop-month{display:flex;max-width:118px;padding:0px;align-items:flex-start;gap:0px;flex:1 0 0}:host .drop-year{display:flex;min-width:80px;max-width:85px;padding:0px;align-items:flex-start;gap:0px;flex:1 0 0}:host .days-of-week{display:flex;height:30px;padding:4px;justify-content:center;align-items:center;gap:4px;flex-shrink:0}:host .day{flex:1;text-align:center}:host .dates{display:flex;flex-wrap:wrap;align-items:center;align-self:stretch;gap:0}:host .icon{cursor:pointer;position:relative;overflow:hidden;border-radius:50%}:host .icon.dropdown{margin-top:10px}:host .icon::before{content:\"\";position:absolute;border-radius:50%;top:50%;left:50%;width:20px;height:20px;background:var(--accent-base);transform:translate(-50%, -50%) scale(0);transition:transform 0.2s ease}:host .icon:active::before{transform:translate(-50%, -50%) scale(1)}:host .icon:active{transform:scale(1)}:host .date{display:flex;justify-content:center;align-items:center;height:auto;width:14.2857142857%;aspect-ratio:1;font-size:14px;cursor:pointer;position:relative;box-sizing:border-box;text-align:center;flex-shrink:0}:host .date.today{border:2px solid var(--primary-darker);border-radius:50%;color:var(--primary-darker)}:host .date.selected,:host .date.default-dates{color:var(--neutral-black) !important;background:var(--accent-base);border-radius:50%;border:none}:host .date.invalid{color:var(--neutral-dark) !important;cursor:not-allowed}:host .date.invalid:hover{background:none;box-shadow:none}:host .date.valid{color:var(--primary-darker);font-weight:var(--font-weight-bold)}:host .date.range.start{border-radius:50% 0 0 50%;color:var(--primary-darker) !important;background:var(--accent-base)}:host .date.range.interval{border-radius:0;background-color:var(--accent-light);color:var(--neutral-black)}:host .date.range.interval.today{border:none}:host .date.range.end{border-radius:0 50% 50% 0;color:var(--primary-darker) !important;background:var(--accent-base)}:host .date:hover{background:var(--accent-light);border-radius:50%;color:var(--neutral-black)}:host select,:host input{width:60px;font-size:16px;box-shadow:0 2px 2px var(--neutral-black);padding:5px;border-radius:4px;border:1px solid #ccc;background:#f7f7f7}";
3518
+ const CuraCalendarStyle0 = curaCalendarCss;
3519
+
3520
+ const CuraCalendar = class {
3521
+ constructor(hostRef) {
3522
+ registerInstance(this, hostRef);
3523
+ this.onchangeday = createEvent(this, "onchangeday", 7);
3524
+ this.theme = window.CuraAPI.theme;
3525
+ this.weights = this.theme.fonts.getWeights();
3526
+ this.optionsLocale = { 'pt-BR': ptBR, 'en-US': enAU };
3527
+ this.period = [];
3528
+ this.width = '300px';
3529
+ this.mode = 'single';
3530
+ this.dateFormat = 'yyyy-MM-dd';
3531
+ this.locale = 'pt-BR';
3532
+ this.type = 'dropdown';
3533
+ this.disable = [];
3534
+ this.enable = [];
3535
+ this.defaultDate = [];
3536
+ this.limitRange = null;
3537
+ this.currentDate = new Date();
3538
+ this.selectedDates = [];
3539
+ this.rangeStart = null;
3540
+ this.defaultDates = [];
3541
+ this.selectMonth = '';
3542
+ this.selectYear = '';
3543
+ this.styles = {};
3544
+ }
3545
+ connectedCallback() {
3546
+ this.initializeDefaultDates();
3547
+ this.setFontProperties();
3548
+ const colors = [
3549
+ { name: '--accent-base', theme: 'accent-base' },
3550
+ { name: '--accent-light', theme: 'accent-light' },
3551
+ { name: '--neutral-black', theme: 'neutral-black' },
3552
+ { name: '--primary-darker', theme: 'primary-darker' },
3553
+ { name: '--neutral-dark', theme: 'neutral-dark' },
3554
+ { name: '--neutral-light', theme: 'neutral-light' },
3555
+ ];
3556
+ colors.forEach(color => this.styles = Object.assign(Object.assign({}, this.styles), { [color.name]: this.theme.colors.getColor(color.theme) }));
3557
+ }
3558
+ setFontProperties() {
3559
+ this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();
3560
+ this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();
3561
+ this.styles['--font-color'] = window.CuraAPI.theme.fonts.getColor();
3562
+ this.styles['--font-weight-medium'] = this.weights.medium;
3563
+ this.styles['--font-weight-bold'] = this.weights.bold;
3564
+ this.styles['--font-weight-regular'] = this.weights.regular;
3565
+ }
3566
+ /**
3567
+ * Initialize the selected dates based on defaultDate and mode.
3568
+ */
3569
+ initializeDefaultDates() {
3570
+ this.defaultDates = this.expandDateRanges(this.defaultDate);
3571
+ }
3572
+ /**
3573
+ * Get the locale for the calendar.
3574
+ *
3575
+ * @returns {Locale} The locale object.
3576
+ */
3577
+ determineLocale() {
3578
+ return this.optionsLocale[this.locale] || this.locale;
3579
+ }
3580
+ /**
3581
+ * Check if a date is within the valid period.
3582
+ *
3583
+ * @param {Date} date - The date to check.
3584
+ * @returns {boolean} Whether the date is valid.
3585
+ */
3586
+ isDateInValidPeriod(date) {
3587
+ return this.period.includes(format(date, this.dateFormat));
3588
+ }
3589
+ /**
3590
+ * Check if a date is selected.
3591
+ *
3592
+ * @param {Date} date - The date to check.
3593
+ * @returns {boolean} Whether the date is selected.
3594
+ */
3595
+ isDateSelected(date) {
3596
+ return this.isDateInList(this.selectedDates, date);
3597
+ }
3598
+ /**
3599
+ * Check if has date in defaultDates.
3600
+ *
3601
+ * @param {Date} date - The date to check.
3602
+ * @returns {boolean} Whether the date is selected.
3603
+ */
3604
+ isDateInDefaultSelection(date) {
3605
+ return this.isDateInList(this.defaultDates, date);
3606
+ }
3607
+ /**
3608
+ * Check if a date is within a disabled period.
3609
+ *
3610
+ * @param {Date} date - The date to check.
3611
+ * @returns {boolean} Whether the date is disabled.
3612
+ */
3613
+ isDateInDisabledPeriod(date) {
3614
+ return this.isDateInList(this.expandDateRanges(this.disable), date);
3615
+ }
3616
+ /**
3617
+ * Check if a date is within an enabled period.
3618
+ *
3619
+ * @param {Date} date - The date to check.
3620
+ * @returns {boolean} Whether the date is enabled.
3621
+ */
3622
+ isDateInEnabledPeriod(date) {
3623
+ if (this.enable.length === 0)
3624
+ return true;
3625
+ return this.isDateInList(this.expandDateRanges(this.enable), date);
3626
+ }
3627
+ /**
3628
+ * Checks if a date is in the provided list of dates.
3629
+ *
3630
+ * @param {Date[]} dates - The list of dates to check against.
3631
+ * @param {Date} date - The date to check.
3632
+ * @returns {boolean} Whether the date is in the list.
3633
+ */
3634
+ isDateInList(dates, date) {
3635
+ return dates.some(d => isSameDay(d, date));
3636
+ }
3637
+ /**
3638
+ * Removes a specific date from a list of dates.
3639
+ *
3640
+ * @param {Date[]} dates - The array of dates to filter.
3641
+ * @param {Date} dateToRemove - The date to remove from the array.
3642
+ * @returns {Date[]} A new array with the specified date removed.
3643
+ */
3644
+ removeDateFromSelection(dates, dateToRemove) {
3645
+ return dates.filter(d => !isSameDay(d, dateToRemove));
3646
+ }
3647
+ /**
3648
+ * Change the current month.
3649
+ *
3650
+ * @param {string} direction - 'prev' | 'next'
3651
+ */
3652
+ updateCurrentMonth(direction) {
3653
+ let newMonth = new Date(this.currentDate);
3654
+ if (direction === 'prev')
3655
+ newMonth = subMonths(this.currentDate, 1);
3656
+ if (direction === 'next')
3657
+ newMonth = addMonths(this.currentDate, 1);
3658
+ this.currentDate = newMonth;
3659
+ }
3660
+ /**
3661
+ * Handle the month dropdown change.
3662
+ *
3663
+ * @param {CustomEvent} event - The change event.
3664
+ */
3665
+ onMonthDropdownChange(event) {
3666
+ const { months } = this.fetchMonthNames();
3667
+ const newMonth = event.detail.value;
3668
+ this.selectMonth = newMonth;
3669
+ this.currentDate = new Date(getYear(this.currentDate), months.indexOf(newMonth), 1);
3670
+ }
3671
+ /**
3672
+ * Handle the year input change.
3673
+ *
3674
+ * @param {CustomEvent} event - The change event.
3675
+ */
3676
+ onYearDropdownChange(event) {
3677
+ const newYear = event.detail.value;
3678
+ this.selectYear = newYear;
3679
+ this.currentDate = new Date(newYear, getMonth(this.currentDate), 1);
3680
+ }
3681
+ /**
3682
+ * Flatten date ranges into individual dates.
3683
+ *
3684
+ * @param {({ from: string; to: string } | string)[]} dates - An array of date ranges or individual dates.
3685
+ * @returns {Date[]} An array of individual dates.
3686
+ */
3687
+ expandDateRanges(dates) {
3688
+ return dates.flatMap(date => {
3689
+ if (typeof date === 'string')
3690
+ return isValid(parseISO(date)) ? [parseISO(date)] : [];
3691
+ const start = parseISO(date.from);
3692
+ const end = parseISO(date.to);
3693
+ if (isValid(start) && isValid(end) && start <= end)
3694
+ return eachDayOfInterval({ start, end });
3695
+ return [];
3696
+ });
3697
+ }
3698
+ /**
3699
+ * Handle single date selection.
3700
+ *
3701
+ * @param {Date} date - The date to select.
3702
+ */
3703
+ selectSingleDate(date) {
3704
+ this.defaultDates = [];
3705
+ this.selectedDates = [date];
3706
+ }
3707
+ /**
3708
+ * Handle multiple date selection.
3709
+ *
3710
+ * @param {Date} date - The date to select or deselect.
3711
+ */
3712
+ selectMultiplesDate(date) {
3713
+ if (!this.isDateSelected(date) || !this.isDateInDefaultSelection(date))
3714
+ return this.selectedDates = [...this.selectedDates, date];
3715
+ this.selectedDates = this.removeDateFromSelection(this.selectedDates, date);
3716
+ this.defaultDates = this.removeDateFromSelection(this.defaultDates, date);
3717
+ }
3718
+ /**
3719
+ * Handle range date selection.
3720
+ *
3721
+ * @param {Date} date - The date to select.
3722
+ */
3723
+ selectDateRange(date) {
3724
+ this.defaultDates = [];
3725
+ const start = isBefore(this.rangeStart, date) ? this.rangeStart : date;
3726
+ const end = isAfter(this.rangeStart, date) ? this.rangeStart : date;
3727
+ const range = eachDayOfInterval({ start, end });
3728
+ if (!this.rangeStart || this.selectedDates.length === 2) {
3729
+ this.rangeStart = date;
3730
+ this.selectedDates = [date];
3731
+ return;
3732
+ }
3733
+ if (this.limitRange === null || range.length <= this.limitRange) {
3734
+ this.selectedDates = range;
3735
+ this.rangeStart = null;
3736
+ }
3737
+ }
3738
+ /**
3739
+ * Handle a click on a date.
3740
+ *
3741
+ * @param {Date} date - The date that was clicked.
3742
+ */
3743
+ onDateClick(date) {
3744
+ if (!this.isDateInValidPeriod(date) || this.isDateInDisabledPeriod(date) || !this.isDateInEnabledPeriod(date))
3745
+ return;
3746
+ const selectionHandlers = {
3747
+ single: this.selectSingleDate.bind(this),
3748
+ multiple: this.selectMultiplesDate.bind(this),
3749
+ range: this.selectDateRange.bind(this)
3750
+ };
3751
+ selectionHandlers[this.mode](date);
3752
+ this.onchangeday.emit({ days: [...this.defaultDates, ...this.selectedDates].filter(d => this.isDateInValidPeriod(d)) });
3753
+ }
3754
+ /**
3755
+ * Get the days of the week.
3756
+ *
3757
+ * @returns {string[]} An array of abbreviated day names.
3758
+ */
3759
+ fetchWeekDays() {
3760
+ const start = startOfWeek(new Date(2021, 0, 3), { locale: this.determineLocale() });
3761
+ const end = endOfWeek(new Date(2021, 0, 3), { locale: this.determineLocale() });
3762
+ return eachDayOfInterval({ start, end }).map(day => format(day, 'EEEEEE', { locale: this.determineLocale() }));
3763
+ }
3764
+ /**
3765
+ * Get the days of the current month, including leading nulls for alignment.
3766
+ *
3767
+ * @returns {(Date | null)[]} An array of dates and nulls for the current month view.
3768
+ */
3769
+ fetchDaysOfMonth() {
3770
+ const start = startOfMonth(this.currentDate);
3771
+ const end = endOfMonth(this.currentDate);
3772
+ const WEEKS_IN_CALENDAR_VIEW = 6;
3773
+ const DAYS_IN_CALENDAR_VIEW = 42;
3774
+ const daysIncurrentDate = eachDayOfInterval({ start, end });
3775
+ const prevMonthStart = startOfMonth(addMonths(start, -1));
3776
+ const prevMonthEnd = endOfMonth(prevMonthStart);
3777
+ const daysInPrevMonth = eachDayOfInterval({
3778
+ start: subDays(prevMonthEnd, getDay(start)),
3779
+ end: prevMonthEnd
3780
+ });
3781
+ const nextMonthStart = startOfMonth(addMonths(end, 1));
3782
+ const nextMonthEnd = endOfMonth(nextMonthStart);
3783
+ const remainingDays = WEEKS_IN_CALENDAR_VIEW - getDay(end);
3784
+ const daysInNextMonth = eachDayOfInterval({
3785
+ start: nextMonthStart,
3786
+ end: addDays(nextMonthEnd, remainingDays)
3787
+ });
3788
+ const totalDays = [
3789
+ ...daysInPrevMonth.slice(-getDay(start)),
3790
+ ...daysIncurrentDate,
3791
+ ...daysInNextMonth
3792
+ ];
3793
+ return totalDays.slice(0, DAYS_IN_CALENDAR_VIEW);
3794
+ }
3795
+ /**
3796
+ * Get the names of all months in the current year.
3797
+ *
3798
+ * @returns {{ months: string[], currentMonth: string }} An object containing an array of month names and the name of the current month.
3799
+ */
3800
+ fetchMonthNames() {
3801
+ const currentYear = getYear(this.currentDate);
3802
+ const locale = this.determineLocale();
3803
+ const months = eachMonthOfInterval({
3804
+ start: startOfYear(new Date(currentYear, 0, 1)),
3805
+ end: new Date(currentYear, 11, 31)
3806
+ }).map(month => format(month, 'MMMM', { locale }));
3807
+ const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
3808
+ return {
3809
+ months: months.map(capitalize),
3810
+ };
3811
+ }
3812
+ /**
3813
+ * Get a list of years in descending order from the current year to a specified limit.
3814
+ *
3815
+ * @returns {number[]} An array of years.
3816
+ */
3817
+ fetchYearList() {
3818
+ const currentYear = getYear(new Date());
3819
+ return Array.from({ length: 100 }, (_, i) => currentYear - i);
3820
+ }
3821
+ /**
3822
+ * Get the color for the previous button.
3823
+ *
3824
+ * @returns {string} The color name for the previous button.
3825
+ */
3826
+ determinePrevButtonColor() {
3827
+ const isPrevDisabled = isBefore(new Date(getYear(this.currentDate), getMonth(this.currentDate) - 1, 1), startOfMonth(new Date()));
3828
+ return isPrevDisabled ? 'neutral-light' : 'primary-base';
3829
+ }
3830
+ /**
3831
+ * Get the status of a given date, determining its position and interval status.
3832
+ *
3833
+ * @param {Date | null} date - The date to evaluate.
3834
+ * @returns {Object} An object containing the status flags for the date.
3835
+ */
3836
+ getDateStatus(date) {
3837
+ const [startSelected, endSelected] = [this.selectedDates[0], this.selectedDates[this.selectedDates.length - 1]];
3838
+ const [startDefault, endDefault] = [this.defaultDates[0], this.defaultDates[this.defaultDates.length - 1]];
3839
+ const hasSelectedDates = this.selectedDates.length > 1;
3840
+ const isDateInDefaultSelection = this.defaultDates.length > 1;
3841
+ const isStartSelected = this.isDateSelected(date) && isSameDay(date, startSelected);
3842
+ const isStartDefault = this.isDateInDefaultSelection(date) && isSameDay(date, startDefault);
3843
+ const isEndSelected = this.isDateSelected(date) && isSameDay(date, endSelected);
3844
+ const isEndDefault = this.isDateInDefaultSelection(date) && isSameDay(date, endDefault);
3845
+ const isStart = isStartSelected || isStartDefault;
3846
+ const isEnd = isEndSelected || isEndDefault;
3847
+ const selectedIntervals = this.expandDateRanges([{ from: startSelected === null || startSelected === void 0 ? void 0 : startSelected.toISOString(), to: endSelected === null || endSelected === void 0 ? void 0 : endSelected.toISOString() }]);
3848
+ const defaultIntervals = this.expandDateRanges([{ from: startDefault === null || startDefault === void 0 ? void 0 : startDefault.toISOString(), to: endDefault === null || endDefault === void 0 ? void 0 : endDefault.toISOString() }]);
3849
+ const intervalSelected = hasSelectedDates && this.isDateInList(selectedIntervals, date);
3850
+ const intervalDefault = isDateInDefaultSelection && this.isDateInList(defaultIntervals, date);
3851
+ const isValid = this.isDateInValidPeriod(date);
3852
+ const isInvalid = !isValid || this.isDateInDisabledPeriod(date) || !this.isDateInEnabledPeriod(date);
3853
+ const isSelected = this.isDateSelected(date);
3854
+ const isRange = this.mode === 'range' && (hasSelectedDates || isDateInDefaultSelection);
3855
+ const isDefault = this.mode !== 'range' && this.isDateInDefaultSelection(date);
3856
+ const isInterval = (intervalSelected || intervalDefault) && !isStart && !isEnd;
3857
+ return {
3858
+ isStart,
3859
+ isEnd,
3860
+ isValid,
3861
+ isInvalid,
3862
+ isSelected,
3863
+ isRange,
3864
+ isDefault,
3865
+ isInterval
3866
+ };
3867
+ }
3868
+ /**
3869
+ * Get the CSS classes for a given date based on its status.
3870
+ *
3871
+ * @param {Date | null} date - The date to evaluate.
3872
+ * @returns {Object} An object containing the CSS classes for the date.
3873
+ */
3874
+ getClasses(date) {
3875
+ const classes = { 'date': true };
3876
+ if (date === null)
3877
+ return classes;
3878
+ const dateStatus = this.getDateStatus(date);
3879
+ classes['today'] = isToday(date);
3880
+ classes['valid'] = dateStatus.isValid;
3881
+ classes['invalid'] = dateStatus.isInvalid;
3882
+ classes['selected'] = dateStatus.isSelected;
3883
+ classes['range'] = dateStatus.isRange;
3884
+ classes['default-dates'] = dateStatus.isDefault;
3885
+ classes['start'] = dateStatus.isStart;
3886
+ classes['interval'] = dateStatus.isInterval;
3887
+ classes['end'] = dateStatus.isEnd;
3888
+ return classes;
3889
+ }
3890
+ /**
3891
+ * Get custom CSS properties for the host element.
3892
+ *
3893
+ * @returns {Object} An object containing CSS properties and their values.
3894
+ */
3895
+ getHostCSSProperties() {
3896
+ return {
3897
+ '--width': this.width,
3898
+ };
3899
+ }
3900
+ render() {
3901
+ const { months } = this.fetchMonthNames();
3902
+ return (h(Host, { key: '7219f5c7370d5f51eaca3893ee5d9378b3bb9cf5', style: this.getHostCSSProperties() }, h("div", { key: 'c1a1a5f3af3c1f782e8db1b768e4d2c3d00e7cfe', class: "calendar", style: this.styles }, h("header", { key: 'a31b15cb3c58a952476370fe10fd546083e3de13', class: "header" }, h("div", { key: '0f4f3113996c4d43477ef9dbed3f94b54f0f1e18', class: `month-year ${this.type === 'dropdown' && 'dropdown'}` }, h("cura-icon", { key: '1aab96a34d0265cf18d54c77d0f874e11e1ebbfc', class: `icon ${this.type === 'dropdown' && 'dropdown'}`, name: "left", color: this.determinePrevButtonColor(), onClick: () => this.updateCurrentMonth('prev') }), this.type === 'dropdown' ? (h("div", { class: "select" }, h("cura-select", { class: "drop-month", mode: "transparent", value: months[getMonth(this.currentDate)], onSelected: (e) => this.onMonthDropdownChange(e) }, months.map((month, index) => (h("cura-select-option", { key: index, value: month }, month)))), h("cura-select", { class: "drop-year", mode: "transparent", value: getYear(this.currentDate).toString(), onSelected: (e) => this.onYearDropdownChange(e) }, this.fetchYearList().map((year, index) => (h("cura-select-option", { key: index, value: year.toString() }, year.toString())))))) : (h("cura-label", { color: "neutral-black", size: "large" }, months[getMonth(this.currentDate)].slice(0, 3), ", ", getYear(this.currentDate))), h("cura-icon", { key: 'bbf1cabd623f27736c1acb29479f8bd3e4d9d465', class: `icon ${this.type === 'dropdown' && 'dropdown'}`, name: "right", color: "primary-base", onClick: () => this.updateCurrentMonth('next') }))), h("span", { key: '05eb9071b488607a2e6a40b687a074150382e81e', class: "days-of-week" }, this.fetchWeekDays().map((day, index) => (h("cura-label", { class: "day", size: "xsmall", color: "neutral-black", weight: 'bold', key: index }, day === 'sab' ? 'SÁB' : day.toLocaleUpperCase())))), h("div", { key: '1a107295063579356f75ee714b712cb265e408eb', class: "dates" }, this.fetchDaysOfMonth().map((day, index) => (h("div", { key: index, class: this.getClasses(day), onClick: () => this.onDateClick(day) }, day ? format(day, 'd') : '')))))));
3903
+ }
3904
+ };
3905
+ CuraCalendar.style = CuraCalendarStyle0;
3906
+
3907
+ export { CuraCalendar as cura_calendar };
3908
+
3909
+ //# sourceMappingURL=cura-calendar.entry.js.map