@carlonicora/nextjs-jsonapi 0.0.1

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 (222) hide show
  1. package/README.md +889 -0
  2. package/dist/AbstractService-BKlpJA61.d.mts +109 -0
  3. package/dist/AbstractService-D9eSVKNa.d.ts +109 -0
  4. package/dist/ApiData-DPKNfY-9.d.mts +10 -0
  5. package/dist/ApiData-DPKNfY-9.d.ts +10 -0
  6. package/dist/ApiDataInterface-DPP8s46n.d.mts +21 -0
  7. package/dist/ApiDataInterface-DPP8s46n.d.ts +21 -0
  8. package/dist/ApiRequestDataTypeInterface-CUKFDBx2.d.mts +20 -0
  9. package/dist/ApiRequestDataTypeInterface-CUKFDBx2.d.ts +20 -0
  10. package/dist/ApiResponseInterface-BHN5D9r5.d.mts +16 -0
  11. package/dist/ApiResponseInterface-DDI7QQPR.d.ts +16 -0
  12. package/dist/BlockNoteEditor-UVO3VZZE.mjs +396 -0
  13. package/dist/BlockNoteEditor-UVO3VZZE.mjs.map +1 -0
  14. package/dist/BlockNoteEditor-VFWG6LXI.js +396 -0
  15. package/dist/BlockNoteEditor-VFWG6LXI.js.map +1 -0
  16. package/dist/JsonApiRequest-S3ICLM7B.mjs +20 -0
  17. package/dist/JsonApiRequest-S3ICLM7B.mjs.map +1 -0
  18. package/dist/JsonApiRequest-ZZLSP26T.js +20 -0
  19. package/dist/JsonApiRequest-ZZLSP26T.js.map +1 -0
  20. package/dist/atoms/index.d.mts +12 -0
  21. package/dist/atoms/index.d.ts +12 -0
  22. package/dist/atoms/index.js +9 -0
  23. package/dist/atoms/index.js.map +1 -0
  24. package/dist/atoms/index.mjs +9 -0
  25. package/dist/atoms/index.mjs.map +1 -0
  26. package/dist/breadcrumb.item.data.interface-CgB4_1EE.d.mts +6 -0
  27. package/dist/breadcrumb.item.data.interface-CgB4_1EE.d.ts +6 -0
  28. package/dist/chunk-2K3Q24UF.js +89 -0
  29. package/dist/chunk-2K3Q24UF.js.map +1 -0
  30. package/dist/chunk-2LM6LCJW.mjs +1091 -0
  31. package/dist/chunk-2LM6LCJW.mjs.map +1 -0
  32. package/dist/chunk-366S2JCC.mjs +31 -0
  33. package/dist/chunk-366S2JCC.mjs.map +1 -0
  34. package/dist/chunk-3FBCC4G3.js +8 -0
  35. package/dist/chunk-3FBCC4G3.js.map +1 -0
  36. package/dist/chunk-4HCRAOS5.js +28 -0
  37. package/dist/chunk-4HCRAOS5.js.map +1 -0
  38. package/dist/chunk-5W6AKZE6.mjs +131 -0
  39. package/dist/chunk-5W6AKZE6.mjs.map +1 -0
  40. package/dist/chunk-6GKHCVF6.js +98 -0
  41. package/dist/chunk-6GKHCVF6.js.map +1 -0
  42. package/dist/chunk-7QVYU63E.js +7 -0
  43. package/dist/chunk-7QVYU63E.js.map +1 -0
  44. package/dist/chunk-A3J3AAYM.mjs +97 -0
  45. package/dist/chunk-A3J3AAYM.mjs.map +1 -0
  46. package/dist/chunk-A5DDIABK.js +4209 -0
  47. package/dist/chunk-A5DDIABK.js.map +1 -0
  48. package/dist/chunk-AUXK7QSA.mjs +15 -0
  49. package/dist/chunk-AUXK7QSA.mjs.map +1 -0
  50. package/dist/chunk-AWONBQQP.js +97 -0
  51. package/dist/chunk-AWONBQQP.js.map +1 -0
  52. package/dist/chunk-BLWVZK6J.mjs +28 -0
  53. package/dist/chunk-BLWVZK6J.mjs.map +1 -0
  54. package/dist/chunk-C7C7VY4F.mjs +77 -0
  55. package/dist/chunk-C7C7VY4F.mjs.map +1 -0
  56. package/dist/chunk-CXQOWQSY.js +55 -0
  57. package/dist/chunk-CXQOWQSY.js.map +1 -0
  58. package/dist/chunk-DD3KISNB.mjs +98 -0
  59. package/dist/chunk-DD3KISNB.mjs.map +1 -0
  60. package/dist/chunk-DKKMWBP4.mjs +1 -0
  61. package/dist/chunk-DKKMWBP4.mjs.map +1 -0
  62. package/dist/chunk-DO2HLAZO.js +48 -0
  63. package/dist/chunk-DO2HLAZO.js.map +1 -0
  64. package/dist/chunk-DZXDB3K2.mjs +17 -0
  65. package/dist/chunk-DZXDB3K2.mjs.map +1 -0
  66. package/dist/chunk-ECDTZBYO.mjs +230 -0
  67. package/dist/chunk-ECDTZBYO.mjs.map +1 -0
  68. package/dist/chunk-EFJEWLRL.js +16 -0
  69. package/dist/chunk-EFJEWLRL.js.map +1 -0
  70. package/dist/chunk-FY4SXJGU.js +806 -0
  71. package/dist/chunk-FY4SXJGU.js.map +1 -0
  72. package/dist/chunk-GYWPEPOH.mjs +1354 -0
  73. package/dist/chunk-GYWPEPOH.mjs.map +1 -0
  74. package/dist/chunk-H6FMOA6B.js +1 -0
  75. package/dist/chunk-H6FMOA6B.js.map +1 -0
  76. package/dist/chunk-HR4H2FP7.mjs +89 -0
  77. package/dist/chunk-HR4H2FP7.mjs.map +1 -0
  78. package/dist/chunk-I2REI7OA.js +462 -0
  79. package/dist/chunk-I2REI7OA.js.map +1 -0
  80. package/dist/chunk-IBS6NI7D.js +77 -0
  81. package/dist/chunk-IBS6NI7D.js.map +1 -0
  82. package/dist/chunk-IWFGEPAA.mjs +4209 -0
  83. package/dist/chunk-IWFGEPAA.mjs.map +1 -0
  84. package/dist/chunk-J4Q36PMP.js +31 -0
  85. package/dist/chunk-J4Q36PMP.js.map +1 -0
  86. package/dist/chunk-JC3WJK65.js +1091 -0
  87. package/dist/chunk-JC3WJK65.js.map +1 -0
  88. package/dist/chunk-L6EQEAXU.mjs +462 -0
  89. package/dist/chunk-L6EQEAXU.mjs.map +1 -0
  90. package/dist/chunk-LXKSUWAV.js +15 -0
  91. package/dist/chunk-LXKSUWAV.js.map +1 -0
  92. package/dist/chunk-MFO27OHB.mjs +48 -0
  93. package/dist/chunk-MFO27OHB.mjs.map +1 -0
  94. package/dist/chunk-PAWJFY3S.mjs +7 -0
  95. package/dist/chunk-PAWJFY3S.mjs.map +1 -0
  96. package/dist/chunk-Q2N6SQYW.mjs +8 -0
  97. package/dist/chunk-Q2N6SQYW.mjs.map +1 -0
  98. package/dist/chunk-RAF7PNLG.js +131 -0
  99. package/dist/chunk-RAF7PNLG.js.map +1 -0
  100. package/dist/chunk-RUR22SVM.js +17 -0
  101. package/dist/chunk-RUR22SVM.js.map +1 -0
  102. package/dist/chunk-TEGF6ZWG.js +109 -0
  103. package/dist/chunk-TEGF6ZWG.js.map +1 -0
  104. package/dist/chunk-TMVHSY3Y.js +230 -0
  105. package/dist/chunk-TMVHSY3Y.js.map +1 -0
  106. package/dist/chunk-V2JJPI7N.js +1354 -0
  107. package/dist/chunk-V2JJPI7N.js.map +1 -0
  108. package/dist/chunk-WWWMJZEF.mjs +806 -0
  109. package/dist/chunk-WWWMJZEF.mjs.map +1 -0
  110. package/dist/chunk-X4BIHJ2B.mjs +55 -0
  111. package/dist/chunk-X4BIHJ2B.mjs.map +1 -0
  112. package/dist/chunk-YDVTFM7X.mjs +109 -0
  113. package/dist/chunk-YDVTFM7X.mjs.map +1 -0
  114. package/dist/chunk-YF5XQZDR.mjs +16 -0
  115. package/dist/chunk-YF5XQZDR.mjs.map +1 -0
  116. package/dist/client/index.d.mts +252 -0
  117. package/dist/client/index.d.ts +252 -0
  118. package/dist/client/index.js +275 -0
  119. package/dist/client/index.js.map +1 -0
  120. package/dist/client/index.mjs +274 -0
  121. package/dist/client/index.mjs.map +1 -0
  122. package/dist/components/index.d.mts +441 -0
  123. package/dist/components/index.d.ts +441 -0
  124. package/dist/components/index.js +2474 -0
  125. package/dist/components/index.js.map +1 -0
  126. package/dist/components/index.mjs +2474 -0
  127. package/dist/components/index.mjs.map +1 -0
  128. package/dist/config-hXufftVS.d.mts +34 -0
  129. package/dist/config-hXufftVS.d.ts +34 -0
  130. package/dist/content.interface-BhyAiOFq.d.ts +35 -0
  131. package/dist/content.interface-Dg2lt_An.d.mts +35 -0
  132. package/dist/contexts/index.d.mts +56 -0
  133. package/dist/contexts/index.d.ts +56 -0
  134. package/dist/contexts/index.js +21 -0
  135. package/dist/contexts/index.js.map +1 -0
  136. package/dist/contexts/index.mjs +21 -0
  137. package/dist/contexts/index.mjs.map +1 -0
  138. package/dist/core/index.d.mts +152 -0
  139. package/dist/core/index.d.ts +152 -0
  140. package/dist/core/index.js +47 -0
  141. package/dist/core/index.js.map +1 -0
  142. package/dist/core/index.mjs +47 -0
  143. package/dist/core/index.mjs.map +1 -0
  144. package/dist/d3.link.interface-QMdB22bC.d.mts +20 -0
  145. package/dist/d3.link.interface-QMdB22bC.d.ts +20 -0
  146. package/dist/features/index.d.mts +553 -0
  147. package/dist/features/index.d.ts +553 -0
  148. package/dist/features/index.js +94 -0
  149. package/dist/features/index.js.map +1 -0
  150. package/dist/features/index.mjs +94 -0
  151. package/dist/features/index.mjs.map +1 -0
  152. package/dist/hooks/index.d.mts +94 -0
  153. package/dist/hooks/index.d.ts +94 -0
  154. package/dist/hooks/index.js +43 -0
  155. package/dist/hooks/index.js.map +1 -0
  156. package/dist/hooks/index.mjs +43 -0
  157. package/dist/hooks/index.mjs.map +1 -0
  158. package/dist/index.d.mts +72 -0
  159. package/dist/index.d.ts +72 -0
  160. package/dist/index.js +84 -0
  161. package/dist/index.js.map +1 -0
  162. package/dist/index.mjs +84 -0
  163. package/dist/index.mjs.map +1 -0
  164. package/dist/interfaces/index.d.mts +3 -0
  165. package/dist/interfaces/index.d.ts +3 -0
  166. package/dist/interfaces/index.js +2 -0
  167. package/dist/interfaces/index.js.map +1 -0
  168. package/dist/interfaces/index.mjs +2 -0
  169. package/dist/interfaces/index.mjs.map +1 -0
  170. package/dist/permissions/index.d.mts +41 -0
  171. package/dist/permissions/index.d.ts +41 -0
  172. package/dist/permissions/index.js +14 -0
  173. package/dist/permissions/index.js.map +1 -0
  174. package/dist/permissions/index.mjs +14 -0
  175. package/dist/permissions/index.mjs.map +1 -0
  176. package/dist/request-7FE3LJLV.mjs +9 -0
  177. package/dist/request-7FE3LJLV.mjs.map +1 -0
  178. package/dist/request-FYMQK5CX.mjs +9 -0
  179. package/dist/request-FYMQK5CX.mjs.map +1 -0
  180. package/dist/request-QFS7NEIE.js +9 -0
  181. package/dist/request-QFS7NEIE.js.map +1 -0
  182. package/dist/request-ZYY6RI5X.js +9 -0
  183. package/dist/request-ZYY6RI5X.js.map +1 -0
  184. package/dist/roles/index.d.mts +33 -0
  185. package/dist/roles/index.d.ts +33 -0
  186. package/dist/roles/index.js +12 -0
  187. package/dist/roles/index.js.map +1 -0
  188. package/dist/roles/index.mjs +12 -0
  189. package/dist/roles/index.mjs.map +1 -0
  190. package/dist/server/index.d.mts +44 -0
  191. package/dist/server/index.d.ts +44 -0
  192. package/dist/server/index.js +29 -0
  193. package/dist/server/index.js.map +1 -0
  194. package/dist/server/index.mjs +29 -0
  195. package/dist/server/index.mjs.map +1 -0
  196. package/dist/shadcnui/index.d.mts +698 -0
  197. package/dist/shadcnui/index.d.ts +698 -0
  198. package/dist/shadcnui/index.js +466 -0
  199. package/dist/shadcnui/index.js.map +1 -0
  200. package/dist/shadcnui/index.mjs +465 -0
  201. package/dist/shadcnui/index.mjs.map +1 -0
  202. package/dist/token-IJSPOMW6.mjs +9 -0
  203. package/dist/token-IJSPOMW6.mjs.map +1 -0
  204. package/dist/token-MJMC26ON.js +9 -0
  205. package/dist/token-MJMC26ON.js.map +1 -0
  206. package/dist/token-UADJQ7VC.mjs +9 -0
  207. package/dist/token-UADJQ7VC.mjs.map +1 -0
  208. package/dist/token-UYE7CV6X.js +9 -0
  209. package/dist/token-UYE7CV6X.js.map +1 -0
  210. package/dist/types-DluCaP1I.d.ts +95 -0
  211. package/dist/types-lQVA8d_P.d.mts +95 -0
  212. package/dist/useDataListRetriever-futhx3OP.d.mts +32 -0
  213. package/dist/useDataListRetriever-futhx3OP.d.ts +32 -0
  214. package/dist/user.interface-CAsTIbuQ.d.mts +85 -0
  215. package/dist/user.interface-CbWqMaaU.d.ts +85 -0
  216. package/dist/utils/index.d.mts +201 -0
  217. package/dist/utils/index.d.ts +201 -0
  218. package/dist/utils/index.js +32 -0
  219. package/dist/utils/index.js.map +1 -0
  220. package/dist/utils/index.mjs +32 -0
  221. package/dist/utils/index.mjs.map +1 -0
  222. package/package.json +205 -0
