@erpsquad/common 1.11.29 → 1.11.30

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 (1192) hide show
  1. package/dist/chunks/DonutChart-BlzVwF9V.js +104 -0
  2. package/dist/chunks/DonutChart-BlzVwF9V.js.map +1 -0
  3. package/dist/chunks/DonutChart-CBaRNVKd.esm.js +88 -0
  4. package/dist/chunks/DonutChart-CBaRNVKd.esm.js.map +1 -0
  5. package/dist/chunks/DynamicDependentField-B1jkZzNW.js +127 -0
  6. package/dist/chunks/DynamicDependentField-B1jkZzNW.js.map +1 -0
  7. package/dist/chunks/DynamicDependentField-m4v2i_Ss.esm.js +128 -0
  8. package/dist/chunks/DynamicDependentField-m4v2i_Ss.esm.js.map +1 -0
  9. package/dist/chunks/ERPUIProvider-D1yQ1CmD.esm.js +130 -0
  10. package/dist/chunks/ERPUIProvider-D1yQ1CmD.esm.js.map +1 -0
  11. package/dist/chunks/ERPUIProvider-O6cQFkJq.js +129 -0
  12. package/dist/chunks/ERPUIProvider-O6cQFkJq.js.map +1 -0
  13. package/dist/chunks/FORMS-CP_bWKVd.js +295 -0
  14. package/dist/chunks/FORMS-CP_bWKVd.js.map +1 -0
  15. package/dist/chunks/FORMS-D1M0DgHQ.esm.js +296 -0
  16. package/dist/chunks/FORMS-D1M0DgHQ.esm.js.map +1 -0
  17. package/dist/chunks/FlexibleReduxExample-Ckz_L6d8.esm.js +149 -0
  18. package/dist/chunks/FlexibleReduxExample-Ckz_L6d8.esm.js.map +1 -0
  19. package/dist/chunks/FlexibleReduxExample-Df-bAX9S.js +148 -0
  20. package/dist/chunks/FlexibleReduxExample-Df-bAX9S.js.map +1 -0
  21. package/dist/chunks/GroupBarChart-BSLOA0iQ.js +102 -0
  22. package/dist/chunks/GroupBarChart-BSLOA0iQ.js.map +1 -0
  23. package/dist/chunks/GroupBarChart-lhrIpM1h.esm.js +86 -0
  24. package/dist/chunks/GroupBarChart-lhrIpM1h.esm.js.map +1 -0
  25. package/dist/chunks/SectionFlowEditor-D1v29JFf.esm.js +5479 -0
  26. package/dist/chunks/SectionFlowEditor-D1v29JFf.esm.js.map +1 -0
  27. package/dist/chunks/SectionFlowEditor-D58o14CY.js +5478 -0
  28. package/dist/chunks/SectionFlowEditor-D58o14CY.js.map +1 -0
  29. package/dist/chunks/action-bar-D4SYJgTT.js +660 -0
  30. package/dist/chunks/action-bar-D4SYJgTT.js.map +1 -0
  31. package/dist/chunks/action-bar-D4Siz93J.esm.js +661 -0
  32. package/dist/chunks/action-bar-D4Siz93J.esm.js.map +1 -0
  33. package/dist/chunks/actionCreator-0uQghTUt.esm.js +22 -0
  34. package/dist/chunks/actionCreator-0uQghTUt.esm.js.map +1 -0
  35. package/dist/chunks/actionCreator-BIur2_cF.esm.js +28 -0
  36. package/dist/chunks/actionCreator-BIur2_cF.esm.js.map +1 -0
  37. package/dist/chunks/actionCreator-BYzzSzcP.esm.js +14 -0
  38. package/dist/chunks/actionCreator-BYzzSzcP.esm.js.map +1 -0
  39. package/dist/chunks/actionCreator-Cddz6Hfa.js +27 -0
  40. package/dist/chunks/actionCreator-Cddz6Hfa.js.map +1 -0
  41. package/dist/chunks/actionCreator-D45ZRUYG.js +13 -0
  42. package/dist/chunks/actionCreator-D45ZRUYG.js.map +1 -0
  43. package/dist/chunks/actionCreator-DA134jFh.js +21 -0
  44. package/dist/chunks/actionCreator-DA134jFh.js.map +1 -0
  45. package/dist/chunks/actionCreator-DCvH3aya.esm.js +79 -0
  46. package/dist/chunks/actionCreator-DCvH3aya.esm.js.map +1 -0
  47. package/dist/chunks/actionCreator-P2el50Ij.js +93 -0
  48. package/dist/chunks/actionCreator-P2el50Ij.js.map +1 -0
  49. package/dist/chunks/actionCreator-Ux93gVSu.esm.js +94 -0
  50. package/dist/chunks/actionCreator-Ux93gVSu.esm.js.map +1 -0
  51. package/dist/chunks/actionCreator-tNh5lk4r.js +78 -0
  52. package/dist/chunks/actionCreator-tNh5lk4r.js.map +1 -0
  53. package/dist/chunks/activity-log-ByIo_G8q.esm.js +104 -0
  54. package/dist/chunks/activity-log-ByIo_G8q.esm.js.map +1 -0
  55. package/dist/chunks/activity-log-Cyne0qwm.js +103 -0
  56. package/dist/chunks/activity-log-Cyne0qwm.js.map +1 -0
  57. package/dist/chunks/add-template-BYyqpxVx.js +10 -0
  58. package/dist/chunks/add-template-BYyqpxVx.js.map +1 -0
  59. package/dist/chunks/add-template-D1Ro9dcG.esm.js +11 -0
  60. package/dist/chunks/add-template-D1Ro9dcG.esm.js.map +1 -0
  61. package/dist/chunks/address-modal-CfE5Ae8t.js +680 -0
  62. package/dist/chunks/address-modal-CfE5Ae8t.js.map +1 -0
  63. package/dist/chunks/address-modal-gRlouRj8.esm.js +664 -0
  64. package/dist/chunks/address-modal-gRlouRj8.esm.js.map +1 -0
  65. package/dist/chunks/ai-summary-BxB8Rnuk.js +350 -0
  66. package/dist/chunks/ai-summary-BxB8Rnuk.js.map +1 -0
  67. package/dist/chunks/ai-summary-CxAKUX2p.esm.js +351 -0
  68. package/dist/chunks/ai-summary-CxAKUX2p.esm.js.map +1 -0
  69. package/dist/chunks/api-DwmixHAO.js +5922 -0
  70. package/dist/chunks/api-DwmixHAO.js.map +1 -0
  71. package/dist/chunks/api-u1lKzJVv.esm.js +5923 -0
  72. package/dist/chunks/api-u1lKzJVv.esm.js.map +1 -0
  73. package/dist/chunks/appbar-B9EKR8QS.esm.js +57 -0
  74. package/dist/chunks/appbar-B9EKR8QS.esm.js.map +1 -0
  75. package/dist/chunks/appbar-Dt_exHJ3.js +56 -0
  76. package/dist/chunks/appbar-Dt_exHJ3.js.map +1 -0
  77. package/dist/chunks/approval-wrapper-C8iOUYeE.js +139 -0
  78. package/dist/chunks/approval-wrapper-C8iOUYeE.js.map +1 -0
  79. package/dist/chunks/approval-wrapper-OmXAoB9R.esm.js +140 -0
  80. package/dist/chunks/approval-wrapper-OmXAoB9R.esm.js.map +1 -0
  81. package/dist/chunks/areaLinerChart-BEiJvhIq.esm.js +104 -0
  82. package/dist/chunks/areaLinerChart-BEiJvhIq.esm.js.map +1 -0
  83. package/dist/chunks/areaLinerChart-DetB92LI.js +120 -0
  84. package/dist/chunks/areaLinerChart-DetB92LI.js.map +1 -0
  85. package/dist/chunks/bar-chart-BjAvgQJP.esm.js +87 -0
  86. package/dist/chunks/bar-chart-BjAvgQJP.esm.js.map +1 -0
  87. package/dist/chunks/bar-chart-HkOgepOg.js +103 -0
  88. package/dist/chunks/bar-chart-HkOgepOg.js.map +1 -0
  89. package/dist/chunks/barChart-B-WO75Ok.js +160 -0
  90. package/dist/chunks/barChart-B-WO75Ok.js.map +1 -0
  91. package/dist/chunks/barChart-BLhVsRwm.esm.js +144 -0
  92. package/dist/chunks/barChart-BLhVsRwm.esm.js.map +1 -0
  93. package/dist/chunks/barLinechart-D3G4VUJZ.esm.js +180 -0
  94. package/dist/chunks/barLinechart-D3G4VUJZ.esm.js.map +1 -0
  95. package/dist/chunks/barLinechart-DEfYJvJj.js +196 -0
  96. package/dist/chunks/barLinechart-DEfYJvJj.js.map +1 -0
  97. package/dist/chunks/calculation-summary-GdbtqnzK.esm.js +193 -0
  98. package/dist/chunks/calculation-summary-GdbtqnzK.esm.js.map +1 -0
  99. package/dist/chunks/calculation-summary-IGoIPXGL.js +192 -0
  100. package/dist/chunks/calculation-summary-IGoIPXGL.js.map +1 -0
  101. package/dist/chunks/chat-bot-BIXoGUj-.js +3609 -0
  102. package/dist/chunks/chat-bot-BIXoGUj-.js.map +1 -0
  103. package/dist/chunks/chat-bot-DURQfOqY.esm.js +3610 -0
  104. package/dist/chunks/chat-bot-DURQfOqY.esm.js.map +1 -0
  105. package/dist/chunks/common-utility-BLazlXzI.js +300 -0
  106. package/dist/chunks/common-utility-BLazlXzI.js.map +1 -0
  107. package/dist/chunks/common-utility-BQcU3rOh.esm.js +301 -0
  108. package/dist/chunks/common-utility-BQcU3rOh.esm.js.map +1 -0
  109. package/dist/chunks/custom-date-picker-BCcOhhvL.js +55 -0
  110. package/dist/chunks/custom-date-picker-BCcOhhvL.js.map +1 -0
  111. package/dist/chunks/custom-date-picker-qIdI_Mxe.esm.js +56 -0
  112. package/dist/chunks/custom-date-picker-qIdI_Mxe.esm.js.map +1 -0
  113. package/dist/chunks/custom-editor-CPTkZWIZ.js +1257 -0
  114. package/dist/chunks/custom-editor-CPTkZWIZ.js.map +1 -0
  115. package/dist/chunks/custom-editor-De9IWFLM.esm.js +1257 -0
  116. package/dist/chunks/custom-editor-De9IWFLM.esm.js.map +1 -0
  117. package/dist/chunks/custom-form-BoIrVoZW.esm.js +1146 -0
  118. package/dist/chunks/custom-form-BoIrVoZW.esm.js.map +1 -0
  119. package/dist/chunks/custom-form-DgnkFIZM.js +1145 -0
  120. package/dist/chunks/custom-form-DgnkFIZM.js.map +1 -0
  121. package/dist/chunks/custom-grid-card-DWv2PDQb.esm.js +128 -0
  122. package/dist/chunks/custom-grid-card-DWv2PDQb.esm.js.map +1 -0
  123. package/dist/chunks/custom-grid-card-H63FyqOk.js +127 -0
  124. package/dist/chunks/custom-grid-card-H63FyqOk.js.map +1 -0
  125. package/dist/chunks/dashboard-CVAH7i-8.esm.js +75 -0
  126. package/dist/chunks/dashboard-CVAH7i-8.esm.js.map +1 -0
  127. package/dist/chunks/dashboard-Drpz8zP5.js +74 -0
  128. package/dist/chunks/dashboard-Drpz8zP5.js.map +1 -0
  129. package/dist/chunks/date-BN5rVQeb.js +55 -0
  130. package/dist/chunks/date-BN5rVQeb.js.map +1 -0
  131. package/dist/chunks/date-CZNWJ8r7.esm.js +56 -0
  132. package/dist/chunks/date-CZNWJ8r7.esm.js.map +1 -0
  133. package/dist/chunks/date-format-settings-DohP3zvG.esm.js +117 -0
  134. package/dist/chunks/date-format-settings-DohP3zvG.esm.js.map +1 -0
  135. package/dist/chunks/date-format-settings-QiQTyiTn.js +116 -0
  136. package/dist/chunks/date-format-settings-QiQTyiTn.js.map +1 -0
  137. package/dist/chunks/date-picker-BAf8u-E9.esm.js +129 -0
  138. package/dist/chunks/date-picker-BAf8u-E9.esm.js.map +1 -0
  139. package/dist/chunks/date-picker-Dv_dfc9e.js +128 -0
  140. package/dist/chunks/date-picker-Dv_dfc9e.js.map +1 -0
  141. package/dist/chunks/date-range-picker-BHAVj3qf.js +62 -0
  142. package/dist/chunks/date-range-picker-BHAVj3qf.js.map +1 -0
  143. package/dist/chunks/date-range-picker-Ce01L3eF.esm.js +198 -0
  144. package/dist/chunks/date-range-picker-Ce01L3eF.esm.js.map +1 -0
  145. package/dist/chunks/date-range-picker-Dt6ODTKk.js +197 -0
  146. package/dist/chunks/date-range-picker-Dt6ODTKk.js.map +1 -0
  147. package/dist/chunks/date-range-picker-XrXYvhk6.esm.js +63 -0
  148. package/dist/chunks/date-range-picker-XrXYvhk6.esm.js.map +1 -0
  149. package/dist/chunks/date-time-Cscyu2JC.esm.js +55 -0
  150. package/dist/chunks/date-time-Cscyu2JC.esm.js.map +1 -0
  151. package/dist/chunks/date-time-DnEKq5ca.js +54 -0
  152. package/dist/chunks/date-time-DnEKq5ca.js.map +1 -0
  153. package/dist/chunks/date-time-picker-DOjxcYjT.js +115 -0
  154. package/dist/chunks/date-time-picker-DOjxcYjT.js.map +1 -0
  155. package/dist/chunks/date-time-picker-Dcs1e1Bc.esm.js +116 -0
  156. package/dist/chunks/date-time-picker-Dcs1e1Bc.esm.js.map +1 -0
  157. package/dist/chunks/dateFormat-BU9us1HO.esm.js +58 -0
  158. package/dist/chunks/dateFormat-BU9us1HO.esm.js.map +1 -0
  159. package/dist/chunks/dateFormat-MGjtBNwQ.js +57 -0
  160. package/dist/chunks/dateFormat-MGjtBNwQ.js.map +1 -0
  161. package/dist/chunks/discount-summary-C2L7GwJ5.esm.js +60 -0
  162. package/dist/chunks/discount-summary-C2L7GwJ5.esm.js.map +1 -0
  163. package/dist/chunks/discount-summary-CdrsdFbM.js +59 -0
  164. package/dist/chunks/discount-summary-CdrsdFbM.js.map +1 -0
  165. package/dist/chunks/dynamic-report-Bq614rL9.esm.js +589 -0
  166. package/dist/chunks/dynamic-report-Bq614rL9.esm.js.map +1 -0
  167. package/dist/chunks/dynamic-report-Dc2pd29H.js +588 -0
  168. package/dist/chunks/dynamic-report-Dc2pd29H.js.map +1 -0
  169. package/dist/chunks/dynamic-rows-BMj3evxl.js +249 -0
  170. package/dist/chunks/dynamic-rows-BMj3evxl.js.map +1 -0
  171. package/dist/chunks/dynamic-rows-Bi_L6K1Q.esm.js +250 -0
  172. package/dist/chunks/dynamic-rows-Bi_L6K1Q.esm.js.map +1 -0
  173. package/dist/chunks/dynamic-text-editor-BzyWihOp.js +44 -0
  174. package/dist/chunks/dynamic-text-editor-BzyWihOp.js.map +1 -0
  175. package/dist/chunks/dynamic-text-editor-FtzncH90.esm.js +45 -0
  176. package/dist/chunks/dynamic-text-editor-FtzncH90.esm.js.map +1 -0
  177. package/dist/chunks/edit-section-modal-By1pY8Kd.js +76 -0
  178. package/dist/chunks/edit-section-modal-By1pY8Kd.js.map +1 -0
  179. package/dist/chunks/edit-section-modal-lx44BKxM.esm.js +77 -0
  180. package/dist/chunks/edit-section-modal-lx44BKxM.esm.js.map +1 -0
  181. package/dist/chunks/filter-3x9UWii1.js +414 -0
  182. package/dist/chunks/filter-3x9UWii1.js.map +1 -0
  183. package/dist/chunks/filter-BnSYAact.esm.js +415 -0
  184. package/dist/chunks/filter-BnSYAact.esm.js.map +1 -0
  185. package/dist/chunks/footer-BDXx5kJG.esm.js +64 -0
  186. package/dist/chunks/footer-BDXx5kJG.esm.js.map +1 -0
  187. package/dist/chunks/footer-CNUL1un1.js +63 -0
  188. package/dist/chunks/footer-CNUL1un1.js.map +1 -0
  189. package/dist/chunks/form-fields-D7-_tDuw.esm.js +355 -0
  190. package/dist/chunks/form-fields-D7-_tDuw.esm.js.map +1 -0
  191. package/dist/chunks/form-fields-DYqWfI4L.js +354 -0
  192. package/dist/chunks/form-fields-DYqWfI4L.js.map +1 -0
  193. package/dist/chunks/form-parser-DgKyP2XE.esm.js +591 -0
  194. package/dist/chunks/form-parser-DgKyP2XE.esm.js.map +1 -0
  195. package/dist/chunks/form-parser-r9UB3j_l.js +607 -0
  196. package/dist/chunks/form-parser-r9UB3j_l.js.map +1 -0
  197. package/dist/chunks/form-section-B0UL95xN.esm.js +476 -0
  198. package/dist/chunks/form-section-B0UL95xN.esm.js.map +1 -0
  199. package/dist/chunks/form-section-Ra3TDNTJ.js +475 -0
  200. package/dist/chunks/form-section-Ra3TDNTJ.js.map +1 -0
  201. package/dist/chunks/format-chart-value-EdWQQL_n.esm.js +37 -0
  202. package/dist/chunks/format-chart-value-EdWQQL_n.esm.js.map +1 -0
  203. package/dist/chunks/format-chart-value-liFH0bwI.js +53 -0
  204. package/dist/chunks/format-chart-value-liFH0bwI.js.map +1 -0
  205. package/dist/chunks/fullScreen-CIO00GJA.js +20 -0
  206. package/dist/chunks/fullScreen-CIO00GJA.js.map +1 -0
  207. package/dist/chunks/fullScreen-Cf1lZpPP.esm.js +21 -0
  208. package/dist/chunks/fullScreen-Cf1lZpPP.esm.js.map +1 -0
  209. package/dist/chunks/global-search-BsF1AKA-.js +149 -0
  210. package/dist/chunks/global-search-BsF1AKA-.js.map +1 -0
  211. package/dist/chunks/global-search-DyHFvWRQ.esm.js +150 -0
  212. package/dist/chunks/global-search-DyHFvWRQ.esm.js.map +1 -0
  213. package/dist/chunks/grid-view-5_HV93Hf.esm.js +52 -0
  214. package/dist/chunks/grid-view-5_HV93Hf.esm.js.map +1 -0
  215. package/dist/chunks/grid-view-D0q_qMd2.js +51 -0
  216. package/dist/chunks/grid-view-D0q_qMd2.js.map +1 -0
  217. package/dist/chunks/header-DAad5p_7.js +90 -0
  218. package/dist/chunks/header-DAad5p_7.js.map +1 -0
  219. package/dist/chunks/header-S5MMcx4g.esm.js +91 -0
  220. package/dist/chunks/header-S5MMcx4g.esm.js.map +1 -0
  221. package/dist/chunks/header-enhanced-BPJQGGo7.js +400 -0
  222. package/dist/chunks/header-enhanced-BPJQGGo7.js.map +1 -0
  223. package/dist/chunks/header-enhanced-BtUsM1g3.esm.js +401 -0
  224. package/dist/chunks/header-enhanced-BtUsM1g3.esm.js.map +1 -0
  225. package/dist/chunks/inline-edit-fields-BXrrK0UT.esm.js +324 -0
  226. package/dist/chunks/inline-edit-fields-BXrrK0UT.esm.js.map +1 -0
  227. package/dist/chunks/inline-edit-fields-DeS-sx9_.js +340 -0
  228. package/dist/chunks/inline-edit-fields-DeS-sx9_.js.map +1 -0
  229. package/dist/chunks/inventory-reports-title-bar-CFqheEGb.js +733 -0
  230. package/dist/chunks/inventory-reports-title-bar-CFqheEGb.js.map +1 -0
  231. package/dist/chunks/inventory-reports-title-bar-CuPn69g7.esm.js +734 -0
  232. package/dist/chunks/inventory-reports-title-bar-CuPn69g7.esm.js.map +1 -0
  233. package/dist/chunks/item-response-details-BkE8ExKF.js +78 -0
  234. package/dist/chunks/item-response-details-BkE8ExKF.js.map +1 -0
  235. package/dist/chunks/item-response-details-FLk2xeBs.esm.js +79 -0
  236. package/dist/chunks/item-response-details-FLk2xeBs.esm.js.map +1 -0
  237. package/dist/chunks/listing-BlTk1lk7.js +275 -0
  238. package/dist/chunks/listing-BlTk1lk7.js.map +1 -0
  239. package/dist/chunks/listing-CBjRBr5T.esm.js +276 -0
  240. package/dist/chunks/listing-CBjRBr5T.esm.js.map +1 -0
  241. package/dist/chunks/location-select-BfXoscUj.esm.js +86 -0
  242. package/dist/chunks/location-select-BfXoscUj.esm.js.map +1 -0
  243. package/dist/chunks/location-select-C4r-bjZM.js +85 -0
  244. package/dist/chunks/location-select-C4r-bjZM.js.map +1 -0
  245. package/dist/chunks/material-editable-table-CUi1XChG.esm.js +1469 -0
  246. package/dist/chunks/material-editable-table-CUi1XChG.esm.js.map +1 -0
  247. package/dist/chunks/material-editable-table-DvOXRsag.js +1485 -0
  248. package/dist/chunks/material-editable-table-DvOXRsag.js.map +1 -0
  249. package/dist/chunks/module-reducer-1oIfrGzZ.js +91 -0
  250. package/dist/chunks/module-reducer-1oIfrGzZ.js.map +1 -0
  251. package/dist/chunks/module-reducer-Brv5y-yX.esm.js +92 -0
  252. package/dist/chunks/module-reducer-Brv5y-yX.esm.js.map +1 -0
  253. package/dist/chunks/multi-line-chart-CrQ7Hgm6.esm.js +96 -0
  254. package/dist/chunks/multi-line-chart-CrQ7Hgm6.esm.js.map +1 -0
  255. package/dist/chunks/multi-line-chart-DR6mEZ86.js +112 -0
  256. package/dist/chunks/multi-line-chart-DR6mEZ86.js.map +1 -0
  257. package/dist/chunks/notification-menu-B6DQbph4.js +600 -0
  258. package/dist/chunks/notification-menu-B6DQbph4.js.map +1 -0
  259. package/dist/chunks/notification-menu-BBEzqTvl.esm.js +601 -0
  260. package/dist/chunks/notification-menu-BBEzqTvl.esm.js.map +1 -0
  261. package/dist/chunks/page-action-BmdnKUie.js +324 -0
  262. package/dist/chunks/page-action-BmdnKUie.js.map +1 -0
  263. package/dist/chunks/page-action-DGnAycU4.esm.js +325 -0
  264. package/dist/chunks/page-action-DGnAycU4.esm.js.map +1 -0
  265. package/dist/chunks/page-navigator-BnJz0dir.esm.js +243 -0
  266. package/dist/chunks/page-navigator-BnJz0dir.esm.js.map +1 -0
  267. package/dist/chunks/page-navigator-qI4ptpIo.js +242 -0
  268. package/dist/chunks/page-navigator-qI4ptpIo.js.map +1 -0
  269. package/dist/chunks/page-view-BzUYT4aO.esm.js +324 -0
  270. package/dist/chunks/page-view-BzUYT4aO.esm.js.map +1 -0
  271. package/dist/chunks/page-view-CgKAg8Fs.js +323 -0
  272. package/dist/chunks/page-view-CgKAg8Fs.js.map +1 -0
  273. package/dist/chunks/quick-approval-modal--Uat95AK.js +272 -0
  274. package/dist/chunks/quick-approval-modal--Uat95AK.js.map +1 -0
  275. package/dist/chunks/quick-approval-modal-Cf5zDkO6.esm.js +256 -0
  276. package/dist/chunks/quick-approval-modal-Cf5zDkO6.esm.js.map +1 -0
  277. package/dist/chunks/reducer-5KSgWLUj.js +49 -0
  278. package/dist/chunks/reducer-5KSgWLUj.js.map +1 -0
  279. package/dist/chunks/reducer-BVEMC024.esm.js +33 -0
  280. package/dist/chunks/reducer-BVEMC024.esm.js.map +1 -0
  281. package/dist/chunks/reducer-Ba-Uxr0O.js +42 -0
  282. package/dist/chunks/reducer-Ba-Uxr0O.js.map +1 -0
  283. package/dist/chunks/reducer-C3gV86mN.esm.js +56 -0
  284. package/dist/chunks/reducer-C3gV86mN.esm.js.map +1 -0
  285. package/dist/chunks/reducer-C_1a_Ybe.js +32 -0
  286. package/dist/chunks/reducer-C_1a_Ybe.js.map +1 -0
  287. package/dist/chunks/reducer-DXCv8Ljo.esm.js +43 -0
  288. package/dist/chunks/reducer-DXCv8Ljo.esm.js.map +1 -0
  289. package/dist/chunks/reducer-DklAfYwo.js +55 -0
  290. package/dist/chunks/reducer-DklAfYwo.js.map +1 -0
  291. package/dist/chunks/reducer-DujEnCl-.js +147 -0
  292. package/dist/chunks/reducer-DujEnCl-.js.map +1 -0
  293. package/dist/chunks/reducer-PeqRGVlz.esm.js +148 -0
  294. package/dist/chunks/reducer-PeqRGVlz.esm.js.map +1 -0
  295. package/dist/chunks/reducer-e3sR-XbO.esm.js +50 -0
  296. package/dist/chunks/reducer-e3sR-XbO.esm.js.map +1 -0
  297. package/dist/chunks/reportFilter-DoD3vUsz.esm.js +396 -0
  298. package/dist/chunks/reportFilter-DoD3vUsz.esm.js.map +1 -0
  299. package/dist/chunks/reportFilter-DzgDlbu8.js +395 -0
  300. package/dist/chunks/reportFilter-DzgDlbu8.js.map +1 -0
  301. package/dist/chunks/reports-title-bar-BpeDKpyV.js +1027 -0
  302. package/dist/chunks/reports-title-bar-BpeDKpyV.js.map +1 -0
  303. package/dist/chunks/reports-title-bar-Bt9ogCT7.esm.js +1028 -0
  304. package/dist/chunks/reports-title-bar-Bt9ogCT7.esm.js.map +1 -0
  305. package/dist/chunks/route-page-map-LXxD_klV.js +8054 -0
  306. package/dist/chunks/route-page-map-LXxD_klV.js.map +1 -0
  307. package/dist/chunks/route-page-map-j4V1FsT3.esm.js +8055 -0
  308. package/dist/chunks/route-page-map-j4V1FsT3.esm.js.map +1 -0
  309. package/dist/chunks/routes-7yLS4Qxk.js +46 -0
  310. package/dist/chunks/routes-7yLS4Qxk.js.map +1 -0
  311. package/dist/chunks/routes-BE9OtJcV.esm.js +47 -0
  312. package/dist/chunks/routes-BE9OtJcV.esm.js.map +1 -0
  313. package/dist/chunks/schedule-report-B4hM1BQS.esm.js +236 -0
  314. package/dist/chunks/schedule-report-B4hM1BQS.esm.js.map +1 -0
  315. package/dist/chunks/schedule-report-D5Gtf9VF.js +235 -0
  316. package/dist/chunks/schedule-report-D5Gtf9VF.js.map +1 -0
  317. package/dist/chunks/schedule-report-modal-CFAdRSIO.esm.js +288 -0
  318. package/dist/chunks/schedule-report-modal-CFAdRSIO.esm.js.map +1 -0
  319. package/dist/chunks/schedule-report-modal-DDsrLqOm.js +287 -0
  320. package/dist/chunks/schedule-report-modal-DDsrLqOm.js.map +1 -0
  321. package/dist/chunks/searchable-select-5i6MO2Ys.esm.js +5431 -0
  322. package/dist/chunks/searchable-select-5i6MO2Ys.esm.js.map +1 -0
  323. package/dist/chunks/searchable-select-BsG-QlJk.js +5447 -0
  324. package/dist/chunks/searchable-select-BsG-QlJk.js.map +1 -0
  325. package/dist/chunks/share-modal-Bpa_0udn.esm.js +218 -0
  326. package/dist/chunks/share-modal-Bpa_0udn.esm.js.map +1 -0
  327. package/dist/chunks/share-modal-CaYg96t_.js +217 -0
  328. package/dist/chunks/share-modal-CaYg96t_.js.map +1 -0
  329. package/dist/chunks/share-modal-enhanced-B7JfgceP.esm.js +270 -0
  330. package/dist/chunks/share-modal-enhanced-B7JfgceP.esm.js.map +1 -0
  331. package/dist/chunks/share-modal-enhanced-BguLEFga.js +269 -0
  332. package/dist/chunks/share-modal-enhanced-BguLEFga.js.map +1 -0
  333. package/dist/chunks/sidebarScreen-DgpLalyG.js +200 -0
  334. package/dist/chunks/sidebarScreen-DgpLalyG.js.map +1 -0
  335. package/dist/chunks/sidebarScreen-Dp1e8Luz.esm.js +201 -0
  336. package/dist/chunks/sidebarScreen-Dp1e8Luz.esm.js.map +1 -0
  337. package/dist/chunks/store-CuKFQXI5.js +88 -0
  338. package/dist/chunks/store-CuKFQXI5.js.map +1 -0
  339. package/dist/chunks/store-KAx-wGcm.esm.js +89 -0
  340. package/dist/chunks/store-KAx-wGcm.esm.js.map +1 -0
  341. package/dist/chunks/table-CbV-bnb7.js +184 -0
  342. package/dist/chunks/table-CbV-bnb7.js.map +1 -0
  343. package/dist/chunks/table-Cdo7w_gv.esm.js +185 -0
  344. package/dist/chunks/table-Cdo7w_gv.esm.js.map +1 -0
  345. package/dist/chunks/table-form-CsxWI8HQ.esm.js +1537 -0
  346. package/dist/chunks/table-form-CsxWI8HQ.esm.js.map +1 -0
  347. package/dist/chunks/table-form-Dd2DNL6w.js +1536 -0
  348. package/dist/chunks/table-form-Dd2DNL6w.js.map +1 -0
  349. package/dist/chunks/template-editor-router-3FVvWm8W.js +8 -0
  350. package/dist/chunks/template-editor-router-3FVvWm8W.js.map +1 -0
  351. package/dist/chunks/template-editor-router-D0yZgK0u.esm.js +9 -0
  352. package/dist/chunks/template-editor-router-D0yZgK0u.esm.js.map +1 -0
  353. package/dist/chunks/template-modal-BHZbvEx9.esm.js +769 -0
  354. package/dist/chunks/template-modal-BHZbvEx9.esm.js.map +1 -0
  355. package/dist/chunks/template-modal-BuKxVaFw.js +768 -0
  356. package/dist/chunks/template-modal-BuKxVaFw.js.map +1 -0
  357. package/dist/chunks/templates-B_y-ywXc.esm.js +279 -0
  358. package/dist/chunks/templates-B_y-ywXc.esm.js.map +1 -0
  359. package/dist/chunks/templates-CtBwZgn9.js +278 -0
  360. package/dist/chunks/templates-CtBwZgn9.js.map +1 -0
  361. package/dist/chunks/text-measurement-BcBEexWP.js +251 -0
  362. package/dist/chunks/text-measurement-BcBEexWP.js.map +1 -0
  363. package/dist/chunks/text-measurement-w3Vk7SeS.esm.js +252 -0
  364. package/dist/chunks/text-measurement-w3Vk7SeS.esm.js.map +1 -0
  365. package/dist/chunks/total-summary-DPOMR8e4.esm.js +41 -0
  366. package/dist/chunks/total-summary-DPOMR8e4.esm.js.map +1 -0
  367. package/dist/chunks/total-summary-erUelIxr.js +40 -0
  368. package/dist/chunks/total-summary-erUelIxr.js.map +1 -0
  369. package/dist/chunks/translations-BnLuKxeJ.js +58 -0
  370. package/dist/chunks/translations-BnLuKxeJ.js.map +1 -0
  371. package/dist/chunks/translations-DQJAYm2A.esm.js +59 -0
  372. package/dist/chunks/translations-DQJAYm2A.esm.js.map +1 -0
  373. package/dist/chunks/uom-field-wrapper-BlwUeXmo.js +79 -0
  374. package/dist/chunks/uom-field-wrapper-BlwUeXmo.js.map +1 -0
  375. package/dist/chunks/uom-field-wrapper-D2QSsD7M.esm.js +80 -0
  376. package/dist/chunks/uom-field-wrapper-D2QSsD7M.esm.js.map +1 -0
  377. package/dist/chunks/upload-excel-DF6rPBeA.esm.js +361 -0
  378. package/dist/chunks/upload-excel-DF6rPBeA.esm.js.map +1 -0
  379. package/dist/chunks/upload-excel-vbTf63qn.js +360 -0
  380. package/dist/chunks/upload-excel-vbTf63qn.js.map +1 -0
  381. package/dist/chunks/use-translations-C_AFtNWf.esm.js +62 -0
  382. package/dist/chunks/use-translations-C_AFtNWf.esm.js.map +1 -0
  383. package/dist/chunks/use-translations-Dnm_y9o4.js +61 -0
  384. package/dist/chunks/use-translations-Dnm_y9o4.js.map +1 -0
  385. package/dist/chunks/useAccountSetting-BimM7OxP.js +172 -0
  386. package/dist/chunks/useAccountSetting-BimM7OxP.js.map +1 -0
  387. package/dist/chunks/useAccountSetting-BsIE2d1l.esm.js +173 -0
  388. package/dist/chunks/useAccountSetting-BsIE2d1l.esm.js.map +1 -0
  389. package/dist/chunks/useCheckSkuAndName-C0twPQja.esm.js +50 -0
  390. package/dist/chunks/useCheckSkuAndName-C0twPQja.esm.js.map +1 -0
  391. package/dist/chunks/useCheckSkuAndName-CQq8Le-_.js +49 -0
  392. package/dist/chunks/useCheckSkuAndName-CQq8Le-_.js.map +1 -0
  393. package/dist/chunks/useReduxIntegration-B5GrPUbT.js +38 -0
  394. package/dist/chunks/useReduxIntegration-B5GrPUbT.js.map +1 -0
  395. package/dist/chunks/useReduxIntegration-DzhcP34r.esm.js +39 -0
  396. package/dist/chunks/useReduxIntegration-DzhcP34r.esm.js.map +1 -0
  397. package/dist/chunks/useUniquenessCheck-BIT9TNYY.esm.js +39 -0
  398. package/dist/chunks/useUniquenessCheck-BIT9TNYY.esm.js.map +1 -0
  399. package/dist/chunks/useUniquenessCheck-VBBQqtYP.js +38 -0
  400. package/dist/chunks/useUniquenessCheck-VBBQqtYP.js.map +1 -0
  401. package/dist/chunks/useVendorAICompare-Bu4fjpby.esm.js +31 -0
  402. package/dist/chunks/useVendorAICompare-Bu4fjpby.esm.js.map +1 -0
  403. package/dist/chunks/useVendorAICompare-Cad1SOQx.js +30 -0
  404. package/dist/chunks/useVendorAICompare-Cad1SOQx.js.map +1 -0
  405. package/dist/chunks/value-editor-CtppXtUW.js +266 -0
  406. package/dist/chunks/value-editor-CtppXtUW.js.map +1 -0
  407. package/dist/chunks/value-editor-xwtdV2gn.esm.js +267 -0
  408. package/dist/chunks/value-editor-xwtdV2gn.esm.js.map +1 -0
  409. package/dist/chunks/vendor-ai-summary-Cf8yBCJC.js +227 -0
  410. package/dist/chunks/vendor-ai-summary-Cf8yBCJC.js.map +1 -0
  411. package/dist/chunks/vendor-ai-summary-w6_aC72U.esm.js +228 -0
  412. package/dist/chunks/vendor-ai-summary-w6_aC72U.esm.js.map +1 -0
  413. package/dist/components/action-bar/action-bar/index.esm.js +1 -1
  414. package/dist/components/action-bar/action-bar/index.js +1 -1
  415. package/dist/components/action-bar/index.esm.js +1 -1
  416. package/dist/components/action-bar/index.js +1 -1
  417. package/dist/components/activityLog/activity-log/index.esm.js +1 -1
  418. package/dist/components/activityLog/activity-log/index.js +1 -1
  419. package/dist/components/activityLog/index.esm.js +1 -1
  420. package/dist/components/activityLog/index.js +1 -1
  421. package/dist/components/address-modal/index.esm.js +1 -1
  422. package/dist/components/address-modal/index.js +1 -1
  423. package/dist/components/ai-summary/ai-summary/index.esm.js +1 -1
  424. package/dist/components/ai-summary/ai-summary/index.js +1 -1
  425. package/dist/components/ai-summary/index.esm.js +1 -1
  426. package/dist/components/ai-summary/index.js +1 -1
  427. package/dist/components/appbar/appbar/index.esm.js +1 -1
  428. package/dist/components/appbar/appbar/index.js +1 -1
  429. package/dist/components/appbar/index.esm.js +1 -1
  430. package/dist/components/appbar/index.js +1 -1
  431. package/dist/components/approval-wrapper/approval-wrapper/index.esm.js +1 -1
  432. package/dist/components/approval-wrapper/approval-wrapper/index.js +1 -1
  433. package/dist/components/approval-wrapper/index.esm.js +1 -1
  434. package/dist/components/approval-wrapper/index.js +1 -1
  435. package/dist/components/calculation-summary/calculation-summary/index.esm.js +1 -1
  436. package/dist/components/calculation-summary/calculation-summary/index.js +1 -1
  437. package/dist/components/calculation-summary/components/discount-summary/index.esm.js +1 -1
  438. package/dist/components/calculation-summary/components/discount-summary/index.js +1 -1
  439. package/dist/components/calculation-summary/components/index.esm.js +2 -2
  440. package/dist/components/calculation-summary/components/index.js +2 -2
  441. package/dist/components/calculation-summary/components/total-summary/index.esm.js +1 -1
  442. package/dist/components/calculation-summary/components/total-summary/index.js +1 -1
  443. package/dist/components/calculation-summary/index.esm.js +3 -3
  444. package/dist/components/calculation-summary/index.js +3 -3
  445. package/dist/components/charts/areaLinerChart/index.esm.js +1 -1
  446. package/dist/components/charts/areaLinerChart/index.js +1 -1
  447. package/dist/components/charts/bar-chart/bar-chart/index.esm.js +1 -1
  448. package/dist/components/charts/bar-chart/bar-chart/index.js +1 -1
  449. package/dist/components/charts/bar-chart/index.esm.js +1 -1
  450. package/dist/components/charts/bar-chart/index.js +1 -1
  451. package/dist/components/charts/barChart/barChart/index.esm.js +1 -1
  452. package/dist/components/charts/barChart/barChart/index.js +1 -1
  453. package/dist/components/charts/barChart/index.esm.js +1 -1
  454. package/dist/components/charts/barChart/index.js +1 -1
  455. package/dist/components/charts/barLineChart/barLinechart/index.esm.js +1 -1
  456. package/dist/components/charts/barLineChart/barLinechart/index.js +1 -1
  457. package/dist/components/charts/barLineChart/index.esm.js +1 -1
  458. package/dist/components/charts/barLineChart/index.js +1 -1
  459. package/dist/components/charts/donutChart/DonutChart/index.esm.js +1 -1
  460. package/dist/components/charts/donutChart/DonutChart/index.js +1 -1
  461. package/dist/components/charts/donutChart/index.esm.js +1 -1
  462. package/dist/components/charts/donutChart/index.js +1 -1
  463. package/dist/components/charts/groupBarChart/GroupBarChart/index.esm.js +1 -1
  464. package/dist/components/charts/groupBarChart/GroupBarChart/index.js +1 -1
  465. package/dist/components/charts/groupBarChart/index.esm.js +1 -1
  466. package/dist/components/charts/groupBarChart/index.js +1 -1
  467. package/dist/components/charts/index.esm.js +7 -7
  468. package/dist/components/charts/index.js +7 -7
  469. package/dist/components/charts/multiLineChart/index.esm.js +1 -1
  470. package/dist/components/charts/multiLineChart/index.js +1 -1
  471. package/dist/components/charts/multiLineChart/multi-line-chart/index.esm.js +1 -1
  472. package/dist/components/charts/multiLineChart/multi-line-chart/index.js +1 -1
  473. package/dist/components/chat-bot/index.esm.js +2 -1
  474. package/dist/components/chat-bot/index.js +2 -1
  475. package/dist/components/chat-bot/index.js.map +1 -1
  476. package/dist/components/custom-forms/FORMS/index.esm.js +1 -1
  477. package/dist/components/custom-forms/FORMS/index.js +1 -1
  478. package/dist/components/custom-forms/grid-view/grid-view/index.esm.js +1 -1
  479. package/dist/components/custom-forms/grid-view/grid-view/index.js +1 -1
  480. package/dist/components/custom-forms/grid-view/index.esm.js +1 -1
  481. package/dist/components/custom-forms/grid-view/index.js +1 -1
  482. package/dist/components/custom-forms/index.esm.js +2 -2
  483. package/dist/components/custom-forms/index.js +2 -2
  484. package/dist/components/customer-ai-summary/index.esm.js +1 -1
  485. package/dist/components/customer-ai-summary/index.js +1 -1
  486. package/dist/components/date-picker/date-picker/index.esm.js +1 -1
  487. package/dist/components/date-picker/date-picker/index.js +1 -1
  488. package/dist/components/date-picker/index.esm.js +2 -2
  489. package/dist/components/date-picker/index.js +2 -2
  490. package/dist/components/date-range-picker/date-range-picker/index.esm.js +1 -1
  491. package/dist/components/date-range-picker/date-range-picker/index.js +1 -1
  492. package/dist/components/date-range-picker/index.esm.js +2 -2
  493. package/dist/components/date-range-picker/index.js +2 -2
  494. package/dist/components/date-time-picker/date-time-picker/index.esm.js +1 -1
  495. package/dist/components/date-time-picker/date-time-picker/index.js +1 -1
  496. package/dist/components/date-time-picker/index.esm.js +2 -2
  497. package/dist/components/date-time-picker/index.js +2 -2
  498. package/dist/components/department-add-modal/index.esm.js +1 -1
  499. package/dist/components/department-add-modal/index.js +1 -1
  500. package/dist/components/designation-add-modal/index.esm.js +1 -1
  501. package/dist/components/designation-add-modal/index.js +1 -1
  502. package/dist/components/editor/custom-editor/index.esm.js +1 -1
  503. package/dist/components/editor/custom-editor/index.js +1 -1
  504. package/dist/components/editor/index.esm.js +1 -1
  505. package/dist/components/editor/index.js +1 -1
  506. package/dist/components/examples/FlexibleReduxExample/index.esm.js +1 -1
  507. package/dist/components/examples/FlexibleReduxExample/index.js +1 -1
  508. package/dist/components/examples/index.esm.js +1 -1
  509. package/dist/components/examples/index.js +1 -1
  510. package/dist/components/filter/components/index.esm.js +1 -1
  511. package/dist/components/filter/components/index.js +1 -1
  512. package/dist/components/filter/components/value-editor/index.esm.js +1 -1
  513. package/dist/components/filter/components/value-editor/index.js +1 -1
  514. package/dist/components/filter/filter/index.esm.js +1 -1
  515. package/dist/components/filter/filter/index.js +1 -1
  516. package/dist/components/filter/index.esm.js +2 -2
  517. package/dist/components/filter/index.js +2 -2
  518. package/dist/components/footer/footer/index.esm.js +1 -1
  519. package/dist/components/footer/footer/index.js +1 -1
  520. package/dist/components/footer/index.esm.js +1 -1
  521. package/dist/components/footer/index.js +1 -1
  522. package/dist/components/form-control/form-builder/form-builder-element/custom-date-picker/index.esm.js +1 -1
  523. package/dist/components/form-control/form-builder/form-builder-element/custom-date-picker/index.js +1 -1
  524. package/dist/components/form-control/form-builder/form-builder-element/date/index.esm.js +1 -1
  525. package/dist/components/form-control/form-builder/form-builder-element/date/index.js +1 -1
  526. package/dist/components/form-control/form-builder/form-builder-element/date-range-picker/index.esm.js +1 -1
  527. package/dist/components/form-control/form-builder/form-builder-element/date-range-picker/index.js +1 -1
  528. package/dist/components/form-control/form-builder/form-builder-element/date-time/index.esm.js +1 -1
  529. package/dist/components/form-control/form-builder/form-builder-element/date-time/index.js +1 -1
  530. package/dist/components/form-control/form-builder/form-builder-element/dynamic-dependent-field/index.esm.js +1 -1
  531. package/dist/components/form-control/form-builder/form-builder-element/dynamic-dependent-field/index.js +1 -1
  532. package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.esm.js +1 -1
  533. package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js +1 -1
  534. package/dist/components/form-control/form-builder/form-builder-element/dynamic-text-editor/index.esm.js +1 -1
  535. package/dist/components/form-control/form-builder/form-builder-element/dynamic-text-editor/index.js +1 -1
  536. package/dist/components/form-control/form-builder/form-builder-element/fixed-asset-item-add-modal/index.esm.js +1 -1
  537. package/dist/components/form-control/form-builder/form-builder-element/fixed-asset-item-add-modal/index.js +1 -1
  538. package/dist/components/form-control/form-builder/form-builder-element/index.esm.js +8 -8
  539. package/dist/components/form-control/form-builder/form-builder-element/index.js +8 -8
  540. package/dist/components/form-control/form-builder/form-builder-element/location-add-modal/index.esm.js +1 -1
  541. package/dist/components/form-control/form-builder/form-builder-element/location-add-modal/index.js +1 -1
  542. package/dist/components/form-control/form-builder/form-builder-element/select-configuration/index.esm.js +1 -1
  543. package/dist/components/form-control/form-builder/form-builder-element/select-configuration/index.js +1 -1
  544. package/dist/components/form-control/form-builder/form-builder-element/table/index.esm.js +1 -1
  545. package/dist/components/form-control/form-builder/form-builder-element/table/index.js +1 -1
  546. package/dist/components/form-control/form-builder/index.esm.js +8 -8
  547. package/dist/components/form-control/form-builder/index.js +8 -8
  548. package/dist/components/form-control/form-parser/form-parser/index.esm.js +1 -1
  549. package/dist/components/form-control/form-parser/form-parser/index.js +1 -1
  550. package/dist/components/form-control/form-parser/form-section/index.esm.js +1 -1
  551. package/dist/components/form-control/form-parser/form-section/index.js +1 -1
  552. package/dist/components/form-control/form-parser/index.esm.js +2 -2
  553. package/dist/components/form-control/form-parser/index.js +2 -2
  554. package/dist/components/form-control/index.esm.js +10 -10
  555. package/dist/components/form-control/index.js +10 -10
  556. package/dist/components/grid/custom-grid-card/custom-grid-card/index.esm.js +1 -1
  557. package/dist/components/grid/custom-grid-card/custom-grid-card/index.js +1 -1
  558. package/dist/components/grid/custom-grid-card/index.esm.js +1 -1
  559. package/dist/components/grid/custom-grid-card/index.js +1 -1
  560. package/dist/components/grid/index.esm.js +1 -1
  561. package/dist/components/grid/index.js +1 -1
  562. package/dist/components/header/components/global-search/index.esm.js +1 -1
  563. package/dist/components/header/components/global-search/index.js +1 -1
  564. package/dist/components/header/components/index.esm.js +1 -1
  565. package/dist/components/header/components/index.js +1 -1
  566. package/dist/components/header/components/notification-menu/index.esm.js +1 -1
  567. package/dist/components/header/components/notification-menu/index.js +1 -1
  568. package/dist/components/header/components/notification-menu/notification-menu/index.esm.js +1 -1
  569. package/dist/components/header/components/notification-menu/notification-menu/index.js +1 -1
  570. package/dist/components/header/header/index.esm.js +1 -1
  571. package/dist/components/header/header/index.js +1 -1
  572. package/dist/components/header/header-enhanced/index.esm.js +1 -1
  573. package/dist/components/header/header-enhanced/index.js +1 -1
  574. package/dist/components/header/index.esm.js +5 -5
  575. package/dist/components/header/index.js +5 -5
  576. package/dist/components/header/redux/actionCreator/index.esm.js +1 -1
  577. package/dist/components/header/redux/actionCreator/index.js +1 -1
  578. package/dist/components/header/redux/index.esm.js +2 -2
  579. package/dist/components/header/redux/index.js +2 -2
  580. package/dist/components/header/redux/reducer/index.esm.js +1 -1
  581. package/dist/components/header/redux/reducer/index.js +1 -1
  582. package/dist/components/index.esm.js +53 -53
  583. package/dist/components/index.js +53 -53
  584. package/dist/components/inventory-reports-title-bar/component/index.esm.js +1 -1
  585. package/dist/components/inventory-reports-title-bar/component/index.js +1 -1
  586. package/dist/components/inventory-reports-title-bar/component/reportFilter/index.esm.js +1 -1
  587. package/dist/components/inventory-reports-title-bar/component/reportFilter/index.js +1 -1
  588. package/dist/components/inventory-reports-title-bar/index.esm.js +4 -4
  589. package/dist/components/inventory-reports-title-bar/index.js +4 -4
  590. package/dist/components/inventory-reports-title-bar/inventory-reports-title-bar/index.esm.js +1 -1
  591. package/dist/components/inventory-reports-title-bar/inventory-reports-title-bar/index.js +1 -1
  592. package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.esm.js +1 -1
  593. package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.js +1 -1
  594. package/dist/components/inventory-reports-title-bar/redux/index.esm.js +2 -2
  595. package/dist/components/inventory-reports-title-bar/redux/index.js +2 -2
  596. package/dist/components/inventory-reports-title-bar/redux/reducer/index.esm.js +1 -1
  597. package/dist/components/inventory-reports-title-bar/redux/reducer/index.js +1 -1
  598. package/dist/components/listing/index.esm.js +1 -1
  599. package/dist/components/listing/index.js +1 -1
  600. package/dist/components/listing/listing/index.esm.js +1 -1
  601. package/dist/components/listing/listing/index.js +1 -1
  602. package/dist/components/location-select/index.esm.js +1 -1
  603. package/dist/components/location-select/index.js +1 -1
  604. package/dist/components/material-editable-table/components/index.esm.js +1 -1
  605. package/dist/components/material-editable-table/components/index.js +1 -1
  606. package/dist/components/material-editable-table/components/inline-edit-fields/index.esm.js +1 -1
  607. package/dist/components/material-editable-table/components/inline-edit-fields/index.js +1 -1
  608. package/dist/components/material-editable-table/index.esm.js +2 -2
  609. package/dist/components/material-editable-table/index.js +2 -2
  610. package/dist/components/material-editable-table/material-editable-table/index.esm.js +1 -1
  611. package/dist/components/material-editable-table/material-editable-table/index.js +1 -1
  612. package/dist/components/material-table/components/index.esm.js +1 -1
  613. package/dist/components/material-table/components/index.js +1 -1
  614. package/dist/components/material-table/components/inline-edit-fields/index.esm.js +1 -1
  615. package/dist/components/material-table/components/inline-edit-fields/index.js +1 -1
  616. package/dist/components/material-table/index.esm.js +1 -1
  617. package/dist/components/material-table/index.js +1 -1
  618. package/dist/components/material-table/material-table/index.esm.js +1 -1
  619. package/dist/components/material-table/material-table/index.js +1 -1
  620. package/dist/components/page-navigator/components/index.esm.js +1 -1
  621. package/dist/components/page-navigator/components/index.js +1 -1
  622. package/dist/components/page-navigator/components/page-action/index.esm.js +1 -1
  623. package/dist/components/page-navigator/components/page-action/index.js +1 -1
  624. package/dist/components/page-navigator/index.esm.js +2 -2
  625. package/dist/components/page-navigator/index.js +2 -2
  626. package/dist/components/page-navigator/page-navigator/index.esm.js +1 -1
  627. package/dist/components/page-navigator/page-navigator/index.js +1 -1
  628. package/dist/components/parties-modal/index.esm.js +1 -1
  629. package/dist/components/parties-modal/index.js +1 -1
  630. package/dist/components/parties-modal/parties-modal/index.esm.js +1 -1
  631. package/dist/components/parties-modal/parties-modal/index.js +1 -1
  632. package/dist/components/providers/ERPUIProvider/index.esm.js +1 -1
  633. package/dist/components/providers/ERPUIProvider/index.js +1 -1
  634. package/dist/components/providers/index.esm.js +1 -1
  635. package/dist/components/providers/index.js +1 -1
  636. package/dist/components/quick-approval-modal/index.esm.js +1 -1
  637. package/dist/components/quick-approval-modal/index.js +1 -1
  638. package/dist/components/quick-approval-modal/quick-approval-modal/index.esm.js +1 -1
  639. package/dist/components/quick-approval-modal/quick-approval-modal/index.js +1 -1
  640. package/dist/components/reports/dynamic-report/dynamic-report/index.esm.js +1 -1
  641. package/dist/components/reports/dynamic-report/dynamic-report/index.js +1 -1
  642. package/dist/components/reports/dynamic-report/dynamic-rows/index.esm.js +1 -1
  643. package/dist/components/reports/dynamic-report/dynamic-rows/index.js +1 -1
  644. package/dist/components/reports/dynamic-report/index.esm.js +2 -2
  645. package/dist/components/reports/dynamic-report/index.js +2 -2
  646. package/dist/components/reports/index.esm.js +2 -2
  647. package/dist/components/reports/index.js +2 -2
  648. package/dist/components/reports-title-bar/index.esm.js +3 -3
  649. package/dist/components/reports-title-bar/index.js +3 -3
  650. package/dist/components/reports-title-bar/redux/actionCreator/index.esm.js +1 -1
  651. package/dist/components/reports-title-bar/redux/actionCreator/index.js +1 -1
  652. package/dist/components/reports-title-bar/redux/index.esm.js +2 -2
  653. package/dist/components/reports-title-bar/redux/index.js +2 -2
  654. package/dist/components/reports-title-bar/redux/reducer/index.esm.js +1 -1
  655. package/dist/components/reports-title-bar/redux/reducer/index.js +1 -1
  656. package/dist/components/reports-title-bar/reports-title-bar/index.esm.js +1 -1
  657. package/dist/components/reports-title-bar/reports-title-bar/index.js +1 -1
  658. package/dist/components/rfq-response/index.esm.js +1 -1
  659. package/dist/components/rfq-response/index.js +1 -1
  660. package/dist/components/rfq-response/item-response-details/index.esm.js +1 -1
  661. package/dist/components/rfq-response/item-response-details/index.js +1 -1
  662. package/dist/components/schedule-report/index.esm.js +2 -2
  663. package/dist/components/schedule-report/index.js +2 -2
  664. package/dist/components/schedule-report/schedule-report/index.esm.js +1 -1
  665. package/dist/components/schedule-report/schedule-report/index.js +1 -1
  666. package/dist/components/schedule-report/schedule-report-modal/index.esm.js +1 -1
  667. package/dist/components/schedule-report/schedule-report-modal/index.js +1 -1
  668. package/dist/components/searchable-select/index.esm.js +1 -1
  669. package/dist/components/searchable-select/index.js +1 -1
  670. package/dist/components/share-modal/index.esm.js +4 -4
  671. package/dist/components/share-modal/index.js +4 -4
  672. package/dist/components/share-modal/redux/actionCreator/index.esm.js +1 -1
  673. package/dist/components/share-modal/redux/actionCreator/index.js +1 -1
  674. package/dist/components/share-modal/redux/index.esm.js +2 -2
  675. package/dist/components/share-modal/redux/index.js +2 -2
  676. package/dist/components/share-modal/redux/reducer/index.esm.js +1 -1
  677. package/dist/components/share-modal/redux/reducer/index.js +1 -1
  678. package/dist/components/share-modal/share-modal/index.esm.js +1 -1
  679. package/dist/components/share-modal/share-modal/index.js +1 -1
  680. package/dist/components/share-modal/share-modal-enhanced/index.esm.js +1 -1
  681. package/dist/components/share-modal/share-modal-enhanced/index.js +1 -1
  682. package/dist/components/team-add-modal/index.esm.js +1 -1
  683. package/dist/components/team-add-modal/index.js +1 -1
  684. package/dist/components/uom-field-wrapper/index.esm.js +1 -1
  685. package/dist/components/uom-field-wrapper/index.js +1 -1
  686. package/dist/components/uom-field-wrapper/uom-field-wrapper/index.esm.js +1 -1
  687. package/dist/components/uom-field-wrapper/uom-field-wrapper/index.js +1 -1
  688. package/dist/components/upload-excel/index.esm.js +1 -1
  689. package/dist/components/upload-excel/index.js +1 -1
  690. package/dist/components/upload-excel/upload-excel/index.esm.js +1 -1
  691. package/dist/components/upload-excel/upload-excel/index.js +1 -1
  692. package/dist/components/vendor-ai-summary/index.esm.js +1 -1
  693. package/dist/components/vendor-ai-summary/index.js +1 -1
  694. package/dist/constants/index.esm.js +1 -1
  695. package/dist/constants/index.js +1 -1
  696. package/dist/hooks/index.esm.js +6 -6
  697. package/dist/hooks/index.js +6 -6
  698. package/dist/hooks/use-translations/index.esm.js +1 -1
  699. package/dist/hooks/use-translations/index.js +1 -1
  700. package/dist/hooks/useAccountSetting/index.esm.js +1 -1
  701. package/dist/hooks/useAccountSetting/index.js +1 -1
  702. package/dist/hooks/useCheckSkuAndName/index.esm.js +1 -1
  703. package/dist/hooks/useCheckSkuAndName/index.js +1 -1
  704. package/dist/hooks/useReduxIntegration/index.esm.js +1 -1
  705. package/dist/hooks/useReduxIntegration/index.js +1 -1
  706. package/dist/hooks/useUniquenessCheck/index.esm.js +1 -1
  707. package/dist/hooks/useUniquenessCheck/index.js +1 -1
  708. package/dist/index.esm.js +137 -119
  709. package/dist/index.esm.js.map +1 -1
  710. package/dist/index.js +100 -82
  711. package/dist/index.js.map +1 -1
  712. package/dist/layout/fullScreen/index.esm.js +1 -1
  713. package/dist/layout/fullScreen/index.js +1 -1
  714. package/dist/layout/index.esm.js +2 -2
  715. package/dist/layout/index.js +2 -2
  716. package/dist/layout/sidebarScreen/index.esm.js +1 -1
  717. package/dist/layout/sidebarScreen/index.js +1 -1
  718. package/dist/redux/index.esm.js +3 -3
  719. package/dist/redux/index.js +3 -3
  720. package/dist/runtime/index.esm.js +6 -2
  721. package/dist/runtime/index.esm.js.map +1 -1
  722. package/dist/runtime/index.js +6 -2
  723. package/dist/runtime/index.js.map +1 -1
  724. package/dist/src/components/calculation-summary/components/discount-summary.d.ts +1 -0
  725. package/dist/src/components/calculation-summary/components/total-summary.d.ts +1 -0
  726. package/dist/src/components/chat-bot/chat-bot-input.d.ts +2 -1
  727. package/dist/src/components/chat-bot/constants.d.ts +1 -0
  728. package/dist/src/components/reports-title-bar/reports-title-bar.d.ts +5 -0
  729. package/dist/src/utils/date-format-settings.d.ts +60 -0
  730. package/dist/src/utils/dateFormat.d.ts +1 -0
  731. package/dist/style.css +28 -1
  732. package/dist/utils/api/index.esm.js +1 -1
  733. package/dist/utils/api/index.js +1 -1
  734. package/dist/utils/common/index.esm.js +1 -1
  735. package/dist/utils/common/index.js +1 -1
  736. package/dist/utils/common-utility/index.esm.js +1 -1
  737. package/dist/utils/common-utility/index.js +1 -1
  738. package/dist/utils/dateFormat/index.esm.js +20 -2
  739. package/dist/utils/dateFormat/index.esm.js.map +1 -1
  740. package/dist/utils/dateFormat/index.js +19 -1
  741. package/dist/utils/dateFormat/index.js.map +1 -1
  742. package/dist/utils/form-builder-deconversion/index.esm.js +10 -4
  743. package/dist/utils/form-builder-deconversion/index.esm.js.map +1 -1
  744. package/dist/utils/form-builder-deconversion/index.js +10 -4
  745. package/dist/utils/form-builder-deconversion/index.js.map +1 -1
  746. package/dist/utils/index.esm.js +28 -10
  747. package/dist/utils/index.esm.js.map +1 -1
  748. package/dist/utils/index.js +23 -5
  749. package/dist/utils/index.js.map +1 -1
  750. package/dist/utils/text-measurement/index.esm.js +1 -1
  751. package/dist/utils/text-measurement/index.js +1 -1
  752. package/dist/views/afterAuth/dashboard/index.esm.js +1 -1
  753. package/dist/views/afterAuth/dashboard/index.js +1 -1
  754. package/dist/views/afterAuth/index.esm.js +2 -2
  755. package/dist/views/afterAuth/index.js +2 -2
  756. package/dist/views/afterAuth/page-view/index.esm.js +1 -1
  757. package/dist/views/afterAuth/page-view/index.js +1 -1
  758. package/dist/views/form-builder/custom-form/index.esm.js +1 -1
  759. package/dist/views/form-builder/custom-form/index.js +1 -1
  760. package/dist/views/form-builder/element-edit-forms/index.esm.js +1 -1
  761. package/dist/views/form-builder/element-edit-forms/index.js +1 -1
  762. package/dist/views/form-builder/form-fields/index.esm.js +1 -1
  763. package/dist/views/form-builder/form-fields/index.js +1 -1
  764. package/dist/views/form-builder/index.esm.js +4 -4
  765. package/dist/views/form-builder/index.js +4 -4
  766. package/dist/views/form-builder/redux/index.esm.js +1 -1
  767. package/dist/views/form-builder/redux/index.js +1 -1
  768. package/dist/views/index.esm.js +13 -13
  769. package/dist/views/index.js +13 -13
  770. package/dist/views/template-editor/add-template/index.esm.js +1 -1
  771. package/dist/views/template-editor/add-template/index.js +1 -1
  772. package/dist/views/template-editor/components/index.esm.js +1 -1
  773. package/dist/views/template-editor/components/index.js +1 -1
  774. package/dist/views/template-editor/edit-section-modal/index.esm.js +1 -1
  775. package/dist/views/template-editor/edit-section-modal/index.js +1 -1
  776. package/dist/views/template-editor/index.esm.js +7 -7
  777. package/dist/views/template-editor/index.js +7 -7
  778. package/dist/views/template-editor/routes/index.esm.js +1 -1
  779. package/dist/views/template-editor/routes/index.js +1 -1
  780. package/dist/views/template-editor/template-modal/index.esm.js +1 -1
  781. package/dist/views/template-editor/template-modal/index.js +1 -1
  782. package/dist/views/template-editor/templates/index.esm.js +1 -1
  783. package/dist/views/template-editor/templates/index.js +1 -1
  784. package/package.json +1 -1
  785. package/dist/chunks/DonutChart-BSM45IZR.js +0 -104
  786. package/dist/chunks/DonutChart-BSM45IZR.js.map +0 -1
  787. package/dist/chunks/DonutChart-CwRZ69d2.esm.js +0 -88
  788. package/dist/chunks/DonutChart-CwRZ69d2.esm.js.map +0 -1
  789. package/dist/chunks/DynamicDependentField-CxvG77Nz.esm.js +0 -128
  790. package/dist/chunks/DynamicDependentField-CxvG77Nz.esm.js.map +0 -1
  791. package/dist/chunks/DynamicDependentField-s4kwIrGN.js +0 -127
  792. package/dist/chunks/DynamicDependentField-s4kwIrGN.js.map +0 -1
  793. package/dist/chunks/ERPUIProvider-BzseBepc.esm.js +0 -130
  794. package/dist/chunks/ERPUIProvider-BzseBepc.esm.js.map +0 -1
  795. package/dist/chunks/ERPUIProvider-iB39BUBd.js +0 -129
  796. package/dist/chunks/ERPUIProvider-iB39BUBd.js.map +0 -1
  797. package/dist/chunks/FORMS-0-6vG5vm.js +0 -295
  798. package/dist/chunks/FORMS-0-6vG5vm.js.map +0 -1
  799. package/dist/chunks/FORMS-QrgpyEK_.esm.js +0 -296
  800. package/dist/chunks/FORMS-QrgpyEK_.esm.js.map +0 -1
  801. package/dist/chunks/FlexibleReduxExample-BgpligMk.js +0 -148
  802. package/dist/chunks/FlexibleReduxExample-BgpligMk.js.map +0 -1
  803. package/dist/chunks/FlexibleReduxExample-Dwvx4wTb.esm.js +0 -149
  804. package/dist/chunks/FlexibleReduxExample-Dwvx4wTb.esm.js.map +0 -1
  805. package/dist/chunks/GroupBarChart-Bqvs5N3s.esm.js +0 -86
  806. package/dist/chunks/GroupBarChart-Bqvs5N3s.esm.js.map +0 -1
  807. package/dist/chunks/GroupBarChart-CQjr7Ow8.js +0 -102
  808. package/dist/chunks/GroupBarChart-CQjr7Ow8.js.map +0 -1
  809. package/dist/chunks/SectionFlowEditor-Blhdf4jD.esm.js +0 -5479
  810. package/dist/chunks/SectionFlowEditor-Blhdf4jD.esm.js.map +0 -1
  811. package/dist/chunks/SectionFlowEditor-CNchIJ-0.js +0 -5478
  812. package/dist/chunks/SectionFlowEditor-CNchIJ-0.js.map +0 -1
  813. package/dist/chunks/action-bar-BCAyZghg.esm.js +0 -660
  814. package/dist/chunks/action-bar-BCAyZghg.esm.js.map +0 -1
  815. package/dist/chunks/action-bar-D6G70JMr.js +0 -659
  816. package/dist/chunks/action-bar-D6G70JMr.js.map +0 -1
  817. package/dist/chunks/actionCreator-2cZZuVFH.js +0 -93
  818. package/dist/chunks/actionCreator-2cZZuVFH.js.map +0 -1
  819. package/dist/chunks/actionCreator-BxsSTjDD.esm.js +0 -28
  820. package/dist/chunks/actionCreator-BxsSTjDD.esm.js.map +0 -1
  821. package/dist/chunks/actionCreator-CCbS63RH.js +0 -21
  822. package/dist/chunks/actionCreator-CCbS63RH.js.map +0 -1
  823. package/dist/chunks/actionCreator-CmAgJzDP.esm.js +0 -94
  824. package/dist/chunks/actionCreator-CmAgJzDP.esm.js.map +0 -1
  825. package/dist/chunks/actionCreator-D5jnL5Pv.js +0 -78
  826. package/dist/chunks/actionCreator-D5jnL5Pv.js.map +0 -1
  827. package/dist/chunks/actionCreator-DaS-QGI4.esm.js +0 -79
  828. package/dist/chunks/actionCreator-DaS-QGI4.esm.js.map +0 -1
  829. package/dist/chunks/actionCreator-DkS_8UbT.esm.js +0 -22
  830. package/dist/chunks/actionCreator-DkS_8UbT.esm.js.map +0 -1
  831. package/dist/chunks/actionCreator-QCAcDFaI.js +0 -27
  832. package/dist/chunks/actionCreator-QCAcDFaI.js.map +0 -1
  833. package/dist/chunks/actionCreator-jriFS6rf.esm.js +0 -14
  834. package/dist/chunks/actionCreator-jriFS6rf.esm.js.map +0 -1
  835. package/dist/chunks/actionCreator-tRYKJL_l.js +0 -13
  836. package/dist/chunks/actionCreator-tRYKJL_l.js.map +0 -1
  837. package/dist/chunks/activity-log-3DTR9uiM.esm.js +0 -103
  838. package/dist/chunks/activity-log-3DTR9uiM.esm.js.map +0 -1
  839. package/dist/chunks/activity-log-Hw1K_cMJ.js +0 -102
  840. package/dist/chunks/activity-log-Hw1K_cMJ.js.map +0 -1
  841. package/dist/chunks/add-template-B8cAl6jP.esm.js +0 -11
  842. package/dist/chunks/add-template-B8cAl6jP.esm.js.map +0 -1
  843. package/dist/chunks/add-template-DXfjAhLS.js +0 -10
  844. package/dist/chunks/add-template-DXfjAhLS.js.map +0 -1
  845. package/dist/chunks/address-modal-DDs0_DwZ.esm.js +0 -664
  846. package/dist/chunks/address-modal-DDs0_DwZ.esm.js.map +0 -1
  847. package/dist/chunks/address-modal-eIuNxXg0.js +0 -680
  848. package/dist/chunks/address-modal-eIuNxXg0.js.map +0 -1
  849. package/dist/chunks/ai-summary-CAKlYLnt.js +0 -350
  850. package/dist/chunks/ai-summary-CAKlYLnt.js.map +0 -1
  851. package/dist/chunks/ai-summary-Dto8NzAC.esm.js +0 -351
  852. package/dist/chunks/ai-summary-Dto8NzAC.esm.js.map +0 -1
  853. package/dist/chunks/api-BSqZ2y7J.esm.js +0 -5922
  854. package/dist/chunks/api-BSqZ2y7J.esm.js.map +0 -1
  855. package/dist/chunks/api-Ce693XLe.js +0 -5921
  856. package/dist/chunks/api-Ce693XLe.js.map +0 -1
  857. package/dist/chunks/appbar-C35Euxp4.js +0 -56
  858. package/dist/chunks/appbar-C35Euxp4.js.map +0 -1
  859. package/dist/chunks/appbar-DCoI9W6A.esm.js +0 -57
  860. package/dist/chunks/appbar-DCoI9W6A.esm.js.map +0 -1
  861. package/dist/chunks/approval-wrapper-B-41mLZw.esm.js +0 -140
  862. package/dist/chunks/approval-wrapper-B-41mLZw.esm.js.map +0 -1
  863. package/dist/chunks/approval-wrapper-C6-tXwaf.js +0 -139
  864. package/dist/chunks/approval-wrapper-C6-tXwaf.js.map +0 -1
  865. package/dist/chunks/areaLinerChart-BSaqONGz.esm.js +0 -104
  866. package/dist/chunks/areaLinerChart-BSaqONGz.esm.js.map +0 -1
  867. package/dist/chunks/areaLinerChart-CV1NKCGz.js +0 -120
  868. package/dist/chunks/areaLinerChart-CV1NKCGz.js.map +0 -1
  869. package/dist/chunks/bar-chart-C0okUFJS.js +0 -103
  870. package/dist/chunks/bar-chart-C0okUFJS.js.map +0 -1
  871. package/dist/chunks/bar-chart-D4myXwbk.esm.js +0 -87
  872. package/dist/chunks/bar-chart-D4myXwbk.esm.js.map +0 -1
  873. package/dist/chunks/barChart-B6SjqFTi.esm.js +0 -144
  874. package/dist/chunks/barChart-B6SjqFTi.esm.js.map +0 -1
  875. package/dist/chunks/barChart-_v5HVNeD.js +0 -160
  876. package/dist/chunks/barChart-_v5HVNeD.js.map +0 -1
  877. package/dist/chunks/barLinechart-BGRDgzAX.esm.js +0 -180
  878. package/dist/chunks/barLinechart-BGRDgzAX.esm.js.map +0 -1
  879. package/dist/chunks/barLinechart-Cybr4t95.js +0 -196
  880. package/dist/chunks/barLinechart-Cybr4t95.js.map +0 -1
  881. package/dist/chunks/calculation-summary-BhWssEJP.esm.js +0 -182
  882. package/dist/chunks/calculation-summary-BhWssEJP.esm.js.map +0 -1
  883. package/dist/chunks/calculation-summary-DdAaSwoG.js +0 -181
  884. package/dist/chunks/calculation-summary-DdAaSwoG.js.map +0 -1
  885. package/dist/chunks/chat-bot-C0ohNCRY.js +0 -3546
  886. package/dist/chunks/chat-bot-C0ohNCRY.js.map +0 -1
  887. package/dist/chunks/chat-bot-CzRxCBcZ.esm.js +0 -3547
  888. package/dist/chunks/chat-bot-CzRxCBcZ.esm.js.map +0 -1
  889. package/dist/chunks/common-utility-DNOInB1J.esm.js +0 -299
  890. package/dist/chunks/common-utility-DNOInB1J.esm.js.map +0 -1
  891. package/dist/chunks/common-utility-DXlg6tQv.js +0 -298
  892. package/dist/chunks/common-utility-DXlg6tQv.js.map +0 -1
  893. package/dist/chunks/custom-date-picker-Bj_9n8p8.esm.js +0 -56
  894. package/dist/chunks/custom-date-picker-Bj_9n8p8.esm.js.map +0 -1
  895. package/dist/chunks/custom-date-picker-Dt54H6AR.js +0 -55
  896. package/dist/chunks/custom-date-picker-Dt54H6AR.js.map +0 -1
  897. package/dist/chunks/custom-editor-D99-i2rN.js +0 -1257
  898. package/dist/chunks/custom-editor-D99-i2rN.js.map +0 -1
  899. package/dist/chunks/custom-editor-DbaK32F2.esm.js +0 -1257
  900. package/dist/chunks/custom-editor-DbaK32F2.esm.js.map +0 -1
  901. package/dist/chunks/custom-form-CiSSDja3.esm.js +0 -1146
  902. package/dist/chunks/custom-form-CiSSDja3.esm.js.map +0 -1
  903. package/dist/chunks/custom-form-rhJ1xvOV.js +0 -1145
  904. package/dist/chunks/custom-form-rhJ1xvOV.js.map +0 -1
  905. package/dist/chunks/custom-grid-card-25R5RDYY.js +0 -126
  906. package/dist/chunks/custom-grid-card-25R5RDYY.js.map +0 -1
  907. package/dist/chunks/custom-grid-card-ChSQynhf.esm.js +0 -127
  908. package/dist/chunks/custom-grid-card-ChSQynhf.esm.js.map +0 -1
  909. package/dist/chunks/dashboard-D7cAtema.js +0 -74
  910. package/dist/chunks/dashboard-D7cAtema.js.map +0 -1
  911. package/dist/chunks/dashboard-uhHB0n9T.esm.js +0 -75
  912. package/dist/chunks/dashboard-uhHB0n9T.esm.js.map +0 -1
  913. package/dist/chunks/date-BEkOnPLg.js +0 -55
  914. package/dist/chunks/date-BEkOnPLg.js.map +0 -1
  915. package/dist/chunks/date-DWW33q1y.esm.js +0 -56
  916. package/dist/chunks/date-DWW33q1y.esm.js.map +0 -1
  917. package/dist/chunks/date-picker-C0qJ2Ceq.js +0 -127
  918. package/dist/chunks/date-picker-C0qJ2Ceq.js.map +0 -1
  919. package/dist/chunks/date-picker-CqiwV3fq.esm.js +0 -128
  920. package/dist/chunks/date-picker-CqiwV3fq.esm.js.map +0 -1
  921. package/dist/chunks/date-range-picker-Bt_heXbX.js +0 -196
  922. package/dist/chunks/date-range-picker-Bt_heXbX.js.map +0 -1
  923. package/dist/chunks/date-range-picker-CXYyecdN.js +0 -61
  924. package/dist/chunks/date-range-picker-CXYyecdN.js.map +0 -1
  925. package/dist/chunks/date-range-picker-CvkYXRaH.esm.js +0 -197
  926. package/dist/chunks/date-range-picker-CvkYXRaH.esm.js.map +0 -1
  927. package/dist/chunks/date-range-picker-DDI-vDlU.esm.js +0 -62
  928. package/dist/chunks/date-range-picker-DDI-vDlU.esm.js.map +0 -1
  929. package/dist/chunks/date-time-Bmf9tUWN.js +0 -54
  930. package/dist/chunks/date-time-Bmf9tUWN.js.map +0 -1
  931. package/dist/chunks/date-time-TwBpGcVi.esm.js +0 -55
  932. package/dist/chunks/date-time-TwBpGcVi.esm.js.map +0 -1
  933. package/dist/chunks/date-time-picker-BiVDvz7V.esm.js +0 -115
  934. package/dist/chunks/date-time-picker-BiVDvz7V.esm.js.map +0 -1
  935. package/dist/chunks/date-time-picker-HC1XkaJG.js +0 -114
  936. package/dist/chunks/date-time-picker-HC1XkaJG.js.map +0 -1
  937. package/dist/chunks/dateFormat-DruK2Qh9.js +0 -56
  938. package/dist/chunks/dateFormat-DruK2Qh9.js.map +0 -1
  939. package/dist/chunks/dateFormat-VzMEQghL.esm.js +0 -57
  940. package/dist/chunks/dateFormat-VzMEQghL.esm.js.map +0 -1
  941. package/dist/chunks/discount-summary-Cfxk2tZa.esm.js +0 -60
  942. package/dist/chunks/discount-summary-Cfxk2tZa.esm.js.map +0 -1
  943. package/dist/chunks/discount-summary-RCy2t_AM.js +0 -59
  944. package/dist/chunks/discount-summary-RCy2t_AM.js.map +0 -1
  945. package/dist/chunks/dynamic-report-BfnrD-zq.js +0 -588
  946. package/dist/chunks/dynamic-report-BfnrD-zq.js.map +0 -1
  947. package/dist/chunks/dynamic-report-CmL56Rs0.esm.js +0 -589
  948. package/dist/chunks/dynamic-report-CmL56Rs0.esm.js.map +0 -1
  949. package/dist/chunks/dynamic-rows-5iZHYEWp.js +0 -249
  950. package/dist/chunks/dynamic-rows-5iZHYEWp.js.map +0 -1
  951. package/dist/chunks/dynamic-rows-Db28dAgS.esm.js +0 -250
  952. package/dist/chunks/dynamic-rows-Db28dAgS.esm.js.map +0 -1
  953. package/dist/chunks/dynamic-text-editor-B2k2GRDf.js +0 -44
  954. package/dist/chunks/dynamic-text-editor-B2k2GRDf.js.map +0 -1
  955. package/dist/chunks/dynamic-text-editor-DSyNRqGU.esm.js +0 -45
  956. package/dist/chunks/dynamic-text-editor-DSyNRqGU.esm.js.map +0 -1
  957. package/dist/chunks/edit-section-modal-Bg_OubEc.js +0 -76
  958. package/dist/chunks/edit-section-modal-Bg_OubEc.js.map +0 -1
  959. package/dist/chunks/edit-section-modal-CqbrHCo2.esm.js +0 -77
  960. package/dist/chunks/edit-section-modal-CqbrHCo2.esm.js.map +0 -1
  961. package/dist/chunks/filter-Br7IBDbh.esm.js +0 -415
  962. package/dist/chunks/filter-Br7IBDbh.esm.js.map +0 -1
  963. package/dist/chunks/filter-DqL-Ey7H.js +0 -414
  964. package/dist/chunks/filter-DqL-Ey7H.js.map +0 -1
  965. package/dist/chunks/footer-BmDKMyLP.js +0 -63
  966. package/dist/chunks/footer-BmDKMyLP.js.map +0 -1
  967. package/dist/chunks/footer-BmKXTODa.esm.js +0 -64
  968. package/dist/chunks/footer-BmKXTODa.esm.js.map +0 -1
  969. package/dist/chunks/form-fields-BiRJ8Gyp.esm.js +0 -355
  970. package/dist/chunks/form-fields-BiRJ8Gyp.esm.js.map +0 -1
  971. package/dist/chunks/form-fields-mWRtoHVX.js +0 -354
  972. package/dist/chunks/form-fields-mWRtoHVX.js.map +0 -1
  973. package/dist/chunks/form-parser-6_MQHzfU.js +0 -607
  974. package/dist/chunks/form-parser-6_MQHzfU.js.map +0 -1
  975. package/dist/chunks/form-parser-D0ZqEsBx.esm.js +0 -591
  976. package/dist/chunks/form-parser-D0ZqEsBx.esm.js.map +0 -1
  977. package/dist/chunks/form-section-D0ipOYv3.esm.js +0 -476
  978. package/dist/chunks/form-section-D0ipOYv3.esm.js.map +0 -1
  979. package/dist/chunks/form-section-DJJ5O8QE.js +0 -475
  980. package/dist/chunks/form-section-DJJ5O8QE.js.map +0 -1
  981. package/dist/chunks/format-chart-value-B5ClGhlz.esm.js +0 -37
  982. package/dist/chunks/format-chart-value-B5ClGhlz.esm.js.map +0 -1
  983. package/dist/chunks/format-chart-value-Cy1P2lbF.js +0 -53
  984. package/dist/chunks/format-chart-value-Cy1P2lbF.js.map +0 -1
  985. package/dist/chunks/fullScreen-CV2gntC3.js +0 -20
  986. package/dist/chunks/fullScreen-CV2gntC3.js.map +0 -1
  987. package/dist/chunks/fullScreen-DwP10GLK.esm.js +0 -21
  988. package/dist/chunks/fullScreen-DwP10GLK.esm.js.map +0 -1
  989. package/dist/chunks/global-search-BUpAIn8K.js +0 -149
  990. package/dist/chunks/global-search-BUpAIn8K.js.map +0 -1
  991. package/dist/chunks/global-search-C_L-lmq1.esm.js +0 -150
  992. package/dist/chunks/global-search-C_L-lmq1.esm.js.map +0 -1
  993. package/dist/chunks/grid-view-7yv8BBGS.esm.js +0 -52
  994. package/dist/chunks/grid-view-7yv8BBGS.esm.js.map +0 -1
  995. package/dist/chunks/grid-view-LeS2Q6Zy.js +0 -51
  996. package/dist/chunks/grid-view-LeS2Q6Zy.js.map +0 -1
  997. package/dist/chunks/header-BfLMcRXF.js +0 -90
  998. package/dist/chunks/header-BfLMcRXF.js.map +0 -1
  999. package/dist/chunks/header-CgGEFjRD.esm.js +0 -91
  1000. package/dist/chunks/header-CgGEFjRD.esm.js.map +0 -1
  1001. package/dist/chunks/header-enhanced-CP0w1-Dn.js +0 -400
  1002. package/dist/chunks/header-enhanced-CP0w1-Dn.js.map +0 -1
  1003. package/dist/chunks/header-enhanced-Cd3gRkWV.esm.js +0 -401
  1004. package/dist/chunks/header-enhanced-Cd3gRkWV.esm.js.map +0 -1
  1005. package/dist/chunks/inline-edit-fields-C7sJKda2.js +0 -340
  1006. package/dist/chunks/inline-edit-fields-C7sJKda2.js.map +0 -1
  1007. package/dist/chunks/inline-edit-fields-D0gvI8T3.esm.js +0 -324
  1008. package/dist/chunks/inline-edit-fields-D0gvI8T3.esm.js.map +0 -1
  1009. package/dist/chunks/inventory-reports-title-bar-C8Qo7NEx.js +0 -732
  1010. package/dist/chunks/inventory-reports-title-bar-C8Qo7NEx.js.map +0 -1
  1011. package/dist/chunks/inventory-reports-title-bar-DpG06q1U.esm.js +0 -733
  1012. package/dist/chunks/inventory-reports-title-bar-DpG06q1U.esm.js.map +0 -1
  1013. package/dist/chunks/item-response-details-Q4dR3qmN.js +0 -78
  1014. package/dist/chunks/item-response-details-Q4dR3qmN.js.map +0 -1
  1015. package/dist/chunks/item-response-details-TEvdMqA7.esm.js +0 -79
  1016. package/dist/chunks/item-response-details-TEvdMqA7.esm.js.map +0 -1
  1017. package/dist/chunks/listing-B7oUf-ga.esm.js +0 -276
  1018. package/dist/chunks/listing-B7oUf-ga.esm.js.map +0 -1
  1019. package/dist/chunks/listing-DINZMGWq.js +0 -275
  1020. package/dist/chunks/listing-DINZMGWq.js.map +0 -1
  1021. package/dist/chunks/location-select-B91gVEZg.esm.js +0 -86
  1022. package/dist/chunks/location-select-B91gVEZg.esm.js.map +0 -1
  1023. package/dist/chunks/location-select-DJGf2z9B.js +0 -85
  1024. package/dist/chunks/location-select-DJGf2z9B.js.map +0 -1
  1025. package/dist/chunks/material-editable-table-Bsy2JLb6.esm.js +0 -1469
  1026. package/dist/chunks/material-editable-table-Bsy2JLb6.esm.js.map +0 -1
  1027. package/dist/chunks/material-editable-table-CzJhE63R.js +0 -1485
  1028. package/dist/chunks/material-editable-table-CzJhE63R.js.map +0 -1
  1029. package/dist/chunks/module-reducer-CCZD_gz4.js +0 -91
  1030. package/dist/chunks/module-reducer-CCZD_gz4.js.map +0 -1
  1031. package/dist/chunks/module-reducer-DNm9BZ0L.esm.js +0 -92
  1032. package/dist/chunks/module-reducer-DNm9BZ0L.esm.js.map +0 -1
  1033. package/dist/chunks/multi-line-chart-BYBYGBdy.esm.js +0 -96
  1034. package/dist/chunks/multi-line-chart-BYBYGBdy.esm.js.map +0 -1
  1035. package/dist/chunks/multi-line-chart-Bt3wdHU7.js +0 -112
  1036. package/dist/chunks/multi-line-chart-Bt3wdHU7.js.map +0 -1
  1037. package/dist/chunks/notification-menu-BCCLpwDZ.js +0 -600
  1038. package/dist/chunks/notification-menu-BCCLpwDZ.js.map +0 -1
  1039. package/dist/chunks/notification-menu-PJM37Tp2.esm.js +0 -601
  1040. package/dist/chunks/notification-menu-PJM37Tp2.esm.js.map +0 -1
  1041. package/dist/chunks/page-action-CUTFLYyt.esm.js +0 -325
  1042. package/dist/chunks/page-action-CUTFLYyt.esm.js.map +0 -1
  1043. package/dist/chunks/page-action-EfPBRwHo.js +0 -324
  1044. package/dist/chunks/page-action-EfPBRwHo.js.map +0 -1
  1045. package/dist/chunks/page-navigator-J9GdrKkm.js +0 -242
  1046. package/dist/chunks/page-navigator-J9GdrKkm.js.map +0 -1
  1047. package/dist/chunks/page-navigator-PBXn7Eh_.esm.js +0 -243
  1048. package/dist/chunks/page-navigator-PBXn7Eh_.esm.js.map +0 -1
  1049. package/dist/chunks/page-view-D_Erav8n.js +0 -323
  1050. package/dist/chunks/page-view-D_Erav8n.js.map +0 -1
  1051. package/dist/chunks/page-view-DsptSruT.esm.js +0 -324
  1052. package/dist/chunks/page-view-DsptSruT.esm.js.map +0 -1
  1053. package/dist/chunks/quick-approval-modal-Bi9f6kIj.esm.js +0 -256
  1054. package/dist/chunks/quick-approval-modal-Bi9f6kIj.esm.js.map +0 -1
  1055. package/dist/chunks/quick-approval-modal-CoFcxeD9.js +0 -272
  1056. package/dist/chunks/quick-approval-modal-CoFcxeD9.js.map +0 -1
  1057. package/dist/chunks/reducer-BSDSt8P5.js +0 -49
  1058. package/dist/chunks/reducer-BSDSt8P5.js.map +0 -1
  1059. package/dist/chunks/reducer-Btzbg-kC.js +0 -55
  1060. package/dist/chunks/reducer-Btzbg-kC.js.map +0 -1
  1061. package/dist/chunks/reducer-C0vp7c_5.esm.js +0 -43
  1062. package/dist/chunks/reducer-C0vp7c_5.esm.js.map +0 -1
  1063. package/dist/chunks/reducer-C5hytm3p.js +0 -42
  1064. package/dist/chunks/reducer-C5hytm3p.js.map +0 -1
  1065. package/dist/chunks/reducer-C_iAxDoX.js +0 -32
  1066. package/dist/chunks/reducer-C_iAxDoX.js.map +0 -1
  1067. package/dist/chunks/reducer-DlQPn2Yf.js +0 -147
  1068. package/dist/chunks/reducer-DlQPn2Yf.js.map +0 -1
  1069. package/dist/chunks/reducer-DpGhVrVl.esm.js +0 -50
  1070. package/dist/chunks/reducer-DpGhVrVl.esm.js.map +0 -1
  1071. package/dist/chunks/reducer-DvN85Zfx.esm.js +0 -33
  1072. package/dist/chunks/reducer-DvN85Zfx.esm.js.map +0 -1
  1073. package/dist/chunks/reducer-LfwRh77b.esm.js +0 -56
  1074. package/dist/chunks/reducer-LfwRh77b.esm.js.map +0 -1
  1075. package/dist/chunks/reducer-qhCDNTSp.esm.js +0 -148
  1076. package/dist/chunks/reducer-qhCDNTSp.esm.js.map +0 -1
  1077. package/dist/chunks/reportFilter-CqxvTM6T.js +0 -394
  1078. package/dist/chunks/reportFilter-CqxvTM6T.js.map +0 -1
  1079. package/dist/chunks/reportFilter-DTsM7pWt.esm.js +0 -395
  1080. package/dist/chunks/reportFilter-DTsM7pWt.esm.js.map +0 -1
  1081. package/dist/chunks/reports-title-bar-BPCvX-LI.esm.js +0 -1016
  1082. package/dist/chunks/reports-title-bar-BPCvX-LI.esm.js.map +0 -1
  1083. package/dist/chunks/reports-title-bar-L1k7t3uz.js +0 -1015
  1084. package/dist/chunks/reports-title-bar-L1k7t3uz.js.map +0 -1
  1085. package/dist/chunks/route-page-map-Bz7COHkD.esm.js +0 -7427
  1086. package/dist/chunks/route-page-map-Bz7COHkD.esm.js.map +0 -1
  1087. package/dist/chunks/route-page-map-DfVJnKQA.js +0 -7426
  1088. package/dist/chunks/route-page-map-DfVJnKQA.js.map +0 -1
  1089. package/dist/chunks/routes-BC185juT.esm.js +0 -47
  1090. package/dist/chunks/routes-BC185juT.esm.js.map +0 -1
  1091. package/dist/chunks/routes-PNRu_AV8.js +0 -46
  1092. package/dist/chunks/routes-PNRu_AV8.js.map +0 -1
  1093. package/dist/chunks/schedule-report-CkrAwjTf.js +0 -235
  1094. package/dist/chunks/schedule-report-CkrAwjTf.js.map +0 -1
  1095. package/dist/chunks/schedule-report-YXW8mqxX.esm.js +0 -236
  1096. package/dist/chunks/schedule-report-YXW8mqxX.esm.js.map +0 -1
  1097. package/dist/chunks/schedule-report-modal-CDieUlju.esm.js +0 -288
  1098. package/dist/chunks/schedule-report-modal-CDieUlju.esm.js.map +0 -1
  1099. package/dist/chunks/schedule-report-modal-DbDqxLtB.js +0 -287
  1100. package/dist/chunks/schedule-report-modal-DbDqxLtB.js.map +0 -1
  1101. package/dist/chunks/searchable-select-Kg6j3WHo.js +0 -5447
  1102. package/dist/chunks/searchable-select-Kg6j3WHo.js.map +0 -1
  1103. package/dist/chunks/searchable-select-UNDm_sU3.esm.js +0 -5431
  1104. package/dist/chunks/searchable-select-UNDm_sU3.esm.js.map +0 -1
  1105. package/dist/chunks/share-modal-BkfNmJ6Q.esm.js +0 -218
  1106. package/dist/chunks/share-modal-BkfNmJ6Q.esm.js.map +0 -1
  1107. package/dist/chunks/share-modal-CfxRsno1.js +0 -217
  1108. package/dist/chunks/share-modal-CfxRsno1.js.map +0 -1
  1109. package/dist/chunks/share-modal-enhanced-B7ROQZkD.esm.js +0 -270
  1110. package/dist/chunks/share-modal-enhanced-B7ROQZkD.esm.js.map +0 -1
  1111. package/dist/chunks/share-modal-enhanced-CdPdyiPt.js +0 -269
  1112. package/dist/chunks/share-modal-enhanced-CdPdyiPt.js.map +0 -1
  1113. package/dist/chunks/sidebarScreen-CUDpCssG.js +0 -200
  1114. package/dist/chunks/sidebarScreen-CUDpCssG.js.map +0 -1
  1115. package/dist/chunks/sidebarScreen-ES06jsUC.esm.js +0 -201
  1116. package/dist/chunks/sidebarScreen-ES06jsUC.esm.js.map +0 -1
  1117. package/dist/chunks/store-BhWKdIyL.esm.js +0 -89
  1118. package/dist/chunks/store-BhWKdIyL.esm.js.map +0 -1
  1119. package/dist/chunks/store-DED99V-p.js +0 -88
  1120. package/dist/chunks/store-DED99V-p.js.map +0 -1
  1121. package/dist/chunks/table-D60IIwv_.js +0 -184
  1122. package/dist/chunks/table-D60IIwv_.js.map +0 -1
  1123. package/dist/chunks/table-DqRPlxNW.esm.js +0 -185
  1124. package/dist/chunks/table-DqRPlxNW.esm.js.map +0 -1
  1125. package/dist/chunks/table-form-5eM4xAoE.js +0 -1536
  1126. package/dist/chunks/table-form-5eM4xAoE.js.map +0 -1
  1127. package/dist/chunks/table-form-lDShKPGv.esm.js +0 -1537
  1128. package/dist/chunks/table-form-lDShKPGv.esm.js.map +0 -1
  1129. package/dist/chunks/template-editor-router-BDTAwEPd.esm.js +0 -9
  1130. package/dist/chunks/template-editor-router-BDTAwEPd.esm.js.map +0 -1
  1131. package/dist/chunks/template-editor-router-DQU440rt.js +0 -8
  1132. package/dist/chunks/template-editor-router-DQU440rt.js.map +0 -1
  1133. package/dist/chunks/template-modal-BEbtkxK2.esm.js +0 -769
  1134. package/dist/chunks/template-modal-BEbtkxK2.esm.js.map +0 -1
  1135. package/dist/chunks/template-modal-DM8bWq5q.js +0 -768
  1136. package/dist/chunks/template-modal-DM8bWq5q.js.map +0 -1
  1137. package/dist/chunks/templates-CcbbOv90.js +0 -278
  1138. package/dist/chunks/templates-CcbbOv90.js.map +0 -1
  1139. package/dist/chunks/templates-DchjIAQf.esm.js +0 -279
  1140. package/dist/chunks/templates-DchjIAQf.esm.js.map +0 -1
  1141. package/dist/chunks/text-measurement-B2SY4MOI.js +0 -251
  1142. package/dist/chunks/text-measurement-B2SY4MOI.js.map +0 -1
  1143. package/dist/chunks/text-measurement-C4VHjrOM.esm.js +0 -252
  1144. package/dist/chunks/text-measurement-C4VHjrOM.esm.js.map +0 -1
  1145. package/dist/chunks/total-summary-BCNJd8iL.esm.js +0 -41
  1146. package/dist/chunks/total-summary-BCNJd8iL.esm.js.map +0 -1
  1147. package/dist/chunks/total-summary-BhLK6YOW.js +0 -40
  1148. package/dist/chunks/total-summary-BhLK6YOW.js.map +0 -1
  1149. package/dist/chunks/translations-CzTYlXLs.js +0 -58
  1150. package/dist/chunks/translations-CzTYlXLs.js.map +0 -1
  1151. package/dist/chunks/translations-s7kQoO4z.esm.js +0 -59
  1152. package/dist/chunks/translations-s7kQoO4z.esm.js.map +0 -1
  1153. package/dist/chunks/uom-field-wrapper-CftM69IH.esm.js +0 -80
  1154. package/dist/chunks/uom-field-wrapper-CftM69IH.esm.js.map +0 -1
  1155. package/dist/chunks/uom-field-wrapper-DGJXWRgH.js +0 -79
  1156. package/dist/chunks/uom-field-wrapper-DGJXWRgH.js.map +0 -1
  1157. package/dist/chunks/upload-excel-BzL5o4KR.esm.js +0 -361
  1158. package/dist/chunks/upload-excel-BzL5o4KR.esm.js.map +0 -1
  1159. package/dist/chunks/upload-excel-WxhTn3iL.js +0 -360
  1160. package/dist/chunks/upload-excel-WxhTn3iL.js.map +0 -1
  1161. package/dist/chunks/use-translations-DK7JAMUq.esm.js +0 -62
  1162. package/dist/chunks/use-translations-DK7JAMUq.esm.js.map +0 -1
  1163. package/dist/chunks/use-translations-fvRLagN8.js +0 -61
  1164. package/dist/chunks/use-translations-fvRLagN8.js.map +0 -1
  1165. package/dist/chunks/useAccountSetting-0o3CgYbA.esm.js +0 -173
  1166. package/dist/chunks/useAccountSetting-0o3CgYbA.esm.js.map +0 -1
  1167. package/dist/chunks/useAccountSetting-DP26D8yo.js +0 -172
  1168. package/dist/chunks/useAccountSetting-DP26D8yo.js.map +0 -1
  1169. package/dist/chunks/useCheckSkuAndName-CoCwHFgC.js +0 -49
  1170. package/dist/chunks/useCheckSkuAndName-CoCwHFgC.js.map +0 -1
  1171. package/dist/chunks/useCheckSkuAndName-rkZ4hHCO.esm.js +0 -50
  1172. package/dist/chunks/useCheckSkuAndName-rkZ4hHCO.esm.js.map +0 -1
  1173. package/dist/chunks/useReduxIntegration-Cd6hvE5r.js +0 -38
  1174. package/dist/chunks/useReduxIntegration-Cd6hvE5r.js.map +0 -1
  1175. package/dist/chunks/useReduxIntegration-DM__4RiP.esm.js +0 -39
  1176. package/dist/chunks/useReduxIntegration-DM__4RiP.esm.js.map +0 -1
  1177. package/dist/chunks/useUniquenessCheck-B2o3fIcX.esm.js +0 -39
  1178. package/dist/chunks/useUniquenessCheck-B2o3fIcX.esm.js.map +0 -1
  1179. package/dist/chunks/useUniquenessCheck-pXvzabHu.js +0 -38
  1180. package/dist/chunks/useUniquenessCheck-pXvzabHu.js.map +0 -1
  1181. package/dist/chunks/useVendorAICompare-BkBY0x5p.js +0 -30
  1182. package/dist/chunks/useVendorAICompare-BkBY0x5p.js.map +0 -1
  1183. package/dist/chunks/useVendorAICompare-fc4aJtj1.esm.js +0 -31
  1184. package/dist/chunks/useVendorAICompare-fc4aJtj1.esm.js.map +0 -1
  1185. package/dist/chunks/value-editor-BmMNObtT.js +0 -265
  1186. package/dist/chunks/value-editor-BmMNObtT.js.map +0 -1
  1187. package/dist/chunks/value-editor-Djz4sP71.esm.js +0 -266
  1188. package/dist/chunks/value-editor-Djz4sP71.esm.js.map +0 -1
  1189. package/dist/chunks/vendor-ai-summary-B_2B-IuL.js +0 -227
  1190. package/dist/chunks/vendor-ai-summary-B_2B-IuL.js.map +0 -1
  1191. package/dist/chunks/vendor-ai-summary-CXNxB7TQ.esm.js +0 -228
  1192. package/dist/chunks/vendor-ai-summary-CXNxB7TQ.esm.js.map +0 -1
