karsten-design-system 1.1.59 → 1.1.61

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 (134) hide show
  1. package/README.md +208 -208
  2. package/dist/index.js +4451 -38
  3. package/dist/index.js.map +1 -1
  4. package/package.json +2 -2
  5. package/dist/.storybook/index.css.js +0 -7
  6. package/dist/.storybook/index.css.js.map +0 -1
  7. package/dist/_virtual/jsx-runtime.js +0 -6
  8. package/dist/_virtual/jsx-runtime.js.map +0 -1
  9. package/dist/_virtual/jsx-runtime2.js +0 -4
  10. package/dist/_virtual/jsx-runtime2.js.map +0 -1
  11. package/dist/_virtual/react-jsx-runtime.production.js +0 -4
  12. package/dist/_virtual/react-jsx-runtime.production.js.map +0 -1
  13. package/dist/assets/icons/error.js +0 -8
  14. package/dist/assets/icons/error.js.map +0 -1
  15. package/dist/assets/icons/filter.js +0 -8
  16. package/dist/assets/icons/filter.js.map +0 -1
  17. package/dist/assets/icons/info.js +0 -8
  18. package/dist/assets/icons/info.js.map +0 -1
  19. package/dist/assets/icons/success.js +0 -8
  20. package/dist/assets/icons/success.js.map +0 -1
  21. package/dist/assets/icons/text.js +0 -8
  22. package/dist/assets/icons/text.js.map +0 -1
  23. package/dist/assets/logoSmall.js +0 -8
  24. package/dist/assets/logoSmall.js.map +0 -1
  25. package/dist/components/floating-label/index.js +0 -14
  26. package/dist/components/floating-label/index.js.map +0 -1
  27. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +0 -11
  28. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js.map +0 -1
  29. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +0 -65
  30. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js.map +0 -1
  31. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +0 -60
  32. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js.map +0 -1
  33. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +0 -23
  34. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js.map +0 -1
  35. package/dist/node_modules/date-fns/locale/pt-BR/_lib/formatDistance.js +0 -104
  36. package/dist/node_modules/date-fns/locale/pt-BR/_lib/formatDistance.js.map +0 -1
  37. package/dist/node_modules/date-fns/locale/pt-BR/_lib/formatLong.js +0 -42
  38. package/dist/node_modules/date-fns/locale/pt-BR/_lib/formatLong.js.map +0 -1
  39. package/dist/node_modules/date-fns/locale/pt-BR/_lib/formatRelative.js +0 -25
  40. package/dist/node_modules/date-fns/locale/pt-BR/_lib/formatRelative.js.map +0 -1
  41. package/dist/node_modules/date-fns/locale/pt-BR/_lib/localize.js +0 -180
  42. package/dist/node_modules/date-fns/locale/pt-BR/_lib/localize.js.map +0 -1
  43. package/dist/node_modules/date-fns/locale/pt-BR/_lib/match.js +0 -137
  44. package/dist/node_modules/date-fns/locale/pt-BR/_lib/match.js.map +0 -1
  45. package/dist/node_modules/date-fns/locale/pt-BR.js +0 -29
  46. package/dist/node_modules/date-fns/locale/pt-BR.js.map +0 -1
  47. package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +0 -45
  48. package/dist/node_modules/react/cjs/react-jsx-runtime.production.js.map +0 -1
  49. package/dist/node_modules/react/jsx-runtime.js +0 -18
  50. package/dist/node_modules/react/jsx-runtime.js.map +0 -1
  51. package/dist/node_modules/style-inject/dist/style-inject.es.js +0 -29
  52. package/dist/node_modules/style-inject/dist/style-inject.es.js.map +0 -1
  53. package/dist/stories/components/accordion.js +0 -30
  54. package/dist/stories/components/accordion.js.map +0 -1
  55. package/dist/stories/components/autoComplete.js +0 -30
  56. package/dist/stories/components/autoComplete.js.map +0 -1
  57. package/dist/stories/components/basicHeader.js +0 -9
  58. package/dist/stories/components/basicHeader.js.map +0 -1
  59. package/dist/stories/components/breadcrumb.js +0 -10
  60. package/dist/stories/components/breadcrumb.js.map +0 -1
  61. package/dist/stories/components/button.js +0 -19
  62. package/dist/stories/components/button.js.map +0 -1
  63. package/dist/stories/components/calendarInput.js +0 -99
  64. package/dist/stories/components/calendarInput.js.map +0 -1
  65. package/dist/stories/components/card.js +0 -9
  66. package/dist/stories/components/card.js.map +0 -1
  67. package/dist/stories/components/cardButton.js +0 -11
  68. package/dist/stories/components/cardButton.js.map +0 -1
  69. package/dist/stories/components/cardIconsButton.js +0 -11
  70. package/dist/stories/components/cardIconsButton.js.map +0 -1
  71. package/dist/stories/components/chart.js +0 -9
  72. package/dist/stories/components/chart.js.map +0 -1
  73. package/dist/stories/components/dialog.js +0 -10
  74. package/dist/stories/components/dialog.js.map +0 -1
  75. package/dist/stories/components/divider.js +0 -9
  76. package/dist/stories/components/divider.js.map +0 -1
  77. package/dist/stories/components/emptyContent.js +0 -8
  78. package/dist/stories/components/emptyContent.js.map +0 -1
  79. package/dist/stories/components/expandablePanel.js +0 -10
  80. package/dist/stories/components/expandablePanel.js.map +0 -1
  81. package/dist/stories/components/fileUpload.js +0 -96
  82. package/dist/stories/components/fileUpload.js.map +0 -1
  83. package/dist/stories/components/filterButton.js +0 -33
  84. package/dist/stories/components/filterButton.js.map +0 -1
  85. package/dist/stories/components/header.js +0 -37
  86. package/dist/stories/components/header.js.map +0 -1
  87. package/dist/stories/components/iconButton.js +0 -14
  88. package/dist/stories/components/iconButton.js.map +0 -1
  89. package/dist/stories/components/infoCard.js +0 -9
  90. package/dist/stories/components/infoCard.js.map +0 -1
  91. package/dist/stories/components/input.js +0 -60
  92. package/dist/stories/components/input.js.map +0 -1
  93. package/dist/stories/components/inputSwitch.js +0 -14
  94. package/dist/stories/components/inputSwitch.js.map +0 -1
  95. package/dist/stories/components/inputTextArea.js +0 -20
  96. package/dist/stories/components/inputTextArea.js.map +0 -1
  97. package/dist/stories/components/internalMenu.js +0 -30
  98. package/dist/stories/components/internalMenu.js.map +0 -1
  99. package/dist/stories/components/link.js +0 -8
  100. package/dist/stories/components/link.js.map +0 -1
  101. package/dist/stories/components/megaMenu.js +0 -13
  102. package/dist/stories/components/megaMenu.js.map +0 -1
  103. package/dist/stories/components/modal.js +0 -38
  104. package/dist/stories/components/modal.js.map +0 -1
  105. package/dist/stories/components/multiselect.js +0 -125
  106. package/dist/stories/components/multiselect.js.map +0 -1
  107. package/dist/stories/components/notification.js +0 -16
  108. package/dist/stories/components/notification.js.map +0 -1
  109. package/dist/stories/components/notificationItem.js +0 -16
  110. package/dist/stories/components/notificationItem.js.map +0 -1
  111. package/dist/stories/components/paginator.js +0 -28
  112. package/dist/stories/components/paginator.js.map +0 -1
  113. package/dist/stories/components/radioButton.js +0 -17
  114. package/dist/stories/components/radioButton.js.map +0 -1
  115. package/dist/stories/components/select.js +0 -98
  116. package/dist/stories/components/select.js.map +0 -1
  117. package/dist/stories/components/sidebar.js +0 -17
  118. package/dist/stories/components/sidebar.js.map +0 -1
  119. package/dist/stories/components/skeleton.js +0 -9
  120. package/dist/stories/components/skeleton.js.map +0 -1
  121. package/dist/stories/components/spinner.js +0 -18
  122. package/dist/stories/components/spinner.js.map +0 -1
  123. package/dist/stories/components/table.js +0 -167
  124. package/dist/stories/components/table.js.map +0 -1
  125. package/dist/stories/components/tagStatus.js +0 -33
  126. package/dist/stories/components/tagStatus.js.map +0 -1
  127. package/dist/stories/components/toast.js +0 -18
  128. package/dist/stories/components/toast.js.map +0 -1
  129. package/dist/utils/masks/index.js +0 -90
  130. package/dist/utils/masks/index.js.map +0 -1
  131. package/dist/utils/nestedValue.js +0 -9
  132. package/dist/utils/nestedValue.js.map +0 -1
  133. package/dist/utils/sortData.js +0 -48
  134. package/dist/utils/sortData.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,39 +1,4452 @@