@@ -0,0 +1,2474 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3
+
4
+ var _chunkRUR22SVMjs = require('../chunk-RUR22SVM.js');
5
+
6
+
7
+
8
+ var _chunkAWONBQQPjs = require('../chunk-AWONBQQP.js');
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+ var _chunkA5DDIABKjs = require('../chunk-A5DDIABK.js');
85
+
86
+
87
+ var _chunkJC3WJK65js = require('../chunk-JC3WJK65.js');
88
+
89
+
90
+
91
+
92
+
93
+ var _chunkFY4SXJGUjs = require('../chunk-FY4SXJGU.js');
94
+
95
+
96
+
97
+
98
+
99
+ var _chunkCXQOWQSYjs = require('../chunk-CXQOWQSY.js');
100
+
101
+
102
+ var _chunk3FBCC4G3js = require('../chunk-3FBCC4G3.js');
103
+
104
+
105
+
106
+ var _chunkRAF7PNLGjs = require('../chunk-RAF7PNLG.js');
107
+ require('../chunk-6GKHCVF6.js');
108
+ require('../chunk-4HCRAOS5.js');
109
+ require('../chunk-I2REI7OA.js');
110
+ require('../chunk-TEGF6ZWG.js');
111
+ require('../chunk-J4Q36PMP.js');
112
+ require('../chunk-DO2HLAZO.js');
113
+
114
+
115
+ var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
116
+
117
+ // src/components/navigations/Breadcrumb.tsx
118
+ var _nextintl = require('next-intl');
119
+ var _react = require('react'); var React2 = _interopRequireWildcard(_react);
120
+ var _jsxruntime = require('react/jsx-runtime');
121
+ var ITEMS_TO_DISPLAY = 3;
122
+ function Breadcrumb2({ items }) {
123
+ const generateUrl = _chunkFY4SXJGUjs.usePageUrlGenerator.call(void 0, );
124
+ const t = _nextintl.useTranslations.call(void 0, );
125
+ const [open, setOpen] = _react.useState.call(void 0, false);
126
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Breadcrumb, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.BreadcrumbList, { children: [
127
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbItem, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: generateUrl({ page: `/` }), children: t(`generic.home`) }) }),
128
+ items.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbSeparator, {}),
129
+ items.length > ITEMS_TO_DISPLAY ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
130
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbItem, { children: items[0].href ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: items[0].href, children: items[0].name }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: items[0].name }) }),
131
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbSeparator, {}),
132
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbItem, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.DropdownMenu, { open, onOpenChange: setOpen, children: [
133
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuTrigger, { className: "flex items-center gap-1", "aria-label": "Toggle menu", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbEllipsis, { className: "h-4 w-4" }) }),
134
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuContent, { align: "start", children: items.slice(1, -ITEMS_TO_DISPLAY + 1).map((item, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuItem, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: item.href ? item.href : "#", children: item.name }) }, index)) })
135
+ ] }) }),
136
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbSeparator, {}),
137
+ items.slice(-ITEMS_TO_DISPLAY + 1).map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
138
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbItem, { children: item.href ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: item.href, children: item.name }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: item.name }) }),
139
+ index < items.slice(-ITEMS_TO_DISPLAY + 1).length - 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbSeparator, {})
140
+ ] }, index))
141
+ ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: items.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
142
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbItem, { children: item.href ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: item.href, children: item.name }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: item.name }) }),
143
+ index < items.length - 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.BreadcrumbSeparator, {})
144
+ ] }, index)) })
145
+ ] }) });
146
+ }
147
+ _chunk7QVYU63Ejs.__name.call(void 0, Breadcrumb2, "Breadcrumb");
148
+
149
+ // src/components/navigations/ContentTitle.tsx
150
+
151
+
152
+ function ContentTitle({ type, element, functions, className }) {
153
+ const [clientFunctions, setClientFunctions] = _react.useState.call(void 0, null);
154
+ const [isClient, setIsClient] = _react.useState.call(void 0, false);
155
+ _react.useEffect.call(void 0, () => {
156
+ setIsClient(true);
157
+ setClientFunctions(functions);
158
+ }, [functions]);
159
+ if (!element) return null;
160
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkJC3WJK65js.cn.call(void 0, `mb-4 flex w-full flex-col`, className), children: [
161
+ (type || isClient) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-row items-center justify-between gap-x-4", children: [
162
+ type && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `text-muted-foreground text-xl font-light`, children: type }),
163
+ isClient && clientFunctions && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-row items-center justify-start", children: clientFunctions })
164
+ ] }),
165
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `text-primary w-full text-3xl font-semibold`, children: element })
166
+ ] });
167
+ }
168
+ _chunk7QVYU63Ejs.__name.call(void 0, ContentTitle, "ContentTitle");
169
+
170
+ // src/components/navigations/Header.tsx
171
+
172
+ function Header({ children }) {
173
+ const { breadcrumbs } = _chunkRAF7PNLGjs.useSharedContext.call(void 0, );
174
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "header", { className: `sticky top-0 z-10 flex h-12 flex-col items-center justify-start gap-x-4 border-b`, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-sidebar flex h-12 w-full flex-row items-center justify-between pl-2 pr-4", children: [
175
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SidebarTrigger, { "aria-label": "Toggle sidebar" }),
176
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-row items-center justify-start", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Breadcrumb2, { items: breadcrumbs }) }),
177
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-64 flex-row items-center justify-end gap-x-4 whitespace-nowrap", children: children ? children : null })
178
+ ] }) });
179
+ }
180
+ _chunk7QVYU63Ejs.__name.call(void 0, Header, "Header");
181
+
182
+ // src/components/navigations/ModeToggleSwitch.tsx
183
+ var _lucidereact = require('lucide-react');
184
+ var _nextthemes = require('next-themes');
185
+
186
+ function ModeToggleSwitch() {
187
+ const { theme, setTheme } = _nextthemes.useTheme.call(void 0, );
188
+ const handleToggle = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
189
+ setTheme(theme === "light" ? "dark" : "light");
190
+ }, "handleToggle");
191
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Switch, { checked: theme === "dark", onCheckedChange: handleToggle, className: "relative", children: theme === "dark" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoonIcon, { className: "text-primary-foreground h-4 w-4" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.SunIcon, { className: "text-primary h-4 w-4" }) }) });
192
+ }
193
+ _chunk7QVYU63Ejs.__name.call(void 0, ModeToggleSwitch, "ModeToggleSwitch");
194
+
195
+ // src/components/navigations/PageSection.tsx
196
+
197
+
198
+ var _uuid = require('uuid');
199
+
200
+ function PageSection({ children, title, options, open, small, onToggle }) {
201
+ const [isOpen, setIsOpen] = _react.useState.call(void 0, _nullishCoalesce(open, () => ( true)));
202
+ const [shouldRender, setShouldRender] = _react.useState.call(void 0, _nullishCoalesce(open, () => ( true)));
203
+ _react.useEffect.call(void 0, () => {
204
+ if (onToggle) {
205
+ onToggle(isOpen);
206
+ }
207
+ }, [isOpen]);
208
+ const toggleOpen = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => setIsOpen(!isOpen), "toggleOpen");
209
+ _react.useEffect.call(void 0, () => {
210
+ if (isOpen) {
211
+ setShouldRender(true);
212
+ } else {
213
+ const timer = setTimeout(() => setShouldRender(false), 300);
214
+ return () => clearTimeout(timer);
215
+ }
216
+ }, [isOpen]);
217
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
218
+ "section",
219
+ {
220
+ id: title ? title.toLowerCase().replaceAll(" ", "") : _uuid.v4.call(void 0, ),
221
+ className: `${isOpen ? "mb-4" : "my-0"} flex w-full scroll-mt-40 flex-col`,
222
+ children: [
223
+ title && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
224
+ "div",
225
+ {
226
+ className: `${isOpen ? "mb-4" : "mb-0"} flex w-full justify-between border-b ${small ? `border-muted` : `border-primary`} pb-1`,
227
+ children: [
228
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full cursor-pointer items-center justify-start gap-x-2", onClick: toggleOpen, children: [
229
+ isOpen ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronDownIcon, { className: `text-primary h-4 w-4` }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronRightIcon, { className: "text-primary h-4 w-4" }),
230
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: `flex w-full ${small === true ? `text-sm` : `text-lg`} text-primary font-semibold`, children: title })
231
+ ] }),
232
+ options && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex gap-2", children: options })
233
+ ]
234
+ }
235
+ ),
236
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `overflow-hidden transition-all duration-300 ${isOpen ? "" : "max-h-0"}`, children: shouldRender && children })
237
+ ]
238
+ }
239
+ );
240
+ }
241
+ _chunk7QVYU63Ejs.__name.call(void 0, PageSection, "PageSection");
242
+
243
+ // src/components/navigations/RecentPagesNavigator.tsx
244
+ var _jotai = require('jotai');
245
+
246
+
247
+
248
+ function RecentPagesNavigator() {
249
+ const recentPages = _jotai.useAtomValue.call(void 0, _chunk3FBCC4G3js.recentPagesAtom);
250
+ const t = _nextintl.useTranslations.call(void 0, );
251
+ const { state } = _chunkA5DDIABKjs.useSidebar.call(void 0, );
252
+ if (recentPages.length === 0) {
253
+ return null;
254
+ }
255
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.DropdownMenu, { children: [
256
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full cursor-pointer items-center gap-2", children: state === "collapsed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.HistoryIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t(`generic.recent_pages`) }) }) }),
257
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.DropdownMenuContent, { align: "start", className: "w-96", children: [
258
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuLabel, { children: t(`generic.recent_pages`) }),
259
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuSeparator, {}),
260
+ recentPages.map((page, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: page.url, className: "flex items-center gap-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
261
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "truncate text-sm", children: page.title }),
262
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground text-xs font-normal", children: t(`types.${page.moduleType}`, { count: 1 }) })
263
+ ] }) }) }, `${page.url}-${index}`))
264
+ ] })
265
+ ] });
266
+ }
267
+ _chunk7QVYU63Ejs.__name.call(void 0, RecentPagesNavigator, "RecentPagesNavigator");
268
+
269
+ // src/components/containers/PageContainer.tsx
270
+
271
+ function PageContainer({ children, testId, className }) {
272
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `flex h-full w-full flex-col`, "data-testid": testId, children: [
273
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Header, {}),
274
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "main", { className: _chunkJC3WJK65js.cn.call(void 0, `flex w-full flex-1 flex-col gap-y-4 pt-4 pl-4 pr-4`, className), children })
275
+ ] });
276
+ }
277
+ _chunk7QVYU63Ejs.__name.call(void 0, PageContainer, "PageContainer");
278
+
279
+ // src/components/containers/ReactMarkdownContainer.tsx
280
+
281
+
282
+
283
+ var _reactmarkdown = require('react-markdown'); var _reactmarkdown2 = _interopRequireDefault(_reactmarkdown);
284
+ var _remarkgfm = require('remark-gfm'); var _remarkgfm2 = _interopRequireDefault(_remarkgfm);
285
+
286
+ function ReactMarkdownContainer({
287
+ content,
288
+ collapsible = false,
289
+ initialLines = 4,
290
+ size = "normal"
291
+ }) {
292
+ const t = _nextintl.useTranslations.call(void 0, "generic.buttons");
293
+ const [isExpanded, setIsExpanded] = _react.useState.call(void 0, false);
294
+ const [showExpandButton, setShowExpandButton] = _react.useState.call(void 0, false);
295
+ const contentRef = _react.useRef.call(void 0, null);
296
+ _react.useEffect.call(void 0, () => {
297
+ if (collapsible && contentRef.current && !isExpanded) {
298
+ const isOverflowing = contentRef.current.scrollHeight > contentRef.current.clientHeight;
299
+ setShowExpandButton(isOverflowing);
300
+ }
301
+ }, [collapsible, content, isExpanded]);
302
+ const handleToggle = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
303
+ setIsExpanded(!isExpanded);
304
+ }, "handleToggle");
305
+ const clampStyle = collapsible && !isExpanded ? {
306
+ display: "-webkit-box",
307
+ WebkitLineClamp: initialLines,
308
+ WebkitBoxOrient: "vertical",
309
+ overflow: "hidden"
310
+ } : {};
311
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
312
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
313
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: contentRef, style: clampStyle, className: "transition-all duration-300 ease-in-out", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
314
+ _reactmarkdown2.default,
315
+ {
316
+ remarkPlugins: [_remarkgfm2.default],
317
+ components: {
318
+ p: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: size === "small" ? "text-xs" : "", children }), "p"),
319
+ li: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { className: size === "small" ? "text-xs" : "", children }), "li"),
320
+ table: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "table", { className: "w-full table-auto border-collapse border", children }), "table"),
321
+ th: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { className: `border px-4 py-2 text-left ${size === "small" ? "px-2 py-1 text-xs" : ""}`, children }), "th"),
322
+ td: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: `border px-4 py-2 ${size === "small" ? "px-2 py-1 text-xs" : ""}`, children }), "td"),
323
+ tr: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { className: "even:bg-gray-50", children }), "tr"),
324
+ ul: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: `list-disc ${size === "small" ? "pl-3" : "pl-4"}`, children }), "ul"),
325
+ ol: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { className: `list-decimal ${size === "small" ? "pl-3" : "pl-4"}`, children }), "ol"),
326
+ h1: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: size === "small" ? "my-1 mt-2 text-sm font-bold" : "my-2 mt-4 text-3xl font-medium", children }), "h1"),
327
+ h2: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
328
+ "h2",
329
+ {
330
+ className: size === "small" ? "my-1 mt-2 text-sm font-semibold" : "my-2 mt-4 text-2xl font-semibold",
331
+ children
332
+ }
333
+ ), "h2"),
334
+ h3: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: size === "small" ? "my-1 mt-2 text-sm font-medium" : "my-2 mt-4 text-xl font-semibold", children }), "h3"),
335
+ h4: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: size === "small" ? "my-1 mt-2 text-sm font-medium" : "my-2 mt-4 text-lg font-semibold", children }), "h4")
336
+ },
337
+ children: content
338
+ }
339
+ ) }),
340
+ collapsible && !isExpanded && showExpandButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pointer-events-none absolute right-0 bottom-0 left-0 h-12 bg-gradient-to-t from-white to-transparent" })
341
+ ] }),
342
+ collapsible && showExpandButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
343
+ "button",
344
+ {
345
+ onClick: handleToggle,
346
+ className: "flex items-center gap-1 rounded-md px-3 py-1.5 text-sm text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900",
347
+ "aria-label": isExpanded ? t("show_less") : t("show_more"),
348
+ children: [
349
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isExpanded ? t("show_less") : t("show_more") }),
350
+ isExpanded ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronUp, { className: "h-4 w-4" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown, { className: "h-4 w-4" })
351
+ ]
352
+ }
353
+ ) })
354
+ ] });
355
+ }
356
+ _chunk7QVYU63Ejs.__name.call(void 0, ReactMarkdownContainer, "ReactMarkdownContainer");
357
+
358
+ // src/components/containers/TabsContainer.tsx
359
+
360
+ function TabsContainer({
361
+ tabs,
362
+ defaultTab,
363
+ tabsListClassName,
364
+ tabsTriggerClassName,
365
+ scrollAreaClassName,
366
+ style,
367
+ additionalComponent
368
+ }) {
369
+ const { hasPermissionToModules } = _chunkRAF7PNLGjs.useCurrentUserContext.call(void 0, );
370
+ const validTabs = tabs.filter(
371
+ (tab) => tab.modules && tab.action ? hasPermissionToModules({ modules: tab.modules, action: tab.action }) : true
372
+ );
373
+ if (validTabs.length === 0) return null;
374
+ const defaultValue = _nullishCoalesce(defaultTab, () => ( tabs[0].label));
375
+ if (validTabs.length === 1) {
376
+ return validTabs[0].content;
377
+ }
378
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Tabs, { defaultValue, className: "w-full", children: [
379
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full items-center justify-between", children: [
380
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
381
+ _chunkA5DDIABKjs.TabsList,
382
+ {
383
+ className: _chunkJC3WJK65js.cn.call(void 0,
384
+ `${style ? `my-4 flex w-full justify-start rounded-none border-b bg-transparent pb-0` : ``}`,
385
+ tabsListClassName
386
+ ),
387
+ children: validTabs.map((tab) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
388
+ _chunkA5DDIABKjs.TabsTrigger,
389
+ {
390
+ value: tab.label,
391
+ className: _chunkJC3WJK65js.cn.call(void 0,
392
+ `${style ? `text-muted-foreground border-accent data-[state=active]:text-foreground hover:text-foreground cursor-pointer rounded-none bg-transparent pb-2 text-sm font-light hover:border-0 data-[state=active]:border-b data-[state=active]:font-medium data-[state=active]:shadow-none` : `text-primary text-xs`}`,
393
+ tabsTriggerClassName
394
+ ),
395
+ children: _nullishCoalesce(tab.contentLabel, () => ( tab.label))
396
+ },
397
+ tab.label
398
+ ))
399
+ }
400
+ ),
401
+ additionalComponent && additionalComponent
402
+ ] }),
403
+ scrollAreaClassName ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.ScrollArea, { className: scrollAreaClassName, children: validTabs.map((tab) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TabsContent, { value: tab.label, children: tab.content }, tab.label)) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: validTabs.map((tab) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TabsContent, { value: tab.label, children: tab.content }, tab.label)) })
404
+ ] });
405
+ }
406
+ _chunk7QVYU63Ejs.__name.call(void 0, TabsContainer, "TabsContainer");
407
+
408
+ // src/components/contents/AttributeElement.tsx
409
+
410
+ function AttributeElement({ inline, title, value, className }) {
411
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkJC3WJK65js.cn.call(void 0, `flex ${inline === true ? "flex-row" : "flex-col"} my-1 justify-start`, className), children: [
412
+ title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `${inline === true ? "min-w-48 pr-4" : "w-full"} text-sm font-semibold`, children: title }),
413
+ value && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col text-sm", children: value })
414
+ ] });
415
+ }
416
+ _chunk7QVYU63Ejs.__name.call(void 0, AttributeElement, "AttributeElement");
417
+
418
+ // src/components/details/AllowedUsersDetails.tsx
419
+
420
+
421
+ function AllowedUsersDetails({ showTitle, content }) {
422
+ const t = _nextintl.useTranslations.call(void 0, );
423
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-2 flex w-full flex-col gap-y-2", children: [
424
+ showTitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-xs font-semibold", children: t("generic.permissions") }),
425
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full items-center justify-start gap-x-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAWONBQQPjs.ContributorsList, { content }) })
426
+ ] });
427
+ }
428
+ _chunk7QVYU63Ejs.__name.call(void 0, AllowedUsersDetails, "AllowedUsersDetails");
429
+
430
+ // src/components/editors/BlockNoteEditorContainer.tsx
431
+ var _dynamic = require('next/dynamic'); var _dynamic2 = _interopRequireDefault(_dynamic);
432
+
433
+
434
+ var BlockNoteEditor = _dynamic2.default.call(void 0, () => Promise.resolve().then(() => _interopRequireWildcard(require("../BlockNoteEditor-VFWG6LXI.js"))), {
435
+ ssr: false
436
+ });
437
+ var BlockNoteEditorContainer = React2.default.memo(/* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, function EditorContainer(props) {
438
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BlockNoteEditor, { ...props });
439
+ }, "EditorContainer"));
440
+
441
+ // src/components/errors/ErrorDetails.tsx
442
+ var _image = require('next/image'); var _image2 = _interopRequireDefault(_image);
443
+
444
+ function ErrorDetails({ title, message, code }) {
445
+ if (code === 403)
446
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-xl max-w-xl", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Card, { className: "w-full", children: [
447
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CardHeader, { children: [
448
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CardTitle, { className: "text-foreground flex flex-col items-center gap-y-4 pb-10 text-4xl", children: [
449
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _image2.default, { src: "/phlow-logo.webp", alt: "Phlow", width: 100, height: 100, priority: true }),
450
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: "Unauthorised" })
451
+ ] }),
452
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.CardDescription, { className: "text-center text-lg", children: "We are sorry, but you are not allowed to access this content." })
453
+ ] }),
454
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.CardContent, {})
455
+ ] }) });
456
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-xl max-w-xl", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Card, { className: "w-full", children: [
457
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CardHeader, { children: [
458
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CardTitle, { className: "text-foreground flex flex-col items-center gap-y-4 pb-10 text-center text-4xl", children: [
459
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _image2.default, { src: "/phlow-logo.webp", alt: "Phlow", width: 100, height: 100, priority: true }),
460
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: code }),
461
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: title })
462
+ ] }),
463
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.CardDescription, { className: "text-center text-lg", children: message })
464
+ ] }),
465
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.CardContent, {})
466
+ ] }) });
467
+ }
468
+ _chunk7QVYU63Ejs.__name.call(void 0, ErrorDetails, "ErrorDetails");
469
+
470
+ // src/components/forms/CommonAssociationForm.tsx
471
+
472
+
473
+ var _sonner = require('sonner');
474
+
475
+ function CommonAssociationTrigger({
476
+ sourceType,
477
+ destinationType,
478
+ hasDestination,
479
+ onTrigger
480
+ }) {
481
+ const t = _nextintl.useTranslations.call(void 0, );
482
+ if (hasDestination)
483
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "hover:text-accent cursor-pointer", onClick: onTrigger, children: "Join" });
484
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Button, { variant: `outline`, size: `sm`, onClick: onTrigger, children: t(`generic.association.label`, {
485
+ source: sourceType,
486
+ destination: destinationType
487
+ }) });
488
+ }
489
+ _chunk7QVYU63Ejs.__name.call(void 0, CommonAssociationTrigger, "CommonAssociationTrigger");
490
+ function CommonAssociationCommandDialog({
491
+ show,
492
+ setShow,
493
+ data,
494
+ source,
495
+ destination,
496
+ destinationName,
497
+ children
498
+ }) {
499
+ const t = _nextintl.useTranslations.call(void 0, );
500
+ const searchTermRef = _react.useRef.call(void 0, "");
501
+ const [searchTerm, setSearchTerm] = _react.useState.call(void 0, "");
502
+ const refreshList = _react.useCallback.call(void 0,
503
+ async (searchedTerm) => {
504
+ if (searchedTerm === searchTermRef.current) return;
505
+ searchTermRef.current = searchedTerm;
506
+ await data.search(searchedTerm);
507
+ },
508
+ [searchTerm, data]
509
+ );
510
+ const updateSearchTerm = _chunkFY4SXJGUjs.useDebounce.call(void 0, refreshList, 500);
511
+ _react.useEffect.call(void 0, () => {
512
+ if (show) updateSearchTerm(searchTerm);
513
+ }, [show, searchTerm]);
514
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CommandDialog, { open: show, onOpenChange: setShow, children: [
515
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.DialogHeader, { className: "flex flex-col items-start p-4 pb-0", children: [
516
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DialogTitle, { children: t(`generic.association.label`, {
517
+ source,
518
+ destination
519
+ }) }),
520
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DialogDescription, { children: t(`generic.association.description`, {
521
+ source,
522
+ destination,
523
+ destination_name: destinationName
524
+ }) })
525
+ ] }),
526
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Command, { shouldFilter: false, className: "p-4", children: [
527
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
528
+ _chunkA5DDIABKjs.CommandInput,
529
+ {
530
+ placeholder: t(`generic.search.placeholder`, { type: source }),
531
+ value: searchTerm,
532
+ onValueChange: setSearchTerm
533
+ }
534
+ ),
535
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.CommandList, { className: "mt-3 h-auto max-h-96 min-h-96 max-w-full overflow-y-auto overflow-x-hidden", children: [
536
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.CommandEmpty, { children: t(`generic.search.no_results`, { type: source }) }),
537
+ children
538
+ ] })
539
+ ] })
540
+ ] });
541
+ }
542
+ _chunk7QVYU63Ejs.__name.call(void 0, CommonAssociationCommandDialog, "CommonAssociationCommandDialog");
543
+ var triggerAssociationToast = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
544
+ if (params.level) {
545
+ _sonner.toast.message(
546
+ params.t(`generic.association.label`, {
547
+ source: params.source,
548
+ destination: params.destination
549
+ }),
550
+ {
551
+ description: params.t(`generic.association.success_level`, {
552
+ source: params.source,
553
+ destination: params.destination,
554
+ source_name: params.source_name,
555
+ destination_name: params.destination_name,
556
+ level: params.level
557
+ })
558
+ }
559
+ );
560
+ } else {
561
+ _sonner.toast.message(
562
+ params.t(`generic.association.label`, {
563
+ source: params.source,
564
+ destination: params.destination
565
+ }),
566
+ {
567
+ description: params.t(`generic.association.success`, {
568
+ source: params.source,
569
+ destination: params.destination,
570
+ source_name: params.source_name,
571
+ destination_name: params.destination_name
572
+ })
573
+ }
574
+ );
575
+ }
576
+ }, "triggerAssociationToast");
577
+
578
+ // src/components/forms/CommonDeleter.tsx
579
+
580
+
581
+
582
+ function CommonDeleter({ deleteFunction, redirectTo, type, forceShow }) {
583
+ const t = _chunkCXQOWQSYjs.useI18nTranslations.call(void 0, );
584
+ const router = _chunkCXQOWQSYjs.useI18nRouter.call(void 0, );
585
+ const [open, setOpen] = _react.useState.call(void 0, forceShow || false);
586
+ const [isDeleting, setIsDeleting] = _react.useState.call(void 0, false);
587
+ const handleDelete = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
588
+ setIsDeleting(true);
589
+ try {
590
+ await deleteFunction();
591
+ setOpen(false);
592
+ if (redirectTo) router.push(redirectTo);
593
+ } catch (error) {
594
+ _chunkRUR22SVMjs.errorToast.call(void 0, { title: t(`generic.errors.delete`), error });
595
+ }
596
+ setIsDeleting(false);
597
+ }, "handleDelete");
598
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.AlertDialog, { open, onOpenChange: setOpen, children: [
599
+ forceShow ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.AlertDialogTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Button, { size: "sm", variant: "ghost", className: "text-muted-foreground hover:text-destructive", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Trash2Icon, {}) }) }),
600
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.AlertDialogContent, { className: `flex max-h-[70vh] max-w-3xl flex-col overflow-y-auto`, children: [
601
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.AlertDialogHeader, { children: [
602
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.AlertDialogTitle, { children: t(`generic.delete.title`, { type: t(`types.${type}`, { count: 1 }) }) }),
603
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.AlertDialogDescription, { children: t(`generic.delete.subtitle`, { type: t(`types.${type}`, { count: 1 }) }) })
604
+ ] }),
605
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-destructive p-4 text-sm", children: t(`generic.delete.description`, { type: t(`types.${type}`, { count: 1 }) }) }),
606
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end", children: [
607
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
608
+ _chunkA5DDIABKjs.Button,
609
+ {
610
+ className: "mr-2",
611
+ variant: "outline",
612
+ type: `button`,
613
+ onClick: () => setOpen(false),
614
+ disabled: isDeleting,
615
+ children: t(`generic.buttons.cancel`)
616
+ }
617
+ ),
618
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
619
+ _chunkA5DDIABKjs.Button,
620
+ {
621
+ type: "submit",
622
+ onClick: (e) => {
623
+ e.preventDefault();
624
+ handleDelete();
625
+ },
626
+ variant: "destructive",
627
+ disabled: isDeleting,
628
+ children: isDeleting ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
629
+ t(`generic.buttons.is_deleting`),
630
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.LoaderCircleIcon, { className: "animate-spin-slow h-5 w-5" })
631
+ ] }) : t(`generic.buttons.delete`)
632
+ }
633
+ )
634
+ ] })
635
+ ] })
636
+ ] });
637
+ }
638
+ _chunk7QVYU63Ejs.__name.call(void 0, CommonDeleter, "CommonDeleter");
639
+
640
+ // src/components/forms/CommonEditorButtons.tsx
641
+
642
+
643
+ function CommonEditorButtons({ isEdit, form, disabled, setOpen }) {
644
+ const t = _nextintl.useTranslations.call(void 0, );
645
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end", children: [
646
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
647
+ _chunkA5DDIABKjs.Button,
648
+ {
649
+ className: "mr-2",
650
+ variant: "outline",
651
+ type: `button`,
652
+ onClick: () => setOpen(false),
653
+ "data-testid": `modal-button-cancel`,
654
+ children: t(`generic.buttons.cancel`)
655
+ }
656
+ ),
657
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Button, { type: "submit", disabled: form.formState.isSubmitting || disabled, "data-testid": `modal-button-create`, children: isEdit ? t(`generic.buttons.confirm_update`) : t(`generic.buttons.confirm_create`) })
658
+ ] });
659
+ }
660
+ _chunk7QVYU63Ejs.__name.call(void 0, CommonEditorButtons, "CommonEditorButtons");
661
+
662
+ // src/components/forms/CommonEditorHeader.tsx
663
+
664
+
665
+ function CommonEditorHeader({ type, name }) {
666
+ const t = _nextintl.useTranslations.call(void 0, );
667
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.DialogHeader, { children: [
668
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DialogTitle, { children: name ? t(`generic.edit.update.title`, {
669
+ type
670
+ }) : t(`generic.edit.create.title`, { type }) }),
671
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DialogDescription, { children: name ? t(`generic.edit.update.description`, {
672
+ type,
673
+ name
674
+ }) : t(`generic.edit.create.description`, {
675
+ type
676
+ }) })
677
+ ] });
678
+ }
679
+ _chunk7QVYU63Ejs.__name.call(void 0, CommonEditorHeader, "CommonEditorHeader");
680
+
681
+ // src/components/forms/CommonEditorTrigger.tsx
682
+
683
+
684
+
685
+ function CommonEditorTrigger({ isEdit, edit, create }) {
686
+ const t = _nextintl.useTranslations.call(void 0, );
687
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.DialogTrigger, { asChild: true, children: isEdit ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Button, { size: "sm", variant: `ghost`, className: "text-muted-foreground", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.PencilIcon, {}) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Button, { size: "sm", variant: `outline`, children: create ? create : t(`generic.buttons.create`) }) });
688
+ }
689
+ _chunk7QVYU63Ejs.__name.call(void 0, CommonEditorTrigger, "CommonEditorTrigger");
690
+
691
+ // src/components/forms/DatePickerPopover.tsx
692
+ var _datefns = require('date-fns');
693
+
694
+
695
+
696
+ var DatePickerPopover = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
697
+ children,
698
+ value,
699
+ onSelect,
700
+ minDate,
701
+ align = "start",
702
+ className
703
+ }) => {
704
+ const locale = _chunkCXQOWQSYjs.useI18nLocale.call(void 0, );
705
+ const dateFnsLocale = _chunkCXQOWQSYjs.useI18nDateFnsLocale.call(void 0, );
706
+ const [isOpen, setIsOpen] = _react.useState.call(void 0, false);
707
+ const [displayMonth, setDisplayMonth] = _react.useState.call(void 0, () => value || /* @__PURE__ */ new Date());
708
+ const dateFormatter = _react.useMemo.call(void 0,
709
+ () => new Intl.DateTimeFormat(locale, { day: "2-digit", month: "2-digit", year: "numeric" }),
710
+ [locale]
711
+ );
712
+ const formatDate = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (date) => dateFormatter.format(date), "formatDate");
713
+ const datePlaceholder = _react.useMemo.call(void 0, () => {
714
+ const parts = dateFormatter.formatToParts(new Date(2e3, 0, 1));
715
+ return parts.map((part) => {
716
+ if (part.type === "day") return "dd";
717
+ if (part.type === "month") return "mm";
718
+ if (part.type === "year") return "yyyy";
719
+ return part.value;
720
+ }).join("");
721
+ }, [dateFormatter]);
722
+ const dateFormatPattern = _react.useMemo.call(void 0, () => {
723
+ const parts = dateFormatter.formatToParts(new Date(2e3, 0, 1));
724
+ return parts.map((part) => {
725
+ if (part.type === "day") return "dd";
726
+ if (part.type === "month") return "MM";
727
+ if (part.type === "year") return "yyyy";
728
+ return part.value;
729
+ }).join("");
730
+ }, [dateFormatter]);
731
+ const [inputValue, setInputValue] = _react.useState.call(void 0, () => value ? formatDate(value) : "");
732
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
733
+ const yearOptions = Array.from({ length: currentYear - 1900 + 11 }, (_, i) => 1900 + i);
734
+ const monthNames = _react.useMemo.call(void 0, () => {
735
+ const formatter = new Intl.DateTimeFormat(locale, { month: "long" });
736
+ return Array.from({ length: 12 }, (_, i) => {
737
+ const monthName = formatter.format(new Date(2e3, i, 1));
738
+ return monthName.charAt(0).toUpperCase() + monthName.slice(1);
739
+ });
740
+ }, [locale]);
741
+ const handleInputChange = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (inputValue2) => {
742
+ setInputValue(inputValue2);
743
+ const parsedDate = _datefns.parse.call(void 0, inputValue2, dateFormatPattern, /* @__PURE__ */ new Date());
744
+ if (_datefns.isValid.call(void 0, parsedDate)) {
745
+ onSelect(parsedDate);
746
+ setDisplayMonth(parsedDate);
747
+ } else if (inputValue2 === "") {
748
+ onSelect(void 0);
749
+ }
750
+ }, "handleInputChange");
751
+ const handleCalendarSelect = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (selectedDate) => {
752
+ onSelect(selectedDate);
753
+ if (selectedDate) {
754
+ setInputValue(formatDate(selectedDate));
755
+ setDisplayMonth(selectedDate);
756
+ } else {
757
+ setInputValue("");
758
+ }
759
+ setIsOpen(false);
760
+ }, "handleCalendarSelect");
761
+ const handleClear = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
762
+ e.stopPropagation();
763
+ onSelect(void 0);
764
+ setInputValue("");
765
+ }, "handleClear");
766
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
767
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverTrigger, { asChild: true, children }),
768
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverContent, { className: _chunkJC3WJK65js.cn.call(void 0, "w-auto p-0", className), align, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-3", children: [
769
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative mb-3", children: [
770
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
771
+ _chunkA5DDIABKjs.Input,
772
+ {
773
+ value: inputValue,
774
+ onChange: (e) => handleInputChange(e.target.value),
775
+ placeholder: datePlaceholder,
776
+ className: "pr-16",
777
+ onClick: (e) => e.stopPropagation()
778
+ }
779
+ ),
780
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "absolute right-1 top-1/2 flex -translate-y-1/2 items-center space-x-1", children: [
781
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
782
+ "button",
783
+ {
784
+ type: "button",
785
+ className: "flex h-8 w-8 items-center justify-center rounded-md hover:bg-muted",
786
+ onClick: (e) => e.stopPropagation(),
787
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Calendar, { className: "h-4 w-4 opacity-50" })
788
+ }
789
+ ),
790
+ value && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
791
+ "button",
792
+ {
793
+ type: "button",
794
+ className: "flex h-8 w-8 items-center justify-center rounded-md hover:bg-muted",
795
+ onClick: handleClear,
796
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CircleXIcon, { className: "h-4 w-4 opacity-50 hover:opacity-100" })
797
+ }
798
+ )
799
+ ] })
800
+ ] }),
801
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-3 flex gap-2", children: [
802
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
803
+ _chunkA5DDIABKjs.Select,
804
+ {
805
+ value: displayMonth.getMonth().toString(),
806
+ onValueChange: (value2) => {
807
+ const newMonth = parseInt(value2);
808
+ const newDate = new Date(displayMonth.getFullYear(), newMonth, 1);
809
+ setDisplayMonth(newDate);
810
+ },
811
+ children: [
812
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { className: "w-[130px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, {}) }),
813
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: monthNames.map((month, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: index.toString(), children: month }, index)) })
814
+ ]
815
+ }
816
+ ),
817
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
818
+ _chunkA5DDIABKjs.Select,
819
+ {
820
+ value: displayMonth.getFullYear().toString(),
821
+ onValueChange: (value2) => {
822
+ const newYear = parseInt(value2);
823
+ const newDate = new Date(newYear, displayMonth.getMonth(), 1);
824
+ setDisplayMonth(newDate);
825
+ },
826
+ children: [
827
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { className: "w-[80px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, {}) }),
828
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: yearOptions.reverse().map((year) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: year.toString(), children: year }, year)) })
829
+ ]
830
+ }
831
+ )
832
+ ] }),
833
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
834
+ _chunkA5DDIABKjs.Calendar,
835
+ {
836
+ mode: "single",
837
+ selected: value,
838
+ onSelect: handleCalendarSelect,
839
+ disabled: (date) => minDate && date < minDate ? true : false,
840
+ locale: dateFnsLocale,
841
+ weekStartsOn: 1,
842
+ month: displayMonth,
843
+ onMonthChange: setDisplayMonth
844
+ }
845
+ )
846
+ ] }) })
847
+ ] });
848
+ }, "DatePickerPopover");
849
+
850
+ // src/components/forms/DateRangeSelector.tsx
851
+
852
+
853
+
854
+
855
+ function DateRangeSelector({ onDateChange, avoidSettingDates, showPreviousMonth }) {
856
+ const [date, setDate] = _react.useState.call(void 0,
857
+ avoidSettingDates ? void 0 : {
858
+ from: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1),
859
+ to: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() + 1, 0)
860
+ }
861
+ );
862
+ const [open, setOpen] = _react.useState.call(void 0, false);
863
+ const [prevRange, setPrevRange] = _react.useState.call(void 0, date);
864
+ _react.useEffect.call(void 0, () => {
865
+ if (_optionalChain([date, 'optionalAccess', _2 => _2.from]) && _optionalChain([date, 'optionalAccess', _3 => _3.to]) && date.to > date.from && (_optionalChain([prevRange, 'optionalAccess', _4 => _4.from, 'optionalAccess', _5 => _5.getTime, 'call', _6 => _6()]) !== date.from.getTime() || _optionalChain([prevRange, 'optionalAccess', _7 => _7.to, 'optionalAccess', _8 => _8.getTime, 'call', _9 => _9()]) !== date.to.getTime())) {
866
+ onDateChange(date);
867
+ setPrevRange(date);
868
+ setOpen(false);
869
+ }
870
+ }, [date, prevRange, onDateChange]);
871
+ const handleSelect = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (range) => {
872
+ if (!range) {
873
+ setDate(void 0);
874
+ return;
875
+ }
876
+ if (range.from && (!_optionalChain([date, 'optionalAccess', _10 => _10.from]) || range.from.getTime() !== date.from.getTime())) {
877
+ setDate({ from: range.from, to: void 0 });
878
+ } else {
879
+ setDate(range);
880
+ }
881
+ }, "handleSelect");
882
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunkJC3WJK65js.cn.call(void 0, "grid gap-2"), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Popover, { open, onOpenChange: setOpen, children: [
883
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
884
+ _chunkA5DDIABKjs.Button,
885
+ {
886
+ id: "date",
887
+ variant: "outline",
888
+ className: _chunkJC3WJK65js.cn.call(void 0, "w-[300px] justify-start text-left font-normal", !date && "text-muted-foreground"),
889
+ children: [
890
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CalendarIcon, {}),
891
+ _optionalChain([date, 'optionalAccess', _11 => _11.from]) ? date.to ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
892
+ _datefns.format.call(void 0, date.from, "LLL dd, y"),
893
+ " - ",
894
+ _datefns.format.call(void 0, date.to, "LLL dd, y")
895
+ ] }) : _datefns.format.call(void 0, date.from, "LLL dd, y") : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Pick a date" })
896
+ ]
897
+ }
898
+ ) }),
899
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-2 p-2", children: [
900
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
901
+ _chunkA5DDIABKjs.Calendar,
902
+ {
903
+ mode: "range",
904
+ defaultMonth: _nullishCoalesce(_optionalChain([date, 'optionalAccess', _12 => _12.from]), () => ( (showPreviousMonth ? new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1) : void 0))),
905
+ selected: date,
906
+ onSelect: handleSelect,
907
+ numberOfMonths: 2
908
+ }
909
+ ),
910
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
911
+ _chunkA5DDIABKjs.Button,
912
+ {
913
+ variant: "secondary",
914
+ type: "button",
915
+ onClick: () => {
916
+ setDate(void 0);
917
+ setPrevRange(void 0);
918
+ onDateChange(void 0);
919
+ setOpen(false);
920
+ },
921
+ className: "cursor-pointer",
922
+ disabled: !date,
923
+ children: "Clear"
924
+ }
925
+ )
926
+ ] }) })
927
+ ] }) });
928
+ }
929
+ _chunk7QVYU63Ejs.__name.call(void 0, DateRangeSelector, "DateRangeSelector");
930
+
931
+ // src/components/forms/FileUploader.tsx
932
+
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
943
+ var _reactdropzone = require('react-dropzone');
944
+
945
+
946
+ var FileUploaderContext = _react.createContext.call(void 0, null);
947
+ var useFileUpload = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
948
+ const context = _react.useContext.call(void 0, FileUploaderContext);
949
+ if (!context) {
950
+ throw new Error("useFileUpload must be used within a FileUploaderProvider");
951
+ }
952
+ return context;
953
+ }, "useFileUpload");
954
+ var FileUploader = _react.forwardRef.call(void 0,
955
+ ({ className, dropzoneOptions, value, onValueChange, reSelect, orientation = "vertical", children, dir, ...props }, ref) => {
956
+ const [isFileTooBig, setIsFileTooBig] = _react.useState.call(void 0, false);
957
+ const [isLOF, setIsLOF] = _react.useState.call(void 0, false);
958
+ const [activeIndex, setActiveIndex] = _react.useState.call(void 0, -1);
959
+ const { maxFiles = 1, maxSize = 4 * 1024 * 1024, multiple = true } = dropzoneOptions;
960
+ const t = _nextintl.useTranslations.call(void 0, );
961
+ const reSelectAll = maxFiles === 1 ? true : reSelect;
962
+ const direction = dir === "rtl" ? "rtl" : "ltr";
963
+ const removeFileFromSet = _react.useCallback.call(void 0,
964
+ (i) => {
965
+ if (!value) return;
966
+ const newFiles = value.filter((_, index) => index !== i);
967
+ onValueChange(newFiles);
968
+ },
969
+ [value, onValueChange]
970
+ );
971
+ const handleKeyDown = _react.useCallback.call(void 0,
972
+ (e) => {
973
+ e.preventDefault();
974
+ e.stopPropagation();
975
+ if (!value) return;
976
+ const moveNext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
977
+ const nextIndex = activeIndex + 1;
978
+ setActiveIndex(nextIndex > value.length - 1 ? 0 : nextIndex);
979
+ }, "moveNext");
980
+ const movePrev = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
981
+ const nextIndex = activeIndex - 1;
982
+ setActiveIndex(nextIndex < 0 ? value.length - 1 : nextIndex);
983
+ }, "movePrev");
984
+ const prevKey = orientation === "horizontal" ? direction === "ltr" ? "ArrowLeft" : "ArrowRight" : "ArrowUp";
985
+ const nextKey = orientation === "horizontal" ? direction === "ltr" ? "ArrowRight" : "ArrowLeft" : "ArrowDown";
986
+ if (e.key === nextKey) {
987
+ moveNext();
988
+ } else if (e.key === prevKey) {
989
+ movePrev();
990
+ } else if (e.key === "Enter" || e.key === "Space") {
991
+ if (activeIndex === -1) {
992
+ _optionalChain([dropzoneState, 'access', _13 => _13.inputRef, 'access', _14 => _14.current, 'optionalAccess', _15 => _15.click, 'call', _16 => _16()]);
993
+ }
994
+ } else if (e.key === "Delete" || e.key === "Backspace") {
995
+ if (activeIndex !== -1) {
996
+ removeFileFromSet(activeIndex);
997
+ if (value.length - 1 === 0) {
998
+ setActiveIndex(-1);
999
+ return;
1000
+ }
1001
+ movePrev();
1002
+ }
1003
+ } else if (e.key === "Escape") {
1004
+ setActiveIndex(-1);
1005
+ }
1006
+ },
1007
+ [value, activeIndex, removeFileFromSet]
1008
+ );
1009
+ const onDrop = _react.useCallback.call(void 0,
1010
+ (acceptedFiles, rejectedFiles) => {
1011
+ const files = acceptedFiles;
1012
+ if (!files) {
1013
+ _sonner.toast.error(t("generic.errors.file"), {
1014
+ description: t("generic.errors.file_large")
1015
+ });
1016
+ return;
1017
+ }
1018
+ const newValues = value ? [...value] : [];
1019
+ if (reSelectAll) {
1020
+ newValues.splice(0, newValues.length);
1021
+ }
1022
+ files.forEach((file) => {
1023
+ if (newValues.length < maxFiles) {
1024
+ newValues.push(file);
1025
+ }
1026
+ });
1027
+ onValueChange(newValues);
1028
+ if (rejectedFiles.length > 0) {
1029
+ for (let i = 0; i < rejectedFiles.length; i++) {
1030
+ if (_optionalChain([rejectedFiles, 'access', _17 => _17[i], 'access', _18 => _18.errors, 'access', _19 => _19[0], 'optionalAccess', _20 => _20.code]) === "file-too-large") {
1031
+ _sonner.toast.error(t("generic.errors.file"), {
1032
+ description: t(`generic.errors.file_max`, { size: maxSize / 1024 / 1024 })
1033
+ });
1034
+ break;
1035
+ }
1036
+ if (_optionalChain([rejectedFiles, 'access', _21 => _21[i], 'access', _22 => _22.errors, 'access', _23 => _23[0], 'optionalAccess', _24 => _24.message])) {
1037
+ _sonner.toast.error(t(`generic.errors.file`), {
1038
+ description: rejectedFiles[i].errors[0].message
1039
+ });
1040
+ break;
1041
+ }
1042
+ }
1043
+ }
1044
+ },
1045
+ [reSelectAll, value]
1046
+ );
1047
+ _react.useEffect.call(void 0, () => {
1048
+ if (!value) return;
1049
+ if (value.length === maxFiles) {
1050
+ return;
1051
+ }
1052
+ setIsLOF(false);
1053
+ }, [value, maxFiles]);
1054
+ const opts = dropzoneOptions ? dropzoneOptions : { maxFiles, maxSize, multiple };
1055
+ const dropzoneState = _reactdropzone.useDropzone.call(void 0, {
1056
+ ...opts,
1057
+ onDrop,
1058
+ onDropRejected: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => setIsFileTooBig(true), "onDropRejected"),
1059
+ onDropAccepted: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => setIsFileTooBig(false), "onDropAccepted")
1060
+ });
1061
+ const { isDragActive } = dropzoneState;
1062
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1063
+ FileUploaderContext.Provider,
1064
+ {
1065
+ value: {
1066
+ dropzoneState,
1067
+ isLOF,
1068
+ isFileTooBig,
1069
+ removeFileFromSet,
1070
+ activeIndex,
1071
+ setActiveIndex,
1072
+ orientation,
1073
+ direction
1074
+ },
1075
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1076
+ "div",
1077
+ {
1078
+ ref,
1079
+ tabIndex: 0,
1080
+ onKeyDownCapture: handleKeyDown,
1081
+ className: _chunkJC3WJK65js.cn.call(void 0,
1082
+ "grid w-full overflow-hidden focus:outline-none",
1083
+ className,
1084
+ // Original className from props
1085
+ {
1086
+ "gap-2": value && value.length > 0,
1087
+ "bg-muted border-primary border-dashed": isDragActive
1088
+ // Apply drag-active styles to the main FileUploader div
1089
+ }
1090
+ ),
1091
+ dir,
1092
+ ...props,
1093
+ children
1094
+ }
1095
+ )
1096
+ }
1097
+ );
1098
+ }
1099
+ );
1100
+ FileUploader.displayName = "FileUploader";
1101
+ var FileUploaderContent = _react.forwardRef.call(void 0,
1102
+ ({ children, className, ...props }, ref) => {
1103
+ const { orientation } = useFileUpload();
1104
+ const containerRef = _react.useRef.call(void 0, null);
1105
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunkJC3WJK65js.cn.call(void 0, "w-full px-1"), ref: containerRef, "aria-description": "content file holder", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1106
+ "div",
1107
+ {
1108
+ ...props,
1109
+ ref,
1110
+ className: _chunkJC3WJK65js.cn.call(void 0,
1111
+ "flex gap-1 rounded-xl",
1112
+ orientation === "horizontal" ? "flex-raw flex-wrap" : "flex-col",
1113
+ className
1114
+ ),
1115
+ children
1116
+ }
1117
+ ) });
1118
+ }
1119
+ );
1120
+ FileUploaderContent.displayName = "FileUploaderContent";
1121
+ var FileUploaderItem = _react.forwardRef.call(void 0,
1122
+ ({ className, index, children, ...props }, ref) => {
1123
+ const { removeFileFromSet, activeIndex, direction } = useFileUpload();
1124
+ const isSelected = index === activeIndex;
1125
+ const t = _nextintl.useTranslations.call(void 0, );
1126
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1127
+ "div",
1128
+ {
1129
+ ref,
1130
+ className: _chunkJC3WJK65js.cn.call(void 0,
1131
+ _chunkA5DDIABKjs.buttonVariants.call(void 0, { variant: "ghost" }),
1132
+ "relative h-6 cursor-pointer justify-between p-1",
1133
+ className,
1134
+ isSelected ? "bg-muted" : ""
1135
+ ),
1136
+ ...props,
1137
+ children: [
1138
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full w-full items-center gap-1.5 leading-none font-medium tracking-tight", children }),
1139
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1140
+ "button",
1141
+ {
1142
+ type: "button",
1143
+ className: _chunkJC3WJK65js.cn.call(void 0, "absolute", direction === "rtl" ? "top-1 left-1" : "top-1 right-1"),
1144
+ onClick: () => removeFileFromSet(index),
1145
+ children: [
1146
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", children: t(`generic.remove_item`, { index }) }),
1147
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Trash2, { className: "hover:stroke-destructive h-4 w-4 duration-200 ease-in-out" })
1148
+ ]
1149
+ }
1150
+ )
1151
+ ]
1152
+ }
1153
+ );
1154
+ }
1155
+ );
1156
+ FileUploaderItem.displayName = "FileUploaderItem";
1157
+ var FileInput = _react.forwardRef.call(void 0,
1158
+ ({ className, children, ...props }, ref) => {
1159
+ const { dropzoneState, isFileTooBig, isLOF } = useFileUpload();
1160
+ const rootProps = isLOF ? {} : dropzoneState.getRootProps();
1161
+ const { isDragActive: parentIsDragActive } = dropzoneState;
1162
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1163
+ "div",
1164
+ {
1165
+ ref,
1166
+ ...props,
1167
+ className: _chunkJC3WJK65js.cn.call(void 0, `relative w-full ${isLOF ? "cursor-not-allowed opacity-50" : "cursor-pointer"}`, className),
1168
+ children: [
1169
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1170
+ "div",
1171
+ {
1172
+ className: _chunkJC3WJK65js.cn.call(void 0,
1173
+ "w-full rounded-lg duration-300 ease-in-out",
1174
+ // Simpler border logic: if parent is drag-active, it controls the border.
1175
+ // Otherwise, FileInput can show its own accept/reject/default border.
1176
+ {
1177
+ "border-green-500": dropzoneState.isDragAccept && !parentIsDragActive,
1178
+ "border-red-500": (dropzoneState.isDragReject || isFileTooBig) && !parentIsDragActive,
1179
+ "border-gray-300": !dropzoneState.isDragAccept && !dropzoneState.isDragReject && !isFileTooBig && !parentIsDragActive
1180
+ },
1181
+ // className from props should be last to allow overrides if necessary
1182
+ className
1183
+ ),
1184
+ ...rootProps,
1185
+ children
1186
+ }
1187
+ ),
1188
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1189
+ _chunkA5DDIABKjs.Input,
1190
+ {
1191
+ ref: dropzoneState.inputRef,
1192
+ disabled: isLOF,
1193
+ ...dropzoneState.getInputProps(),
1194
+ className: `${isLOF ? "cursor-not-allowed" : ""}`
1195
+ }
1196
+ )
1197
+ ]
1198
+ }
1199
+ );
1200
+ }
1201
+ );
1202
+ FileInput.displayName = "FileInput";
1203
+
1204
+ // src/components/forms/FormCheckbox.tsx
1205
+
1206
+ function FormCheckbox({ form, id, name, labelBefore, description, isRequired }) {
1207
+ const simpleLabel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
1208
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { htmlFor: id, className: `font-normal ${labelBefore ? "" : "ml-3"}`, children: name });
1209
+ }, "simpleLabel");
1210
+ const label = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
1211
+ if (description) return simpleLabel();
1212
+ else
1213
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Tooltip, { children: [
1214
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TooltipTrigger, { asChild: true, children: simpleLabel() }),
1215
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TooltipContent, { children: description })
1216
+ ] });
1217
+ }, "label");
1218
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1219
+ _chunkA5DDIABKjs.FormField,
1220
+ {
1221
+ control: form.control,
1222
+ name: id,
1223
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1224
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-4", children: [
1225
+ labelBefore && label(),
1226
+ labelBefore && isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" }),
1227
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Checkbox, { id, defaultChecked: field.value, onCheckedChange: field.onChange }),
1228
+ !labelBefore && label(),
1229
+ !labelBefore && isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1230
+ ] }) }),
1231
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1232
+ ] })
1233
+ }
1234
+ ) });
1235
+ }
1236
+ _chunk7QVYU63Ejs.__name.call(void 0, FormCheckbox, "FormCheckbox");
1237
+
1238
+ // src/components/forms/FormContainerGeneric.tsx
1239
+
1240
+ function FormContainerGeneric({
1241
+ form,
1242
+ id,
1243
+ name,
1244
+ children,
1245
+ isRequired = false
1246
+ }) {
1247
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1248
+ _chunkA5DDIABKjs.FormField,
1249
+ {
1250
+ control: form.control,
1251
+ name: id,
1252
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1253
+ name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: "flex items-center", children: [
1254
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: name }),
1255
+ isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1256
+ ] }),
1257
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children }),
1258
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1259
+ ] })
1260
+ }
1261
+ ) });
1262
+ }
1263
+ _chunk7QVYU63Ejs.__name.call(void 0, FormContainerGeneric, "FormContainerGeneric");
1264
+
1265
+ // src/components/forms/FormDate.tsx
1266
+
1267
+
1268
+
1269
+
1270
+ function FormDate({
1271
+ form,
1272
+ id,
1273
+ name,
1274
+ minDate,
1275
+ onChange,
1276
+ isRequired = false
1277
+ }) {
1278
+ const locale = _chunkCXQOWQSYjs.useI18nLocale.call(void 0, );
1279
+ const dateFnsLocale = _chunkCXQOWQSYjs.useI18nDateFnsLocale.call(void 0, );
1280
+ const [open, setOpen] = _react.useState.call(void 0, false);
1281
+ const [displayMonth, setDisplayMonth] = _react.useState.call(void 0, () => {
1282
+ const currentValue = form.getValues(id);
1283
+ return currentValue || /* @__PURE__ */ new Date();
1284
+ });
1285
+ const dateFormatter = _react.useMemo.call(void 0,
1286
+ () => new Intl.DateTimeFormat(locale, { day: "2-digit", month: "2-digit", year: "numeric" }),
1287
+ [locale]
1288
+ );
1289
+ const formatDate = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (date) => dateFormatter.format(date), "formatDate");
1290
+ const datePlaceholder = _react.useMemo.call(void 0, () => {
1291
+ const parts = dateFormatter.formatToParts(new Date(2e3, 0, 1));
1292
+ return parts.map((part) => {
1293
+ if (part.type === "day") return "dd";
1294
+ if (part.type === "month") return "mm";
1295
+ if (part.type === "year") return "yyyy";
1296
+ return part.value;
1297
+ }).join("");
1298
+ }, [dateFormatter]);
1299
+ const dateFormatPattern = _react.useMemo.call(void 0, () => {
1300
+ const parts = dateFormatter.formatToParts(new Date(2e3, 0, 1));
1301
+ return parts.map((part) => {
1302
+ if (part.type === "day") return "dd";
1303
+ if (part.type === "month") return "MM";
1304
+ if (part.type === "year") return "yyyy";
1305
+ return part.value;
1306
+ }).join("");
1307
+ }, [dateFormatter]);
1308
+ const [inputValue, setInputValue] = _react.useState.call(void 0, () => {
1309
+ const currentValue = form.getValues(id);
1310
+ return currentValue ? formatDate(currentValue) : "";
1311
+ });
1312
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
1313
+ const yearOptions = Array.from({ length: currentYear - 1900 + 1 }, (_, i) => 1900 + i);
1314
+ const monthNames = _react.useMemo.call(void 0, () => {
1315
+ const formatter = new Intl.DateTimeFormat(locale, { month: "long" });
1316
+ return Array.from({ length: 12 }, (_, i) => {
1317
+ const monthName = formatter.format(new Date(2e3, i, 1));
1318
+ return monthName.charAt(0).toUpperCase() + monthName.slice(1);
1319
+ });
1320
+ }, [locale]);
1321
+ const handleInputChange = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value, field) => {
1322
+ setInputValue(value);
1323
+ const parsedDate = _datefns.parse.call(void 0, value, dateFormatPattern, /* @__PURE__ */ new Date());
1324
+ if (_datefns.isValid.call(void 0, parsedDate)) {
1325
+ field.onChange(parsedDate);
1326
+ setDisplayMonth(parsedDate);
1327
+ if (onChange) onChange(parsedDate);
1328
+ } else if (value === "") {
1329
+ field.onChange(void 0);
1330
+ if (onChange) onChange(void 0);
1331
+ }
1332
+ }, "handleInputChange");
1333
+ const handleCalendarSelect = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (selectedDate, field) => {
1334
+ field.onChange(selectedDate);
1335
+ if (selectedDate) {
1336
+ setInputValue(formatDate(selectedDate));
1337
+ setDisplayMonth(selectedDate);
1338
+ } else {
1339
+ setInputValue("");
1340
+ }
1341
+ if (onChange) onChange(selectedDate);
1342
+ }, "handleCalendarSelect");
1343
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1344
+ _chunkA5DDIABKjs.FormField,
1345
+ {
1346
+ control: form.control,
1347
+ name: id,
1348
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"} w-full`, children: [
1349
+ name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: "dlex items-center", children: [
1350
+ name,
1351
+ " ",
1352
+ isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1353
+ ] }),
1354
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "relative", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Popover, { open, onOpenChange: setOpen, modal: true, children: [
1355
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
1356
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1357
+ _chunkA5DDIABKjs.Input,
1358
+ {
1359
+ value: inputValue,
1360
+ onChange: (e) => handleInputChange(e.target.value, field),
1361
+ placeholder: datePlaceholder,
1362
+ className: "pr-16"
1363
+ }
1364
+ ),
1365
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "absolute right-1 top-1/2 flex -translate-y-1/2 items-center space-x-1", children: [
1366
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1367
+ "button",
1368
+ {
1369
+ type: "button",
1370
+ className: "hover:bg-muted flex h-8 w-8 items-center justify-center rounded-md",
1371
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Calendar, { className: "h-4 w-4 opacity-50" })
1372
+ }
1373
+ ) }),
1374
+ field.value && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1375
+ "button",
1376
+ {
1377
+ type: "button",
1378
+ className: "hover:bg-muted flex h-8 w-8 items-center justify-center rounded-md",
1379
+ onClick: () => {
1380
+ field.onChange(void 0);
1381
+ setInputValue("");
1382
+ if (onChange) onChange(void 0);
1383
+ },
1384
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CircleXIcon, { className: "h-4 w-4 opacity-50 hover:opacity-100" })
1385
+ }
1386
+ )
1387
+ ] })
1388
+ ] }),
1389
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-3", children: [
1390
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-3 flex gap-2", children: [
1391
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1392
+ _chunkA5DDIABKjs.Select,
1393
+ {
1394
+ value: displayMonth.getMonth().toString(),
1395
+ onValueChange: (value) => {
1396
+ const newMonth = parseInt(value);
1397
+ const newDate = new Date(displayMonth.getFullYear(), newMonth, 1);
1398
+ setDisplayMonth(newDate);
1399
+ },
1400
+ children: [
1401
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { className: "w-[130px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, {}) }),
1402
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: monthNames.map((month, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: index.toString(), children: month }, index)) })
1403
+ ]
1404
+ }
1405
+ ),
1406
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1407
+ _chunkA5DDIABKjs.Select,
1408
+ {
1409
+ value: displayMonth.getFullYear().toString(),
1410
+ onValueChange: (value) => {
1411
+ const newYear = parseInt(value);
1412
+ const newDate = new Date(newYear, displayMonth.getMonth(), 1);
1413
+ setDisplayMonth(newDate);
1414
+ },
1415
+ children: [
1416
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { className: "w-[80px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, {}) }),
1417
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: yearOptions.reverse().map((year) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: year.toString(), children: year }, year)) })
1418
+ ]
1419
+ }
1420
+ )
1421
+ ] }),
1422
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1423
+ _chunkA5DDIABKjs.Calendar,
1424
+ {
1425
+ mode: "single",
1426
+ selected: field.value,
1427
+ onSelect: (e) => {
1428
+ handleCalendarSelect(e, field);
1429
+ setOpen(false);
1430
+ },
1431
+ disabled: (date) => minDate && date < minDate ? true : false,
1432
+ locale: dateFnsLocale,
1433
+ weekStartsOn: 1,
1434
+ month: displayMonth,
1435
+ onMonthChange: setDisplayMonth
1436
+ }
1437
+ )
1438
+ ] }) })
1439
+ ] }) }) }),
1440
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1441
+ ] })
1442
+ }
1443
+ ) });
1444
+ }
1445
+ _chunk7QVYU63Ejs.__name.call(void 0, FormDate, "FormDate");
1446
+
1447
+ // src/components/forms/FormDateTime.tsx
1448
+
1449
+
1450
+
1451
+ function FormDateTime({
1452
+ form,
1453
+ id,
1454
+ name,
1455
+ minDate,
1456
+ onChange,
1457
+ allowEmpty
1458
+ }) {
1459
+ const [open, setOpen] = _react.useState.call(void 0, false);
1460
+ const t = _chunkCXQOWQSYjs.useI18nTranslations.call(void 0, );
1461
+ const locale = _chunkCXQOWQSYjs.useI18nLocale.call(void 0, );
1462
+ const dateFnsLocale = _chunkCXQOWQSYjs.useI18nDateFnsLocale.call(void 0, );
1463
+ const dateTimeFormatter = _react.useMemo.call(void 0,
1464
+ () => new Intl.DateTimeFormat(locale, {
1465
+ year: "numeric",
1466
+ month: "long",
1467
+ day: "numeric",
1468
+ hour: "2-digit",
1469
+ minute: "2-digit"
1470
+ }),
1471
+ [locale]
1472
+ );
1473
+ const formatDateTime = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (date) => dateTimeFormatter.format(date), "formatDateTime");
1474
+ const [selectedHours, setSelectedHours] = _react.useState.call(void 0, (/* @__PURE__ */ new Date()).getHours());
1475
+ const [selectedMinutes, setSelectedMinutes] = _react.useState.call(void 0, roundToNearestFiveMinutes((/* @__PURE__ */ new Date()).getMinutes()));
1476
+ const hoursOptions = Array.from({ length: 24 }, (_, i) => {
1477
+ const hour = i;
1478
+ return {
1479
+ value: hour,
1480
+ label: hour.toString().padStart(2, "0")
1481
+ };
1482
+ });
1483
+ const minutesOptions = Array.from({ length: 12 }, (_, i) => {
1484
+ const minute = i * 5;
1485
+ return {
1486
+ value: minute,
1487
+ label: minute.toString().padStart(2, "0")
1488
+ };
1489
+ });
1490
+ function roundToNearestFiveMinutes(minutes) {
1491
+ return Math.round(minutes / 5) * 5 % 60;
1492
+ }
1493
+ _chunk7QVYU63Ejs.__name.call(void 0, roundToNearestFiveMinutes, "roundToNearestFiveMinutes");
1494
+ const handleTimeChange = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (hours, minutes) => {
1495
+ const currentDate = form.getValues(id);
1496
+ if (currentDate) {
1497
+ const updatedDate = new Date(currentDate);
1498
+ updatedDate.setHours(hours);
1499
+ updatedDate.setMinutes(minutes);
1500
+ form.setValue(id, updatedDate);
1501
+ if (onChange) onChange(updatedDate);
1502
+ }
1503
+ }, "handleTimeChange");
1504
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1505
+ _chunkA5DDIABKjs.FormField,
1506
+ {
1507
+ control: form.control,
1508
+ name: id,
1509
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"} w-full`, children: [
1510
+ name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { children: name }),
1511
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "relative flex flex-row", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Popover, { open, onOpenChange: setOpen, modal: true, children: [
1512
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-row items-center justify-between", children: [
1513
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1514
+ _chunkA5DDIABKjs.Button,
1515
+ {
1516
+ variant: "outline",
1517
+ className: _chunkJC3WJK65js.cn.call(void 0, "w-full pl-3 text-left font-normal", !field.value && "text-muted-foreground"),
1518
+ children: [
1519
+ field.value ? formatDateTime(field.value) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t(`generic.pick_date_time`) }),
1520
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Calendar, { className: "ml-auto h-4 w-4 opacity-50" })
1521
+ ]
1522
+ }
1523
+ ) }) }),
1524
+ field.value && allowEmpty !== false && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1525
+ _lucidereact.CircleXIcon,
1526
+ {
1527
+ className: "text-muted hover:text-destructive ml-2 h-6 w-6 cursor-pointer",
1528
+ onClick: () => {
1529
+ if (onChange) onChange(void 0);
1530
+ form.setValue(id, "");
1531
+ }
1532
+ }
1533
+ )
1534
+ ] }),
1535
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.PopoverContent, { className: "w-auto p-4", align: "start", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col space-y-4", children: [
1536
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1537
+ _chunkA5DDIABKjs.Calendar,
1538
+ {
1539
+ mode: "single",
1540
+ selected: field.value,
1541
+ onSelect: (date) => {
1542
+ if (date) {
1543
+ const newDate = new Date(date);
1544
+ if (field.value) {
1545
+ const currentDate = new Date(field.value);
1546
+ newDate.setHours(currentDate.getHours(), currentDate.getMinutes());
1547
+ } else {
1548
+ newDate.setHours(selectedHours, selectedMinutes);
1549
+ }
1550
+ form.setValue(id, newDate);
1551
+ if (onChange) onChange(newDate);
1552
+ setSelectedHours(newDate.getHours());
1553
+ setSelectedMinutes(roundToNearestFiveMinutes(newDate.getMinutes()));
1554
+ }
1555
+ },
1556
+ disabled: (date) => minDate && date < minDate ? true : false,
1557
+ locale: dateFnsLocale
1558
+ }
1559
+ ),
1560
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-row items-end justify-center space-x-4", children: [
1561
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col space-y-2", children: [
1562
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Label, { htmlFor: "hours-select", children: t(`generic.hours`) }),
1563
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1564
+ _chunkA5DDIABKjs.Select,
1565
+ {
1566
+ value: String(field.value ? new Date(field.value).getHours() : selectedHours),
1567
+ onValueChange: (value) => {
1568
+ const hours = parseInt(value);
1569
+ setSelectedHours(hours);
1570
+ handleTimeChange(
1571
+ hours,
1572
+ field.value ? roundToNearestFiveMinutes(new Date(field.value).getMinutes()) : selectedMinutes
1573
+ );
1574
+ },
1575
+ children: [
1576
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { id: "hours-select", className: "w-[70px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, { placeholder: "Hour" }) }),
1577
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: hoursOptions.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: String(option.value), children: option.label }, option.value)) })
1578
+ ]
1579
+ }
1580
+ )
1581
+ ] }),
1582
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-[9px] text-xl", children: ":" }),
1583
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col space-y-2", children: [
1584
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Label, { htmlFor: "minutes-select", children: t(`generic.minutes`) }),
1585
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1586
+ _chunkA5DDIABKjs.Select,
1587
+ {
1588
+ value: String(
1589
+ field.value ? roundToNearestFiveMinutes(new Date(field.value).getMinutes()) : selectedMinutes
1590
+ ),
1591
+ onValueChange: (value) => {
1592
+ const minutes = parseInt(value);
1593
+ setSelectedMinutes(minutes);
1594
+ handleTimeChange(field.value ? new Date(field.value).getHours() : selectedHours, minutes);
1595
+ },
1596
+ children: [
1597
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { id: "minutes-select", className: "w-[70px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, { placeholder: "Min" }) }),
1598
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: minutesOptions.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: String(option.value), children: option.label }, option.value)) })
1599
+ ]
1600
+ }
1601
+ )
1602
+ ] })
1603
+ ] }),
1604
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1605
+ _chunkA5DDIABKjs.Button,
1606
+ {
1607
+ className: "mt-2",
1608
+ onClick: () => {
1609
+ setOpen(false);
1610
+ },
1611
+ children: t(`generic.buttons.select_date`)
1612
+ }
1613
+ )
1614
+ ] }) })
1615
+ ] }) }) }),
1616
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1617
+ ] })
1618
+ }
1619
+ ) });
1620
+ }
1621
+ _chunk7QVYU63Ejs.__name.call(void 0, FormDateTime, "FormDateTime");
1622
+
1623
+ // src/components/forms/FormInput.tsx
1624
+
1625
+
1626
+ function FormInput({
1627
+ form,
1628
+ id,
1629
+ name,
1630
+ placeholder,
1631
+ type,
1632
+ onBlur,
1633
+ disabled,
1634
+ onKeyDown,
1635
+ autoFocus,
1636
+ onChange,
1637
+ testId,
1638
+ isRequired = false
1639
+ }) {
1640
+ const t = _nextintl.useTranslations.call(void 0, );
1641
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1642
+ _chunkA5DDIABKjs.FormField,
1643
+ {
1644
+ control: form.control,
1645
+ name: id,
1646
+ render: ({ field }) => {
1647
+ const handleBlur = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (e) => {
1648
+ let value = e.target.value;
1649
+ if (type === "link" && value) {
1650
+ if (!/^https?:\/\//i.test(value)) {
1651
+ value = "https://" + value;
1652
+ field.onChange(value);
1653
+ }
1654
+ try {
1655
+ new URL(value);
1656
+ form.clearErrors(id);
1657
+ } catch (error) {
1658
+ form.setError(id, {
1659
+ type: "validate",
1660
+ message: t(`generic.errors.valid_url`)
1661
+ });
1662
+ }
1663
+ }
1664
+ if (onBlur) await onBlur();
1665
+ field.onBlur();
1666
+ }, "handleBlur");
1667
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1668
+ name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: "flex items-center", children: [
1669
+ name,
1670
+ isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1671
+ ] }),
1672
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
1673
+ type === "currency" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground absolute top-0 left-0 pt-2 pl-3", children: "\u20AC" }),
1674
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1675
+ _chunkA5DDIABKjs.Input,
1676
+ {
1677
+ "data-testid": testId,
1678
+ ...field,
1679
+ autoFocus: autoFocus === true,
1680
+ type: type === "number" || type === "currency" ? "number" : type === "password" ? "password" : "text",
1681
+ className: `w-full ${type === "number" || type === "currency" ? "text-end" : ""}`,
1682
+ disabled: disabled === true || form.formState.isSubmitting,
1683
+ placeholder: placeholder || "",
1684
+ onBlur: handleBlur,
1685
+ onKeyDown,
1686
+ onChange: (e) => {
1687
+ if (type === "number" || type === "currency") {
1688
+ const value = e.target.value.replace(/[^0-9]/g, "");
1689
+ field.onChange(+value);
1690
+ if (onChange) onChange(+value);
1691
+ } else {
1692
+ field.onChange(e.target.value);
1693
+ if (onChange) onChange(e.target.value);
1694
+ }
1695
+ }
1696
+ }
1697
+ )
1698
+ ] }) }),
1699
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, { "data-testid": testId ? `${testId}-error` : void 0 })
1700
+ ] });
1701
+ }
1702
+ }
1703
+ ) });
1704
+ }
1705
+ _chunk7QVYU63Ejs.__name.call(void 0, FormInput, "FormInput");
1706
+
1707
+ // src/components/forms/PasswordInput.tsx
1708
+
1709
+
1710
+
1711
+
1712
+ var PasswordInput = React2.forwardRef(({ className, type, ...props }, ref) => {
1713
+ const [showPassword, setShowPassword] = React2.useState(false);
1714
+ const disabled = props.value === "" || props.value === void 0 || props.disabled;
1715
+ const t = _nextintl.useTranslations.call(void 0, );
1716
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
1717
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Input, { type: showPassword ? "text" : "password", className: _chunkJC3WJK65js.cn.call(void 0, "", className), ref, ...props }),
1718
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1719
+ _chunkA5DDIABKjs.Button,
1720
+ {
1721
+ type: "button",
1722
+ variant: "ghost",
1723
+ size: "sm",
1724
+ className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
1725
+ onClick: () => setShowPassword((prev) => !prev),
1726
+ disabled,
1727
+ children: [
1728
+ showPassword && !disabled ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.EyeIcon, { className: "h-4 w-4", "aria-hidden": "true" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.EyeOffIcon, { className: "h-4 w-4", "aria-hidden": "true" }),
1729
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", children: showPassword ? t(`generic.hide_password`) : t(`generic.show_password`) })
1730
+ ]
1731
+ }
1732
+ ),
1733
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: `
1734
+ .hide-password-toggle::-ms-reveal,
1735
+ .hide-password-toggle::-ms-clear {
1736
+ visibility: hidden;
1737
+ pointer-events: none;
1738
+ display: none;
1739
+ }
1740
+ ` })
1741
+ ] });
1742
+ });
1743
+ PasswordInput.displayName = "PasswordInput";
1744
+
1745
+ // src/components/forms/FormPassword.tsx
1746
+
1747
+ function FormPassword({
1748
+ form,
1749
+ id,
1750
+ name,
1751
+ placeholder,
1752
+ onBlur,
1753
+ disabled,
1754
+ testId,
1755
+ isRequired
1756
+ }) {
1757
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1758
+ _chunkA5DDIABKjs.FormField,
1759
+ {
1760
+ control: form.control,
1761
+ name: id,
1762
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1763
+ name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { children: [
1764
+ name,
1765
+ isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1766
+ ] }),
1767
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1768
+ PasswordInput,
1769
+ {
1770
+ ...field,
1771
+ className: `w-full`,
1772
+ disabled: disabled === true || form.formState.isSubmitting,
1773
+ placeholder: placeholder ? placeholder : "",
1774
+ onBlur,
1775
+ "data-testid": testId
1776
+ }
1777
+ ) }),
1778
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, { "data-testid": testId ? `${testId}-error` : void 0 })
1779
+ ] })
1780
+ }
1781
+ ) });
1782
+ }
1783
+ _chunk7QVYU63Ejs.__name.call(void 0, FormPassword, "FormPassword");
1784
+
1785
+ // src/components/forms/FormPlaceAutocomplete.tsx
1786
+
1787
+
1788
+ function FormPlaceAutocomplete({
1789
+ form,
1790
+ id,
1791
+ name,
1792
+ placeholder,
1793
+ disabled,
1794
+ testId,
1795
+ isRequired = false,
1796
+ onPlaceSelect,
1797
+ className,
1798
+ includeTypes
1799
+ }) {
1800
+ const [inputValue, setInputValue] = _react.useState.call(void 0, "");
1801
+ const [suggestions, setSuggestions] = _react.useState.call(void 0, []);
1802
+ const [isLoading, setIsLoading] = _react.useState.call(void 0, false);
1803
+ const [showSuggestions, setShowSuggestions] = _react.useState.call(void 0, false);
1804
+ const [loadError, setLoadError] = _react.useState.call(void 0, false);
1805
+ const [apiKey, setApiKey] = _react.useState.call(void 0, null);
1806
+ const debounceRef = _react.useRef.call(void 0, null);
1807
+ const containerRef = _react.useRef.call(void 0, null);
1808
+ _react.useEffect.call(void 0, () => {
1809
+ const key = process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY;
1810
+ if (!key) {
1811
+ console.error("Google Maps API key not found. Please set NEXT_PUBLIC_GOOGLE_MAPS_API_KEY environment variable.");
1812
+ setLoadError(true);
1813
+ return;
1814
+ }
1815
+ setApiKey(key);
1816
+ }, []);
1817
+ _react.useEffect.call(void 0, () => {
1818
+ const formValue = form.getValues(id);
1819
+ if (formValue !== inputValue) {
1820
+ setInputValue(formValue || "");
1821
+ }
1822
+ }, [form.watch(id), id, inputValue]);
1823
+ const fetchSuggestions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (input) => {
1824
+ if (!apiKey) return;
1825
+ try {
1826
+ setIsLoading(true);
1827
+ const response = await fetch(`https://places.googleapis.com/v1/places:autocomplete`, {
1828
+ method: "POST",
1829
+ headers: {
1830
+ "Content-Type": "application/json",
1831
+ "X-Goog-Api-Key": apiKey
1832
+ },
1833
+ body: JSON.stringify({
1834
+ input,
1835
+ includedPrimaryTypes: includeTypes || ["street_address", "premise", "subpremise"],
1836
+ languageCode: "en"
1837
+ })
1838
+ });
1839
+ if (!response.ok) {
1840
+ throw new Error(`Places API error: ${response.status}`);
1841
+ }
1842
+ const data = await response.json();
1843
+ if (data.suggestions) {
1844
+ const formattedSuggestions = data.suggestions.map((suggestion) => ({
1845
+ place_id: _optionalChain([suggestion, 'access', _25 => _25.placePrediction, 'optionalAccess', _26 => _26.placeId]) || "",
1846
+ description: _optionalChain([suggestion, 'access', _27 => _27.placePrediction, 'optionalAccess', _28 => _28.text, 'optionalAccess', _29 => _29.text]) || "",
1847
+ structured_formatting: {
1848
+ main_text: _optionalChain([suggestion, 'access', _30 => _30.placePrediction, 'optionalAccess', _31 => _31.structuredFormat, 'optionalAccess', _32 => _32.mainText, 'optionalAccess', _33 => _33.text]) || "",
1849
+ secondary_text: _optionalChain([suggestion, 'access', _34 => _34.placePrediction, 'optionalAccess', _35 => _35.structuredFormat, 'optionalAccess', _36 => _36.secondaryText, 'optionalAccess', _37 => _37.text]) || ""
1850
+ }
1851
+ }));
1852
+ setSuggestions(formattedSuggestions);
1853
+ setShowSuggestions(true);
1854
+ } else {
1855
+ setSuggestions([]);
1856
+ }
1857
+ } catch (error) {
1858
+ console.error("Error fetching place suggestions:", error);
1859
+ setSuggestions([]);
1860
+ } finally {
1861
+ setIsLoading(false);
1862
+ }
1863
+ }, "fetchSuggestions");
1864
+ const handleInputChange = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (value) => {
1865
+ setInputValue(value);
1866
+ form.setValue(id, value);
1867
+ if (debounceRef.current) {
1868
+ clearTimeout(debounceRef.current);
1869
+ }
1870
+ if (value.length > 2 && apiKey) {
1871
+ debounceRef.current = setTimeout(() => {
1872
+ fetchSuggestions(value);
1873
+ }, 300);
1874
+ } else {
1875
+ setSuggestions([]);
1876
+ setShowSuggestions(false);
1877
+ setIsLoading(false);
1878
+ }
1879
+ }, "handleInputChange");
1880
+ const handleSuggestionSelect = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (suggestion) => {
1881
+ setInputValue(suggestion.description);
1882
+ form.setValue(id, suggestion.description);
1883
+ setShowSuggestions(false);
1884
+ setSuggestions([]);
1885
+ if (onPlaceSelect) {
1886
+ onPlaceSelect(suggestion);
1887
+ }
1888
+ }, "handleSuggestionSelect");
1889
+ _react.useEffect.call(void 0, () => {
1890
+ const handleClickOutside = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (event) => {
1891
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
1892
+ setShowSuggestions(false);
1893
+ }
1894
+ }, "handleClickOutside");
1895
+ document.addEventListener("mousedown", handleClickOutside);
1896
+ return () => {
1897
+ document.removeEventListener("mousedown", handleClickOutside);
1898
+ };
1899
+ }, []);
1900
+ _react.useEffect.call(void 0, () => {
1901
+ return () => {
1902
+ if (debounceRef.current) {
1903
+ clearTimeout(debounceRef.current);
1904
+ }
1905
+ };
1906
+ }, []);
1907
+ if (loadError) {
1908
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1909
+ _chunkA5DDIABKjs.FormField,
1910
+ {
1911
+ control: form.control,
1912
+ name: id,
1913
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1914
+ name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: "flex items-center", children: [
1915
+ name,
1916
+ isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1917
+ ] }),
1918
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1919
+ _chunkA5DDIABKjs.Input,
1920
+ {
1921
+ ...field,
1922
+ placeholder,
1923
+ disabled,
1924
+ "data-testid": testId,
1925
+ className: _chunkJC3WJK65js.cn.call(void 0, "w-full", className)
1926
+ }
1927
+ ) }),
1928
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1929
+ ] })
1930
+ }
1931
+ ) });
1932
+ }
1933
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", ref: containerRef, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1934
+ _chunkA5DDIABKjs.FormField,
1935
+ {
1936
+ control: form.control,
1937
+ name: id,
1938
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
1939
+ name && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: "flex items-center", children: [
1940
+ name,
1941
+ isRequired && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-destructive ml-2 font-semibold", children: "*" })
1942
+ ] }),
1943
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
1944
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1945
+ _chunkA5DDIABKjs.Input,
1946
+ {
1947
+ value: inputValue,
1948
+ onChange: (e) => handleInputChange(e.target.value),
1949
+ onBlur: field.onBlur,
1950
+ onFocus: () => {
1951
+ if (suggestions.length > 0) {
1952
+ setShowSuggestions(true);
1953
+ }
1954
+ },
1955
+ placeholder,
1956
+ disabled: disabled || !apiKey,
1957
+ "data-testid": testId,
1958
+ className: _chunkJC3WJK65js.cn.call(void 0, "w-full", className)
1959
+ }
1960
+ ),
1961
+ isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-primary h-4 w-4 animate-spin rounded-full border-2 border-t-transparent" }) }),
1962
+ showSuggestions && suggestions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-background absolute left-0 right-0 top-full z-50 mt-1 max-h-60 overflow-auto rounded-md border shadow-lg", children: suggestions.map((suggestion, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1963
+ "div",
1964
+ {
1965
+ className: "hover:bg-muted cursor-pointer px-3 py-2 text-sm",
1966
+ onClick: () => handleSuggestionSelect(suggestion),
1967
+ children: [
1968
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "font-medium", children: _optionalChain([suggestion, 'access', _38 => _38.structured_formatting, 'optionalAccess', _39 => _39.main_text]) }),
1969
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground", children: _optionalChain([suggestion, 'access', _40 => _40.structured_formatting, 'optionalAccess', _41 => _41.secondary_text]) })
1970
+ ]
1971
+ },
1972
+ suggestion.place_id || index
1973
+ )) })
1974
+ ] }) }),
1975
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
1976
+ ] })
1977
+ }
1978
+ ) });
1979
+ }
1980
+ _chunk7QVYU63Ejs.__name.call(void 0, FormPlaceAutocomplete, "FormPlaceAutocomplete");
1981
+
1982
+ // src/components/forms/FormSelect.tsx
1983
+
1984
+ function FormSelect({
1985
+ form,
1986
+ id,
1987
+ name,
1988
+ placeholder,
1989
+ disabled,
1990
+ values,
1991
+ onChange,
1992
+ useRows,
1993
+ testId
1994
+ }) {
1995
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `flex w-full flex-col`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1996
+ _chunkA5DDIABKjs.FormField,
1997
+ {
1998
+ control: form.control,
1999
+ name: id,
2000
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `flex w-full ${useRows ? `flex-row items-center justify-between gap-x-4` : `flex-col`}`, children: [
2001
+ name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { className: `${useRows ? `min-w-28` : ``}`, children: name }),
2002
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2003
+ _chunkA5DDIABKjs.Select,
2004
+ {
2005
+ onValueChange: (e) => {
2006
+ field.onChange(e);
2007
+ if (onChange) onChange(e);
2008
+ },
2009
+ defaultValue: field.value,
2010
+ "data-testid": testId,
2011
+ children: [
2012
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { className: "w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectValue, { placeholder }) }) }),
2013
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectContent, { children: values.map((type) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.SelectItem, { value: type.id, children: type.text }, type.id)) })
2014
+ ]
2015
+ }
2016
+ ),
2017
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
2018
+ ] })
2019
+ }
2020
+ ) });
2021
+ }
2022
+ _chunk7QVYU63Ejs.__name.call(void 0, FormSelect, "FormSelect");
2023
+
2024
+ // src/components/forms/FormSlider.tsx
2025
+ var _reacthookform = require('react-hook-form');
2026
+
2027
+ function FormSlider({
2028
+ form,
2029
+ id,
2030
+ name,
2031
+ disabled,
2032
+ showPercentage
2033
+ }) {
2034
+ const value = _reacthookform.useWatch.call(void 0, { control: form.control, name: id });
2035
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2036
+ _chunkA5DDIABKjs.FormField,
2037
+ {
2038
+ control: form.control,
2039
+ name: id,
2040
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
2041
+ name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { children: name }),
2042
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2043
+ showPercentage && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground mb-2 flex w-full justify-center text-xs", children: `${value}%` }),
2044
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2045
+ _chunkA5DDIABKjs.Slider,
2046
+ {
2047
+ onValueChange: (value2) => form.setValue(id, value2[0]),
2048
+ value: [value],
2049
+ max: 100,
2050
+ step: 5,
2051
+ disabled: disabled === true || form.formState.isSubmitting
2052
+ }
2053
+ )
2054
+ ] }) }),
2055
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
2056
+ ] })
2057
+ }
2058
+ ) });
2059
+ }
2060
+ _chunk7QVYU63Ejs.__name.call(void 0, FormSlider, "FormSlider");
2061
+
2062
+ // src/components/forms/FormSwitch.tsx
2063
+
2064
+ function FormSwitch({ form, id, name, disabled }) {
2065
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2066
+ _chunkA5DDIABKjs.FormField,
2067
+ {
2068
+ control: form.control,
2069
+ name: id,
2070
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: `${name ? "mb-5" : "mb-1"}`, children: [
2071
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-row gap-x-4", children: [
2072
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Switch, { checked: field.value, onCheckedChange: field.onChange }),
2073
+ name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { children: name })
2074
+ ] }) }),
2075
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, {})
2076
+ ] })
2077
+ }
2078
+ ) });
2079
+ }
2080
+ _chunk7QVYU63Ejs.__name.call(void 0, FormSwitch, "FormSwitch");
2081
+
2082
+ // src/components/forms/FormTextarea.tsx
2083
+
2084
+ function FormTextarea({
2085
+ form,
2086
+ id,
2087
+ name,
2088
+ className,
2089
+ placeholder,
2090
+ testId
2091
+ }) {
2092
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2093
+ _chunkA5DDIABKjs.FormField,
2094
+ {
2095
+ control: form.control,
2096
+ name: id,
2097
+ render: ({ field }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.FormItem, { className: "mb-5", children: [
2098
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormLabel, { children: name }),
2099
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormControl, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2100
+ _chunkA5DDIABKjs.Textarea,
2101
+ {
2102
+ ...field,
2103
+ className: _chunkJC3WJK65js.cn.call(void 0, "min-h-96 w-full", className),
2104
+ disabled: form.formState.isSubmitting,
2105
+ placeholder,
2106
+ "data-testid": testId
2107
+ }
2108
+ ) }),
2109
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.FormMessage, { "data-testid": testId ? `${testId}-error` : void 0 })
2110
+ ] })
2111
+ }
2112
+ ) });
2113
+ }
2114
+ _chunk7QVYU63Ejs.__name.call(void 0, FormTextarea, "FormTextarea");
2115
+
2116
+ // src/components/pages/PageContainerContentDetails.tsx
2117
+
2118
+
2119
+ function PageContainerContentDetails({ items, section, module, id }) {
2120
+ const rewriteUrl = _chunkFY4SXJGUjs.useUrlRewriter.call(void 0, );
2121
+ const [isScrolled, setIsScrolled] = _react.useState.call(void 0, false);
2122
+ const sentinelRef = _react.useRef.call(void 0, null);
2123
+ _react.useEffect.call(void 0, () => {
2124
+ const sentinel = sentinelRef.current;
2125
+ if (!sentinel) return;
2126
+ const observer = new IntersectionObserver(
2127
+ ([entry]) => {
2128
+ setIsScrolled(!entry.isIntersecting);
2129
+ },
2130
+ {
2131
+ threshold: 0,
2132
+ rootMargin: "0px"
2133
+ }
2134
+ );
2135
+ observer.observe(sentinel);
2136
+ return () => {
2137
+ observer.disconnect();
2138
+ };
2139
+ }, []);
2140
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2141
+ _chunkA5DDIABKjs.Tabs,
2142
+ {
2143
+ defaultValue: section || items[0].title,
2144
+ onValueChange: (a) => rewriteUrl({ page: module, id, childPage: a }),
2145
+ children: [
2146
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: sentinelRef, className: "h-0" }),
2147
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `bg-background sticky top-0 z-10 mb-2 pb-2 transition-shadow ${isScrolled ? "border-b" : ""}`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TabsList, { children: items.map((item) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TabsTrigger, { value: item.title, children: item.title }, item.title)) }) }),
2148
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pr-4", children: items.map((item) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TabsContent, { value: item.title, children: item.content }, item.title)) })
2149
+ ]
2150
+ }
2151
+ );
2152
+ }
2153
+ _chunk7QVYU63Ejs.__name.call(void 0, PageContainerContentDetails, "PageContainerContentDetails");
2154
+
2155
+ // src/components/pages/PageContentContainer.tsx
2156
+
2157
+ function PageContentContainer({ details, footer, content }) {
2158
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-[calc(100vh-(--spacing(16)))] w-full", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.ResizablePanelGroup, { direction: "horizontal", className: "items-stretch", autoSaveId: "page-content-layout", children: [
2159
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.ResizablePanel, { id: "left-panel", defaultSize: 32, minSize: 20, maxSize: 40, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "@container flex h-full flex-col pr-4", children: [
2160
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex-1 overflow-y-auto", children: details }),
2161
+ footer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col gap-y-2 pt-2 pb-2", children: footer })
2162
+ ] }) }),
2163
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.ResizableHandle, { withHandle: true }),
2164
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.ResizablePanel, { id: "right-panel", className: "pl-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full overflow-y-auto", children: content }) })
2165
+ ] }) });
2166
+ }
2167
+ _chunk7QVYU63Ejs.__name.call(void 0, PageContentContainer, "PageContentContainer");
2168
+
2169
+ // src/components/tables/cells/cell.component.tsx
2170
+ var cellComponent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
2171
+ return {
2172
+ id: params.name,
2173
+ accessorKey: params.name,
2174
+ header: params.title,
2175
+ cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => params.component, "cell"),
2176
+ enableSorting: false,
2177
+ enableHiding: false
2178
+ };
2179
+ }, "cellComponent");
2180
+
2181
+ // src/components/tables/cells/cell.date.tsx
2182
+
2183
+ var cellDate = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
2184
+ return {
2185
+ id: params.name,
2186
+ accessorKey: params.name,
2187
+ header: params.title,
2188
+ cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: row.getValue(params.name).toLocaleDateString("en", { dateStyle: "medium" }) }), "cell"),
2189
+ enableSorting: false,
2190
+ enableHiding: false
2191
+ };
2192
+ }, "cellDate");
2193
+
2194
+ // src/components/tables/cells/cell.id.tsx
2195
+
2196
+ var cellId = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
2197
+ return {
2198
+ id: params.name,
2199
+ accessorKey: params.name,
2200
+ header: "",
2201
+ cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => params.toggleId ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2202
+ _chunkA5DDIABKjs.Checkbox,
2203
+ {
2204
+ checked: _optionalChain([params, 'access', _42 => _42.checkedIds, 'optionalAccess', _43 => _43.includes, 'call', _44 => _44(row.getValue(params.name))]) || false,
2205
+ onCheckedChange: (value) => {
2206
+ row.toggleSelected(!!value);
2207
+ _optionalChain([params, 'access', _45 => _45.toggleId, 'optionalCall', _46 => _46(row.getValue(params.name))]);
2208
+ },
2209
+ "aria-label": "Select row"
2210
+ }
2211
+ ) : null, "cell"),
2212
+ enableSorting: false,
2213
+ enableHiding: true
2214
+ };
2215
+ }, "cellId");
2216
+
2217
+ // src/components/tables/cells/cell.link.tsx
2218
+
2219
+ var cellLink = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
2220
+ return {
2221
+ id: params.name,
2222
+ accessorKey: params.name,
2223
+ header: params.title,
2224
+ cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: params.generateUrl(row.getValue(params.id)), children: row.getValue(params.name) }), "cell"),
2225
+ enableSorting: false,
2226
+ enableHiding: false
2227
+ };
2228
+ }, "cellLink");
2229
+
2230
+ // src/components/tables/cells/cell.url.tsx
2231
+
2232
+ var cellUrl = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => {
2233
+ return {
2234
+ id: params.name,
2235
+ accessorKey: params.name,
2236
+ header: params.title,
2237
+ cell: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ row }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.Link, { href: row.getValue(params.name), children: row.getValue(params.name) }), "cell"),
2238
+ enableSorting: false,
2239
+ enableHiding: false
2240
+ };
2241
+ }, "cellUrl");
2242
+
2243
+ // src/components/tables/ContentListTable.tsx
2244
+ var _reacttable = require('@tanstack/react-table');
2245
+ var _reacticons = require('@radix-ui/react-icons');
2246
+
2247
+
2248
+ // src/components/tables/ContentTableSearch.tsx
2249
+
2250
+
2251
+
2252
+
2253
+ function ContentTableSearch({ data }) {
2254
+ const t = _nextintl.useTranslations.call(void 0, );
2255
+ const searchTermRef = _react.useRef.call(void 0, "");
2256
+ const inputRef = _react.useRef.call(void 0, null);
2257
+ const [searchTerm, setSearchTerm] = _react.useState.call(void 0, "");
2258
+ const [isFocused, setIsFocused] = _react.useState.call(void 0, false);
2259
+ const [isSearching, setIsSearching] = _react.useState.call(void 0, false);
2260
+ const isExpanded = isFocused || searchTerm.length > 0;
2261
+ const search = _react.useCallback.call(void 0,
2262
+ async (searchedTerm) => {
2263
+ try {
2264
+ if (searchedTerm === searchTermRef.current) return;
2265
+ searchTermRef.current = searchedTerm;
2266
+ await data.search(searchedTerm);
2267
+ } finally {
2268
+ setIsSearching(false);
2269
+ }
2270
+ },
2271
+ [searchTermRef, data]
2272
+ );
2273
+ const updateSearchTerm = _chunkFY4SXJGUjs.useDebounce.call(void 0, search, 500);
2274
+ _react.useEffect.call(void 0, () => {
2275
+ setIsSearching(true);
2276
+ updateSearchTerm(searchTerm);
2277
+ }, [updateSearchTerm, searchTerm]);
2278
+ const handleSearchIconClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2279
+ if (!isExpanded) {
2280
+ setIsFocused(true);
2281
+ setTimeout(() => _optionalChain([inputRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.focus, 'call', _49 => _49()]), 50);
2282
+ }
2283
+ }, "handleSearchIconClick");
2284
+ const handleBlur = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2285
+ if (searchTerm.length === 0) {
2286
+ setIsFocused(false);
2287
+ }
2288
+ }, "handleBlur");
2289
+ const handleClear = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2290
+ setSearchTerm("");
2291
+ search("");
2292
+ setIsFocused(false);
2293
+ }, "handleClear");
2294
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2295
+ "div",
2296
+ {
2297
+ className: `relative flex h-6 items-center text-xs font-normal transition-all duration-300 ease-in-out ${isExpanded ? "w-64" : "w-6"}`,
2298
+ children: [
2299
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2300
+ _lucidereact.Search,
2301
+ {
2302
+ className: `absolute top-1 left-1 h-4 w-4 transition-colors ${isExpanded ? "text-muted-foreground" : "text-muted-foreground hover:text-foreground cursor-pointer"}`,
2303
+ onClick: handleSearchIconClick
2304
+ }
2305
+ ),
2306
+ isExpanded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2307
+ _chunkA5DDIABKjs.Input,
2308
+ {
2309
+ ref: inputRef,
2310
+ onKeyDown: (e) => {
2311
+ if (e.key === "Escape") {
2312
+ handleClear();
2313
+ }
2314
+ },
2315
+ onFocus: () => setIsFocused(true),
2316
+ onBlur: handleBlur,
2317
+ placeholder: t(`generic.search.placeholder_global`),
2318
+ type: "text",
2319
+ className: "border-border/50 focus-visible:border-border h-10 w-full pr-8 pl-8 text-xs shadow-none focus-visible:ring-0",
2320
+ onChange: (e) => setSearchTerm(e.target.value),
2321
+ value: searchTerm
2322
+ }
2323
+ ),
2324
+ isExpanded && isSearching && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "text-muted-foreground absolute top-1 right-1 h-4 w-4 animate-spin" }),
2325
+ isExpanded && !isSearching && searchTermRef.current && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2326
+ _lucidereact.X,
2327
+ {
2328
+ className: "text-muted-foreground hover:text-foreground absolute top-1 right-1 h-4 w-4 cursor-pointer",
2329
+ onClick: handleClear
2330
+ }
2331
+ )
2332
+ ]
2333
+ }
2334
+ );
2335
+ }
2336
+ _chunk7QVYU63Ejs.__name.call(void 0, ContentTableSearch, "ContentTableSearch");
2337
+
2338
+ // src/components/tables/ContentListTable.tsx
2339
+
2340
+ var EMPTY_ARRAY = [];
2341
+ var ContentListTable = _react.memo.call(void 0, /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, function ContentListTable2(props) {
2342
+ const { data, fields, checkedIds, toggleId, allowSearch, filters } = props;
2343
+ const { data: tableData, columns: tableColumns } = _chunkFY4SXJGUjs.useTableGenerator.call(void 0, props.tableGeneratorType, {
2344
+ data: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _50 => _50.data]), () => ( EMPTY_ARRAY)),
2345
+ fields,
2346
+ checkedIds,
2347
+ toggleId,
2348
+ dataRetriever: data,
2349
+ context: props.context
2350
+ });
2351
+ const columnVisibility = _react.useMemo.call(void 0,
2352
+ () => fields.reduce(
2353
+ (acc, columnId) => {
2354
+ acc[columnId] = true;
2355
+ return acc;
2356
+ },
2357
+ {}
2358
+ ),
2359
+ [fields]
2360
+ );
2361
+ const table = _reacttable.useReactTable.call(void 0, {
2362
+ data: tableData,
2363
+ columns: tableColumns,
2364
+ getCoreRowModel: _reacttable.getCoreRowModel.call(void 0, ),
2365
+ initialState: {
2366
+ columnVisibility
2367
+ }
2368
+ });
2369
+ const rowModel = tableData ? table.getRowModel() : null;
2370
+ const showFooter = !!(props.functions || data.next || data.previous);
2371
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full flex-col", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-hidden rounded-md border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.Table, { children: [
2372
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5DDIABKjs.TableHeader, { className: "bg-muted font-semibold", children: [
2373
+ props.title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableRow, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableHead, { className: "bg-card text-primary p-4 text-left font-bold", colSpan: tableColumns.length, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full items-center justify-between gap-x-2", children: [
2374
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full", children: props.title }),
2375
+ (props.functions || props.filters || allowSearch) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2376
+ props.functions,
2377
+ props.filters,
2378
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentTableSearch, { data })
2379
+ ] })
2380
+ ] }) }) }),
2381
+ table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableRow, { children: headerGroup.headers.map((header) => {
2382
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableHead, { children: header.isPlaceholder ? null : _reacttable.flexRender.call(void 0, header.column.columnDef.header, header.getContext()) }, header.id);
2383
+ }) }, headerGroup.id))
2384
+ ] }),
2385
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableBody, { children: rowModel && _optionalChain([rowModel, 'access', _51 => _51.rows, 'optionalAccess', _52 => _52.length]) ? rowModel.rows.map((row) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableRow, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableCell, { children: _reacttable.flexRender.call(void 0, cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableRow, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableCell, { colSpan: tableColumns.length, className: "h-24 text-center", children: "No results." }) }) }),
2386
+ showFooter && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableRow, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5DDIABKjs.TableCell, { colSpan: tableColumns.length, className: "bg-card py-4 text-right", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-end space-x-2", children: [
2387
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2388
+ _chunkA5DDIABKjs.Button,
2389
+ {
2390
+ variant: "outline",
2391
+ size: "sm",
2392
+ onClick: (e) => {
2393
+ e.preventDefault();
2394
+ _optionalChain([data, 'access', _53 => _53.previous, 'optionalCall', _54 => _54(true)]);
2395
+ },
2396
+ disabled: !data.previous,
2397
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.CaretLeftIcon, { className: "h-4 w-4" })
2398
+ }
2399
+ ),
2400
+ data.pageInfo && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-muted-foreground text-xs", children: [
2401
+ data.pageInfo.startItem,
2402
+ "-",
2403
+ data.pageInfo.endItem
2404
+ ] }),
2405
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2406
+ _chunkA5DDIABKjs.Button,
2407
+ {
2408
+ variant: "outline",
2409
+ size: "sm",
2410
+ onClick: (e) => {
2411
+ e.preventDefault();
2412
+ _optionalChain([data, 'access', _55 => _55.next, 'optionalCall', _56 => _56(true)]);
2413
+ },
2414
+ disabled: !data.next,
2415
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.CaretRightIcon, { className: "h-4 w-4" })
2416
+ }
2417
+ )
2418
+ ] }) }) }) })
2419
+ ] }) }) });
2420
+ }, "ContentListTable"));
2421
+
2422
+
2423
+
2424
+
2425
+
2426
+
2427
+
2428
+
2429
+
2430
+
2431
+
2432
+
2433
+
2434
+
2435
+
2436
+
2437
+
2438
+
2439
+
2440
+
2441
+
2442
+
2443
+
2444
+
2445
+
2446
+
2447
+
2448
+
2449
+
2450
+
2451
+
2452
+
2453
+
2454
+
2455
+
2456
+
2457
+
2458
+
2459
+
2460
+
2461
+
2462
+
2463
+
2464
+
2465
+
2466
+
2467
+
2468
+
2469
+
2470
+
2471
+
2472
+
2473
+ exports.AllowedUsersDetails = AllowedUsersDetails; exports.AttributeElement = AttributeElement; exports.BlockNoteEditorContainer = BlockNoteEditorContainer; exports.Breadcrumb = Breadcrumb2; exports.CommonAssociationCommandDialog = CommonAssociationCommandDialog; exports.CommonAssociationTrigger = CommonAssociationTrigger; exports.CommonDeleter = CommonDeleter; exports.CommonEditorButtons = CommonEditorButtons; exports.CommonEditorHeader = CommonEditorHeader; exports.CommonEditorTrigger = CommonEditorTrigger; exports.ContentListTable = ContentListTable; exports.ContentTableSearch = ContentTableSearch; exports.ContentTitle = ContentTitle; exports.ContributorsList = _chunkAWONBQQPjs.ContributorsList; exports.DatePickerPopover = DatePickerPopover; exports.DateRangeSelector = DateRangeSelector; exports.ErrorDetails = ErrorDetails; exports.FileInput = FileInput; exports.FileUploader = FileUploader; exports.FileUploaderContent = FileUploaderContent; exports.FileUploaderItem = FileUploaderItem; exports.FormCheckbox = FormCheckbox; exports.FormContainerGeneric = FormContainerGeneric; exports.FormDate = FormDate; exports.FormDateTime = FormDateTime; exports.FormInput = FormInput; exports.FormPassword = FormPassword; exports.FormPlaceAutocomplete = FormPlaceAutocomplete; exports.FormSelect = FormSelect; exports.FormSlider = FormSlider; exports.FormSwitch = FormSwitch; exports.FormTextarea = FormTextarea; exports.Header = Header; exports.ModeToggleSwitch = ModeToggleSwitch; exports.PageContainer = PageContainer; exports.PageContainerContentDetails = PageContainerContentDetails; exports.PageContentContainer = PageContentContainer; exports.PageSection = PageSection; exports.PasswordInput = PasswordInput; exports.ReactMarkdownContainer = ReactMarkdownContainer; exports.RecentPagesNavigator = RecentPagesNavigator; exports.TabsContainer = TabsContainer; exports.UserAvatar = _chunkAWONBQQPjs.UserAvatar; exports.cellComponent = cellComponent; exports.cellDate = cellDate; exports.cellId = cellId; exports.cellLink = cellLink; exports.cellUrl = cellUrl; exports.errorToast = _chunkRUR22SVMjs.errorToast; exports.triggerAssociationToast = triggerAssociationToast; exports.useFileUpload = useFileUpload;
2474
+ //# sourceMappingURL=index.js.map