@@ -0,0 +1,3609 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const React = require("react");
4
+ const marked = require("marked");
5
+ const iconsMaterial = require("@mui/icons-material");
6
+ const runtime = require("@erpsquad/common/runtime");
7
+ const utils_apiConfig = require("../utils/api-config/index.js");
8
+ const api = require("./api-DwmixHAO.js");
9
+ const api$1 = require("./api-BNpPd9ZI.js");
10
+ const api$2 = require("./api-BhYzlgpk.js");
11
+ const lucideReact = require("lucide-react");
12
+ const reactI18next = require("react-i18next");
13
+ const ReactDOM = require("react-dom");
14
+ const aiDisclaimer = require("./ai-disclaimer-DAecPGGI.js");
15
+ const button = require("./button-CYiSRppg.js");
16
+ const save = require("./save-omAUfbkE.js");
17
+ const tick = require("./tick-CQMWRTch.js");
18
+ const trash = require("./trash-DWY4lso3.js");
19
+ const confirmModal = require("./confirm-modal-BpCtXddt.js");
20
+ const toast = require("react-hot-toast");
21
+ const chatDockState = require("./chat-dock-state-DXegFiEF.js");
22
+ const FORM_TYPE_LABELS = {
23
+ sales_invoice: "Sales Invoice",
24
+ purchase_invoice: "Purchase Invoice"
25
+ };
26
+ const ACCEPTED_FILE_EXTENSIONS = {
27
+ pdf: [".pdf"],
28
+ excel: [".xls", ".xlsx"],
29
+ doc: [".doc", ".docx"],
30
+ md: [".md"],
31
+ image: [".png", ".jpg", ".jpeg"]
32
+ };
33
+ const ACCEPT_ATTR = Object.values(ACCEPTED_FILE_EXTENSIONS).flat().join(",");
34
+ const getFileCategory = (filename) => {
35
+ const lower = filename.toLowerCase();
36
+ return Object.keys(ACCEPTED_FILE_EXTENSIONS).find(
37
+ (category) => ACCEPTED_FILE_EXTENSIONS[category].some((ext) => lower.endsWith(ext))
38
+ ) || null;
39
+ };
40
+ const getTime = () => (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
41
+ const getGreeting = () => {
42
+ const h = (/* @__PURE__ */ new Date()).getHours();
43
+ if (h < 12) return "Good morning";
44
+ if (h < 17) return "Good afternoon";
45
+ return "Good evening";
46
+ };
47
+ const formatDuration = (ms) => `${(ms / 1e3).toFixed(1)}s`;
48
+ const formatTokens = (n) => n >= 1e4 ? `${(n / 1e3).toFixed(1)}k` : n.toLocaleString();
49
+ const IcWarning = ({ size = 14 }) => /* @__PURE__ */ jsxRuntime.jsxs(
50
+ "svg",
51
+ {
52
+ viewBox: "0 0 24 24",
53
+ stroke: "currentColor",
54
+ fill: "none",
55
+ strokeWidth: "2",
56
+ style: { width: size, height: size, flexShrink: 0 },
57
+ children: [
58
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10.3 3.9L1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z" }),
59
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
60
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
61
+ ]
62
+ }
63
+ );
64
+ const IcBox = ({ size = 14 }) => /* @__PURE__ */ jsxRuntime.jsxs(
65
+ "svg",
66
+ {
67
+ viewBox: "0 0 24 24",
68
+ stroke: "currentColor",
69
+ fill: "none",
70
+ strokeWidth: "2",
71
+ style: { width: size, height: size, flexShrink: 0 },
72
+ children: [
73
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" }),
74
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "3.3 7 12 12 20.7 7" }),
75
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "22", x2: "12", y2: "12" })
76
+ ]
77
+ }
78
+ );
79
+ const IcCalendar = ({ size = 14 }) => /* @__PURE__ */ jsxRuntime.jsxs(
80
+ "svg",
81
+ {
82
+ viewBox: "0 0 24 24",
83
+ stroke: "currentColor",
84
+ fill: "none",
85
+ strokeWidth: "2",
86
+ style: { width: size, height: size, flexShrink: 0 },
87
+ children: [
88
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
89
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
90
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
91
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
92
+ ]
93
+ }
94
+ );
95
+ const IcChevR = ({ size = 14 }) => /* @__PURE__ */ jsxRuntime.jsx(
96
+ "svg",
97
+ {
98
+ viewBox: "0 0 24 24",
99
+ stroke: "currentColor",
100
+ fill: "none",
101
+ strokeWidth: "2",
102
+ style: { width: size, height: size, flexShrink: 0 },
103
+ children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "9 6 15 12 9 18" })
104
+ }
105
+ );
106
+ const IcSearch = ({ size = 14 }) => /* @__PURE__ */ jsxRuntime.jsxs(
107
+ "svg",
108
+ {
109
+ viewBox: "0 0 24 24",
110
+ stroke: "currentColor",
111
+ fill: "none",
112
+ strokeWidth: "2",
113
+ style: { width: size, height: size, flexShrink: 0 },
114
+ children: [
115
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11", cy: "11", r: "7" }),
116
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
117
+ ]
118
+ }
119
+ );
120
+ const IcTarget = ({ size = 14 }) => /* @__PURE__ */ jsxRuntime.jsxs(
121
+ "svg",
122
+ {
123
+ viewBox: "0 0 24 24",
124
+ stroke: "currentColor",
125
+ fill: "none",
126
+ strokeWidth: "2",
127
+ style: { width: size, height: size, flexShrink: 0 },
128
+ children: [
129
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "9" }),
130
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "5" }),
131
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "1.5", fill: "currentColor", stroke: "none" })
132
+ ]
133
+ }
134
+ );
135
+ const IcBolt = ({ size = 14 }) => /* @__PURE__ */ jsxRuntime.jsx(
136
+ "svg",
137
+ {
138
+ viewBox: "0 0 24 24",
139
+ fill: "currentColor",
140
+ stroke: "none",
141
+ style: { width: size, height: size, flexShrink: 0 },
142
+ children: /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: "13 2 3 14 12 14 11 22 21 10 12 10 13 2" })
143
+ }
144
+ );
145
+ const IcFlame = ({ size = 14 }) => /* @__PURE__ */ jsxRuntime.jsx(
146
+ "svg",
147
+ {
148
+ viewBox: "0 0 24 24",
149
+ stroke: "currentColor",
150
+ fill: "none",
151
+ strokeWidth: "1.8",
152
+ style: { width: size, height: size, flexShrink: 0 },
153
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 14.5A2.5 2.5 0 0 0 11 17c1.4 0 2-1 2-2 0-1-.6-2-2-2-1 0-1.5.5-1.5 1zM12 2c0 4-3 5-3 9a5 5 0 0 0 10 0c0-2-1-3-2-4 0-1 0-2-1-3-1.5-1.5-3-2-4-2z" })
154
+ }
155
+ );
156
+ const SparkMark = ({ size = 20 }) => /* @__PURE__ */ jsxRuntime.jsx(
157
+ "span",
158
+ {
159
+ className: "chatBot--spark-mark",
160
+ style: { width: size, height: size, borderRadius: Math.round(size * 0.3) },
161
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
162
+ "svg",
163
+ {
164
+ viewBox: "0 0 24 24",
165
+ stroke: "currentColor",
166
+ fill: "none",
167
+ strokeWidth: "2",
168
+ style: { width: "58%", height: "58%" },
169
+ children: [
170
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z" }),
171
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 3l.6 1.8L21 5.4l-1.4.6L19 7.8l-.6-1.8L17 5.4l1.4-.6z" })
172
+ ]
173
+ }
174
+ )
175
+ }
176
+ );
177
+ const IcInvoice = ({ size = 14 }) => /* @__PURE__ */ jsxRuntime.jsxs(
178
+ "svg",
179
+ {
180
+ viewBox: "0 0 24 24",
181
+ stroke: "currentColor",
182
+ fill: "none",
183
+ strokeWidth: "2",
184
+ style: { width: size, height: size, flexShrink: 0 },
185
+ children: [
186
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
187
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "14 2 14 8 20 8" }),
188
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "8", y1: "13", x2: "16", y2: "13" }),
189
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "8", y1: "17", x2: "14", y2: "17" })
190
+ ]
191
+ }
192
+ );
193
+ const SparkSvg = ({ size = 12 }) => /* @__PURE__ */ jsxRuntime.jsxs(
194
+ "svg",
195
+ {
196
+ viewBox: "0 0 24 24",
197
+ stroke: "currentColor",
198
+ fill: "none",
199
+ strokeWidth: "2",
200
+ style: { width: size, height: size, flexShrink: 0 },
201
+ children: [
202
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z" }),
203
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 3l.6 1.8L21 5.4l-1.4.6L19 7.8l-.6-1.8L17 5.4l1.4-.6z" })
204
+ ]
205
+ }
206
+ );
207
+ const IcInfo = ({ size = 14 }) => /* @__PURE__ */ jsxRuntime.jsxs(
208
+ "svg",
209
+ {
210
+ viewBox: "0 0 24 24",
211
+ stroke: "currentColor",
212
+ fill: "none",
213
+ strokeWidth: "2",
214
+ strokeLinecap: "round",
215
+ strokeLinejoin: "round",
216
+ style: { width: size, height: size, flexShrink: 0, fill: "none" },
217
+ children: [
218
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
219
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
220
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
221
+ ]
222
+ }
223
+ );
224
+ const SLASH_COMMANDS = [
225
+ // {
226
+ // id: 'conversation',
227
+ // label: 'Conversation',
228
+ // description: 'Chat with the ERP AI assistant'
229
+ // },
230
+ // {
231
+ // id: 'agent',
232
+ // label: 'Agent',
233
+ // description: 'Let AI take actions in your ERP'
234
+ // },
235
+ // {
236
+ // id: 'doc_qa',
237
+ // label: 'Document',
238
+ // description: 'Upload a document and ask questions about it'
239
+ // },
240
+ {
241
+ id: "smart",
242
+ label: "Smart",
243
+ description: "Automatically routes your query to the right service"
244
+ }
245
+ ];
246
+ const INSIGHTS = [
247
+ { icon: IcWarning, kind: "red", title: "Overdue invoices need attention", sub: "Review receivables aging for payment follow-up" },
248
+ { icon: IcBox, kind: "amber", title: "Items below reorder level detected", sub: "Check inventory before the next purchase order cycle" },
249
+ { icon: IcCalendar, kind: "blue", title: "Pending leave requests awaiting approval", sub: "Some requests are past the standard SLA" }
250
+ ];
251
+ const SUGGEST_TILES = [
252
+ { icon: IcSearch, kind: "", cat: "ASK", mode: "conversation", prompt: "List the 5 most recent purchase orders" },
253
+ { icon: IcSearch, kind: "", cat: "ASK", mode: "conversation", prompt: "Show me journal entries from last month" },
254
+ { icon: IcBolt, kind: "amber", cat: "AGENT", mode: "agent", formType: "sales_invoice", prompt: "Create a sales invoice" },
255
+ { icon: IcBolt, kind: "amber", cat: "AGENT", mode: "agent", formType: "purchase_invoice", prompt: "Create a purchase invoice" },
256
+ { icon: IcSearch, kind: "blue", cat: "DOC", mode: "doc_qa", prompt: "Upload a document to get started" },
257
+ { icon: IcTarget, kind: "blue", cat: "DOC", mode: "doc_qa", prompt: "Ask questions about any uploaded document" }
258
+ ];
259
+ const MAX_ATTACHED_DOCS = 10;
260
+ const HISTORY_PAGE_SIZE = 20;
261
+ const historyServiceForMode = (mode) => {
262
+ if (mode === "smart") return "copilot_smart";
263
+ if (mode === "conversation" || mode === "doc_qa") return "copilot_chat";
264
+ return null;
265
+ };
266
+ const toTimestamp = (value) => value ? new Date(value).getTime() || 0 : 0;
267
+ const toChatSession = (session) => {
268
+ var _a, _b;
269
+ const createdAt = toTimestamp(session.created_at);
270
+ return {
271
+ id: session.session_id,
272
+ title: session.title || ((_a = session.metadata) == null ? void 0 : _a.title) || "New chat",
273
+ service: session.service,
274
+ totalMessages: session.total_messages ?? ((_b = session.metadata) == null ? void 0 : _b.total_messages) ?? 0,
275
+ createdAt,
276
+ updatedAt: toTimestamp(session.updated_at) || createdAt
277
+ };
278
+ };
279
+ const toChatMessages = (messages, mode) => {
280
+ const baseId = Date.now();
281
+ return messages.map((m, i) => ({
282
+ id: baseId + i,
283
+ role: m.role === "user" ? "user" : "ai",
284
+ text: m.content ?? "",
285
+ mode
286
+ }));
287
+ };
288
+ const groupChatSessions = (sessions) => {
289
+ const startOfToday = /* @__PURE__ */ new Date();
290
+ startOfToday.setHours(0, 0, 0, 0);
291
+ const today = startOfToday.getTime();
292
+ const yesterday = today - 24 * 60 * 60 * 1e3;
293
+ const weekAgo = today - 7 * 24 * 60 * 60 * 1e3;
294
+ const groups = [
295
+ { label: "Today", sessions: [] },
296
+ { label: "Yesterday", sessions: [] },
297
+ { label: "Previous 7 days", sessions: [] },
298
+ { label: "Older", sessions: [] }
299
+ ];
300
+ [...sessions].sort((a, b) => b.updatedAt - a.updatedAt).forEach((s) => {
301
+ if (s.updatedAt >= today) groups[0].sessions.push(s);
302
+ else if (s.updatedAt >= yesterday) groups[1].sessions.push(s);
303
+ else if (s.updatedAt >= weekAgo) groups[2].sessions.push(s);
304
+ else groups[3].sessions.push(s);
305
+ });
306
+ return groups.filter((g) => g.sessions.length > 0);
307
+ };
308
+ const formatSessionTime = (ts) => {
309
+ const d = new Date(ts);
310
+ const startOfToday = /* @__PURE__ */ new Date();
311
+ startOfToday.setHours(0, 0, 0, 0);
312
+ if (ts >= startOfToday.getTime() - 24 * 60 * 60 * 1e3) {
313
+ return d.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
314
+ }
315
+ return d.toLocaleDateString([], { day: "numeric", month: "short" });
316
+ };
317
+ const ChatBotHistoryButton = ({ open, onClick }) => /* @__PURE__ */ jsxRuntime.jsxs(
318
+ "button",
319
+ {
320
+ type: "button",
321
+ className: `chatBot--history-btn ${open ? "chatBot--history-btn--active" : ""}`,
322
+ onClick,
323
+ "aria-pressed": open,
324
+ "aria-controls": "chatBot-history-panel",
325
+ children: [
326
+ /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.History, { style: { fontSize: 16 } }),
327
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "History" })
328
+ ]
329
+ }
330
+ );
331
+ const ChatBotHistoryIconButton = ({ open, onClick }) => /* @__PURE__ */ jsxRuntime.jsx(
332
+ "button",
333
+ {
334
+ type: "button",
335
+ className: `chatBot--hd-history-btn ${open ? "chatBot--hd-history-btn--active" : ""}`,
336
+ onClick,
337
+ "aria-label": "Chat history",
338
+ "aria-pressed": open,
339
+ title: "History",
340
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.History, { style: { fontSize: 18 } })
341
+ }
342
+ );
343
+ const ChatBotNewChatButton = ({ onClick }) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "chatBot--history-btn", onClick, children: [
344
+ /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Add, { style: { fontSize: 17 } }),
345
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "New chat" })
346
+ ] });
347
+ const ChatBotHistory = ({
348
+ open,
349
+ sessions,
350
+ activeId,
351
+ onClose,
352
+ onSelect,
353
+ onDelete,
354
+ loading = false,
355
+ error = null,
356
+ onRetry,
357
+ hasMore = false,
358
+ loadingMore = false,
359
+ onLoadMore,
360
+ unavailableMessage = null,
361
+ variant = "side"
362
+ }) => {
363
+ const { t } = reactI18next.useTranslation();
364
+ const [query, setQuery] = React.useState("");
365
+ const closeBtnRef = React.useRef(null);
366
+ const isEmbedded = variant === "embedded";
367
+ React.useEffect(() => {
368
+ if (open) setTimeout(() => {
369
+ var _a;
370
+ return (_a = closeBtnRef.current) == null ? void 0 : _a.focus();
371
+ }, 50);
372
+ else setQuery("");
373
+ }, [open]);
374
+ const groups = React.useMemo(() => {
375
+ if (unavailableMessage || loading || error) return [];
376
+ const q = query.trim().toLowerCase();
377
+ const filtered = q ? sessions.filter((s) => s.title.toLowerCase().includes(q)) : sessions;
378
+ return groupChatSessions(filtered);
379
+ }, [sessions, query, unavailableMessage, loading, error]);
380
+ if (!open) return null;
381
+ const Wrapper = isEmbedded ? "section" : "aside";
382
+ return /* @__PURE__ */ jsxRuntime.jsxs(
383
+ Wrapper,
384
+ {
385
+ id: "chatBot-history-panel",
386
+ className: isEmbedded ? "chatBot--history-embedded" : "chatBot--history-panel",
387
+ "aria-label": "Chat history",
388
+ onKeyDown: (e) => {
389
+ if (e.key === "Escape") onClose();
390
+ },
391
+ children: [
392
+ isEmbedded ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--history-head chatBot--history-head--embedded", children: [
393
+ /* @__PURE__ */ jsxRuntime.jsx("button", { ref: closeBtnRef, type: "button", className: "chatBot--history-icon-btn", onClick: onClose, "aria-label": "Back to chat", children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ChevronLeft, { style: { fontSize: 22 } }) }),
394
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--history-head-title", children: [
395
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { children: "History" }),
396
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--history-count", children: [
397
+ sessions.length,
398
+ hasMore ? "+" : "",
399
+ " ",
400
+ sessions.length === 1 && !hasMore ? "chat" : "chats"
401
+ ] })
402
+ ] })
403
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--history-head", children: [
404
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--history-head-title", children: [
405
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { children: "History" }),
406
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--history-count", children: [
407
+ sessions.length,
408
+ hasMore ? "+" : "",
409
+ " ",
410
+ sessions.length === 1 && !hasMore ? "chat" : "chats"
411
+ ] })
412
+ ] }),
413
+ /* @__PURE__ */ jsxRuntime.jsx("button", { ref: closeBtnRef, type: "button", className: "chatBot--history-icon-btn", onClick: onClose, "aria-label": "Close history", children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Close, { style: { fontSize: 18 } }) })
414
+ ] }),
415
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--history-search-wrap", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "chatBot--history-search", children: [
416
+ /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Search, { style: { fontSize: 16 } }),
417
+ /* @__PURE__ */ jsxRuntime.jsx(
418
+ "input",
419
+ {
420
+ "aria-label": "Search chats",
421
+ placeholder: "Search chats",
422
+ value: query,
423
+ onChange: (e) => setQuery(e.target.value)
424
+ }
425
+ )
426
+ ] }) }),
427
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--history-list", children: [
428
+ groups.map((group) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--history-group", children: [
429
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--history-group-lbl", children: group.label }),
430
+ group.sessions.map((s) => {
431
+ const isActive = s.id === activeId;
432
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `chatBot--history-row ${isActive ? "chatBot--history-row--active" : ""}`, children: [
433
+ /* @__PURE__ */ jsxRuntime.jsxs(
434
+ "button",
435
+ {
436
+ type: "button",
437
+ className: "chatBot--history-open",
438
+ onClick: () => onSelect(s),
439
+ "aria-current": isActive ? "true" : void 0,
440
+ title: s.title,
441
+ children: [
442
+ /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ChatBubbleOutline, { className: "chatBot--history-row-ic", style: { fontSize: 15 } }),
443
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--history-row-body", children: [
444
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--history-row-title", children: s.title }),
445
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--history-row-time", children: formatSessionTime(s.updatedAt) })
446
+ ] })
447
+ ]
448
+ }
449
+ ),
450
+ /* @__PURE__ */ jsxRuntime.jsx(
451
+ "button",
452
+ {
453
+ type: "button",
454
+ className: "chatBot--history-del",
455
+ onClick: () => onDelete(s),
456
+ "aria-label": `Delete chat: ${s.title}`,
457
+ title: "Delete chat",
458
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.DeleteOutline, { style: { fontSize: 17 } })
459
+ }
460
+ )
461
+ ] }, s.id);
462
+ })
463
+ ] }, group.label)),
464
+ unavailableMessage ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--history-empty", children: unavailableMessage }) : loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--history-empty", children: "Loading chats…" }) : error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--history-empty", children: [
465
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: "Couldn't load your chats." }),
466
+ onRetry && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "chatBot--history-more", onClick: onRetry, children: "Try again" })
467
+ ] }) : groups.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--history-empty", children: query ? "No chats found" : "No conversations yet. Your chats will appear here." }),
468
+ !unavailableMessage && !loading && !error && hasMore && onLoadMore && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--history-load-more", children: /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "chatBot--history-load-more-pill", onClick: onLoadMore, disabled: loadingMore, children: [
469
+ loadingMore ? "Loading…" : t("common.load_more"),
470
+ !loadingMore && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { size: 13 })
471
+ ] }) })
472
+ ] })
473
+ ]
474
+ }
475
+ );
476
+ };
477
+ const ChatBotHeader = ({ onClose, onNewChat, sessionTokens = 0, sessionMs = 0, onHistory, historyOpen = false }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
478
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--header", children: [
479
+ /* @__PURE__ */ jsxRuntime.jsx(SparkMark, { size: 34 }),
480
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--hd-info", children: [
481
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--hd-name", children: [
482
+ "NovaForce",
483
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--hd-beta", children: "Beta" })
484
+ ] }),
485
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--hd-sub", children: "AI-powered ERP assistant" })
486
+ ] }),
487
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--hd-actions", children: [
488
+ onHistory && /* @__PURE__ */ jsxRuntime.jsx(ChatBotHistoryIconButton, { open: historyOpen, onClick: onHistory }),
489
+ /* @__PURE__ */ jsxRuntime.jsx("button", { title: "New chat", onClick: onNewChat, children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Add, { style: { fontSize: 18 } }) }),
490
+ /* @__PURE__ */ jsxRuntime.jsx("button", { title: "Expand", children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.OpenInFullRounded, { style: { fontSize: 16 } }) }),
491
+ /* @__PURE__ */ jsxRuntime.jsx("button", { title: "Close", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Close, { style: { fontSize: 18 } }) })
492
+ ] })
493
+ ] }),
494
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--ctx-bar", children: [
495
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--ctx-chip", children: [
496
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--ctx-dot" }),
497
+ "ERP Data"
498
+ ] }),
499
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--ctx-label", children: "All modules · Live data" }),
500
+ sessionMs > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--ctx-session", children: [
501
+ "Session ",
502
+ sessionTokens > 0 ? `${formatTokens(sessionTokens)} tok · ` : "",
503
+ formatDuration(sessionMs)
504
+ ] })
505
+ ] })
506
+ ] });
507
+ const ChatBotWelcome = ({ firstName, onSuggestion, dynamicQuestions = [], mode, dashboardMode = false, inputSlot }) => {
508
+ const greeting = getGreeting();
509
+ const dynamicTiles = dynamicQuestions.map((dq) => ({
510
+ icon: IcSearch,
511
+ kind: dq.kind || "blue",
512
+ cat: dq.cat,
513
+ mode: dq.mode,
514
+ formType: dq.formType,
515
+ prompt: dq.prompt
516
+ }));
517
+ const askTiles = dynamicQuestions.length > 0 ? dynamicTiles : SUGGEST_TILES.filter((t) => t.cat === "ASK");
518
+ const agentTiles = SUGGEST_TILES.filter((t) => t.cat === "AGENT");
519
+ const docTiles = SUGGEST_TILES.filter((t) => t.cat === "DOC");
520
+ const displayTiles = mode === "smart" ? [...askTiles, ...agentTiles, ...docTiles] : mode === "conversation" ? askTiles : mode === "agent" ? agentTiles : docTiles;
521
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `chatBot--welcome ${dashboardMode ? "chatBot--welcome--center" : ""}`, children: [
522
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--greeting", children: dashboardMode ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
523
+ "Hi ",
524
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--grad", children: firstName }),
525
+ ", how's your day going?"
526
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
527
+ greeting,
528
+ firstName && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
529
+ ", ",
530
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--grad", children: firstName })
531
+ ] })
532
+ ] }) }),
533
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--greeting-sub", children: dashboardMode ? "Shall we start with your action items, or with what's on your agenda today?" : "NovaForce is watching your ERP data. Here's what stands out today." }),
534
+ inputSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--welcome-input", children: inputSlot }),
535
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--section-lbl", children: [
536
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Try asking" }),
537
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--ln" })
538
+ ] }),
539
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--suggest-grid", children: displayTiles.map((tile, i) => /* @__PURE__ */ jsxRuntime.jsxs(
540
+ "button",
541
+ {
542
+ className: "chatBot--suggest-tile",
543
+ onClick: () => onSuggestion(tile.prompt, tile.mode, tile.formType),
544
+ children: [
545
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--suggest-head", children: [
546
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: `chatBot--ic chatBot--ic--${tile.kind}`, children: /* @__PURE__ */ jsxRuntime.jsx(tile.icon, { size: 13 }) }),
547
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--suggest-cat", children: tile.cat })
548
+ ] }),
549
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--suggest-prompt", children: tile.prompt })
550
+ ]
551
+ },
552
+ i
553
+ )) })
554
+ ] });
555
+ };
556
+ const DEFAULT_CURRENCY = "AED";
557
+ function formatDeltaAmount(delta) {
558
+ if (delta.unit === "new") return "New";
559
+ const amount = +Math.abs(delta.value).toFixed(1);
560
+ return delta.unit === "percent" ? `${amount}%` : `${amount}`;
561
+ }
562
+ function formatProvenance(provenance, { currency, rowCount } = {}) {
563
+ var _a, _b;
564
+ const rows = (provenance == null ? void 0 : provenance.row_count) ?? rowCount;
565
+ return [
566
+ (_a = provenance == null ? void 0 : provenance.source) == null ? void 0 : _a.trim(),
567
+ (_b = provenance == null ? void 0 : provenance.period) == null ? void 0 : _b.trim(),
568
+ typeof rows === "number" ? `${rows.toLocaleString("en-US")} ${rows === 1 ? "record" : "records"}` : void 0,
569
+ currency
570
+ ].filter(Boolean).join(" · ");
571
+ }
572
+ function CardFooter({
573
+ provenance,
574
+ rowCount,
575
+ currency
576
+ }) {
577
+ const text = formatProvenance(provenance, { rowCount });
578
+ if (!text && !currency) return null;
579
+ return /* @__PURE__ */ jsxRuntime.jsxs("footer", { className: "card-footer", children: [
580
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "card-footer__dot", "aria-hidden": "true" }),
581
+ text && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "card-footer__text", children: [
582
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "card-footer__sr", children: "Source: " }),
583
+ text
584
+ ] }),
585
+ currency && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
586
+ text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "card-footer__sep", children: "·" }),
587
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "card-footer__chip", children: currency })
588
+ ] })
589
+ ] });
590
+ }
591
+ const HALF_WIDTH = 70;
592
+ const HEIGHT = 50;
593
+ const GAP = 8;
594
+ function exactValue(value, format, currency = DEFAULT_CURRENCY) {
595
+ const number = value.toLocaleString("en-US", { maximumFractionDigits: 2 });
596
+ if (format === "percent") return `${number}%`;
597
+ return format === "currency" ? `${currency} ${number}` : number;
598
+ }
599
+ function useTip() {
600
+ const [tip, setTip] = React.useState(null);
601
+ const bind = React.useCallback(
602
+ (content) => ({
603
+ onMouseEnter: (e) => {
604
+ const r = e.currentTarget.getBoundingClientRect();
605
+ setTip({ ...content, x: r.left + r.width / 2, top: r.top, bottom: r.bottom });
606
+ },
607
+ onMouseLeave: () => setTip(null)
608
+ }),
609
+ []
610
+ );
611
+ const below = tip ? tip.top < HEIGHT : false;
612
+ const tooltip = tip ? ReactDOM.createPortal(
613
+ /* @__PURE__ */ jsxRuntime.jsxs(
614
+ "div",
615
+ {
616
+ className: "gen-tip",
617
+ style: {
618
+ left: Math.min(Math.max(tip.x, HALF_WIDTH), window.innerWidth - HALF_WIDTH),
619
+ top: below ? tip.bottom + GAP : tip.top - GAP,
620
+ transform: below ? "translateX(-50%)" : "translate(-50%, -100%)"
621
+ },
622
+ children: [
623
+ tip.title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "gen-tip__title", children: tip.title }),
624
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "gen-tip__value", children: tip.value })
625
+ ]
626
+ }
627
+ ),
628
+ document.body
629
+ ) : null;
630
+ return { bind, tooltip };
631
+ }
632
+ const MONTHS = {
633
+ jan: "January",
634
+ feb: "February",
635
+ mar: "March",
636
+ apr: "April",
637
+ may: "May",
638
+ jun: "June",
639
+ jul: "July",
640
+ aug: "August",
641
+ sep: "September",
642
+ oct: "October",
643
+ nov: "November",
644
+ dec: "December"
645
+ };
646
+ const fullMonth = (label) => MONTHS[label.slice(0, 3).toLowerCase()] ?? label;
647
+ function compact(value) {
648
+ const abs = Math.abs(value);
649
+ if (abs >= 1e9) return `${Math.round(value / 1e7) / 100}B`;
650
+ if (abs >= 1e6) return `${Math.round(value / 1e4) / 100}M`;
651
+ if (abs >= 1e3) return `${Math.round(value / 100) / 10}K`;
652
+ return `${value}`;
653
+ }
654
+ function formatValue(value, format, currency = DEFAULT_CURRENCY) {
655
+ if (format === "percent") return `${value}%`;
656
+ if (format === "currency") return `${currency} ${compact(value)}`;
657
+ return compact(value);
658
+ }
659
+ function buildHeadline$7(metric, series, currency) {
660
+ const subject = metric.label.split("·")[0].trim();
661
+ let text = `${subject} is sitting at ${formatValue(metric.value, metric.format, currency)}`;
662
+ const { delta } = metric;
663
+ if (delta && delta.direction !== "flat") {
664
+ const change = delta.unit === "new" ? "new this period" : `${delta.direction} ${formatDeltaAmount(delta)}`;
665
+ text += `, ${change}${delta.basis ? ` ${delta.basis}` : ""}`;
666
+ }
667
+ if (series == null ? void 0 : series.points.length) {
668
+ const peak = series.points.reduce((max, p) => p.value > max.value ? p : max);
669
+ text += `, with the peak in ${fullMonth(peak.label)}`;
670
+ }
671
+ return `${text}.`;
672
+ }
673
+ const SKEW_RATIO = 20;
674
+ function scaleValues(values) {
675
+ const positives = values.filter((v) => v > 0).sort((a, b) => a - b);
676
+ const median = positives[Math.floor(positives.length / 2)] ?? 0;
677
+ const skewed = positives.length > 1 && median > 0 && positives[positives.length - 1] / median > SKEW_RATIO;
678
+ return skewed ? (v) => Math.sign(v) * Math.log10(1 + Math.abs(v)) : (v) => v;
679
+ }
680
+ const BAR_MIN_WIDTH = 52;
681
+ const DELTA_ARROW = { up: "↑", down: "↓", flat: "→" };
682
+ function splitValue(value, format, currency) {
683
+ if (format === "currency") return { unit: currency, figure: compact(value) };
684
+ if (format === "percent") return { unit: void 0, figure: `${value}%` };
685
+ return { unit: void 0, figure: compact(value) };
686
+ }
687
+ const AREA_W = 160;
688
+ const AREA_H = 56;
689
+ const AREA_PAD = 6;
690
+ function smoothPath(coords) {
691
+ const clampY = (y, a, b) => Math.min(Math.max(y, Math.min(a, b)), Math.max(a, b));
692
+ let d = `M${coords[0][0].toFixed(1)},${coords[0][1].toFixed(1)}`;
693
+ for (let i = 0; i < coords.length - 1; i++) {
694
+ const p0 = coords[i - 1] ?? coords[i];
695
+ const p1 = coords[i];
696
+ const p2 = coords[i + 1];
697
+ const p3 = coords[i + 2] ?? p2;
698
+ const c1x = p1[0] + (p2[0] - p0[0]) / 6;
699
+ const c1y = clampY(p1[1] + (p2[1] - p0[1]) / 6, p1[1], p2[1]);
700
+ const c2x = p2[0] - (p3[0] - p1[0]) / 6;
701
+ const c2y = clampY(p2[1] - (p3[1] - p1[1]) / 6, p1[1], p2[1]);
702
+ d += ` C${c1x.toFixed(1)},${c1y.toFixed(1)} ${c2x.toFixed(1)},${c2y.toFixed(1)} ${p2[0].toFixed(1)},${p2[1].toFixed(1)}`;
703
+ }
704
+ return d;
705
+ }
706
+ function AreaTrend({ data, className = "metric-hero__trend", tone }) {
707
+ const gradientId = React.useId();
708
+ if (data.length < 2) return null;
709
+ const scale = scaleValues(data);
710
+ const scaled = data.map(scale);
711
+ const min = Math.min(...scaled);
712
+ const range = Math.max(...scaled) - min || 1;
713
+ const step = (AREA_W - AREA_PAD * 2) / (data.length - 1);
714
+ const baseY = AREA_H - AREA_PAD;
715
+ const coords = data.map((v, i) => [AREA_PAD + i * step, baseY - (scale(v) - min) / range * (AREA_H - AREA_PAD * 2)]);
716
+ const line = smoothPath(coords);
717
+ const first = coords[0];
718
+ const last = coords[coords.length - 1];
719
+ const area = `${line} L${last[0].toFixed(1)},${baseY} L${first[0].toFixed(1)},${baseY} Z`;
720
+ const peak = data.reduce((best, v, i) => v > data[best] ? i : best, 0);
721
+ const at = ([x, y]) => ({ left: `${x / AREA_W * 100}%`, top: `${y / AREA_H * 100}%` });
722
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `area-trend ${className}${tone ? ` area-trend--${tone}` : ""}`, "aria-hidden": "true", children: [
723
+ /* @__PURE__ */ jsxRuntime.jsxs("svg", { viewBox: `0 0 ${AREA_W} ${AREA_H}`, preserveAspectRatio: "none", children: [
724
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
725
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: "currentColor", stopOpacity: 0.22 }),
726
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: "currentColor", stopOpacity: 0 })
727
+ ] }) }),
728
+ /* @__PURE__ */ jsxRuntime.jsx("line", { className: "area-trend__baseline", x1: first[0], x2: last[0], y1: baseY, y2: baseY, vectorEffect: "non-scaling-stroke" }),
729
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: area, fill: `url(#${gradientId})` }),
730
+ /* @__PURE__ */ jsxRuntime.jsx(
731
+ "path",
732
+ {
733
+ d: line,
734
+ fill: "none",
735
+ stroke: "currentColor",
736
+ strokeWidth: 2,
737
+ strokeLinejoin: "round",
738
+ strokeLinecap: "round",
739
+ vectorEffect: "non-scaling-stroke"
740
+ }
741
+ )
742
+ ] }),
743
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "area-trend__marker", style: at(coords[peak]) }),
744
+ peak !== coords.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "area-trend__marker area-trend__marker--end", style: at(last) })
745
+ ] });
746
+ }
747
+ function MetricHero({ label, value, format, delta, sparkline_data, currency = DEFAULT_CURRENCY }) {
748
+ const { unit, figure } = splitValue(value, format, currency);
749
+ const { bind, tooltip } = useTip();
750
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "metric-hero", children: [
751
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "metric-hero__body", children: [
752
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "metric-hero__label", children: label }),
753
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "metric-hero__value", ...bind({ title: label, value: exactValue(value, format, currency) }), children: [
754
+ unit && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "metric-hero__unit", children: unit }),
755
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "metric-hero__figure", children: figure })
756
+ ] }),
757
+ delta && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "metric-hero__delta", children: [
758
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `metric-hero__pill metric-hero__pill--${delta.polarity}`, children: [
759
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "metric-hero__arrow", children: DELTA_ARROW[delta.direction] }),
760
+ formatDeltaAmount(delta)
761
+ ] }),
762
+ delta.basis && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "metric-hero__basis", children: delta.basis })
763
+ ] })
764
+ ] }),
765
+ sparkline_data && /* @__PURE__ */ jsxRuntime.jsx(AreaTrend, { data: sparkline_data, tone: delta == null ? void 0 : delta.polarity }),
766
+ tooltip
767
+ ] });
768
+ }
769
+ function PillBars({ label, points, emphasis_index, format, currency = DEFAULT_CURRENCY }) {
770
+ const { bind, tooltip } = useTip();
771
+ const scale = scaleValues(points.map((p) => p.value));
772
+ const max = Math.max(...points.map((p) => scale(p.value)), 0);
773
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pill-bars", children: [
774
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "pill-bars__label", children: label }),
775
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pill-bars__plot", style: { gridTemplateColumns: `repeat(${points.length}, minmax(${BAR_MIN_WIDTH}px, 1fr))` }, children: points.map((p, i) => {
776
+ const active = i === emphasis_index;
777
+ const height = max > 0 && p.value > 0 ? `max(${scale(p.value) / max * 100}%, 8px)` : "0";
778
+ return /* @__PURE__ */ jsxRuntime.jsxs(
779
+ "div",
780
+ {
781
+ className: `pill-bars__col${active ? " is-active" : ""}`,
782
+ ...bind({ title: p.label, value: exactValue(p.value, format, currency) }),
783
+ children: [
784
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pill-bars__value", children: format === "percent" ? `${p.value}%` : compact(p.value) }),
785
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pill-bars__track", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pill-bars__bar", style: { height } }) }),
786
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pill-bars__axis-label", children: p.label })
787
+ ]
788
+ },
789
+ p.label
790
+ );
791
+ }) }),
792
+ tooltip
793
+ ] });
794
+ }
795
+ function MetricCard({
796
+ payload = [],
797
+ currency = DEFAULT_CURRENCY
798
+ }) {
799
+ var _a, _b, _c;
800
+ const blocks = payload.flatMap((item) => item.data);
801
+ const metric = (_a = blocks.find((b) => b.type === "metric")) == null ? void 0 : _a.props;
802
+ const series = (_b = blocks.find((b) => b.type === "bar_series")) == null ? void 0 : _b.props;
803
+ const provenance = (_c = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _c.props;
804
+ const headline = React.useMemo(
805
+ () => metric ? buildHeadline$7(metric, series, currency) : null,
806
+ [metric, series, currency]
807
+ );
808
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "metric-card", children: /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "metric-card__panel", children: [
809
+ headline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "metric-card__headline", children: headline }),
810
+ metric && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "metric-card__hero", children: /* @__PURE__ */ jsxRuntime.jsx(MetricHero, { ...metric, currency }) }),
811
+ series && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "metric-card__section", children: /* @__PURE__ */ jsxRuntime.jsx(PillBars, { ...series, currency }) }),
812
+ provenance && /* @__PURE__ */ jsxRuntime.jsx(CardFooter, { provenance, currency: (metric == null ? void 0 : metric.format) === "currency" ? currency : void 0 })
813
+ ] }) });
814
+ }
815
+ const splitLabel = (label) => {
816
+ const [name, ...rest] = label.split("·").map((s) => s.trim());
817
+ return { name, period: rest.join(" · ") || void 0 };
818
+ };
819
+ function buildHeadline$6(metrics, currency) {
820
+ if (metrics.length === 0) return null;
821
+ const parts = metrics.map((m) => ({ ...splitLabel(m.label), m }));
822
+ const fmt = (m) => formatValue(m.value, m.format, currency);
823
+ const sameMetric = parts.every((p) => p.name === parts[0].name && p.period);
824
+ if (sameMetric && metrics.every((m) => m.format !== "percent")) {
825
+ const total = metrics.reduce((sum, m) => sum + m.value, 0);
826
+ const top = parts.reduce((a, b) => b.m.value > a.m.value ? b : a);
827
+ const first = parts[0].period;
828
+ const last = parts[parts.length - 1].period;
829
+ return `${parts[0].name} across ${first} to ${last} totals ${formatValue(total, metrics[0].format, currency)}, with ${top.period} the largest at ${fmt(top.m)}.`;
830
+ }
831
+ const items = parts.map((p, i) => i === 0 ? `${p.name} is ${fmt(p.m)}` : `${p.name} ${fmt(p.m)}`);
832
+ const sentence = items.length > 1 ? `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}` : items[0];
833
+ return `${sentence}.`;
834
+ }
835
+ function MetricTile({ metric, currency = DEFAULT_CURRENCY }) {
836
+ const { name, period } = splitLabel(metric.label);
837
+ const { delta } = metric;
838
+ const { unit, figure } = splitValue(metric.value, metric.format, currency);
839
+ const { bind, tooltip } = useTip();
840
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "metric-tile", children: [
841
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "metric-tile__header", children: [
842
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "metric-tile__name", children: name }),
843
+ period && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "metric-tile__period", children: period })
844
+ ] }),
845
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "metric-tile__value", ...bind({ title: metric.label, value: exactValue(metric.value, metric.format, currency) }), children: [
846
+ unit && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "metric-tile__unit", children: unit }),
847
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "metric-tile__figure", children: figure })
848
+ ] }),
849
+ (delta || metric.sparkline_data) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "metric-tile__footer", children: [
850
+ delta && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `metric-tile__badge metric-tile__badge--${delta.polarity}`, children: [
851
+ DELTA_ARROW[delta.direction],
852
+ " ",
853
+ formatDeltaAmount(delta)
854
+ ] }),
855
+ (delta == null ? void 0 : delta.basis) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "metric-tile__basis", children: delta.basis }),
856
+ metric.sparkline_data && /* @__PURE__ */ jsxRuntime.jsx(AreaTrend, { data: metric.sparkline_data, className: "metric-tile__trend", tone: delta == null ? void 0 : delta.polarity })
857
+ ] }),
858
+ tooltip
859
+ ] });
860
+ }
861
+ const columnsFor = (count) => count <= 3 ? Math.max(count, 1) : 2;
862
+ function MetricRow({ metrics, currency = DEFAULT_CURRENCY }) {
863
+ const columns = columnsFor(metrics.length);
864
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "metric-row", "data-cols": columns, style: { ["--metric-row-cols"]: columns }, children: metrics.map((m, i) => /* @__PURE__ */ jsxRuntime.jsx(MetricTile, { metric: m, currency }, `${m.label}-${i}`)) });
865
+ }
866
+ function MetricRowCard({
867
+ payload = [],
868
+ currency = DEFAULT_CURRENCY
869
+ }) {
870
+ var _a, _b, _c;
871
+ const blocks = payload.flatMap((item) => item.data);
872
+ const row = (_a = blocks.find((b) => b.type === "metric_row")) == null ? void 0 : _a.props;
873
+ const series = (_b = blocks.find((b) => b.type === "bar_series")) == null ? void 0 : _b.props;
874
+ const provenance = (_c = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _c.props;
875
+ const headline = React.useMemo(() => row ? buildHeadline$6(row.metrics, currency) : null, [row, currency]);
876
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "metric-row-card", children: /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "metric-row-card__panel", children: [
877
+ headline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "metric-row-card__headline", children: headline }),
878
+ row && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "metric-row-card__section", children: /* @__PURE__ */ jsxRuntime.jsx(MetricRow, { metrics: row.metrics, currency }) }),
879
+ series && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "metric-row-card__section", children: /* @__PURE__ */ jsxRuntime.jsx(PillBars, { ...series, currency }) }),
880
+ provenance && /* @__PURE__ */ jsxRuntime.jsx(CardFooter, { provenance, currency })
881
+ ] }) });
882
+ }
883
+ function changeBetween(current, previous) {
884
+ if (!previous) return null;
885
+ if (current.value === previous.value) {
886
+ return { value: 0, unit: "percent", direction: "flat", polarity: "neutral" };
887
+ }
888
+ if (previous.value === 0) return null;
889
+ const change = (current.value - previous.value) / Math.abs(previous.value) * 100;
890
+ const up = change > 0;
891
+ return {
892
+ value: Math.round(Math.abs(change) * 10) / 10,
893
+ unit: "percent",
894
+ direction: up ? "up" : "down",
895
+ polarity: up ? "positive" : "negative"
896
+ };
897
+ }
898
+ function resolveDelta({ delta, entries }) {
899
+ return delta ?? changeBetween(entries[0], entries[1]);
900
+ }
901
+ const arrowFor = (delta) => DELTA_ARROW[delta.direction];
902
+ const hasChange = (delta) => !!delta && delta.direction !== "flat" && delta.value !== 0;
903
+ const periodText = (label) => /^(this|last|previous|current)\b/i.test(label) ? label.toLowerCase() : label;
904
+ const withPeriod = (name, entry) => /^(this|last|previous|current)\b/i.test(entry.label) ? `${name} ${periodText(entry.label)}` : `${name} in ${entry.label}`;
905
+ function buildHeadline$5(props, delta, currency) {
906
+ const { entries } = props;
907
+ const [current, previous] = entries;
908
+ if (!current) return null;
909
+ const fmt = (v) => formatValue(v, props.format, currency);
910
+ const subject = `${withPeriod(props.label, current)} are ${fmt(current.value)}`;
911
+ if (!previous) return `${subject}.`;
912
+ const prev = `${periodText(previous.label)}'s ${fmt(previous.value)}`;
913
+ let text;
914
+ if (!delta) text = `${subject}, compared with ${prev}`;
915
+ else if (!hasChange(delta)) text = `${subject}, identical to ${prev}, so there's no change`;
916
+ else text = `${subject}, ${delta.direction} ${formatDeltaAmount(delta)} from ${prev}`;
917
+ if (entries.length > 2) {
918
+ const values = entries.map((e) => e.value);
919
+ if (current.value === Math.max(...values) && current.value !== Math.min(...values)) {
920
+ text += ` — the highest of the ${entries.length} periods shown`;
921
+ } else if (current.value === Math.min(...values) && current.value !== Math.max(...values)) {
922
+ text += ` — the lowest of the ${entries.length} periods shown`;
923
+ }
924
+ }
925
+ return `${text}.`;
926
+ }
927
+ function Comparison({ props, currency = DEFAULT_CURRENCY }) {
928
+ const { entries } = props;
929
+ const [current, previous] = entries;
930
+ if (!current) return null;
931
+ const delta = resolveDelta(props);
932
+ const fmt = (v) => formatValue(v, props.format, currency);
933
+ const history = entries.slice(1);
934
+ const { bind, tooltip } = useTip();
935
+ const { unit, figure } = splitValue(current.value, props.format, currency);
936
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "comparison", children: [
937
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "comparison__tile", children: [
938
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "comparison__header", children: [
939
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "comparison__name", children: props.label }),
940
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "comparison__period", children: current.label })
941
+ ] }),
942
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "comparison__value", ...bind({ title: current.label, value: exactValue(current.value, props.format, currency) }), children: [
943
+ unit && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "comparison__unit", children: unit }),
944
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "comparison__figure", children: figure })
945
+ ] }),
946
+ hasChange(delta) && previous && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "comparison__delta", children: [
947
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `comparison__badge comparison__badge--${delta.polarity}`, children: [
948
+ arrowFor(delta),
949
+ " ",
950
+ formatDeltaAmount(delta)
951
+ ] }),
952
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "comparison__basis", children: delta.basis ?? `vs. ${periodText(previous.label)}` })
953
+ ] })
954
+ ] }),
955
+ history.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "comparison__history", children: history.map((entry, i) => {
956
+ const rowDelta = history.length > 1 ? changeBetween(entry, history[i + 1]) : null;
957
+ return /* @__PURE__ */ jsxRuntime.jsxs(
958
+ "div",
959
+ {
960
+ className: "comparison__previous",
961
+ ...bind({ title: entry.label, value: exactValue(entry.value, props.format, currency) }),
962
+ children: [
963
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "comparison__previous-label", children: entry.label }),
964
+ hasChange(rowDelta) && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `comparison__row-badge comparison__badge--${rowDelta.polarity}`, children: [
965
+ arrowFor(rowDelta),
966
+ " ",
967
+ rowDelta.value,
968
+ "%"
969
+ ] }),
970
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "comparison__previous-value", children: fmt(entry.value) })
971
+ ]
972
+ },
973
+ `${entry.label}-${i}`
974
+ );
975
+ }) }),
976
+ tooltip
977
+ ] });
978
+ }
979
+ function ComparisonCard({
980
+ payload = [],
981
+ currency = DEFAULT_CURRENCY
982
+ }) {
983
+ var _a, _b;
984
+ const blocks = payload.flatMap((item) => item.data);
985
+ const comparison = (_a = blocks.find((b) => b.type === "comparison")) == null ? void 0 : _a.props;
986
+ const provenance = (_b = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _b.props;
987
+ const headline = React.useMemo(
988
+ () => comparison ? buildHeadline$5(comparison, resolveDelta(comparison), currency) : null,
989
+ [comparison, currency]
990
+ );
991
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "comparison-card", children: /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "comparison-card__panel", children: [
992
+ headline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "comparison-card__headline", children: headline }),
993
+ comparison && /* @__PURE__ */ jsxRuntime.jsx(Comparison, { props: comparison, currency }),
994
+ provenance && /* @__PURE__ */ jsxRuntime.jsx(CardFooter, { provenance, currency })
995
+ ] }) });
996
+ }
997
+ const peakIndex = (points) => points.reduce((best, p, i) => p.value > points[best].value ? i : best, 0);
998
+ const isMonth = (label) => fullMonth(label) !== label;
999
+ function buildHeadline$4({ label, points, format }, currency) {
1000
+ if (points.length === 0) return null;
1001
+ const fmt = (v) => formatValue(v, format, currency);
1002
+ const unit = points.every((p) => isMonth(p.label)) ? "months" : "periods";
1003
+ const total = points.reduce((sum, p) => sum + p.value, 0);
1004
+ let text = `The past ${points.length} ${unit} delivered ${fmt(total)} in ${label.toLowerCase()}`;
1005
+ if (total > 0) {
1006
+ const peak = points[peakIndex(points)];
1007
+ text += `, driven primarily by the ${fullMonth(peak.label)} figure (${fmt(peak.value)})`;
1008
+ }
1009
+ return `${text}.`;
1010
+ }
1011
+ function SeriesSummary({ label, points, format, currency = DEFAULT_CURRENCY }) {
1012
+ if (points.length === 0) return null;
1013
+ const latest = points[points.length - 1];
1014
+ const peak = points[peakIndex(points)];
1015
+ const { unit, figure } = splitValue(latest.value, format, currency);
1016
+ const { bind, tooltip } = useTip();
1017
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "series-summary", children: [
1018
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "series-summary__header", children: [
1019
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "series-summary__name", children: label }),
1020
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "series-summary__period", children: latest.label })
1021
+ ] }),
1022
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "series-summary__main", children: [
1023
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "series-summary__body", children: [
1024
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "series-summary__value", ...bind({ title: latest.label, value: exactValue(latest.value, format, currency) }), children: [
1025
+ unit && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "series-summary__unit", children: unit }),
1026
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "series-summary__figure", children: figure })
1027
+ ] }),
1028
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "series-summary__peak", children: [
1029
+ "Peak: ",
1030
+ peak.label,
1031
+ " · ",
1032
+ formatValue(peak.value, format, currency)
1033
+ ] })
1034
+ ] }),
1035
+ /* @__PURE__ */ jsxRuntime.jsx(AreaTrend, { data: points.map((p) => p.value), className: "series-summary__trend" })
1036
+ ] }),
1037
+ tooltip
1038
+ ] });
1039
+ }
1040
+ function BarSeriesCard({
1041
+ payload = [],
1042
+ currency = DEFAULT_CURRENCY
1043
+ }) {
1044
+ var _a, _b;
1045
+ const blocks = payload.flatMap((item) => item.data);
1046
+ const series = (_a = blocks.find((b) => b.type === "bar_series")) == null ? void 0 : _a.props;
1047
+ const provenance = (_b = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _b.props;
1048
+ const headline = React.useMemo(() => series ? buildHeadline$4(series, currency) : null, [series, currency]);
1049
+ const emphasis = series ? series.emphasis_index ?? peakIndex(series.points) : void 0;
1050
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bar-series-card", children: /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "bar-series-card__panel", children: [
1051
+ headline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "bar-series-card__headline", children: headline }),
1052
+ series && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1053
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bar-series-card__section bar-series-card__section--hero", children: /* @__PURE__ */ jsxRuntime.jsx(SeriesSummary, { ...series, currency }) }),
1054
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bar-series-card__section", children: /* @__PURE__ */ jsxRuntime.jsx(PillBars, { ...series, label: `${series.label} by period`, emphasis_index: emphasis, currency }) })
1055
+ ] }),
1056
+ /* @__PURE__ */ jsxRuntime.jsx(CardFooter, { provenance, rowCount: (series == null ? void 0 : series.points.length) ?? 0, currency })
1057
+ ] }) });
1058
+ }
1059
+ function formatFull(value, format, currency = DEFAULT_CURRENCY) {
1060
+ if (format === "percent") return `${value}%`;
1061
+ const number = value.toLocaleString("en-US", {
1062
+ minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
1063
+ maximumFractionDigits: 2
1064
+ });
1065
+ return format === "currency" ? `${currency} ${number}` : number;
1066
+ }
1067
+ const subjectOf = (label) => label.replace(/^top\s+/i, "").trim();
1068
+ const joinList = (items) => items.length > 1 ? `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}` : items[0];
1069
+ function buildHeadline$3({ label, entries, format }, currency) {
1070
+ if (entries.length === 0) return null;
1071
+ const list = entries.map((e) => `${e.label} (${formatFull(e.value, format, currency)})`);
1072
+ return `Our top ${entries.length} ${subjectOf(label)} are ${joinList(list)}.`;
1073
+ }
1074
+ function RankedBars({ label, entries, format, total_row_count, currency = DEFAULT_CURRENCY }) {
1075
+ const max = Math.max(...entries.map((e) => e.value), 0);
1076
+ const truncated = total_row_count !== void 0 && total_row_count > entries.length;
1077
+ const { bind, tooltip } = useTip();
1078
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ranked-bars", children: [
1079
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ranked-bars__heading", children: [
1080
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "ranked-bars__label", children: label }),
1081
+ truncated && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ranked-bars__count", children: [
1082
+ "Top ",
1083
+ entries.length,
1084
+ " of ",
1085
+ total_row_count
1086
+ ] })
1087
+ ] }),
1088
+ /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "ranked-bars__list", children: entries.map((e, i) => /* @__PURE__ */ jsxRuntime.jsxs(
1089
+ "li",
1090
+ {
1091
+ className: `ranked-bars__row${i === 0 ? " is-top" : ""}`,
1092
+ ...bind({ title: e.label, value: exactValue(e.value, format, currency) }),
1093
+ children: [
1094
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ranked-bars__line", children: [
1095
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ranked-bars__name", children: e.label }),
1096
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ranked-bars__value", children: formatFull(e.value, format, currency) })
1097
+ ] }),
1098
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ranked-bars__track", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ranked-bars__bar", style: { width: `${max > 0 ? Math.max(e.value / max * 100, 0) : 0}%` } }) })
1099
+ ]
1100
+ },
1101
+ `${e.label}-${i}`
1102
+ )) }),
1103
+ tooltip
1104
+ ] });
1105
+ }
1106
+ function RankedBarsCard({
1107
+ payload = [],
1108
+ currency = DEFAULT_CURRENCY
1109
+ }) {
1110
+ var _a, _b;
1111
+ const blocks = payload.flatMap((item) => item.data);
1112
+ const ranked = (_a = blocks.find((b) => b.type === "ranked_bars")) == null ? void 0 : _a.props;
1113
+ const provenance = (_b = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _b.props;
1114
+ const headline = React.useMemo(() => ranked ? buildHeadline$3(ranked, currency) : null, [ranked, currency]);
1115
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ranked-bars-card", children: /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "ranked-bars-card__panel", children: [
1116
+ headline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ranked-bars-card__headline", children: headline }),
1117
+ ranked && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ranked-bars-card__section", children: /* @__PURE__ */ jsxRuntime.jsx(RankedBars, { ...ranked, currency }) }),
1118
+ provenance && /* @__PURE__ */ jsxRuntime.jsx(CardFooter, { provenance, currency: (ranked == null ? void 0 : ranked.format) === "currency" ? currency : void 0 })
1119
+ ] }) });
1120
+ }
1121
+ const STATUS_COLOR_RULES = [
1122
+ { color: "#9f2f24", keywords: ["rejected", "cancelled", "canceled", "void", "refunded", "returned", "written off", "terminated", "declined"] },
1123
+ { color: "#c9402f", keywords: ["overdue", "failed", "late", "disputed", "expired", "blocked", "inactive", "deactive", "error"] },
1124
+ { color: "#b5690f", keywords: ["pending", "unpaid", "partially", "partial", "draft", "open", "submitted", "awaiting", "in progress", "on hold"] },
1125
+ { color: "#1f8a55", keywords: ["paid", "settled", "approved", "active", "completed", "complete", "closed", "delivered", "received", "posted"] }
1126
+ ];
1127
+ const NEUTRAL_COLOR = "#8a9099";
1128
+ const RULE_PATTERNS = STATUS_COLOR_RULES.map(({ color, keywords }) => ({
1129
+ color,
1130
+ match: new RegExp(`\\b(?:${keywords.join("|")})\\b`, "i")
1131
+ }));
1132
+ const colorForStatus = (label) => {
1133
+ var _a;
1134
+ return ((_a = RULE_PATTERNS.find((rule) => rule.match.test(label))) == null ? void 0 : _a.color) ?? NEUTRAL_COLOR;
1135
+ };
1136
+ const pct = (value, total) => total > 0 ? Math.round(value / total * 100) : 0;
1137
+ const resolveTotal = ({ total, segments }) => total ?? segments.reduce((sum, s) => sum + s.value, 0);
1138
+ function nounOf(label) {
1139
+ const base = label.split("·")[0].replace(/\s+by\s+.*$/i, "").replace(/\s+status$/i, "").trim().toLowerCase();
1140
+ return base.endsWith("s") ? base : `${base}s`;
1141
+ }
1142
+ function buildHeadline$2(props) {
1143
+ var _a;
1144
+ const { label, segments } = props;
1145
+ if (segments.length === 0) return null;
1146
+ const total = resolveTotal(props);
1147
+ const year = (_a = label.match(/\b(19|20)\d{2}\b/)) == null ? void 0 : _a[0];
1148
+ const [first] = segments;
1149
+ const overdue = segments.find((s) => s !== first && /overdue/i.test(s.label));
1150
+ const second = overdue ?? segments[1];
1151
+ let text = `Of ${total} ${nounOf(label)}${year ? ` in ${year}` : ""}, ${first.value} are ${first.label.toLowerCase()}`;
1152
+ if (second) text += ` and ${second.value} are ${second.label.toLowerCase()}`;
1153
+ return `${text}.`;
1154
+ }
1155
+ function Donut({ segments, total, size = 148, stroke = 20 }) {
1156
+ const radius = (size - stroke) / 2;
1157
+ const circumference = 2 * Math.PI * radius;
1158
+ const { bind, tooltip } = useTip();
1159
+ const gap = segments.filter((s) => s.value > 0).length > 1 ? 2 : 0;
1160
+ let offset = 0;
1161
+ const arcs = segments.map((seg) => {
1162
+ const length = total > 0 ? seg.value / total * circumference : 0;
1163
+ const visible = Math.max(length - gap, 0);
1164
+ const arc = /* @__PURE__ */ jsxRuntime.jsx(
1165
+ "circle",
1166
+ {
1167
+ cx: size / 2,
1168
+ cy: size / 2,
1169
+ r: radius,
1170
+ fill: "none",
1171
+ stroke: colorForStatus(seg.label),
1172
+ strokeWidth: stroke,
1173
+ strokeDasharray: `${visible} ${circumference - visible}`,
1174
+ strokeDashoffset: -offset,
1175
+ ...bind({ title: seg.label, value: `${seg.value.toLocaleString("en-US")} (${pct(seg.value, total)}%)` })
1176
+ },
1177
+ seg.label
1178
+ );
1179
+ offset += length;
1180
+ return arc;
1181
+ });
1182
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "status-donut__chart", style: { width: size, height: size }, children: [
1183
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, role: "img", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `rotate(-90 ${size / 2} ${size / 2})`, children: arcs }) }),
1184
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "status-donut__center", children: [
1185
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "status-donut__total", children: total }),
1186
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "status-donut__total-label", children: "Total" })
1187
+ ] }),
1188
+ tooltip
1189
+ ] });
1190
+ }
1191
+ function Legend({ segments, total }) {
1192
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "status-donut__legend", children: segments.map((seg) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "status-donut__legend-row", children: [
1193
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "status-donut__dot", style: { background: colorForStatus(seg.label) } }),
1194
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "status-donut__legend-label", children: seg.label }),
1195
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "status-donut__legend-value", children: seg.value }),
1196
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "status-donut__legend-pct", children: [
1197
+ pct(seg.value, total),
1198
+ "%"
1199
+ ] })
1200
+ ] }, seg.label)) });
1201
+ }
1202
+ function StatusDonut({ donut, provenance }) {
1203
+ const headline = React.useMemo(() => buildHeadline$2(donut), [donut]);
1204
+ const total = resolveTotal(donut);
1205
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "status-donut", children: [
1206
+ headline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "status-donut__headline", children: headline }),
1207
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "status-donut__body", children: [
1208
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "status-donut__label", children: donut.label }),
1209
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "status-donut__content", children: [
1210
+ /* @__PURE__ */ jsxRuntime.jsx(Donut, { segments: donut.segments, total }),
1211
+ /* @__PURE__ */ jsxRuntime.jsx(Legend, { segments: donut.segments, total })
1212
+ ] })
1213
+ ] }),
1214
+ provenance && /* @__PURE__ */ jsxRuntime.jsx(CardFooter, { provenance })
1215
+ ] });
1216
+ }
1217
+ function StatusDonutCard({ payload = [] }) {
1218
+ const blocks = payload.flatMap((item) => item.data);
1219
+ const donut = blocks.find((b) => b.type === "status_donut");
1220
+ const provenance = blocks.find((b) => b.type === "provenance");
1221
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "status-donut-card", children: (donut == null ? void 0 : donut.type) === "status_donut" && /* @__PURE__ */ jsxRuntime.jsx(
1222
+ StatusDonut,
1223
+ {
1224
+ donut: donut.props,
1225
+ provenance: (provenance == null ? void 0 : provenance.type) === "provenance" ? provenance.props : void 0
1226
+ }
1227
+ ) });
1228
+ }
1229
+ const NUMBER_WORDS = [
1230
+ "zero",
1231
+ "one",
1232
+ "two",
1233
+ "three",
1234
+ "four",
1235
+ "five",
1236
+ "six",
1237
+ "seven",
1238
+ "eight",
1239
+ "nine",
1240
+ "ten",
1241
+ "eleven",
1242
+ "twelve",
1243
+ "thirteen",
1244
+ "fourteen",
1245
+ "fifteen",
1246
+ "sixteen",
1247
+ "seventeen",
1248
+ "eighteen",
1249
+ "nineteen",
1250
+ "twenty"
1251
+ ];
1252
+ const inWords = (n) => NUMBER_WORDS[n] ?? `${n}`;
1253
+ const capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
1254
+ function formatCell(value) {
1255
+ if (value === null || value === void 0 || value === "") return "—";
1256
+ if (typeof value === "number") {
1257
+ return value.toLocaleString("en-US", {
1258
+ minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
1259
+ maximumFractionDigits: 2
1260
+ });
1261
+ }
1262
+ return value;
1263
+ }
1264
+ function buildHeadline$1({ label, rows, total_row_count }) {
1265
+ const noun = label.toLowerCase();
1266
+ const total = total_row_count ?? rows.length;
1267
+ if (total === 0) return `No ${noun} found.`;
1268
+ if (total > rows.length) {
1269
+ const verb = rows.length === 1 ? "is" : "are";
1270
+ return `${capitalize(inWords(total))} ${noun} in total. Here ${verb} the first ${inWords(rows.length)}.`;
1271
+ }
1272
+ return `${capitalize(inWords(total))} ${noun}.`;
1273
+ }
1274
+ function StatusPill({ value }) {
1275
+ if (value === null || value === "") return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "data-table__empty", children: "—" });
1276
+ const color = colorForStatus(String(value));
1277
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "data-table__pill", style: { color, background: `${color}1a` }, children: value });
1278
+ }
1279
+ function Cell({ column, value, first }) {
1280
+ const classes = [
1281
+ "data-table__cell",
1282
+ `data-table__cell--${column.align ?? "left"}`,
1283
+ typeof value === "number" ? "data-table__cell--number" : "",
1284
+ first ? "data-table__cell--key" : ""
1285
+ ].filter(Boolean).join(" ");
1286
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { className: classes, children: column.role === "status" ? /* @__PURE__ */ jsxRuntime.jsx(StatusPill, { value }) : formatCell(value) });
1287
+ }
1288
+ function DataTable({ label, columns, rows, total_row_count }) {
1289
+ const truncated = total_row_count !== void 0 && total_row_count > rows.length;
1290
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "data-table", children: [
1291
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "data-table__label", children: label }),
1292
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "data-table__scroll", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "data-table__table", children: [
1293
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: columns.map((c) => /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: `data-table__head data-table__cell--${c.align ?? "left"}`, children: c.label }, c.key)) }) }),
1294
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: rows.map((row, r) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "data-table__row", children: columns.map((c, i) => /* @__PURE__ */ jsxRuntime.jsx(Cell, { column: c, value: row[c.key] ?? null, first: i === 0 }, c.key)) }, r)) })
1295
+ ] }) }),
1296
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "data-table__count", children: [
1297
+ "Showing ",
1298
+ rows.length,
1299
+ " of ",
1300
+ truncated ? total_row_count : rows.length
1301
+ ] })
1302
+ ] });
1303
+ }
1304
+ function TableCard({ payload = [] }) {
1305
+ var _a, _b;
1306
+ const blocks = payload.flatMap((item) => item.data);
1307
+ const table = (_a = blocks.find((b) => b.type === "table")) == null ? void 0 : _a.props;
1308
+ const provenance = (_b = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _b.props;
1309
+ const headline = React.useMemo(() => table ? buildHeadline$1(table) : null, [table]);
1310
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "table-card", children: /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "table-card__panel", children: [
1311
+ headline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "table-card__headline", children: headline }),
1312
+ table && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "table-card__section", children: /* @__PURE__ */ jsxRuntime.jsx(DataTable, { ...table }) }),
1313
+ provenance && /* @__PURE__ */ jsxRuntime.jsx(CardFooter, { provenance })
1314
+ ] }) });
1315
+ }
1316
+ function formatField(value) {
1317
+ if (value === null || value === void 0 || value === "") return "—";
1318
+ if (typeof value === "number") {
1319
+ return value.toLocaleString("en-US", {
1320
+ minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
1321
+ maximumFractionDigits: 2
1322
+ });
1323
+ }
1324
+ return value;
1325
+ }
1326
+ function recordName(fields) {
1327
+ var _a;
1328
+ const named = fields.find((f) => /\bname\b/i.test(f.label) && f.value !== null && f.value !== "");
1329
+ const value = (_a = named ?? fields[0]) == null ? void 0 : _a.value;
1330
+ return value === null || value === void 0 || value === "" ? null : String(value);
1331
+ }
1332
+ function buildHeadline({ label, fields }) {
1333
+ const name = recordName(fields);
1334
+ return `Here's what we have on file for ${name ?? `this ${label.toLowerCase()}`}.`;
1335
+ }
1336
+ function RecordList({ label, fields }) {
1337
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "record-list", children: [
1338
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "record-list__label", children: label }),
1339
+ /* @__PURE__ */ jsxRuntime.jsx("dl", { className: "record-list__fields", children: fields.map((f, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "record-list__row", children: [
1340
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { className: "record-list__key", children: f.label }),
1341
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { className: `record-list__value${f.value === null || f.value === "" ? " is-empty" : ""}`, children: formatField(f.value) })
1342
+ ] }, `${f.label}-${i}`)) })
1343
+ ] });
1344
+ }
1345
+ function RecordListCard({ payload = [] }) {
1346
+ var _a, _b;
1347
+ const blocks = payload.flatMap((item) => item.data);
1348
+ const record = (_a = blocks.find((b) => b.type === "record_list")) == null ? void 0 : _a.props;
1349
+ const provenance = (_b = blocks.find((b) => b.type === "provenance")) == null ? void 0 : _b.props;
1350
+ const headline = React.useMemo(() => record ? buildHeadline(record) : null, [record]);
1351
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "record-list-card", children: /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "record-list-card__panel", children: [
1352
+ headline && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "record-list-card__headline", children: headline }),
1353
+ record && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "record-list-card__section", children: /* @__PURE__ */ jsxRuntime.jsx(RecordList, { ...record }) }),
1354
+ provenance && /* @__PURE__ */ jsxRuntime.jsx(CardFooter, { provenance })
1355
+ ] }) });
1356
+ }
1357
+ const SEVERITY_LABEL = {
1358
+ info: "Note",
1359
+ warning: "Warning",
1360
+ critical: "Critical",
1361
+ positive: "Good news"
1362
+ };
1363
+ function Callout({ severity, text }) {
1364
+ const level = SEVERITY_LABEL[severity] ? severity : "info";
1365
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `callout callout--${level}`, role: level === "critical" ? "alert" : "note", children: [
1366
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "callout__sr", children: [
1367
+ SEVERITY_LABEL[level],
1368
+ ": "
1369
+ ] }),
1370
+ text
1371
+ ] });
1372
+ }
1373
+ function CalloutCard({
1374
+ payload = [],
1375
+ answer
1376
+ }) {
1377
+ const callouts = payload.flatMap((item) => item.data).filter((b) => b.type === "callout");
1378
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "callout-card", children: /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "callout-card__panel", children: [
1379
+ answer && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "callout-card__answer", children: answer }),
1380
+ callouts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "callout-card__callouts", children: callouts.map((b) => /* @__PURE__ */ jsxRuntime.jsx(Callout, { ...b.props }, b.id)) })
1381
+ ] }) });
1382
+ }
1383
+ const CARDS = {
1384
+ metric: MetricCard,
1385
+ metric_row: MetricRowCard,
1386
+ comparison: ComparisonCard,
1387
+ bar_series: BarSeriesCard,
1388
+ ranked_bars: RankedBarsCard,
1389
+ status_donut: StatusDonutCard,
1390
+ table: TableCard,
1391
+ record_list: RecordListCard,
1392
+ callout: CalloutCard
1393
+ };
1394
+ const HOSTS_BAR_SERIES = /* @__PURE__ */ new Set(["metric", "metric_row"]);
1395
+ class CardBoundary extends React.Component {
1396
+ constructor() {
1397
+ super(...arguments);
1398
+ this.state = { failed: false };
1399
+ }
1400
+ static getDerivedStateFromError() {
1401
+ return { failed: true };
1402
+ }
1403
+ componentDidCatch(error) {
1404
+ console.error(`GenUI card "${this.props.type}" failed to render`, error);
1405
+ }
1406
+ render() {
1407
+ return this.state.failed ? null : this.props.children;
1408
+ }
1409
+ }
1410
+ function BlockRenderer({ blocks }) {
1411
+ if (!(blocks == null ? void 0 : blocks.length)) return null;
1412
+ const provenance = blocks.find((b) => b.type === "provenance");
1413
+ const hasHost = blocks.some((b) => HOSTS_BAR_SERIES.has(b.type));
1414
+ const hostedSeries = hasHost ? blocks.filter((b) => b.type === "bar_series") : [];
1415
+ const primary = blocks.filter(
1416
+ (b) => CARDS[b.type] && !hostedSeries.includes(b)
1417
+ );
1418
+ const lastData = [...primary].reverse().find((b) => b.type !== "callout");
1419
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--blocks", children: primary.map((block, i) => {
1420
+ const Card = CARDS[block.type];
1421
+ const data = [block];
1422
+ if (HOSTS_BAR_SERIES.has(block.type)) data.push(...hostedSeries);
1423
+ if (provenance && block === lastData) data.push(provenance);
1424
+ return /* @__PURE__ */ jsxRuntime.jsx(CardBoundary, { type: block.type, children: /* @__PURE__ */ jsxRuntime.jsx(Card, { payload: [{ type: "blocks", data }] }) }, block.id || `${block.type}-${i}`);
1425
+ }) });
1426
+ }
1427
+ const ChatBotMessages = ({ messages, isTyping, bodyRef, footer }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: bodyRef, className: "chatBot--body", children: [
1428
+ messages.map((msg) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `chatBot--msg-row chatBot--msg-row--${msg.role}`, children: [
1429
+ msg.role === "user" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--user-bubble", children: msg.text }),
1430
+ msg.role === "ai" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--ai-msg", children: [
1431
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--ai-sender", children: [
1432
+ /* @__PURE__ */ jsxRuntime.jsx(SparkMark, { size: 22 }),
1433
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--ai-name", children: "NovaForce" }),
1434
+ (msg.durationMs !== void 0 || msg.time) && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--ai-time", children: [
1435
+ "· ",
1436
+ msg.durationMs !== void 0 ? formatDuration(msg.durationMs) : msg.time
1437
+ ] }),
1438
+ msg.inputTokens !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--ai-stat", "data-tip": `${msg.inputTokens.toLocaleString()} input tokens`, children: [
1439
+ "↓ ",
1440
+ /* @__PURE__ */ jsxRuntime.jsx("b", { children: formatTokens(msg.inputTokens) }),
1441
+ " in"
1442
+ ] }),
1443
+ msg.outputTokens !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--ai-stat", "data-tip": `${msg.outputTokens.toLocaleString()} output tokens`, children: [
1444
+ "↑ ",
1445
+ /* @__PURE__ */ jsxRuntime.jsx("b", { children: formatTokens(msg.outputTokens) }),
1446
+ " out"
1447
+ ] }),
1448
+ !!msg.tokens && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--ai-stat", "data-tip": `${msg.tokens.toLocaleString()} total tokens`, children: [
1449
+ /* @__PURE__ */ jsxRuntime.jsx("b", { children: formatTokens(msg.tokens) }),
1450
+ " tokens"
1451
+ ] })
1452
+ ] }),
1453
+ /* @__PURE__ */ jsxRuntime.jsx(
1454
+ "div",
1455
+ {
1456
+ className: "chatBot--ai-text",
1457
+ dangerouslySetInnerHTML: { __html: marked.marked.parse(msg.text) }
1458
+ }
1459
+ ),
1460
+ msg.blocks && /* @__PURE__ */ jsxRuntime.jsx(BlockRenderer, { blocks: msg.blocks })
1461
+ ] })
1462
+ ] }, msg.id)),
1463
+ isTyping && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--ai-msg", children: [
1464
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--ai-sender", children: [
1465
+ /* @__PURE__ */ jsxRuntime.jsx(SparkMark, { size: 22 }),
1466
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--ai-name", children: "NovaForce" })
1467
+ ] }),
1468
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--typing-dots", children: [
1469
+ /* @__PURE__ */ jsxRuntime.jsx("span", {}),
1470
+ /* @__PURE__ */ jsxRuntime.jsx("span", {}),
1471
+ /* @__PURE__ */ jsxRuntime.jsx("span", {})
1472
+ ] })
1473
+ ] }),
1474
+ footer
1475
+ ] });
1476
+ const FORM_TYPES = ["sales_invoice", "purchase_invoice"];
1477
+ const ChatBotInput = ({
1478
+ inputValue,
1479
+ isTyping,
1480
+ mode,
1481
+ formType,
1482
+ showSlashMenu,
1483
+ filteredCommands,
1484
+ slashIndex,
1485
+ textareaRef,
1486
+ onChange,
1487
+ onKeyDown,
1488
+ onSend,
1489
+ onSlashHover,
1490
+ onSlashSelect,
1491
+ onModeChange,
1492
+ onFormTypeChange,
1493
+ activeDocument,
1494
+ activeDocuments,
1495
+ onDocDelete,
1496
+ onDocUpload,
1497
+ onMultiDocDelete,
1498
+ onDocDetach
1499
+ }) => {
1500
+ const canSend = mode === "agent" ? formType !== null && !isTyping : mode === "doc_qa" ? activeDocuments && activeDocuments.length > 0 ? activeDocuments.every((d) => d.status === "ready") && !!inputValue.trim() && !isTyping : (activeDocument == null ? void 0 : activeDocument.status) === "ready" && !!inputValue.trim() && !isTyping : !!inputValue.trim() && !isTyping;
1501
+ const attachedDocs = activeDocuments && activeDocuments.length > 0 ? activeDocuments : activeDocument ? [activeDocument] : [];
1502
+ const docsProcessing = attachedDocs.some((d) => d.status !== "ready" && d.status !== "failed");
1503
+ const canAttachMore = !docsProcessing && attachedDocs.length < MAX_ATTACHED_DOCS;
1504
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--input-area", children: [
1505
+ showSlashMenu && filteredCommands.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--slash-menu", children: [
1506
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--slash-menu-label", children: "Commands" }),
1507
+ filteredCommands.map((cmd, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
1508
+ "button",
1509
+ {
1510
+ className: `chatBot--slash-item${idx === slashIndex ? " chatBot--slash-item--active" : ""}`,
1511
+ onMouseEnter: () => onSlashHover(idx),
1512
+ onClick: () => onSlashSelect(cmd.id),
1513
+ children: [
1514
+ /* @__PURE__ */ jsxRuntime.jsx(SparkMark, { size: 28 }),
1515
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1516
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--slash-item-label", children: cmd.label }),
1517
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--slash-item-desc", children: cmd.description })
1518
+ ] })
1519
+ ]
1520
+ },
1521
+ cmd.id
1522
+ ))
1523
+ ] }),
1524
+ mode === "agent" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--form-type-bar", children: [
1525
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--form-type-label", children: "Form type" }),
1526
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--form-type-options", children: FORM_TYPES.map((ft) => /* @__PURE__ */ jsxRuntime.jsx(
1527
+ "button",
1528
+ {
1529
+ className: `chatBot--form-type-btn${formType === ft ? " chatBot--form-type-btn--active" : ""}`,
1530
+ onClick: () => onFormTypeChange(ft),
1531
+ children: FORM_TYPE_LABELS[ft]
1532
+ },
1533
+ ft
1534
+ )) })
1535
+ ] }),
1536
+ (mode === "doc_qa" || mode === "smart") && activeDocument && (!activeDocuments || activeDocuments.length === 0) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-chip-bar", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-chip", children: [
1537
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--doc-chip-dot", style: {
1538
+ background: activeDocument.status === "ready" ? "#2EB273" : activeDocument.status === "failed" ? "#C62828" : "#2EB273"
1539
+ } }),
1540
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--doc-chip-name", children: activeDocument.filename }),
1541
+ activeDocument.status === "ready" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--doc-chip-badge", children: "Ready" }),
1542
+ mode === "smart" && onDocDetach && /* @__PURE__ */ jsxRuntime.jsx(
1543
+ "button",
1544
+ {
1545
+ className: "chatBot--doc-chip-remove",
1546
+ onClick: () => onDocDetach(activeDocument.doc_id),
1547
+ disabled: isTyping,
1548
+ title: "Remove document",
1549
+ "aria-label": `Remove ${activeDocument.filename}`,
1550
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.CloseRounded, { style: { fontSize: 13 } })
1551
+ }
1552
+ )
1553
+ ] }) }),
1554
+ (mode === "doc_qa" || mode === "smart") && activeDocuments && activeDocuments.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-chip-bar", children: activeDocuments.map((doc) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-chip", children: [
1555
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--doc-chip-dot", style: {
1556
+ background: doc.status === "ready" ? "#2EB273" : doc.status === "failed" ? "#C62828" : "#2EB273"
1557
+ } }),
1558
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--doc-chip-name", title: doc.filename, children: doc.filename }),
1559
+ doc.status === "ready" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--doc-chip-badge", children: "Ready" }),
1560
+ mode === "smart" && onDocDetach && /* @__PURE__ */ jsxRuntime.jsx(
1561
+ "button",
1562
+ {
1563
+ className: "chatBot--doc-chip-remove",
1564
+ onClick: () => onDocDetach(doc.doc_id),
1565
+ disabled: isTyping,
1566
+ title: "Remove document",
1567
+ "aria-label": `Remove ${doc.filename}`,
1568
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.CloseRounded, { style: { fontSize: 13 } })
1569
+ }
1570
+ )
1571
+ ] }, doc.doc_id)) }),
1572
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--input-wrap", children: [
1573
+ /* @__PURE__ */ jsxRuntime.jsx(
1574
+ "textarea",
1575
+ {
1576
+ ref: textareaRef,
1577
+ className: "chatBot--textarea",
1578
+ rows: 2,
1579
+ placeholder: (mode === "doc_qa" || mode === "smart") && (activeDocument || activeDocuments && activeDocuments.length > 0) ? activeDocuments && activeDocuments.length > 0 ? activeDocuments.every((d) => d.status === "ready") ? "Ask a question about the document(s)…" : "Documents are processing…" : (activeDocument == null ? void 0 : activeDocument.status) === "ready" ? "Ask a question about this document…" : activeDocument ? "Document is still processing…" : "Upload PDF(s) above, then ask questions…" : mode === "agent" ? "Add any context for the agent…" : "Ask anything, or describe an action…",
1580
+ value: inputValue,
1581
+ onChange,
1582
+ onKeyDown,
1583
+ disabled: isTyping || (mode === "doc_qa" || mode === "smart") && !!activeDocument && activeDocument.status !== "ready" || (mode === "doc_qa" || mode === "smart") && !!activeDocuments && activeDocuments.length > 0 && activeDocuments.some((d) => d.status !== "ready")
1584
+ }
1585
+ ),
1586
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--ctrls", children: [
1587
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--ctrls-grow" }),
1588
+ mode === "smart" && canAttachMore && /* @__PURE__ */ jsxRuntime.jsx(
1589
+ "button",
1590
+ {
1591
+ className: "chatBot--attach-btn",
1592
+ onClick: onDocUpload,
1593
+ disabled: isTyping,
1594
+ title: "Attach Document",
1595
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.UploadFileRounded, { style: { fontSize: 15 } })
1596
+ }
1597
+ ),
1598
+ /* @__PURE__ */ jsxRuntime.jsx(
1599
+ "button",
1600
+ {
1601
+ className: `chatBot--send-btn${canSend ? " active" : ""}`,
1602
+ onClick: onSend,
1603
+ disabled: !canSend,
1604
+ title: "Send",
1605
+ children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ArrowUpwardRounded, { style: { fontSize: 15 } })
1606
+ }
1607
+ )
1608
+ ] })
1609
+ ] }),
1610
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--hints", style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "6px", overflow: "hidden" }, children: [
1611
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "#9ca3af", fontSize: "10px", whiteSpace: "nowrap" }, children: mode === "doc_qa" ? "Document Q&A mode" : "Replies use ERP data only" }),
1612
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "1px", height: "10px", background: "#d1d5db", flexShrink: 0 } }),
1613
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: "-16px", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: /* @__PURE__ */ jsxRuntime.jsx(aiDisclaimer.AIDisclaimer, { showIcon: false, justifyContent: "flex-start" }) })
1614
+ ] })
1615
+ ] });
1616
+ };
1617
+ const ChatBotLauncher = ({ onOpen }) => /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "chatBot--launcher", onClick: onOpen, children: [
1618
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--launcher-icon", children: /* @__PURE__ */ jsxRuntime.jsxs(
1619
+ "svg",
1620
+ {
1621
+ viewBox: "0 0 24 24",
1622
+ stroke: "currentColor",
1623
+ fill: "none",
1624
+ strokeWidth: "2",
1625
+ style: { width: 22, height: 22, flexShrink: 0 },
1626
+ children: [
1627
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8z" }),
1628
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 3l.6 1.8L21 5.4l-1.4.6L19 7.8l-.6-1.8L17 5.4l1.4-.6z" })
1629
+ ]
1630
+ }
1631
+ ) }),
1632
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--launcher-label", children: "Ask NovaForce" })
1633
+ ] });
1634
+ const ItemEntryTable = ({ fieldUpdates, resolvedLabels }) => {
1635
+ const prefix = fieldUpdates["sales_item_entries.items.name"] ? "sales_item_entries" : fieldUpdates["purchase_item_entries.items.name"] ? "purchase_item_entries" : null;
1636
+ if (!prefix) return null;
1637
+ const names = fieldUpdates[`${prefix}.items.name`];
1638
+ const quantities = fieldUpdates[`${prefix}.quantity`];
1639
+ const rates = fieldUpdates[`${prefix}.rate`];
1640
+ const discountAmounts = fieldUpdates[`${prefix}.discount_amount`];
1641
+ const taxAmounts = fieldUpdates[`${prefix}.tax_amount`];
1642
+ const totalAmounts = fieldUpdates[`${prefix}.total_amount`];
1643
+ if (!Array.isArray(names) || names.length === 0) return null;
1644
+ const rows = names.map((_, i) => {
1645
+ const itemId = names[i];
1646
+ const qty = parseFloat(quantities == null ? void 0 : quantities[i]) || 0;
1647
+ const rate = parseFloat(rates == null ? void 0 : rates[i]) || 0;
1648
+ const gross = qty * rate;
1649
+ const discount = parseFloat(discountAmounts == null ? void 0 : discountAmounts[i]) || 0;
1650
+ const tax = parseFloat(taxAmounts == null ? void 0 : taxAmounts[i]) || 0;
1651
+ const total = parseFloat(totalAmounts == null ? void 0 : totalAmounts[i]) || 0;
1652
+ const resolvedKey = `${prefix}.items.name:${itemId}`;
1653
+ const itemName = resolvedLabels[resolvedKey] || `Item #${itemId}`;
1654
+ return { itemName, qty, rate, gross, discount, tax, total };
1655
+ });
1656
+ const subtotal = rows.reduce((sum, r) => sum + r.gross, 0);
1657
+ const totalDiscount = rows.reduce((sum, r) => sum + r.discount, 0);
1658
+ rows.reduce((sum, r) => sum + r.tax, 0);
1659
+ const totalDue = rows.reduce((sum, r) => sum + r.total, 0);
1660
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1661
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-li", style: { gridTemplateColumns: "1fr repeat(6, 85px)" }, children: [
1662
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h", children: "Item" }),
1663
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h right", children: "Qty" }),
1664
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h right", children: "Rate" }),
1665
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h right", children: "Gross" }),
1666
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h right", children: "Discount" }),
1667
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h right", children: "Tax" }),
1668
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h right", children: "Total" }),
1669
+ rows.map((r, i) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
1670
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c", children: r.itemName }),
1671
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c right", children: r.qty }),
1672
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c right", children: api.formatAmount(r.rate, api.defaultCurrencyFormat()) }),
1673
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c right", children: api.formatAmount(r.gross, api.defaultCurrencyFormat()) }),
1674
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c right", children: api.formatAmount(r.discount, api.defaultCurrencyFormat()) }),
1675
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c right", children: api.formatAmount(r.tax, api.defaultCurrencyFormat()) }),
1676
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c right", children: api.formatAmount(r.total, api.defaultCurrencyFormat()) })
1677
+ ] }, i))
1678
+ ] }) }),
1679
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-tot", children: [
1680
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-tot-row", children: [
1681
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Subtotal" }),
1682
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-tot-row-val", children: api.formatAmount(subtotal, api.defaultCurrencyFormat()) })
1683
+ ] }),
1684
+ totalDiscount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-tot-row", children: [
1685
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
1686
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--preview-tot-row-val", children: [
1687
+ "-",
1688
+ api.formatAmount(totalDiscount, api.defaultCurrencyFormat())
1689
+ ] })
1690
+ ] }),
1691
+ rows.filter((r) => r.tax).map((r, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-tot-row", children: [
1692
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
1693
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-tot-row-val", children: api.formatAmount(r.tax, api.defaultCurrencyFormat()) })
1694
+ ] }, i)),
1695
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-tot-row total", children: [
1696
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Total due (items)" }),
1697
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-tot-row-val", children: api.formatAmount(totalDue, api.defaultCurrencyFormat()) })
1698
+ ] })
1699
+ ] })
1700
+ ] });
1701
+ };
1702
+ const ExpenseEntryTable = ({ fieldUpdates, resolvedLabels }) => {
1703
+ const accountIds = fieldUpdates["purchase_expense_entries.accounts.account_name"];
1704
+ const rates = fieldUpdates["purchase_expense_entries.rate"];
1705
+ const discountAmounts = fieldUpdates["purchase_expense_entries.discount_amount"];
1706
+ const taxAmounts = fieldUpdates["purchase_expense_entries.tax_amount"];
1707
+ const totalAmounts = fieldUpdates["purchase_expense_entries.total_amount"];
1708
+ if (!Array.isArray(accountIds) || accountIds.length === 0) return null;
1709
+ const rows = accountIds.map((_, i) => {
1710
+ const accountId = accountIds[i];
1711
+ const rate = parseFloat(rates == null ? void 0 : rates[i]) || 0;
1712
+ const gross = rate;
1713
+ const discount = parseFloat(discountAmounts == null ? void 0 : discountAmounts[i]) || 0;
1714
+ const tax = parseFloat(taxAmounts == null ? void 0 : taxAmounts[i]) || 0;
1715
+ const total = parseFloat(totalAmounts == null ? void 0 : totalAmounts[i]) || 0;
1716
+ const resolvedKey = `purchase_expense_entries.accounts.account_name:${accountId}`;
1717
+ const accountName = resolvedLabels[resolvedKey] || `Account #${accountId}`;
1718
+ return { accountName, rate, gross, discount, tax, total };
1719
+ });
1720
+ const subtotal = rows.reduce((sum, r) => sum + r.gross, 0);
1721
+ const totalDiscount = rows.reduce((sum, r) => sum + r.discount, 0);
1722
+ const totalTax = rows.reduce((sum, r) => sum + r.tax, 0);
1723
+ const totalDue = rows.reduce((sum, r) => sum + r.total, 0);
1724
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1725
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-li", style: { gridTemplateColumns: "1fr repeat(5, 85px)" }, children: [
1726
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h", children: "Account" }),
1727
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h right", children: "Rate" }),
1728
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h right", children: "Gross" }),
1729
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h right", children: "Discount" }),
1730
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h right", children: "Tax" }),
1731
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-h right", children: "Total" }),
1732
+ rows.map((r, i) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
1733
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c", children: r.accountName }),
1734
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c right", children: api.formatAmount(r.rate, api.defaultCurrencyFormat()) }),
1735
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c right", children: api.formatAmount(r.gross, api.defaultCurrencyFormat()) }),
1736
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c right", children: api.formatAmount(r.discount, api.defaultCurrencyFormat()) }),
1737
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c right", children: api.formatAmount(r.tax, api.defaultCurrencyFormat()) }),
1738
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--preview-li-c right", children: api.formatAmount(r.total, api.defaultCurrencyFormat()) })
1739
+ ] }, i))
1740
+ ] }) }),
1741
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-tot", children: [
1742
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-tot-row", children: [
1743
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Subtotal" }),
1744
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-tot-row-val", children: api.formatAmount(subtotal, api.defaultCurrencyFormat()) })
1745
+ ] }),
1746
+ totalDiscount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-tot-row", children: [
1747
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
1748
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--preview-tot-row-val", children: [
1749
+ "-",
1750
+ api.formatAmount(totalDiscount, api.defaultCurrencyFormat())
1751
+ ] })
1752
+ ] }),
1753
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-tot-row", children: [
1754
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Total Tax" }),
1755
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-tot-row-val", children: api.formatAmount(totalTax, api.defaultCurrencyFormat()) })
1756
+ ] }),
1757
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-tot-row total", children: [
1758
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Total due (expenses)" }),
1759
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-tot-row-val", children: api.formatAmount(totalDue, api.defaultCurrencyFormat()) })
1760
+ ] })
1761
+ ] })
1762
+ ] });
1763
+ };
1764
+ const sumField = (updates, key) => (updates[key] || []).reduce((s, v) => s + (parseFloat(v) || 0), 0);
1765
+ const FIELD_LABELS = {
1766
+ customer_id: "Customer",
1767
+ vendor_id: "Vendor",
1768
+ date: "Date",
1769
+ bill_date: "Bill Date",
1770
+ invoice_date: "Invoice Date",
1771
+ due_date: "Due Date",
1772
+ posting_time: "Posting Time",
1773
+ payment_term_id: "Payment Term",
1774
+ company_id: "Company",
1775
+ exchange_rate: "Exchange Rate",
1776
+ account_payable_id: "Account Payable",
1777
+ account_receivable_id: "Account Receivable",
1778
+ currency_id: "Currency",
1779
+ supplier_currency_id: "Supplier Currency",
1780
+ supplier_invoice_number: "Supplier Invoice #",
1781
+ supplier_invoice_date: "Supplier Invoice Date",
1782
+ transaction_type: "Transaction Type",
1783
+ narration: "Narration",
1784
+ department: "Department",
1785
+ department_id: "Department",
1786
+ location: "Location",
1787
+ incoterm_id: "Incoterm",
1788
+ region_id: "Region",
1789
+ series_number: "Series Number",
1790
+ attachment_url: "Attachment",
1791
+ additional_discount_on: "Discount On",
1792
+ additional_discount_percentage: "Discount Percentage",
1793
+ additional_discount_amount: "Discount Amount",
1794
+ round_off: "Round Off",
1795
+ round_off_option: "Round Off Option",
1796
+ is_cash: "Cash Transaction",
1797
+ discount_amount: "Discount Amount",
1798
+ total_invoice_amount: "Total Amount",
1799
+ supplier_address: "Supplier Address",
1800
+ contact_person: "Contact Person",
1801
+ shipping_address: "Shipping Address",
1802
+ billing_address: "Billing Address",
1803
+ place_of_supply: "Place of Supply"
1804
+ };
1805
+ const InvoicePreview = ({ fieldUpdates, resolvedLabels, formStatus, useActionGating, pendingFormAction, onSave, onSubmit, onDiscard }) => {
1806
+ const itemTotalKey = fieldUpdates["purchase_item_entries.total_amount"] ? "purchase_item_entries.total_amount" : fieldUpdates["sales_item_entries.total_amount"] ? "sales_item_entries.total_amount" : null;
1807
+ const itemTotal = itemTotalKey ? sumField(fieldUpdates, itemTotalKey) : 0;
1808
+ const expenseTotal = sumField(fieldUpdates, "purchase_expense_entries.total_amount");
1809
+ const grandTotal = itemTotal + expenseTotal;
1810
+ const displayKey = (key) => {
1811
+ const shortKey = key.startsWith("invoice_addresses.") ? key.slice("invoice_addresses.".length) : key;
1812
+ return FIELD_LABELS[shortKey] || FIELD_LABELS[key] || key;
1813
+ };
1814
+ const entries = Object.entries(fieldUpdates).filter(([key]) => {
1815
+ if (key.startsWith("sales_item_entries.") || key.startsWith("purchase_item_entries.") || key.startsWith("purchase_expense_entries.")) return false;
1816
+ return true;
1817
+ });
1818
+ if (Object.keys(fieldUpdates).length === 0) return null;
1819
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-card", children: [
1820
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-head", children: [
1821
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-head-ic", children: /* @__PURE__ */ jsxRuntime.jsx(IcInvoice, { size: 14 }) }),
1822
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-head-ttl", children: [
1823
+ "Draft Invoice",
1824
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--preview-head-sub", children: [
1825
+ "AI-prepared · ",
1826
+ entries.length,
1827
+ " fields locked"
1828
+ ] })
1829
+ ] }),
1830
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-badge", children: "DRAFT" })
1831
+ ] }),
1832
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-body", children: [
1833
+ entries.map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-row", children: [
1834
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-row-key", children: displayKey(key) }),
1835
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-row-val", children: resolvedLabels[key] || String(value ?? "") })
1836
+ ] }, key)),
1837
+ /* @__PURE__ */ jsxRuntime.jsx(ItemEntryTable, { fieldUpdates, resolvedLabels }),
1838
+ /* @__PURE__ */ jsxRuntime.jsx(ExpenseEntryTable, { fieldUpdates, resolvedLabels }),
1839
+ (itemTotal > 0 || expenseTotal > 0) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-tot-row total", style: { marginTop: 8 }, children: [
1840
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Grand Total" }),
1841
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-tot-row-val", children: api.formatAmount(grandTotal, api.defaultCurrencyFormat()) })
1842
+ ] })
1843
+ ] }),
1844
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--preview-foot", children: [
1845
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--preview-foot-grow" }),
1846
+ useActionGating ? (
1847
+ // Smart mode: each button only appears when the AI's last action explicitly signalled
1848
+ // it — status is fill-completeness only and never gates these (Copilot Smart API contract).
1849
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1850
+ pendingFormAction === "discard_form" && onDiscard && /* @__PURE__ */ jsxRuntime.jsx(button.Button, { variant: "outlined", startIcon: /* @__PURE__ */ jsxRuntime.jsx(trash.Trash, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onDiscard, sx: { mr: 1 }, children: "Discard" }),
1851
+ pendingFormAction === "save_draft" && /* @__PURE__ */ jsxRuntime.jsx(button.Button, { variant: "outlined", startIcon: /* @__PURE__ */ jsxRuntime.jsx(save.Save, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onSave, sx: { mr: 1 }, children: "Save Draft" }),
1852
+ pendingFormAction === "submit_form" && onSubmit && /* @__PURE__ */ jsxRuntime.jsx(button.Button, { variant: "contained", startIcon: /* @__PURE__ */ jsxRuntime.jsx(tick.Tick, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onSubmit, children: "Submit" })
1853
+ ] })
1854
+ ) : formStatus === "ready_to_submit" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1855
+ onDiscard && /* @__PURE__ */ jsxRuntime.jsx(button.Button, { variant: "outlined", startIcon: /* @__PURE__ */ jsxRuntime.jsx(trash.Trash, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onDiscard, sx: { mr: 1 }, children: "Discard" }),
1856
+ /* @__PURE__ */ jsxRuntime.jsx(button.Button, { variant: "outlined", startIcon: /* @__PURE__ */ jsxRuntime.jsx(save.Save, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onSave, sx: { mr: 1 }, children: "Save Draft" }),
1857
+ onSubmit && /* @__PURE__ */ jsxRuntime.jsx(button.Button, { variant: "contained", startIcon: /* @__PURE__ */ jsxRuntime.jsx(tick.Tick, { fontSize: "small", sx: { stroke: "currentColor", strokeWidth: 0.5 } }), onClick: onSubmit, children: "Submit" })
1858
+ ] })
1859
+ ] })
1860
+ ] });
1861
+ };
1862
+ const ICON_BY_CATEGORY = {
1863
+ pdf: { Icon: iconsMaterial.PictureAsPdfRounded, color: "#C62828" },
1864
+ excel: { Icon: iconsMaterial.TableChartRounded, color: "#1E7E34" },
1865
+ doc: { Icon: iconsMaterial.DescriptionRounded, color: "#1B5FBD" },
1866
+ md: { Icon: iconsMaterial.ArticleRounded, color: "#5C5C5C" },
1867
+ image: { Icon: iconsMaterial.ImageRounded, color: "#8E24AA" }
1868
+ };
1869
+ const DocFileIcon = ({ filename, fontSize = 16 }) => {
1870
+ const category = getFileCategory(filename);
1871
+ const { Icon, color } = category ? ICON_BY_CATEGORY[category] : { Icon: iconsMaterial.InsertDriveFileRounded, color: "#9E9E9E" };
1872
+ return /* @__PURE__ */ jsxRuntime.jsx(Icon, { sx: { fontSize, color } });
1873
+ };
1874
+ const DocUpload = ({ onUploadComplete, onUploadError, uploadDocument, uploadDocuments }) => {
1875
+ const [isDragging, setIsDragging] = React.useState(false);
1876
+ const [progress, setProgress] = React.useState(null);
1877
+ const [fileNames, setFileNames] = React.useState([]);
1878
+ const fileInputRef = React.useRef(null);
1879
+ const handleFiles = React.useCallback(async (files) => {
1880
+ if (files.length === 0) return;
1881
+ if (files.length > 10) {
1882
+ onUploadError("Maximum 10 files allowed per request.");
1883
+ return;
1884
+ }
1885
+ for (const file of files) {
1886
+ if (!getFileCategory(file.name)) {
1887
+ onUploadError("Unsupported file type. Accepted: PDF, Word, Excel, Markdown, image.");
1888
+ return;
1889
+ }
1890
+ if (file.size > 50 * 1024 * 1024) {
1891
+ onUploadError(`File too large (${file.name}). Maximum 50MB.`);
1892
+ return;
1893
+ }
1894
+ }
1895
+ setFileNames(files.map((f) => f.name));
1896
+ setProgress(0);
1897
+ try {
1898
+ if (files.length === 1) {
1899
+ const doc = await uploadDocument(files[0], (pct2) => setProgress(pct2));
1900
+ onUploadComplete([doc]);
1901
+ } else {
1902
+ const docs = await uploadDocuments(files, (pct2) => setProgress(pct2));
1903
+ onUploadComplete(docs);
1904
+ }
1905
+ } catch (err) {
1906
+ onUploadError(err.message || "Upload failed");
1907
+ } finally {
1908
+ setProgress(null);
1909
+ setFileNames([]);
1910
+ }
1911
+ }, [uploadDocument, uploadDocuments, onUploadComplete, onUploadError]);
1912
+ const handleDrop = React.useCallback((e) => {
1913
+ e.preventDefault();
1914
+ setIsDragging(false);
1915
+ const files = Array.from(e.dataTransfer.files);
1916
+ if (files.length) handleFiles(files);
1917
+ }, [handleFiles]);
1918
+ const handleDragOver = React.useCallback((e) => {
1919
+ e.preventDefault();
1920
+ setIsDragging(true);
1921
+ }, []);
1922
+ const handleDragLeave = React.useCallback(() => setIsDragging(false), []);
1923
+ const handleClick = () => {
1924
+ var _a;
1925
+ return (_a = fileInputRef.current) == null ? void 0 : _a.click();
1926
+ };
1927
+ const handleChange = (e) => {
1928
+ const files = Array.from(e.target.files || []);
1929
+ if (files.length) handleFiles(files);
1930
+ e.target.value = "";
1931
+ };
1932
+ if (progress !== null) {
1933
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-progress-wrap", children: [
1934
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-progress-info", children: [
1935
+ /* @__PURE__ */ jsxRuntime.jsx(DocFileIcon, { filename: fileNames[0] || "", fontSize: 16 }),
1936
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--doc-progress-name", children: fileNames.length === 1 ? fileNames[0] : `${fileNames.length} files uploading...` }),
1937
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--doc-progress-pct", children: [
1938
+ progress,
1939
+ "%"
1940
+ ] })
1941
+ ] }),
1942
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-progress-bar", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-progress-fill", style: { width: `${progress}%` } }) })
1943
+ ] });
1944
+ }
1945
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1946
+ "div",
1947
+ {
1948
+ className: `chatBot--doc-dropzone${isDragging ? " chatBot--doc-dropzone--active" : ""}`,
1949
+ onDrop: handleDrop,
1950
+ onDragOver: handleDragOver,
1951
+ onDragLeave: handleDragLeave,
1952
+ onClick: handleClick,
1953
+ children: [
1954
+ /* @__PURE__ */ jsxRuntime.jsx(
1955
+ "input",
1956
+ {
1957
+ ref: fileInputRef,
1958
+ type: "file",
1959
+ accept: ACCEPT_ATTR,
1960
+ multiple: true,
1961
+ style: { display: "none" },
1962
+ onChange: handleChange
1963
+ }
1964
+ ),
1965
+ /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.CloudUploadRounded, { sx: { fontSize: 28, color: "#2EB273", mb: 0.5 } }),
1966
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-drop-label", children: "Drop files here or click to browse" }),
1967
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-drop-sub", children: "Max 50MB per file · PDF, Word, Excel, Markdown, image · Up to 10 files" })
1968
+ ]
1969
+ }
1970
+ );
1971
+ };
1972
+ const STATUS_LABELS = {
1973
+ uploading: "Uploading…",
1974
+ pending: "Queued",
1975
+ processing: "Processing",
1976
+ parsing: "Extracting text",
1977
+ embedding: "Generating embeddings",
1978
+ indexing: "Indexing",
1979
+ ready: "Ready",
1980
+ failed: "Failed"
1981
+ };
1982
+ const ACTIVE_STATUSES = ["pending", "processing", "parsing", "embedding", "indexing"];
1983
+ const DocStatus = ({ document: document2, onReady, onError, getStatus }) => {
1984
+ const [doc, setDoc] = React.useState(document2);
1985
+ const [pollCount, setPollCount] = React.useState(0);
1986
+ const mountedRef = React.useRef(true);
1987
+ const pollDocIdRef = React.useRef(doc.doc_id);
1988
+ pollDocIdRef.current = doc.doc_id;
1989
+ React.useEffect(() => {
1990
+ mountedRef.current = true;
1991
+ return () => {
1992
+ mountedRef.current = false;
1993
+ };
1994
+ }, []);
1995
+ React.useEffect(() => {
1996
+ if (!ACTIVE_STATUSES.includes(doc.status)) return;
1997
+ const interval = setInterval(async () => {
1998
+ try {
1999
+ const updated = await getStatus(doc.doc_id);
2000
+ if (!mountedRef.current || updated.doc_id !== pollDocIdRef.current) return;
2001
+ setDoc(updated);
2002
+ setPollCount((c) => c + 1);
2003
+ if (updated.status === "ready") {
2004
+ clearInterval(interval);
2005
+ onReady(updated);
2006
+ } else if (updated.status === "failed") {
2007
+ clearInterval(interval);
2008
+ onError(updated);
2009
+ }
2010
+ } catch {
2011
+ setPollCount((c) => c + 1);
2012
+ }
2013
+ }, 3e3);
2014
+ return () => clearInterval(interval);
2015
+ }, [doc.doc_id, doc.status]);
2016
+ const isActive = ACTIVE_STATUSES.includes(doc.status);
2017
+ const isReady = doc.status === "ready";
2018
+ const isFailed = doc.status === "failed";
2019
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-status-card", children: [
2020
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-status-head", children: [
2021
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.CheckCircleRounded, { sx: { fontSize: 18, color: "#2EB273" } }),
2022
+ isFailed && /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ErrorRounded, { sx: { fontSize: 18, color: "#C62828" } }),
2023
+ isActive && /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.HourglassBottomRounded, { sx: { fontSize: 18, color: "#2EB273" }, className: "chatBot--doc-status-spin" }),
2024
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-status-info", children: [
2025
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--doc-status-name", children: doc.filename }),
2026
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "chatBot--doc-status-label", children: [
2027
+ STATUS_LABELS[doc.status],
2028
+ doc.pages ? ` · ${doc.pages} pages` : "",
2029
+ doc.category ? ` · ${doc.category}` : ""
2030
+ ] })
2031
+ ] })
2032
+ ] }),
2033
+ isActive && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-progress-bar", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-progress-fill chatBot--doc-progress-fill--indeterminate" }) }),
2034
+ isFailed && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-status-error", children: [
2035
+ doc.error || "Document processing failed",
2036
+ doc.error_code && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--doc-status-error-code", children: doc.error_code })
2037
+ ] }),
2038
+ isReady && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-status-ready", children: [
2039
+ doc.chunk_count,
2040
+ " chunks indexed · Ready to chat"
2041
+ ] })
2042
+ ] });
2043
+ };
2044
+ const DocIntro = ({ document: document2, documents, suggestedQuestions, onSuggestion }) => {
2045
+ const docsToRender = documents && documents.length > 0 ? documents : document2 ? [document2] : [];
2046
+ const questionsToRender = suggestedQuestions && suggestedQuestions.length > 0 ? suggestedQuestions : document2 == null ? void 0 : document2.suggested_questions;
2047
+ if (docsToRender.length === 0) return null;
2048
+ if (!docsToRender.some((d) => d.summary) && !(questionsToRender == null ? void 0 : questionsToRender.length)) return null;
2049
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-intro-card", children: [
2050
+ docsToRender.map((doc, idx) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { borderBottom: idx < docsToRender.length - 1 && docsToRender.length > 1 ? "1px solid #F2F3F4" : "none" }, children: [
2051
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-intro-head", children: [
2052
+ /* @__PURE__ */ jsxRuntime.jsx(DocFileIcon, { filename: doc.filename, fontSize: 16 }),
2053
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-intro-head-info", children: [
2054
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--doc-intro-filename", children: doc.filename }),
2055
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "chatBot--doc-intro-meta", children: doc.category && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2056
+ doc.category,
2057
+ doc.sub_category ? ` · ${doc.sub_category}` : ""
2058
+ ] }) })
2059
+ ] })
2060
+ ] }),
2061
+ doc.summary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-intro-summary", children: doc.summary })
2062
+ ] }, doc.doc_id || idx)),
2063
+ questionsToRender && questionsToRender.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-intro-questions", children: [
2064
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-intro-q-label", children: "Suggested questions" }),
2065
+ questionsToRender.map((q, i) => /* @__PURE__ */ jsxRuntime.jsx("button", { className: "chatBot--doc-intro-q-btn", onClick: () => onSuggestion(q), children: q }, i))
2066
+ ] })
2067
+ ] });
2068
+ };
2069
+ const mergeById = (first, rest) => {
2070
+ const ids = new Set(first.map((s) => s.id));
2071
+ return [...first, ...rest.filter((s) => !ids.has(s.id))];
2072
+ };
2073
+ const useChatHistory = (service, enabled) => {
2074
+ const [sessions, setSessions] = React.useState([]);
2075
+ const [nextCursor, setNextCursor] = React.useState(null);
2076
+ const [loading, setLoading] = React.useState(false);
2077
+ const [loadingMore, setLoadingMore] = React.useState(false);
2078
+ const [error, setError] = React.useState(null);
2079
+ const sessionsRef = React.useRef([]);
2080
+ const requestIdRef = React.useRef(0);
2081
+ React.useEffect(() => {
2082
+ sessionsRef.current = sessions;
2083
+ }, [sessions]);
2084
+ const refresh = React.useCallback(async (keepLoaded = false) => {
2085
+ const requestId = ++requestIdRef.current;
2086
+ if (!service) {
2087
+ setSessions([]);
2088
+ setNextCursor(null);
2089
+ setError(null);
2090
+ return;
2091
+ }
2092
+ const merge = keepLoaded && sessionsRef.current.length > 0;
2093
+ if (!merge) setLoading(true);
2094
+ setError(null);
2095
+ try {
2096
+ const page = await api$1.getV1CopilotHistory({ service, limit: HISTORY_PAGE_SIZE }, api.getToken()["x-token"]);
2097
+ if (requestId !== requestIdRef.current) return;
2098
+ const firstPage = page.sessions.map(toChatSession);
2099
+ if (merge) {
2100
+ setSessions((prev) => mergeById(firstPage, prev));
2101
+ } else {
2102
+ setSessions(firstPage);
2103
+ setNextCursor(page.next_cursor);
2104
+ }
2105
+ } catch (e) {
2106
+ if (requestId === requestIdRef.current) setError((e == null ? void 0 : e.message) || "Failed to load chat history");
2107
+ } finally {
2108
+ if (requestId === requestIdRef.current) setLoading(false);
2109
+ }
2110
+ }, [service]);
2111
+ const loadMore = React.useCallback(async () => {
2112
+ if (!service || !nextCursor || loadingMore) return;
2113
+ const requestId = requestIdRef.current;
2114
+ setLoadingMore(true);
2115
+ try {
2116
+ const page = await api$1.getV1CopilotHistory({ service, limit: HISTORY_PAGE_SIZE, cursor: nextCursor }, api.getToken()["x-token"]);
2117
+ if (requestId !== requestIdRef.current) return;
2118
+ setSessions((prev) => mergeById(prev, page.sessions.map(toChatSession)));
2119
+ setNextCursor(page.next_cursor);
2120
+ } catch {
2121
+ if (requestId === requestIdRef.current) await refresh();
2122
+ } finally {
2123
+ setLoadingMore(false);
2124
+ }
2125
+ }, [service, nextCursor, loadingMore, refresh]);
2126
+ const openSession = React.useCallback(
2127
+ (session) => api$1.getV1CopilotHistorySession(session.id, session.service, api.getToken()["x-token"]),
2128
+ []
2129
+ );
2130
+ const removeSession = React.useCallback(async (session) => {
2131
+ await api$1.deleteV1CopilotHistorySession(session.id, session.service, api.getToken()["x-token"]);
2132
+ setSessions((prev) => prev.filter((s) => s.id !== session.id));
2133
+ }, []);
2134
+ React.useEffect(() => {
2135
+ if (!enabled) return;
2136
+ setSessions([]);
2137
+ setNextCursor(null);
2138
+ refresh();
2139
+ }, [enabled, refresh]);
2140
+ return {
2141
+ sessions,
2142
+ loading,
2143
+ loadingMore,
2144
+ error,
2145
+ hasMore: !!nextCursor,
2146
+ refresh,
2147
+ loadMore,
2148
+ openSession,
2149
+ removeSession
2150
+ };
2151
+ };
2152
+ marked.marked.use({ breaks: true, gfm: true });
2153
+ const ChatBot = ({ inline = false, dashboardMode = false } = {}) => {
2154
+ var _a;
2155
+ const isAiEnabled = ((_a = utils_apiConfig.getApiConfigSafe()) == null ? void 0 : _a.aiFeatureEnabled) === "true";
2156
+ if (!isAiEnabled) return null;
2157
+ const uData = JSON.parse(localStorage.getItem("_u_data") || "{}");
2158
+ if (uData.role_type !== "Admin") return null;
2159
+ const { user } = runtime.useAuth();
2160
+ const [isOpen, setIsOpen] = React.useState(inline ? true : false);
2161
+ const [messages, setMessages] = React.useState([]);
2162
+ const [isTyping, setIsTyping] = React.useState(false);
2163
+ const [inputValue, setInputValue] = React.useState("");
2164
+ const [mode, setMode] = React.useState("smart");
2165
+ const [formType, setFormType] = React.useState(null);
2166
+ const [formStatus, setFormStatus] = React.useState("in_progress");
2167
+ const [currentFieldUpdates, setCurrentFieldUpdates] = React.useState(null);
2168
+ const [pendingFormAction, setPendingFormAction] = React.useState(null);
2169
+ const [resolvedLabels, setResolvedLabels] = React.useState({});
2170
+ const [dynamicQuestions, setDynamicQuestions] = React.useState([]);
2171
+ const [showSlashMenu, setShowSlashMenu] = React.useState(false);
2172
+ const [slashIndex, setSlashIndex] = React.useState(0);
2173
+ const labelCacheRef = React.useRef({});
2174
+ const bodyRef = React.useRef(null);
2175
+ const textareaRef = React.useRef(null);
2176
+ const userScrolledUp = React.useRef(false);
2177
+ const agentStarted = React.useRef(false);
2178
+ const smartSessionIdRef = React.useRef(null);
2179
+ const formSessionIdRef = React.useRef(null);
2180
+ const [activeDocument, setActiveDocument] = React.useState(null);
2181
+ const [docIntroSent, setDocIntroSent] = React.useState(false);
2182
+ const [docError, setDocError] = React.useState(null);
2183
+ const [showUploadArea, setShowUploadArea] = React.useState(false);
2184
+ const [activeDocuments, setActiveDocuments] = React.useState([]);
2185
+ const [suggestedQuestions, setSuggestedQuestions] = React.useState([]);
2186
+ const fetchedMultiDocIntroIds = React.useRef("");
2187
+ const tabStateRef = React.useRef({});
2188
+ const [historyOpen, setHistoryOpen] = React.useState(false);
2189
+ const historyService = historyServiceForMode(mode);
2190
+ const chatHistory = useChatHistory(historyService, historyOpen);
2191
+ const [activeSessionId, setActiveSessionId] = React.useState(null);
2192
+ const activeSessionIdRef = React.useRef(null);
2193
+ const chatSessionIdRef = React.useRef(null);
2194
+ const conversationRef = React.useRef(0);
2195
+ const [pendingDeleteSession, setPendingDeleteSession] = React.useState(null);
2196
+ const [deletingSession, setDeletingSession] = React.useState(false);
2197
+ const markActiveSession = (sessionId) => {
2198
+ activeSessionIdRef.current = sessionId;
2199
+ setActiveSessionId(sessionId);
2200
+ };
2201
+ const firstName = (user == null ? void 0 : user.first_name) || "";
2202
+ const filteredMessages = React.useMemo(
2203
+ () => messages.filter((m) => {
2204
+ if (!m.mode) return true;
2205
+ if (m.mode === mode) return true;
2206
+ return false;
2207
+ }),
2208
+ [messages, mode]
2209
+ );
2210
+ React.useEffect(() => {
2211
+ const config = utils_apiConfig.getApiConfigSafe();
2212
+ if (config == null ? void 0 : config.backendBaseUrl) {
2213
+ api$1.setAiFeatureBaseUrl(`${config.backendBaseUrl}/ai-feature`);
2214
+ }
2215
+ }, []);
2216
+ const slashQuery = inputValue.startsWith("/") ? inputValue.slice(1).toLowerCase() : "";
2217
+ const filteredCommands = SLASH_COMMANDS.filter(
2218
+ (cmd) => cmd.label.toLowerCase().startsWith(slashQuery)
2219
+ );
2220
+ const fetchQuestions = React.useCallback(async () => {
2221
+ try {
2222
+ const { "x-token": token } = api.getToken();
2223
+ const uData2 = api.getDefaultUserData();
2224
+ const mapLocalToApiModule = (localName) => {
2225
+ switch (localName) {
2226
+ case "accounts-and-finance":
2227
+ return "Accounting";
2228
+ case "inventory":
2229
+ return "Inventory";
2230
+ case "manufacturing":
2231
+ return "Manufacturing";
2232
+ case "purchase":
2233
+ return "Procurement";
2234
+ case "sales":
2235
+ return "CRM";
2236
+ case "hrms":
2237
+ return "HRMS";
2238
+ case "rental":
2239
+ return "Rental";
2240
+ case "rbac":
2241
+ case "user":
2242
+ return "Users";
2243
+ default:
2244
+ return null;
2245
+ }
2246
+ };
2247
+ const mappedModules = ((uData2 == null ? void 0 : uData2.module_access) || []).map((m) => mapLocalToApiModule(m.module_name)).filter(Boolean);
2248
+ const uniqueModules = Array.from(new Set(mappedModules));
2249
+ if (uniqueModules.length === 0) {
2250
+ setDynamicQuestions([]);
2251
+ return;
2252
+ }
2253
+ const modules = [...uniqueModules].sort(() => Math.random() - 0.5).slice(0, 4);
2254
+ const res = await api$1.getV1CopilotQuestions(modules, token);
2255
+ if (res && res.modules) {
2256
+ const questions = [];
2257
+ res.modules.forEach((mod) => {
2258
+ if (mod.questions) {
2259
+ mod.questions.forEach((q) => {
2260
+ questions.push({
2261
+ prompt: q,
2262
+ cat: mod.module.toUpperCase(),
2263
+ mode: "conversation",
2264
+ kind: "blue"
2265
+ });
2266
+ });
2267
+ }
2268
+ });
2269
+ setDynamicQuestions(questions);
2270
+ }
2271
+ } catch (e) {
2272
+ console.error("Failed to fetch copilot questions", e);
2273
+ }
2274
+ }, []);
2275
+ React.useEffect(() => {
2276
+ if (isOpen) {
2277
+ setTimeout(() => {
2278
+ var _a2;
2279
+ return (_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
2280
+ }, 100);
2281
+ if (dynamicQuestions.length === 0) {
2282
+ fetchQuestions();
2283
+ }
2284
+ }
2285
+ }, [isOpen, dynamicQuestions.length, fetchQuestions]);
2286
+ React.useEffect(() => {
2287
+ if (!isTyping && isOpen) {
2288
+ setTimeout(() => {
2289
+ var _a2;
2290
+ return (_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
2291
+ }, 100);
2292
+ }
2293
+ }, [isTyping, isOpen]);
2294
+ const handleDockAsk = React.useCallback(({ prefill }) => {
2295
+ setIsOpen(true);
2296
+ if (prefill) setInputValue(prefill);
2297
+ setTimeout(() => {
2298
+ const ta = textareaRef.current;
2299
+ if (!ta) return;
2300
+ ta.focus();
2301
+ ta.scrollIntoView({ block: "nearest", behavior: "smooth" });
2302
+ if (prefill) ta.selectionStart = ta.selectionEnd = prefill.length;
2303
+ }, 120);
2304
+ }, []);
2305
+ chatDockState.useChatFocusListener(handleDockAsk);
2306
+ const panelRef = React.useRef(null);
2307
+ const [panelHeight, setPanelHeight] = React.useState(null);
2308
+ React.useLayoutEffect(() => {
2309
+ if (!(inline && dashboardMode)) return;
2310
+ const GAP2 = 16;
2311
+ const restTop = (el) => window.innerHeight - parseFloat(getComputedStyle(el).bottom || "0") - el.offsetHeight;
2312
+ const calc = () => {
2313
+ const el = panelRef.current;
2314
+ if (!el) return;
2315
+ const top = el.getBoundingClientRect().top + window.scrollY;
2316
+ const dock2 = document.querySelector(".fmd");
2317
+ const pill = document.querySelector(".fmd-pill");
2318
+ let limit = window.innerHeight - GAP2;
2319
+ if (dock2) {
2320
+ const collapsed = dock2.dataset.collapsed === "true";
2321
+ limit = collapsed && pill ? restTop(pill) - 14 : restTop(dock2) - GAP2;
2322
+ }
2323
+ setPanelHeight(Math.max(320, Math.floor(limit - top)));
2324
+ };
2325
+ calc();
2326
+ window.addEventListener("resize", calc);
2327
+ window.addEventListener(chatDockState.DOCK_LAYOUT_EVENT, calc);
2328
+ const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(calc) : null;
2329
+ const dock = document.querySelector(".fmd");
2330
+ if (ro && dock) ro.observe(dock);
2331
+ return () => {
2332
+ window.removeEventListener("resize", calc);
2333
+ window.removeEventListener(chatDockState.DOCK_LAYOUT_EVENT, calc);
2334
+ ro == null ? void 0 : ro.disconnect();
2335
+ };
2336
+ }, [inline, dashboardMode]);
2337
+ React.useEffect(() => {
2338
+ const container = bodyRef.current;
2339
+ if (!container) return;
2340
+ const onScroll = () => {
2341
+ const atBottom = container.scrollHeight - container.scrollTop - container.clientHeight < 40;
2342
+ userScrolledUp.current = !atBottom;
2343
+ };
2344
+ container.addEventListener("scroll", onScroll);
2345
+ return () => container.removeEventListener("scroll", onScroll);
2346
+ }, []);
2347
+ React.useEffect(() => {
2348
+ if (!userScrolledUp.current && bodyRef.current) {
2349
+ bodyRef.current.scrollTop = bodyRef.current.scrollHeight;
2350
+ }
2351
+ }, [messages, isTyping, currentFieldUpdates, resolvedLabels, activeDocument, activeDocuments, suggestedQuestions]);
2352
+ const selectCommand = (id) => {
2353
+ if (id !== mode) {
2354
+ tabStateRef.current[mode] = {
2355
+ doc: activeDocument,
2356
+ docs: activeDocuments,
2357
+ suggested: suggestedQuestions,
2358
+ introSent: docIntroSent,
2359
+ error: docError,
2360
+ multiDocIds: fetchedMultiDocIntroIds.current
2361
+ };
2362
+ const nextState = tabStateRef.current[id] || { doc: null, docs: [], suggested: [], introSent: false, error: null, multiDocIds: "" };
2363
+ setActiveDocument(nextState.doc);
2364
+ setActiveDocuments(nextState.docs);
2365
+ setSuggestedQuestions(nextState.suggested);
2366
+ setDocIntroSent(nextState.introSent);
2367
+ setDocError(nextState.error);
2368
+ fetchedMultiDocIntroIds.current = nextState.multiDocIds;
2369
+ }
2370
+ setMode(id);
2371
+ setShowSlashMenu(false);
2372
+ setSlashIndex(0);
2373
+ if (id === "conversation") {
2374
+ setFormType(null);
2375
+ setFormStatus("in_progress");
2376
+ setPendingFormAction(null);
2377
+ agentStarted.current = false;
2378
+ } else if (id === "agent" && !formType) {
2379
+ setFormType("sales_invoice");
2380
+ }
2381
+ setTimeout(() => {
2382
+ var _a2;
2383
+ return (_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
2384
+ }, 0);
2385
+ };
2386
+ const handleModeChange = (id) => {
2387
+ selectCommand(id);
2388
+ };
2389
+ const handleInputChange = (e) => {
2390
+ const val = e.target.value;
2391
+ setInputValue(val);
2392
+ if (val.startsWith("/")) {
2393
+ setShowSlashMenu(true);
2394
+ setSlashIndex(0);
2395
+ } else {
2396
+ setShowSlashMenu(false);
2397
+ }
2398
+ };
2399
+ const handleSuggestion = (prompt, suggestionMode, suggestionFormType) => {
2400
+ if (mode !== "smart") {
2401
+ setMode(suggestionMode);
2402
+ }
2403
+ if (suggestionFormType) setFormType(suggestionFormType);
2404
+ setInputValue(prompt);
2405
+ setTimeout(() => {
2406
+ const ta = textareaRef.current;
2407
+ if (ta) {
2408
+ ta.focus();
2409
+ ta.selectionStart = ta.selectionEnd = prompt.length;
2410
+ }
2411
+ }, 0);
2412
+ };
2413
+ const handleDocUpload = React.useCallback(async (file, onProgress) => {
2414
+ const { "x-token": token } = api.getToken();
2415
+ setDocError(null);
2416
+ const result = await api$1.uploadDocument(file, token, void 0, onProgress);
2417
+ const doc = {
2418
+ doc_id: result.doc_id,
2419
+ filename: result.filename,
2420
+ status: result.status,
2421
+ pages: result.pages
2422
+ };
2423
+ setActiveDocument(doc);
2424
+ if (result.deduplicated && result.status === "ready") {
2425
+ const fullStatus = await api$1.getDocumentStatus(result.doc_id, token);
2426
+ const fullDoc = {
2427
+ doc_id: fullStatus.doc_id,
2428
+ filename: fullStatus.filename || result.filename,
2429
+ status: fullStatus.status,
2430
+ pages: fullStatus.pages || result.pages,
2431
+ category: fullStatus.category || void 0,
2432
+ sub_category: fullStatus.sub_category || void 0,
2433
+ chunk_count: fullStatus.chunk_count || void 0
2434
+ };
2435
+ setActiveDocument(fullDoc);
2436
+ setDocIntroSent(false);
2437
+ const onDocIntro = (data) => {
2438
+ if (data == null ? void 0 : data.found) {
2439
+ setActiveDocument((prev) => prev && prev.doc_id === fullDoc.doc_id ? {
2440
+ ...prev,
2441
+ summary: data.summary,
2442
+ suggested_questions: data.suggested_questions,
2443
+ category: data.category || prev.category,
2444
+ sub_category: data.sub_category || prev.sub_category
2445
+ } : prev);
2446
+ }
2447
+ };
2448
+ if (mode === "smart") {
2449
+ smartSessionIdRef.current = null;
2450
+ formSessionIdRef.current = null;
2451
+ agentStarted.current = false;
2452
+ setFormType(null);
2453
+ setFormStatus("in_progress");
2454
+ setPendingFormAction(null);
2455
+ setCurrentFieldUpdates(null);
2456
+ setResolvedLabels({});
2457
+ }
2458
+ api$1.streamV1CopilotChat(
2459
+ { ...api.getToken(), query: "", doc_id: fullDoc.doc_id, doc_intro: true },
2460
+ () => {
2461
+ },
2462
+ () => {
2463
+ },
2464
+ () => {
2465
+ },
2466
+ () => {
2467
+ },
2468
+ onDocIntro
2469
+ ).catch(() => {
2470
+ });
2471
+ return fullDoc;
2472
+ }
2473
+ return doc;
2474
+ }, []);
2475
+ const handleDocUploadComplete = React.useCallback((doc) => {
2476
+ setDocIntroSent(false);
2477
+ }, []);
2478
+ const handleDocUploadError = React.useCallback((msg) => {
2479
+ setDocError(msg);
2480
+ }, []);
2481
+ const handleDocReady = React.useCallback((doc) => {
2482
+ setActiveDocument(doc);
2483
+ setDocIntroSent(false);
2484
+ const onDocIntro = (data) => {
2485
+ if (data == null ? void 0 : data.found) {
2486
+ setActiveDocument((prev) => prev && prev.doc_id === doc.doc_id ? {
2487
+ ...prev,
2488
+ summary: data.summary,
2489
+ suggested_questions: data.suggested_questions,
2490
+ category: data.category || prev.category,
2491
+ sub_category: data.sub_category || prev.sub_category
2492
+ } : prev);
2493
+ }
2494
+ };
2495
+ if (mode === "smart") {
2496
+ smartSessionIdRef.current = null;
2497
+ formSessionIdRef.current = null;
2498
+ agentStarted.current = false;
2499
+ setFormType(null);
2500
+ setFormStatus("in_progress");
2501
+ setPendingFormAction(null);
2502
+ setCurrentFieldUpdates(null);
2503
+ setResolvedLabels({});
2504
+ }
2505
+ api$1.streamV1CopilotChat(
2506
+ { ...api.getToken(), query: "", doc_id: doc.doc_id, doc_intro: true },
2507
+ () => {
2508
+ },
2509
+ () => {
2510
+ },
2511
+ () => {
2512
+ },
2513
+ () => {
2514
+ },
2515
+ onDocIntro
2516
+ ).catch(() => {
2517
+ });
2518
+ }, []);
2519
+ const handleDocError = React.useCallback((doc) => {
2520
+ setActiveDocument(null);
2521
+ setDocError(doc.error || "Document processing failed");
2522
+ }, []);
2523
+ const handleDocDelete = React.useCallback(async () => {
2524
+ if (!activeDocument) return;
2525
+ const docId = activeDocument.doc_id;
2526
+ try {
2527
+ const { "x-token": token } = api.getToken();
2528
+ const { deleteDocument } = await Promise.resolve().then(() => require("./api-BNpPd9ZI.js")).then((n) => n.api$1);
2529
+ await deleteDocument(docId, token);
2530
+ setActiveDocument(
2531
+ (current) => (current == null ? void 0 : current.doc_id) === docId ? null : current
2532
+ );
2533
+ setDocIntroSent(false);
2534
+ setDocError(null);
2535
+ } catch {
2536
+ setDocError("Failed to delete document. Please try again.");
2537
+ }
2538
+ }, [activeDocument]);
2539
+ const checkAndSendMultiDocIntro = React.useCallback((docs) => {
2540
+ if (docs.length === 0) return;
2541
+ if (docs.some((d) => d.status !== "ready")) return;
2542
+ const currentIds = docs.map((d) => d.doc_id).sort().join(",");
2543
+ if (fetchedMultiDocIntroIds.current === currentIds) return;
2544
+ fetchedMultiDocIntroIds.current = currentIds;
2545
+ const onDocIntro = (data) => {
2546
+ if (data == null ? void 0 : data.found) {
2547
+ if (data.suggested_questions) {
2548
+ setSuggestedQuestions(data.suggested_questions);
2549
+ }
2550
+ setActiveDocuments((prev) => prev.map((p) => {
2551
+ if (docs.length === 1) {
2552
+ return {
2553
+ ...p,
2554
+ summary: data.summary,
2555
+ category: data.category || p.category,
2556
+ sub_category: data.sub_category || p.sub_category
2557
+ };
2558
+ } else if (data.docs && Array.isArray(data.docs)) {
2559
+ const dData = data.docs.find((d) => d.doc_id === p.doc_id);
2560
+ if (dData) {
2561
+ return {
2562
+ ...p,
2563
+ summary: dData.summary,
2564
+ category: dData.category || p.category,
2565
+ sub_category: dData.sub_category || p.sub_category
2566
+ };
2567
+ }
2568
+ }
2569
+ return p;
2570
+ }));
2571
+ }
2572
+ };
2573
+ if (mode === "smart") {
2574
+ smartSessionIdRef.current = null;
2575
+ formSessionIdRef.current = null;
2576
+ agentStarted.current = false;
2577
+ setFormType(null);
2578
+ setFormStatus("in_progress");
2579
+ setPendingFormAction(null);
2580
+ setCurrentFieldUpdates(null);
2581
+ setResolvedLabels({});
2582
+ }
2583
+ api$1.streamV1CopilotChat(
2584
+ { ...api.getToken(), query: "", doc_ids: docs.map((d) => d.doc_id), doc_intro: true },
2585
+ () => {
2586
+ },
2587
+ () => {
2588
+ },
2589
+ () => {
2590
+ },
2591
+ () => {
2592
+ },
2593
+ onDocIntro
2594
+ ).catch(() => {
2595
+ });
2596
+ }, [docIntroSent, mode]);
2597
+ const handleMultiDocUpload = React.useCallback(async (files, onProgress) => {
2598
+ const { "x-token": token } = api.getToken();
2599
+ setDocError(null);
2600
+ const result = await api$1.uploadDocuments(files, token, void 0, onProgress);
2601
+ const items = Array.isArray(result) ? result : result.items || [];
2602
+ const docs = items.map((r) => ({
2603
+ doc_id: r.doc_id,
2604
+ filename: r.filename,
2605
+ status: r.status,
2606
+ pages: r.pages,
2607
+ error: r.error
2608
+ }));
2609
+ setActiveDocuments((prev) => {
2610
+ const newDocs = [...prev];
2611
+ docs.forEach((d) => {
2612
+ if (!newDocs.find((x) => x.doc_id === d.doc_id)) newDocs.push(d);
2613
+ });
2614
+ return newDocs;
2615
+ });
2616
+ setDocIntroSent(false);
2617
+ const readyDocs = items.filter((r) => r.deduplicated && r.status === "ready");
2618
+ if (readyDocs.length > 0) {
2619
+ const fullStatuses = await Promise.all(readyDocs.map((r) => api$1.getDocumentStatus(r.doc_id, token)));
2620
+ setActiveDocuments((prev) => {
2621
+ const updated = prev.map((p) => {
2622
+ const full = fullStatuses.find((fs) => fs.doc_id === p.doc_id);
2623
+ if (full) {
2624
+ return {
2625
+ ...p,
2626
+ filename: full.filename || p.filename,
2627
+ status: full.status,
2628
+ pages: full.pages || p.pages,
2629
+ category: full.category || p.category,
2630
+ sub_category: full.sub_category || p.sub_category,
2631
+ chunk_count: full.chunk_count || p.chunk_count
2632
+ };
2633
+ }
2634
+ return p;
2635
+ });
2636
+ setTimeout(() => checkAndSendMultiDocIntro(updated), 0);
2637
+ return updated;
2638
+ });
2639
+ }
2640
+ return docs;
2641
+ }, [checkAndSendMultiDocIntro]);
2642
+ const handleMultiDocUploadComplete = React.useCallback((docs) => {
2643
+ setDocIntroSent(false);
2644
+ }, []);
2645
+ React.useCallback((msg) => {
2646
+ setDocError(msg);
2647
+ }, []);
2648
+ const handleMultiDocReady = React.useCallback((doc) => {
2649
+ setActiveDocuments((prev) => {
2650
+ const updated = prev.map((p) => p.doc_id === doc.doc_id ? doc : p);
2651
+ setTimeout(() => checkAndSendMultiDocIntro(updated), 0);
2652
+ return updated;
2653
+ });
2654
+ }, [checkAndSendMultiDocIntro]);
2655
+ const handleMultiDocError = React.useCallback((doc) => {
2656
+ setActiveDocuments((prev) => {
2657
+ const updated = prev.filter((p) => p.doc_id !== doc.doc_id);
2658
+ setTimeout(() => checkAndSendMultiDocIntro(updated), 0);
2659
+ return updated;
2660
+ });
2661
+ setDocError(doc.error || "Document processing failed");
2662
+ }, [checkAndSendMultiDocIntro]);
2663
+ const handleMultiDocDelete = React.useCallback(async (docId) => {
2664
+ if (activeDocuments.length === 0) return;
2665
+ const docsToDelete = docId ? activeDocuments.filter((d) => d.doc_id === docId) : activeDocuments;
2666
+ try {
2667
+ const { "x-token": token } = api.getToken();
2668
+ const { deleteDocument } = await Promise.resolve().then(() => require("./api-BNpPd9ZI.js")).then((n) => n.api$1);
2669
+ await Promise.all(docsToDelete.map((d) => deleteDocument(d.doc_id, token)));
2670
+ setActiveDocuments((current) => docId ? current.filter((c) => c.doc_id !== docId) : []);
2671
+ setDocIntroSent(false);
2672
+ setDocError(null);
2673
+ setSuggestedQuestions([]);
2674
+ fetchedMultiDocIntroIds.current = "";
2675
+ } catch {
2676
+ setDocError("Failed to delete document(s). Please try again.");
2677
+ }
2678
+ }, [activeDocuments]);
2679
+ const handleAddDocuments = React.useCallback(async (files, onProgress) => {
2680
+ const attachedCount = activeDocuments.length + (activeDocument ? 1 : 0);
2681
+ if (attachedCount + files.length > MAX_ATTACHED_DOCS) {
2682
+ throw new Error(`You can attach up to ${MAX_ATTACHED_DOCS} documents per chat.`);
2683
+ }
2684
+ if (activeDocument) {
2685
+ const existing = activeDocument;
2686
+ setActiveDocuments((prev) => prev.some((d) => d.doc_id === existing.doc_id) ? prev : [existing, ...prev]);
2687
+ setActiveDocument(null);
2688
+ fetchedMultiDocIntroIds.current = "";
2689
+ }
2690
+ const docs = await handleMultiDocUpload(files, onProgress);
2691
+ setSuggestedQuestions([]);
2692
+ return docs;
2693
+ }, [activeDocument, activeDocuments, handleMultiDocUpload]);
2694
+ const handleDocDetach = React.useCallback((docId) => {
2695
+ setDocError(null);
2696
+ setDocIntroSent(false);
2697
+ setSuggestedQuestions([]);
2698
+ fetchedMultiDocIntroIds.current = "";
2699
+ if ((activeDocument == null ? void 0 : activeDocument.doc_id) === docId) {
2700
+ setActiveDocument(null);
2701
+ return;
2702
+ }
2703
+ const remaining = activeDocuments.filter((d) => d.doc_id !== docId);
2704
+ setActiveDocuments(remaining);
2705
+ checkAndSendMultiDocIntro(remaining);
2706
+ }, [activeDocument, activeDocuments, checkAndSendMultiDocIntro]);
2707
+ const sendMessage = React.useCallback(
2708
+ async (text) => {
2709
+ if (isTyping) return;
2710
+ if (mode === "conversation" && !text.trim()) return;
2711
+ if (mode === "agent" && !formType) return;
2712
+ if (mode === "doc_qa" && !activeDocument && activeDocuments.length === 0) return;
2713
+ if (mode === "smart" && !text.trim()) return;
2714
+ const userText = text;
2715
+ setMessages((prev) => [
2716
+ ...prev,
2717
+ { id: Date.now(), role: "user", text: userText, mode }
2718
+ ]);
2719
+ setInputValue("");
2720
+ setIsTyping(true);
2721
+ let aiMsgId = null;
2722
+ const startTime = Date.now();
2723
+ const conversation = conversationRef.current;
2724
+ const isCurrentConversation = () => conversationRef.current === conversation;
2725
+ const setTurnMessages = (value) => {
2726
+ if (isCurrentConversation()) setMessages(value);
2727
+ };
2728
+ const appendToken = (chunk) => {
2729
+ if (aiMsgId === null) {
2730
+ aiMsgId = Date.now() + 1;
2731
+ const responseTime = `${((Date.now() - startTime) / 1e3).toFixed(1)}s`;
2732
+ setIsTyping(false);
2733
+ setTurnMessages((prev) => [
2734
+ ...prev,
2735
+ { id: aiMsgId, role: "ai", text: chunk, time: responseTime, mode }
2736
+ ]);
2737
+ } else {
2738
+ setTurnMessages(
2739
+ (prev) => prev.map((m) => m.id === aiMsgId ? { ...m, text: m.text + chunk } : m)
2740
+ );
2741
+ }
2742
+ };
2743
+ const onBlocks = (blocks) => {
2744
+ if (blocks.length === 0) return;
2745
+ if (aiMsgId === null) {
2746
+ aiMsgId = Date.now() + 1;
2747
+ const responseTime = `${((Date.now() - startTime) / 1e3).toFixed(1)}s`;
2748
+ setIsTyping(false);
2749
+ setTurnMessages((prev) => [
2750
+ ...prev,
2751
+ { id: aiMsgId, role: "ai", text: "", time: responseTime, mode, blocks }
2752
+ ]);
2753
+ } else {
2754
+ setTurnMessages((prev) => prev.map((m) => m.id === aiMsgId ? { ...m, blocks } : m));
2755
+ }
2756
+ };
2757
+ const onDone = (usage) => {
2758
+ setIsTyping(false);
2759
+ if (aiMsgId === null) return;
2760
+ const durationMs = Date.now() - startTime;
2761
+ const inputTokens = (usage == null ? void 0 : usage.input_tokens) ?? (usage == null ? void 0 : usage.prompt_tokens);
2762
+ const outputTokens = (usage == null ? void 0 : usage.output_tokens) ?? (usage == null ? void 0 : usage.completion_tokens);
2763
+ const tokens = (usage == null ? void 0 : usage.total_tokens) ?? (inputTokens !== void 0 || outputTokens !== void 0 ? (inputTokens ?? 0) + (outputTokens ?? 0) : void 0);
2764
+ setTurnMessages((prev) => prev.map((m) => m.id === aiMsgId ? { ...m, durationMs, tokens, inputTokens, outputTokens } : m));
2765
+ };
2766
+ const onError = (message) => {
2767
+ setIsTyping(false);
2768
+ const errorText = message || "Sorry, something went wrong. Please try again.";
2769
+ if (aiMsgId !== null) {
2770
+ setTurnMessages((prev) => prev.map(
2771
+ (m) => m.id === aiMsgId ? { ...m, text: m.text + "\n\n⚠️ " + errorText } : m
2772
+ ));
2773
+ } else {
2774
+ setTurnMessages((prev) => [
2775
+ ...prev,
2776
+ { id: Date.now() + 1, role: "ai", text: errorText, time: getTime(), mode }
2777
+ ]);
2778
+ }
2779
+ };
2780
+ const onOffTopic = () => {
2781
+ setIsTyping(false);
2782
+ if (aiMsgId === null) {
2783
+ setTurnMessages((prev) => [
2784
+ ...prev,
2785
+ { id: Date.now() + 1, role: "ai", text: "That question is outside the scope of ERP data.", time: getTime(), mode }
2786
+ ]);
2787
+ }
2788
+ };
2789
+ const resolveFieldLabel = async (key, value) => {
2790
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
2791
+ const cacheKey = `${key}:${value}`;
2792
+ if (labelCacheRef.current[cacheKey]) return labelCacheRef.current[cacheKey];
2793
+ let label = String(value ?? "");
2794
+ try {
2795
+ if (key === "customer_id" || key === "vendor_id") {
2796
+ const res = await api$1.getV1PartiesId({ ...api.getToken(), id: value });
2797
+ const p = ((_c = (_b = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.parties) == null ? void 0 : _b.party) == null ? void 0 : _c.data) || ((_e = (_d = res == null ? void 0 : res.data) == null ? void 0 : _d.parties) == null ? void 0 : _e.party) || {};
2798
+ label = p.company_name || `${p.first_name || ""} ${p.last_name || ""}`.trim() || label;
2799
+ } else if (key === "payment_term_id") {
2800
+ const res = await api$1.getV1PaymentTermsId({ ...api.getToken(), id: value });
2801
+ const pt = ((_h = (_g = (_f = res == null ? void 0 : res.data) == null ? void 0 : _f.payment_term) == null ? void 0 : _g.payment_term) == null ? void 0 : _h.data) || {};
2802
+ label = pt.name || label;
2803
+ } else if (key === "account_payable_id" || key === "account_receivable_id") {
2804
+ const res = await api$1.getV1ChartOfAccountId({ ...api.getToken(), id: value });
2805
+ const c = ((_k = (_j = (_i = res == null ? void 0 : res.data) == null ? void 0 : _i.chart_of_account) == null ? void 0 : _j.account) == null ? void 0 : _k.data) || {};
2806
+ label = c.account_name || label;
2807
+ } else if (key === "company_id") {
2808
+ const res = await api$2.getV1CompanyId({ ...api.getToken(), id: value });
2809
+ const c = ((_m = (_l = res == null ? void 0 : res.data) == null ? void 0 : _l.company) == null ? void 0 : _m.data) || {};
2810
+ label = c.company_name || label;
2811
+ } else if (key === "currency_id" || key === "supplier_currency_id") {
2812
+ const res = await api$1.getV1CurrencyId({ ...api.getToken(), id: value });
2813
+ const c = ((_o = (_n = res == null ? void 0 : res.data) == null ? void 0 : _n.currency) == null ? void 0 : _o.data) || {};
2814
+ label = c.currency_name || label;
2815
+ } else if (key === "region_id") {
2816
+ const res = await api$2.getV1LocationsStates({ ...api.getToken(), id: Number(value) });
2817
+ const r = ((_p = res == null ? void 0 : res.data) == null ? void 0 : _p.state) || (res == null ? void 0 : res.data) || {};
2818
+ label = r.name || r.state_name || label;
2819
+ } else if (key === "location" || key.startsWith("invoice_addresses.shipping_address") || key.startsWith("invoice_addresses.billing_address") || key.startsWith("invoice_addresses.place_of_supply")) {
2820
+ const res = await api$1.getV1WarehouseLocationId({ ...api.getToken(), id: value });
2821
+ const wl = ((_s = (_r = (_q = res == null ? void 0 : res.data) == null ? void 0 : _q.warehouse_location) == null ? void 0 : _r.warehouse_location) == null ? void 0 : _s.data) || {};
2822
+ label = wl.name || label;
2823
+ } else if (key === "department" || key === "department_id") {
2824
+ const res = await api.getV1DepartmentsId({ ...api.getToken(), id: value });
2825
+ const d = ((_v = (_u = (_t = res == null ? void 0 : res.data) == null ? void 0 : _t.department) == null ? void 0 : _u.department) == null ? void 0 : _v.data) || {};
2826
+ label = d.name || label;
2827
+ } else if (key.startsWith("invoice_addresses.supplier_address") || key.startsWith("invoice_addresses.contact_person")) {
2828
+ const res = await api$1.getV1PartiesId({ ...api.getToken(), id: value });
2829
+ const p = ((_y = (_x = (_w = res == null ? void 0 : res.data) == null ? void 0 : _w.parties) == null ? void 0 : _x.party) == null ? void 0 : _y.data) || ((_A = (_z = res == null ? void 0 : res.data) == null ? void 0 : _z.parties) == null ? void 0 : _A.party) || {};
2830
+ label = p.company_name || `${p.first_name || ""} ${p.last_name || ""}`.trim() || label;
2831
+ }
2832
+ } catch {
2833
+ }
2834
+ labelCacheRef.current[cacheKey] = label;
2835
+ return label;
2836
+ };
2837
+ const onFieldUpdates = async (updates) => {
2838
+ if (Object.keys(updates).length === 0) return;
2839
+ setCurrentFieldUpdates((prev) => ({ ...prev || {}, ...updates }));
2840
+ const newLabels = {};
2841
+ const expenseAccountIds = updates["purchase_expense_entries.accounts.account_name"];
2842
+ if (Array.isArray(expenseAccountIds)) {
2843
+ const accountPromises = expenseAccountIds.map(async (accountId) => {
2844
+ var _a2, _b, _c;
2845
+ const cacheKey = `purchase_expense_entries.accounts.account_name:${accountId}`;
2846
+ if (labelCacheRef.current[cacheKey]) {
2847
+ newLabels[cacheKey] = labelCacheRef.current[cacheKey];
2848
+ return;
2849
+ }
2850
+ try {
2851
+ const res = await api$1.getV1ChartOfAccountId({ ...api.getToken(), id: accountId });
2852
+ const c = ((_c = (_b = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.chart_of_account) == null ? void 0 : _b.account) == null ? void 0 : _c.data) || {};
2853
+ const label = c.account_name || `Account #${accountId}`;
2854
+ labelCacheRef.current[cacheKey] = label;
2855
+ newLabels[cacheKey] = label;
2856
+ } catch {
2857
+ newLabels[cacheKey] = `Account #${accountId}`;
2858
+ }
2859
+ });
2860
+ await Promise.all(accountPromises);
2861
+ }
2862
+ const expenseTaxCodes = updates["purchase_expense_entries.tax_codes"];
2863
+ if (Array.isArray(expenseTaxCodes)) {
2864
+ const uniqueTaxIds = [...new Set(expenseTaxCodes.filter(Boolean))];
2865
+ const taxPromises = uniqueTaxIds.map(async (taxId) => {
2866
+ var _a2, _b;
2867
+ const cacheKey = `tax_code_data:${taxId}`;
2868
+ if (labelCacheRef.current[cacheKey]) {
2869
+ newLabels[cacheKey] = labelCacheRef.current[cacheKey];
2870
+ return;
2871
+ }
2872
+ try {
2873
+ const res = await api$1.getV1TaxCodeId({ ...api.getToken(), id: taxId });
2874
+ const taxCode = ((_b = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.taxCode) == null ? void 0 : _b.data) || {};
2875
+ const taxRate = Number(taxCode.rate) || 0;
2876
+ const taxName = taxCode.name || `Tax #${taxId}`;
2877
+ const label = JSON.stringify({ name: `${taxName} (${taxRate}%)`, rate: taxRate });
2878
+ labelCacheRef.current[cacheKey] = label;
2879
+ newLabels[cacheKey] = label;
2880
+ } catch {
2881
+ newLabels[cacheKey] = JSON.stringify({ name: `Tax #${taxId}`, rate: 0 });
2882
+ }
2883
+ });
2884
+ await Promise.all(taxPromises);
2885
+ }
2886
+ const itemNames = updates["sales_item_entries.items.name"] || updates["purchase_item_entries.items.name"];
2887
+ const itemPrefix = updates["sales_item_entries.items.name"] ? "sales_item_entries" : "purchase_item_entries";
2888
+ if (Array.isArray(itemNames)) {
2889
+ const itemPromises = itemNames.map(async (itemId) => {
2890
+ var _a2;
2891
+ const cacheKey = `${itemPrefix}.items.name:${itemId}`;
2892
+ if (labelCacheRef.current[cacheKey]) {
2893
+ newLabels[cacheKey] = labelCacheRef.current[cacheKey];
2894
+ return;
2895
+ }
2896
+ try {
2897
+ const res = await api$1.getV1InventoryItemsId({ ...api.getToken(), id: itemId });
2898
+ const item = ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) || {};
2899
+ const label = item.name || `Item #${itemId}`;
2900
+ labelCacheRef.current[cacheKey] = label;
2901
+ newLabels[cacheKey] = label;
2902
+ } catch {
2903
+ newLabels[cacheKey] = `Item #${itemId}`;
2904
+ }
2905
+ });
2906
+ await Promise.all(itemPromises);
2907
+ }
2908
+ const taxCodes = updates["sales_item_entries.tax_codes"] || updates["purchase_item_entries.tax_codes"];
2909
+ if (Array.isArray(taxCodes)) {
2910
+ const uniqueTaxIds = [...new Set(taxCodes.filter(Boolean))];
2911
+ const taxPromises = uniqueTaxIds.map(async (taxId) => {
2912
+ var _a2, _b;
2913
+ const cacheKey = `tax_code_data:${taxId}`;
2914
+ if (labelCacheRef.current[cacheKey]) {
2915
+ newLabels[cacheKey] = labelCacheRef.current[cacheKey];
2916
+ return;
2917
+ }
2918
+ try {
2919
+ const res = await api$1.getV1TaxCodeId({ ...api.getToken(), id: taxId });
2920
+ const taxCode = ((_b = (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.taxCode) == null ? void 0 : _b.data) || {};
2921
+ const taxRate = Number(taxCode.rate) || 0;
2922
+ const taxName = taxCode.name || `Tax #${taxId}`;
2923
+ const label = JSON.stringify({ name: `${taxName} (${taxRate}%)`, rate: taxRate });
2924
+ labelCacheRef.current[cacheKey] = label;
2925
+ newLabels[cacheKey] = label;
2926
+ } catch {
2927
+ newLabels[cacheKey] = JSON.stringify({ name: `Tax #${taxId}`, rate: 0 });
2928
+ }
2929
+ });
2930
+ await Promise.all(taxPromises);
2931
+ }
2932
+ const uomKeys = ["sales_item_entries.units_of_measurement.uom_name", "sales_item_entries.units_of_measurement.name", "purchase_item_entries.units_of_measurement.uom_name"];
2933
+ const uomIdsForKey = uomKeys.find((k) => Array.isArray(updates[k]));
2934
+ if (uomIdsForKey) {
2935
+ const uomIds = updates[uomIdsForKey];
2936
+ const uomPrefix = uomIdsForKey.startsWith("sales") ? "sales_item_entries" : "purchase_item_entries";
2937
+ const uomPromises = uomIds.map(async (uomId) => {
2938
+ var _a2, _b;
2939
+ const cacheKey = `${uomPrefix}.units_of_measurement:${uomId}`;
2940
+ if (labelCacheRef.current[cacheKey]) {
2941
+ newLabels[cacheKey] = labelCacheRef.current[cacheKey];
2942
+ return;
2943
+ }
2944
+ try {
2945
+ const res = await api$1.getV1Uom({ ...api.getToken(), filters: JSON.stringify({ id: uomId }) });
2946
+ const uomList = ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2["uom"]) || ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.data) || [];
2947
+ const uom = Array.isArray(uomList) ? uomList[0] : uomList;
2948
+ const label = (uom == null ? void 0 : uom.name) || (uom == null ? void 0 : uom.uom_name) || `UOM #${uomId}`;
2949
+ labelCacheRef.current[cacheKey] = label;
2950
+ newLabels[cacheKey] = label;
2951
+ } catch {
2952
+ newLabels[cacheKey] = `UOM #${uomId}`;
2953
+ }
2954
+ });
2955
+ await Promise.all(uomPromises);
2956
+ }
2957
+ const promises = Object.entries(updates).map(async ([key, value]) => {
2958
+ if (value !== void 0 && value !== null && value !== "") {
2959
+ if (key === "sales_item_entries.items.name" || key === "purchase_item_entries.items.name" || key === "purchase_expense_entries.accounts.account_name") return;
2960
+ if (uomKeys.includes(key)) return;
2961
+ newLabels[key] = await resolveFieldLabel(key, value);
2962
+ }
2963
+ });
2964
+ await Promise.all(promises);
2965
+ setResolvedLabels((prev) => ({ ...prev, ...newLabels }));
2966
+ };
2967
+ const onChatSessionId = (sessionId) => {
2968
+ if (!isCurrentConversation()) return;
2969
+ chatSessionIdRef.current = sessionId;
2970
+ markActiveSession(sessionId);
2971
+ };
2972
+ try {
2973
+ if (mode === "smart") {
2974
+ const docsToPass = activeDocuments.length > 0 ? activeDocuments.map((d) => ({ doc_id: d.doc_id, filename: d.filename, sub_category: d.sub_category || "General" })) : activeDocument ? [{ doc_id: activeDocument.doc_id, filename: activeDocument.filename, sub_category: activeDocument.sub_category || "General" }] : void 0;
2975
+ await api$1.streamV1CopilotSmart(
2976
+ { ...api.getToken(), query: text, docs: docsToPass, "x-timezone": (/* @__PURE__ */ new Date()).getTimezoneOffset(), session_id: smartSessionIdRef.current || void 0 },
2977
+ appendToken,
2978
+ onDone,
2979
+ onError,
2980
+ onOffTopic,
2981
+ void 0,
2982
+ (planData) => {
2983
+ },
2984
+ onFieldUpdates,
2985
+ (citationsData) => {
2986
+ if (citationsData && citationsData.length > 0) {
2987
+ const docGroups = {};
2988
+ citationsData.forEach((c) => {
2989
+ const key = c.doc_id || c.filename;
2990
+ if (!docGroups[key]) {
2991
+ docGroups[key] = { filename: c.filename, chunks: [] };
2992
+ }
2993
+ docGroups[key].chunks.push(c);
2994
+ });
2995
+ let citationText = "\n\n**Sources:**\n\n";
2996
+ Object.values(docGroups).forEach((group) => {
2997
+ citationText += `📄 **${group.filename}**
2998
+ `;
2999
+ const pages = [...new Set(group.chunks.map((c) => c.page_num).filter((p) => p !== void 0 && p !== null))].sort((a, b) => a - b);
3000
+ if (pages.length > 0) {
3001
+ if (pages.length === 1) {
3002
+ citationText += ` Page ${pages[0]}
3003
+
3004
+ `;
3005
+ } else {
3006
+ citationText += ` Pages ${pages[0]}–${pages[pages.length - 1]}
3007
+
3008
+ `;
3009
+ }
3010
+ } else {
3011
+ citationText += "\n";
3012
+ }
3013
+ });
3014
+ appendToken(citationText);
3015
+ }
3016
+ },
3017
+ async (action) => {
3018
+ if (["save_draft", "submit_form", "discard_form"].includes(action)) {
3019
+ setPendingFormAction(action);
3020
+ }
3021
+ },
3022
+ (status) => {
3023
+ setFormStatus(status);
3024
+ },
3025
+ (newFormType) => {
3026
+ setFormType(newFormType);
3027
+ },
3028
+ (sessionId) => {
3029
+ if (!isCurrentConversation()) return;
3030
+ smartSessionIdRef.current = sessionId;
3031
+ markActiveSession(sessionId);
3032
+ },
3033
+ (formSessionId) => {
3034
+ formSessionIdRef.current = formSessionId;
3035
+ },
3036
+ onBlocks
3037
+ );
3038
+ } else if (mode === "doc_qa") {
3039
+ if (activeDocuments && activeDocuments.length > 0) {
3040
+ await api$1.streamV1CopilotChat(
3041
+ { ...api.getToken(), query: text, doc_ids: activeDocuments.map((d) => d.doc_id), session_id: chatSessionIdRef.current || void 0 },
3042
+ appendToken,
3043
+ onDone,
3044
+ onError,
3045
+ onOffTopic,
3046
+ void 0,
3047
+ onChatSessionId
3048
+ );
3049
+ } else if (activeDocument) {
3050
+ await api$1.streamV1CopilotChat(
3051
+ { ...api.getToken(), query: text, doc_id: activeDocument.doc_id, session_id: chatSessionIdRef.current || void 0 },
3052
+ appendToken,
3053
+ onDone,
3054
+ onError,
3055
+ onOffTopic,
3056
+ void 0,
3057
+ onChatSessionId
3058
+ );
3059
+ }
3060
+ } else if (mode === "agent" && formType) {
3061
+ if (!agentStarted.current) {
3062
+ await api$1.startV1CopilotAgent(
3063
+ { ...api.getToken(), form_type: formType },
3064
+ appendToken,
3065
+ () => {
3066
+ agentStarted.current = true;
3067
+ },
3068
+ onError,
3069
+ onOffTopic
3070
+ );
3071
+ }
3072
+ await api$1.formAssistV1Copilot(
3073
+ { ...api.getToken(), message: text },
3074
+ appendToken,
3075
+ onDone,
3076
+ onError,
3077
+ onFieldUpdates,
3078
+ async (action) => {
3079
+ if (["save_draft", "submit_form", "discard_form"].includes(action)) {
3080
+ try {
3081
+ const token = api.getToken()["x-token"];
3082
+ const sessionId = "current_session";
3083
+ if (action === "submit_form") {
3084
+ await api$1.postV1CopilotSubmit(sessionId, token, formType, currentFieldUpdates);
3085
+ toast.success("Form submitted successfully!");
3086
+ } else if (action === "save_draft") {
3087
+ await api$1.postV1CopilotSaveDraft(sessionId, token, formType, currentFieldUpdates);
3088
+ toast.success("Draft saved successfully!");
3089
+ } else if (action === "discard_form") {
3090
+ await api$1.postV1CopilotDiscard(sessionId, token, formType, currentFieldUpdates);
3091
+ toast.success("Form discarded");
3092
+ }
3093
+ agentStarted.current = false;
3094
+ setCurrentFieldUpdates(null);
3095
+ setResolvedLabels({});
3096
+ labelCacheRef.current = {};
3097
+ setFormStatus("in_progress");
3098
+ } catch (e) {
3099
+ console.error("Failed to perform copilot action", e);
3100
+ let errMsg = "Action failed. Please try again.";
3101
+ try {
3102
+ const parsed = JSON.parse(e.message);
3103
+ if (parsed.message) errMsg = parsed.message;
3104
+ } catch (err) {
3105
+ if (e.message) errMsg = e.message;
3106
+ }
3107
+ toast.error(errMsg);
3108
+ setMessages((prev) => [
3109
+ ...prev,
3110
+ {
3111
+ id: Date.now(),
3112
+ role: "ai",
3113
+ text: `Validation Error: ${errMsg}
3114
+
3115
+ Please correct the details and try again.`,
3116
+ time: (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }),
3117
+ mode: "agent"
3118
+ }
3119
+ ]);
3120
+ }
3121
+ }
3122
+ },
3123
+ (status) => {
3124
+ console.log("Copilot Form Status:", status);
3125
+ setFormStatus(status);
3126
+ }
3127
+ );
3128
+ } else {
3129
+ await api$1.streamV1CopilotChat(
3130
+ { ...api.getToken(), query: text, "x-timezone": (/* @__PURE__ */ new Date()).getTimezoneOffset(), session_id: chatSessionIdRef.current || void 0 },
3131
+ appendToken,
3132
+ onDone,
3133
+ onError,
3134
+ onOffTopic,
3135
+ void 0,
3136
+ onChatSessionId
3137
+ );
3138
+ }
3139
+ } catch {
3140
+ setIsTyping(false);
3141
+ if (aiMsgId === null) {
3142
+ setTurnMessages((prev) => [
3143
+ ...prev,
3144
+ { id: Date.now() + 1, role: "ai", text: "Connection error. Please try again.", time: getTime(), mode }
3145
+ ]);
3146
+ }
3147
+ }
3148
+ },
3149
+ [isTyping, mode, formType, activeDocument, activeDocuments]
3150
+ );
3151
+ const handleKeyDown = (e) => {
3152
+ if (showSlashMenu && filteredCommands.length > 0) {
3153
+ if (e.key === "ArrowDown") {
3154
+ e.preventDefault();
3155
+ setSlashIndex((i) => (i + 1) % filteredCommands.length);
3156
+ return;
3157
+ }
3158
+ if (e.key === "ArrowUp") {
3159
+ e.preventDefault();
3160
+ setSlashIndex((i) => (i - 1 + filteredCommands.length) % filteredCommands.length);
3161
+ return;
3162
+ }
3163
+ if (e.key === "Enter" || e.key === "Tab") {
3164
+ e.preventDefault();
3165
+ const cmdId = filteredCommands[slashIndex].id;
3166
+ setInputValue("");
3167
+ selectCommand(cmdId);
3168
+ return;
3169
+ }
3170
+ if (e.key === "Escape") {
3171
+ setShowSlashMenu(false);
3172
+ setInputValue("");
3173
+ return;
3174
+ }
3175
+ }
3176
+ if (e.key === "Enter" && !e.shiftKey) {
3177
+ e.preventDefault();
3178
+ sendMessage(inputValue);
3179
+ }
3180
+ };
3181
+ const executeSmartFormAction = React.useCallback(async (action) => {
3182
+ const sessionId = formSessionIdRef.current;
3183
+ if (!sessionId) {
3184
+ toast.error("No active form session to act on.");
3185
+ return;
3186
+ }
3187
+ try {
3188
+ const token = api.getToken()["x-token"];
3189
+ if (action === "submit_form") {
3190
+ await api$1.postV1CopilotSubmit(sessionId, token, formType, currentFieldUpdates);
3191
+ toast.success("Form submitted successfully!");
3192
+ } else if (action === "save_draft") {
3193
+ await api$1.postV1CopilotSaveDraft(sessionId, token, formType, currentFieldUpdates);
3194
+ toast.success("Draft saved successfully!");
3195
+ } else {
3196
+ await api$1.postV1CopilotDiscard(sessionId, token, formType, currentFieldUpdates);
3197
+ toast.success("Form discarded");
3198
+ }
3199
+ agentStarted.current = false;
3200
+ setCurrentFieldUpdates(null);
3201
+ setResolvedLabels({});
3202
+ labelCacheRef.current = {};
3203
+ setFormStatus("in_progress");
3204
+ setFormType(null);
3205
+ setPendingFormAction(null);
3206
+ smartSessionIdRef.current = null;
3207
+ formSessionIdRef.current = null;
3208
+ } catch (e) {
3209
+ console.error("Failed to perform copilot action", e);
3210
+ let errMsg = "Action failed. Please try again.";
3211
+ try {
3212
+ const parsed = JSON.parse(e.message);
3213
+ if (parsed.message) errMsg = parsed.message;
3214
+ } catch {
3215
+ if (e.message) errMsg = e.message;
3216
+ }
3217
+ toast.error(errMsg);
3218
+ setMessages((prev) => [
3219
+ ...prev,
3220
+ {
3221
+ id: Date.now(),
3222
+ role: "ai",
3223
+ text: `Validation Error: ${errMsg}
3224
+
3225
+ Please correct the details and try again.`,
3226
+ time: (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }),
3227
+ mode: "smart"
3228
+ }
3229
+ ]);
3230
+ }
3231
+ }, [formType, currentFieldUpdates]);
3232
+ const handleSave = React.useCallback(async () => {
3233
+ if (mode === "smart") return executeSmartFormAction("save_draft");
3234
+ await sendMessage("Save the draft");
3235
+ }, [mode, executeSmartFormAction, sendMessage]);
3236
+ const handleDiscard = React.useCallback(async () => {
3237
+ if (mode === "smart") return executeSmartFormAction("discard_form");
3238
+ await sendMessage("Discard this form");
3239
+ }, [mode, executeSmartFormAction, sendMessage]);
3240
+ const handleSubmit = React.useCallback(async () => {
3241
+ if (mode === "smart") return executeSmartFormAction("submit_form");
3242
+ await sendMessage("Submit this form");
3243
+ }, [mode, executeSmartFormAction, sendMessage]);
3244
+ const handleNewChat = React.useCallback(async () => {
3245
+ conversationRef.current += 1;
3246
+ const { "x-token": token } = api.getToken();
3247
+ await api$1.resetV1CopilotSession(token);
3248
+ setIsTyping(false);
3249
+ setFormType(null);
3250
+ setFormStatus("in_progress");
3251
+ setPendingFormAction(null);
3252
+ agentStarted.current = false;
3253
+ smartSessionIdRef.current = null;
3254
+ chatSessionIdRef.current = null;
3255
+ formSessionIdRef.current = null;
3256
+ setCurrentFieldUpdates(null);
3257
+ setResolvedLabels({});
3258
+ labelCacheRef.current = {};
3259
+ setActiveDocument(null);
3260
+ setDocIntroSent(false);
3261
+ setDocError(null);
3262
+ setActiveDocuments([]);
3263
+ setSuggestedQuestions([]);
3264
+ setMessages([]);
3265
+ fetchedMultiDocIntroIds.current = "";
3266
+ tabStateRef.current = {};
3267
+ fetchQuestions();
3268
+ }, [fetchQuestions]);
3269
+ React.useEffect(() => {
3270
+ activeSessionIdRef.current = activeSessionId;
3271
+ }, [activeSessionId]);
3272
+ React.useEffect(() => {
3273
+ if (messages.length === 0) {
3274
+ activeSessionIdRef.current = null;
3275
+ setActiveSessionId(null);
3276
+ }
3277
+ }, [messages.length]);
3278
+ const wasTypingRef = React.useRef(false);
3279
+ const refreshHistory = chatHistory.refresh;
3280
+ React.useEffect(() => {
3281
+ if (wasTypingRef.current && !isTyping && historyOpen) refreshHistory(true);
3282
+ wasTypingRef.current = isTyping;
3283
+ }, [isTyping, historyOpen, refreshHistory]);
3284
+ const handleOpenSession = React.useCallback(async (session) => {
3285
+ if (session.id === activeSessionIdRef.current) return;
3286
+ const conversation = ++conversationRef.current;
3287
+ let detail;
3288
+ try {
3289
+ detail = await chatHistory.openSession(session);
3290
+ } catch (e) {
3291
+ if (conversation !== conversationRef.current) return;
3292
+ toast.error((e == null ? void 0 : e.message) || "Failed to open chat");
3293
+ refreshHistory();
3294
+ return;
3295
+ }
3296
+ if (conversation !== conversationRef.current) return;
3297
+ try {
3298
+ await api$1.resetV1CopilotSession(api.getToken()["x-token"]);
3299
+ } catch {
3300
+ }
3301
+ if (conversation !== conversationRef.current) return;
3302
+ const sessionMode = session.service === "copilot_smart" ? "smart" : "conversation";
3303
+ setIsTyping(false);
3304
+ setFormType(null);
3305
+ setFormStatus("in_progress");
3306
+ setPendingFormAction(null);
3307
+ agentStarted.current = false;
3308
+ smartSessionIdRef.current = null;
3309
+ formSessionIdRef.current = null;
3310
+ setCurrentFieldUpdates(null);
3311
+ setResolvedLabels({});
3312
+ labelCacheRef.current = {};
3313
+ setActiveDocument(null);
3314
+ setDocIntroSent(false);
3315
+ setDocError(null);
3316
+ setActiveDocuments([]);
3317
+ setSuggestedQuestions([]);
3318
+ fetchedMultiDocIntroIds.current = "";
3319
+ tabStateRef.current = {};
3320
+ userScrolledUp.current = false;
3321
+ smartSessionIdRef.current = session.service === "copilot_smart" ? session.id : null;
3322
+ chatSessionIdRef.current = session.service === "copilot_chat" ? session.id : null;
3323
+ markActiveSession(session.id);
3324
+ setMode(sessionMode);
3325
+ setMessages(toChatMessages(detail.messages || [], sessionMode));
3326
+ }, [chatHistory.openSession, refreshHistory]);
3327
+ const handleConfirmDeleteSession = React.useCallback(async () => {
3328
+ const session = pendingDeleteSession;
3329
+ if (!session) return;
3330
+ setDeletingSession(true);
3331
+ try {
3332
+ await chatHistory.removeSession(session);
3333
+ if (session.id === activeSessionIdRef.current) handleNewChat();
3334
+ setPendingDeleteSession(null);
3335
+ } catch (e) {
3336
+ toast.error((e == null ? void 0 : e.message) || "Failed to delete chat");
3337
+ setPendingDeleteSession(null);
3338
+ refreshHistory();
3339
+ } finally {
3340
+ setDeletingSession(false);
3341
+ }
3342
+ }, [pendingDeleteSession, chatHistory.removeSession, handleNewChat, refreshHistory]);
3343
+ const historyPanelProps = {
3344
+ sessions: chatHistory.sessions,
3345
+ activeId: activeSessionId,
3346
+ onClose: () => setHistoryOpen(false),
3347
+ onDelete: setPendingDeleteSession,
3348
+ loading: chatHistory.loading,
3349
+ error: chatHistory.error,
3350
+ onRetry: () => refreshHistory(),
3351
+ hasMore: chatHistory.hasMore,
3352
+ loadingMore: chatHistory.loadingMore,
3353
+ onLoadMore: chatHistory.loadMore,
3354
+ unavailableMessage: historyService ? null : "History isn't available for Agent mode."
3355
+ };
3356
+ const hasAttachedDocs = !!activeDocument || activeDocuments.length > 0;
3357
+ const isEmptyChat = filteredMessages.length === 0 && !hasAttachedDocs;
3358
+ const centerInput = inline && dashboardMode && isEmptyChat;
3359
+ const dashboardChatActive = inline && dashboardMode && !isEmptyChat;
3360
+ React.useEffect(() => {
3361
+ if (inline && dashboardMode) chatDockState.setChatActive(dashboardChatActive);
3362
+ }, [inline, dashboardMode, dashboardChatActive]);
3363
+ React.useEffect(() => () => {
3364
+ if (inline && dashboardMode) chatDockState.setChatActive(false);
3365
+ }, [inline, dashboardMode]);
3366
+ const chatInput = /* @__PURE__ */ jsxRuntime.jsx(
3367
+ ChatBotInput,
3368
+ {
3369
+ inputValue,
3370
+ isTyping,
3371
+ mode,
3372
+ formType,
3373
+ showSlashMenu,
3374
+ filteredCommands,
3375
+ slashIndex,
3376
+ textareaRef,
3377
+ onChange: handleInputChange,
3378
+ onKeyDown: handleKeyDown,
3379
+ onSend: () => sendMessage(inputValue),
3380
+ onSlashHover: setSlashIndex,
3381
+ onSlashSelect: selectCommand,
3382
+ onModeChange: handleModeChange,
3383
+ onFormTypeChange: setFormType,
3384
+ activeDocument,
3385
+ activeDocuments,
3386
+ onDocDelete: handleDocDelete,
3387
+ onDocUpload: () => setShowUploadArea(!showUploadArea),
3388
+ onMultiDocDelete: handleMultiDocDelete,
3389
+ onDocDetach: handleDocDetach
3390
+ }
3391
+ );
3392
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3393
+ (isOpen || inline) && /* @__PURE__ */ jsxRuntime.jsxs(
3394
+ "div",
3395
+ {
3396
+ ref: panelRef,
3397
+ className: `chatBot--panel ${inline ? "chatBot--panel--inline" : ""} ${inline && dashboardMode ? "chatBot--panel--dashboard" : ""}`,
3398
+ style: panelHeight ? { height: panelHeight, minHeight: 0 } : void 0,
3399
+ children: [
3400
+ inline && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--history-bar", children: [
3401
+ (filteredMessages.length > 0 || activeDocument || activeDocuments.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(ChatBotNewChatButton, { onClick: handleNewChat }),
3402
+ /* @__PURE__ */ jsxRuntime.jsx(ChatBotHistoryButton, { open: historyOpen, onClick: () => setHistoryOpen((o) => !o) })
3403
+ ] }),
3404
+ inline && (filteredMessages.length > 0 || activeDocument || activeDocuments.length > 0) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--inline-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "chatBot--new-chat-btn", onClick: handleNewChat, title: "New Chat", children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Add, { style: { fontSize: 20 } }) }) }),
3405
+ !inline && /* @__PURE__ */ jsxRuntime.jsx(
3406
+ ChatBotHeader,
3407
+ {
3408
+ onClose: () => setIsOpen(false),
3409
+ onNewChat: () => {
3410
+ setHistoryOpen(false);
3411
+ handleNewChat();
3412
+ },
3413
+ sessionTokens: messages.reduce((sum, m) => sum + (m.tokens ?? 0), 0),
3414
+ sessionMs: messages.reduce((sum, m) => sum + (m.durationMs ?? 0), 0),
3415
+ onHistory: () => setHistoryOpen((o) => !o),
3416
+ historyOpen
3417
+ }
3418
+ ),
3419
+ !inline && /* @__PURE__ */ jsxRuntime.jsx(
3420
+ ChatBotHistory,
3421
+ {
3422
+ ...historyPanelProps,
3423
+ variant: "embedded",
3424
+ open: historyOpen,
3425
+ onSelect: (session) => {
3426
+ setHistoryOpen(false);
3427
+ handleOpenSession(session);
3428
+ }
3429
+ }
3430
+ ),
3431
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `chatBot--main-view ${!inline && historyOpen ? "chatBot--main-view--hidden" : ""}`, children: [
3432
+ filteredMessages.length === 0 && !activeDocument && activeDocuments.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { ref: bodyRef, className: "chatBot--body", children: /* @__PURE__ */ jsxRuntime.jsx(ChatBotWelcome, { firstName, onSuggestion: handleSuggestion, dynamicQuestions, mode, dashboardMode, inputSlot: centerInput ? chatInput : void 0 }) }) : /* @__PURE__ */ jsxRuntime.jsx(
3433
+ ChatBotMessages,
3434
+ {
3435
+ messages: filteredMessages,
3436
+ isTyping,
3437
+ bodyRef,
3438
+ footer: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3439
+ activeDocument && activeDocuments.length === 0 && (mode === "doc_qa" || mode === "smart") && activeDocument.status === "ready" && !docIntroSent && /* @__PURE__ */ jsxRuntime.jsx(
3440
+ DocIntro,
3441
+ {
3442
+ document: activeDocument,
3443
+ onSuggestion: (q) => {
3444
+ setDocIntroSent(true);
3445
+ setInputValue(q);
3446
+ setTimeout(() => sendMessage(q), 0);
3447
+ }
3448
+ }
3449
+ ),
3450
+ activeDocuments.length > 0 && (mode === "doc_qa" || mode === "smart") && activeDocuments.every((d) => d.status === "ready") && !docIntroSent && /* @__PURE__ */ jsxRuntime.jsx(
3451
+ DocIntro,
3452
+ {
3453
+ documents: activeDocuments,
3454
+ suggestedQuestions: suggestedQuestions.length > 0 ? suggestedQuestions : activeDocuments[0].suggested_questions,
3455
+ onSuggestion: (q) => {
3456
+ setDocIntroSent(true);
3457
+ setInputValue(q);
3458
+ setTimeout(() => sendMessage(q), 0);
3459
+ }
3460
+ }
3461
+ ),
3462
+ currentFieldUpdates && (mode === "agent" || mode === "smart") && /* @__PURE__ */ jsxRuntime.jsx(
3463
+ InvoicePreview,
3464
+ {
3465
+ fieldUpdates: currentFieldUpdates,
3466
+ resolvedLabels,
3467
+ formStatus,
3468
+ useActionGating: mode === "smart",
3469
+ pendingFormAction,
3470
+ onSave: handleSave,
3471
+ onDiscard: handleDiscard,
3472
+ onSubmit: handleSubmit
3473
+ }
3474
+ )
3475
+ ] })
3476
+ }
3477
+ ),
3478
+ (mode === "doc_qa" && !activeDocument && activeDocuments.length === 0 || mode === "smart" && showUploadArea) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "chatBot--doc-upload-area", children: [
3479
+ /* @__PURE__ */ jsxRuntime.jsx(
3480
+ DocUpload,
3481
+ {
3482
+ onUploadComplete: (docs) => {
3483
+ if (docs.length === 1 && (!activeDocuments || activeDocuments.length === 0)) {
3484
+ handleDocUploadComplete(docs[0]);
3485
+ } else {
3486
+ handleMultiDocUploadComplete(docs);
3487
+ }
3488
+ setShowUploadArea(false);
3489
+ },
3490
+ onUploadError: handleDocUploadError,
3491
+ uploadDocument: hasAttachedDocs ? (file, onProgress) => handleAddDocuments([file], onProgress).then((docs) => docs[0]) : handleDocUpload,
3492
+ uploadDocuments: hasAttachedDocs ? handleAddDocuments : handleMultiDocUpload
3493
+ }
3494
+ ),
3495
+ docError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-error", children: docError })
3496
+ ] }),
3497
+ activeDocument && activeDocuments.length === 0 && (mode === "doc_qa" || mode === "smart") && ["pending", "processing", "parsing", "embedding", "indexing"].includes(activeDocument.status) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-status-area", children: /* @__PURE__ */ jsxRuntime.jsx(
3498
+ DocStatus,
3499
+ {
3500
+ document: activeDocument,
3501
+ onReady: handleDocReady,
3502
+ onError: handleDocError,
3503
+ getStatus: async (docId) => {
3504
+ const { "x-token": token } = api.getToken();
3505
+ const res = await api$1.getDocumentStatus(docId, token);
3506
+ return {
3507
+ doc_id: res.doc_id,
3508
+ filename: res.filename || activeDocument.filename,
3509
+ status: res.status,
3510
+ pages: res.pages || activeDocument.pages,
3511
+ category: res.category || void 0,
3512
+ sub_category: res.sub_category || void 0,
3513
+ chunk_count: res.chunk_count || void 0,
3514
+ error: res.error || void 0,
3515
+ error_code: res.error_code || void 0
3516
+ };
3517
+ }
3518
+ },
3519
+ activeDocument.doc_id
3520
+ ) }),
3521
+ (mode === "doc_qa" || mode === "smart") && activeDocuments.length > 0 && activeDocuments.some((d) => ["pending", "processing", "parsing", "embedding", "indexing"].includes(d.status)) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-status-area chatBot--doc-status-area--multiple", children: activeDocuments.filter((d) => ["pending", "processing", "parsing", "embedding", "indexing"].includes(d.status)).map((doc) => /* @__PURE__ */ jsxRuntime.jsx(
3522
+ DocStatus,
3523
+ {
3524
+ document: doc,
3525
+ onReady: handleMultiDocReady,
3526
+ onError: handleMultiDocError,
3527
+ getStatus: async (docId) => {
3528
+ const { "x-token": token } = api.getToken();
3529
+ const res = await api$1.getDocumentStatus(docId, token);
3530
+ return {
3531
+ doc_id: res.doc_id,
3532
+ filename: res.filename || doc.filename,
3533
+ status: res.status,
3534
+ pages: res.pages || doc.pages,
3535
+ category: res.category || void 0,
3536
+ sub_category: res.sub_category || void 0,
3537
+ chunk_count: res.chunk_count || void 0,
3538
+ error: res.error || void 0,
3539
+ error_code: res.error_code || void 0
3540
+ };
3541
+ }
3542
+ },
3543
+ doc.doc_id
3544
+ )) }),
3545
+ docError && (mode === "doc_qa" || mode === "smart") && !!(activeDocument || activeDocuments.length > 0) && !(mode === "smart" && showUploadArea) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "chatBot--doc-error-floating", onClick: () => setDocError(null), children: docError }),
3546
+ !centerInput && chatInput
3547
+ ] })
3548
+ ]
3549
+ }
3550
+ ),
3551
+ inline && /* @__PURE__ */ jsxRuntime.jsx(
3552
+ ChatBotHistory,
3553
+ {
3554
+ ...historyPanelProps,
3555
+ open: historyOpen,
3556
+ onSelect: handleOpenSession
3557
+ }
3558
+ ),
3559
+ /* @__PURE__ */ jsxRuntime.jsx(
3560
+ confirmModal.ConfirmPopUp,
3561
+ {
3562
+ open: !!pendingDeleteSession,
3563
+ title: "Delete chat",
3564
+ description: `"${(pendingDeleteSession == null ? void 0 : pendingDeleteSession.title) ?? ""}" will be permanently deleted. This cannot be undone.`,
3565
+ loading: deletingSession,
3566
+ onClose: () => !deletingSession && setPendingDeleteSession(null),
3567
+ onConfirm: handleConfirmDeleteSession
3568
+ }
3569
+ ),
3570
+ !isOpen && !inline && /* @__PURE__ */ jsxRuntime.jsx(ChatBotLauncher, { onOpen: () => setIsOpen(true) })
3571
+ ] });
3572
+ };
3573
+ exports.ACCEPTED_FILE_EXTENSIONS = ACCEPTED_FILE_EXTENSIONS;
3574
+ exports.ACCEPT_ATTR = ACCEPT_ATTR;
3575
+ exports.ChatBot = ChatBot;
3576
+ exports.ChatBotHeader = ChatBotHeader;
3577
+ exports.ChatBotInput = ChatBotInput;
3578
+ exports.ChatBotLauncher = ChatBotLauncher;
3579
+ exports.ChatBotMessages = ChatBotMessages;
3580
+ exports.ChatBotWelcome = ChatBotWelcome;
3581
+ exports.DocIntro = DocIntro;
3582
+ exports.DocStatus = DocStatus;
3583
+ exports.DocUpload = DocUpload;
3584
+ exports.ExpenseEntryTable = ExpenseEntryTable;
3585
+ exports.FORM_TYPE_LABELS = FORM_TYPE_LABELS;
3586
+ exports.INSIGHTS = INSIGHTS;
3587
+ exports.IcBolt = IcBolt;
3588
+ exports.IcBox = IcBox;
3589
+ exports.IcCalendar = IcCalendar;
3590
+ exports.IcChevR = IcChevR;
3591
+ exports.IcFlame = IcFlame;
3592
+ exports.IcInfo = IcInfo;
3593
+ exports.IcInvoice = IcInvoice;
3594
+ exports.IcSearch = IcSearch;
3595
+ exports.IcTarget = IcTarget;
3596
+ exports.IcWarning = IcWarning;
3597
+ exports.InvoicePreview = InvoicePreview;
3598
+ exports.ItemEntryTable = ItemEntryTable;
3599
+ exports.MAX_ATTACHED_DOCS = MAX_ATTACHED_DOCS;
3600
+ exports.SLASH_COMMANDS = SLASH_COMMANDS;
3601
+ exports.SUGGEST_TILES = SUGGEST_TILES;
3602
+ exports.SparkMark = SparkMark;
3603
+ exports.SparkSvg = SparkSvg;
3604
+ exports.formatDuration = formatDuration;
3605
+ exports.formatTokens = formatTokens;
3606
+ exports.getFileCategory = getFileCategory;
3607
+ exports.getGreeting = getGreeting;
3608
+ exports.getTime = getTime;
3609
+ //# sourceMappingURL=chat-bot-BIXoGUj-.js.map