1
- import './.storybook/index.css.js';
2
- export { Accordion } from './stories/components/accordion.js';
3
- export { AutoComplete } from './stories/components/autoComplete.js';
4
- export { BasicHeader } from './stories/components/basicHeader.js';
5
- export { Breadcrumb } from './stories/components/breadcrumb.js';
6
- export { Button } from './stories/components/button.js';
7
- export { CalendarInput } from './stories/components/calendarInput.js';
8
- export { Card } from './stories/components/card.js';
9
- export { CardButton } from './stories/components/cardButton.js';
10
- export { CardIconsButton } from './stories/components/cardIconsButton.js';
11
- export { Chart } from './stories/components/chart.js';
12
- export { Dialog } from './stories/components/dialog.js';
13
- export { Divider } from './stories/components/divider.js';
14
- export { EmptyContent } from './stories/components/emptyContent.js';
15
- export { ExpandablePanel } from './stories/components/expandablePanel.js';
16
- export { FileUpload } from './stories/components/fileUpload.js';
17
- export { FilterButton } from './stories/components/filterButton.js';
18
- export { Header } from './stories/components/header.js';
19
- export { IconButton } from './stories/components/iconButton.js';
20
- export { InfoCard } from './stories/components/infoCard.js';
21
- export { Input } from './stories/components/input.js';
22
- export { InputSwitch } from './stories/components/inputSwitch.js';
23
- export { InputTextArea } from './stories/components/inputTextArea.js';
24
- export { InternalMenu } from './stories/components/internalMenu.js';
25
- export { Link } from './stories/components/link.js';
26
- export { MegaMenu } from './stories/components/megaMenu.js';
27
- export { Modal } from './stories/components/modal.js';
28
- export { MultiSelect } from './stories/components/multiselect.js';
29
- export { Notification } from './stories/components/notification.js';
30
- export { Paginator } from './stories/components/paginator.js';
31
- export { RadioButton } from './stories/components/radioButton.js';
32
- export { Select } from './stories/components/select.js';
33
- export { Sidebar } from './stories/components/sidebar.js';
34
- export { Skeleton } from './stories/components/skeleton.js';
35
- export { Spinner } from './stories/components/spinner.js';
36
- export { Table } from './stories/components/table.js';
37
- export { TagStatus } from './stories/components/tagStatus.js';
38
- export { Toast } from './stories/components/toast.js';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
3
+ import React, { useState, useEffect, useId, useRef } from 'react';
4
+ import { IconField } from 'primereact/iconfield';
5
+ import { InputIcon } from 'primereact/inputicon';
6
+ import { InputText } from 'primereact/inputtext';
7
+ import { Link as Link$1 } from 'react-router-dom';
8
+ import { Button as Button$1 } from 'primereact/button';
9
+ import { addLocale } from 'primereact/api';
10
+ import { Calendar } from 'primereact/calendar';
11
+ import { Chart as Chart$1 } from 'primereact/chart';
12
+ import { Divider as Divider$1 } from 'primereact/divider';
13
+ import { InputSwitch as InputSwitch$1 } from 'primereact/inputswitch';
14
+ import { InputTextarea } from 'primereact/inputtextarea';
15
+ import { Sidebar as Sidebar$1 } from 'primereact/sidebar';
16
+ import { Paginator as Paginator$1 } from 'primereact/paginator';
17
+ import { classNames } from 'primereact/utils';
18
+ import { Skeleton as Skeleton$1 } from 'primereact/skeleton';
19
+
20
+ function styleInject(css, ref) {
21
+ if ( ref === void 0 ) ref = {};
22
+ var insertAt = ref.insertAt;
23
+
24
+ if (typeof document === 'undefined') { return; }
25
+
26
+ var head = document.head || document.getElementsByTagName('head')[0];
27
+ var style = document.createElement('style');
28
+ style.type = 'text/css';
29
+
30
+ if (insertAt === 'top') {
31
+ if (head.firstChild) {
32
+ head.insertBefore(style, head.firstChild);
33
+ } else {
34
+ head.appendChild(style);
35
+ }
36
+ } else {
37
+ head.appendChild(style);
38
+ }
39
+
40
+ if (style.styleSheet) {
41
+ style.styleSheet.cssText = css;
42
+ } else {
43
+ style.appendChild(document.createTextNode(css));
44
+ }
45
+ }
46
+
47
+ var css_248z = "@layer tailwind-base, primereact, tailwind-utilities;@import \"primereact/resources/themes/lara-light-blue/theme.css\";@import \"primeicons/primeicons.css\";@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap\");@layer tailwind-base{*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }\n /*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid;box-sizing:border-box}:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}*{font-family:Roboto,sans-serif}}@layer tailwind-utilities{.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.p-calendar.p-invalid input::-moz-placeholder{color:#ec4a54!important}.p-calendar.p-invalid input::placeholder{color:#ec4a54!important}.p-calendar.p-custom input::-moz-placeholder{color:#a0a4b3!important}.p-calendar.p-custom input::placeholder{color:#a0a4b3!important}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.-bottom-1{bottom:-.25rem}.-top-3{top:-.75rem}.bottom-0{bottom:0}.left-4{left:1rem}.right-1{right:.25rem}.right-3{right:.75rem}.right-5{right:1.25rem}.top-1{top:.25rem}.top-1\\/2{top:50%}.top-5{top:1.25rem}.top-\\[9px\\]{top:9px}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\\[999\\]{z-index:999}.z-\\[9\\]{z-index:9}.m-0{margin:0}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.line-clamp-3{-webkit-box-orient:vertical;-webkit-line-clamp:3;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1/1}.\\!h-8{height:2rem!important}.h-2{height:.5rem}.h-4{height:1rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\\[160px\\]{height:160px}.h-\\[400px\\]{height:400px}.h-\\[calc\\(100vh_-114\\.8px\\)\\]{height:calc(100vh - 114.8px)}.h-\\[calc\\(100vh_-_125px\\)\\]{height:calc(100vh - 125px)}.h-\\[calc\\(100vh_-_64px\\)\\]{height:calc(100vh - 64px)}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:12rem}.max-h-60{max-height:15rem}.max-h-\\[70vh\\]{max-height:70vh}.min-h-16{min-height:4rem}.min-h-\\[60px\\]{min-height:60px}.\\!w-8{width:2rem!important}.w-1\\/2{width:50%}.w-1\\/3{width:33.333333%}.w-10\\/12{width:83.333333%}.w-100{width:100%}.w-2{width:.5rem}.w-2\\/3{width:66.666667%}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-96{width:24rem}.w-\\[240px\\]{width:240px}.w-\\[276px\\]{width:276px}.w-\\[40rem\\]{width:40rem}.w-\\[40vw\\]{width:40vw}.w-\\[60vw\\]{width:60vw}.w-\\[90\\%\\]{width:90%}.w-\\[900px\\]{width:900px}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-screen{width:100vw}.min-w-0{min-width:0}.min-w-6{min-width:1.5rem}.min-w-7{min-width:1.75rem}.min-w-72{min-width:18rem}.min-w-\\[305px\\]{min-width:305px}.min-w-full{min-width:100%}.max-w-\\[calc\\(100\\%-20px\\)\\]{max-width:calc(100% - 20px)}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.-translate-y-1\\/2{--tw-translate-y:-50%}.-translate-y-1\\/2,.translate-y-full{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-full{--tw-translate-y:100%}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-auto{cursor:auto}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-6{row-gap:1.5rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.\\!rounded-full{border-radius:9999px!important}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-l-full{border-bottom-left-radius:9999px;border-top-left-radius:9999px}.rounded-r-full{border-bottom-right-radius:9999px;border-top-right-radius:9999px}.rounded-r-lg{border-bottom-right-radius:.5rem;border-top-right-radius:.5rem}.rounded-se-lg{border-start-end-radius:.5rem}.border{border-width:1px}.border-0{border-width:0}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l-0{border-left-width:0}.border-l-4{border-left-width:4px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-\\[\\#13294B\\]{--tw-border-opacity:1;border-color:rgb(19 41 75/var(--tw-border-opacity,1))}.border-\\[\\#1565C0\\]{--tw-border-opacity:1;border-color:rgb(21 101 192/var(--tw-border-opacity,1))}.border-\\[\\#2E7D32\\]{--tw-border-opacity:1;border-color:rgb(46 125 50/var(--tw-border-opacity,1))}.border-\\[\\#5EEAD4\\]{--tw-border-opacity:1;border-color:rgb(94 234 212/var(--tw-border-opacity,1))}.border-\\[\\#67E8F9\\]{--tw-border-opacity:1;border-color:rgb(103 232 249/var(--tw-border-opacity,1))}.border-\\[\\#6EE7B7\\]{--tw-border-opacity:1;border-color:rgb(110 231 183/var(--tw-border-opacity,1))}.border-\\[\\#7DD3FC\\]{--tw-border-opacity:1;border-color:rgb(125 211 252/var(--tw-border-opacity,1))}.border-\\[\\#A5B4FC\\]{--tw-border-opacity:1;border-color:rgb(165 180 252/var(--tw-border-opacity,1))}.border-\\[\\#BEF264\\]{--tw-border-opacity:1;border-color:rgb(190 242 100/var(--tw-border-opacity,1))}.border-\\[\\#BFDBFE\\]{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.border-\\[\\#C4B5FD\\]{--tw-border-opacity:1;border-color:rgb(196 181 253/var(--tw-border-opacity,1))}.border-\\[\\#C62828\\]{--tw-border-opacity:1;border-color:rgb(198 40 40/var(--tw-border-opacity,1))}.border-\\[\\#CBD5E1\\]{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity,1))}.border-\\[\\#D1D5DB\\]{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.border-\\[\\#D4D4D4\\]{--tw-border-opacity:1;border-color:rgb(212 212 212/var(--tw-border-opacity,1))}.border-\\[\\#D4D4D8\\]{--tw-border-opacity:1;border-color:rgb(212 212 216/var(--tw-border-opacity,1))}.border-\\[\\#D6D3D1\\]{--tw-border-opacity:1;border-color:rgb(214 211 209/var(--tw-border-opacity,1))}.border-\\[\\#F0ABFC\\]{--tw-border-opacity:1;border-color:rgb(240 171 252/var(--tw-border-opacity,1))}.border-\\[\\#F1F1F4\\]{--tw-border-opacity:1;border-color:rgb(241 241 244/var(--tw-border-opacity,1))}.border-\\[\\#F9A8D4\\]{--tw-border-opacity:1;border-color:rgb(249 168 212/var(--tw-border-opacity,1))}.border-\\[\\#FCA5A5\\]{--tw-border-opacity:1;border-color:rgb(252 165 165/var(--tw-border-opacity,1))}.border-\\[\\#FCD34D\\]{--tw-border-opacity:1;border-color:rgb(252 211 77/var(--tw-border-opacity,1))}.border-\\[\\#FDA4AF\\]{--tw-border-opacity:1;border-color:rgb(253 164 175/var(--tw-border-opacity,1))}.border-\\[\\#FDBA74\\]{--tw-border-opacity:1;border-color:rgb(253 186 116/var(--tw-border-opacity,1))}.border-\\[\\#e6e6e6\\]{--tw-border-opacity:1;border-color:rgb(230 230 230/var(--tw-border-opacity,1))}.border-\\[\\#f3f4f6\\]{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity,1))}.border-background{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity,1))}.border-gray{--tw-border-opacity:1;border-color:rgb(160 164 179/var(--tw-border-opacity,1))}.border-gray50{--tw-border-opacity:1;border-color:rgb(224 224 224/var(--tw-border-opacity,1))}.border-grayDark{--tw-border-opacity:1;border-color:rgb(100 105 129/var(--tw-border-opacity,1))}.border-primary{--tw-border-opacity:1;border-color:rgb(19 41 75/var(--tw-border-opacity,1))}.border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.border-redError{--tw-border-opacity:1;border-color:rgb(236 74 84/var(--tw-border-opacity,1))}.border-secondary{--tw-border-opacity:1;border-color:rgb(232 236 249/var(--tw-border-opacity,1))}.border-secondaryActive{--tw-border-opacity:1;border-color:rgb(164 180 232/var(--tw-border-opacity,1))}.border-stone{--tw-border-opacity:1;border-color:rgb(230 230 230/var(--tw-border-opacity,1))}.border-stoneDark{--tw-border-opacity:1;border-color:rgb(194 194 194/var(--tw-border-opacity,1))}.border-stoneLight{--tw-border-opacity:1;border-color:rgb(241 241 244/var(--tw-border-opacity,1))}.border-b-primary{--tw-border-opacity:1;border-bottom-color:rgb(19 41 75/var(--tw-border-opacity,1))}.border-b-stone{--tw-border-opacity:1;border-bottom-color:rgb(230 230 230/var(--tw-border-opacity,1))}.border-t-transparent{border-top-color:transparent}.bg-\\[\\#1d6ee731\\]{background-color:#1d6ee731}.bg-\\[\\#CCFBF1\\]{--tw-bg-opacity:1;background-color:rgb(204 251 241/var(--tw-bg-opacity,1))}.bg-\\[\\#CFFAFE\\]{--tw-bg-opacity:1;background-color:rgb(207 250 254/var(--tw-bg-opacity,1))}.bg-\\[\\#D1FAE5\\]{--tw-bg-opacity:1;background-color:rgb(209 250 229/var(--tw-bg-opacity,1))}.bg-\\[\\#DBEAFE\\]{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.bg-\\[\\#E0E7FF\\]{--tw-bg-opacity:1;background-color:rgb(224 231 255/var(--tw-bg-opacity,1))}.bg-\\[\\#E0F2FE\\]{--tw-bg-opacity:1;background-color:rgb(224 242 254/var(--tw-bg-opacity,1))}.bg-\\[\\#E3F2FD\\]{--tw-bg-opacity:1;background-color:rgb(227 242 253/var(--tw-bg-opacity,1))}.bg-\\[\\#E6F4EA\\]{--tw-bg-opacity:1;background-color:rgb(230 244 234/var(--tw-bg-opacity,1))}.bg-\\[\\#E7E5E4\\]{--tw-bg-opacity:1;background-color:rgb(231 229 228/var(--tw-bg-opacity,1))}.bg-\\[\\#ECFCCB\\]{--tw-bg-opacity:1;background-color:rgb(236 252 203/var(--tw-bg-opacity,1))}.bg-\\[\\#EDE9FE\\]{--tw-bg-opacity:1;background-color:rgb(237 233 254/var(--tw-bg-opacity,1))}.bg-\\[\\#F1F5F9\\]{--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity,1))}.bg-\\[\\#F3F4F6\\]{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-\\[\\#F4F4F5\\]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.bg-\\[\\#F5F5F5\\]{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.bg-\\[\\#FAE8FF\\]{--tw-bg-opacity:1;background-color:rgb(250 232 255/var(--tw-bg-opacity,1))}.bg-\\[\\#FCE7F3\\]{--tw-bg-opacity:1;background-color:rgb(252 231 243/var(--tw-bg-opacity,1))}.bg-\\[\\#FEE2E2\\]{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.bg-\\[\\#FEF3C7\\]{--tw-bg-opacity:1;background-color:rgb(254 243 199/var(--tw-bg-opacity,1))}.bg-\\[\\#FEF9C3\\]{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.bg-\\[\\#FFE4E6\\]{--tw-bg-opacity:1;background-color:rgb(255 228 230/var(--tw-bg-opacity,1))}.bg-\\[\\#FFEBEE\\]{--tw-bg-opacity:1;background-color:rgb(255 235 238/var(--tw-bg-opacity,1))}.bg-\\[\\#FFEDD5\\]{--tw-bg-opacity:1;background-color:rgb(255 237 213/var(--tw-bg-opacity,1))}.bg-\\[\\#e6e6e6\\]{--tw-bg-opacity:1;background-color:rgb(230 230 230/var(--tw-bg-opacity,1))}.bg-background{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-backgroundDark\\/20{background-color:rgba(66,66,66,.2)}.bg-black{background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black,.bg-blue{--tw-bg-opacity:1}.bg-blue{background-color:rgb(0 69 186/var(--tw-bg-opacity,1))}.bg-gray{background-color:rgb(160 164 179/var(--tw-bg-opacity,1))}.bg-gray,.bg-green{--tw-bg-opacity:1}.bg-green{background-color:rgb(10 168 54/var(--tw-bg-opacity,1))}.bg-greenBackground{background-color:#0aa83612}.bg-primary{--tw-bg-opacity:1;background-color:rgb(19 41 75/var(--tw-bg-opacity,1))}.bg-primary\\/5{background-color:rgba(19,41,75,.05)}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.bg-redErrorOpacity{background-color:#a80a0a14}.bg-secondary{--tw-bg-opacity:1;background-color:rgb(232 236 249/var(--tw-bg-opacity,1))}.bg-stone{--tw-bg-opacity:1;background-color:rgb(230 230 230/var(--tw-bg-opacity,1))}.bg-stoneBackground{--tw-bg-opacity:1;background-color:rgb(250 250 251/var(--tw-bg-opacity,1))}.bg-stoneLight{--tw-bg-opacity:1;background-color:rgb(241 241 244/var(--tw-bg-opacity,1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-opacity-50{--tw-bg-opacity:0.5}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-\\[\\#13294B\\]{--tw-gradient-from:#13294b var(--tw-gradient-from-position);--tw-gradient-to:rgba(19,41,75,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-\\[\\#FAFAFB\\]{--tw-gradient-from:#fafafb var(--tw-gradient-from-position);--tw-gradient-to:rgba(250,250,251,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-\\[\\#FFFFFF\\]{--tw-gradient-from:#fff var(--tw-gradient-from-position);--tw-gradient-to:hsla(0,0%,100%,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.from-\\[\\#f3f4f6\\]{--tw-gradient-from:#f3f4f6 var(--tw-gradient-from-position);--tw-gradient-to:rgba(243,244,246,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),var(--tw-gradient-to)}.via-\\[\\#FAFAFB\\]{--tw-gradient-to:rgba(250,250,251,0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from),#fafafb var(--tw-gradient-via-position),var(--tw-gradient-to)}.to-\\[\\#0C1C34\\]{--tw-gradient-to:#0c1c34 var(--tw-gradient-to-position)}.to-\\[\\#FAFAFB\\]{--tw-gradient-to:#fafafb var(--tw-gradient-to-position)}.to-\\[\\#FFFFFF\\],.to-white{--tw-gradient-to:#fff var(--tw-gradient-to-position)}.object-cover{-o-object-fit:cover;object-fit:cover}.\\!p-2{padding:.5rem!important}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\\[2px\\]{padding:2px}.\\!py-2{padding-bottom:.5rem!important;padding-top:.5rem!important}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-2\\.5{padding-bottom:.625rem;padding-top:.625rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.py-4{padding-top:1rem}.pb-4,.py-4{padding-bottom:1rem}.pb-6{padding-bottom:1.5rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pr-4{padding-right:1rem}.pt-1\\.5{padding-top:.375rem}.pt-10{padding-top:2.5rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-justify{text-align:justify}.font-roboto{font-family:Roboto,sans-serif}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\\[18px\\]{font-size:18px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.\\!font-bold{font-weight:700!important}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.normal-case{text-transform:none}.\\!text-background{--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity,1))!important}.\\!text-backgroundDark{--tw-text-opacity:1!important;color:rgb(66 66 66/var(--tw-text-opacity,1))!important}.\\!text-gray100{color:rgb(102 102 102/var(--tw-text-opacity,1))!important}.\\!text-gray100,.\\!text-grayDark{--tw-text-opacity:1!important}.\\!text-grayDark{color:rgb(100 105 129/var(--tw-text-opacity,1))!important}.\\!text-green{color:rgb(10 168 54/var(--tw-text-opacity,1))!important}.\\!text-green,.\\!text-primary{--tw-text-opacity:1!important}.\\!text-primary{color:rgb(19 41 75/var(--tw-text-opacity,1))!important}.\\!text-white{--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity,1))!important}.text-\\[\\#0369A1\\]{--tw-text-opacity:1;color:rgb(3 105 161/var(--tw-text-opacity,1))}.text-\\[\\#065F46\\]{--tw-text-opacity:1;color:rgb(6 95 70/var(--tw-text-opacity,1))}.text-\\[\\#0D47A1\\]{--tw-text-opacity:1;color:rgb(13 71 161/var(--tw-text-opacity,1))}.text-\\[\\#13294B\\]{--tw-text-opacity:1;color:rgb(19 41 75/var(--tw-text-opacity,1))}.text-\\[\\#134E4A\\]{--tw-text-opacity:1;color:rgb(19 78 74/var(--tw-text-opacity,1))}.text-\\[\\#155E75\\]{--tw-text-opacity:1;color:rgb(21 94 117/var(--tw-text-opacity,1))}.text-\\[\\#1B5E20\\]{--tw-text-opacity:1;color:rgb(27 94 32/var(--tw-text-opacity,1))}.text-\\[\\#1E40AF\\]{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.text-\\[\\#334155\\]{--tw-text-opacity:1;color:rgb(51 65 85/var(--tw-text-opacity,1))}.text-\\[\\#365314\\]{--tw-text-opacity:1;color:rgb(54 83 20/var(--tw-text-opacity,1))}.text-\\[\\#3730A3\\]{--tw-text-opacity:1;color:rgb(55 48 163/var(--tw-text-opacity,1))}.text-\\[\\#374151\\]{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.text-\\[\\#3F3F46\\]{--tw-text-opacity:1;color:rgb(63 63 70/var(--tw-text-opacity,1))}.text-\\[\\#404040\\]{--tw-text-opacity:1;color:rgb(64 64 64/var(--tw-text-opacity,1))}.text-\\[\\#44403C\\]{--tw-text-opacity:1;color:rgb(68 64 60/var(--tw-text-opacity,1))}.text-\\[\\#646981\\]{--tw-text-opacity:1;color:rgb(100 105 129/var(--tw-text-opacity,1))}.text-\\[\\#6B21A8\\]{--tw-text-opacity:1;color:rgb(107 33 168/var(--tw-text-opacity,1))}.text-\\[\\#6D28D9\\]{--tw-text-opacity:1;color:rgb(109 40 217/var(--tw-text-opacity,1))}.text-\\[\\#878787\\]{--tw-text-opacity:1;color:rgb(135 135 135/var(--tw-text-opacity,1))}.text-\\[\\#92400E\\]{--tw-text-opacity:1;color:rgb(146 64 14/var(--tw-text-opacity,1))}.text-\\[\\#991B1B\\]{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.text-\\[\\#9A3412\\]{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.text-\\[\\#9D174D\\]{--tw-text-opacity:1;color:rgb(157 23 77/var(--tw-text-opacity,1))}.text-\\[\\#A21CAF\\]{--tw-text-opacity:1;color:rgb(162 28 175/var(--tw-text-opacity,1))}.text-\\[\\#B71C1C\\]{--tw-text-opacity:1;color:rgb(183 28 28/var(--tw-text-opacity,1))}.text-\\[\\#BE123C\\]{--tw-text-opacity:1;color:rgb(190 18 60/var(--tw-text-opacity,1))}.text-\\[\\#a0a4b3\\]{--tw-text-opacity:1;color:rgb(160 164 179/var(--tw-text-opacity,1))}.text-background{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-backgroundDark{--tw-text-opacity:1;color:rgb(66 66 66/var(--tw-text-opacity,1))}.text-gray{--tw-text-opacity:1;color:rgb(160 164 179/var(--tw-text-opacity,1))}.text-grayDark{--tw-text-opacity:1;color:rgb(100 105 129/var(--tw-text-opacity,1))}.text-green{--tw-text-opacity:1;color:rgb(10 168 54/var(--tw-text-opacity,1))}.text-primary{--tw-text-opacity:1;color:rgb(19 41 75/var(--tw-text-opacity,1))}.text-redError{--tw-text-opacity:1;color:rgb(236 74 84/var(--tw-text-opacity,1))}.text-stone{--tw-text-opacity:1;color:rgb(230 230 230/var(--tw-text-opacity,1))}.text-stoneDark{--tw-text-opacity:1;color:rgb(194 194 194/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.opacity-50{opacity:.5}.\\!shadow-none{--tw-shadow:0 0 #0000!important;--tw-shadow-colored:0 0 #0000!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-\\[0_4px_12px_rgba\\(0\\2c 0\\2c 0\\2c 0\\.50\\)\\]{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-\\[0_4px_12px_rgba\\(0\\2c 0\\2c 0\\2c 0\\.50\\)\\]{--tw-shadow:0 4px 12px rgba(0,0,0,.5);--tw-shadow-colored:0 4px 12px var(--tw-shadow-color)}.shadow-container{--tw-shadow:0px 0px 5px 3px rgba(0,0,0,.1);--tw-shadow-colored:0px 0px 5px 3px var(--tw-shadow-color)}.shadow-container,.shadow-header{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-header{--tw-shadow:0px 0px 20px 0px hsla(0,0%,54%,.3);--tw-shadow-colored:0px 0px 20px 0px var(--tw-shadow-color)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-md,.shadow-none{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}.outline{outline-style:solid}.ring{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.ring,.ring-1{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.ring-gray{--tw-ring-opacity:1;--tw-ring-color:rgb(160 164 179/var(--tw-ring-opacity,1))}.ring-redError{--tw-ring-opacity:1;--tw-ring-color:rgb(236 74 84/var(--tw-ring-opacity,1))}.ring-stone{--tw-ring-opacity:1;--tw-ring-color:rgb(230 230 230/var(--tw-ring-opacity,1))}.ring-offset-2{--tw-ring-offset-width:2px}.ring-offset-background{--tw-ring-offset-color:#fff}.ring-offset-secondary{--tw-ring-offset-color:#e8ecf9}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-shadow{transition-duration:.15s;transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}}.placeholder\\:\\!text-redError::-moz-placeholder{--tw-text-opacity:1!important;color:rgb(236 74 84/var(--tw-text-opacity,1))!important}.placeholder\\:\\!text-redError::placeholder{--tw-text-opacity:1!important;color:rgb(236 74 84/var(--tw-text-opacity,1))!important}.placeholder\\:text-gray::-moz-placeholder{--tw-text-opacity:1;color:rgb(160 164 179/var(--tw-text-opacity,1))}.placeholder\\:text-gray::placeholder{--tw-text-opacity:1;color:rgb(160 164 179/var(--tw-text-opacity,1))}.placeholder\\:text-redError::-moz-placeholder{--tw-text-opacity:1;color:rgb(236 74 84/var(--tw-text-opacity,1))}.placeholder\\:text-redError::placeholder{--tw-text-opacity:1;color:rgb(236 74 84/var(--tw-text-opacity,1))}.first\\:rounded-ss-lg:first-child{border-start-start-radius:.5rem}.checked\\:bg-primary:checked{--tw-bg-opacity:1;background-color:rgb(19 41 75/var(--tw-bg-opacity,1))}.hover\\:border-grayDark:hover{--tw-border-opacity:1;border-color:rgb(100 105 129/var(--tw-border-opacity,1))}.hover\\:border-primary:hover{--tw-border-opacity:1;border-color:rgb(19 41 75/var(--tw-border-opacity,1))}.hover\\:border-primary\\/50:hover{border-color:rgba(19,41,75,.5)}.hover\\:border-red-500:hover{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.hover\\:border-stone:hover{--tw-border-opacity:1;border-color:rgb(230 230 230/var(--tw-border-opacity,1))}.hover\\:bg-grayDark:hover{--tw-bg-opacity:1;background-color:rgb(100 105 129/var(--tw-bg-opacity,1))}.hover\\:bg-greenBackgroundActive:hover{background-color:#0aa83633}.hover\\:bg-primaryActive:hover{--tw-bg-opacity:1;background-color:rgb(12 28 52/var(--tw-bg-opacity,1))}.hover\\:bg-secondary:hover{--tw-bg-opacity:1;background-color:rgb(232 236 249/var(--tw-bg-opacity,1))}.hover\\:bg-secondaryActive:hover{--tw-bg-opacity:1;background-color:rgb(164 180 232/var(--tw-bg-opacity,1))}.hover\\:bg-stone:hover{--tw-bg-opacity:1;background-color:rgb(230 230 230/var(--tw-bg-opacity,1))}.hover\\:bg-stoneBackground:hover{--tw-bg-opacity:1;background-color:rgb(250 250 251/var(--tw-bg-opacity,1))}.hover\\:font-bold:hover{font-weight:700}.hover\\:text-backgroundDark:hover{--tw-text-opacity:1;color:rgb(66 66 66/var(--tw-text-opacity,1))}.hover\\:text-primary:hover{--tw-text-opacity:1;color:rgb(19 41 75/var(--tw-text-opacity,1))}.hover\\:text-slate-200:hover{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.focus\\:border-primary:focus{--tw-border-opacity:1;border-color:rgb(19 41 75/var(--tw-border-opacity,1))}.focus\\:shadow-md:focus{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.focus\\:shadow-md:focus,.focus\\:shadow-none:focus{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.focus\\:shadow-none:focus{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}.disabled\\:border-stone:disabled{--tw-border-opacity:1;border-color:rgb(230 230 230/var(--tw-border-opacity,1))}.disabled\\:border-stoneDark:disabled{--tw-border-opacity:1;border-color:rgb(194 194 194/var(--tw-border-opacity,1))}.disabled\\:bg-stone:disabled{--tw-bg-opacity:1;background-color:rgb(230 230 230/var(--tw-bg-opacity,1))}.disabled\\:bg-stoneDark:disabled{--tw-bg-opacity:1;background-color:rgb(194 194 194/var(--tw-bg-opacity,1))}.disabled\\:text-background:disabled{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.disabled\\:text-stoneDark:disabled{--tw-text-opacity:1;color:rgb(194 194 194/var(--tw-text-opacity,1))}.group:hover .group-hover\\:scale-105{--tw-scale-x:1.05;--tw-scale-y:1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width:640px){.sm\\:w-auto{width:auto}.sm\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\\:flex-row{flex-direction:row}.sm\\:justify-end{justify-content:flex-end}}@media (min-width:768px){.md\\:w-1\\/2{width:50%}.md\\:min-w-\\[110px\\]{min-width:110px}.md\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width:1024px){.lg\\:w-1\\/3{width:33.333333%}.lg\\:min-w-\\[110px\\]{min-width:110px}.lg\\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}.\\[\\&\\:\\:-webkit-scrollbar-thumb\\]\\:rounded-md::-webkit-scrollbar-thumb{border-radius:.375rem}.\\[\\&\\:\\:-webkit-scrollbar-thumb\\]\\:bg-stoneDark::-webkit-scrollbar-thumb{--tw-bg-opacity:1;background-color:rgb(194 194 194/var(--tw-bg-opacity,1))}.\\[\\&\\:\\:-webkit-scrollbar-track\\]\\:rounded-r-md::-webkit-scrollbar-track{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}.\\[\\&\\:\\:-webkit-scrollbar-track\\]\\:bg-stone::-webkit-scrollbar-track{--tw-bg-opacity:1;background-color:rgb(230 230 230/var(--tw-bg-opacity,1))}.\\[\\&\\:\\:-webkit-scrollbar\\]\\:w-1::-webkit-scrollbar{width:.25rem}";
48
+ styleInject(css_248z,{"insertAt":"top"});
49
+
50
+ function Accordion({ tabsChildren, headers, multiple = false, activeIndex, className, onClickFavorite, showFavorite = false, }) {
51
+ const [openIndexes, setOpenIndexes] = useState(activeIndex
52
+ ? Array.isArray(activeIndex)
53
+ ? activeIndex
54
+ : [activeIndex]
55
+ : []);
56
+ const toggleTab = (index) => {
57
+ if (multiple) {
58
+ setOpenIndexes((prev) => prev.includes(index)
59
+ ? prev.filter((i) => i !== index)
60
+ : [...prev, index]);
61
+ }
62
+ else {
63
+ setOpenIndexes((prev) => (prev.includes(index) ? [] : [index]));
64
+ }
65
+ };
66
+ return (jsx("div", { className: clsx('w-full flex flex-col text-primary', className), children: tabsChildren.map((tab, index) => (jsxs("div", { className: "w-full", children: [jsx("div", { className: "flex items-center justify-between w-full border-b border-b-primary bg-background", children: jsxs("button", { onClick: () => toggleTab(index), className: "flex items-center justify-between w-full px-4 py-2", "aria-label": "Abrir aba de menus", children: [jsxs("div", { className: "flex items-center gap-3", children: [showFavorite && (jsx("i", { className: clsx('text-primary cursor-pointer text-lg', headers[index]?.isFavorite
67
+ ? 'pi pi-star-fill text-primary'
68
+ : 'pi pi-star'), onClick: (e) => {
69
+ e.stopPropagation();
70
+ onClickFavorite?.(index);
71
+ } })), jsx("span", { className: "text-left text-primary text-base font-bold font-roboto", children: headers[index].label })] }), jsx("i", { className: clsx('pi', openIndexes.includes(index) ? 'pi-angle-up' : 'pi-angle-down', 'text-primary ml-4') })] }) }), openIndexes.includes(index) && jsx("div", { className: "py-4", children: tab })] }, index))) }));
72
+ }
73
+
74
+ const FloatingLabel = ({ value, label, disabled, error, }) => {
75
+ const [isFloating, setIsFloating] = useState(!!value);
76
+ useEffect(() => {
77
+ setIsFloating(!!value);
78
+ }, [value]);
79
+ return (jsx("label", { className: clsx('absolute left-4 text-gray transition-all bg-background px-1 z-20 font-roboto text-sm', isFloating ? '-top-3 text-primary' : 'top-[9px]', disabled ? 'text-stoneDark' : error ? 'text-redError' : 'text-gray'), children: isFloating ? label : value }));
80
+ };
81
+
82
+ const maskCPF = (value) => {
83
+ value = value.replace(/\D/g, '');
84
+ value = value.slice(0, 11);
85
+ if (value.length <= 3) {
86
+ return value;
87
+ }
88
+ if (value.length <= 6) {
89
+ return value.replace(/(\d{3})(\d{1,})/, '$1.$2');
90
+ }
91
+ if (value.length <= 9) {
92
+ return value.replace(/(\d{3})(\d{3})(\d{1,})/, '$1.$2.$3');
93
+ }
94
+ return value.replace(/(\d{3})(\d{3})(\d{3})(\d{1,})/, '$1.$2.$3-$4');
95
+ };
96
+ const maskCNPJ = (value) => {
97
+ value = value.replace(/\D/g, '');
98
+ value = value.slice(0, 14);
99
+ if (value.length <= 2) {
100
+ return value;
101
+ }
102
+ if (value.length <= 5) {
103
+ return value.replace(/(\d{2})(\d{1,})/, '$1.$2');
104
+ }
105
+ if (value.length <= 8) {
106
+ return value.replace(/(\d{2})(\d{3})(\d{1,})/, '$1.$2.$3');
107
+ }
108
+ if (value.length <= 12) {
109
+ return value.replace(/(\d{2})(\d{3})(\d{3})(\d{1,})/, '$1.$2.$3/$4');
110
+ }
111
+ return value.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{1,})/, '$1.$2.$3/$4-$5');
112
+ };
113
+ // export const maskNumber = (value: string) => {
114
+ // value = value.replace(/\D/g, '');
115
+ // value = value.slice(0, 12);
116
+ // return value.replace(/(\d)(\d{2})$/, '$1,$2');
117
+ // };
118
+ const maskOnlyNumbers = (value) => {
119
+ value = value.replace(/\D/g, '');
120
+ value = value.slice(0, 15);
121
+ return value;
122
+ };
123
+ const maskNumberWithDecimal = (value) => {
124
+ const regex = /^[0-9]+([.,][0-9]+)?$/;
125
+ value = value.slice(0, 20);
126
+ if (!regex.test(value)) {
127
+ return value.replace(/[^0-9.,]/g, '').replace(/([.,]).*\1/g, '$1');
128
+ }
129
+ return value;
130
+ };
131
+ const maskCellphone = (value) => {
132
+ value = value.replace(/\D/g, '');
133
+ value = value.slice(0, 11);
134
+ if (value.length <= 2) {
135
+ return value.replace(/(\d{2})/, '($1');
136
+ }
137
+ if (value.length <= 6) {
138
+ return value.replace(/(\d{2})(\d{4})/, '($1) $2');
139
+ }
140
+ return value.replace(/(\d{2})(\d{4})(\d{4})/, '($1) $2-$3');
141
+ };
142
+ const maskPhone = (value) => {
143
+ value = value.replace(/\D/g, '');
144
+ value = value.slice(0, 10);
145
+ if (value.length <= 2) {
146
+ return value.replace(/(\d{2})/, '($1');
147
+ }
148
+ if (value.length <= 6) {
149
+ return value.replace(/(\d{2})(\d{4})/, '($1) $2');
150
+ }
151
+ return value.replace(/(\d{2})(\d{4})(\d{4})/, '($1) $2-$3');
152
+ };
153
+ const maskCEP = (value) => {
154
+ value = value.replace(/\D/g, '');
155
+ value = value.slice(0, 8);
156
+ return value.replace(/(\d{5})(\d{1,})/, '$1-$2');
157
+ };
158
+ const maskMoneyBRL = (value) => {
159
+ value = value.replace(/\D/g, '');
160
+ if (!value)
161
+ return '';
162
+ value = value.slice(0, 13);
163
+ const numericValue = parseFloat(value) / 100;
164
+ return numericValue.toLocaleString('pt-BR', {
165
+ style: 'currency',
166
+ currency: 'BRL',
167
+ });
168
+ };
169
+
170
+ const variants$4 = {
171
+ green: 'text-green',
172
+ gray: 'text-gray',
173
+ };
174
+ function Input({ onChange, placeholder, disabled = false, error, icon, onClickIcon, iconColor = 'green', label, mask, ...props }) {
175
+ const inputId = useId();
176
+ const [inputValue, setInputValue] = useState('');
177
+ const applyMask = (value, mask) => {
178
+ switch (mask) {
179
+ case 'cpf':
180
+ return maskCPF(value);
181
+ case 'cnpj':
182
+ return maskCNPJ(value);
183
+ case 'numbers':
184
+ return maskOnlyNumbers(value);
185
+ case 'cellphone':
186
+ return maskCellphone(value);
187
+ case 'phone':
188
+ return maskPhone(value);
189
+ case 'decimal':
190
+ return maskNumberWithDecimal(value);
191
+ case 'cep':
192
+ return maskCEP(value);
193
+ case 'currency':
194
+ return maskMoneyBRL(value);
195
+ default:
196
+ return value;
197
+ }
198
+ };
199
+ useEffect(() => {
200
+ const formatted = applyMask(props?.value ?? '', mask);
201
+ setInputValue(formatted);
202
+ }, [props?.value, mask]);
203
+ const handleChange = (e) => {
204
+ const value = applyMask(e.target.value, mask);
205
+ setInputValue(value);
206
+ onChange(value);
207
+ };
208
+ const hasError = (props?.value && error && !disabled) ||
209
+ (!!error && !disabled && props?.value?.length === 0);
210
+ return (jsxs("div", { className: "relative flex flex-col w-100", children: [jsxs(IconField, { className: "w-100", children: [jsx(InputIcon, { className: clsx(`pi ${icon} px-2 cursor-pointer`, hasError
211
+ ? 'text-redError'
212
+ : disabled
213
+ ? 'text-stone'
214
+ : variants$4[iconColor]), onClick: onClickIcon }), jsx(InputText, { id: inputId, type: "text", placeholder: placeholder, className: clsx('focus:shadow-none text-base w-100 font-roboto border !p-2 rounded-md', hasError
215
+ ? 'border-redError placeholder:text-redError'
216
+ : 'border-gray focus:border-primary', disabled && 'border-stoneDark text-disabled', error && 'border-redError text-redError', !error && 'border-gray placeholder:text-gray'), onChange: handleChange, disabled: disabled, invalid: hasError, ...props, value: inputValue })] }), jsx(FloatingLabel, { value: props?.value ? props?.value?.toString() : '', label: label || '', disabled: disabled, error: error }), hasError && jsx("span", { className: "text-redError text-xs px-2", children: error })] }));
217
+ }
218
+
219
+ function AutoComplete({ items, onChange, error, ...props }) {
220
+ const [isOpen, setIsOpen] = useState(false);
221
+ const [filteredItems, setFilteredItems] = useState(items);
222
+ const handleInputChange = (value) => {
223
+ onChange(value);
224
+ setIsOpen(!!value);
225
+ const filtered = items.filter((item) => item.toLowerCase().includes(value.toLowerCase()));
226
+ setFilteredItems(filtered);
227
+ };
228
+ const handleSelect = (selectedValue) => {
229
+ onChange(selectedValue);
230
+ setIsOpen(false);
231
+ };
232
+ const handleIconClick = () => {
233
+ if (isOpen) {
234
+ onChange('');
235
+ setFilteredItems(items);
236
+ }
237
+ setIsOpen(!isOpen);
238
+ };
239
+ return (jsxs("div", { className: "relative w-100", children: [jsx(IconField, { className: "w-100", children: jsx(Input, { ...props, onChange: handleInputChange, icon: isOpen ? 'pi-times' : 'pi-search', iconColor: isOpen ? 'gray' : 'green', onClickIcon: handleIconClick, error: error }) }), isOpen && filteredItems.length > 0 && (jsx("div", { className: "absolute w-100 max-h-48 -bottom-1 translate-y-full overflow-y-auto bg-white shadow-md z-10 rounded-md border border-stoneDark [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:rounded-r-md [&::-webkit-scrollbar-thumb]:rounded-md [&::-webkit-scrollbar-track]:bg-stone [&::-webkit-scrollbar-thumb]:bg-stoneDark", children: jsx("ul", { children: filteredItems.map((item) => (jsx("li", { onClick: () => handleSelect(item), className: "p-3 text-backgroundDark cursor-pointer hover:bg-secondary rounded-md", children: item }, item))) }) }))] }));
240
+ }
241
+
242
+ function LogoSmall() {
243
+ return (jsxs("svg", { width: "92", height: "19", viewBox: "0 0 92 19", fill: "none", children: [jsxs("g", { clipPath: "url(#clip0_297_2300)", children: [jsx("path", { d: "M91.7394 11.8865C91.7803 10.4995 91.7909 9.58382 91.7705 9.14601C91.7156 7.98967 91.4236 7.04721 90.8966 6.31195C90.3697 5.5767 89.4247 4.87486 88.0886 4.78128C85.8182 4.62755 84.8462 4.99183 83.2655 6.19498C82.5381 6.74642 81.8208 7.64544 81.1852 8.34393L81.3415 5.3862H77.1061C77.1809 7.94956 77.1775 10.5229 77.0959 13.1031L77.0109 15.2888C76.9701 16.141 76.9225 16.9932 76.8647 17.8488H81.1274C81.1172 17.0066 81.1443 15.8736 81.2123 14.4499C81.2803 13.0295 81.3619 11.9968 81.4639 11.3451C81.6236 10.4126 82.0046 9.63732 82.6027 9.02573C83.2008 8.41077 83.9454 7.66883 84.8699 7.66883C86.5865 7.70893 87.484 9.38328 87.6403 11.8331C87.7082 13.2066 87.6943 15.2152 87.6059 17.8488H91.8179C91.7328 16.1644 91.7091 14.1759 91.7394 11.8865Z", fill: "#878787" }), jsx("path", { d: "M70.8993 16.094C69.6314 16.1241 68.5607 15.586 67.7176 15.0079C66.8747 14.4297 66.4192 13.4137 66.3477 11.9532H76.0593V10.9806C75.8622 6.92673 73.6051 4.90479 69.2337 4.90479C68.1051 4.90479 67.0854 5.0886 66.1778 5.45622C65.2702 5.82385 64.5054 6.33853 63.8697 7.00695C63.2409 7.66868 62.7718 8.44069 62.4727 9.31301C62.1701 10.1919 62.0409 11.1311 62.0919 12.1337C62.1667 13.6777 62.595 14.9009 63.3734 15.7966C64.1553 16.6956 65.1274 17.3206 66.2933 17.6648C67.4593 18.0091 68.7204 18.263 70.0665 18.1828C72.361 18.0491 74.5875 16.9563 76.0593 16.0172V14.0988C74.4414 15.195 72.0211 16.0673 70.8993 16.094ZM66.2253 10.5261C66.1778 9.55028 66.4089 8.70469 66.9222 7.98617C67.4389 7.26428 68.2411 6.88329 69.3323 6.8365C69.9033 6.8365 70.386 6.96684 70.7803 7.22084C71.178 7.47483 71.4738 7.80904 71.6709 8.22012C71.8681 8.62785 71.9803 9.06567 72.0041 9.52688C72.0109 9.6672 71.9973 9.84769 71.9667 10.0783C71.9361 10.3022 71.9157 10.4493 71.9123 10.5261H66.2253Z", fill: "#878787" }), jsx("path", { d: "M62.0138 5.39624H57.9823L58.1285 1.92383L54.1003 2.76603C53.876 6.74309 53.8114 10.7335 53.7095 14.7239C53.7026 15.0214 53.6823 15.3924 53.7061 15.8368C53.7367 16.4451 53.9372 16.9364 54.148 17.3107C54.3587 17.6817 54.6918 17.9657 55.1337 18.1563C55.5756 18.3468 56.3643 18.5372 57.1087 18.4938C58.8321 18.3902 59.7363 18.0827 60.4705 17.8288L60.909 15.5394C60.4909 15.6864 60.0116 15.8101 59.6717 15.8368C58.9612 15.887 58.5262 15.8435 57.9517 15.252C57.6016 14.8877 57.7851 12.7588 57.8021 12.0871L57.9075 7.95292H61.4631C61.5549 7.09736 61.7827 6.3153 62.0138 5.39624Z", fill: "#878787" }), jsx("path", { d: "M51.4557 7.79912L51.6257 5.51983C49.8478 5.15554 47.9443 4.94165 46.6764 5.01851C45.1841 5.10541 43.9808 5.33935 43.0766 5.89414C42.1758 6.45226 41.7475 7.27107 41.8018 8.34387C41.8291 8.94547 41.9922 9.4534 42.2811 9.86453C42.5701 10.2789 43.046 10.7535 43.7122 11.2916C43.8822 11.4319 44.2221 11.6826 44.7286 12.0469C45.2351 12.4145 45.643 12.7253 45.9523 12.986C46.2651 13.2467 46.5234 13.5307 46.7444 13.8382C46.9585 14.1457 47.0775 14.4632 47.0945 14.784C47.0673 15.2619 46.826 15.5961 46.3738 15.7866C45.9252 15.9738 45.3982 16.0708 44.8068 16.0708C44.2255 16.0373 43.6 15.9371 42.9169 15.7666C42.237 15.5928 41.6659 15.3722 41.207 15.1115L41.5164 17.9189C42.9882 18.2664 44.7116 18.4402 46.69 18.4402C47.5092 18.4402 48.3012 18.2932 49.0694 18.0058C49.8376 17.7117 50.4563 17.3039 50.9254 16.7826C51.3945 16.2545 51.6121 15.663 51.5815 15.0046C51.5509 14.3964 51.3265 13.8215 50.905 13.2901C50.4869 12.762 49.8717 12.204 49.0661 11.6224C48.8485 11.4787 48.5799 11.3016 48.2604 11.0911C47.9409 10.8738 47.635 10.6365 47.3427 10.3658C47.0537 10.0917 46.8123 9.79769 46.6186 9.4768C46.4283 9.15599 46.2855 8.81513 46.3059 8.4575C46.35 7.73895 47.0469 7.33791 48.2672 7.29112C49.0729 7.2577 49.943 7.37801 51.4557 7.79912Z", fill: "#878787" }), jsx("path", { d: "M40.459 8.32386L40.7479 4.92163C39.9151 4.92163 38.5826 5.22577 37.7396 5.69365C36.917 6.15151 36.4139 6.68624 35.6593 7.43153L35.7375 5.41292C34.3132 5.41292 32.9739 5.36947 31.5496 5.36947C31.7161 9.63397 31.7569 13.7113 31.5088 17.9658H35.8497C35.8258 17.4812 35.7443 17.0634 35.7238 16.7024C35.6593 15.6129 35.6083 14.6337 35.6253 13.7614C35.6422 12.8891 35.7273 12.0402 35.87 11.2315C36.0162 10.416 36.2099 9.66065 36.5396 9.27635C37.2399 8.46088 38.2767 8.21357 39.3882 8.21357C39.7553 8.21357 40.1122 8.24699 40.459 8.32386Z", fill: "#878787" }), jsx("path", { d: "M24.2312 5.07852C22.1339 5.10192 20.0467 5.36928 17.9086 5.77368L17.6435 7.81233C18.8842 7.41128 20.1793 7.11384 21.539 6.84982C24.7445 6.22485 27.1749 9.11574 23.2692 10.0983C20.0196 10.9104 16.9365 11.6825 16.2362 13.0794C14.8595 15.8233 16.9501 17.5946 19.7646 18.2095C21.5798 18.6072 23.3779 18.5036 25.1523 17.9622C26.5427 17.9555 27.7018 17.9488 29.092 17.9388C29.1091 14.5867 29.3164 11.2346 29.2892 7.87918C29.2756 5.90401 27.1409 5.04845 24.2312 5.07852ZM25.3088 15.9135C24.068 16.368 22.936 16.6354 21.4812 16.2744C19.9584 15.8968 19.5641 13.9685 21.1651 13.1062C22.552 12.3542 24.4793 11.8997 25.5365 11.2346L25.3088 15.9135Z", fill: "#878787" }), jsx("path", { d: "M16.6135 0.5C14.8935 0.5 13.1735 0.5 11.4535 0.5C8.955 2.37156 5.90933 5.30589 4.76379 8.58446C4.77399 7.47824 4.79439 6.12804 4.82838 4.53054C4.85897 2.8194 4.87937 1.47589 4.89297 0.5H0.249625C0.259823 2.42503 0.27342 3.87549 0.27342 4.85805C0.280218 5.84062 0.283618 7.12732 0.283618 8.73148C0.287018 10.3357 0.280219 11.95 0.259824 13.5808C0.242828 15.2118 0.219032 16.6389 0.181641 17.8587H4.99154C4.98135 17.6615 4.96435 17.3741 4.93716 16.9931C4.90996 16.6121 4.88956 16.3247 4.88277 16.1375C4.82158 14.8709 4.78419 13.6209 4.77059 12.3944C4.757 11.2514 4.7536 10.5596 4.76379 9.48347C6.27985 11.1612 7.39819 12.4981 8.22761 13.6978C9.09099 14.9478 9.80141 16.3314 10.6784 17.8587H16.1478L8.80209 8.67804C9.04001 6.5057 13.9791 1.58617 16.6135 0.5Z", fill: "#878787" })] }), jsx("defs", { children: jsx("clipPath", { id: "clip0_297_2300", children: jsx("rect", { width: "91.6364", height: "18", fill: "white", transform: "translate(0.181641 0.5)" }) }) })] }));
244
+ }
245
+
246
+ function BasicHeader() {
247
+ return (jsx(Fragment, { children: jsx("div", { className: "w-100 min-h-16 border-b border-b-stone flex flex-row justify-between items-center px-8 shadow-header", children: jsx("div", { className: "flex flex-row items-center gap-4", children: jsx(LogoSmall, {}) }) }) }));
248
+ }
249
+
250
+ function Breadcrumb({ items }) {
251
+ return (jsx("nav", { className: "w-100", children: jsx("ol", { className: "flex items-center gap-2", children: items?.map((item, index) => (jsxs("li", { className: "flex flex-row gap-2", "aria-label": "breadcrumb", children: [jsx(Link$1, { to: item.href, className: clsx('text-base text-primary hover:underline'), children: item.label }), index < items.length - 1 && (jsx("span", { className: "text-base text-primary", children: '>' }))] }, index))) }) }));
252
+ }
253
+
254
+ const variants$3 = {
255
+ primary: 'bg-primary !text-background border-primary hover:bg-primaryActive disabled:bg-stoneDark disabled:border-stoneDark',
256
+ outline: 'bg-background !text-primary border-primary hover:bg-stone disabled:bg-stoneDark disabled:text-background disabled:border-stoneDark',
257
+ secondary: 'bg-stoneLight !text-grayDark border-stoneLight hover:bg-stone hover:border-stone disabled:bg-stone disabled:border-stone',
258
+ secondaryOutline: 'bg-transparent !text-backgroundDark border-stoneDark hover:bg-stone disabled:text-stoneDark',
259
+ gray: 'bg-gray !text-background border-gray hover:bg-grayDark hover:border-grayDark ',
260
+ grayOutline: 'bg-transparent !text-gray100 border-gray50 hover:bg-stone disabled:bg-stone disabled:text-stoneDark',
261
+ tab: 'bg-background !text-primary border-background hover:bg-secondaryActive hover:border-grayDark disabled:bg-stoneDark disabled:text-background disabled:border-stoneDark',
262
+ };
263
+ function Button({ variant = 'primary', selected = false, rightIcon, className, width = 'w-100', ...props }) {
264
+ return (jsx(Button$1, { ...props, className: clsx('!py-2 !shadow-none font-roboto', variants$3[variant], selected && variant === 'tab' && 'bg-secondary border-grayDark ', width, className), "aria-label": "Componente Bot\u00E3o Padr\u00E3o", children: rightIcon && jsx("span", { className: `pi pl-2 ${rightIcon}`, children: " " }) }));
265
+ }
266
+
267
+ addLocale('pt-BR', {
268
+ firstDayOfWeek: 0,
269
+ dayNames: [
270
+ 'domingo',
271
+ 'segunda-feira',
272
+ 'terça-feira',
273
+ 'quarta-feira',
274
+ 'quinta-feira',
275
+ 'sexta-feira',
276
+ 'sábado',
277
+ ],
278
+ dayNamesShort: ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb'],
279
+ dayNamesMin: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'],
280
+ monthNames: [
281
+ 'janeiro',
282
+ 'fevereiro',
283
+ 'março',
284
+ 'abril',
285
+ 'maio',
286
+ 'junho',
287
+ 'julho',
288
+ 'agosto',
289
+ 'setembro',
290
+ 'outubro',
291
+ 'novembro',
292
+ 'dezembro',
293
+ ],
294
+ monthNamesShort: [
295
+ 'jan',
296
+ 'fev',
297
+ 'mar',
298
+ 'abr',
299
+ 'mai',
300
+ 'jun',
301
+ 'jul',
302
+ 'ago',
303
+ 'set',
304
+ 'out',
305
+ 'nov',
306
+ 'dez',
307
+ ],
308
+ today: 'Hoje',
309
+ clear: 'Limpar',
310
+ dateFormat: 'dd/mm/yy',
311
+ });
312
+ function CalendarInput({ error, placeholder = 'Selecione uma data', label, disabled = false, ...props }) {
313
+ const calendarRef = useRef(null);
314
+ const hasError = (error && !disabled) || (!!error && !disabled);
315
+ const dateTemplate = (data) => {
316
+ const date = new Date(`${data.year}/${data.month + 1}/${data.day}`);
317
+ const dayComponent = (className) => {
318
+ return (jsx("div", { className: `w-full h-full flex justify-center items-center text-grayDark ${className}`, children: data.day }));
319
+ };
320
+ if (props.selectionMode === 'range') {
321
+ const [start, end] = Array.isArray(props.value)
322
+ ? props.value
323
+ : [null, null];
324
+ if (start && date.getTime() === start.getTime()) {
325
+ return dayComponent('bg-stone');
326
+ }
327
+ if (start && end && date >= start && date <= end) {
328
+ return dayComponent('bg-stone');
329
+ }
330
+ return dayComponent();
331
+ }
332
+ if (props.selectionMode === 'single' || !props.selectionMode) {
333
+ const selectedDate = props.value;
334
+ if (selectedDate && date.getTime() === selectedDate.getTime()) {
335
+ return dayComponent('bg-stone');
336
+ }
337
+ }
338
+ return dayComponent();
339
+ };
340
+ const handleInputClick = () => {
341
+ if (!disabled) {
342
+ calendarRef.current?.show();
343
+ }
344
+ };
345
+ return (jsx("div", { className: "relative flex flex-col w-full min-w-full", children: jsxs("div", { onClick: handleInputClick, children: [jsx(FloatingLabel, { value: props?.value ? props.value.toString() : '', label: label, disabled: disabled, error: error }), jsxs("div", { className: "relative w-full min-w-full", children: [jsx(Calendar, { ...props, disabled: disabled, placeholder: placeholder, ref: calendarRef, panelStyle: { width: '530px', height: '500px' }, className: clsx('w-full min-w-full focus:shadow-none border-none z-0 font-roboto border rounded-md', hasError
346
+ ? 'border-redError placeholder:!text-redError p-invalid'
347
+ : 'border-gray focus:border-primary', disabled && 'border-stoneDark text-disabled', error && 'border-redError text-redError p-invalid', !error && 'border-gray p-custom'), dateFormat: "dd/mm/yy", inputStyle: {
348
+ border: `1px solid ${error && !props.value ? '#EC4A54' : '#a0a4b3'}`,
349
+ boxShadow: 'none',
350
+ color: hasError ? '#EC4A54' : '',
351
+ height: '42px',
352
+ fontSize: '16px',
353
+ }, hideOnDateTimeSelect: true, hideOnRangeSelection: true, todayButtonClassName: "bg-primary text-background", dateTemplate: dateTemplate, invalid: hasError, locale: "pt-BR" }), jsx(InputIcon, { className: clsx(`pi pi-calendar text-gray cursor-pointer absolute right-3 top-1/2 transform -translate-y-1/2`, disabled && 'text-disabled', hasError && 'text-redError') })] }), hasError && (jsx("div", { className: "mb-4", children: jsx("span", { className: "absolute text-redError text-xs px-2", children: error }) }))] }) }));
354
+ }
355
+
356
+ function Card({ children, className, ariaLabel = 'Card de informação', }) {
357
+ return (jsx("div", { className: clsx('bg-background shadow-container rounded-md p-3', className ? className : 'w-full h-full'), "aria-label": ariaLabel, children: children }));
358
+ }
359
+
360
+ function CardButton({ label, description, onClick, isLight = true, }) {
361
+ return (jsxs("div", { className: `cursor-pointer rounded-2xl p-4 h-[160px] w-full bg-gradient-to-br hover:shadow-md transition-shadow duration-200 border ${isLight ? 'border-[#f3f4f6] from-[#f3f4f6] to-white' : 'border-[#13294B] from-[#13294B] to-[#0C1C34]'}`, onClick: () => {
362
+ if (onClick)
363
+ onClick();
364
+ }, children: [jsx("h3", { className: `text-lg font-bold ${isLight ? 'text-[#13294B]' : 'text-white'}`, children: label }), description && (jsx("p", { className: `text-sm mt-2 line-clamp-3 ${isLight ? 'text-[#13294B]' : 'text-white'}`, children: description }))] }));
365
+ }
366
+
367
+ function CardIconsButton({ label, leftIcon, onClick, isLight = true, }) {
368
+ return (jsxs("div", { className: `cursor-pointer rounded-xl p-4 w-full min-h-[60px] bg-gradient-to-br hover:shadow-md transition-shadow duration-200 border flex items-center justify-between gap-4 ${isLight ? 'border-[#f3f4f6] from-[#f3f4f6] to-white' : 'border-[#13294B] from-[#13294B] to-[#0C1C34]'}`, onClick: () => {
369
+ if (onClick)
370
+ onClick();
371
+ }, "aria-label": `Botão de navegação para ${label}`, children: [jsxs("div", { className: "flex items-center gap-3 flex-grow overflow-hidden", children: [leftIcon && (jsx("div", { className: `text-xl flex-shrink-0 flex items-center ${isLight ? 'text-[#13294B]' : 'text-white'}`, children: leftIcon })), jsx("h3", { className: `text-base font-semibold break-words ${isLight ? 'text-[#646981]' : 'text-white'}`, children: label })] }), jsx("div", { className: "flex items-center justify-center h-full", children: jsx("i", { className: `pi pi-angle-right text-xl flex-shrink-0 ${isLight ? 'text-[#646981]' : 'text-white'}` }) })] }));
372
+ }
373
+
374
+ function Chart(props) {
375
+ return jsx(Chart$1, { ...props });
376
+ }
377
+
378
+ function Dialog({ title, description, labelConfirmButton, onClose, onClick, }) {
379
+ return (jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 z-20 flex justify-center items-center", children: jsxs(Card, { className: "flex flex-col", children: [jsxs("div", { className: "flex flex-row items-center justify-between px-4 pt-4 pb-6 border-b border-b-stone", children: [jsx("h2", { className: "text-primary font-semibold", children: title }), jsx("i", { className: "pi pi-times", style: { color: '#606060', cursor: 'pointer' }, onClick: onClose })] }), jsxs("div", { className: "flex flex-col items-center p-6", children: [jsx("span", { className: "text-primary", children: description }), jsxs("div", { className: "w-100 flex flex-row justify-end pt-10 gap-4", children: [jsx("div", { className: "w-1/3", children: jsx(Button, { label: "Cancelar", variant: "outline", onClick: onClose }) }), jsx("div", { className: "w-1/3", children: jsx(Button, { label: labelConfirmButton, variant: "primary", onClick: onClick }) })] })] })] }) }));
380
+ }
381
+
382
+ function Divider({ ...props }) {
383
+ return jsx(Divider$1, { ...props });
384
+ }
385
+
386
+ function EmptyContent({ message = 'Não há dados disponíveis.' }) {
387
+ return (jsx("div", { className: "p-6 text-justify text-primary bg-stoneBackground", children: jsxs("div", { className: 'py-2 px-4 rounded-lg font-semibold', children: [jsx("i", { className: 'pi pi-database mr-2' }), message] }) }));
388
+ }
389
+
390
+ function ExpandablePanel({ title, children, defaultOpen = true, isLight = true, }) {
391
+ const [isOpen, setIsOpen] = useState(defaultOpen);
392
+ return (jsx("div", { className: "relative p-[2px] rounded-lg bg-gradient-to-r from-[#FAFAFB] via-[#FAFAFB] to-[#FAFAFB] mb-4", children: jsxs("div", { className: "bg-white rounded-lg overflow-hidden", children: [jsxs("div", { className: `flex justify-between items-center px-4 py-2 cursor-pointer bg-gradient-to-r ${isLight ? 'from-[#FFFFFF] via-[#FAFAFB] to-[#FFFFFF]' : 'from-[#13294B] to-[#0C1C34]'}`, onClick: () => setIsOpen(!isOpen), children: [jsx("div", { className: `text-xl font-bold ${isLight ? 'text-primary' : 'text-white'}`, children: title }), jsx("button", { children: isOpen ? (jsx("i", { className: `pi pi-chevron-down ${isLight ? 'text-primary' : 'text-white'}` })) : (jsx("i", { className: `pi pi-chevron-up ${isLight ? 'text-primary' : 'text-white'}` })) })] }), isOpen && jsx("div", { className: "p-4 text-primary", children: children })] }) }));
393
+ }
394
+
395
+ function FileUpload({ label = 'Enviar arquivos', value = [], onChange, multiple = true, fileTypes, className, error, disabled = false, }) {
396
+ const [isDragging, setIsDragging] = useState(false);
397
+ const fileInputRef = useRef(null);
398
+ const [uploadFiles, setUploadFiles] = useState(value);
399
+ useEffect(() => {
400
+ setUploadFiles(value);
401
+ }, [value]);
402
+ const updateFiles = (newFiles) => {
403
+ setUploadFiles(newFiles);
404
+ onChange?.(newFiles);
405
+ };
406
+ const generateFileWithPreview = (files, allowedTypes = ['image', 'pdf']) => {
407
+ const allowedMimeTypes = getAcceptedMimeTypes(allowedTypes).split(',');
408
+ return Array.from(files)
409
+ .filter((file) => allowedMimeTypes.some((mime) => {
410
+ if (mime === 'image/*')
411
+ return file.type.startsWith('image/');
412
+ return file.type === mime;
413
+ }))
414
+ .map((file) => {
415
+ const type = file.type.startsWith('image/') ? 'image' : 'pdf';
416
+ const previewUrl = type === 'image' ? URL.createObjectURL(file) : undefined;
417
+ return { file, type, previewUrl };
418
+ });
419
+ };
420
+ const getAcceptedMimeTypes = (types = ['image', 'pdf']) => {
421
+ const mimeMap = {
422
+ image: 'image/*',
423
+ pdf: 'application/pdf',
424
+ };
425
+ return types.map((type) => mimeMap[type]).join(',');
426
+ };
427
+ const handleFileChange = (selectedFiles) => {
428
+ if (!selectedFiles)
429
+ return;
430
+ const newFiles = generateFileWithPreview(selectedFiles, fileTypes);
431
+ updateFiles([...(uploadFiles || []), ...newFiles]);
432
+ };
433
+ const handleRemoveFile = (fileToRemove) => {
434
+ const updated = uploadFiles
435
+ .map((file) => {
436
+ if (file.id && file.id === fileToRemove.id) {
437
+ return { ...file, isDeleted: true };
438
+ }
439
+ if (!file.id && file.file === fileToRemove.file) {
440
+ return null;
441
+ }
442
+ return file;
443
+ })
444
+ .filter(Boolean);
445
+ updateFiles(updated);
446
+ };
447
+ const getSupportedFileText = (types = ['image', 'pdf']) => {
448
+ const includesImage = types.includes('image');
449
+ const includesPdf = types.includes('pdf');
450
+ if (includesImage && includesPdf)
451
+ return 'Suporta imagens e PDFs';
452
+ if (includesImage)
453
+ return 'Suporta apenas imagens';
454
+ if (includesPdf)
455
+ return 'Suporta apenas PDFs';
456
+ return '';
457
+ };
458
+ const handleDragOver = (e) => {
459
+ e.preventDefault();
460
+ setIsDragging(true);
461
+ };
462
+ const handleDragLeave = (e) => {
463
+ e.preventDefault();
464
+ setIsDragging(false);
465
+ };
466
+ const handleDrop = (e) => {
467
+ e.preventDefault();
468
+ setIsDragging(false);
469
+ if (isDisabled || disabled)
470
+ return;
471
+ handleFileChange(e.dataTransfer.files);
472
+ };
473
+ const visibleFiles = uploadFiles.filter((file) => !file.isDeleted);
474
+ const isDisabled = !multiple && visibleFiles.length > 0;
475
+ return (jsxs("div", { className: clsx('space-y-3', className), children: [jsx("label", { htmlFor: "file-upload", className: "text-[18px] font-medium text-primary", children: label }), jsxs("div", { role: "button", "aria-label": "\u00C1rea de envio de arquivos", "aria-disabled": isDisabled || disabled, className: clsx('border-2 border-dashed rounded-lg p-2 text-center cursor-pointer transition-colors', isDragging && !error
476
+ ? 'border-primary bg-primary/5'
477
+ : 'border-[#e6e6e6] hover:border-primary/50', isDisabled || (disabled && 'bg-gray-200 cursor-auto'), error && 'border-red-500 hover:border-red-500'), onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: () => fileInputRef.current?.click(), children: [jsx("input", { id: "file-upload", ref: fileInputRef, type: "file", onChange: (e) => handleFileChange(e.target.files), className: "hidden", multiple: multiple, accept: getAcceptedMimeTypes(fileTypes), disabled: isDisabled || disabled }), jsxs("div", { className: "flex flex-col items-center justify-center space-y-3", children: [jsx("i", { className: "pi pi-upload text-xl text-[#a0a4b3]" }), jsx("p", { className: "text-lg font-semibold text-primary", children: isDisabled ? 'Limite atingido' : 'Arraste e solte arquivos aqui' }), jsx("p", { className: "text-sm text-[#a0a4b3]", children: isDisabled
478
+ ? 'Já possui um arquivo selecionado'
479
+ : 'ou clique para selecionar arquivos' }), jsx("p", { className: "text-xs text-[#a0a4b3]", children: getSupportedFileText(fileTypes) })] })] }), error && (jsx("span", { className: "text-redError text-xs", role: "alert", "aria-live": "assertive", children: error })), visibleFiles.length > 0 && (jsxs("div", { className: "space-y-4", children: [jsxs("p", { className: "text-base text-[#a0a4b3]", children: ["Arquivos selecionados (", visibleFiles.length, ")"] }), jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: visibleFiles.map((file, index) => (jsxs("div", { className: "relative group overflow-hidden rounded border border-gray-200", children: [jsx("div", { className: "aspect-square bg-[#e6e6e6] flex items-center justify-center", children: file.type === 'image' && file.previewUrl ? (jsx("img", { src: file?.previewUrl, alt: file?.file?.name || file?.name, className: "object-cover w-full h-full transition-transform duration-300 ease-in-out group-hover:scale-105" })) : (jsxs("div", { className: "flex flex-col items-center justify-center p-4 transition-transform duration-300 ease-in-out group-hover:scale-105", children: [jsx("i", { className: "pi pi-file-pdf text-4xl text-primary" }), jsx("span", { className: "mt-2 text-xs text-center truncate max-w-full", children: file?.file?.name || file?.name })] })) }), jsx("button", { type: "button", className: "absolute top-1 right-1 w-6 h-6 flex items-center justify-center bg-primary hover:bg-primaryActive rounded-full transition-colors", onClick: (e) => {
480
+ e.stopPropagation();
481
+ handleRemoveFile(file);
482
+ }, "aria-label": `Remover o arquivo ${file.file?.name || file.name}`, children: jsx("i", { className: "pi pi-times text-white text-xs hover:text-slate-200" }) })] }, index))) })] }))] }));
483
+ }
484
+
485
+ const variants$2 = {
486
+ green: {
487
+ text: '!text-green',
488
+ button: 'bg-greenBackground hover:bg-greenBackgroundActive',
489
+ },
490
+ main: {
491
+ text: '!text-white',
492
+ button: 'bg-gray hover:bg-grayDark',
493
+ },
494
+ primary: {
495
+ text: '!text-white',
496
+ button: 'bg-primary hover:bg-primaryActive',
497
+ },
498
+ };
499
+ function FilterButton({ filterOptions, setOption, option, variant, icon, label, ...props }) {
500
+ const [isOpen, setIsOpen] = useState(false);
501
+ const toggleDropdown = () => {
502
+ setIsOpen(!isOpen);
503
+ };
504
+ const handleSelect = (selectedOption) => {
505
+ setIsOpen(false);
506
+ setOption(selectedOption.value === option?.value ? null : selectedOption);
507
+ };
508
+ return (jsxs("div", { className: "relative flex flex-col items-end", children: [jsx(Button$1, { ...props, icon: icon, label: label, className: clsx('w-max shadow-none border-none !py-2 gap-2 items-center disabled:bg-stoneDark', props.disabled ? '!disabled:text-background' : variants$2[variant].text, variants$2[variant].button), onClick: toggleDropdown }), isOpen && (jsx("div", { className: `absolute w-40 bg-background shadow-md border border-gray z-[9] rounded-md p-2 -bottom-1 translate-y-full`, children: jsx("ul", { children: filterOptions.map((filterOption) => (jsxs("li", { onClick: () => handleSelect(filterOption), className: "p-2 flex justify-between items-center cursor-pointer", children: [filterOption.label, jsx("input", { type: "radio", onChange: () => handleSelect(filterOption), checked: filterOption?.value === option?.value, className: "appearance-none w-2 h-2 rounded-full ring-1 ring-offset-2 ring-offset-background ring-gray checked:bg-primary cursor-pointer" })] }, filterOption.value))) }) }))] }));
509
+ }
510
+
511
+ function Sidebar({ item, onClose, topItem }) {
512
+ return (jsxs("div", { className: "relative w-100", children: [jsx("div", { className: "fixed bottom-0 w-100 h-[calc(100vh_-_64px)] bg-backgroundDark/20 z-50", onClick: onClose }), jsxs("div", { className: "fixed h-[calc(100vh_-_64px)] bottom-0 w-72 bg-background z-50", children: [jsx("div", { className: "cursor-pointer flex flex-row gap-3 items-center border-b pl-6 px-2 py-2 border-b-stone hover:bg-stoneBackground hover:font-bold", children: jsx(Link$1, { to: "/", className: "font-roboto text-base text-backgroundDark hover:font-bold", onClick: onClose, "aria-label": "Ir para o inicio", children: "In\u00EDcio" }, "home-id") }, 'home-div'), topItem &&
513
+ topItem.map((item) => (jsxs("div", { className: "cursor-pointer flex flex-row gap-3 items-center border-b pl-6 px-2 py-2 border-b-stone hover:bg-stoneBackground hover:font-bold", children: [item?.isWindowOpen && (jsx("button", { className: "font-roboto text-base text-backgroundDark hover:font-bold", onClick: () => {
514
+ if (onClose)
515
+ onClose();
516
+ if (typeof window !== 'undefined') {
517
+ window.open(item?.path, '_blank');
518
+ }
519
+ }, "aria-label": `Ir para ${item?.title}`, children: item?.title }, item?.id || item.title)), !item?.isWindowOpen && (jsx(Link$1, { to: item?.path || '', className: "font-roboto text-base text-backgroundDark hover:font-bold", onClick: onClose, "aria-label": `Ir para ${item?.title}`, children: item?.title }, item?.id || item.title))] }, `top-item-${item?.id ?? item.title}`))), jsxs("div", { className: "flex flex-row gap-3 items-center pl-6 pt-8 pb-4", children: [jsx("i", { className: "pi pi-star !text-backgroundDark !font-bold text-lg" }), jsx("p", { className: "text-backgroundDark font-bold text-lg", children: "Favoritos" })] }), jsx("div", { className: "overflow-y-auto overflow-x-hidden [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:rounded-r-md [&::-webkit-scrollbar-thumb]:rounded-md [&::-webkit-scrollbar-track]:bg-stone [&::-webkit-scrollbar-thumb]:bg-stoneDark", children: item &&
520
+ item.map((item) => (jsx(Link$1, { className: "flex flex-row items-center pl-6 gap-2 border-b border-b-stone hover:bg-stoneBackground hover:font-bold", to: item.path || '', onClick: onClose, "aria-label": `Ir para ${item.title}`, children: jsx("span", { className: "font-roboto text-base py-2 text-backgroundDark hover:font-bold", children: item.title }) }, item.id))) })] }, 'sidebar-div')] }));
521
+ }
522
+
523
+ function Header({ sidebarItems, sidebarTopItems, username, userConfigItems, setOpenNotifications, }) {
524
+ const [openSidebar, setOpenSidebar] = useState(false);
525
+ const [openUserConfig, setOpenUserConfig] = useState(false);
526
+ const userConfigRef = useRef(null);
527
+ useEffect(() => {
528
+ function handleClickOutside(event) {
529
+ if (userConfigRef.current &&
530
+ !userConfigRef.current.contains(event.target)) {
531
+ setOpenUserConfig(false);
532
+ }
533
+ }
534
+ if (openUserConfig) {
535
+ document.addEventListener('mousedown', handleClickOutside);
536
+ }
537
+ else {
538
+ document.removeEventListener('mousedown', handleClickOutside);
539
+ }
540
+ return () => {
541
+ document.removeEventListener('mousedown', handleClickOutside);
542
+ };
543
+ }, [openUserConfig]);
544
+ return (jsxs(Fragment, { children: [jsxs("div", { className: "w-100 min-h-16 border-b border-b-stone flex flex-row justify-between items-center px-8 shadow-header", children: [jsxs("div", { className: "flex flex-row items-center gap-4", children: [jsx("button", { className: "bg-transparent border-none", onClick: () => setOpenSidebar(!openSidebar), "aria-label": "Abrir menu lateral", children: jsx("i", { className: `${openSidebar ? 'pi pi-list' : 'pi pi-bars'} text-[#878787] cursor-pointer hover:text-backgroundDark text-xl mt-1 }` }) }), jsx(LogoSmall, {})] }), jsxs("div", { className: "relative flex flex-row gap-4 items-center", children: [jsx("button", { className: "bg-transparent border-none", onClick: () => setOpenNotifications(true), "aria-label": "Abrir notifica\u00E7\u00E3o", children: jsx("i", { className: "pi pi-bell text-[#878787] cursor-pointer hover:text-backgroundDark" }) }), jsxs("div", { ref: userConfigRef, className: "relative", children: [jsx("button", { className: "bg-transparent border-none", onClick: () => setOpenUserConfig(!openUserConfig), "aria-label": "Abrir menu de configura\u00E7\u00F5es do usu\u00E1rio", children: jsxs("p", { className: "text-[#878787] hover:text-backgroundDark font-roboto font-bold cursor-pointer transition-colors duration-200", children: ["Ol\u00E1, ", username] }) }), openUserConfig && (jsx("div", { className: `absolute w-100 bg-background shadow-md border border-stoneLight z-20 rounded-md p-2 -bottom-1 translate-y-full`, children: jsx("ul", { children: userConfigItems.map(({ id, title, onClick, path }) => (jsx("li", { className: "p-2 hover:bg-stoneBackground", children: jsx("a", { onClick: () => {
545
+ if (onClick)
546
+ onClick();
547
+ setOpenUserConfig(false);
548
+ }, href: path, className: "block w-full font-base font-roboto text-backgroundDark cursor-pointer hover:font-bold", "aria-label": "Op\u00E7\u00F5es de configura\u00E7\u00F5es do usu\u00E1rio", children: title }) }, id))) }) }))] })] })] }), openSidebar && (jsx(Sidebar, { topItem: sidebarTopItems, item: sidebarItems, onClose: () => {
549
+ setOpenSidebar(false);
550
+ } }))] }));
551
+ }
552
+
553
+ const variants$1 = {
554
+ border: 'border-primary hover:border-primary shadow-none',
555
+ shadow: 'border-background hover:border-stone focus:shadow-md',
556
+ };
557
+ function IconButton({ variant, icon, ...props }) {
558
+ return (jsx(Button$1, { ...props, icon: `pi ${icon}`, rounded: true, text: variant === 'shadow', raised: variant === 'shadow', outlined: variant === 'border', className: clsx('bg-background text-primary hover:bg-stone disabled:bg-stoneDark disabled:border-stoneDark disabled:text-background', variants$1[variant]) }));
559
+ }
560
+
561
+ function InfoCard({ title, children, icon, className, titleClassName, }) {
562
+ return (jsxs("div", { className: clsx('bg-background rounded-lg p-4 border border-stone overflow-hidden', className), children: [jsxs("div", { className: "flex justify-between items-center mb-2", children: [jsx("span", { className: clsx('text-sm font-roboto text-primary', titleClassName), children: title }), icon] }), jsx("div", { className: "font-roboto text-primary break-words overflow-wrap break-all max-w-full", children: children })] }));
563
+ }
564
+
565
+ function InputSwitch({ checked, onChange, disabled = false, error, ariaLabel = 'Switch', }) {
566
+ const inputId = useId();
567
+ return (jsxs("div", { className: "flex flex-col gap-1", children: [jsx(InputSwitch$1, { id: inputId, checked: checked, onChange: (e) => onChange(e.value), disabled: disabled, className: clsx('transition-all border-2 rounded-full p-inputswitch', disabled
568
+ ? 'opacity-50 cursor-not-allowed border-none'
569
+ : 'border-none', error ? 'p-inputswitch-error' : '', checked ? 'p-inputswitch-checked' : ''), "aria-label": ariaLabel }), error && jsx("span", { className: "text-redError text-xs", children: error })] }));
570
+ }
571
+
572
+ function InputTextArea({ onChange, placeholder, disabled = false, error, label, rows = 2, ...props }) {
573
+ const inputTextAreaId = useId();
574
+ const handleChange = (e) => {
575
+ onChange(e.target.value);
576
+ };
577
+ const hasError = (props.value && error && !disabled) ||
578
+ (!!error && !disabled && props.value?.length === 0);
579
+ return (jsxs("div", { className: "relative flex flex-col w-full", children: [jsx(InputTextarea, { id: inputTextAreaId, rows: rows, placeholder: placeholder, onChange: handleChange, disabled: disabled, invalid: hasError, className: clsx('w-100 font-roboto border !p-2 rounded-md focus:shadow-none', hasError
580
+ ? 'border-redError placeholder:text-redError'
581
+ : 'border-gray focus:border-primary', disabled && 'border-stoneDark text-disabled', error && 'border-redError text-redError', !error && 'border-gray placeholder:text-gray'), ...props }), jsx(FloatingLabel, { value: props?.value ? props.value.toString() : '', label: label || '', disabled: disabled, error: error }), hasError && jsx("span", { className: "text-redError text-xs px-2", children: error })] }));
582
+ }
583
+
584
+ function TextIcon() {
585
+ return (jsxs("svg", { width: "16", height: "10", viewBox: "0 0 16 10", fill: "none", children: [jsx("path", { d: "M1 1H14.5", stroke: "#666666", strokeWidth: "2", strokeLinecap: "round" }), jsx("path", { d: "M1 5H14.5", stroke: "#666666", strokeWidth: "2", strokeLinecap: "round" }), jsx("path", { d: "M1 9H10", stroke: "#666666", strokeWidth: "2", strokeLinecap: "round" })] }));
586
+ }
587
+
588
+ function InternalMenu({ item, isFiltering }) {
589
+ const [openItems, setOpenItems] = useState([]);
590
+ const toggleMenu = (menuItem) => {
591
+ setOpenItems((prev) => prev.includes(menuItem)
592
+ ? prev.filter((item) => item !== menuItem)
593
+ : [...prev, menuItem]);
594
+ };
595
+ useEffect(() => {
596
+ if (isFiltering) {
597
+ setOpenItems(item);
598
+ }
599
+ else {
600
+ const initialOpen = item.filter((menuItem) => menuItem.isActive);
601
+ setOpenItems(initialOpen);
602
+ }
603
+ }, [isFiltering, item]);
604
+ return (jsx("div", { className: "w-72 overflow-x-hidden overflow-y-auto [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:rounded-r-md [&::-webkit-scrollbar-thumb]:rounded-md [&::-webkit-scrollbar-track]:bg-stone [&::-webkit-scrollbar-thumb]:bg-stoneDark ", children: item.map((menuItem) => {
605
+ const isOpen = openItems.includes(menuItem);
606
+ return (jsxs("div", { children: [jsxs("div", { className: "cursor-pointer flex flex-row justify-between items-center border-b px-2 py-1 border-b-stone", onClick: () => toggleMenu(menuItem), children: [jsxs("div", { className: "flex flex-row items-center gap-2", children: [jsx(TextIcon, {}), jsx("span", { className: "font-roboto text-base text-primary", children: menuItem.title })] }), menuItem.subItem && (jsx("i", { className: `pi ${isOpen ? 'pi-angle-up' : 'pi-angle-down'} px-2 text-primary` }))] }), menuItem.subItem && isOpen && (jsx("div", { className: "flex flex-col", children: menuItem.subItem.map((subItem) => (jsx(Link$1, { className: clsx('cursor-pointer text-base text-primary pl-6 py-1 hover:font-bold hover:text-primary hover:bg-stoneBackground', subItem.isActive ? 'text-primary font-bold' : ''), to: subItem.path, children: jsx("span", { children: subItem.title }) }, subItem.id))) }))] }, menuItem.id));
607
+ }) }));
608
+ }
609
+
610
+ function Link({ href, children, className }) {
611
+ return (jsx("a", { href: href, className: `text-primary hover:underline font-bold font-roboto ${className}`, children: children }));
612
+ }
613
+
614
+ function MegaMenu({ items }) {
615
+ return (jsx("div", { className: "w-100 flex items-center justify-between", children: items.map((item, index) => {
616
+ const isfirst = index === 0;
617
+ const isLast = index === items.length - 1;
618
+ return (jsx("a", { onClick: item.onClick, className: clsx('w-100 p-2 font-medium border border-stoneDark text-center cursor-pointer', item.active && 'bg-primary text-background', !item.active && 'text-primary', isfirst && 'rounded-l-full', !isfirst && 'border-l-0', isLast && 'rounded-r-full'), "aria-label": "Itens do menu", children: item.label }, index));
619
+ }) }));
620
+ }
621
+
622
+ function Modal({ title, size = 'md', onClose, onConfirm, labelCloseButton = 'Fechar', labelConfirmButton = 'Confirmar', isExpanded = false, ariaLabel = 'Modal de informçoes', children, }) {
623
+ const [isFullScreen, setIsFullScreen] = useState(false);
624
+ const toggleFullScreen = () => {
625
+ setIsFullScreen(!isFullScreen);
626
+ };
627
+ const modalSizeClass = isFullScreen
628
+ ? 'w-screen h-screen'
629
+ : {
630
+ sm: 'w-1/3',
631
+ md: 'w-1/2',
632
+ lg: 'w-2/3',
633
+ xl: 'w-[90%]',
634
+ }[size];
635
+ return (jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 z-20 flex justify-center items-center", children: jsxs(Card, { className: `flex flex-col ${modalSizeClass}`, "aria-label": ariaLabel, children: [jsxs("div", { className: `flex flex-row items-center justify-between px-4 pt-4 pb-6 border-b border-b-stone`, children: [title && (jsx("div", { className: "text-primary font-bold text-xl", children: title })), jsxs("div", { className: "flex items-center gap-6", children: [isExpanded && (jsx(Fragment, { children: isFullScreen ? (jsx(Fragment, { children: jsx("button", { onClick: toggleFullScreen, "aria-label": "Minimizar tela", style: {
636
+ color: '#606060',
637
+ width: '24px',
638
+ height: '24px',
639
+ cursor: 'pointer',
640
+ }, children: jsx("i", { className: "pi pi-window-minimize" }) }) })) : (jsx(Fragment, { children: jsx("button", { onClick: toggleFullScreen, "aria-label": "Maximizar tela", style: {
641
+ color: '#606060',
642
+ width: '24px',
643
+ height: '24px',
644
+ cursor: 'pointer',
645
+ }, children: jsx("i", { className: "pi pi-window-maximize" }) }) })) })), jsx("button", { onClick: onClose, "aria-label": "Fechar modal", style: {
646
+ color: '#606060',
647
+ width: '24px',
648
+ height: '24px',
649
+ cursor: 'pointer',
650
+ }, children: jsx("i", { className: "pi pi-times cursor-pointer" }) })] })] }), jsx("div", { className: `flex-1 overflow-y-auto text-primary ${isFullScreen ? 'h-full' : 'max-h-[70vh]'} p-6`, children: children }), jsxs("div", { className: "w-full flex flex-col sm:flex-row sm:justify-end pt-10 gap-4 px-6", children: [onClose && (jsx(Button, { label: labelCloseButton, variant: "outline", onClick: onClose, className: "w-full sm:w-auto lg:min-w-[110px] md:min-w-[110px] px-4", "aria-label": "Fechar modal" })), onConfirm && (jsx(Button, { label: labelConfirmButton, variant: "primary", onClick: onConfirm, className: "w-full sm:w-auto lg:min-w-[110px] md:min-w-[110px] px-4", "aria-label": "Confirmar modal" }))] })] }) }));
651
+ }
652
+
653
+ function MultiSelect(props) {
654
+ const { options, placeholder = 'Selecione uma opção', label = 'Opção', disabled = false, error, isLoading = false, isReadOnly = true, ariaLabel = 'Selecione uma ou mais opções', } = props;
655
+ const [isOpen, setIsOpen] = useState(false);
656
+ const [visibleText, setVisibleText] = useState('');
657
+ const [searchText, setSearchText] = useState('');
658
+ const [highlightedIndex, setHighlightedIndex] = useState(-1);
659
+ const containerRef = useRef(null);
660
+ const normalize = (str) => str
661
+ .normalize('NFD')
662
+ .replace(/[\u0300-\u036f]/g, '')
663
+ .toLowerCase();
664
+ const filteredOptions = options.filter((option) => normalize(option.label).includes(normalize(searchText)));
665
+ const toggleDropdown = () => {
666
+ if (!disabled && !isLoading) {
667
+ const newState = !isOpen;
668
+ setIsOpen(newState);
669
+ if (!newState) {
670
+ setSearchText('');
671
+ setHighlightedIndex(-1);
672
+ }
673
+ }
674
+ };
675
+ const handleSelect = (option) => {
676
+ const currentValues = Array.isArray(props.value) ? props.value : [];
677
+ const alreadySelected = currentValues.some((v) => v.value === option.value);
678
+ const newValues = alreadySelected
679
+ ? currentValues.filter((v) => v.value !== option.value)
680
+ : [...currentValues, option];
681
+ props.onChange(newValues.length > 0 ? newValues : null);
682
+ setSearchText('');
683
+ const newFiltered = options.filter((opt) => normalize(opt.label).includes(normalize('')));
684
+ const newIndex = newFiltered.findIndex((o) => o.value === option.value);
685
+ setHighlightedIndex(newIndex);
686
+ };
687
+ const hasError = !!error && !disabled;
688
+ const isInputDisabled = disabled || isLoading;
689
+ useEffect(() => {
690
+ const handleClickOutside = (event) => {
691
+ if (containerRef.current &&
692
+ !containerRef.current.contains(event.target)) {
693
+ setIsOpen(false);
694
+ setSearchText('');
695
+ setHighlightedIndex(-1);
696
+ }
697
+ };
698
+ document.addEventListener('mousedown', handleClickOutside);
699
+ return () => {
700
+ document.removeEventListener('mousedown', handleClickOutside);
701
+ };
702
+ }, []);
703
+ const selectedText = () => {
704
+ const selected = Array.isArray(props.value) ? props.value : [];
705
+ if (selected.length === 0)
706
+ return '';
707
+ if (selected.length === 1)
708
+ return selected[0].label;
709
+ return `${selected.length} itens selecionados`;
710
+ };
711
+ useEffect(() => {
712
+ const selected = Array.isArray(props.value) ? props.value : [];
713
+ if (selected.length === 0) {
714
+ setVisibleText('');
715
+ }
716
+ else if (selected.length === 1) {
717
+ setVisibleText(selected[0].label);
718
+ }
719
+ else {
720
+ const count = selected.length;
721
+ setVisibleText(`${count} itens selecionados`);
722
+ }
723
+ }, [props.value]);
724
+ return (jsx(Fragment, { children: jsxs("div", { ref: containerRef, className: "relative flex flex-col w-100", children: [jsxs("div", { className: "relative w-full cursor-pointer", onClick: toggleDropdown, children: [jsx(FloatingLabel, { value: selectedText(), label: label, disabled: isInputDisabled, error: error }), jsxs(IconField, { className: "w-full", children: [jsx(InputText, { placeholder: placeholder, type: "text", value: isLoading
725
+ ? 'Carregando...'
726
+ : isOpen && !isReadOnly
727
+ ? searchText
728
+ : visibleText, onChange: (e) => {
729
+ setSearchText(e.target.value);
730
+ if (!isOpen)
731
+ setIsOpen(true);
732
+ setHighlightedIndex(-1);
733
+ }, onKeyDown: (e) => {
734
+ if (!isOpen)
735
+ return;
736
+ if (e.key === 'ArrowDown') {
737
+ e.preventDefault();
738
+ setHighlightedIndex((prev) => prev < filteredOptions.length - 1 ? prev + 1 : 0);
739
+ }
740
+ if (e.key === 'ArrowUp') {
741
+ e.preventDefault();
742
+ setHighlightedIndex((prev) => prev > 0 ? prev - 1 : filteredOptions.length - 1);
743
+ }
744
+ if (e.key === 'Enter') {
745
+ e.preventDefault();
746
+ if (highlightedIndex >= 0 &&
747
+ highlightedIndex < filteredOptions.length) {
748
+ handleSelect(filteredOptions[highlightedIndex]);
749
+ }
750
+ }
751
+ if (e.key === 'Escape') {
752
+ e.preventDefault();
753
+ setIsOpen(false);
754
+ setSearchText('');
755
+ setHighlightedIndex(-1);
756
+ }
757
+ }, onClick: toggleDropdown, className: clsx('focus:shadow-none text-base w-100 font-roboto border !p-2 rounded-md', hasError
758
+ ? 'border-redError placeholder:text-redError'
759
+ : 'border-gray focus:border-primary', isInputDisabled && 'border-stoneDark text-disabled', error && 'border-redError text-redError', !error && 'border-gray placeholder:text-gray', isLoading && 'text-gray', 'truncate'), invalid: hasError, readOnly: !isOpen || isReadOnly, style: { height: '42px', fontSize: '16px' }, disabled: isInputDisabled, "aria-label": ariaLabel }), jsx(InputIcon, { className: clsx(isLoading
760
+ ? 'pi pi-spinner pi-spin'
761
+ : isOpen
762
+ ? 'pi pi-angle-up'
763
+ : 'pi pi-angle-down', 'text-gray px-2 flex items-center cursor-pointer', isInputDisabled && 'text-disabled', error && 'text-redError'), onClick: toggleDropdown })] })] }), isOpen && !isLoading && (jsx("div", { className: clsx('absolute w-full bg-background border shadow-md z-40 rounded-md -bottom-1 translate-y-full', error ? 'border-redError' : 'border-gray'), children: jsx("div", { children: jsx("ul", { className: "max-h-60 overflow-y-auto", children: filteredOptions.map((option, index) => (jsxs("li", { onClick: () => handleSelect(option), className: clsx('p-2 flex justify-between items-center cursor-pointer', 'hover:bg-stoneBackground hover:font-bold', index === highlightedIndex &&
764
+ 'bg-stoneBackground font-bold'), title: option.label, children: [jsx("span", { className: "truncate max-w-[calc(100%-20px)]", children: option.label }), jsx("input", { type: 'checkbox', checked: Array.isArray(props.value) &&
765
+ props.value.some((v) => v.value === option.value), onChange: () => handleSelect(option), className: clsx('appearance-none w-2 h-2 ring-1 ring-offset-2 ring-offset-background ring-gray checked:bg-primary cursor-pointer rounded-md') })] }, option.value))) }) }) })), hasError && (jsx("span", { className: "text-redError text-xs px-2", children: error }))] }) }));
766
+ }
767
+
768
+ function FilterIcon({ color }) {
769
+ return (jsx("svg", { width: "16", height: "15", viewBox: "0 0 16 15", fill: "none", children: jsx("path", { d: "M14.3164 0.75C14.918 0.75 15.2188 1.46094 14.7812 1.87109L9.75 6.92969V14.0938C9.75 14.6406 9.14844 14.9414 8.71094 14.6406L6.52344 13.1094C6.33203 13 6.25 12.7812 6.25 12.5625V6.92969L1.19141 1.87109C0.753906 1.46094 1.05469 0.75 1.65625 0.75H14.3164Z", fill: color }) }));
770
+ }
771
+
772
+ /**
773
+ * @module constants
774
+ * @summary Useful constants
775
+ * @description
776
+ * Collection of useful date constants.
777
+ *
778
+ * The constants could be imported from `date-fns/constants`:
779
+ *
780
+ * ```ts
781
+ * import { maxTime, minTime } from "./constants/date-fns/constants";
782
+ *
783
+ * function isAllowedTime(time) {
784
+ * return time <= maxTime && time >= minTime;
785
+ * }
786
+ * ```
787
+ */
788
+
789
+
790
+ /**
791
+ * @constant
792
+ * @name millisecondsInWeek
793
+ * @summary Milliseconds in 1 week.
794
+ */
795
+ const millisecondsInWeek = 604800000;
796
+
797
+ /**
798
+ * @constant
799
+ * @name millisecondsInDay
800
+ * @summary Milliseconds in 1 day.
801
+ */
802
+ const millisecondsInDay = 86400000;
803
+
804
+ /**
805
+ * @constant
806
+ * @name constructFromSymbol
807
+ * @summary Symbol enabling Date extensions to inherit properties from the reference date.
808
+ *
809
+ * The symbol is used to enable the `constructFrom` function to construct a date
810
+ * using a reference date and a value. It allows to transfer extra properties
811
+ * from the reference date to the new date. It's useful for extensions like
812
+ * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as
813
+ * a constructor argument.
814
+ */
815
+ const constructFromSymbol = Symbol.for("constructDateFrom");
816
+
817
+ /**
818
+ * @name constructFrom
819
+ * @category Generic Helpers
820
+ * @summary Constructs a date using the reference date and the value
821
+ *
822
+ * @description
823
+ * The function constructs a new date using the constructor from the reference
824
+ * date and the given value. It helps to build generic functions that accept
825
+ * date extensions.
826
+ *
827
+ * It defaults to `Date` if the passed reference date is a number or a string.
828
+ *
829
+ * Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]`
830
+ * enabling to transfer extra properties from the reference date to the new date.
831
+ * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
832
+ * that accept a time zone as a constructor argument.
833
+ *
834
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
835
+ *
836
+ * @param date - The reference date to take constructor from
837
+ * @param value - The value to create the date
838
+ *
839
+ * @returns Date initialized using the given date and value
840
+ *
841
+ * @example
842
+ * import { constructFrom } from "./constructFrom/date-fns";
843
+ *
844
+ * // A function that clones a date preserving the original type
845
+ * function cloneDate<DateType extends Date>(date: DateType): DateType {
846
+ * return constructFrom(
847
+ * date, // Use constructor from the given date
848
+ * date.getTime() // Use the date value to create a new date
849
+ * );
850
+ * }
851
+ */
852
+ function constructFrom(date, value) {
853
+ if (typeof date === "function") return date(value);
854
+
855
+ if (date && typeof date === "object" && constructFromSymbol in date)
856
+ return date[constructFromSymbol](value);
857
+
858
+ if (date instanceof Date) return new date.constructor(value);
859
+
860
+ return new Date(value);
861
+ }
862
+
863
+ /**
864
+ * @name toDate
865
+ * @category Common Helpers
866
+ * @summary Convert the given argument to an instance of Date.
867
+ *
868
+ * @description
869
+ * Convert the given argument to an instance of Date.
870
+ *
871
+ * If the argument is an instance of Date, the function returns its clone.
872
+ *
873
+ * If the argument is a number, it is treated as a timestamp.
874
+ *
875
+ * If the argument is none of the above, the function returns Invalid Date.
876
+ *
877
+ * Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]`
878
+ * enabling to transfer extra properties from the reference date to the new date.
879
+ * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
880
+ * that accept a time zone as a constructor argument.
881
+ *
882
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
883
+ *
884
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
885
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
886
+ *
887
+ * @param argument - The value to convert
888
+ *
889
+ * @returns The parsed date in the local time zone
890
+ *
891
+ * @example
892
+ * // Clone the date:
893
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
894
+ * //=> Tue Feb 11 2014 11:30:30
895
+ *
896
+ * @example
897
+ * // Convert the timestamp to date:
898
+ * const result = toDate(1392098430000)
899
+ * //=> Tue Feb 11 2014 11:30:30
900
+ */
901
+ function toDate(argument, context) {
902
+ // [TODO] Get rid of `toDate` or `constructFrom`?
903
+ return constructFrom(context || argument, argument);
904
+ }
905
+
906
+ let defaultOptions = {};
907
+
908
+ function getDefaultOptions() {
909
+ return defaultOptions;
910
+ }
911
+
912
+ /**
913
+ * The {@link startOfWeek} function options.
914
+ */
915
+
916
+ /**
917
+ * @name startOfWeek
918
+ * @category Week Helpers
919
+ * @summary Return the start of a week for the given date.
920
+ *
921
+ * @description
922
+ * Return the start of a week for the given date.
923
+ * The result will be in the local timezone.
924
+ *
925
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
926
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
927
+ *
928
+ * @param date - The original date
929
+ * @param options - An object with options
930
+ *
931
+ * @returns The start of a week
932
+ *
933
+ * @example
934
+ * // The start of a week for 2 September 2014 11:55:00:
935
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
936
+ * //=> Sun Aug 31 2014 00:00:00
937
+ *
938
+ * @example
939
+ * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
940
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
941
+ * //=> Mon Sep 01 2014 00:00:00
942
+ */
943
+ function startOfWeek(date, options) {
944
+ const defaultOptions = getDefaultOptions();
945
+ const weekStartsOn =
946
+ options?.weekStartsOn ??
947
+ options?.locale?.options?.weekStartsOn ??
948
+ defaultOptions.weekStartsOn ??
949
+ defaultOptions.locale?.options?.weekStartsOn ??
950
+ 0;
951
+
952
+ const _date = toDate(date, options?.in);
953
+ const day = _date.getDay();
954
+ const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
955
+
956
+ _date.setDate(_date.getDate() - diff);
957
+ _date.setHours(0, 0, 0, 0);
958
+ return _date;
959
+ }
960
+
961
+ /**
962
+ * The {@link startOfISOWeek} function options.
963
+ */
964
+
965
+ /**
966
+ * @name startOfISOWeek
967
+ * @category ISO Week Helpers
968
+ * @summary Return the start of an ISO week for the given date.
969
+ *
970
+ * @description
971
+ * Return the start of an ISO week for the given date.
972
+ * The result will be in the local timezone.
973
+ *
974
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
975
+ *
976
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
977
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
978
+ *
979
+ * @param date - The original date
980
+ * @param options - An object with options
981
+ *
982
+ * @returns The start of an ISO week
983
+ *
984
+ * @example
985
+ * // The start of an ISO week for 2 September 2014 11:55:00:
986
+ * const result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
987
+ * //=> Mon Sep 01 2014 00:00:00
988
+ */
989
+ function startOfISOWeek(date, options) {
990
+ return startOfWeek(date, { ...options, weekStartsOn: 1 });
991
+ }
992
+
993
+ /**
994
+ * The {@link getISOWeekYear} function options.
995
+ */
996
+
997
+ /**
998
+ * @name getISOWeekYear
999
+ * @category ISO Week-Numbering Year Helpers
1000
+ * @summary Get the ISO week-numbering year of the given date.
1001
+ *
1002
+ * @description
1003
+ * Get the ISO week-numbering year of the given date,
1004
+ * which always starts 3 days before the year's first Thursday.
1005
+ *
1006
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
1007
+ *
1008
+ * @param date - The given date
1009
+ *
1010
+ * @returns The ISO week-numbering year
1011
+ *
1012
+ * @example
1013
+ * // Which ISO-week numbering year is 2 January 2005?
1014
+ * const result = getISOWeekYear(new Date(2005, 0, 2))
1015
+ * //=> 2004
1016
+ */
1017
+ function getISOWeekYear(date, options) {
1018
+ const _date = toDate(date, options?.in);
1019
+ const year = _date.getFullYear();
1020
+
1021
+ const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
1022
+ fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
1023
+ fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
1024
+ const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
1025
+
1026
+ const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
1027
+ fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
1028
+ fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
1029
+ const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
1030
+
1031
+ if (_date.getTime() >= startOfNextYear.getTime()) {
1032
+ return year + 1;
1033
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
1034
+ return year;
1035
+ } else {
1036
+ return year - 1;
1037
+ }
1038
+ }
1039
+
1040
+ /**
1041
+ * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
1042
+ * They usually appear for dates that denote time before the timezones were introduced
1043
+ * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
1044
+ * and GMT+01:00:00 after that date)
1045
+ *
1046
+ * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
1047
+ * which would lead to incorrect calculations.
1048
+ *
1049
+ * This function returns the timezone offset in milliseconds that takes seconds in account.
1050
+ */
1051
+ function getTimezoneOffsetInMilliseconds(date) {
1052
+ const _date = toDate(date);
1053
+ const utcDate = new Date(
1054
+ Date.UTC(
1055
+ _date.getFullYear(),
1056
+ _date.getMonth(),
1057
+ _date.getDate(),
1058
+ _date.getHours(),
1059
+ _date.getMinutes(),
1060
+ _date.getSeconds(),
1061
+ _date.getMilliseconds(),
1062
+ ),
1063
+ );
1064
+ utcDate.setUTCFullYear(_date.getFullYear());
1065
+ return +date - +utcDate;
1066
+ }
1067
+
1068
+ function normalizeDates(context, ...dates) {
1069
+ const normalize = constructFrom.bind(
1070
+ null,
1071
+ dates.find((date) => typeof date === "object"),
1072
+ );
1073
+ return dates.map(normalize);
1074
+ }
1075
+
1076
+ /**
1077
+ * The {@link startOfDay} function options.
1078
+ */
1079
+
1080
+ /**
1081
+ * @name startOfDay
1082
+ * @category Day Helpers
1083
+ * @summary Return the start of a day for the given date.
1084
+ *
1085
+ * @description
1086
+ * Return the start of a day for the given date.
1087
+ * The result will be in the local timezone.
1088
+ *
1089
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
1090
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
1091
+ *
1092
+ * @param date - The original date
1093
+ * @param options - The options
1094
+ *
1095
+ * @returns The start of a day
1096
+ *
1097
+ * @example
1098
+ * // The start of a day for 2 September 2014 11:55:00:
1099
+ * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
1100
+ * //=> Tue Sep 02 2014 00:00:00
1101
+ */
1102
+ function startOfDay(date, options) {
1103
+ const _date = toDate(date, options?.in);
1104
+ _date.setHours(0, 0, 0, 0);
1105
+ return _date;
1106
+ }
1107
+
1108
+ /**
1109
+ * The {@link differenceInCalendarDays} function options.
1110
+ */
1111
+
1112
+ /**
1113
+ * @name differenceInCalendarDays
1114
+ * @category Day Helpers
1115
+ * @summary Get the number of calendar days between the given dates.
1116
+ *
1117
+ * @description
1118
+ * Get the number of calendar days between the given dates. This means that the times are removed
1119
+ * from the dates and then the difference in days is calculated.
1120
+ *
1121
+ * @param laterDate - The later date
1122
+ * @param earlierDate - The earlier date
1123
+ * @param options - The options object
1124
+ *
1125
+ * @returns The number of calendar days
1126
+ *
1127
+ * @example
1128
+ * // How many calendar days are between
1129
+ * // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
1130
+ * const result = differenceInCalendarDays(
1131
+ * new Date(2012, 6, 2, 0, 0),
1132
+ * new Date(2011, 6, 2, 23, 0)
1133
+ * )
1134
+ * //=> 366
1135
+ * // How many calendar days are between
1136
+ * // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
1137
+ * const result = differenceInCalendarDays(
1138
+ * new Date(2011, 6, 3, 0, 1),
1139
+ * new Date(2011, 6, 2, 23, 59)
1140
+ * )
1141
+ * //=> 1
1142
+ */
1143
+ function differenceInCalendarDays(laterDate, earlierDate, options) {
1144
+ const [laterDate_, earlierDate_] = normalizeDates(
1145
+ options?.in,
1146
+ laterDate,
1147
+ earlierDate,
1148
+ );
1149
+
1150
+ const laterStartOfDay = startOfDay(laterDate_);
1151
+ const earlierStartOfDay = startOfDay(earlierDate_);
1152
+
1153
+ const laterTimestamp =
1154
+ +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
1155
+ const earlierTimestamp =
1156
+ +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
1157
+
1158
+ // Round the number of days to the nearest integer because the number of
1159
+ // milliseconds in a day is not constant (e.g. it's different in the week of
1160
+ // the daylight saving time clock shift).
1161
+ return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
1162
+ }
1163
+
1164
+ /**
1165
+ * The {@link startOfISOWeekYear} function options.
1166
+ */
1167
+
1168
+ /**
1169
+ * @name startOfISOWeekYear
1170
+ * @category ISO Week-Numbering Year Helpers
1171
+ * @summary Return the start of an ISO week-numbering year for the given date.
1172
+ *
1173
+ * @description
1174
+ * Return the start of an ISO week-numbering year,
1175
+ * which always starts 3 days before the year's first Thursday.
1176
+ * The result will be in the local timezone.
1177
+ *
1178
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
1179
+ *
1180
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
1181
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
1182
+ *
1183
+ * @param date - The original date
1184
+ * @param options - An object with options
1185
+ *
1186
+ * @returns The start of an ISO week-numbering year
1187
+ *
1188
+ * @example
1189
+ * // The start of an ISO week-numbering year for 2 July 2005:
1190
+ * const result = startOfISOWeekYear(new Date(2005, 6, 2))
1191
+ * //=> Mon Jan 03 2005 00:00:00
1192
+ */
1193
+ function startOfISOWeekYear(date, options) {
1194
+ const year = getISOWeekYear(date, options);
1195
+ const fourthOfJanuary = constructFrom(date, 0);
1196
+ fourthOfJanuary.setFullYear(year, 0, 4);
1197
+ fourthOfJanuary.setHours(0, 0, 0, 0);
1198
+ return startOfISOWeek(fourthOfJanuary);
1199
+ }
1200
+
1201
+ /**
1202
+ * @name isDate
1203
+ * @category Common Helpers
1204
+ * @summary Is the given value a date?
1205
+ *
1206
+ * @description
1207
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
1208
+ *
1209
+ * @param value - The value to check
1210
+ *
1211
+ * @returns True if the given value is a date
1212
+ *
1213
+ * @example
1214
+ * // For a valid date:
1215
+ * const result = isDate(new Date())
1216
+ * //=> true
1217
+ *
1218
+ * @example
1219
+ * // For an invalid date:
1220
+ * const result = isDate(new Date(NaN))
1221
+ * //=> true
1222
+ *
1223
+ * @example
1224
+ * // For some value:
1225
+ * const result = isDate('2014-02-31')
1226
+ * //=> false
1227
+ *
1228
+ * @example
1229
+ * // For an object:
1230
+ * const result = isDate({})
1231
+ * //=> false
1232
+ */
1233
+ function isDate(value) {
1234
+ return (
1235
+ value instanceof Date ||
1236
+ (typeof value === "object" &&
1237
+ Object.prototype.toString.call(value) === "[object Date]")
1238
+ );
1239
+ }
1240
+
1241
+ /**
1242
+ * @name isValid
1243
+ * @category Common Helpers
1244
+ * @summary Is the given date valid?
1245
+ *
1246
+ * @description
1247
+ * Returns false if argument is Invalid Date and true otherwise.
1248
+ * Argument is converted to Date using `toDate`. See [toDate](https://date-fns.org/docs/toDate)
1249
+ * Invalid Date is a Date, whose time value is NaN.
1250
+ *
1251
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
1252
+ *
1253
+ * @param date - The date to check
1254
+ *
1255
+ * @returns The date is valid
1256
+ *
1257
+ * @example
1258
+ * // For the valid date:
1259
+ * const result = isValid(new Date(2014, 1, 31))
1260
+ * //=> true
1261
+ *
1262
+ * @example
1263
+ * // For the value, convertible into a date:
1264
+ * const result = isValid(1393804800000)
1265
+ * //=> true
1266
+ *
1267
+ * @example
1268
+ * // For the invalid date:
1269
+ * const result = isValid(new Date(''))
1270
+ * //=> false
1271
+ */
1272
+ function isValid(date) {
1273
+ return !((!isDate(date) && typeof date !== "number") || isNaN(+toDate(date)));
1274
+ }
1275
+
1276
+ /**
1277
+ * The {@link startOfYear} function options.
1278
+ */
1279
+
1280
+ /**
1281
+ * @name startOfYear
1282
+ * @category Year Helpers
1283
+ * @summary Return the start of a year for the given date.
1284
+ *
1285
+ * @description
1286
+ * Return the start of a year for the given date.
1287
+ * The result will be in the local timezone.
1288
+ *
1289
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
1290
+ * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
1291
+ *
1292
+ * @param date - The original date
1293
+ * @param options - The options
1294
+ *
1295
+ * @returns The start of a year
1296
+ *
1297
+ * @example
1298
+ * // The start of a year for 2 September 2014 11:55:00:
1299
+ * const result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
1300
+ * //=> Wed Jan 01 2014 00:00:00
1301
+ */
1302
+ function startOfYear(date, options) {
1303
+ const date_ = toDate(date, options?.in);
1304
+ date_.setFullYear(date_.getFullYear(), 0, 1);
1305
+ date_.setHours(0, 0, 0, 0);
1306
+ return date_;
1307
+ }
1308
+
1309
+ const formatDistanceLocale$1 = {
1310
+ lessThanXSeconds: {
1311
+ one: "less than a second",
1312
+ other: "less than {{count}} seconds",
1313
+ },
1314
+
1315
+ xSeconds: {
1316
+ one: "1 second",
1317
+ other: "{{count}} seconds",
1318
+ },
1319
+
1320
+ halfAMinute: "half a minute",
1321
+
1322
+ lessThanXMinutes: {
1323
+ one: "less than a minute",
1324
+ other: "less than {{count}} minutes",
1325
+ },
1326
+
1327
+ xMinutes: {
1328
+ one: "1 minute",
1329
+ other: "{{count}} minutes",
1330
+ },
1331
+
1332
+ aboutXHours: {
1333
+ one: "about 1 hour",
1334
+ other: "about {{count}} hours",
1335
+ },
1336
+
1337
+ xHours: {
1338
+ one: "1 hour",
1339
+ other: "{{count}} hours",
1340
+ },
1341
+
1342
+ xDays: {
1343
+ one: "1 day",
1344
+ other: "{{count}} days",
1345
+ },
1346
+
1347
+ aboutXWeeks: {
1348
+ one: "about 1 week",
1349
+ other: "about {{count}} weeks",
1350
+ },
1351
+
1352
+ xWeeks: {
1353
+ one: "1 week",
1354
+ other: "{{count}} weeks",
1355
+ },
1356
+
1357
+ aboutXMonths: {
1358
+ one: "about 1 month",
1359
+ other: "about {{count}} months",
1360
+ },
1361
+
1362
+ xMonths: {
1363
+ one: "1 month",
1364
+ other: "{{count}} months",
1365
+ },
1366
+
1367
+ aboutXYears: {
1368
+ one: "about 1 year",
1369
+ other: "about {{count}} years",
1370
+ },
1371
+
1372
+ xYears: {
1373
+ one: "1 year",
1374
+ other: "{{count}} years",
1375
+ },
1376
+
1377
+ overXYears: {
1378
+ one: "over 1 year",
1379
+ other: "over {{count}} years",
1380
+ },
1381
+
1382
+ almostXYears: {
1383
+ one: "almost 1 year",
1384
+ other: "almost {{count}} years",
1385
+ },
1386
+ };
1387
+
1388
+ const formatDistance$1 = (token, count, options) => {
1389
+ let result;
1390
+
1391
+ const tokenValue = formatDistanceLocale$1[token];
1392
+ if (typeof tokenValue === "string") {
1393
+ result = tokenValue;
1394
+ } else if (count === 1) {
1395
+ result = tokenValue.one;
1396
+ } else {
1397
+ result = tokenValue.other.replace("{{count}}", count.toString());
1398
+ }
1399
+
1400
+ if (options?.addSuffix) {
1401
+ if (options.comparison && options.comparison > 0) {
1402
+ return "in " + result;
1403
+ } else {
1404
+ return result + " ago";
1405
+ }
1406
+ }
1407
+
1408
+ return result;
1409
+ };
1410
+
1411
+ function buildFormatLongFn(args) {
1412
+ return (options = {}) => {
1413
+ // TODO: Remove String()
1414
+ const width = options.width ? String(options.width) : args.defaultWidth;
1415
+ const format = args.formats[width] || args.formats[args.defaultWidth];
1416
+ return format;
1417
+ };
1418
+ }
1419
+
1420
+ const dateFormats$1 = {
1421
+ full: "EEEE, MMMM do, y",
1422
+ long: "MMMM do, y",
1423
+ medium: "MMM d, y",
1424
+ short: "MM/dd/yyyy",
1425
+ };
1426
+
1427
+ const timeFormats$1 = {
1428
+ full: "h:mm:ss a zzzz",
1429
+ long: "h:mm:ss a z",
1430
+ medium: "h:mm:ss a",
1431
+ short: "h:mm a",
1432
+ };
1433
+
1434
+ const dateTimeFormats$1 = {
1435
+ full: "{{date}} 'at' {{time}}",
1436
+ long: "{{date}} 'at' {{time}}",
1437
+ medium: "{{date}}, {{time}}",
1438
+ short: "{{date}}, {{time}}",
1439
+ };
1440
+
1441
+ const formatLong$1 = {
1442
+ date: buildFormatLongFn({
1443
+ formats: dateFormats$1,
1444
+ defaultWidth: "full",
1445
+ }),
1446
+
1447
+ time: buildFormatLongFn({
1448
+ formats: timeFormats$1,
1449
+ defaultWidth: "full",
1450
+ }),
1451
+
1452
+ dateTime: buildFormatLongFn({
1453
+ formats: dateTimeFormats$1,
1454
+ defaultWidth: "full",
1455
+ }),
1456
+ };
1457
+
1458
+ const formatRelativeLocale$1 = {
1459
+ lastWeek: "'last' eeee 'at' p",
1460
+ yesterday: "'yesterday at' p",
1461
+ today: "'today at' p",
1462
+ tomorrow: "'tomorrow at' p",
1463
+ nextWeek: "eeee 'at' p",
1464
+ other: "P",
1465
+ };
1466
+
1467
+ const formatRelative$1 = (token, _date, _baseDate, _options) =>
1468
+ formatRelativeLocale$1[token];
1469
+
1470
+ /**
1471
+ * The localize function argument callback which allows to convert raw value to
1472
+ * the actual type.
1473
+ *
1474
+ * @param value - The value to convert
1475
+ *
1476
+ * @returns The converted value
1477
+ */
1478
+
1479
+ /**
1480
+ * The map of localized values for each width.
1481
+ */
1482
+
1483
+ /**
1484
+ * The index type of the locale unit value. It types conversion of units of
1485
+ * values that don't start at 0 (i.e. quarters).
1486
+ */
1487
+
1488
+ /**
1489
+ * Converts the unit value to the tuple of values.
1490
+ */
1491
+
1492
+ /**
1493
+ * The tuple of localized era values. The first element represents BC,
1494
+ * the second element represents AD.
1495
+ */
1496
+
1497
+ /**
1498
+ * The tuple of localized quarter values. The first element represents Q1.
1499
+ */
1500
+
1501
+ /**
1502
+ * The tuple of localized day values. The first element represents Sunday.
1503
+ */
1504
+
1505
+ /**
1506
+ * The tuple of localized month values. The first element represents January.
1507
+ */
1508
+
1509
+ function buildLocalizeFn(args) {
1510
+ return (value, options) => {
1511
+ const context = options?.context ? String(options.context) : "standalone";
1512
+
1513
+ let valuesArray;
1514
+ if (context === "formatting" && args.formattingValues) {
1515
+ const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
1516
+ const width = options?.width ? String(options.width) : defaultWidth;
1517
+
1518
+ valuesArray =
1519
+ args.formattingValues[width] || args.formattingValues[defaultWidth];
1520
+ } else {
1521
+ const defaultWidth = args.defaultWidth;
1522
+ const width = options?.width ? String(options.width) : args.defaultWidth;
1523
+
1524
+ valuesArray = args.values[width] || args.values[defaultWidth];
1525
+ }
1526
+ const index = args.argumentCallback ? args.argumentCallback(value) : value;
1527
+
1528
+ // @ts-expect-error - 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!
1529
+ return valuesArray[index];
1530
+ };
1531
+ }
1532
+
1533
+ const eraValues$1 = {
1534
+ narrow: ["B", "A"],
1535
+ abbreviated: ["BC", "AD"],
1536
+ wide: ["Before Christ", "Anno Domini"],
1537
+ };
1538
+
1539
+ const quarterValues$1 = {
1540
+ narrow: ["1", "2", "3", "4"],
1541
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
1542
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"],
1543
+ };
1544
+
1545
+ // Note: in English, the names of days of the week and months are capitalized.
1546
+ // If you are making a new locale based on this one, check if the same is true for the language you're working on.
1547
+ // Generally, formatted dates should look like they are in the middle of a sentence,
1548
+ // e.g. in Spanish language the weekdays and months should be in the lowercase.
1549
+ const monthValues$1 = {
1550
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
1551
+ abbreviated: [
1552
+ "Jan",
1553
+ "Feb",
1554
+ "Mar",
1555
+ "Apr",
1556
+ "May",
1557
+ "Jun",
1558
+ "Jul",
1559
+ "Aug",
1560
+ "Sep",
1561
+ "Oct",
1562
+ "Nov",
1563
+ "Dec",
1564
+ ],
1565
+
1566
+ wide: [
1567
+ "January",
1568
+ "February",
1569
+ "March",
1570
+ "April",
1571
+ "May",
1572
+ "June",
1573
+ "July",
1574
+ "August",
1575
+ "September",
1576
+ "October",
1577
+ "November",
1578
+ "December",
1579
+ ],
1580
+ };
1581
+
1582
+ const dayValues$1 = {
1583
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
1584
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
1585
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1586
+ wide: [
1587
+ "Sunday",
1588
+ "Monday",
1589
+ "Tuesday",
1590
+ "Wednesday",
1591
+ "Thursday",
1592
+ "Friday",
1593
+ "Saturday",
1594
+ ],
1595
+ };
1596
+
1597
+ const dayPeriodValues$1 = {
1598
+ narrow: {
1599
+ am: "a",
1600
+ pm: "p",
1601
+ midnight: "mi",
1602
+ noon: "n",
1603
+ morning: "morning",
1604
+ afternoon: "afternoon",
1605
+ evening: "evening",
1606
+ night: "night",
1607
+ },
1608
+ abbreviated: {
1609
+ am: "AM",
1610
+ pm: "PM",
1611
+ midnight: "midnight",
1612
+ noon: "noon",
1613
+ morning: "morning",
1614
+ afternoon: "afternoon",
1615
+ evening: "evening",
1616
+ night: "night",
1617
+ },
1618
+ wide: {
1619
+ am: "a.m.",
1620
+ pm: "p.m.",
1621
+ midnight: "midnight",
1622
+ noon: "noon",
1623
+ morning: "morning",
1624
+ afternoon: "afternoon",
1625
+ evening: "evening",
1626
+ night: "night",
1627
+ },
1628
+ };
1629
+
1630
+ const formattingDayPeriodValues$1 = {
1631
+ narrow: {
1632
+ am: "a",
1633
+ pm: "p",
1634
+ midnight: "mi",
1635
+ noon: "n",
1636
+ morning: "in the morning",
1637
+ afternoon: "in the afternoon",
1638
+ evening: "in the evening",
1639
+ night: "at night",
1640
+ },
1641
+ abbreviated: {
1642
+ am: "AM",
1643
+ pm: "PM",
1644
+ midnight: "midnight",
1645
+ noon: "noon",
1646
+ morning: "in the morning",
1647
+ afternoon: "in the afternoon",
1648
+ evening: "in the evening",
1649
+ night: "at night",
1650
+ },
1651
+ wide: {
1652
+ am: "a.m.",
1653
+ pm: "p.m.",
1654
+ midnight: "midnight",
1655
+ noon: "noon",
1656
+ morning: "in the morning",
1657
+ afternoon: "in the afternoon",
1658
+ evening: "in the evening",
1659
+ night: "at night",
1660
+ },
1661
+ };
1662
+
1663
+ const ordinalNumber$1 = (dirtyNumber, _options) => {
1664
+ const number = Number(dirtyNumber);
1665
+
1666
+ // If ordinal numbers depend on context, for example,
1667
+ // if they are different for different grammatical genders,
1668
+ // use `options.unit`.
1669
+ //
1670
+ // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
1671
+ // 'day', 'hour', 'minute', 'second'.
1672
+
1673
+ const rem100 = number % 100;
1674
+ if (rem100 > 20 || rem100 < 10) {
1675
+ switch (rem100 % 10) {
1676
+ case 1:
1677
+ return number + "st";
1678
+ case 2:
1679
+ return number + "nd";
1680
+ case 3:
1681
+ return number + "rd";
1682
+ }
1683
+ }
1684
+ return number + "th";
1685
+ };
1686
+
1687
+ const localize$1 = {
1688
+ ordinalNumber: ordinalNumber$1,
1689
+
1690
+ era: buildLocalizeFn({
1691
+ values: eraValues$1,
1692
+ defaultWidth: "wide",
1693
+ }),
1694
+
1695
+ quarter: buildLocalizeFn({
1696
+ values: quarterValues$1,
1697
+ defaultWidth: "wide",
1698
+ argumentCallback: (quarter) => quarter - 1,
1699
+ }),
1700
+
1701
+ month: buildLocalizeFn({
1702
+ values: monthValues$1,
1703
+ defaultWidth: "wide",
1704
+ }),
1705
+
1706
+ day: buildLocalizeFn({
1707
+ values: dayValues$1,
1708
+ defaultWidth: "wide",
1709
+ }),
1710
+
1711
+ dayPeriod: buildLocalizeFn({
1712
+ values: dayPeriodValues$1,
1713
+ defaultWidth: "wide",
1714
+ formattingValues: formattingDayPeriodValues$1,
1715
+ defaultFormattingWidth: "wide",
1716
+ }),
1717
+ };
1718
+
1719
+ function buildMatchFn(args) {
1720
+ return (string, options = {}) => {
1721
+ const width = options.width;
1722
+
1723
+ const matchPattern =
1724
+ (width && args.matchPatterns[width]) ||
1725
+ args.matchPatterns[args.defaultMatchWidth];
1726
+ const matchResult = string.match(matchPattern);
1727
+
1728
+ if (!matchResult) {
1729
+ return null;
1730
+ }
1731
+ const matchedString = matchResult[0];
1732
+
1733
+ const parsePatterns =
1734
+ (width && args.parsePatterns[width]) ||
1735
+ args.parsePatterns[args.defaultParseWidth];
1736
+
1737
+ const key = Array.isArray(parsePatterns)
1738
+ ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString))
1739
+ : // [TODO] -- I challenge you to fix the type
1740
+ findKey(parsePatterns, (pattern) => pattern.test(matchedString));
1741
+
1742
+ let value;
1743
+
1744
+ value = args.valueCallback ? args.valueCallback(key) : key;
1745
+ value = options.valueCallback
1746
+ ? // [TODO] -- I challenge you to fix the type
1747
+ options.valueCallback(value)
1748
+ : value;
1749
+
1750
+ const rest = string.slice(matchedString.length);
1751
+
1752
+ return { value, rest };
1753
+ };
1754
+ }
1755
+
1756
+ function findKey(object, predicate) {
1757
+ for (const key in object) {
1758
+ if (
1759
+ Object.prototype.hasOwnProperty.call(object, key) &&
1760
+ predicate(object[key])
1761
+ ) {
1762
+ return key;
1763
+ }
1764
+ }
1765
+ return undefined;
1766
+ }
1767
+
1768
+ function findIndex(array, predicate) {
1769
+ for (let key = 0; key < array.length; key++) {
1770
+ if (predicate(array[key])) {
1771
+ return key;
1772
+ }
1773
+ }
1774
+ return undefined;
1775
+ }
1776
+
1777
+ function buildMatchPatternFn(args) {
1778
+ return (string, options = {}) => {
1779
+ const matchResult = string.match(args.matchPattern);
1780
+ if (!matchResult) return null;
1781
+ const matchedString = matchResult[0];
1782
+
1783
+ const parseResult = string.match(args.parsePattern);
1784
+ if (!parseResult) return null;
1785
+ let value = args.valueCallback
1786
+ ? args.valueCallback(parseResult[0])
1787
+ : parseResult[0];
1788
+
1789
+ // [TODO] I challenge you to fix the type
1790
+ value = options.valueCallback ? options.valueCallback(value) : value;
1791
+
1792
+ const rest = string.slice(matchedString.length);
1793
+
1794
+ return { value, rest };
1795
+ };
1796
+ }
1797
+
1798
+ const matchOrdinalNumberPattern$1 = /^(\d+)(th|st|nd|rd)?/i;
1799
+ const parseOrdinalNumberPattern$1 = /\d+/i;
1800
+
1801
+ const matchEraPatterns$1 = {
1802
+ narrow: /^(b|a)/i,
1803
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
1804
+ wide: /^(before christ|before common era|anno domini|common era)/i,
1805
+ };
1806
+ const parseEraPatterns$1 = {
1807
+ any: [/^b/i, /^(a|c)/i],
1808
+ };
1809
+
1810
+ const matchQuarterPatterns$1 = {
1811
+ narrow: /^[1234]/i,
1812
+ abbreviated: /^q[1234]/i,
1813
+ wide: /^[1234](th|st|nd|rd)? quarter/i,
1814
+ };
1815
+ const parseQuarterPatterns$1 = {
1816
+ any: [/1/i, /2/i, /3/i, /4/i],
1817
+ };
1818
+
1819
+ const matchMonthPatterns$1 = {
1820
+ narrow: /^[jfmasond]/i,
1821
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
1822
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i,
1823
+ };
1824
+ const parseMonthPatterns$1 = {
1825
+ narrow: [
1826
+ /^j/i,
1827
+ /^f/i,
1828
+ /^m/i,
1829
+ /^a/i,
1830
+ /^m/i,
1831
+ /^j/i,
1832
+ /^j/i,
1833
+ /^a/i,
1834
+ /^s/i,
1835
+ /^o/i,
1836
+ /^n/i,
1837
+ /^d/i,
1838
+ ],
1839
+
1840
+ any: [
1841
+ /^ja/i,
1842
+ /^f/i,
1843
+ /^mar/i,
1844
+ /^ap/i,
1845
+ /^may/i,
1846
+ /^jun/i,
1847
+ /^jul/i,
1848
+ /^au/i,
1849
+ /^s/i,
1850
+ /^o/i,
1851
+ /^n/i,
1852
+ /^d/i,
1853
+ ],
1854
+ };
1855
+
1856
+ const matchDayPatterns$1 = {
1857
+ narrow: /^[smtwf]/i,
1858
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
1859
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
1860
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i,
1861
+ };
1862
+ const parseDayPatterns$1 = {
1863
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
1864
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i],
1865
+ };
1866
+
1867
+ const matchDayPeriodPatterns$1 = {
1868
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
1869
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i,
1870
+ };
1871
+ const parseDayPeriodPatterns$1 = {
1872
+ any: {
1873
+ am: /^a/i,
1874
+ pm: /^p/i,
1875
+ midnight: /^mi/i,
1876
+ noon: /^no/i,
1877
+ morning: /morning/i,
1878
+ afternoon: /afternoon/i,
1879
+ evening: /evening/i,
1880
+ night: /night/i,
1881
+ },
1882
+ };
1883
+
1884
+ const match$1 = {
1885
+ ordinalNumber: buildMatchPatternFn({
1886
+ matchPattern: matchOrdinalNumberPattern$1,
1887
+ parsePattern: parseOrdinalNumberPattern$1,
1888
+ valueCallback: (value) => parseInt(value, 10),
1889
+ }),
1890
+
1891
+ era: buildMatchFn({
1892
+ matchPatterns: matchEraPatterns$1,
1893
+ defaultMatchWidth: "wide",
1894
+ parsePatterns: parseEraPatterns$1,
1895
+ defaultParseWidth: "any",
1896
+ }),
1897
+
1898
+ quarter: buildMatchFn({
1899
+ matchPatterns: matchQuarterPatterns$1,
1900
+ defaultMatchWidth: "wide",
1901
+ parsePatterns: parseQuarterPatterns$1,
1902
+ defaultParseWidth: "any",
1903
+ valueCallback: (index) => index + 1,
1904
+ }),
1905
+
1906
+ month: buildMatchFn({
1907
+ matchPatterns: matchMonthPatterns$1,
1908
+ defaultMatchWidth: "wide",
1909
+ parsePatterns: parseMonthPatterns$1,
1910
+ defaultParseWidth: "any",
1911
+ }),
1912
+
1913
+ day: buildMatchFn({
1914
+ matchPatterns: matchDayPatterns$1,
1915
+ defaultMatchWidth: "wide",
1916
+ parsePatterns: parseDayPatterns$1,
1917
+ defaultParseWidth: "any",
1918
+ }),
1919
+
1920
+ dayPeriod: buildMatchFn({
1921
+ matchPatterns: matchDayPeriodPatterns$1,
1922
+ defaultMatchWidth: "any",
1923
+ parsePatterns: parseDayPeriodPatterns$1,
1924
+ defaultParseWidth: "any",
1925
+ }),
1926
+ };
1927
+
1928
+ /**
1929
+ * @category Locales
1930
+ * @summary English locale (United States).
1931
+ * @language English
1932
+ * @iso-639-2 eng
1933
+ * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
1934
+ * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
1935
+ */
1936
+ const enUS = {
1937
+ code: "en-US",
1938
+ formatDistance: formatDistance$1,
1939
+ formatLong: formatLong$1,
1940
+ formatRelative: formatRelative$1,
1941
+ localize: localize$1,
1942
+ match: match$1,
1943
+ options: {
1944
+ weekStartsOn: 0 /* Sunday */,
1945
+ firstWeekContainsDate: 1,
1946
+ },
1947
+ };
1948
+
1949
+ /**
1950
+ * The {@link getDayOfYear} function options.
1951
+ */
1952
+
1953
+ /**
1954
+ * @name getDayOfYear
1955
+ * @category Day Helpers
1956
+ * @summary Get the day of the year of the given date.
1957
+ *
1958
+ * @description
1959
+ * Get the day of the year of the given date.
1960
+ *
1961
+ * @param date - The given date
1962
+ * @param options - The options
1963
+ *
1964
+ * @returns The day of year
1965
+ *
1966
+ * @example
1967
+ * // Which day of the year is 2 July 2014?
1968
+ * const result = getDayOfYear(new Date(2014, 6, 2))
1969
+ * //=> 183
1970
+ */
1971
+ function getDayOfYear(date, options) {
1972
+ const _date = toDate(date, options?.in);
1973
+ const diff = differenceInCalendarDays(_date, startOfYear(_date));
1974
+ const dayOfYear = diff + 1;
1975
+ return dayOfYear;
1976
+ }
1977
+
1978
+ /**
1979
+ * The {@link getISOWeek} function options.
1980
+ */
1981
+
1982
+ /**
1983
+ * @name getISOWeek
1984
+ * @category ISO Week Helpers
1985
+ * @summary Get the ISO week of the given date.
1986
+ *
1987
+ * @description
1988
+ * Get the ISO week of the given date.
1989
+ *
1990
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
1991
+ *
1992
+ * @param date - The given date
1993
+ * @param options - The options
1994
+ *
1995
+ * @returns The ISO week
1996
+ *
1997
+ * @example
1998
+ * // Which week of the ISO-week numbering year is 2 January 2005?
1999
+ * const result = getISOWeek(new Date(2005, 0, 2))
2000
+ * //=> 53
2001
+ */
2002
+ function getISOWeek(date, options) {
2003
+ const _date = toDate(date, options?.in);
2004
+ const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
2005
+
2006
+ // Round the number of weeks to the nearest integer because the number of
2007
+ // milliseconds in a week is not constant (e.g. it's different in the week of
2008
+ // the daylight saving time clock shift).
2009
+ return Math.round(diff / millisecondsInWeek) + 1;
2010
+ }
2011
+
2012
+ /**
2013
+ * The {@link getWeekYear} function options.
2014
+ */
2015
+
2016
+ /**
2017
+ * @name getWeekYear
2018
+ * @category Week-Numbering Year Helpers
2019
+ * @summary Get the local week-numbering year of the given date.
2020
+ *
2021
+ * @description
2022
+ * Get the local week-numbering year of the given date.
2023
+ * The exact calculation depends on the values of
2024
+ * `options.weekStartsOn` (which is the index of the first day of the week)
2025
+ * and `options.firstWeekContainsDate` (which is the day of January, which is always in
2026
+ * the first week of the week-numbering year)
2027
+ *
2028
+ * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
2029
+ *
2030
+ * @param date - The given date
2031
+ * @param options - An object with options.
2032
+ *
2033
+ * @returns The local week-numbering year
2034
+ *
2035
+ * @example
2036
+ * // Which week numbering year is 26 December 2004 with the default settings?
2037
+ * const result = getWeekYear(new Date(2004, 11, 26))
2038
+ * //=> 2005
2039
+ *
2040
+ * @example
2041
+ * // Which week numbering year is 26 December 2004 if week starts on Saturday?
2042
+ * const result = getWeekYear(new Date(2004, 11, 26), { weekStartsOn: 6 })
2043
+ * //=> 2004
2044
+ *
2045
+ * @example
2046
+ * // Which week numbering year is 26 December 2004 if the first week contains 4 January?
2047
+ * const result = getWeekYear(new Date(2004, 11, 26), { firstWeekContainsDate: 4 })
2048
+ * //=> 2004
2049
+ */
2050
+ function getWeekYear(date, options) {
2051
+ const _date = toDate(date, options?.in);
2052
+ const year = _date.getFullYear();
2053
+
2054
+ const defaultOptions = getDefaultOptions();
2055
+ const firstWeekContainsDate =
2056
+ options?.firstWeekContainsDate ??
2057
+ options?.locale?.options?.firstWeekContainsDate ??
2058
+ defaultOptions.firstWeekContainsDate ??
2059
+ defaultOptions.locale?.options?.firstWeekContainsDate ??
2060
+ 1;
2061
+
2062
+ const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
2063
+ firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
2064
+ firstWeekOfNextYear.setHours(0, 0, 0, 0);
2065
+ const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
2066
+
2067
+ const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
2068
+ firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
2069
+ firstWeekOfThisYear.setHours(0, 0, 0, 0);
2070
+ const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
2071
+
2072
+ if (+_date >= +startOfNextYear) {
2073
+ return year + 1;
2074
+ } else if (+_date >= +startOfThisYear) {
2075
+ return year;
2076
+ } else {
2077
+ return year - 1;
2078
+ }
2079
+ }
2080
+
2081
+ /**
2082
+ * The {@link startOfWeekYear} function options.
2083
+ */
2084
+
2085
+ /**
2086
+ * @name startOfWeekYear
2087
+ * @category Week-Numbering Year Helpers
2088
+ * @summary Return the start of a local week-numbering year for the given date.
2089
+ *
2090
+ * @description
2091
+ * Return the start of a local week-numbering year.
2092
+ * The exact calculation depends on the values of
2093
+ * `options.weekStartsOn` (which is the index of the first day of the week)
2094
+ * and `options.firstWeekContainsDate` (which is the day of January, which is always in
2095
+ * the first week of the week-numbering year)
2096
+ *
2097
+ * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
2098
+ *
2099
+ * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
2100
+ * @typeParam ResultDate - The result `Date` type.
2101
+ *
2102
+ * @param date - The original date
2103
+ * @param options - An object with options
2104
+ *
2105
+ * @returns The start of a week-numbering year
2106
+ *
2107
+ * @example
2108
+ * // The start of an a week-numbering year for 2 July 2005 with default settings:
2109
+ * const result = startOfWeekYear(new Date(2005, 6, 2))
2110
+ * //=> Sun Dec 26 2004 00:00:00
2111
+ *
2112
+ * @example
2113
+ * // The start of a week-numbering year for 2 July 2005
2114
+ * // if Monday is the first day of week
2115
+ * // and 4 January is always in the first week of the year:
2116
+ * const result = startOfWeekYear(new Date(2005, 6, 2), {
2117
+ * weekStartsOn: 1,
2118
+ * firstWeekContainsDate: 4
2119
+ * })
2120
+ * //=> Mon Jan 03 2005 00:00:00
2121
+ */
2122
+ function startOfWeekYear(date, options) {
2123
+ const defaultOptions = getDefaultOptions();
2124
+ const firstWeekContainsDate =
2125
+ options?.firstWeekContainsDate ??
2126
+ options?.locale?.options?.firstWeekContainsDate ??
2127
+ defaultOptions.firstWeekContainsDate ??
2128
+ defaultOptions.locale?.options?.firstWeekContainsDate ??
2129
+ 1;
2130
+
2131
+ const year = getWeekYear(date, options);
2132
+ const firstWeek = constructFrom(options?.in || date, 0);
2133
+ firstWeek.setFullYear(year, 0, firstWeekContainsDate);
2134
+ firstWeek.setHours(0, 0, 0, 0);
2135
+ const _date = startOfWeek(firstWeek, options);
2136
+ return _date;
2137
+ }
2138
+
2139
+ /**
2140
+ * The {@link getWeek} function options.
2141
+ */
2142
+
2143
+ /**
2144
+ * @name getWeek
2145
+ * @category Week Helpers
2146
+ * @summary Get the local week index of the given date.
2147
+ *
2148
+ * @description
2149
+ * Get the local week index of the given date.
2150
+ * The exact calculation depends on the values of
2151
+ * `options.weekStartsOn` (which is the index of the first day of the week)
2152
+ * and `options.firstWeekContainsDate` (which is the day of January, which is always in
2153
+ * the first week of the week-numbering year)
2154
+ *
2155
+ * Week numbering: https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system
2156
+ *
2157
+ * @param date - The given date
2158
+ * @param options - An object with options
2159
+ *
2160
+ * @returns The week
2161
+ *
2162
+ * @example
2163
+ * // Which week of the local week numbering year is 2 January 2005 with default options?
2164
+ * const result = getWeek(new Date(2005, 0, 2))
2165
+ * //=> 2
2166
+ *
2167
+ * @example
2168
+ * // Which week of the local week numbering year is 2 January 2005,
2169
+ * // if Monday is the first day of the week,
2170
+ * // and the first week of the year always contains 4 January?
2171
+ * const result = getWeek(new Date(2005, 0, 2), {
2172
+ * weekStartsOn: 1,
2173
+ * firstWeekContainsDate: 4
2174
+ * })
2175
+ * //=> 53
2176
+ */
2177
+ function getWeek(date, options) {
2178
+ const _date = toDate(date, options?.in);
2179
+ const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
2180
+
2181
+ // Round the number of weeks to the nearest integer because the number of
2182
+ // milliseconds in a week is not constant (e.g. it's different in the week of
2183
+ // the daylight saving time clock shift).
2184
+ return Math.round(diff / millisecondsInWeek) + 1;
2185
+ }
2186
+
2187
+ function addLeadingZeros(number, targetLength) {
2188
+ const sign = number < 0 ? "-" : "";
2189
+ const output = Math.abs(number).toString().padStart(targetLength, "0");
2190
+ return sign + output;
2191
+ }
2192
+
2193
+ /*
2194
+ * | | Unit | | Unit |
2195
+ * |-----|--------------------------------|-----|--------------------------------|
2196
+ * | a | AM, PM | A* | |
2197
+ * | d | Day of month | D | |
2198
+ * | h | Hour [1-12] | H | Hour [0-23] |
2199
+ * | m | Minute | M | Month |
2200
+ * | s | Second | S | Fraction of second |
2201
+ * | y | Year (abs) | Y | |
2202
+ *
2203
+ * Letters marked by * are not implemented but reserved by Unicode standard.
2204
+ */
2205
+
2206
+ const lightFormatters = {
2207
+ // Year
2208
+ y(date, token) {
2209
+ // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
2210
+ // | Year | y | yy | yyy | yyyy | yyyyy |
2211
+ // |----------|-------|----|-------|-------|-------|
2212
+ // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
2213
+ // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
2214
+ // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
2215
+ // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
2216
+ // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
2217
+
2218
+ const signedYear = date.getFullYear();
2219
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
2220
+ const year = signedYear > 0 ? signedYear : 1 - signedYear;
2221
+ return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
2222
+ },
2223
+
2224
+ // Month
2225
+ M(date, token) {
2226
+ const month = date.getMonth();
2227
+ return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
2228
+ },
2229
+
2230
+ // Day of the month
2231
+ d(date, token) {
2232
+ return addLeadingZeros(date.getDate(), token.length);
2233
+ },
2234
+
2235
+ // AM or PM
2236
+ a(date, token) {
2237
+ const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
2238
+
2239
+ switch (token) {
2240
+ case "a":
2241
+ case "aa":
2242
+ return dayPeriodEnumValue.toUpperCase();
2243
+ case "aaa":
2244
+ return dayPeriodEnumValue;
2245
+ case "aaaaa":
2246
+ return dayPeriodEnumValue[0];
2247
+ case "aaaa":
2248
+ default:
2249
+ return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
2250
+ }
2251
+ },
2252
+
2253
+ // Hour [1-12]
2254
+ h(date, token) {
2255
+ return addLeadingZeros(date.getHours() % 12 || 12, token.length);
2256
+ },
2257
+
2258
+ // Hour [0-23]
2259
+ H(date, token) {
2260
+ return addLeadingZeros(date.getHours(), token.length);
2261
+ },
2262
+
2263
+ // Minute
2264
+ m(date, token) {
2265
+ return addLeadingZeros(date.getMinutes(), token.length);
2266
+ },
2267
+
2268
+ // Second
2269
+ s(date, token) {
2270
+ return addLeadingZeros(date.getSeconds(), token.length);
2271
+ },
2272
+
2273
+ // Fraction of second
2274
+ S(date, token) {
2275
+ const numberOfDigits = token.length;
2276
+ const milliseconds = date.getMilliseconds();
2277
+ const fractionalSeconds = Math.trunc(
2278
+ milliseconds * Math.pow(10, numberOfDigits - 3),
2279
+ );
2280
+ return addLeadingZeros(fractionalSeconds, token.length);
2281
+ },
2282
+ };
2283
+
2284
+ const dayPeriodEnum = {
2285
+ midnight: "midnight",
2286
+ noon: "noon",
2287
+ morning: "morning",
2288
+ afternoon: "afternoon",
2289
+ evening: "evening",
2290
+ night: "night",
2291
+ };
2292
+
2293
+ /*
2294
+ * | | Unit | | Unit |
2295
+ * |-----|--------------------------------|-----|--------------------------------|
2296
+ * | a | AM, PM | A* | Milliseconds in day |
2297
+ * | b | AM, PM, noon, midnight | B | Flexible day period |
2298
+ * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
2299
+ * | d | Day of month | D | Day of year |
2300
+ * | e | Local day of week | E | Day of week |
2301
+ * | f | | F* | Day of week in month |
2302
+ * | g* | Modified Julian day | G | Era |
2303
+ * | h | Hour [1-12] | H | Hour [0-23] |
2304
+ * | i! | ISO day of week | I! | ISO week of year |
2305
+ * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
2306
+ * | k | Hour [1-24] | K | Hour [0-11] |
2307
+ * | l* | (deprecated) | L | Stand-alone month |
2308
+ * | m | Minute | M | Month |
2309
+ * | n | | N | |
2310
+ * | o! | Ordinal number modifier | O | Timezone (GMT) |
2311
+ * | p! | Long localized time | P! | Long localized date |
2312
+ * | q | Stand-alone quarter | Q | Quarter |
2313
+ * | r* | Related Gregorian year | R! | ISO week-numbering year |
2314
+ * | s | Second | S | Fraction of second |
2315
+ * | t! | Seconds timestamp | T! | Milliseconds timestamp |
2316
+ * | u | Extended year | U* | Cyclic year |
2317
+ * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
2318
+ * | w | Local week of year | W* | Week of month |
2319
+ * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
2320
+ * | y | Year (abs) | Y | Local week-numbering year |
2321
+ * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
2322
+ *
2323
+ * Letters marked by * are not implemented but reserved by Unicode standard.
2324
+ *
2325
+ * Letters marked by ! are non-standard, but implemented by date-fns:
2326
+ * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
2327
+ * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
2328
+ * i.e. 7 for Sunday, 1 for Monday, etc.
2329
+ * - `I` is ISO week of year, as opposed to `w` which is local week of year.
2330
+ * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
2331
+ * `R` is supposed to be used in conjunction with `I` and `i`
2332
+ * for universal ISO week-numbering date, whereas
2333
+ * `Y` is supposed to be used in conjunction with `w` and `e`
2334
+ * for week-numbering date specific to the locale.
2335
+ * - `P` is long localized date format
2336
+ * - `p` is long localized time format
2337
+ */
2338
+
2339
+ const formatters = {
2340
+ // Era
2341
+ G: function (date, token, localize) {
2342
+ const era = date.getFullYear() > 0 ? 1 : 0;
2343
+ switch (token) {
2344
+ // AD, BC
2345
+ case "G":
2346
+ case "GG":
2347
+ case "GGG":
2348
+ return localize.era(era, { width: "abbreviated" });
2349
+ // A, B
2350
+ case "GGGGG":
2351
+ return localize.era(era, { width: "narrow" });
2352
+ // Anno Domini, Before Christ
2353
+ case "GGGG":
2354
+ default:
2355
+ return localize.era(era, { width: "wide" });
2356
+ }
2357
+ },
2358
+
2359
+ // Year
2360
+ y: function (date, token, localize) {
2361
+ // Ordinal number
2362
+ if (token === "yo") {
2363
+ const signedYear = date.getFullYear();
2364
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
2365
+ const year = signedYear > 0 ? signedYear : 1 - signedYear;
2366
+ return localize.ordinalNumber(year, { unit: "year" });
2367
+ }
2368
+
2369
+ return lightFormatters.y(date, token);
2370
+ },
2371
+
2372
+ // Local week-numbering year
2373
+ Y: function (date, token, localize, options) {
2374
+ const signedWeekYear = getWeekYear(date, options);
2375
+ // Returns 1 for 1 BC (which is year 0 in JavaScript)
2376
+ const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
2377
+
2378
+ // Two digit year
2379
+ if (token === "YY") {
2380
+ const twoDigitYear = weekYear % 100;
2381
+ return addLeadingZeros(twoDigitYear, 2);
2382
+ }
2383
+
2384
+ // Ordinal number
2385
+ if (token === "Yo") {
2386
+ return localize.ordinalNumber(weekYear, { unit: "year" });
2387
+ }
2388
+
2389
+ // Padding
2390
+ return addLeadingZeros(weekYear, token.length);
2391
+ },
2392
+
2393
+ // ISO week-numbering year
2394
+ R: function (date, token) {
2395
+ const isoWeekYear = getISOWeekYear(date);
2396
+
2397
+ // Padding
2398
+ return addLeadingZeros(isoWeekYear, token.length);
2399
+ },
2400
+
2401
+ // Extended year. This is a single number designating the year of this calendar system.
2402
+ // The main difference between `y` and `u` localizers are B.C. years:
2403
+ // | Year | `y` | `u` |
2404
+ // |------|-----|-----|
2405
+ // | AC 1 | 1 | 1 |
2406
+ // | BC 1 | 1 | 0 |
2407
+ // | BC 2 | 2 | -1 |
2408
+ // Also `yy` always returns the last two digits of a year,
2409
+ // while `uu` pads single digit years to 2 characters and returns other years unchanged.
2410
+ u: function (date, token) {
2411
+ const year = date.getFullYear();
2412
+ return addLeadingZeros(year, token.length);
2413
+ },
2414
+
2415
+ // Quarter
2416
+ Q: function (date, token, localize) {
2417
+ const quarter = Math.ceil((date.getMonth() + 1) / 3);
2418
+ switch (token) {
2419
+ // 1, 2, 3, 4
2420
+ case "Q":
2421
+ return String(quarter);
2422
+ // 01, 02, 03, 04
2423
+ case "QQ":
2424
+ return addLeadingZeros(quarter, 2);
2425
+ // 1st, 2nd, 3rd, 4th
2426
+ case "Qo":
2427
+ return localize.ordinalNumber(quarter, { unit: "quarter" });
2428
+ // Q1, Q2, Q3, Q4
2429
+ case "QQQ":
2430
+ return localize.quarter(quarter, {
2431
+ width: "abbreviated",
2432
+ context: "formatting",
2433
+ });
2434
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2435
+ case "QQQQQ":
2436
+ return localize.quarter(quarter, {
2437
+ width: "narrow",
2438
+ context: "formatting",
2439
+ });
2440
+ // 1st quarter, 2nd quarter, ...
2441
+ case "QQQQ":
2442
+ default:
2443
+ return localize.quarter(quarter, {
2444
+ width: "wide",
2445
+ context: "formatting",
2446
+ });
2447
+ }
2448
+ },
2449
+
2450
+ // Stand-alone quarter
2451
+ q: function (date, token, localize) {
2452
+ const quarter = Math.ceil((date.getMonth() + 1) / 3);
2453
+ switch (token) {
2454
+ // 1, 2, 3, 4
2455
+ case "q":
2456
+ return String(quarter);
2457
+ // 01, 02, 03, 04
2458
+ case "qq":
2459
+ return addLeadingZeros(quarter, 2);
2460
+ // 1st, 2nd, 3rd, 4th
2461
+ case "qo":
2462
+ return localize.ordinalNumber(quarter, { unit: "quarter" });
2463
+ // Q1, Q2, Q3, Q4
2464
+ case "qqq":
2465
+ return localize.quarter(quarter, {
2466
+ width: "abbreviated",
2467
+ context: "standalone",
2468
+ });
2469
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2470
+ case "qqqqq":
2471
+ return localize.quarter(quarter, {
2472
+ width: "narrow",
2473
+ context: "standalone",
2474
+ });
2475
+ // 1st quarter, 2nd quarter, ...
2476
+ case "qqqq":
2477
+ default:
2478
+ return localize.quarter(quarter, {
2479
+ width: "wide",
2480
+ context: "standalone",
2481
+ });
2482
+ }
2483
+ },
2484
+
2485
+ // Month
2486
+ M: function (date, token, localize) {
2487
+ const month = date.getMonth();
2488
+ switch (token) {
2489
+ case "M":
2490
+ case "MM":
2491
+ return lightFormatters.M(date, token);
2492
+ // 1st, 2nd, ..., 12th
2493
+ case "Mo":
2494
+ return localize.ordinalNumber(month + 1, { unit: "month" });
2495
+ // Jan, Feb, ..., Dec
2496
+ case "MMM":
2497
+ return localize.month(month, {
2498
+ width: "abbreviated",
2499
+ context: "formatting",
2500
+ });
2501
+ // J, F, ..., D
2502
+ case "MMMMM":
2503
+ return localize.month(month, {
2504
+ width: "narrow",
2505
+ context: "formatting",
2506
+ });
2507
+ // January, February, ..., December
2508
+ case "MMMM":
2509
+ default:
2510
+ return localize.month(month, { width: "wide", context: "formatting" });
2511
+ }
2512
+ },
2513
+
2514
+ // Stand-alone month
2515
+ L: function (date, token, localize) {
2516
+ const month = date.getMonth();
2517
+ switch (token) {
2518
+ // 1, 2, ..., 12
2519
+ case "L":
2520
+ return String(month + 1);
2521
+ // 01, 02, ..., 12
2522
+ case "LL":
2523
+ return addLeadingZeros(month + 1, 2);
2524
+ // 1st, 2nd, ..., 12th
2525
+ case "Lo":
2526
+ return localize.ordinalNumber(month + 1, { unit: "month" });
2527
+ // Jan, Feb, ..., Dec
2528
+ case "LLL":
2529
+ return localize.month(month, {
2530
+ width: "abbreviated",
2531
+ context: "standalone",
2532
+ });
2533
+ // J, F, ..., D
2534
+ case "LLLLL":
2535
+ return localize.month(month, {
2536
+ width: "narrow",
2537
+ context: "standalone",
2538
+ });
2539
+ // January, February, ..., December
2540
+ case "LLLL":
2541
+ default:
2542
+ return localize.month(month, { width: "wide", context: "standalone" });
2543
+ }
2544
+ },
2545
+
2546
+ // Local week of year
2547
+ w: function (date, token, localize, options) {
2548
+ const week = getWeek(date, options);
2549
+
2550
+ if (token === "wo") {
2551
+ return localize.ordinalNumber(week, { unit: "week" });
2552
+ }
2553
+
2554
+ return addLeadingZeros(week, token.length);
2555
+ },
2556
+
2557
+ // ISO week of year
2558
+ I: function (date, token, localize) {
2559
+ const isoWeek = getISOWeek(date);
2560
+
2561
+ if (token === "Io") {
2562
+ return localize.ordinalNumber(isoWeek, { unit: "week" });
2563
+ }
2564
+
2565
+ return addLeadingZeros(isoWeek, token.length);
2566
+ },
2567
+
2568
+ // Day of the month
2569
+ d: function (date, token, localize) {
2570
+ if (token === "do") {
2571
+ return localize.ordinalNumber(date.getDate(), { unit: "date" });
2572
+ }
2573
+
2574
+ return lightFormatters.d(date, token);
2575
+ },
2576
+
2577
+ // Day of year
2578
+ D: function (date, token, localize) {
2579
+ const dayOfYear = getDayOfYear(date);
2580
+
2581
+ if (token === "Do") {
2582
+ return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
2583
+ }
2584
+
2585
+ return addLeadingZeros(dayOfYear, token.length);
2586
+ },
2587
+
2588
+ // Day of week
2589
+ E: function (date, token, localize) {
2590
+ const dayOfWeek = date.getDay();
2591
+ switch (token) {
2592
+ // Tue
2593
+ case "E":
2594
+ case "EE":
2595
+ case "EEE":
2596
+ return localize.day(dayOfWeek, {
2597
+ width: "abbreviated",
2598
+ context: "formatting",
2599
+ });
2600
+ // T
2601
+ case "EEEEE":
2602
+ return localize.day(dayOfWeek, {
2603
+ width: "narrow",
2604
+ context: "formatting",
2605
+ });
2606
+ // Tu
2607
+ case "EEEEEE":
2608
+ return localize.day(dayOfWeek, {
2609
+ width: "short",
2610
+ context: "formatting",
2611
+ });
2612
+ // Tuesday
2613
+ case "EEEE":
2614
+ default:
2615
+ return localize.day(dayOfWeek, {
2616
+ width: "wide",
2617
+ context: "formatting",
2618
+ });
2619
+ }
2620
+ },
2621
+
2622
+ // Local day of week
2623
+ e: function (date, token, localize, options) {
2624
+ const dayOfWeek = date.getDay();
2625
+ const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
2626
+ switch (token) {
2627
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
2628
+ case "e":
2629
+ return String(localDayOfWeek);
2630
+ // Padded numerical value
2631
+ case "ee":
2632
+ return addLeadingZeros(localDayOfWeek, 2);
2633
+ // 1st, 2nd, ..., 7th
2634
+ case "eo":
2635
+ return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
2636
+ case "eee":
2637
+ return localize.day(dayOfWeek, {
2638
+ width: "abbreviated",
2639
+ context: "formatting",
2640
+ });
2641
+ // T
2642
+ case "eeeee":
2643
+ return localize.day(dayOfWeek, {
2644
+ width: "narrow",
2645
+ context: "formatting",
2646
+ });
2647
+ // Tu
2648
+ case "eeeeee":
2649
+ return localize.day(dayOfWeek, {
2650
+ width: "short",
2651
+ context: "formatting",
2652
+ });
2653
+ // Tuesday
2654
+ case "eeee":
2655
+ default:
2656
+ return localize.day(dayOfWeek, {
2657
+ width: "wide",
2658
+ context: "formatting",
2659
+ });
2660
+ }
2661
+ },
2662
+
2663
+ // Stand-alone local day of week
2664
+ c: function (date, token, localize, options) {
2665
+ const dayOfWeek = date.getDay();
2666
+ const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
2667
+ switch (token) {
2668
+ // Numerical value (same as in `e`)
2669
+ case "c":
2670
+ return String(localDayOfWeek);
2671
+ // Padded numerical value
2672
+ case "cc":
2673
+ return addLeadingZeros(localDayOfWeek, token.length);
2674
+ // 1st, 2nd, ..., 7th
2675
+ case "co":
2676
+ return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
2677
+ case "ccc":
2678
+ return localize.day(dayOfWeek, {
2679
+ width: "abbreviated",
2680
+ context: "standalone",
2681
+ });
2682
+ // T
2683
+ case "ccccc":
2684
+ return localize.day(dayOfWeek, {
2685
+ width: "narrow",
2686
+ context: "standalone",
2687
+ });
2688
+ // Tu
2689
+ case "cccccc":
2690
+ return localize.day(dayOfWeek, {
2691
+ width: "short",
2692
+ context: "standalone",
2693
+ });
2694
+ // Tuesday
2695
+ case "cccc":
2696
+ default:
2697
+ return localize.day(dayOfWeek, {
2698
+ width: "wide",
2699
+ context: "standalone",
2700
+ });
2701
+ }
2702
+ },
2703
+
2704
+ // ISO day of week
2705
+ i: function (date, token, localize) {
2706
+ const dayOfWeek = date.getDay();
2707
+ const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
2708
+ switch (token) {
2709
+ // 2
2710
+ case "i":
2711
+ return String(isoDayOfWeek);
2712
+ // 02
2713
+ case "ii":
2714
+ return addLeadingZeros(isoDayOfWeek, token.length);
2715
+ // 2nd
2716
+ case "io":
2717
+ return localize.ordinalNumber(isoDayOfWeek, { unit: "day" });
2718
+ // Tue
2719
+ case "iii":
2720
+ return localize.day(dayOfWeek, {
2721
+ width: "abbreviated",
2722
+ context: "formatting",
2723
+ });
2724
+ // T
2725
+ case "iiiii":
2726
+ return localize.day(dayOfWeek, {
2727
+ width: "narrow",
2728
+ context: "formatting",
2729
+ });
2730
+ // Tu
2731
+ case "iiiiii":
2732
+ return localize.day(dayOfWeek, {
2733
+ width: "short",
2734
+ context: "formatting",
2735
+ });
2736
+ // Tuesday
2737
+ case "iiii":
2738
+ default:
2739
+ return localize.day(dayOfWeek, {
2740
+ width: "wide",
2741
+ context: "formatting",
2742
+ });
2743
+ }
2744
+ },
2745
+
2746
+ // AM or PM
2747
+ a: function (date, token, localize) {
2748
+ const hours = date.getHours();
2749
+ const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
2750
+
2751
+ switch (token) {
2752
+ case "a":
2753
+ case "aa":
2754
+ return localize.dayPeriod(dayPeriodEnumValue, {
2755
+ width: "abbreviated",
2756
+ context: "formatting",
2757
+ });
2758
+ case "aaa":
2759
+ return localize
2760
+ .dayPeriod(dayPeriodEnumValue, {
2761
+ width: "abbreviated",
2762
+ context: "formatting",
2763
+ })
2764
+ .toLowerCase();
2765
+ case "aaaaa":
2766
+ return localize.dayPeriod(dayPeriodEnumValue, {
2767
+ width: "narrow",
2768
+ context: "formatting",
2769
+ });
2770
+ case "aaaa":
2771
+ default:
2772
+ return localize.dayPeriod(dayPeriodEnumValue, {
2773
+ width: "wide",
2774
+ context: "formatting",
2775
+ });
2776
+ }
2777
+ },
2778
+
2779
+ // AM, PM, midnight, noon
2780
+ b: function (date, token, localize) {
2781
+ const hours = date.getHours();
2782
+ let dayPeriodEnumValue;
2783
+ if (hours === 12) {
2784
+ dayPeriodEnumValue = dayPeriodEnum.noon;
2785
+ } else if (hours === 0) {
2786
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
2787
+ } else {
2788
+ dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
2789
+ }
2790
+
2791
+ switch (token) {
2792
+ case "b":
2793
+ case "bb":
2794
+ return localize.dayPeriod(dayPeriodEnumValue, {
2795
+ width: "abbreviated",
2796
+ context: "formatting",
2797
+ });
2798
+ case "bbb":
2799
+ return localize
2800
+ .dayPeriod(dayPeriodEnumValue, {
2801
+ width: "abbreviated",
2802
+ context: "formatting",
2803
+ })
2804
+ .toLowerCase();
2805
+ case "bbbbb":
2806
+ return localize.dayPeriod(dayPeriodEnumValue, {
2807
+ width: "narrow",
2808
+ context: "formatting",
2809
+ });
2810
+ case "bbbb":
2811
+ default:
2812
+ return localize.dayPeriod(dayPeriodEnumValue, {
2813
+ width: "wide",
2814
+ context: "formatting",
2815
+ });
2816
+ }
2817
+ },
2818
+
2819
+ // in the morning, in the afternoon, in the evening, at night
2820
+ B: function (date, token, localize) {
2821
+ const hours = date.getHours();
2822
+ let dayPeriodEnumValue;
2823
+ if (hours >= 17) {
2824
+ dayPeriodEnumValue = dayPeriodEnum.evening;
2825
+ } else if (hours >= 12) {
2826
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
2827
+ } else if (hours >= 4) {
2828
+ dayPeriodEnumValue = dayPeriodEnum.morning;
2829
+ } else {
2830
+ dayPeriodEnumValue = dayPeriodEnum.night;
2831
+ }
2832
+
2833
+ switch (token) {
2834
+ case "B":
2835
+ case "BB":
2836
+ case "BBB":
2837
+ return localize.dayPeriod(dayPeriodEnumValue, {
2838
+ width: "abbreviated",
2839
+ context: "formatting",
2840
+ });
2841
+ case "BBBBB":
2842
+ return localize.dayPeriod(dayPeriodEnumValue, {
2843
+ width: "narrow",
2844
+ context: "formatting",
2845
+ });
2846
+ case "BBBB":
2847
+ default:
2848
+ return localize.dayPeriod(dayPeriodEnumValue, {
2849
+ width: "wide",
2850
+ context: "formatting",
2851
+ });
2852
+ }
2853
+ },
2854
+
2855
+ // Hour [1-12]
2856
+ h: function (date, token, localize) {
2857
+ if (token === "ho") {
2858
+ let hours = date.getHours() % 12;
2859
+ if (hours === 0) hours = 12;
2860
+ return localize.ordinalNumber(hours, { unit: "hour" });
2861
+ }
2862
+
2863
+ return lightFormatters.h(date, token);
2864
+ },
2865
+
2866
+ // Hour [0-23]
2867
+ H: function (date, token, localize) {
2868
+ if (token === "Ho") {
2869
+ return localize.ordinalNumber(date.getHours(), { unit: "hour" });
2870
+ }
2871
+
2872
+ return lightFormatters.H(date, token);
2873
+ },
2874
+
2875
+ // Hour [0-11]
2876
+ K: function (date, token, localize) {
2877
+ const hours = date.getHours() % 12;
2878
+
2879
+ if (token === "Ko") {
2880
+ return localize.ordinalNumber(hours, { unit: "hour" });
2881
+ }
2882
+
2883
+ return addLeadingZeros(hours, token.length);
2884
+ },
2885
+
2886
+ // Hour [1-24]
2887
+ k: function (date, token, localize) {
2888
+ let hours = date.getHours();
2889
+ if (hours === 0) hours = 24;
2890
+
2891
+ if (token === "ko") {
2892
+ return localize.ordinalNumber(hours, { unit: "hour" });
2893
+ }
2894
+
2895
+ return addLeadingZeros(hours, token.length);
2896
+ },
2897
+
2898
+ // Minute
2899
+ m: function (date, token, localize) {
2900
+ if (token === "mo") {
2901
+ return localize.ordinalNumber(date.getMinutes(), { unit: "minute" });
2902
+ }
2903
+
2904
+ return lightFormatters.m(date, token);
2905
+ },
2906
+
2907
+ // Second
2908
+ s: function (date, token, localize) {
2909
+ if (token === "so") {
2910
+ return localize.ordinalNumber(date.getSeconds(), { unit: "second" });
2911
+ }
2912
+
2913
+ return lightFormatters.s(date, token);
2914
+ },
2915
+
2916
+ // Fraction of second
2917
+ S: function (date, token) {
2918
+ return lightFormatters.S(date, token);
2919
+ },
2920
+
2921
+ // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
2922
+ X: function (date, token, _localize) {
2923
+ const timezoneOffset = date.getTimezoneOffset();
2924
+
2925
+ if (timezoneOffset === 0) {
2926
+ return "Z";
2927
+ }
2928
+
2929
+ switch (token) {
2930
+ // Hours and optional minutes
2931
+ case "X":
2932
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
2933
+
2934
+ // Hours, minutes and optional seconds without `:` delimiter
2935
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2936
+ // so this token always has the same output as `XX`
2937
+ case "XXXX":
2938
+ case "XX": // Hours and minutes without `:` delimiter
2939
+ return formatTimezone(timezoneOffset);
2940
+
2941
+ // Hours, minutes and optional seconds with `:` delimiter
2942
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2943
+ // so this token always has the same output as `XXX`
2944
+ case "XXXXX":
2945
+ case "XXX": // Hours and minutes with `:` delimiter
2946
+ default:
2947
+ return formatTimezone(timezoneOffset, ":");
2948
+ }
2949
+ },
2950
+
2951
+ // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
2952
+ x: function (date, token, _localize) {
2953
+ const timezoneOffset = date.getTimezoneOffset();
2954
+
2955
+ switch (token) {
2956
+ // Hours and optional minutes
2957
+ case "x":
2958
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
2959
+
2960
+ // Hours, minutes and optional seconds without `:` delimiter
2961
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2962
+ // so this token always has the same output as `xx`
2963
+ case "xxxx":
2964
+ case "xx": // Hours and minutes without `:` delimiter
2965
+ return formatTimezone(timezoneOffset);
2966
+
2967
+ // Hours, minutes and optional seconds with `:` delimiter
2968
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2969
+ // so this token always has the same output as `xxx`
2970
+ case "xxxxx":
2971
+ case "xxx": // Hours and minutes with `:` delimiter
2972
+ default:
2973
+ return formatTimezone(timezoneOffset, ":");
2974
+ }
2975
+ },
2976
+
2977
+ // Timezone (GMT)
2978
+ O: function (date, token, _localize) {
2979
+ const timezoneOffset = date.getTimezoneOffset();
2980
+
2981
+ switch (token) {
2982
+ // Short
2983
+ case "O":
2984
+ case "OO":
2985
+ case "OOO":
2986
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2987
+ // Long
2988
+ case "OOOO":
2989
+ default:
2990
+ return "GMT" + formatTimezone(timezoneOffset, ":");
2991
+ }
2992
+ },
2993
+
2994
+ // Timezone (specific non-location)
2995
+ z: function (date, token, _localize) {
2996
+ const timezoneOffset = date.getTimezoneOffset();
2997
+
2998
+ switch (token) {
2999
+ // Short
3000
+ case "z":
3001
+ case "zz":
3002
+ case "zzz":
3003
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
3004
+ // Long
3005
+ case "zzzz":
3006
+ default:
3007
+ return "GMT" + formatTimezone(timezoneOffset, ":");
3008
+ }
3009
+ },
3010
+
3011
+ // Seconds timestamp
3012
+ t: function (date, token, _localize) {
3013
+ const timestamp = Math.trunc(+date / 1000);
3014
+ return addLeadingZeros(timestamp, token.length);
3015
+ },
3016
+
3017
+ // Milliseconds timestamp
3018
+ T: function (date, token, _localize) {
3019
+ return addLeadingZeros(+date, token.length);
3020
+ },
3021
+ };
3022
+
3023
+ function formatTimezoneShort(offset, delimiter = "") {
3024
+ const sign = offset > 0 ? "-" : "+";
3025
+ const absOffset = Math.abs(offset);
3026
+ const hours = Math.trunc(absOffset / 60);
3027
+ const minutes = absOffset % 60;
3028
+ if (minutes === 0) {
3029
+ return sign + String(hours);
3030
+ }
3031
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
3032
+ }
3033
+
3034
+ function formatTimezoneWithOptionalMinutes(offset, delimiter) {
3035
+ if (offset % 60 === 0) {
3036
+ const sign = offset > 0 ? "-" : "+";
3037
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
3038
+ }
3039
+ return formatTimezone(offset, delimiter);
3040
+ }
3041
+
3042
+ function formatTimezone(offset, delimiter = "") {
3043
+ const sign = offset > 0 ? "-" : "+";
3044
+ const absOffset = Math.abs(offset);
3045
+ const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
3046
+ const minutes = addLeadingZeros(absOffset % 60, 2);
3047
+ return sign + hours + delimiter + minutes;
3048
+ }
3049
+
3050
+ const dateLongFormatter = (pattern, formatLong) => {
3051
+ switch (pattern) {
3052
+ case "P":
3053
+ return formatLong.date({ width: "short" });
3054
+ case "PP":
3055
+ return formatLong.date({ width: "medium" });
3056
+ case "PPP":
3057
+ return formatLong.date({ width: "long" });
3058
+ case "PPPP":
3059
+ default:
3060
+ return formatLong.date({ width: "full" });
3061
+ }
3062
+ };
3063
+
3064
+ const timeLongFormatter = (pattern, formatLong) => {
3065
+ switch (pattern) {
3066
+ case "p":
3067
+ return formatLong.time({ width: "short" });
3068
+ case "pp":
3069
+ return formatLong.time({ width: "medium" });
3070
+ case "ppp":
3071
+ return formatLong.time({ width: "long" });
3072
+ case "pppp":
3073
+ default:
3074
+ return formatLong.time({ width: "full" });
3075
+ }
3076
+ };
3077
+
3078
+ const dateTimeLongFormatter = (pattern, formatLong) => {
3079
+ const matchResult = pattern.match(/(P+)(p+)?/) || [];
3080
+ const datePattern = matchResult[1];
3081
+ const timePattern = matchResult[2];
3082
+
3083
+ if (!timePattern) {
3084
+ return dateLongFormatter(pattern, formatLong);
3085
+ }
3086
+
3087
+ let dateTimeFormat;
3088
+
3089
+ switch (datePattern) {
3090
+ case "P":
3091
+ dateTimeFormat = formatLong.dateTime({ width: "short" });
3092
+ break;
3093
+ case "PP":
3094
+ dateTimeFormat = formatLong.dateTime({ width: "medium" });
3095
+ break;
3096
+ case "PPP":
3097
+ dateTimeFormat = formatLong.dateTime({ width: "long" });
3098
+ break;
3099
+ case "PPPP":
3100
+ default:
3101
+ dateTimeFormat = formatLong.dateTime({ width: "full" });
3102
+ break;
3103
+ }
3104
+
3105
+ return dateTimeFormat
3106
+ .replace("{{date}}", dateLongFormatter(datePattern, formatLong))
3107
+ .replace("{{time}}", timeLongFormatter(timePattern, formatLong));
3108
+ };
3109
+
3110
+ const longFormatters = {
3111
+ p: timeLongFormatter,
3112
+ P: dateTimeLongFormatter,
3113
+ };
3114
+
3115
+ const dayOfYearTokenRE = /^D+$/;
3116
+ const weekYearTokenRE = /^Y+$/;
3117
+
3118
+ const throwTokens = ["D", "DD", "YY", "YYYY"];
3119
+
3120
+ function isProtectedDayOfYearToken(token) {
3121
+ return dayOfYearTokenRE.test(token);
3122
+ }
3123
+
3124
+ function isProtectedWeekYearToken(token) {
3125
+ return weekYearTokenRE.test(token);
3126
+ }
3127
+
3128
+ function warnOrThrowProtectedError(token, format, input) {
3129
+ const _message = message(token, format, input);
3130
+ console.warn(_message);
3131
+ if (throwTokens.includes(token)) throw new RangeError(_message);
3132
+ }
3133
+
3134
+ function message(token, format, input) {
3135
+ const subject = token[0] === "Y" ? "years" : "days of the month";
3136
+ return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
3137
+ }
3138
+
3139
+ // This RegExp consists of three parts separated by `|`:
3140
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
3141
+ // (one of the certain letters followed by `o`)
3142
+ // - (\w)\1* matches any sequences of the same letter
3143
+ // - '' matches two quote characters in a row
3144
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
3145
+ // except a single quote symbol, which ends the sequence.
3146
+ // Two quote characters do not end the sequence.
3147
+ // If there is no matching single quote
3148
+ // then the sequence will continue until the end of the string.
3149
+ // - . matches any single character unmatched by previous parts of the RegExps
3150
+ const formattingTokensRegExp =
3151
+ /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
3152
+
3153
+ // This RegExp catches symbols escaped by quotes, and also
3154
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
3155
+ const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
3156
+
3157
+ const escapedStringRegExp = /^'([^]*?)'?$/;
3158
+ const doubleQuoteRegExp = /''/g;
3159
+ const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
3160
+
3161
+ /**
3162
+ * The {@link format} function options.
3163
+ */
3164
+
3165
+ /**
3166
+ * @name format
3167
+ * @alias formatDate
3168
+ * @category Common Helpers
3169
+ * @summary Format the date.
3170
+ *
3171
+ * @description
3172
+ * Return the formatted date string in the given format. The result may vary by locale.
3173
+ *
3174
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
3175
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
3176
+ *
3177
+ * The characters wrapped between two single quotes characters (') are escaped.
3178
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
3179
+ * (see the last example)
3180
+ *
3181
+ * Format of the string is based on Unicode Technical Standard #35:
3182
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
3183
+ * with a few additions (see note 7 below the table).
3184
+ *
3185
+ * Accepted patterns:
3186
+ * | Unit | Pattern | Result examples | Notes |
3187
+ * |---------------------------------|---------|-----------------------------------|-------|
3188
+ * | Era | G..GGG | AD, BC | |
3189
+ * | | GGGG | Anno Domini, Before Christ | 2 |
3190
+ * | | GGGGG | A, B | |
3191
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
3192
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
3193
+ * | | yy | 44, 01, 00, 17 | 5 |
3194
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
3195
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
3196
+ * | | yyyyy | ... | 3,5 |
3197
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
3198
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
3199
+ * | | YY | 44, 01, 00, 17 | 5,8 |
3200
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
3201
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
3202
+ * | | YYYYY | ... | 3,5 |
3203
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
3204
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
3205
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
3206
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
3207
+ * | | RRRRR | ... | 3,5,7 |
3208
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
3209
+ * | | uu | -43, 01, 1900, 2017 | 5 |
3210
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
3211
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
3212
+ * | | uuuuu | ... | 3,5 |
3213
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
3214
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
3215
+ * | | QQ | 01, 02, 03, 04 | |
3216
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
3217
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
3218
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
3219
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
3220
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
3221
+ * | | qq | 01, 02, 03, 04 | |
3222
+ * | | qqq | Q1, Q2, Q3, Q4 | |
3223
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
3224
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
3225
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
3226
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
3227
+ * | | MM | 01, 02, ..., 12 | |
3228
+ * | | MMM | Jan, Feb, ..., Dec | |
3229
+ * | | MMMM | January, February, ..., December | 2 |
3230
+ * | | MMMMM | J, F, ..., D | |
3231
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
3232
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
3233
+ * | | LL | 01, 02, ..., 12 | |
3234
+ * | | LLL | Jan, Feb, ..., Dec | |
3235
+ * | | LLLL | January, February, ..., December | 2 |
3236
+ * | | LLLLL | J, F, ..., D | |
3237
+ * | Local week of year | w | 1, 2, ..., 53 | |
3238
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
3239
+ * | | ww | 01, 02, ..., 53 | |
3240
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
3241
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
3242
+ * | | II | 01, 02, ..., 53 | 7 |
3243
+ * | Day of month | d | 1, 2, ..., 31 | |
3244
+ * | | do | 1st, 2nd, ..., 31st | 7 |
3245
+ * | | dd | 01, 02, ..., 31 | |
3246
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
3247
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
3248
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
3249
+ * | | DDD | 001, 002, ..., 365, 366 | |
3250
+ * | | DDDD | ... | 3 |
3251
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
3252
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
3253
+ * | | EEEEE | M, T, W, T, F, S, S | |
3254
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
3255
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
3256
+ * | | io | 1st, 2nd, ..., 7th | 7 |
3257
+ * | | ii | 01, 02, ..., 07 | 7 |
3258
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
3259
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
3260
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
3261
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
3262
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
3263
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
3264
+ * | | ee | 02, 03, ..., 01 | |
3265
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
3266
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
3267
+ * | | eeeee | M, T, W, T, F, S, S | |
3268
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
3269
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
3270
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
3271
+ * | | cc | 02, 03, ..., 01 | |
3272
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
3273
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
3274
+ * | | ccccc | M, T, W, T, F, S, S | |
3275
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
3276
+ * | AM, PM | a..aa | AM, PM | |
3277
+ * | | aaa | am, pm | |
3278
+ * | | aaaa | a.m., p.m. | 2 |
3279
+ * | | aaaaa | a, p | |
3280
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
3281
+ * | | bbb | am, pm, noon, midnight | |
3282
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
3283
+ * | | bbbbb | a, p, n, mi | |
3284
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
3285
+ * | | BBBB | at night, in the morning, ... | 2 |
3286
+ * | | BBBBB | at night, in the morning, ... | |
3287
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
3288
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
3289
+ * | | hh | 01, 02, ..., 11, 12 | |
3290
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
3291
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
3292
+ * | | HH | 00, 01, 02, ..., 23 | |
3293
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
3294
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
3295
+ * | | KK | 01, 02, ..., 11, 00 | |
3296
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
3297
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
3298
+ * | | kk | 24, 01, 02, ..., 23 | |
3299
+ * | Minute | m | 0, 1, ..., 59 | |
3300
+ * | | mo | 0th, 1st, ..., 59th | 7 |
3301
+ * | | mm | 00, 01, ..., 59 | |
3302
+ * | Second | s | 0, 1, ..., 59 | |
3303
+ * | | so | 0th, 1st, ..., 59th | 7 |
3304
+ * | | ss | 00, 01, ..., 59 | |
3305
+ * | Fraction of second | S | 0, 1, ..., 9 | |
3306
+ * | | SS | 00, 01, ..., 99 | |
3307
+ * | | SSS | 000, 001, ..., 999 | |
3308
+ * | | SSSS | ... | 3 |
3309
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
3310
+ * | | XX | -0800, +0530, Z | |
3311
+ * | | XXX | -08:00, +05:30, Z | |
3312
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
3313
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
3314
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
3315
+ * | | xx | -0800, +0530, +0000 | |
3316
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
3317
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
3318
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
3319
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
3320
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
3321
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
3322
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
3323
+ * | Seconds timestamp | t | 512969520 | 7 |
3324
+ * | | tt | ... | 3,7 |
3325
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
3326
+ * | | TT | ... | 3,7 |
3327
+ * | Long localized date | P | 04/29/1453 | 7 |
3328
+ * | | PP | Apr 29, 1453 | 7 |
3329
+ * | | PPP | April 29th, 1453 | 7 |
3330
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
3331
+ * | Long localized time | p | 12:00 AM | 7 |
3332
+ * | | pp | 12:00:00 AM | 7 |
3333
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
3334
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
3335
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
3336
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
3337
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
3338
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
3339
+ * Notes:
3340
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
3341
+ * are the same as "stand-alone" units, but are different in some languages.
3342
+ * "Formatting" units are declined according to the rules of the language
3343
+ * in the context of a date. "Stand-alone" units are always nominative singular:
3344
+ *
3345
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
3346
+ *
3347
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
3348
+ *
3349
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
3350
+ * the single quote characters (see below).
3351
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
3352
+ * the output will be the same as default pattern for this unit, usually
3353
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
3354
+ * are marked with "2" in the last column of the table.
3355
+ *
3356
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
3357
+ *
3358
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
3359
+ *
3360
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
3361
+ *
3362
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
3363
+ *
3364
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
3365
+ *
3366
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
3367
+ * The output will be padded with zeros to match the length of the pattern.
3368
+ *
3369
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
3370
+ *
3371
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
3372
+ * These tokens represent the shortest form of the quarter.
3373
+ *
3374
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
3375
+ *
3376
+ * | Year | `y` | `u` |
3377
+ * |------|-----|-----|
3378
+ * | AC 1 | 1 | 1 |
3379
+ * | BC 1 | 1 | 0 |
3380
+ * | BC 2 | 2 | -1 |
3381
+ *
3382
+ * Also `yy` always returns the last two digits of a year,
3383
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
3384
+ *
3385
+ * | Year | `yy` | `uu` |
3386
+ * |------|------|------|
3387
+ * | 1 | 01 | 01 |
3388
+ * | 14 | 14 | 14 |
3389
+ * | 376 | 76 | 376 |
3390
+ * | 1453 | 53 | 1453 |
3391
+ *
3392
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
3393
+ * except local week-numbering years are dependent on `options.weekStartsOn`
3394
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)
3395
+ * and [getWeekYear](https://date-fns.org/docs/getWeekYear)).
3396
+ *
3397
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
3398
+ * so right now these tokens fall back to GMT timezones.
3399
+ *
3400
+ * 7. These patterns are not in the Unicode Technical Standard #35:
3401
+ * - `i`: ISO day of week
3402
+ * - `I`: ISO week of year
3403
+ * - `R`: ISO week-numbering year
3404
+ * - `t`: seconds timestamp
3405
+ * - `T`: milliseconds timestamp
3406
+ * - `o`: ordinal number modifier
3407
+ * - `P`: long localized date
3408
+ * - `p`: long localized time
3409
+ *
3410
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
3411
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
3412
+ *
3413
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
3414
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
3415
+ *
3416
+ * @param date - The original date
3417
+ * @param format - The string of tokens
3418
+ * @param options - An object with options
3419
+ *
3420
+ * @returns The formatted date string
3421
+ *
3422
+ * @throws `date` must not be Invalid Date
3423
+ * @throws `options.locale` must contain `localize` property
3424
+ * @throws `options.locale` must contain `formatLong` property
3425
+ * @throws 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
3426
+ * @throws 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
3427
+ * @throws 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
3428
+ * @throws 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
3429
+ * @throws format string contains an unescaped latin alphabet character
3430
+ *
3431
+ * @example
3432
+ * // Represent 11 February 2014 in middle-endian format:
3433
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
3434
+ * //=> '02/11/2014'
3435
+ *
3436
+ * @example
3437
+ * // Represent 2 July 2014 in Esperanto:
3438
+ * import { eoLocale } from 'date-fns/locale/eo'
3439
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
3440
+ * locale: eoLocale
3441
+ * })
3442
+ * //=> '2-a de julio 2014'
3443
+ *
3444
+ * @example
3445
+ * // Escape string by single quote characters:
3446
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
3447
+ * //=> "3 o'clock"
3448
+ */
3449
+ function format(date, formatStr, options) {
3450
+ const defaultOptions = getDefaultOptions();
3451
+ const locale = options?.locale ?? defaultOptions.locale ?? enUS;
3452
+
3453
+ const firstWeekContainsDate =
3454
+ options?.firstWeekContainsDate ??
3455
+ options?.locale?.options?.firstWeekContainsDate ??
3456
+ defaultOptions.firstWeekContainsDate ??
3457
+ defaultOptions.locale?.options?.firstWeekContainsDate ??
3458
+ 1;
3459
+
3460
+ const weekStartsOn =
3461
+ options?.weekStartsOn ??
3462
+ options?.locale?.options?.weekStartsOn ??
3463
+ defaultOptions.weekStartsOn ??
3464
+ defaultOptions.locale?.options?.weekStartsOn ??
3465
+ 0;
3466
+
3467
+ const originalDate = toDate(date, options?.in);
3468
+
3469
+ if (!isValid(originalDate)) {
3470
+ throw new RangeError("Invalid time value");
3471
+ }
3472
+
3473
+ let parts = formatStr
3474
+ .match(longFormattingTokensRegExp)
3475
+ .map((substring) => {
3476
+ const firstCharacter = substring[0];
3477
+ if (firstCharacter === "p" || firstCharacter === "P") {
3478
+ const longFormatter = longFormatters[firstCharacter];
3479
+ return longFormatter(substring, locale.formatLong);
3480
+ }
3481
+ return substring;
3482
+ })
3483
+ .join("")
3484
+ .match(formattingTokensRegExp)
3485
+ .map((substring) => {
3486
+ // Replace two single quote characters with one single quote character
3487
+ if (substring === "''") {
3488
+ return { isToken: false, value: "'" };
3489
+ }
3490
+
3491
+ const firstCharacter = substring[0];
3492
+ if (firstCharacter === "'") {
3493
+ return { isToken: false, value: cleanEscapedString(substring) };
3494
+ }
3495
+
3496
+ if (formatters[firstCharacter]) {
3497
+ return { isToken: true, value: substring };
3498
+ }
3499
+
3500
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
3501
+ throw new RangeError(
3502
+ "Format string contains an unescaped latin alphabet character `" +
3503
+ firstCharacter +
3504
+ "`",
3505
+ );
3506
+ }
3507
+
3508
+ return { isToken: false, value: substring };
3509
+ });
3510
+
3511
+ // invoke localize preprocessor (only for french locales at the moment)
3512
+ if (locale.localize.preprocessor) {
3513
+ parts = locale.localize.preprocessor(originalDate, parts);
3514
+ }
3515
+
3516
+ const formatterOptions = {
3517
+ firstWeekContainsDate,
3518
+ weekStartsOn,
3519
+ locale,
3520
+ };
3521
+
3522
+ return parts
3523
+ .map((part) => {
3524
+ if (!part.isToken) return part.value;
3525
+
3526
+ const token = part.value;
3527
+
3528
+ if (
3529
+ (!options?.useAdditionalWeekYearTokens &&
3530
+ isProtectedWeekYearToken(token)) ||
3531
+ (!options?.useAdditionalDayOfYearTokens &&
3532
+ isProtectedDayOfYearToken(token))
3533
+ ) {
3534
+ warnOrThrowProtectedError(token, formatStr, String(date));
3535
+ }
3536
+
3537
+ const formatter = formatters[token[0]];
3538
+ return formatter(originalDate, token, locale.localize, formatterOptions);
3539
+ })
3540
+ .join("");
3541
+ }
3542
+
3543
+ function cleanEscapedString(input) {
3544
+ const matched = input.match(escapedStringRegExp);
3545
+
3546
+ if (!matched) {
3547
+ return input;
3548
+ }
3549
+
3550
+ return matched[1].replace(doubleQuoteRegExp, "'");
3551
+ }
3552
+
3553
+ const formatDistanceLocale = {
3554
+ lessThanXSeconds: {
3555
+ one: "menos de um segundo",
3556
+ other: "menos de {{count}} segundos",
3557
+ },
3558
+
3559
+ xSeconds: {
3560
+ one: "1 segundo",
3561
+ other: "{{count}} segundos",
3562
+ },
3563
+
3564
+ halfAMinute: "meio minuto",
3565
+
3566
+ lessThanXMinutes: {
3567
+ one: "menos de um minuto",
3568
+ other: "menos de {{count}} minutos",
3569
+ },
3570
+
3571
+ xMinutes: {
3572
+ one: "1 minuto",
3573
+ other: "{{count}} minutos",
3574
+ },
3575
+
3576
+ aboutXHours: {
3577
+ one: "cerca de 1 hora",
3578
+ other: "cerca de {{count}} horas",
3579
+ },
3580
+
3581
+ xHours: {
3582
+ one: "1 hora",
3583
+ other: "{{count}} horas",
3584
+ },
3585
+
3586
+ xDays: {
3587
+ one: "1 dia",
3588
+ other: "{{count}} dias",
3589
+ },
3590
+
3591
+ aboutXWeeks: {
3592
+ one: "cerca de 1 semana",
3593
+ other: "cerca de {{count}} semanas",
3594
+ },
3595
+
3596
+ xWeeks: {
3597
+ one: "1 semana",
3598
+ other: "{{count}} semanas",
3599
+ },
3600
+
3601
+ aboutXMonths: {
3602
+ one: "cerca de 1 mês",
3603
+ other: "cerca de {{count}} meses",
3604
+ },
3605
+
3606
+ xMonths: {
3607
+ one: "1 mês",
3608
+ other: "{{count}} meses",
3609
+ },
3610
+
3611
+ aboutXYears: {
3612
+ one: "cerca de 1 ano",
3613
+ other: "cerca de {{count}} anos",
3614
+ },
3615
+
3616
+ xYears: {
3617
+ one: "1 ano",
3618
+ other: "{{count}} anos",
3619
+ },
3620
+
3621
+ overXYears: {
3622
+ one: "mais de 1 ano",
3623
+ other: "mais de {{count}} anos",
3624
+ },
3625
+
3626
+ almostXYears: {
3627
+ one: "quase 1 ano",
3628
+ other: "quase {{count}} anos",
3629
+ },
3630
+ };
3631
+
3632
+ const formatDistance = (token, count, options) => {
3633
+ let result;
3634
+
3635
+ const tokenValue = formatDistanceLocale[token];
3636
+ if (typeof tokenValue === "string") {
3637
+ result = tokenValue;
3638
+ } else if (count === 1) {
3639
+ result = tokenValue.one;
3640
+ } else {
3641
+ result = tokenValue.other.replace("{{count}}", String(count));
3642
+ }
3643
+
3644
+ if (options?.addSuffix) {
3645
+ if (options.comparison && options.comparison > 0) {
3646
+ return "em " + result;
3647
+ } else {
3648
+ return "há " + result;
3649
+ }
3650
+ }
3651
+
3652
+ return result;
3653
+ };
3654
+
3655
+ const dateFormats = {
3656
+ full: "EEEE, d 'de' MMMM 'de' y",
3657
+ long: "d 'de' MMMM 'de' y",
3658
+ medium: "d MMM y",
3659
+ short: "dd/MM/yyyy",
3660
+ };
3661
+
3662
+ const timeFormats = {
3663
+ full: "HH:mm:ss zzzz",
3664
+ long: "HH:mm:ss z",
3665
+ medium: "HH:mm:ss",
3666
+ short: "HH:mm",
3667
+ };
3668
+
3669
+ const dateTimeFormats = {
3670
+ full: "{{date}} 'às' {{time}}",
3671
+ long: "{{date}} 'às' {{time}}",
3672
+ medium: "{{date}}, {{time}}",
3673
+ short: "{{date}}, {{time}}",
3674
+ };
3675
+
3676
+ const formatLong = {
3677
+ date: buildFormatLongFn({
3678
+ formats: dateFormats,
3679
+ defaultWidth: "full",
3680
+ }),
3681
+
3682
+ time: buildFormatLongFn({
3683
+ formats: timeFormats,
3684
+ defaultWidth: "full",
3685
+ }),
3686
+
3687
+ dateTime: buildFormatLongFn({
3688
+ formats: dateTimeFormats,
3689
+ defaultWidth: "full",
3690
+ }),
3691
+ };
3692
+
3693
+ const formatRelativeLocale = {
3694
+ lastWeek: (date) => {
3695
+ const weekday = date.getDay();
3696
+ const last = weekday === 0 || weekday === 6 ? "último" : "última";
3697
+ return "'" + last + "' eeee 'às' p";
3698
+ },
3699
+ yesterday: "'ontem às' p",
3700
+ today: "'hoje às' p",
3701
+ tomorrow: "'amanhã às' p",
3702
+ nextWeek: "eeee 'às' p",
3703
+ other: "P",
3704
+ };
3705
+
3706
+ const formatRelative = (token, date, _baseDate, _options) => {
3707
+ const format = formatRelativeLocale[token];
3708
+
3709
+ if (typeof format === "function") {
3710
+ return format(date);
3711
+ }
3712
+
3713
+ return format;
3714
+ };
3715
+
3716
+ const eraValues = {
3717
+ narrow: ["AC", "DC"],
3718
+ abbreviated: ["AC", "DC"],
3719
+ wide: ["antes de cristo", "depois de cristo"],
3720
+ };
3721
+
3722
+ const quarterValues = {
3723
+ narrow: ["1", "2", "3", "4"],
3724
+ abbreviated: ["T1", "T2", "T3", "T4"],
3725
+ wide: ["1º trimestre", "2º trimestre", "3º trimestre", "4º trimestre"],
3726
+ };
3727
+
3728
+ const monthValues = {
3729
+ narrow: ["j", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"],
3730
+ abbreviated: [
3731
+ "jan",
3732
+ "fev",
3733
+ "mar",
3734
+ "abr",
3735
+ "mai",
3736
+ "jun",
3737
+ "jul",
3738
+ "ago",
3739
+ "set",
3740
+ "out",
3741
+ "nov",
3742
+ "dez",
3743
+ ],
3744
+
3745
+ wide: [
3746
+ "janeiro",
3747
+ "fevereiro",
3748
+ "março",
3749
+ "abril",
3750
+ "maio",
3751
+ "junho",
3752
+ "julho",
3753
+ "agosto",
3754
+ "setembro",
3755
+ "outubro",
3756
+ "novembro",
3757
+ "dezembro",
3758
+ ],
3759
+ };
3760
+
3761
+ const dayValues = {
3762
+ narrow: ["D", "S", "T", "Q", "Q", "S", "S"],
3763
+ short: ["dom", "seg", "ter", "qua", "qui", "sex", "sab"],
3764
+ abbreviated: [
3765
+ "domingo",
3766
+ "segunda",
3767
+ "terça",
3768
+ "quarta",
3769
+ "quinta",
3770
+ "sexta",
3771
+ "sábado",
3772
+ ],
3773
+
3774
+ wide: [
3775
+ "domingo",
3776
+ "segunda-feira",
3777
+ "terça-feira",
3778
+ "quarta-feira",
3779
+ "quinta-feira",
3780
+ "sexta-feira",
3781
+ "sábado",
3782
+ ],
3783
+ };
3784
+
3785
+ const dayPeriodValues = {
3786
+ narrow: {
3787
+ am: "a",
3788
+ pm: "p",
3789
+ midnight: "mn",
3790
+ noon: "md",
3791
+ morning: "manhã",
3792
+ afternoon: "tarde",
3793
+ evening: "tarde",
3794
+ night: "noite",
3795
+ },
3796
+ abbreviated: {
3797
+ am: "AM",
3798
+ pm: "PM",
3799
+ midnight: "meia-noite",
3800
+ noon: "meio-dia",
3801
+ morning: "manhã",
3802
+ afternoon: "tarde",
3803
+ evening: "tarde",
3804
+ night: "noite",
3805
+ },
3806
+ wide: {
3807
+ am: "a.m.",
3808
+ pm: "p.m.",
3809
+ midnight: "meia-noite",
3810
+ noon: "meio-dia",
3811
+ morning: "manhã",
3812
+ afternoon: "tarde",
3813
+ evening: "tarde",
3814
+ night: "noite",
3815
+ },
3816
+ };
3817
+
3818
+ const formattingDayPeriodValues = {
3819
+ narrow: {
3820
+ am: "a",
3821
+ pm: "p",
3822
+ midnight: "mn",
3823
+ noon: "md",
3824
+ morning: "da manhã",
3825
+ afternoon: "da tarde",
3826
+ evening: "da tarde",
3827
+ night: "da noite",
3828
+ },
3829
+ abbreviated: {
3830
+ am: "AM",
3831
+ pm: "PM",
3832
+ midnight: "meia-noite",
3833
+ noon: "meio-dia",
3834
+ morning: "da manhã",
3835
+ afternoon: "da tarde",
3836
+ evening: "da tarde",
3837
+ night: "da noite",
3838
+ },
3839
+ wide: {
3840
+ am: "a.m.",
3841
+ pm: "p.m.",
3842
+ midnight: "meia-noite",
3843
+ noon: "meio-dia",
3844
+ morning: "da manhã",
3845
+ afternoon: "da tarde",
3846
+ evening: "da tarde",
3847
+ night: "da noite",
3848
+ },
3849
+ };
3850
+
3851
+ const ordinalNumber = (dirtyNumber, options) => {
3852
+ const number = Number(dirtyNumber);
3853
+
3854
+ if (options?.unit === "week") {
3855
+ return number + "ª";
3856
+ }
3857
+ return number + "º";
3858
+ };
3859
+
3860
+ const localize = {
3861
+ ordinalNumber,
3862
+
3863
+ era: buildLocalizeFn({
3864
+ values: eraValues,
3865
+ defaultWidth: "wide",
3866
+ }),
3867
+
3868
+ quarter: buildLocalizeFn({
3869
+ values: quarterValues,
3870
+ defaultWidth: "wide",
3871
+ argumentCallback: (quarter) => quarter - 1,
3872
+ }),
3873
+
3874
+ month: buildLocalizeFn({
3875
+ values: monthValues,
3876
+ defaultWidth: "wide",
3877
+ }),
3878
+
3879
+ day: buildLocalizeFn({
3880
+ values: dayValues,
3881
+ defaultWidth: "wide",
3882
+ }),
3883
+
3884
+ dayPeriod: buildLocalizeFn({
3885
+ values: dayPeriodValues,
3886
+ defaultWidth: "wide",
3887
+ formattingValues: formattingDayPeriodValues,
3888
+ defaultFormattingWidth: "wide",
3889
+ }),
3890
+ };
3891
+
3892
+ const matchOrdinalNumberPattern = /^(\d+)[ºªo]?/i;
3893
+ const parseOrdinalNumberPattern = /\d+/i;
3894
+
3895
+ const matchEraPatterns = {
3896
+ narrow: /^(ac|dc|a|d)/i,
3897
+ abbreviated: /^(a\.?\s?c\.?|d\.?\s?c\.?)/i,
3898
+ wide: /^(antes de cristo|depois de cristo)/i,
3899
+ };
3900
+ const parseEraPatterns = {
3901
+ any: [/^ac/i, /^dc/i],
3902
+ wide: [/^antes de cristo/i, /^depois de cristo/i],
3903
+ };
3904
+
3905
+ const matchQuarterPatterns = {
3906
+ narrow: /^[1234]/i,
3907
+ abbreviated: /^T[1234]/i,
3908
+ wide: /^[1234](º)? trimestre/i,
3909
+ };
3910
+ const parseQuarterPatterns = {
3911
+ any: [/1/i, /2/i, /3/i, /4/i],
3912
+ };
3913
+
3914
+ const matchMonthPatterns = {
3915
+ narrow: /^[jfmajsond]/i,
3916
+ abbreviated: /^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,
3917
+ wide: /^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i,
3918
+ };
3919
+ const parseMonthPatterns = {
3920
+ narrow: [
3921
+ /^j/i,
3922
+ /^f/i,
3923
+ /^m/i,
3924
+ /^a/i,
3925
+ /^m/i,
3926
+ /^j/i,
3927
+ /^j/i,
3928
+ /^a/i,
3929
+ /^s/i,
3930
+ /^o/i,
3931
+ /^n/i,
3932
+ /^d/i,
3933
+ ],
3934
+
3935
+ any: [
3936
+ /^ja/i,
3937
+ /^fev/i,
3938
+ /^mar/i,
3939
+ /^abr/i,
3940
+ /^mai/i,
3941
+ /^jun/i,
3942
+ /^jul/i,
3943
+ /^ago/i,
3944
+ /^set/i,
3945
+ /^out/i,
3946
+ /^nov/i,
3947
+ /^dez/i,
3948
+ ],
3949
+ };
3950
+
3951
+ const matchDayPatterns = {
3952
+ narrow: /^(dom|[23456]ª?|s[aá]b)/i,
3953
+ short: /^(dom|[23456]ª?|s[aá]b)/i,
3954
+ abbreviated: /^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,
3955
+ wide: /^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i,
3956
+ };
3957
+ const parseDayPatterns = {
3958
+ short: [/^d/i, /^2/i, /^3/i, /^4/i, /^5/i, /^6/i, /^s[aá]/i],
3959
+ narrow: [/^d/i, /^2/i, /^3/i, /^4/i, /^5/i, /^6/i, /^s[aá]/i],
3960
+ any: [/^d/i, /^seg/i, /^t/i, /^qua/i, /^qui/i, /^sex/i, /^s[aá]b/i],
3961
+ };
3962
+
3963
+ const matchDayPeriodPatterns = {
3964
+ narrow: /^(a|p|mn|md|(da) (manhã|tarde|noite))/i,
3965
+ any: /^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i,
3966
+ };
3967
+ const parseDayPeriodPatterns = {
3968
+ any: {
3969
+ am: /^a/i,
3970
+ pm: /^p/i,
3971
+ midnight: /^mn|^meia[-\s]noite/i,
3972
+ noon: /^md|^meio[-\s]dia/i,
3973
+ morning: /manhã/i,
3974
+ afternoon: /tarde/i,
3975
+ evening: /tarde/i,
3976
+ night: /noite/i,
3977
+ },
3978
+ };
3979
+
3980
+ const match = {
3981
+ ordinalNumber: buildMatchPatternFn({
3982
+ matchPattern: matchOrdinalNumberPattern,
3983
+ parsePattern: parseOrdinalNumberPattern,
3984
+ valueCallback: (value) => parseInt(value, 10),
3985
+ }),
3986
+
3987
+ era: buildMatchFn({
3988
+ matchPatterns: matchEraPatterns,
3989
+ defaultMatchWidth: "wide",
3990
+ parsePatterns: parseEraPatterns,
3991
+ defaultParseWidth: "any",
3992
+ }),
3993
+
3994
+ quarter: buildMatchFn({
3995
+ matchPatterns: matchQuarterPatterns,
3996
+ defaultMatchWidth: "wide",
3997
+ parsePatterns: parseQuarterPatterns,
3998
+ defaultParseWidth: "any",
3999
+ valueCallback: (index) => index + 1,
4000
+ }),
4001
+
4002
+ month: buildMatchFn({
4003
+ matchPatterns: matchMonthPatterns,
4004
+ defaultMatchWidth: "wide",
4005
+ parsePatterns: parseMonthPatterns,
4006
+ defaultParseWidth: "any",
4007
+ }),
4008
+
4009
+ day: buildMatchFn({
4010
+ matchPatterns: matchDayPatterns,
4011
+ defaultMatchWidth: "wide",
4012
+ parsePatterns: parseDayPatterns,
4013
+ defaultParseWidth: "any",
4014
+ }),
4015
+
4016
+ dayPeriod: buildMatchFn({
4017
+ matchPatterns: matchDayPeriodPatterns,
4018
+ defaultMatchWidth: "any",
4019
+ parsePatterns: parseDayPeriodPatterns,
4020
+ defaultParseWidth: "any",
4021
+ }),
4022
+ };
4023
+
4024
+ /**
4025
+ * @category Locales
4026
+ * @summary Portuguese locale (Brazil).
4027
+ * @language Portuguese
4028
+ * @iso-639-2 por
4029
+ * @author Lucas Duailibe [@duailibe](https://github.com/duailibe)
4030
+ * @author Yago Carballo [@yagocarballo](https://github.com/YagoCarballo)
4031
+ */
4032
+ const ptBR = {
4033
+ code: "pt-BR",
4034
+ formatDistance: formatDistance,
4035
+ formatLong: formatLong,
4036
+ formatRelative: formatRelative,
4037
+ localize: localize,
4038
+ match: match,
4039
+ options: {
4040
+ weekStartsOn: 0 /* Sunday */,
4041
+ firstWeekContainsDate: 1,
4042
+ },
4043
+ };
4044
+
4045
+ const formatDate = (date) => {
4046
+ return format(date, "EEEE',' dd 'de' MMM '-' HH:mm", {
4047
+ locale: ptBR,
4048
+ }).replace('.', '');
4049
+ };
4050
+ function NotificationItem({ notification, onDelete, onClick, }) {
4051
+ return (jsxs("div", { className: "flex flex-row items-start gap-2 px-4 hover:text-primary cursor-pointer rounded", children: [jsx("i", { className: "pi pi-circle-fill text-xs pt-1.5", style: { color: notification.active ? '#0AA836' : '#A0A4B3' } }), jsxs("div", { className: "flex-1 text-left", onClick: () => onClick(notification.id), children: [jsx("h2", { className: clsx('text-base font-bold', !notification.active && 'text-gray'), children: notification.title }), jsx("p", { className: clsx('text-sm py-1 text-gray'), children: notification.description }), jsx("p", { className: clsx('text-sm font-bold', !notification.active && 'text-gray'), children: formatDate(notification.date) })] }), jsx("div", { className: "min-w-6 cursor-pointer", onClick: () => onDelete(notification.id), children: jsx("i", { className: "pi pi-trash text-[#878787] hover:text-backgroundDark" }) })] }, notification.id));
4052
+ }
4053
+
4054
+ function Notification({ onClose, onReadAll, onDeleteNotificationbyId, onClickNotification, notifications, setFilter, filter, setInputValue, inputValue, filterOptions, }) {
4055
+ const customContent = (jsxs("div", { children: [jsxs("div", { className: "flex justify-between items-center px-4 py-3 border-b border-[#F1F1F4]", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("i", { className: "pi pi-bell text-backgroundDark" }), jsx("h2", { className: "font-roboto text-base text-backgroundDark font-bold", children: "Notifica\u00E7\u00F5es" })] }), jsx("div", { className: "flex items-center gap-2", children: jsx(Button, { label: "Marcar todas como lidas", variant: "secondaryOutline", onClick: onReadAll, className: "px-2 py-1 text-xs h-7" }) })] }), jsxs("div", { className: "px-4 py-2 flex flex-row gap-4", children: [jsx(Input, { value: inputValue, onChange: setInputValue, label: "Pesquisar", placeholder: "Pesquisar", icon: "pi-search", iconColor: "gray" }), jsx(FilterButton, { variant: "primary", label: "Filter", icon: jsx(FilterIcon, { color: "#FFFFFF" }), option: filter, setOption: (option) => setFilter(option), filterOptions: filterOptions })] }), jsx("div", { className: "text-center pt-4", children: notifications.length > 0 ? (jsx("div", { className: "w-100 h-[calc(100vh_-114.8px)] overflow-y-auto [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:rounded-r-md [&::-webkit-scrollbar-thumb]:rounded-md [&::-webkit-scrollbar-track]:bg-stone [&::-webkit-scrollbar-thumb]:bg-stoneDark", children: notifications.map((notification) => (jsxs("div", { className: "w-100 hover:bg-stoneBackground", children: [jsx(NotificationItem, { notification: notification, onDelete: onDeleteNotificationbyId, onClick: onClickNotification }), jsx(Divider$1, {})] }, notification.id))) })) : (jsx("p", { children: " Sem notifica\u00E7\u00F5es" })) })] }));
4056
+ return (jsx(Sidebar$1, { visible: true, position: "right", onHide: onClose, className: "w-10/12 md:w-1/2 lg:w-1/3", content: customContent }));
4057
+ }
4058
+
4059
+ function Paginator(props) {
4060
+ const template = {
4061
+ layout: 'PrevPageLink PageLinks NextPageLink',
4062
+ PrevPageLink: (options) => {
4063
+ return (jsx("button", { className: classNames(options.className, '!w-8 !h-8 min-w-0 mr-2 font-roboto'), onClick: options.onClick, disabled: options.disabled, "aria-label": "Pr\u00F3xima p\u00E1gina", children: jsx("span", { className: "pi pi-angle-left" }) }));
4064
+ },
4065
+ NextPageLink: (options) => {
4066
+ return (jsx("button", { className: classNames(options.className, '!w-8 !h-8 min-w-0 ml-2 font-roboto'), onClick: options.onClick, disabled: options.disabled, "aria-label": "P\u00E1gina anterior", children: jsx("span", { className: "pi pi-angle-right" }) }));
4067
+ },
4068
+ PageLinks: (options) => {
4069
+ return React.cloneElement(options.element, {
4070
+ className: classNames(options.element.props.className, '!rounded-full !w-8 !h-8 min-w-0 font-roboto', {
4071
+ 'bg-primary text-white': options.page === options.currentPage,
4072
+ 'hover:bg-gray-100': options.page !== options.currentPage,
4073
+ }),
4074
+ });
4075
+ },
4076
+ };
4077
+ return jsx(Paginator$1, { ...props, template: template });
4078
+ }
4079
+
4080
+ const variants = {
4081
+ white: 'ring-offset-background',
4082
+ secondary: 'ring-offset-secondary',
4083
+ };
4084
+ function RadioButton({ label, value, checked, onChange, disabled = false, error = false, variant = 'secondary', ariaLabel = 'Radio button', }) {
4085
+ return (jsxs("label", { className: clsx('flex items-center gap-2 cursor-pointer font-roboto text-primary', disabled && 'text-disabled', error && !checked && 'text-redError'), children: [jsx("input", { type: "radio", value: value, checked: checked, onChange: onChange, disabled: disabled, className: clsx('font-roboto appearance-none w-2 h-2 border-0 rounded-full shadow-none ring-1 ring-offset-2 checked:bg-primary transition-colors duration-200', disabled
4086
+ ? 'ring-stone'
4087
+ : error && !checked
4088
+ ? 'ring-redError'
4089
+ : 'ring-gray', variants[variant]), "aria-label": ariaLabel }), label] }));
4090
+ }
4091
+
4092
+ function Select(props) {
4093
+ const { options, placeholder = 'Selecione uma opção', label = 'Opção', disabled = false, error, isLoading = false, isReadOnly = true, ariaLabel = 'Selecione uma opção', } = props;
4094
+ const [isOpen, setIsOpen] = useState(false);
4095
+ const [searchText, setSearchText] = useState('');
4096
+ const [highlightedIndex, setHighlightedIndex] = useState(-1);
4097
+ const containerRef = useRef(null);
4098
+ const normalize = (str) => str
4099
+ .normalize('NFD')
4100
+ .replace(/[\u0300-\u036f]/g, '')
4101
+ .toLowerCase();
4102
+ const filteredOptions = options.filter((option) => normalize(option.label).includes(normalize(searchText)));
4103
+ const toggleDropdown = () => {
4104
+ if (!disabled && !isLoading) {
4105
+ const newState = !isOpen;
4106
+ setIsOpen(newState);
4107
+ setSearchText('');
4108
+ setHighlightedIndex(-1);
4109
+ }
4110
+ };
4111
+ const handleSelect = (option) => {
4112
+ if (props.value?.value === option.value) {
4113
+ props.onChange(null);
4114
+ }
4115
+ else {
4116
+ props.onChange(option);
4117
+ }
4118
+ setSearchText('');
4119
+ setIsOpen(false);
4120
+ setHighlightedIndex(-1);
4121
+ };
4122
+ const hasError = !!error && !disabled;
4123
+ const isInputDisabled = disabled || isLoading;
4124
+ useEffect(() => {
4125
+ const handleClickOutside = (event) => {
4126
+ if (containerRef.current &&
4127
+ !containerRef.current.contains(event.target)) {
4128
+ setIsOpen(false);
4129
+ setSearchText('');
4130
+ setHighlightedIndex(-1);
4131
+ }
4132
+ };
4133
+ document.addEventListener('mousedown', handleClickOutside);
4134
+ return () => {
4135
+ document.removeEventListener('mousedown', handleClickOutside);
4136
+ };
4137
+ }, []);
4138
+ return (jsxs("div", { ref: containerRef, className: "relative flex flex-col w-100", children: [jsxs("div", { className: "relative w-full cursor-pointer", onClick: toggleDropdown, children: [jsx(FloatingLabel, { value: props.value ? props.value.label : '', label: label, disabled: isInputDisabled, error: error }), jsxs(IconField, { className: "w-full", children: [jsx(InputText, { placeholder: placeholder, type: "text", value: isLoading
4139
+ ? 'Carregando...'
4140
+ : isOpen
4141
+ ? searchText
4142
+ : (props.value?.label ?? ''), onClick: toggleDropdown, onChange: (e) => {
4143
+ if (isOpen) {
4144
+ setSearchText(e.target.value);
4145
+ setHighlightedIndex(0);
4146
+ }
4147
+ }, onKeyDown: (e) => {
4148
+ if (!isOpen)
4149
+ return;
4150
+ if (e.key === 'ArrowDown') {
4151
+ e.preventDefault();
4152
+ setHighlightedIndex((prev) => prev < filteredOptions.length - 1 ? prev + 1 : 0);
4153
+ }
4154
+ if (e.key === 'ArrowUp') {
4155
+ e.preventDefault();
4156
+ setHighlightedIndex((prev) => prev > 0 ? prev - 1 : filteredOptions.length - 1);
4157
+ }
4158
+ if (e.key === 'Enter') {
4159
+ e.preventDefault();
4160
+ if (highlightedIndex >= 0 &&
4161
+ highlightedIndex < filteredOptions.length) {
4162
+ handleSelect(filteredOptions[highlightedIndex]);
4163
+ }
4164
+ }
4165
+ if (e.key === 'Escape') {
4166
+ e.preventDefault();
4167
+ setIsOpen(false);
4168
+ setSearchText('');
4169
+ setHighlightedIndex(-1);
4170
+ }
4171
+ }, className: clsx('focus:shadow-none text-base w-100 font-roboto border !p-2 rounded-md', hasError
4172
+ ? 'border-redError placeholder:text-redError'
4173
+ : 'border-gray focus:border-primary', isInputDisabled && 'border-stoneDark text-disabled', error && 'border-redError text-redError', !error && 'border-gray placeholder:text-gray', isLoading && 'text-gray', 'truncate'), invalid: hasError, readOnly: !isOpen || isReadOnly, style: { height: '42px', fontSize: '16px' }, disabled: isInputDisabled, "aria-label": ariaLabel }), jsx(InputIcon, { className: clsx(isLoading
4174
+ ? 'pi pi-spinner pi-spin'
4175
+ : isOpen
4176
+ ? 'pi pi-angle-up'
4177
+ : 'pi pi-angle-down', 'text-gray px-2 flex items-center cursor-pointer', isInputDisabled && 'text-disabled', error && 'text-redError'), onClick: toggleDropdown })] })] }), isOpen && !isLoading && (jsx("div", { className: clsx('absolute w-full bg-background border shadow-md z-40 rounded-md p-2 -bottom-1 translate-y-full', error ? 'border-redError' : 'border-gray'), children: jsx("ul", { className: "max-h-60 overflow-y-auto", children: filteredOptions.map((option, index) => (jsxs("li", { onClick: () => handleSelect(option), className: clsx('p-2 flex justify-between items-center cursor-pointer', 'hover:bg-stoneBackground hover:font-bold', index === highlightedIndex && 'bg-stoneBackground font-bold'), children: [jsx("span", { className: "truncate max-w-[calc(100%-20px)]", children: option.label }), jsx("input", { type: 'radio', checked: props.value?.value === option.value, onChange: () => handleSelect(option), className: clsx('appearance-none w-2 h-2 rounded-full ring-1 ring-offset-2 ring-offset-background ring-gray checked:bg-primary cursor-pointer') })] }, option.value))) }) })), hasError && jsx("span", { className: "text-redError text-xs px-2", children: error })] }));
4178
+ }
4179
+
4180
+ function Skeleton({ shape = 'rectangle', width = '100%', height = '1rem', borderRadius, animation = 'wave', size, className, }) {
4181
+ return (jsx("div", { className: className, children: jsx(Skeleton$1, { shape: shape, width: width, height: height, borderRadius: borderRadius, animation: animation, size: size, "aria-label": "skeleton" }) }));
4182
+ }
4183
+
4184
+ const colorVariants = {
4185
+ primary: 'border-primary',
4186
+ secondary: 'border-secondary',
4187
+ };
4188
+ const sizeVariants = {
4189
+ sm: 'w-4 h-4',
4190
+ md: 'w-6 h-6',
4191
+ lg: 'w-8 h-8',
4192
+ };
4193
+ function Spinner({ size = 'md', color = 'primary' }) {
4194
+ return (jsx("div", { className: clsx('border-2 border-t-transparent animate-spin rounded-full', colorVariants[color], sizeVariants[size]), "aria-label": "loading", role: "status" }));
4195
+ }
4196
+
4197
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4198
+ function getNestedValue(obj, path) {
4199
+ if (!obj || !path)
4200
+ return undefined;
4201
+ return path.split('.').reduce((acc, part) => acc?.[part], obj);
4202
+ }
4203
+
4204
+ // import { SortDirection } from '../types'
4205
+ // export function sortData<T>(
4206
+ // data: T[],
4207
+ // column: keyof T,
4208
+ // direction: SortDirection
4209
+ // ): T[] {
4210
+ // return [...data].sort((a, b) => {
4211
+ // const aValue = a[column]
4212
+ // const bValue = b[column]
4213
+ // if (typeof aValue === 'number' && typeof bValue === 'number') {
4214
+ // return direction === 'ASC' ? aValue - bValue : bValue - aValue
4215
+ // }
4216
+ // if (aValue instanceof Date && bValue instanceof Date) {
4217
+ // return direction === 'ASC'
4218
+ // ? aValue.getTime() - bValue.getTime()
4219
+ // : bValue.getTime() - aValue.getTime()
4220
+ // }
4221
+ // const aString = String(aValue).toLowerCase()
4222
+ // const bString = String(bValue).toLowerCase()
4223
+ // return direction === 'ASC'
4224
+ // ? aString.localeCompare(bString)
4225
+ // : bString.localeCompare(aString)
4226
+ // })
4227
+ // }
4228
+ function sortData(data, columnPath, direction) {
4229
+ return [...data].sort((a, b) => {
4230
+ const aValue = getNestedValue(a, columnPath);
4231
+ const bValue = getNestedValue(b, columnPath);
4232
+ if (typeof aValue === 'number' && typeof bValue === 'number') {
4233
+ return direction === 'ASC' ? aValue - bValue : bValue - aValue;
4234
+ }
4235
+ if (aValue instanceof Date && bValue instanceof Date) {
4236
+ return direction === 'ASC'
4237
+ ? aValue.getTime() - bValue.getTime()
4238
+ : bValue.getTime() - aValue.getTime();
4239
+ }
4240
+ const aString = String(aValue || '').toLowerCase();
4241
+ const bString = String(bValue || '').toLowerCase();
4242
+ return direction === 'ASC'
4243
+ ? aString.localeCompare(bString)
4244
+ : bString.localeCompare(aString);
4245
+ });
4246
+ }
4247
+
4248
+ function parseDateRange(value) {
4249
+ try {
4250
+ const parsed = JSON.parse(value);
4251
+ const start = parsed[0] ? new Date(parsed[0]) : null;
4252
+ const end = parsed[1] ? new Date(parsed[1]) : null;
4253
+ return [start, end];
4254
+ }
4255
+ catch {
4256
+ return [null, null];
4257
+ }
4258
+ }
4259
+ function Table({ columns, data, totalRecords, actions = [], isOrdered = true, actionsHeaderClassName = '', actionsColumnsClassName = '', rowsPerPage = 10, onPageChange, isPaginated = true, isLoading = false, onFilterChange, onSortChange, }) {
4260
+ const [sortDirection, setSortDirection] = useState({});
4261
+ const [sortedData, setSortedData] = useState(data);
4262
+ const [currentPage, setCurrentPage] = useState(1);
4263
+ const [filters, setFilters] = useState({});
4264
+ const [openFilter, setOpenFilter] = useState(null);
4265
+ const filterModalRef = useRef(null);
4266
+ const [filterStatus, setFilterStatus] = useState({});
4267
+ const handleSort = (dataIndex) => {
4268
+ setSortDirection((prev) => {
4269
+ const current = prev[dataIndex];
4270
+ let nextDirection;
4271
+ if (current === 'ASC')
4272
+ nextDirection = 'DESC';
4273
+ else if (current === 'DESC')
4274
+ nextDirection = null;
4275
+ else
4276
+ nextDirection = 'ASC';
4277
+ const newSortDirection = { [dataIndex]: nextDirection };
4278
+ if (nextDirection === null) {
4279
+ setSortedData(data);
4280
+ }
4281
+ else {
4282
+ const sorted = sortData(data, dataIndex, nextDirection);
4283
+ setSortedData(sorted);
4284
+ }
4285
+ if (onSortChange) {
4286
+ onSortChange(dataIndex, nextDirection);
4287
+ }
4288
+ return newSortDirection;
4289
+ });
4290
+ };
4291
+ useEffect(() => {
4292
+ setSortedData(data);
4293
+ }, [data]);
4294
+ useEffect(() => {
4295
+ const handleClickOutside = (event) => {
4296
+ const target = event.target;
4297
+ const isClickInsideFilter = filterModalRef.current && filterModalRef.current.contains(target);
4298
+ const isClickInsideCalendar = (target instanceof HTMLElement && target.closest('.p-datepicker')) !==
4299
+ null;
4300
+ if (!isClickInsideFilter && !isClickInsideCalendar) {
4301
+ setOpenFilter(null);
4302
+ }
4303
+ };
4304
+ document.addEventListener('mousedown', handleClickOutside);
4305
+ return () => {
4306
+ document.removeEventListener('mousedown', handleClickOutside);
4307
+ };
4308
+ }, []);
4309
+ const handleFilter = (column) => {
4310
+ setOpenFilter(null);
4311
+ if (onFilterChange) {
4312
+ onFilterChange(filters);
4313
+ }
4314
+ setFilterStatus((prev) => ({
4315
+ ...prev,
4316
+ [column.dataIndex]: filters[column.dataIndex]
4317
+ ? 'applied'
4318
+ : 'default',
4319
+ }));
4320
+ };
4321
+ const handleClearFilter = (column) => {
4322
+ const dataIndex = column.dataIndex;
4323
+ const newFilters = {
4324
+ ...filters,
4325
+ [dataIndex]: '',
4326
+ };
4327
+ setFilters(newFilters);
4328
+ setFilterStatus((prev) => ({
4329
+ ...prev,
4330
+ [dataIndex]: 'default',
4331
+ }));
4332
+ setOpenFilter(null);
4333
+ if (onFilterChange) {
4334
+ onFilterChange(newFilters);
4335
+ }
4336
+ };
4337
+ return (jsxs("div", { children: [jsxs("table", { className: "w-100", children: [jsx("thead", { children: jsxs("tr", { className: "bg-gray-100", children: [columns.map((column) => (jsxs("th", { scope: "col", className: "bg-primary first:rounded-ss-lg font-bold text-background text-sm uppercase p-3 text-left", children: [jsx("div", { children: openFilter === column.dataIndex && (jsxs("div", { ref: filterModalRef, className: "absolute mt-6 bg-background border rounded-md shadow-md p-4 z-10 w-[276px] normal-case", children: [jsxs("div", { className: "space-y-4 text-primary", children: [jsxs("h1", { className: "text-primary text-sm", children: ["Filtrar por ", column?.label?.toLowerCase()] }), jsxs("div", { className: "w-full", children: [column.filterType === 'text' && (jsx(Input, { placeholder: "Digite para filtrar", value: filters[column.dataIndex] || '', onChange: (e) => setFilters((prev) => ({
4338
+ ...prev,
4339
+ [column.dataIndex]: e,
4340
+ })), mask: column?.mask, "aria-label": `Filtrar por ${column.label}` })), column.filterType === 'select' && (jsx(Select, { options: column.filterOptions || [], value: column.filterOptions?.find((option) => option.value ===
4341
+ filters[column.dataIndex]) || null, onChange: (selected) => setFilters((prev) => ({
4342
+ ...prev,
4343
+ [column.dataIndex]: selected?.value ?? null,
4344
+ })), placeholder: "Selecione uma op\u00E7\u00E3o", label: "", "aria-label": `Filtrar por ${column.label}` })), column.filterType === 'multiSelect' && (jsx(MultiSelect, { options: column.filterOptions || [], value: (filters[column.dataIndex]
4345
+ ? JSON.parse(filters[column.dataIndex])
4346
+ : []), onChange: (selected) => setFilters((prev) => ({
4347
+ ...prev,
4348
+ [column.dataIndex]: selected
4349
+ ? JSON.stringify(selected)
4350
+ : '',
4351
+ })), placeholder: "Selecione uma ou mais op\u00E7\u00F5es", label: "", "aria-label": `Filtrar por ${column.label}` })), column.filterType === 'singleDate' && (jsx(CalendarInput, { label: "", selectionMode: "single", placeholder: "Selecione uma data", value: filters[column.dataIndex]
4352
+ ? new Date(filters[column.dataIndex])
4353
+ : null, onChange: (e) => {
4354
+ const value = e?.value;
4355
+ setFilters((prev) => ({
4356
+ ...prev,
4357
+ [column.dataIndex]: value instanceof Date
4358
+ ? value.toISOString()
4359
+ : '',
4360
+ }));
4361
+ }, ariaLabel: `Filtrar por ${column.label}` })), column.filterType === 'rangeDate' && (jsx(CalendarInput, { label: "", selectionMode: "range", placeholder: "Selecione as datas", value: filters[column.dataIndex]
4362
+ ? parseDateRange(filters[column.dataIndex])
4363
+ : null, onChange: (e) => {
4364
+ const range = e?.value;
4365
+ setFilters((prev) => ({
4366
+ ...prev,
4367
+ [column.dataIndex]: range
4368
+ ? JSON.stringify(range)
4369
+ : '',
4370
+ }));
4371
+ }, ariaLabel: `Filtrar por ${column.label}` }))] })] }), jsxs("div", { className: "flex justify-between mt-4", children: [jsx(Button, { variant: "outline", onClick: () => {
4372
+ setFilters((prev) => ({
4373
+ ...prev,
4374
+ [column.dataIndex]: '',
4375
+ }));
4376
+ setOpenFilter(null);
4377
+ }, label: "Fechar", width: "10", size: "small", "aria-label": "Fechar filtro" }), jsx(Button, { variant: "secondary", onClick: () => handleClearFilter(column), label: "Limpar", width: "10", size: "small", "aria-label": "Limpar filtro" }), jsx(Button, { variant: "primary", onClick: () => handleFilter(column), label: "Aplicar", width: "10", size: "small", "aria-label": "Aplicar filtro" })] })] })) }), column.label, isOrdered && (jsx("button", { onClick: () => handleSort(column.dataIndex), "aria-label": `Ordenar por ${column.label}`, children: jsx("i", { className: clsx('pl-2 text-xs cursor-pointer pi', sortDirection[column.dataIndex] === 'ASC' &&
4378
+ 'pi-sort-amount-up-alt', sortDirection[column.dataIndex] === 'DESC' &&
4379
+ 'pi-sort-amount-down', !sortDirection[column.dataIndex] && 'pi-sort-alt') }) })), column.filterable && (jsx(Fragment, { children: jsx("button", { onClick: () => setOpenFilter((prev) => prev === column.dataIndex
4380
+ ? null
4381
+ : column.dataIndex), "aria-label": `Filtrar por ${column.label}`, children: jsx("i", { className: clsx('pl-2 text-xs cursor-pointer', filterStatus[column.dataIndex] === 'applied'
4382
+ ? 'pi pi-filter-slash'
4383
+ : 'pi pi-filter') }) }) }))] }, String(column.dataIndex)))), actions.length > 0 && (jsx("th", { scope: "col", className: clsx('bg-primary rounded-se-lg font-bold text-background text-sm uppercase p-3 text-right pr-4', actionsHeaderClassName), children: "A\u00C7\u00D5ES" }))] }) }), jsx("tbody", { children: isLoading ? (jsx("tr", { children: jsx("td", { colSpan: columns.length + (actions.length > 0 ? 1 : 0), className: "p-6 text-center bg-gray-50", children: jsx("div", { className: "py-2 px-4 flex justify-center items-center gap-2", children: jsx(Spinner, { size: "lg" }) }) }) })) : sortedData.length > 0 ? (sortedData.map((row, index) => (jsxs("tr", { className: clsx(index % 2 === 0 ? 'bg-stoneBackground' : 'bg-background', 'text-primary text-base'), children: [columns.map((column) => {
4384
+ const value = getNestedValue(row, column.dataIndex);
4385
+ return (jsx("td", { className: clsx('p-3 text-sm text-left', typeof column.style === 'function'
4386
+ ? column.style(getNestedValue(row, column.dataIndex), row)
4387
+ : column.style), children: column.render
4388
+ ? column.render(value, row)
4389
+ : String(value) }, String(column.dataIndex)));
4390
+ }), actions.length > 0 && (jsx("td", { className: clsx('text-sm text-right flex flex-row justify-end p-3 gap-2', actionsColumnsClassName), children: actions.map((action, idx) => (jsx("span", { className: clsx('cursor-pointer', action.disabled &&
4391
+ 'opacity-50 pointer-events-none cursor-not-allowed'), onClick: () => {
4392
+ if (!action.disabled)
4393
+ action.onClick(row);
4394
+ }, "aria-label": action?.ariaLabel || action.label, role: "button", children: action.icon }, idx))) }))] }, index)))) : (jsx("tr", { children: jsxs("td", { colSpan: columns.length + (actions.length > 0 ? 1 : 0), className: "p-6 text-center text-primary bg-stoneBackground", children: [jsx("i", { className: "pi pi-database mr-2" }), " N\u00E3o h\u00E1 dados dispon\u00EDveis."] }) })) })] }), sortedData.length > 0 && isPaginated && (jsx(Paginator, { first: (currentPage - 1) * rowsPerPage, rows: rowsPerPage, totalRecords: totalRecords, onPageChange: (event) => {
4395
+ setCurrentPage(event.page + 1);
4396
+ onPageChange(event.page + 1);
4397
+ } }))] }));
4398
+ }
4399
+
4400
+ const colorMap = {
4401
+ blue: 'bg-[#DBEAFE] text-[#1E40AF] border-[#BFDBFE]',
4402
+ red: 'bg-[#FEE2E2] text-[#991B1B] border-[#FCA5A5]',
4403
+ green: 'bg-[#D1FAE5] text-[#065F46] border-[#6EE7B7]',
4404
+ gray: 'bg-[#F3F4F6] text-[#374151] border-[#D1D5DB]',
4405
+ purple: 'bg-[#EDE9FE] text-[#6B21A8] border-[#C4B5FD]',
4406
+ yellow: 'bg-[#FEF9C3] text-[#92400E] border-[#FCD34D]',
4407
+ orange: 'bg-[#FFEDD5] text-[#9A3412] border-[#FDBA74]',
4408
+ pink: 'bg-[#FCE7F3] text-[#9D174D] border-[#F9A8D4]',
4409
+ emerald: 'bg-[#D1FAE5] text-[#065F46] border-[#6EE7B7]',
4410
+ teal: 'bg-[#CCFBF1] text-[#134E4A] border-[#5EEAD4]',
4411
+ cyan: 'bg-[#CFFAFE] text-[#155E75] border-[#67E8F9]',
4412
+ sky: 'bg-[#E0F2FE] text-[#0369A1] border-[#7DD3FC]',
4413
+ indigo: 'bg-[#E0E7FF] text-[#3730A3] border-[#A5B4FC]',
4414
+ violet: 'bg-[#EDE9FE] text-[#6D28D9] border-[#C4B5FD]',
4415
+ fuchsia: 'bg-[#FAE8FF] text-[#A21CAF] border-[#F0ABFC]',
4416
+ rose: 'bg-[#FFE4E6] text-[#BE123C] border-[#FDA4AF]',
4417
+ stone: 'bg-[#E7E5E4] text-[#44403C] border-[#D6D3D1]',
4418
+ amber: 'bg-[#FEF3C7] text-[#92400E] border-[#FCD34D]',
4419
+ lime: 'bg-[#ECFCCB] text-[#365314] border-[#BEF264]',
4420
+ slate: 'bg-[#F1F5F9] text-[#334155] border-[#CBD5E1]',
4421
+ zinc: 'bg-[#F4F4F5] text-[#3F3F46] border-[#D4D4D8]',
4422
+ neutral: 'bg-[#F5F5F5] text-[#404040] border-[#D4D4D4]',
4423
+ };
4424
+ function TagStatus({ value, color = 'gray' }) {
4425
+ const colorClass = colorMap[color];
4426
+ return (jsx("span", { className: `text-sm px-2 py-1 rounded-xl font-medium border ${colorClass}`, children: value }));
4427
+ }
4428
+
4429
+ function ErrorIcon() {
4430
+ return (jsxs("svg", { width: "27", height: "27", viewBox: "0 0 27 27", fill: "none", className: "min-w-7", children: [jsx("circle", { cx: "13.5", cy: "13.5", r: "12.5", stroke: "#B71C1C", strokeWidth: "2" }), jsx("path", { d: "M8 8L19 19", stroke: "#B71C1C", strokeWidth: "2", strokeLinecap: "round" }), jsx("path", { d: "M19 8L8 19", stroke: "#B71C1C", strokeWidth: "2", strokeLinecap: "round" })] }));
4431
+ }
4432
+
4433
+ function InfoIcon() {
4434
+ return (jsxs("svg", { width: "27", height: "27", viewBox: "0 0 27 27", fill: "none", children: [jsx("circle", { cx: "13.5", cy: "13.5", r: "12.5", stroke: "#0045ba", strokeWidth: "2" }), jsx("path", { d: "M14.6294 8L14.3877 15.4048H12.6299L12.3809 8H14.6294ZM12.3223 17.6973C12.3223 17.3848 12.4297 17.126 12.6445 16.9209C12.8643 16.7109 13.1523 16.606 13.5088 16.606C13.8701 16.606 14.1582 16.7109 14.373 16.9209C14.5879 17.126 14.6953 17.3848 14.6953 17.6973C14.6953 18 14.5879 18.2563 14.373 18.4663C14.1582 18.6763 13.8701 18.7812 13.5088 18.7812C13.1523 18.7812 12.8643 18.6763 12.6445 18.4663C12.4297 18.2563 12.3223 18 12.3223 17.6973Z", fill: "#0045ba" })] }));
4435
+ }
4436
+
4437
+ function SuccessIcon() {
4438
+ return (jsxs("svg", { width: "27", height: "27", viewBox: "0 0 27 27", fill: "none", className: "min-w-7", children: [jsx("circle", { cx: "13.5", cy: "13.5", r: "12.5", stroke: '#1B5E20', strokeWidth: "2" }), jsx("path", { d: "M7 12.5L12 17.5L19.5 10", stroke: '#1B5E20', strokeWidth: "2", strokeLinecap: "round" })] }));
4439
+ }
4440
+
4441
+ function Toast({ messages }) {
4442
+ return (jsx("div", { className: "fixed top-5 right-5 flex flex-col gap-2 z-[999]", children: messages.map(({ id, severity, summary, detail }) => (jsxs("div", { className: clsx('p-2 rounded flex items-center gap-2 transition-opacity bg-white border border-l-4 rounded-r-lg shadow-[0_4px_12px_rgba(0,0,0,0.50)]', severity === 'success'
4443
+ ? 'bg-[#E6F4EA] border-[#2E7D32] text-[#1B5E20]'
4444
+ : '', severity === 'info'
4445
+ ? 'bg-[#E3F2FD] border-[#1565C0] text-[#0D47A1]'
4446
+ : '', severity === 'error'
4447
+ ? 'bg-[#FFEBEE] border-[#C62828] text-[#B71C1C]'
4448
+ : ''), "aria-label": "toast", children: [severity === 'success' && jsx(SuccessIcon, {}), severity === 'info' && jsx(InfoIcon, {}), severity === 'error' && jsx(ErrorIcon, {}), jsxs("div", { children: [jsx("strong", { children: summary }), jsx("p", { children: detail })] })] }, id))) }));
4449
+ }
4450
+
4451
+ export { Accordion, AutoComplete, BasicHeader, Breadcrumb, Button, CalendarInput, Card, CardButton, CardIconsButton, Chart, Dialog, Divider, EmptyContent, ExpandablePanel, FileUpload, FilterButton, Header, IconButton, InfoCard, Input, InputSwitch, InputTextArea, InternalMenu, Link, MegaMenu, Modal, MultiSelect, Notification, Paginator, RadioButton, Select, Sidebar, Skeleton, Spinner, Table, TagStatus, Toast };
39
4452
  //# sourceMappingURL=index.js.map