@alfadocs/ui-kit 1.115.0 → 1.117.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/dist/_chunks/accessible-target-D3j6F-AG.js +7 -0
  2. package/dist/_chunks/{actions-cell-renderer-bI27uXXC.js → actions-cell-renderer-DTaIQKp9.js} +3 -3
  3. package/dist/_chunks/{address-autocomplete-DC-H-MZw.js → address-autocomplete-Bnc9ieKO.js} +2 -2
  4. package/dist/_chunks/{address-fields-D5Ije0S2.js → address-fields-RIaGnpnm.js} +4 -4
  5. package/dist/_chunks/{anamnesis-card-Ddnrdfx3.js → anamnesis-card-sUFT0dpF.js} +2 -2
  6. package/dist/_chunks/{anamnesis-summary-card-S1H_AARG.js → anamnesis-summary-card-BtFPpegp.js} +2 -2
  7. package/dist/_chunks/{anamnesis-summary-rows-BZ36ULQk.js → anamnesis-summary-rows-BbAREK-3.js} +7 -7
  8. package/dist/_chunks/{antenatal-schedule-timeline-va9zx7tJ.js → antenatal-schedule-timeline-86YVlMYJ.js} +2 -2
  9. package/dist/_chunks/{appointment-card-D_-aBrx5.js → appointment-card-0PebvrOS.js} +3 -3
  10. package/dist/_chunks/{appointment-peek-DWfcpoGy.js → appointment-peek-DdUhqfEi.js} +2 -2
  11. package/dist/_chunks/{appointment-timeline-DxLu3afn.js → appointment-timeline-CC7nmBOH.js} +3 -3
  12. package/dist/_chunks/{appointment-tray-BhXOJpIJ.js → appointment-tray-B04zKY7g.js} +2 -2
  13. package/dist/_chunks/arrow-down-left-DECv-dJt.js +15 -0
  14. package/dist/_chunks/{balance-badge-cell-CXHihM22.js → balance-badge-cell-DPjab0eJ.js} +6 -6
  15. package/dist/_chunks/bill-line-table-vCnVo7_a.js +1565 -0
  16. package/dist/_chunks/{bishop-score-QJu-sM1y.js → bishop-score-CKztphVz.js} +2 -2
  17. package/dist/_chunks/{bmi-calculator-Ba4yoR31.js → bmi-calculator-rri5vvMt.js} +3 -3
  18. package/dist/_chunks/{button-group-CUnNnt8a.js → button-group-B2MJo0Se.js} +2 -2
  19. package/dist/_chunks/{calculator-dialog-D4TyJwqy.js → calculator-dialog-BGX5XQCM.js} +2 -2
  20. package/dist/_chunks/{calendar-appointment-editor-dialog-BVzFi4hH.js → calendar-appointment-editor-dialog-BEmBcb61.js} +18 -18
  21. package/dist/_chunks/{card-DVO3x8E-.js → card-n6W6LW-N.js} +78 -47
  22. package/dist/_chunks/{care-plan-card-BA3MfdfZ.js → care-plan-card-bGTIliXc.js} +3 -3
  23. package/dist/_chunks/{care-plan-entry-card-CUtFZ813.js → care-plan-entry-card-cdojypxu.js} +3 -3
  24. package/dist/_chunks/{chart-DebrFZ6L.js → chart-Aue_2dMb.js} +2 -2
  25. package/dist/_chunks/circle-off-DuT9pVy2.js +16 -0
  26. package/dist/_chunks/{clinical-note-card-Zz5_GEz-.js → clinical-note-card-DHn5W_bv.js} +2 -2
  27. package/dist/_chunks/combobox-BBCVQS-S.js +935 -0
  28. package/dist/_chunks/{compact-editor-fields-cP6yh7xv.js → compact-editor-fields-6sTWRLtf.js} +3 -3
  29. package/dist/_chunks/{connection-status-DjarASoU.js → connection-status-DWClakYw.js} +2 -2
  30. package/dist/_chunks/{contact-card-Cv-Nwvac.js → contact-card-CGpbYuxl.js} +2 -2
  31. package/dist/_chunks/{contact-profile-card-DMXWBBkU.js → contact-profile-card-BubJPyRB.js} +3 -3
  32. package/dist/_chunks/{country-select-CUuGOAoZ.js → country-select-C2GdvRtS.js} +2 -2
  33. package/dist/_chunks/{cycle-calculator-C68V9rdH.js → cycle-calculator-C8nWAeTk.js} +3 -3
  34. package/dist/_chunks/{dashboard-grid-DrOkTtya.js → dashboard-grid-CaxgaEgI.js} +2 -2
  35. package/dist/_chunks/{toolbar-Bc3pjfG5.js → data-grid-DiBSbN2Y.js} +3017 -3106
  36. package/dist/_chunks/{data-grid-tabs-CsLbIv0h.js → data-grid-tabs-D9Y4DeeH.js} +2 -2
  37. package/dist/_chunks/{data-table-DXaE2Ret.js → data-table-DhYx-hCD.js} +101 -100
  38. package/dist/_chunks/{date-range-panel-CBFfkgmz.js → date-range-panel-CT6nXjRM.js} +7 -7
  39. package/dist/_chunks/default-tabs-CD285u0C.js +2250 -0
  40. package/dist/_chunks/dialog-CIUn5oLb.js +348 -0
  41. package/dist/_chunks/{document-preview-WvJKHJOP.js → document-preview-BWDTCEHI.js} +3 -3
  42. package/dist/_chunks/dropdown-menu-Dw6sgQwJ.js +679 -0
  43. package/dist/_chunks/{due-date-calculator-C1UA5jpS.js → due-date-calculator-c1NJPw9F.js} +4 -4
  44. package/dist/_chunks/{editable-currency-cell-renderer-CtlMhLai.js → editable-currency-cell-renderer-BlK-8A7b.js} +2 -2
  45. package/dist/_chunks/{entity-summary-DGCBQDt1.js → entity-summary-BanguTa6.js} +2 -2
  46. package/dist/_chunks/export-files-BByoK9Cg.js +248 -0
  47. package/dist/_chunks/{face-scheme-DkoxiDCh.js → face-scheme-Bt07zQJU.js} +20 -19
  48. package/dist/_chunks/{fetal-weight-DmZzMRzB.js → fetal-weight-D0KofJJw.js} +3 -3
  49. package/dist/_chunks/{file-manager-DFFExyym.js → file-manager-CV1_GtjC.js} +5 -5
  50. package/dist/_chunks/{finished-terminal-BKTFUk3S.js → finished-terminal-FR8uc_Ws.js} +2 -2
  51. package/dist/_chunks/{forgot-password-form-Bc_UPax6.js → forgot-password-form-YvI9vX-G.js} +2 -2
  52. package/dist/_chunks/format-price-CIX0YJZn.js +179 -0
  53. package/dist/_chunks/{gestational-age-calculator-60y1RyQL.js → gestational-age-calculator-Cg4Gq42R.js} +3 -3
  54. package/dist/_chunks/{grid-context-AwsLJRhH.js → grid-context-jn9y8tNE.js} +4 -4
  55. package/dist/_chunks/{hcg-doubling-CC-dbKE8.js → hcg-doubling-BjTa_77t.js} +3 -3
  56. package/dist/_chunks/{header-settings-Df9q1uHt.js → header-settings-DsvheAOt.js} +160 -147
  57. package/dist/_chunks/{heatmap-eXdtmEoU.js → heatmap-BurtKmeu.js} +3 -3
  58. package/dist/_chunks/{help-me-write-templates-CWxgjDZl.js → help-me-write-templates-C28E_rOt.js} +2 -2
  59. package/dist/_chunks/highlighter-DSkckT2Q.js +15 -0
  60. package/dist/_chunks/{icon-button-group-C9mPK-bX.js → icon-button-group-BKtkVZ1W.js} +2 -2
  61. package/dist/_chunks/{kit-extensions-CzG0RmhQ.js → kit-extensions-C3oL0WTp.js} +7 -7
  62. package/dist/_chunks/{link-cell-renderer-Ditt5mvT.js → link-cell-renderer-NFNGdAGt.js} +4 -4
  63. package/dist/_chunks/{login-dev-card-CPndtWdz.js → login-dev-card-Dz3ezx1o.js} +2 -2
  64. package/dist/_chunks/map-view-Frj8vE7n.js +1105 -0
  65. package/dist/_chunks/{maps-core-gate-DkNqGkm3.js → maps-core-gate-Dgs7jXxy.js} +6 -6
  66. package/dist/_chunks/{marketplace-app-shell-CcEHJgDd.js → marketplace-app-shell-BOBWmzoT.js} +6 -6
  67. package/dist/_chunks/money-OE6_oDPH.js +138 -0
  68. package/dist/_chunks/{muscle-scheme-BkmDUTmk.js → muscle-scheme-C9dnSxzw.js} +2 -2
  69. package/dist/_chunks/{notes-panel-BVYG_MJE.js → notes-panel-CHR-Jv6N.js} +5 -5
  70. package/dist/_chunks/{notification-card-CPW4poUr.js → notification-card-DRMv2_pW.js} +20 -20
  71. package/dist/_chunks/{notification-tray-CQK3lw87.js → notification-tray-mlCfxNRH.js} +2 -2
  72. package/dist/_chunks/number-input-DUSvP7Dq.js +625 -0
  73. package/dist/_chunks/{operator-hero-BWayX73x.js → operator-hero-CnfWckNQ.js} +2 -2
  74. package/dist/_chunks/{optical-prescription-CvbN8yD2.js → optical-prescription-Da_r8pMr.js} +2 -2
  75. package/dist/_chunks/parts-CcyRkB8t.js +869 -0
  76. package/dist/_chunks/{patient-details-DlT-vpSe.js → patient-details-C4dHR4iu.js} +3 -3
  77. package/dist/_chunks/{patient-field-row-B54uzvu-.js → patient-field-row-0QP8KCVp.js} +5 -5
  78. package/dist/_chunks/{patient-search-DDRDCjZi.js → patient-search-D_S7joff.js} +3 -3
  79. package/dist/_chunks/{patient-summary-card-Dy9-CzON.js → patient-summary-card-x0-AhCyC.js} +4 -4
  80. package/dist/_chunks/{payment-automation-upsell-D7yaD4u1.js → payment-automation-upsell-CGdG2Mwk.js} +2 -2
  81. package/dist/_chunks/{payment-request-card-BmV2pLoM.js → payment-request-card-CEIalOtr.js} +15 -14
  82. package/dist/_chunks/{periodontal-chart-Bjz7O4wT.js → periodontal-chart-DqHrQY4e.js} +2 -2
  83. package/dist/_chunks/{periodontal-chart-card-CxEXHl2x.js → periodontal-chart-card-q9WSHRC2.js} +2 -2
  84. package/dist/_chunks/{periodontal-diagnosis-DnZuZD14.js → periodontal-diagnosis-CJPWluQU.js} +2 -2
  85. package/dist/_chunks/{periodontal-risk-chart-BBPB9wf1.js → periodontal-risk-chart-CKkyOROk.js} +2 -2
  86. package/dist/_chunks/{practice-profile-hero-Cw4NZp0A.js → practice-profile-hero-BFS6lO2a.js} +2 -2
  87. package/dist/_chunks/{practice-results-BlxfBx-D.js → practice-results-CzHWprX4.js} +922 -787
  88. package/dist/_chunks/{pregnancy-dating-qZpw3zj8.js → pregnancy-dating-BO6diQMZ.js} +4 -4
  89. package/dist/_chunks/{pregnancy-weight-gain-DQoOM8QV.js → pregnancy-weight-gain-DkGcEc_l.js} +3 -3
  90. package/dist/_chunks/{privacy-mask-BlJK51MD.js → privacy-mask-DJ1gee4c.js} +2 -2
  91. package/dist/_chunks/{province-select-cVOlwEc5.js → province-select-CTM8A9SM.js} +2 -2
  92. package/dist/_chunks/{radiograph-panel.agent-C1LGeX-G.js → radiograph-panel.agent-9jwXlOXB.js} +2 -2
  93. package/dist/_chunks/{registration-form-DW-0X7S4.js → registration-form-CMXefBnC.js} +2 -2
  94. package/dist/_chunks/{reserved.agent-6p3Hm4oH.js → reserved.agent-TaZfI3yj.js} +5 -5
  95. package/dist/_chunks/{reset-password-form-C93SH0Tx.js → reset-password-form-D_TePSM1.js} +2 -2
  96. package/dist/_chunks/{reviews-panel-CfJPEkH7.js → reviews-panel-CdHUSndF.js} +2 -2
  97. package/dist/_chunks/{rich-text-editor-efaMWbYz.js → rich-text-editor-CMPA5Wgy.js} +12 -11
  98. package/dist/_chunks/row-actions-Dpf9CrCP.js +213 -0
  99. package/dist/_chunks/{section-card-DFr2wGal.js → section-card-CYfeQ6EQ.js} +2 -2
  100. package/dist/_chunks/{send-registration-link-form-DWxWa_cJ.js → send-registration-link-form-DuZQuKnI.js} +2 -2
  101. package/dist/_chunks/{signature-request-BnTihryS.js → signature-request-Dzs0jZsd.js} +3 -3
  102. package/dist/_chunks/{tab-bar-C_pggqVr.js → tab-bar-CF8R38Og.js} +2 -2
  103. package/dist/_chunks/{tabs-CXYjr_8O.js → tabs-P4qFmxk5.js} +2 -2
  104. package/dist/_chunks/{task-editor-CSa6vQ9r.js → task-editor-WdDCqbIL.js} +168 -178
  105. package/dist/_chunks/{tasks-panel-CVjY1d7Q.js → tasks-panel-DBSm3WjK.js} +2 -2
  106. package/dist/_chunks/{theme-toggle-CObX2Ffa.js → theme-toggle-CeKl8f_f.js} +3 -3
  107. package/dist/_chunks/{timeline-AMqE-c2T.js → timeline-DXko0M1t.js} +2 -2
  108. package/dist/_chunks/{token-insert-menu-Dl3x2ekR.js → token-insert-menu-BrK5NQIq.js} +2 -2
  109. package/dist/_chunks/toolbar-z8vXnpXz.js +159 -0
  110. package/dist/_chunks/{tooth-scheme-C-ALCHaV.js → tooth-scheme-DHRxV2sE.js} +2 -2
  111. package/dist/_chunks/{transaction-chip-CohY6sTA.js → transaction-chip-CkYd-3ky.js} +47 -57
  112. package/dist/_chunks/{treatment-receipt-BydbojdD.js → treatment-receipt-1VnuinhY.js} +2 -2
  113. package/dist/_chunks/undo-2-EBxWjj1W.js +15 -0
  114. package/dist/_chunks/{unit-converter-D77vmlzN.js → unit-converter-YKlHyUC2.js} +2 -2
  115. package/dist/_chunks/{use-appointment-details-read-BMAiQYo6.js → use-appointment-details-read-B-SXnszJ.js} +10 -10
  116. package/dist/_chunks/{verify-identity-types-C85EXNzy.js → verify-identity-types-D_LdByCp.js} +2 -2
  117. package/dist/_chunks/{widget-picker-U4JsEhQE.js → widget-picker-DrxJjEkv.js} +2 -2
  118. package/dist/_chunks/{workflow-map-B4XkcET0.js → workflow-map-DCjkRuS_.js} +3 -3
  119. package/dist/_chunks/{workflow-status-9wb7iWUd.js → workflow-status-D0avpoeS.js} +2 -2
  120. package/dist/_chunks/{workflow-webhook-action-DNSe65yd.js → workflow-webhook-action-dgUjv9T7.js} +3 -3
  121. package/dist/agent-catalog.json +1080 -1
  122. package/dist/agent-i18n/en.json +50 -0
  123. package/dist/browser-support.js +2 -0
  124. package/dist/components/_shared/accessible-target.d.ts +19 -0
  125. package/dist/components/_shared/decimal.d.ts +171 -0
  126. package/dist/components/_shared/focus-visible.d.ts +8 -0
  127. package/dist/components/_shared/format-price.d.ts +54 -2
  128. package/dist/components/address-autocomplete/index.js +1 -1
  129. package/dist/components/address-fields/index.js +1 -1
  130. package/dist/components/anamnesis-card/index.js +1 -1
  131. package/dist/components/anamnesis-summary-card/index.js +1 -1
  132. package/dist/components/appointment-card/index.js +2 -2
  133. package/dist/components/appointment-details-panel/index.js +1 -1
  134. package/dist/components/appointment-peek/index.js +1 -1
  135. package/dist/components/appointment-timeline/index.js +1 -1
  136. package/dist/components/bill-line-table/bill-line-table.agent.d.ts +4 -0
  137. package/dist/components/bill-line-table/bill-line-table.columns.d.ts +49 -0
  138. package/dist/components/bill-line-table/bill-line-table.d.ts +4 -0
  139. package/dist/components/bill-line-table/bill-line-table.model.d.ts +173 -0
  140. package/dist/components/bill-line-table/bill-line-table.types.d.ts +443 -0
  141. package/dist/components/bill-line-table/bill-line-table.variants.d.ts +36 -0
  142. package/dist/components/bill-line-table/index.d.ts +6 -0
  143. package/dist/components/bill-line-table/index.js +23 -0
  144. package/dist/components/bill-table/bill-table.agent.d.ts +4 -0
  145. package/dist/components/bill-table/bill-table.d.ts +13 -0
  146. package/dist/components/bill-table/bill-table.variants.d.ts +55 -0
  147. package/dist/components/bill-table/cells.d.ts +89 -0
  148. package/dist/components/bill-table/columns.d.ts +21 -0
  149. package/dist/components/bill-table/default-tabs.d.ts +21 -0
  150. package/dist/components/bill-table/handle.d.ts +19 -0
  151. package/dist/components/bill-table/index.d.ts +7 -0
  152. package/dist/components/bill-table/index.js +19 -0
  153. package/dist/components/bill-table/model.d.ts +103 -0
  154. package/dist/components/bill-table/row-actions.d.ts +27 -0
  155. package/dist/components/bill-table/status-maps.d.ts +225 -0
  156. package/dist/components/bill-table/types.d.ts +542 -0
  157. package/dist/components/bishop-score/index.js +1 -1
  158. package/dist/components/bmi-calculator/index.js +1 -1
  159. package/dist/components/booking/index.js +1 -1
  160. package/dist/components/button-group/index.js +1 -1
  161. package/dist/components/calculator-dialog/index.js +1 -1
  162. package/dist/components/card/card.d.ts +9 -2
  163. package/dist/components/card/index.js +1 -1
  164. package/dist/components/care-plan-card/index.js +1 -1
  165. package/dist/components/care-plan-entry-card/index.js +1 -1
  166. package/dist/components/chart/index.js +1 -1
  167. package/dist/components/clinical-note-card/index.js +1 -1
  168. package/dist/components/combobox/combobox.d.ts +59 -1
  169. package/dist/components/combobox/index.d.ts +1 -1
  170. package/dist/components/combobox/index.js +1 -1
  171. package/dist/components/connection-status/index.js +1 -1
  172. package/dist/components/contact-card/index.js +1 -1
  173. package/dist/components/contact-profile-card/index.js +1 -1
  174. package/dist/components/country-select/index.js +1 -1
  175. package/dist/components/cycle-calculator/index.js +1 -1
  176. package/dist/components/dashboard-grid/index.js +1 -1
  177. package/dist/components/data-grid/body.d.ts +6 -0
  178. package/dist/components/data-grid/data-grid.variants.d.ts +1 -9
  179. package/dist/components/data-grid/editors.d.ts +7 -1
  180. package/dist/components/data-grid/index.js +9 -8
  181. package/dist/components/data-grid/selection.d.ts +10 -0
  182. package/dist/components/data-grid/types.d.ts +61 -11
  183. package/dist/components/data-grid-tabs/index.js +1 -1
  184. package/dist/components/data-table/index.js +4 -4
  185. package/dist/components/dialog/focus-return.d.ts +12 -0
  186. package/dist/components/dialog/index.js +1 -1
  187. package/dist/components/document-preview/index.js +1 -1
  188. package/dist/components/dropdown-menu/dropdown-menu.d.ts +11 -0
  189. package/dist/components/dropdown-menu/index.js +1 -1
  190. package/dist/components/due-date-calculator/index.js +2 -2
  191. package/dist/components/entity-summary/index.js +1 -1
  192. package/dist/components/face-scheme/index.js +1 -1
  193. package/dist/components/fetal-weight/index.js +1 -1
  194. package/dist/components/file-manager/index.js +1 -1
  195. package/dist/components/finished-terminal/index.js +1 -1
  196. package/dist/components/gestational-age-calculator/index.js +1 -1
  197. package/dist/components/hcg-doubling/index.js +1 -1
  198. package/dist/components/header-settings/header-settings.d.ts +7 -3
  199. package/dist/components/header-settings/index.js +1 -1
  200. package/dist/components/heatmap/index.js +1 -1
  201. package/dist/components/icon-button-group/index.js +1 -1
  202. package/dist/components/index.d.ts +6 -0
  203. package/dist/components/map-view/index.d.ts +1 -1
  204. package/dist/components/map-view/index.js +1 -1
  205. package/dist/components/map-view/map-view.d.ts +48 -0
  206. package/dist/components/money/index.js +1 -1
  207. package/dist/components/money/money.d.ts +39 -6
  208. package/dist/components/muscle-scheme/index.js +1 -1
  209. package/dist/components/notes-panel/index.js +1 -1
  210. package/dist/components/notification-card/index.js +1 -1
  211. package/dist/components/notification-card/notification-card.d.ts +2 -1
  212. package/dist/components/notification-tray/index.js +1 -1
  213. package/dist/components/number-input/index.d.ts +2 -2
  214. package/dist/components/number-input/index.js +1 -1
  215. package/dist/components/number-input/number-input.d.ts +43 -2
  216. package/dist/components/number-input/use-locale-number.d.ts +67 -3
  217. package/dist/components/operator-hero/index.js +1 -1
  218. package/dist/components/optical-prescription/index.js +1 -1
  219. package/dist/components/patient-details/index.js +1 -1
  220. package/dist/components/patient-search/index.js +1 -1
  221. package/dist/components/patient-summary-card/index.js +1 -1
  222. package/dist/components/patient-table/index.js +1 -1
  223. package/dist/components/payment-card/index.js +1 -1
  224. package/dist/components/periodontal-chart/index.js +1 -1
  225. package/dist/components/periodontal-chart-card/index.js +1 -1
  226. package/dist/components/periodontal-diagnosis/index.js +1 -1
  227. package/dist/components/periodontal-risk-chart/index.js +1 -1
  228. package/dist/components/practice-profile-hero/index.js +1 -1
  229. package/dist/components/practice-results/index.js +1 -1
  230. package/dist/components/practice-results/practice-results.d.ts +20 -0
  231. package/dist/components/pregnancy-dating/index.js +1 -1
  232. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  233. package/dist/components/province-select/index.js +1 -1
  234. package/dist/components/radiograph-panel/index.js +1 -1
  235. package/dist/components/reviews-panel/index.js +1 -1
  236. package/dist/components/rich-text-editor/index.js +2 -2
  237. package/dist/components/row-actions/index.d.ts +3 -0
  238. package/dist/components/row-actions/index.js +5 -0
  239. package/dist/components/row-actions/row-actions.d.ts +63 -0
  240. package/dist/components/section-card/index.js +1 -1
  241. package/dist/components/skeleton-scheme/index.js +1 -1
  242. package/dist/components/smart-date/smart-date.d.ts +1 -1
  243. package/dist/components/tab-bar/index.js +1 -1
  244. package/dist/components/tabs/index.js +1 -1
  245. package/dist/components/task-editor/index.js +1 -1
  246. package/dist/components/tasks-panel/index.js +1 -1
  247. package/dist/components/theme-toggle/index.js +1 -1
  248. package/dist/components/timeline/index.js +1 -1
  249. package/dist/components/token-insert-menu/index.js +1 -1
  250. package/dist/components/tooth-scheme/index.js +1 -1
  251. package/dist/components/transaction-chip/index.js +1 -1
  252. package/dist/components/transaction-chip/transaction-chip.d.ts +1 -1
  253. package/dist/components/treatment-receipt/index.js +1 -1
  254. package/dist/components/unit-converter/index.js +1 -1
  255. package/dist/components/widget-picker/index.js +1 -1
  256. package/dist/components/workflow/index.js +1 -1
  257. package/dist/components/workflow-status/index.js +1 -1
  258. package/dist/core.css +1 -1
  259. package/dist/decimal/index.js +149 -0
  260. package/dist/host-compat.css +7 -1
  261. package/dist/i18n/locales/ar.d.ts +262 -0
  262. package/dist/i18n/locales/ar.js +263 -1
  263. package/dist/i18n/locales/de.d.ts +262 -0
  264. package/dist/i18n/locales/de.js +263 -1
  265. package/dist/i18n/locales/el.d.ts +262 -0
  266. package/dist/i18n/locales/el.js +263 -1
  267. package/dist/i18n/locales/en.d.ts +262 -0
  268. package/dist/i18n/locales/en.js +263 -1
  269. package/dist/i18n/locales/es.d.ts +262 -0
  270. package/dist/i18n/locales/es.js +263 -1
  271. package/dist/i18n/locales/fr.d.ts +262 -0
  272. package/dist/i18n/locales/fr.js +263 -1
  273. package/dist/i18n/locales/hi.d.ts +262 -0
  274. package/dist/i18n/locales/hi.js +263 -1
  275. package/dist/i18n/locales/it.d.ts +262 -0
  276. package/dist/i18n/locales/it.js +263 -1
  277. package/dist/i18n/locales/ja.d.ts +262 -0
  278. package/dist/i18n/locales/ja.js +263 -1
  279. package/dist/i18n/locales/nl.d.ts +262 -0
  280. package/dist/i18n/locales/nl.js +263 -1
  281. package/dist/i18n/locales/pl.d.ts +262 -0
  282. package/dist/i18n/locales/pl.js +263 -1
  283. package/dist/i18n/locales/pt.d.ts +262 -0
  284. package/dist/i18n/locales/pt.js +263 -1
  285. package/dist/i18n/locales/ro.d.ts +262 -0
  286. package/dist/i18n/locales/ro.js +263 -1
  287. package/dist/i18n/locales/ru.d.ts +262 -0
  288. package/dist/i18n/locales/ru.js +263 -1
  289. package/dist/i18n/locales/sq.d.ts +262 -0
  290. package/dist/i18n/locales/sq.js +263 -1
  291. package/dist/i18n/locales/sv.d.ts +262 -0
  292. package/dist/i18n/locales/sv.js +263 -1
  293. package/dist/i18n/locales/tr.d.ts +262 -0
  294. package/dist/i18n/locales/tr.js +263 -1
  295. package/dist/i18n/locales/zh.d.ts +262 -0
  296. package/dist/i18n/locales/zh.js +263 -1
  297. package/dist/index.js +1298 -1246
  298. package/dist/locales/ar.json +263 -1
  299. package/dist/locales/de.json +263 -1
  300. package/dist/locales/el.json +263 -1
  301. package/dist/locales/en.json +263 -1
  302. package/dist/locales/es.json +263 -1
  303. package/dist/locales/fr.json +263 -1
  304. package/dist/locales/hi.json +263 -1
  305. package/dist/locales/it.json +263 -1
  306. package/dist/locales/ja.json +263 -1
  307. package/dist/locales/nl.json +263 -1
  308. package/dist/locales/pl.json +263 -1
  309. package/dist/locales/pt.json +263 -1
  310. package/dist/locales/ro.json +263 -1
  311. package/dist/locales/ru.json +263 -1
  312. package/dist/locales/sq.json +263 -1
  313. package/dist/locales/sv.json +263 -1
  314. package/dist/locales/tr.json +263 -1
  315. package/dist/locales/zh.json +263 -1
  316. package/dist/patterns/anamnesis/index.js +1 -1
  317. package/dist/patterns/calendar/index.js +1 -1
  318. package/dist/patterns/forgot-password-form/index.js +1 -1
  319. package/dist/patterns/help-me-write-templates/index.js +1 -1
  320. package/dist/patterns/login-form/index.js +1 -1
  321. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  322. package/dist/patterns/payment-automation-upsell/index.js +1 -1
  323. package/dist/patterns/registration-form/index.js +1 -1
  324. package/dist/patterns/reset-password-form/index.js +1 -1
  325. package/dist/patterns/send-registration-link-form/index.js +1 -1
  326. package/dist/patterns/signature-request/index.js +1 -1
  327. package/dist/patterns/verify-identity/index.js +1 -1
  328. package/dist/patterns/workflow-webhook-action/index.js +1 -1
  329. package/dist/tokens.css +1 -1
  330. package/package.json +22 -3
  331. package/dist/_chunks/combobox-duuDRI1t.js +0 -688
  332. package/dist/_chunks/dialog-BTjSQjdY.js +0 -274
  333. package/dist/_chunks/dropdown-menu-CqxBthww.js +0 -595
  334. package/dist/_chunks/format-price-BcFBa-WP.js +0 -52
  335. package/dist/_chunks/map-view-Bny79cWa.js +0 -856
  336. package/dist/_chunks/money-Tsczpjfz.js +0 -102
  337. package/dist/_chunks/number-input-CVwI1ltI.js +0 -423
  338. package/dist/_chunks/parts-Wz2LeGnH.js +0 -1113
  339. package/dist/_chunks/undo-2-CYNAzclj.js +0 -26
@@ -0,0 +1,1565 @@
1
+ import { jsx as o, jsxs as O, Fragment as wt } from "react/jsx-runtime";
2
+ import { createContext as Nt, useContext as fe, useRef as I, useLayoutEffect as cn, useMemo as b, forwardRef as un, useEffect as Pe, useState as Te, useCallback as k, useImperativeHandle as dn } from "react";
3
+ import { useTranslation as mn } from "react-i18next";
4
+ import { u as fn } from "./registry-DvAUVLHh.js";
5
+ import { e as yn } from "./data-grid-DiBSbN2Y.js";
6
+ import { a as K } from "./format-number-DdzqwMs1.js";
7
+ import { i as pn } from "./is-development-CLUAnsU7.js";
8
+ import { B as Ln } from "./badge-BUk4RjTS.js";
9
+ import { C as hn } from "./combobox-BBCVQS-S.js";
10
+ import { M as gn } from "./money-OE6_oDPH.js";
11
+ import { V as Ye } from "./visually-hidden-BHxEUGyT.js";
12
+ import { divideDecimal as vn, formatDecimal as se, multiplyDecimal as bn, sumDecimals as ke, parseDecimal as _e, FATTURAPA_VALUE as Ee, compareDecimal as xe, decimalToNumber as Se, rescaleDecimal as kt, numberToDecimal as In, shiftDecimal as Tn } from "../decimal/index.js";
13
+ import { c as _ } from "./index-D2ZczOXr.js";
14
+ import { E as wn } from "./compact-editor-fields-6sTWRLtf.js";
15
+ import { C as Nn } from "./check-DrFSN__t.js";
16
+ import { P as kn } from "./plus-DzMQ_c6b.js";
17
+ import { C as _n } from "./circle-alert-rGDZ73Wh.js";
18
+ import { T as En } from "./triangle-alert-CBnO6nq_.js";
19
+ function dt(e, t) {
20
+ throw new Error(`${e}: ${t}`);
21
+ }
22
+ const xn = "^[0-9]{1,8}([.][0-9]{1,8})?$", de = { type: "string", minLength: 1 }, we = "{ id, lineNumber, matchState, selected, selectable, readOnly, quantityLocked, itemKind, itemId, quantity, removesStock, warningCodes, invalid }", Sn = {
23
+ id: "bill-line-table",
24
+ // select_multiple: ticks. set_value: a line's quantity and its item
25
+ // (whole-value assignment to a NumberInput and a Combobox, 26 section 4).
26
+ // scroll: focus_line. No `confirm`: loading is the host's.
27
+ capabilities: ["select_multiple", "set_value", "scroll"],
28
+ state: {
29
+ lines: {
30
+ type: `Array<${we}>`,
31
+ descriptionKey: "ui.agent.billLineTable.state.lines",
32
+ description: "Every invoice line in invoice order, with what Confirm will do with it. Quantities are exact decimal text as shown, unsigned; there are no descriptions or names.",
33
+ read: (e) => e.getLines()
34
+ },
35
+ selection: {
36
+ type: "string[]",
37
+ descriptionKey: "ui.agent.billLineTable.state.selection",
38
+ description: "Ids of the ticked lines: the lines Confirm will load.",
39
+ read: (e) => e.getSelection()
40
+ },
41
+ summary: {
42
+ type: "{ lineCount, selectedCount, matchedCount, newItemCount, skippedCount, alreadyLoadedCount, warningLineCount, invoiceLoaded, invalidCount, net, vat, gross, canConfirm, dirty }",
43
+ descriptionKey: "ui.agent.billLineTable.state.summary",
44
+ description: 'Counts and totals of the ticked lines. net, vat and gross are exact decimal text with 2 places ("14.58"). canConfirm is false while no line is ticked, a ticked line cannot load, or the invoice is already loaded (invoiceLoaded).',
45
+ read: (e) => e.getSummary()
46
+ },
47
+ invalidLineIds: {
48
+ type: "string[]",
49
+ descriptionKey: "ui.agent.billLineTable.state.invalidLineIds",
50
+ description: "Ticked lines that cannot load as they are: an empty or zero quantity, an item no longer in the warehouse, or an error from the server.",
51
+ read: (e) => e.getInvalidLineIds()
52
+ }
53
+ },
54
+ actions: {
55
+ select_lines: {
56
+ safety: "write",
57
+ idempotent: !0,
58
+ argsType: "{ ids: string[]; mode?: 'replace' | 'add' | 'remove' }",
59
+ argsSchema: {
60
+ type: "object",
61
+ properties: {
62
+ ids: { type: "array", items: de, uniqueItems: !0 },
63
+ mode: { type: "string", enum: ["replace", "add", "remove"] }
64
+ },
65
+ required: ["ids"],
66
+ additionalProperties: !1
67
+ },
68
+ returns: "string[]",
69
+ errors: ["UNKNOWN_LINE", "LINE_READ_ONLY", "TABLE_READ_ONLY"],
70
+ examples: [{ args: { ids: ["ln-3", "ln-4"], mode: "add" } }],
71
+ descriptionKey: "ui.agent.billLineTable.actions.selectLines",
72
+ description: "Tick or untick lines. Lines of an invoice that is already loaded cannot be ticked. Returns the ticked ids.",
73
+ invoke: (e, t) => {
74
+ for (const u of t.ids)
75
+ e.getLine(u) || dt("UNKNOWN_LINE", `no line "${u}".`);
76
+ const i = e.getSelection(), n = t.mode ?? "replace", r = n === "replace" ? t.ids : n === "add" ? [...i, ...t.ids] : i.filter((u) => !t.ids.includes(u));
77
+ return e.setSelection(r), e.getSelection();
78
+ }
79
+ },
80
+ select_all_lines: {
81
+ safety: "write",
82
+ idempotent: !0,
83
+ returns: "string[]",
84
+ errors: ["TABLE_READ_ONLY"],
85
+ descriptionKey: "ui.agent.billLineTable.actions.selectAllLines",
86
+ description: "Tick every line that can load. Returns the ticked ids.",
87
+ invoke: (e) => (e.selectAll(), e.getSelection())
88
+ },
89
+ clear_selection: {
90
+ safety: "write",
91
+ idempotent: !0,
92
+ returns: "string[]",
93
+ errors: ["TABLE_READ_ONLY"],
94
+ descriptionKey: "ui.agent.billLineTable.actions.clearSelection",
95
+ description: "Untick every line.",
96
+ invoke: (e) => (e.clearSelection(), e.getSelection())
97
+ },
98
+ set_quantity: {
99
+ safety: "write",
100
+ idempotent: !0,
101
+ argsType: "{ lineId: string; quantity: string }",
102
+ argsSchema: {
103
+ type: "object",
104
+ properties: {
105
+ lineId: de,
106
+ quantity: { type: "string", pattern: xn }
107
+ },
108
+ required: ["lineId", "quantity"],
109
+ additionalProperties: !1
110
+ },
111
+ returns: we,
112
+ errors: [
113
+ "UNKNOWN_LINE",
114
+ "INVALID_QUANTITY",
115
+ "TABLE_READ_ONLY",
116
+ "LINE_READ_ONLY"
117
+ ],
118
+ examples: [
119
+ { args: { lineId: "ln-2", quantity: "2.5" } },
120
+ {
121
+ args: { lineId: "ln-7", quantity: "3" },
122
+ note: "On a credit note this removes 3 from stock."
123
+ }
124
+ ],
125
+ descriptionKey: "ui.agent.billLineTable.actions.setQuantity",
126
+ description: "Set the quantity of a line as shown in the table: a decimal above 0 and at most 10000000, with a dot and up to 8 places, never signed. On a credit note it is the quantity to remove. The line amount stays as invoiced. Does not tick the line.",
127
+ invoke: (e, t) => (e.setQuantity(t.lineId, t.quantity), e.getLine(t.lineId))
128
+ },
129
+ set_item: {
130
+ safety: "write",
131
+ idempotent: !0,
132
+ argsType: "{ lineId: string; itemId: string }",
133
+ argsSchema: {
134
+ type: "object",
135
+ properties: {
136
+ lineId: de,
137
+ itemId: { type: "string", minLength: 1 }
138
+ },
139
+ required: ["lineId", "itemId"],
140
+ additionalProperties: !1
141
+ },
142
+ returns: we,
143
+ errors: [
144
+ "UNKNOWN_LINE",
145
+ "UNKNOWN_ITEM",
146
+ "TABLE_READ_ONLY",
147
+ "LINE_READ_ONLY"
148
+ ],
149
+ descriptionKey: "ui.agent.billLineTable.actions.setItem",
150
+ description: "Load a line into an existing warehouse item, by item id. Does not tick the line.",
151
+ invoke: (e, t) => (e.setItem(t.lineId, { kind: "existing", itemId: t.itemId }), e.getLine(t.lineId))
152
+ },
153
+ create_new_item: {
154
+ safety: "write",
155
+ idempotent: !0,
156
+ argsType: "{ lineId: string; name?: string }",
157
+ argsSchema: {
158
+ type: "object",
159
+ properties: {
160
+ lineId: de,
161
+ // DoctorInventoryItem.name is a string of 255.
162
+ name: { type: "string", minLength: 1, maxLength: 255 }
163
+ },
164
+ required: ["lineId"],
165
+ additionalProperties: !1
166
+ },
167
+ returns: we,
168
+ errors: [
169
+ "UNKNOWN_LINE",
170
+ "INVALID_ARGS",
171
+ "TABLE_READ_ONLY",
172
+ "LINE_READ_ONLY"
173
+ ],
174
+ descriptionKey: "ui.agent.billLineTable.actions.createNewItem",
175
+ description: "Mark a line to create a new warehouse item when the invoice is loaded. Without a name, the item takes the line description. Nothing is created until Confirm. Does not tick the line.",
176
+ invoke: (e, t) => {
177
+ var n;
178
+ const i = (n = t.name) == null ? void 0 : n.trim();
179
+ return t.name !== void 0 && !i && dt("INVALID_ARGS", "name is empty."), e.setItem(t.lineId, { kind: "new", name: i ?? "" }), e.getLine(t.lineId);
180
+ }
181
+ },
182
+ focus_line: {
183
+ safety: "read",
184
+ idempotent: !0,
185
+ argsType: "{ lineId: string; field?: 'select' | 'quantity' | 'item' }",
186
+ argsSchema: {
187
+ type: "object",
188
+ properties: {
189
+ lineId: de,
190
+ field: { type: "string", enum: ["select", "quantity", "item"] }
191
+ },
192
+ required: ["lineId"],
193
+ additionalProperties: !1
194
+ },
195
+ errors: ["UNKNOWN_LINE"],
196
+ descriptionKey: "ui.agent.billLineTable.actions.focusLine",
197
+ description: "Scroll a line into view and move focus to its checkbox, quantity or item field.",
198
+ invoke: (e, t) => {
199
+ e.focusLine(t.lineId, t.field);
200
+ }
201
+ }
202
+ },
203
+ domHooks: {
204
+ root: {
205
+ attr: "data-component",
206
+ value: "bill-line-table",
207
+ description: "Marks the element as a kit BillLineTable."
208
+ },
209
+ instanceId: {
210
+ attr: "data-component-id",
211
+ sourceProp: "gridId",
212
+ description: "The agent instance id."
213
+ },
214
+ item: {
215
+ attr: "data-row-id",
216
+ sourceProp: "lines[].id",
217
+ description: "BillLine.id on each body row (written by DataGrid). The only line datum in the DOM."
218
+ }
219
+ }
220
+ }, ae = 8, _t = 8, Cn = 2, ye = 1e7, mt = 255, le = "bill-line-table:new-item", Et = "quantityTooLarge", me = { units: 0, scale: 0 }, xt = { units: ye, scale: 0 }, qn = {
221
+ ...Ee.quantity,
222
+ allowNegative: !0
223
+ };
224
+ function Ce(e) {
225
+ let { units: t, scale: i } = e;
226
+ for (; i > 0 && t % 10 === 0; )
227
+ t /= 10, i -= 1;
228
+ return { units: t || 0, scale: i };
229
+ }
230
+ function Ue(e) {
231
+ return { units: Math.abs(e.units), scale: e.scale };
232
+ }
233
+ function A(e) {
234
+ const t = {
235
+ empty: !0,
236
+ wellFormed: !1,
237
+ positive: !1,
238
+ value: null,
239
+ editorNumber: null
240
+ };
241
+ if (e === null || e.trim() === "") return t;
242
+ const i = _e(e, qn);
243
+ if (i.ok) {
244
+ const n = Se(i.value);
245
+ return {
246
+ empty: !1,
247
+ wellFormed: !0,
248
+ positive: i.value.units > 0,
249
+ value: i.value,
250
+ editorNumber: n !== null && Math.abs(n) <= ye ? n : null
251
+ };
252
+ }
253
+ return i.error === "unsafe" ? {
254
+ empty: !1,
255
+ wellFormed: !0,
256
+ positive: !e.trim().startsWith("-"),
257
+ value: null,
258
+ editorNumber: null
259
+ } : { ...t, empty: !1 };
260
+ }
261
+ function $e(e) {
262
+ const t = A(e);
263
+ return !t.wellFormed || t.editorNumber !== null;
264
+ }
265
+ function On(e) {
266
+ const t = In(e, ae);
267
+ return t ? se(Ce(t)) : null;
268
+ }
269
+ function oe(e) {
270
+ const t = _e(e, Ee.lineTotal);
271
+ return t.ok ? t.value : null;
272
+ }
273
+ function St(e) {
274
+ if (e === null) return null;
275
+ const t = _e(e, Ee.rate);
276
+ return t.ok ? t.value : null;
277
+ }
278
+ function An(e, t) {
279
+ const i = oe(e), n = A(t).value;
280
+ if (!i || !n || n.units === 0) return null;
281
+ const r = vn(i, n, _t);
282
+ return r ? se(Ce(r)) : null;
283
+ }
284
+ function Rn(e, t) {
285
+ const i = oe(e), n = oe(t);
286
+ return !i || !n ? e.trim() === t.trim() : xe(Ue(i), Ue(n)) === 0;
287
+ }
288
+ function W(e) {
289
+ const t = e.trim(), i = Array.from(t);
290
+ return i.length > mt ? i.slice(0, mt).join("").trim() : t;
291
+ }
292
+ function Qe(e, t) {
293
+ if (e.kind === "existing")
294
+ return { kind: "existing", itemId: e.itemId };
295
+ const i = W(e.name);
296
+ return {
297
+ kind: "new",
298
+ name: i === "" ? W(t.description) : i
299
+ };
300
+ }
301
+ function Vn(e) {
302
+ const t = A(e);
303
+ return t.wellFormed ? t.value === null ? !0 : xe(Ue(t.value), xt) > 0 : !1;
304
+ }
305
+ function Ct(e, t) {
306
+ return Vn(t.quantity) && !At(t.quantity, e.quantity);
307
+ }
308
+ function qt(e) {
309
+ return e.item.kind === "new" && W(e.item.name) === "";
310
+ }
311
+ function Dn(e, t) {
312
+ if (t.item.kind !== "new") return !1;
313
+ const i = W(t.item.name);
314
+ return i !== "" && i === W(e.description);
315
+ }
316
+ function te(e) {
317
+ return e.some((t) => t.alreadyLoaded);
318
+ }
319
+ function z(e) {
320
+ return {
321
+ quantity: e.quantity,
322
+ item: e.proposal === "existing" && e.proposedItemId !== null ? { kind: "existing", itemId: e.proposedItemId } : { kind: "new", name: W(e.description) }
323
+ };
324
+ }
325
+ function Vi(e) {
326
+ const t = {};
327
+ for (const i of e) t[i.id] = z(i);
328
+ return t;
329
+ }
330
+ function Ke(e) {
331
+ return te(e) ? [] : e.filter((t) => t.proposal !== "skip").map((t) => t.id);
332
+ }
333
+ function ft(e, t) {
334
+ const i = {};
335
+ for (const n of e)
336
+ i[n.id] = t[n.id] ?? z(n);
337
+ return i;
338
+ }
339
+ function Bn(e, t) {
340
+ return !e.alreadyLoaded;
341
+ }
342
+ function $(e, t) {
343
+ if (te(e) || t.length === 0) return [];
344
+ const n = new Set(t);
345
+ return e.filter((r) => n.has(r.id) && Bn(r)).map((r) => r.id);
346
+ }
347
+ function Ot(e, t) {
348
+ return e.kind === "existing" ? t.kind === "existing" && e.itemId === t.itemId : t.kind === "new" && W(e.name) === W(t.name);
349
+ }
350
+ function At(e, t) {
351
+ if (e === t) return !0;
352
+ if (e === null || t === null) return !1;
353
+ const i = A(e).value, n = A(t).value;
354
+ return i && n ? xe(i, n) === 0 : e.trim() === t.trim();
355
+ }
356
+ function Rt(e, t) {
357
+ return At(e.quantity, t.quantity) && Ot(e.item, t.item);
358
+ }
359
+ function Mn(e, t, i) {
360
+ return e.alreadyLoaded ? "alreadyLoaded" : i ? t.item.kind === "existing" ? "matched" : "newItem" : "skip";
361
+ }
362
+ function ze(e, t, i = !0) {
363
+ const n = A(t.quantity);
364
+ return !n.wellFormed || !n.positive || Ct(e, t) || !oe(e.lineTotal) || t.item.kind === "existing" && !i || qt(t) ? !0 : e.warnings.some((r) => r.severity === "error");
365
+ }
366
+ const Vt = () => !0;
367
+ function Dt(e, t) {
368
+ return e.item.kind !== "existing" || t(e.item.itemId);
369
+ }
370
+ function yt(e) {
371
+ const t = ke(e);
372
+ if (t) return t;
373
+ const i = [];
374
+ for (const n of e) {
375
+ const r = kt(n, 2);
376
+ r && i.push(r);
377
+ }
378
+ return ke(i) ?? me;
379
+ }
380
+ function Ne(e) {
381
+ return kt(e, 2) ?? me;
382
+ }
383
+ const Fe = (e) => se(e, 2);
384
+ function pt(e, t, i, n, r = Vt) {
385
+ const u = te(e), E = new Set($(e, i));
386
+ let T = 0, p = 0, g = 0, N = 0, R = 0, q = 0, V = 0;
387
+ const D = [], B = /* @__PURE__ */ new Map();
388
+ for (const m of e) {
389
+ const H = t[m.id] ?? z(m);
390
+ if ((m.warnings.length > 0 || !$e(m.quantity)) && (q += 1), m.alreadyLoaded) {
391
+ R += 1;
392
+ continue;
393
+ }
394
+ if (!E.has(m.id)) {
395
+ N += 1;
396
+ continue;
397
+ }
398
+ T += 1, H.item.kind === "existing" ? p += 1 : g += 1, ze(m, H, Dt(H, r)) && (V += 1);
399
+ const F = oe(m.lineTotal);
400
+ if (!F) continue;
401
+ D.push(F);
402
+ const f = St(m.vatPercent);
403
+ if (f) {
404
+ const he = se(Ce(f)), X = B.get(he);
405
+ X ? X.amounts.push(F) : B.set(he, { rate: f, amounts: [F] });
406
+ }
407
+ }
408
+ const j = Ne(yt(D)), y = [];
409
+ for (const m of B.values()) {
410
+ const H = {
411
+ units: m.rate.units,
412
+ scale: m.rate.scale + 2
413
+ }, F = Ne(yt(m.amounts));
414
+ y.push(bn(F, H, 2) ?? me);
415
+ }
416
+ const v = ke(y) ?? me, M = ke([j, v]) ?? me, G = $(e, n.selection), Le = G.length !== E.size || G.some((m) => !E.has(m)) || e.some(
417
+ (m) => !Rt(
418
+ t[m.id] ?? z(m),
419
+ n.values[m.id] ?? z(m)
420
+ )
421
+ );
422
+ return {
423
+ lineCount: e.length,
424
+ selectedCount: T,
425
+ matchedCount: p,
426
+ newItemCount: g,
427
+ skippedCount: N,
428
+ alreadyLoadedCount: R,
429
+ warningLineCount: q,
430
+ invoiceLoaded: u,
431
+ invalidCount: V,
432
+ net: Fe(j),
433
+ vat: Fe(Ne(v)),
434
+ gross: Fe(Ne(M)),
435
+ canConfirm: T > 0 && V === 0,
436
+ dirty: Le
437
+ };
438
+ }
439
+ function Pn(e) {
440
+ const t = A(e).value;
441
+ return t ? se(t) : e.trim();
442
+ }
443
+ function Kn(e, t, i, n, r = Vt) {
444
+ if (te(e)) return { ok: !1, invalidLineIds: [] };
445
+ const u = new Set($(e, i)), E = [], T = [];
446
+ for (const p of e) {
447
+ if (!u.has(p.id)) continue;
448
+ const g = t[p.id] ?? z(p);
449
+ if (g.quantity === null || ze(p, g, Dt(g, r))) {
450
+ T.push(p.id);
451
+ continue;
452
+ }
453
+ const N = Pn(g.quantity);
454
+ E.push({
455
+ lineId: p.id,
456
+ quantity: n === "creditNote" ? `-${N}` : N,
457
+ item: Qe(g.item, p)
458
+ });
459
+ }
460
+ return T.length > 0 ? { ok: !1, invalidLineIds: T } : { ok: !0, lines: E };
461
+ }
462
+ function Bt(e, t, i) {
463
+ const n = i.ticked.has(e.id), r = t.item.kind === "existing" ? i.findItem(t.item.itemId) ?? null : null, u = t.item.kind !== "existing" || r !== null;
464
+ return {
465
+ line: e,
466
+ value: t,
467
+ selected: n,
468
+ matchState: Mn(e, t, n),
469
+ invalid: n && ze(e, t, u),
470
+ readOnly: i.invoiceLoaded,
471
+ quantityLocked: !$e(e.quantity),
472
+ item: r,
473
+ itemKnown: u
474
+ };
475
+ }
476
+ function Fn(e, t) {
477
+ return e === t ? !0 : e === null || t === null ? !1 : e.id === t.id && e.name === t.name && e.code === t.code;
478
+ }
479
+ function Un(e, t) {
480
+ return e.line === t.line && e.value.quantity === t.value.quantity && Ot(e.value.item, t.value.item) && e.selected === t.selected && e.matchState === t.matchState && e.invalid === t.invalid && e.readOnly === t.readOnly && e.quantityLocked === t.quantityLocked && e.itemKnown === t.itemKnown && Fn(e.item, t.item);
481
+ }
482
+ function Lt(e) {
483
+ const t = {
484
+ invoiceLoaded: te(e.lines),
485
+ ticked: new Set($(e.lines, e.selection)),
486
+ findItem: e.findItem
487
+ };
488
+ return e.lines.map((i) => {
489
+ var u;
490
+ const n = Bt(
491
+ i,
492
+ e.values[i.id] ?? z(i),
493
+ t
494
+ ), r = (u = e.previous) == null ? void 0 : u.get(i.id);
495
+ return r && Un(r, n) ? r : n;
496
+ });
497
+ }
498
+ function Qn(e, t) {
499
+ const i = e.line.warnings.map((r) => r.code);
500
+ e.quantityLocked && i.push(Et);
501
+ const n = e.readOnly || e.line.alreadyLoaded;
502
+ return {
503
+ id: e.line.id,
504
+ lineNumber: e.line.lineNumber,
505
+ matchState: e.matchState,
506
+ selected: e.selected,
507
+ selectable: !n && !t.tableReadOnly,
508
+ readOnly: n || t.tableReadOnly,
509
+ quantityLocked: e.quantityLocked,
510
+ itemKind: e.value.item.kind,
511
+ itemId: e.value.item.kind === "existing" ? e.value.item.itemId : null,
512
+ quantity: e.value.quantity,
513
+ removesStock: t.documentKind === "creditNote",
514
+ warningCodes: i,
515
+ invalid: e.invalid
516
+ };
517
+ }
518
+ function Yn(e) {
519
+ const t = _e(e, Ee.quantity);
520
+ return !t.ok || t.value.units <= 0 || xe(t.value, xt) > 0 ? null : se(Ce(t.value));
521
+ }
522
+ const $n = _("ds:flex ds:min-w-0 ds:flex-col", {
523
+ variants: {
524
+ height: {
525
+ auto: "",
526
+ fill: "ds:min-h-0 ds:flex-1"
527
+ }
528
+ },
529
+ defaultVariants: { height: "fill" }
530
+ }), zn = _([
531
+ "ds:w-full ds:min-w-0",
532
+ wn
533
+ ]), Mt = _("ds:flex ds:flex-col", {
534
+ variants: {
535
+ align: {
536
+ start: "ds:items-start",
537
+ end: "ds:items-end"
538
+ }
539
+ },
540
+ defaultVariants: { align: "start" }
541
+ }), Pt = _(
542
+ "type-body-sm ds:text-[color:var(--muted-foreground)]"
543
+ ), Kt = _(
544
+ "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-2xs)] ds:p-0",
545
+ {
546
+ variants: {
547
+ align: {
548
+ start: "ds:items-start",
549
+ end: "ds:items-end"
550
+ }
551
+ },
552
+ defaultVariants: { align: "start" }
553
+ }
554
+ ), qe = _("ds:tabular-nums"), Wn = _(
555
+ "ds:flex ds:items-start ds:gap-[var(--spacing-xs)]"
556
+ ), ht = _(
557
+ "ds:mt-[var(--spacing-2xs)] ds:size-4 ds:shrink-0",
558
+ {
559
+ variants: {
560
+ severity: {
561
+ warning: "ds:text-[color:var(--warning-foreground)]",
562
+ error: "ds:text-[color:var(--error-foreground)]"
563
+ }
564
+ },
565
+ defaultVariants: { severity: "warning" }
566
+ }
567
+ ), jn = _("ds:text-[color:var(--foreground)]"), Gn = _(
568
+ "ds:m-0 ds:grid ds:grid-cols-1 ds:justify-items-end ds:text-end"
569
+ ), gt = _(
570
+ "type-meta ds:text-[color:var(--muted-foreground)]"
571
+ ), vt = _(
572
+ "ds:m-0 ds:[&:not(:last-child)]:mb-[var(--spacing-2xs)]"
573
+ ), Hn = {
574
+ itemOptions: [],
575
+ itemOptionIds: /* @__PURE__ */ new Set(),
576
+ serverSearch: !1,
577
+ itemsLoading: !1,
578
+ searchingLineId: null
579
+ }, Ft = Nt(Hn), pe = Nt(
580
+ null
581
+ ), Xn = {
582
+ matched: { variant: "success", check: !1 },
583
+ newItem: { variant: "info", check: !1 },
584
+ skip: { variant: "neutral", check: !1 },
585
+ alreadyLoaded: { variant: "neutral", check: !0 }
586
+ };
587
+ function bt(e, t) {
588
+ return e === "matched" ? t("billLineTable.match.matched", "Matched") : e === "newItem" ? t("billLineTable.match.newItem", "New item") : e === "alreadyLoaded" ? t("billLineTable.match.alreadyLoaded", "Already loaded") : t("billLineTable.match.skip", "Skip");
589
+ }
590
+ function Ut(e, t) {
591
+ const i = St(e), n = i ? Se(i) : null;
592
+ return n === null ? e.trim() : K(Tn(n, -2), t, {
593
+ style: "percent",
594
+ minimumFractionDigits: 0,
595
+ maximumFractionDigits: Cn
596
+ });
597
+ }
598
+ function ne({
599
+ value: e,
600
+ currency: t,
601
+ fractionDigits: i = _t,
602
+ tone: n = "default"
603
+ }) {
604
+ const r = oe(e);
605
+ return r ? /* @__PURE__ */ o(
606
+ gn,
607
+ {
608
+ size: "sm",
609
+ tone: n,
610
+ value: r.units,
611
+ scale: r.scale,
612
+ currency: t,
613
+ minimumFractionDigits: Math.min(2, i),
614
+ maximumFractionDigits: i
615
+ }
616
+ ) : /* @__PURE__ */ o("span", { dir: "ltr", className: qe(), children: e.trim() });
617
+ }
618
+ function Jn(e, t) {
619
+ const i = e.value.quantity;
620
+ if (i === null) return null;
621
+ const n = A(i), r = n.value ? Se(n.value) : null;
622
+ return /* @__PURE__ */ O("span", { className: qe(), children: [
623
+ r === null ? (
624
+ // More digits than a double holds: every digit, as sent.
625
+ /* @__PURE__ */ o("span", { dir: "ltr", children: i.trim() })
626
+ ) : K(r, t, {
627
+ maximumFractionDigits: ae
628
+ }),
629
+ e.line.unitOfMeasure ? /* @__PURE__ */ O(wt, { children: [
630
+ " ",
631
+ /* @__PURE__ */ o("span", { dir: "auto", children: e.line.unitOfMeasure })
632
+ ] }) : null
633
+ ] });
634
+ }
635
+ function Zn(e, t) {
636
+ const { t: i } = t;
637
+ if (!e.selected) return;
638
+ const n = A(e.value.quantity);
639
+ if (n.empty)
640
+ return i("billLineTable.quantity.errorRequired", "Enter a quantity");
641
+ if (!n.wellFormed || !n.positive)
642
+ return i(
643
+ "billLineTable.quantity.errorNotPositive",
644
+ "Enter a quantity above 0"
645
+ );
646
+ if (Ct(e.line, e.value))
647
+ return i("billLineTable.quantity.errorTooLarge", {
648
+ max: K(ye, t.language),
649
+ defaultValue: "Enter a quantity of {{max}} or less"
650
+ });
651
+ const r = e.line.warnings.find(
652
+ (u) => u.severity === "error"
653
+ );
654
+ return r == null ? void 0 : r.message;
655
+ }
656
+ function ei(e, t) {
657
+ if (!e.itemKnown)
658
+ return t(
659
+ "billLineTable.item.errorUnknown",
660
+ "This item is no longer in the warehouse. Choose another."
661
+ );
662
+ if (e.selected && qt(e.value))
663
+ return t(
664
+ "billLineTable.item.errorNameRequired",
665
+ "Enter a name for the new item"
666
+ );
667
+ }
668
+ function ti(e, t) {
669
+ const i = An(e.line.lineTotal, e.value.quantity), n = i !== null && !Rn(i, e.line.unitPrice) ? i : null;
670
+ return /* @__PURE__ */ O("span", { className: Mt({ align: "end" }), children: [
671
+ /* @__PURE__ */ o(ne, { value: e.line.unitPrice, currency: t.currency }),
672
+ n !== null ? /* @__PURE__ */ O("span", { className: Pt(), children: [
673
+ t.t("billLineTable.unitPrice.netLabel", "Net per unit"),
674
+ " ",
675
+ /* @__PURE__ */ o(
676
+ ne,
677
+ {
678
+ value: n,
679
+ currency: t.currency,
680
+ tone: "muted"
681
+ }
682
+ )
683
+ ] }) : null
684
+ ] });
685
+ }
686
+ function ni(e, t) {
687
+ return e.line.adjustments.length === 0 ? null : /* @__PURE__ */ o("ul", { className: Kt({ align: "end" }), children: e.line.adjustments.map((i, n) => (
688
+ // Index key: the blocks have no identity and never reorder.
689
+ /* @__PURE__ */ O("li", { className: qe(), children: [
690
+ /* @__PURE__ */ o(Ye, { children: i.type === "discount" ? t.t("billLineTable.adjustment.discount", "Discount") : t.t("billLineTable.adjustment.surcharge", "Surcharge") }),
691
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: i.type === "discount" ? "−" : "+" }),
692
+ i.percent !== null ? Ut(i.percent, t.language) : i.amount !== null ? /* @__PURE__ */ o(ne, { value: i.amount, currency: t.currency }) : null
693
+ ] }, n)
694
+ )) });
695
+ }
696
+ function ii(e, t) {
697
+ if (e.line.vatPercent === null)
698
+ return /* @__PURE__ */ O(wt, { children: [
699
+ /* @__PURE__ */ o("span", { "aria-hidden": "true", children: "–" }),
700
+ /* @__PURE__ */ o(Ye, { children: t.t("billLineTable.vat.none", "No VAT rate") })
701
+ ] });
702
+ const i = Ut(e.line.vatPercent, t.language);
703
+ return e.line.vatNature ? t.t("billLineTable.vat.withNature", {
704
+ rate: i,
705
+ nature: e.line.vatNature,
706
+ defaultValue: "{{rate}} ({{nature}})"
707
+ }) : i;
708
+ }
709
+ function We(e, t) {
710
+ return t.privacyMode ? t.t("billLineTable.item.newOptionMasked", "New item") : t.t("billLineTable.item.newOption", {
711
+ name: e,
712
+ defaultValue: "New item: {{name}}"
713
+ });
714
+ }
715
+ function ri(e, t) {
716
+ const i = [We("", { ...t, privacyMode: !1 }).trim()];
717
+ t.privacyMode && i.push(t.t("billLineTable.item.newOptionMasked", "New item"));
718
+ for (const n of i)
719
+ if (n !== "" && e.startsWith(n))
720
+ return e.slice(n.length).trim();
721
+ return e.trim();
722
+ }
723
+ function It(e, t) {
724
+ var n;
725
+ const i = e.value.item;
726
+ return i.kind === "new" ? We(i.name, t) : ((n = e.item) == null ? void 0 : n.name) ?? "";
727
+ }
728
+ function Qt(e) {
729
+ return {
730
+ value: e.id,
731
+ label: e.name,
732
+ description: e.code ?? void 0,
733
+ // Item names are text a practice wrote.
734
+ dir: "auto"
735
+ };
736
+ }
737
+ const ai = () => 1;
738
+ function li(e, t) {
739
+ const i = [...e.line.warnings];
740
+ return e.quantityLocked && i.push({
741
+ code: Et,
742
+ message: t.t(
743
+ "billLineTable.quantity.tooLarge",
744
+ "This quantity is too large to edit here. It loads as on the invoice."
745
+ ),
746
+ severity: "warning"
747
+ }), t.privacyMode && e.selected && Dn(e.line, e.value) && i.push({
748
+ code: "newItemNameHidden",
749
+ message: t.t(
750
+ "billLineTable.item.checkNameHidden",
751
+ "The new item takes the line description as its name. Turn off privacy mode to check it before you load."
752
+ ),
753
+ severity: "warning"
754
+ }), i.length === 0 ? null : /* @__PURE__ */ o("ul", { className: Kt(), children: i.map((n, r) => (
755
+ // Index key: warnings have no identity of their own.
756
+ /* @__PURE__ */ O("li", { className: Wn(), children: [
757
+ n.severity === "error" ? /* @__PURE__ */ o(
758
+ _n,
759
+ {
760
+ "aria-hidden": "true",
761
+ className: ht({ severity: "error" })
762
+ }
763
+ ) : /* @__PURE__ */ o(
764
+ En,
765
+ {
766
+ "aria-hidden": "true",
767
+ className: ht({ severity: "warning" })
768
+ }
769
+ ),
770
+ /* @__PURE__ */ O("span", { className: jn(), children: [
771
+ /* @__PURE__ */ o(Ye, { children: n.severity === "error" ? t.t("billLineTable.warnings.error", "Error:") : t.t("billLineTable.warnings.warning", "Warning:") }),
772
+ /* @__PURE__ */ o("span", { dir: "auto", children: n.message })
773
+ ] })
774
+ ] }, r)
775
+ )) });
776
+ }
777
+ function oi({
778
+ row: e,
779
+ context: t,
780
+ deps: i
781
+ }) {
782
+ const n = fe(Ft), { t: r, setItem: u, queryItems: E } = i, { line: T, value: p, item: g } = e, N = p.item.kind === "new" ? p.item.name : null, R = I(null), q = I(i.privacyMode), V = I(0), D = I(!1);
783
+ if (q.current !== i.privacyMode) {
784
+ q.current = i.privacyMode;
785
+ const y = R.current;
786
+ y !== null && y.contains(y.ownerDocument.activeElement) && (V.current += 1, D.current = !0);
787
+ }
788
+ cn(() => {
789
+ if (!D.current) return;
790
+ D.current = !1;
791
+ const y = () => {
792
+ var v, M;
793
+ return (M = (v = R.current) == null ? void 0 : v.querySelector('input[role="combobox"]')) == null ? void 0 : M.focus();
794
+ };
795
+ y(), queueMicrotask(y);
796
+ }, [i.privacyMode]);
797
+ const B = b(() => N !== null ? [
798
+ {
799
+ value: le,
800
+ label: We(N, i),
801
+ description: r(
802
+ "billLineTable.item.newOptionDescription",
803
+ "Created when you load the invoice"
804
+ )
805
+ },
806
+ ...n.itemOptions
807
+ ] : g && !n.itemOptionIds.has(g.id) ? [Qt(g), ...n.itemOptions] : n.itemOptions, [N, g, n.itemOptions, n.itemOptionIds, i, r]), j = b(
808
+ () => ({
809
+ label: r("billLineTable.item.createNew", "Create new item"),
810
+ icon: /* @__PURE__ */ o(kn, {}),
811
+ // Marks the line only; nothing is created before Confirm (D5). The
812
+ // typed text names the item; with none, the description does.
813
+ onSelect: (y) => u(T.id, {
814
+ kind: "new",
815
+ name: ri(y, i)
816
+ })
817
+ }),
818
+ [r, u, T.id, i]
819
+ );
820
+ return /* @__PURE__ */ o("div", { ref: R, className: zn(), children: /* @__PURE__ */ o(
821
+ hn,
822
+ {
823
+ "aria-labelledby": t.labelledBy,
824
+ "aria-invalid": t.invalid || void 0,
825
+ "aria-describedby": t.errorId,
826
+ options: B,
827
+ value: p.item.kind === "existing" ? p.item.itemId : le,
828
+ onValueChange: (y) => {
829
+ y === "" || y === le || u(T.id, { kind: "existing", itemId: y });
830
+ },
831
+ placeholder: r("billLineTable.item.placeholder", "Choose an item"),
832
+ openOnFocus: !1,
833
+ popoverSize: "md",
834
+ wrapOptionLabels: !0,
835
+ action: j,
836
+ onQueryChange: n.serverSearch ? (y) => E(T.id, y) : void 0,
837
+ filter: n.serverSearch ? ai : void 0,
838
+ loading: n.serverSearch ? n.searchingLineId === T.id && n.itemsLoading : void 0
839
+ },
840
+ V.current
841
+ ) });
842
+ }
843
+ function si({ deps: e }) {
844
+ const t = fe(pe);
845
+ if (!t) return null;
846
+ const i = t.lineCount - t.alreadyLoadedCount;
847
+ return /* @__PURE__ */ O("span", { className: Mt(), children: [
848
+ /* @__PURE__ */ o("span", { children: e.t("billLineTable.footer.ticked", {
849
+ count: i,
850
+ selected: K(t.selectedCount, e.language),
851
+ total: K(i, e.language),
852
+ defaultValue: "{{selected}} of {{total}} lines ticked",
853
+ defaultValue_one: "{{selected}} of {{total}} line ticked",
854
+ defaultValue_other: "{{selected}} of {{total}} lines ticked"
855
+ }) }),
856
+ t.newItemCount > 0 ? /* @__PURE__ */ o("span", { className: Pt(), children: e.t("billLineTable.footer.newItems", {
857
+ count: t.newItemCount,
858
+ countText: K(t.newItemCount, e.language),
859
+ defaultValue: "{{countText}} new items",
860
+ defaultValue_one: "{{countText}} new item",
861
+ defaultValue_other: "{{countText}} new items"
862
+ }) }) : null
863
+ ] });
864
+ }
865
+ function ci({ currency: e }) {
866
+ const t = fe(pe);
867
+ return t ? /* @__PURE__ */ o(ne, { value: t.vat, currency: e, fractionDigits: 2 }) : null;
868
+ }
869
+ function ui({ deps: e }) {
870
+ const t = fe(pe);
871
+ return t ? /* @__PURE__ */ O("dl", { className: Gn(), children: [
872
+ /* @__PURE__ */ o("dt", { className: gt(), children: e.t("billLineTable.footer.net", "Net") }),
873
+ /* @__PURE__ */ o("dd", { className: vt(), children: /* @__PURE__ */ o(
874
+ ne,
875
+ {
876
+ value: t.net,
877
+ currency: e.currency,
878
+ fractionDigits: 2
879
+ }
880
+ ) }),
881
+ /* @__PURE__ */ o("dt", { className: gt(), children: e.t("billLineTable.footer.gross", "Total with VAT") }),
882
+ /* @__PURE__ */ o("dd", { className: vt(), children: /* @__PURE__ */ o(
883
+ ne,
884
+ {
885
+ value: t.gross,
886
+ currency: e.currency,
887
+ fractionDigits: 2
888
+ }
889
+ ) })
890
+ ] }) : null;
891
+ }
892
+ function di({ deps: e }) {
893
+ const t = fe(pe);
894
+ return !t || t.warningLineCount === 0 ? null : /* @__PURE__ */ o("span", { children: e.t("billLineTable.footer.warningLines", {
895
+ count: t.warningLineCount,
896
+ countText: K(t.warningLineCount, e.language),
897
+ defaultValue: "{{countText}} lines with warnings",
898
+ defaultValue_one: "{{countText}} line with warnings",
899
+ defaultValue_other: "{{countText}} lines with warnings"
900
+ }) });
901
+ }
902
+ function mi(e) {
903
+ const { t } = e, i = {
904
+ kind: "number",
905
+ mode: "decimal",
906
+ // The float lives only inside NumberInput: every change goes back to
907
+ // exact text at once, within BILL_LINE_MAX_QUANTITY. Unsigned in the
908
+ // field and in the value: the document carries the sign (D6).
909
+ // A typed value above the limit stays in the field with its error
910
+ // (`quantityError`); an invoiced one is locked by `isEditable`.
911
+ getValue: (n) => {
912
+ const r = A(n.value.quantity).value;
913
+ return r ? Se(r) : null;
914
+ },
915
+ onChange: (n, r) => e.setQuantity(
916
+ n.line.id,
917
+ r === null ? null : On(r)
918
+ ),
919
+ // A quantity the editor cannot hold exactly stays text, never clamped.
920
+ isEditable: (n) => !n.readOnly && !n.quantityLocked,
921
+ min: 0,
922
+ max: ye,
923
+ step: 1,
924
+ maximumFractionDigits: ae,
925
+ // DG-1: FatturaPA UnitaMisura per line, as the supplier wrote it.
926
+ unit: (n) => n.line.unitOfMeasure ?? void 0,
927
+ error: (n) => Zn(n, e),
928
+ // WCAG 3.3.2: the field says how many decimals it takes, since a digit
929
+ // past the limit is refused as it is typed. Kit copy and a constant
930
+ // only, so it shows in privacy mode too (`hostTextPrivacySafe`).
931
+ description: () => t(
932
+ "billLineTable.quantity.precision",
933
+ "Up to {{formatted}} decimal places",
934
+ {
935
+ count: ae,
936
+ formatted: K(
937
+ ae,
938
+ e.language
939
+ )
940
+ }
941
+ )
942
+ };
943
+ return [
944
+ {
945
+ id: "description",
946
+ header: t("billLineTable.column.description", "Description"),
947
+ rowHeader: !0,
948
+ pin: "start",
949
+ wrap: !0,
950
+ // Lab invoices can name a patient here (D9).
951
+ privacy: "mask",
952
+ cell: (n) => /* @__PURE__ */ o("span", { dir: "auto", children: n.line.description }),
953
+ value: (n) => n.line.description,
954
+ // No sorting in any mode (D10); privacy mode would turn it off anyway.
955
+ sort: !1,
956
+ size: 240,
957
+ minSize: 192,
958
+ hideable: !1,
959
+ reorderable: !1,
960
+ // The totals row's header cell.
961
+ footer: () => /* @__PURE__ */ o(si, { deps: e })
962
+ },
963
+ {
964
+ id: "quantity",
965
+ header: e.documentKind === "creditNote" ? t("billLineTable.column.quantityCreditNote", "Quantity to remove") : t("billLineTable.column.quantity", "Quantity"),
966
+ align: "end",
967
+ // Read-only lines (a loaded invoice, the table while loading, or a
968
+ // locked quantity): the unsigned value as text, plus the unit.
969
+ cell: (n) => Jn(n, e.language),
970
+ exportValue: (n) => n.value.quantity,
971
+ edit: i,
972
+ size: 128,
973
+ hideable: !1,
974
+ reorderable: !1
975
+ },
976
+ {
977
+ id: "item",
978
+ header: t("billLineTable.column.item", "Warehouse item"),
979
+ cell: (n) => /* @__PURE__ */ o("span", { dir: "auto", children: It(n, e) }),
980
+ exportValue: (n) => It(n, e) || null,
981
+ edit: {
982
+ kind: "custom",
983
+ render: (n, r) => /* @__PURE__ */ o(oi, { row: n, context: r, deps: e }),
984
+ error: (n) => ei(n, t)
985
+ },
986
+ size: 240,
987
+ minSize: 192,
988
+ hideable: !1,
989
+ reorderable: !1
990
+ },
991
+ {
992
+ id: "match",
993
+ header: t("billLineTable.column.match", "Status"),
994
+ cell: (n) => {
995
+ const r = Xn[n.matchState];
996
+ return /* @__PURE__ */ o(
997
+ Ln,
998
+ {
999
+ size: "sm",
1000
+ variant: r.variant,
1001
+ leading: r.check ? /* @__PURE__ */ o(Nn, {}) : void 0,
1002
+ children: bt(n.matchState, t)
1003
+ }
1004
+ );
1005
+ },
1006
+ exportValue: (n) => bt(n.matchState, t),
1007
+ size: 136,
1008
+ hideable: !1,
1009
+ reorderable: !1
1010
+ },
1011
+ {
1012
+ id: "warnings",
1013
+ header: t("billLineTable.column.warnings", "Warnings"),
1014
+ wrap: !0,
1015
+ // Not masked: a warning must not quote the description
1016
+ // (BillLineWarning.message), so errors stay readable (D9).
1017
+ cell: (n) => li(n, e),
1018
+ exportValue: (n) => n.line.warnings.map((r) => r.message).join("; ") || null,
1019
+ size: 184,
1020
+ hideable: !1,
1021
+ reorderable: !1,
1022
+ footer: () => /* @__PURE__ */ o(di, { deps: e })
1023
+ },
1024
+ {
1025
+ id: "lineTotal",
1026
+ header: t("billLineTable.column.lineTotal", "Amount"),
1027
+ align: "end",
1028
+ cell: (n) => /* @__PURE__ */ o(ne, { value: n.line.lineTotal, currency: e.currency }),
1029
+ exportValue: (n) => n.line.lineTotal,
1030
+ size: 128,
1031
+ hideable: !1,
1032
+ reorderable: !1,
1033
+ // From the summary (exact decimals, ticked lines), not from the
1034
+ // footer context's rows.
1035
+ footer: () => /* @__PURE__ */ o(ui, { deps: e })
1036
+ },
1037
+ {
1038
+ id: "unitPrice",
1039
+ header: t("billLineTable.column.unitPrice", "Unit price"),
1040
+ align: "end",
1041
+ cell: (n) => ti(n, e),
1042
+ exportValue: (n) => n.line.unitPrice,
1043
+ size: 128,
1044
+ hideable: !1,
1045
+ reorderable: !1
1046
+ },
1047
+ {
1048
+ id: "vat",
1049
+ header: t("billLineTable.column.vat", "VAT"),
1050
+ align: "end",
1051
+ cell: (n) => ii(n, e),
1052
+ exportValue: (n) => n.line.vatPercent,
1053
+ size: 88,
1054
+ hideable: !1,
1055
+ reorderable: !1,
1056
+ // VAT of the ticked lines, under the VAT header.
1057
+ footer: () => /* @__PURE__ */ o(ci, { currency: e.currency })
1058
+ },
1059
+ {
1060
+ id: "adjustment",
1061
+ header: t("billLineTable.column.adjustment", "Discount or surcharge"),
1062
+ align: "end",
1063
+ cell: (n) => ni(n, e),
1064
+ exportValue: (n) => n.line.adjustments.map(
1065
+ (r) => `${r.type === "discount" ? "-" : "+"}${r.percent !== null ? `${r.percent}%` : r.amount ?? ""}`
1066
+ ).join(", ") || null,
1067
+ size: 112,
1068
+ hideable: !1,
1069
+ reorderable: !1
1070
+ },
1071
+ {
1072
+ id: "supplierCode",
1073
+ header: t("billLineTable.column.supplierCode", "Supplier code"),
1074
+ cell: (n) => n.line.supplierCode === null ? null : /* @__PURE__ */ o("span", { dir: "ltr", className: qe(), children: n.line.supplierCode }),
1075
+ exportValue: (n) => n.line.supplierCode,
1076
+ size: 112,
1077
+ hideable: !1,
1078
+ reorderable: !1
1079
+ }
1080
+ ];
1081
+ }
1082
+ function fi(e) {
1083
+ return e.map(Qt);
1084
+ }
1085
+ const Tt = {};
1086
+ function ee(e, t) {
1087
+ return new Error(`${e}: ${t}`);
1088
+ }
1089
+ function yi(e, t) {
1090
+ return e.length === t.length && e.every((i, n) => i === t[n]);
1091
+ }
1092
+ function pi(e) {
1093
+ return JSON.stringify(e);
1094
+ }
1095
+ const Li = un(function({
1096
+ lines: t,
1097
+ items: i,
1098
+ selectedItems: n,
1099
+ documentKind: r = "invoice",
1100
+ currency: u = "EUR",
1101
+ gridId: E,
1102
+ caption: T,
1103
+ values: p,
1104
+ defaultValues: g,
1105
+ onValuesChange: N,
1106
+ selection: R,
1107
+ defaultSelection: q,
1108
+ onSelectionChange: V,
1109
+ onSummaryChange: D,
1110
+ onItemQueryChange: B,
1111
+ itemsLoading: j = !1,
1112
+ status: y = "ready",
1113
+ error: v,
1114
+ readOnly: M = !1,
1115
+ privacyMode: G = !1,
1116
+ height: Le = "fill",
1117
+ className: m,
1118
+ ...H
1119
+ }, F) {
1120
+ const { t: f, i18n: he } = mn("ui"), X = he.language, Oe = I(null), ge = M !== !1, Yt = I(/* @__PURE__ */ new Map()), ie = b(() => {
1121
+ const a = Yt.current;
1122
+ for (const c of n ?? []) a.set(c.id, c);
1123
+ for (const c of i) a.set(c.id, c);
1124
+ return new Map(a);
1125
+ }, [i, n]);
1126
+ Pe(() => {
1127
+ pn() && i.some((a) => a.id === le) && console.warn(
1128
+ `[BillLineTable] an item id equals "${le}", the value of the new-item option, so that item cannot be chosen.`
1129
+ );
1130
+ }, [i]);
1131
+ const je = b(() => fi(i), [i]), Ge = b(
1132
+ () => new Set(i.map((a) => a.id)),
1133
+ [i]
1134
+ ), [He, $t] = Te(null), Xe = B !== void 0, zt = b(
1135
+ () => ({
1136
+ itemOptions: je,
1137
+ itemOptionIds: Ge,
1138
+ serverSearch: Xe,
1139
+ itemsLoading: j,
1140
+ searchingLineId: He
1141
+ }),
1142
+ [je, Ge, Xe, j, He]
1143
+ ), Je = p !== void 0, [Wt, jt] = Te(
1144
+ () => g ?? Tt
1145
+ ), x = p ?? Wt, Ae = R !== void 0, [Re, Ze] = Te(
1146
+ () => q ?? Ke(t)
1147
+ ), [et, Gt] = Te(t);
1148
+ if (et !== t && (Gt(t), !Ae && q === void 0)) {
1149
+ const a = new Set(et.map((d) => d.id)), c = Ke(t).filter(
1150
+ (d) => !a.has(d) && !Re.includes(d)
1151
+ );
1152
+ c.length > 0 && Ze([...Re, ...c]);
1153
+ }
1154
+ const S = R ?? Re, U = I(x);
1155
+ U.current = x;
1156
+ const Q = I(S);
1157
+ Q.current = S;
1158
+ const tt = I(null), nt = I(null), ve = b(
1159
+ () => ({
1160
+ values: g ?? Tt,
1161
+ selection: q ?? Ke(t)
1162
+ }),
1163
+ [g, q, t]
1164
+ ), it = I(/* @__PURE__ */ new Map()), Ve = b(() => {
1165
+ const a = Lt({
1166
+ lines: t,
1167
+ values: x,
1168
+ selection: S,
1169
+ findItem: (c) => ie.get(c),
1170
+ previous: it.current
1171
+ });
1172
+ return it.current = new Map(a.map((c) => [c.line.id, c])), a;
1173
+ }, [t, x, S, ie]), Ht = b(
1174
+ () => Ve.filter((a) => a.selected).map((a) => a.line.id),
1175
+ [Ve]
1176
+ ), rt = k(
1177
+ (a) => ie.has(a),
1178
+ [ie]
1179
+ ), ce = b(
1180
+ () => pt(
1181
+ t,
1182
+ x,
1183
+ S,
1184
+ ve,
1185
+ rt
1186
+ ),
1187
+ [t, x, S, ve, rt]
1188
+ ), at = b(
1189
+ () => new Map(t.map((a) => [a.id, a])),
1190
+ [t]
1191
+ ), L = I({
1192
+ lines: t,
1193
+ lineById: at,
1194
+ itemIndex: ie,
1195
+ defaults: ve,
1196
+ documentKind: r,
1197
+ tableReadOnly: ge,
1198
+ valuesControlled: Je,
1199
+ selectionControlled: Ae
1200
+ });
1201
+ L.current = {
1202
+ lines: t,
1203
+ lineById: at,
1204
+ itemIndex: ie,
1205
+ defaults: ve,
1206
+ documentKind: r,
1207
+ tableReadOnly: ge,
1208
+ valuesControlled: Je,
1209
+ selectionControlled: Ae
1210
+ };
1211
+ const ue = I({
1212
+ onValuesChange: N,
1213
+ onSelectionChange: V,
1214
+ onSummaryChange: D,
1215
+ onItemQueryChange: B
1216
+ });
1217
+ ue.current = {
1218
+ onValuesChange: N,
1219
+ onSelectionChange: V,
1220
+ onSummaryChange: D,
1221
+ onItemQueryChange: B
1222
+ };
1223
+ const De = I(/* @__PURE__ */ new Set()), Y = k((a) => {
1224
+ for (const c of [...De.current]) c(a);
1225
+ }, []), J = k(
1226
+ (a, c, d, h) => {
1227
+ var Z, Ie;
1228
+ const C = L.current;
1229
+ if (!C.lineById.has(a)) return;
1230
+ const P = ft(C.lines, U.current), l = P[a], s = { ...l, ...d };
1231
+ if (Rt(l, s)) return;
1232
+ const w = {
1233
+ ...P,
1234
+ [a]: s
1235
+ };
1236
+ U.current = w, tt.current = w, C.valuesControlled || jt(w), (Ie = (Z = ue.current).onValuesChange) == null || Ie.call(Z, w, { lineId: a, field: c, source: h }), Y({ event: "values", source: h });
1237
+ },
1238
+ [Y]
1239
+ ), re = k(
1240
+ (a, c) => {
1241
+ var P, l;
1242
+ const d = L.current, h = $(d.lines, a), C = $(
1243
+ d.lines,
1244
+ Q.current
1245
+ );
1246
+ yi(h, C) || (Q.current = h, nt.current = h, d.selectionControlled || Ze(h), (l = (P = ue.current).onSelectionChange) == null || l.call(P, h), Y({ event: "selection", source: c }));
1247
+ },
1248
+ [Y]
1249
+ ), lt = k(
1250
+ (a, c) => J(a, "quantity", { quantity: c }, "user"),
1251
+ [J]
1252
+ ), ot = k(
1253
+ (a, c) => {
1254
+ const d = L.current.lineById.get(a);
1255
+ d && J(
1256
+ a,
1257
+ "item",
1258
+ { item: Qe(c, d) },
1259
+ "user"
1260
+ );
1261
+ },
1262
+ [J]
1263
+ ), st = k((a, c) => {
1264
+ var d, h;
1265
+ $t(a), (h = (d = ue.current).onItemQueryChange) == null || h.call(d, a, c);
1266
+ }, []), Xt = k(
1267
+ (a) => re(a, "user"),
1268
+ [re]
1269
+ ), ct = I(null);
1270
+ Pe(() => {
1271
+ var c, d;
1272
+ const a = pi(ce);
1273
+ a !== ct.current && (ct.current = a, (d = (c = ue.current).onSummaryChange) == null || d.call(c, ce));
1274
+ }, [ce]);
1275
+ const be = `${y}:${ge ? "readOnly" : "editable"}`, ut = I({
1276
+ lines: t,
1277
+ values: x,
1278
+ selection: S,
1279
+ status: be
1280
+ });
1281
+ Pe(() => {
1282
+ const a = ut.current;
1283
+ (a.lines !== t || a.values !== x && x !== tt.current) && Y({ event: "values", source: "host" }), a.selection !== S && S !== nt.current && Y({ event: "selection", source: "host" }), a.status !== be && Y({ event: "status", source: "host" }), ut.current = {
1284
+ lines: t,
1285
+ values: x,
1286
+ selection: S,
1287
+ status: be
1288
+ };
1289
+ }, [t, x, S, be, Y]);
1290
+ const Be = b(() => {
1291
+ const a = () => {
1292
+ const l = L.current;
1293
+ return Lt({
1294
+ lines: l.lines,
1295
+ values: U.current,
1296
+ selection: Q.current,
1297
+ findItem: (s) => l.itemIndex.get(s)
1298
+ });
1299
+ }, c = (l) => Qn(l, {
1300
+ tableReadOnly: L.current.tableReadOnly,
1301
+ documentKind: L.current.documentKind
1302
+ }), d = (l) => L.current.itemIndex.has(l), h = (l) => {
1303
+ const s = L.current.lineById.get(l);
1304
+ if (!s) throw ee("UNKNOWN_LINE", `no line "${l}".`);
1305
+ return s;
1306
+ }, C = () => {
1307
+ if (L.current.tableReadOnly)
1308
+ throw ee(
1309
+ "TABLE_READ_ONLY",
1310
+ "the table is read-only while the load request runs."
1311
+ );
1312
+ }, P = (l) => {
1313
+ if (te(L.current.lines))
1314
+ throw ee(
1315
+ "LINE_READ_ONLY",
1316
+ `line "${l}" belongs to an invoice that is already loaded.`
1317
+ );
1318
+ };
1319
+ return {
1320
+ getLineIds: () => L.current.lines.map((l) => l.id),
1321
+ getLine: (l) => {
1322
+ const s = L.current, w = s.lineById.get(l);
1323
+ if (!w) return null;
1324
+ const Z = Bt(
1325
+ w,
1326
+ U.current[l] ?? z(w),
1327
+ {
1328
+ invoiceLoaded: te(s.lines),
1329
+ ticked: new Set(
1330
+ $(s.lines, Q.current)
1331
+ ),
1332
+ findItem: (Ie) => s.itemIndex.get(Ie)
1333
+ }
1334
+ );
1335
+ return c(Z);
1336
+ },
1337
+ getLines: () => a().map(c),
1338
+ getSelection: () => $(L.current.lines, Q.current),
1339
+ getValues: () => ft(L.current.lines, U.current),
1340
+ getSummary: () => {
1341
+ const l = L.current;
1342
+ return pt(
1343
+ l.lines,
1344
+ U.current,
1345
+ Q.current,
1346
+ l.defaults,
1347
+ d
1348
+ );
1349
+ },
1350
+ getInvalidLineIds: () => a().filter((l) => l.invalid).map((l) => l.line.id),
1351
+ getLoadPayload: () => {
1352
+ const l = L.current;
1353
+ return Kn(
1354
+ l.lines,
1355
+ U.current,
1356
+ Q.current,
1357
+ l.documentKind,
1358
+ d
1359
+ );
1360
+ },
1361
+ setSelection: (l) => {
1362
+ for (const s of l) h(s);
1363
+ C();
1364
+ for (const s of l) {
1365
+ if (h(s).alreadyLoaded)
1366
+ throw ee(
1367
+ "LINE_READ_ONLY",
1368
+ `line "${s}" is already loaded.`
1369
+ );
1370
+ P(s);
1371
+ }
1372
+ re(l, "api");
1373
+ },
1374
+ selectAll: () => {
1375
+ C(), re(
1376
+ L.current.lines.map((l) => l.id),
1377
+ "api"
1378
+ );
1379
+ },
1380
+ clearSelection: () => {
1381
+ C(), re([], "api");
1382
+ },
1383
+ setQuantity: (l, s) => {
1384
+ const w = h(l), Z = Yn(s);
1385
+ if (Z === null)
1386
+ throw ee(
1387
+ "INVALID_QUANTITY",
1388
+ `"${s}" is not a quantity above 0 and at most ${ye}, with at most ${ae} decimal places.`
1389
+ );
1390
+ if (C(), P(l), !$e(w.quantity))
1391
+ throw ee(
1392
+ "LINE_READ_ONLY",
1393
+ `line "${l}" has a quantity too large to edit; it loads as invoiced.`
1394
+ );
1395
+ J(l, "quantity", { quantity: Z }, "api");
1396
+ },
1397
+ setItem: (l, s) => {
1398
+ const w = h(l);
1399
+ if (s.kind === "existing" && (s.itemId === le || !d(s.itemId)))
1400
+ throw ee("UNKNOWN_ITEM", `no item "${s.itemId}".`);
1401
+ C(), P(l), J(
1402
+ l,
1403
+ "item",
1404
+ { item: Qe(s, w) },
1405
+ "api"
1406
+ );
1407
+ },
1408
+ focusLine: (l, s = "select") => {
1409
+ var w;
1410
+ h(l), (w = Oe.current) == null || w.focusRow(
1411
+ l,
1412
+ s === "select" ? void 0 : s
1413
+ );
1414
+ },
1415
+ scrollToLine: (l) => {
1416
+ var s;
1417
+ h(l), (s = Oe.current) == null || s.scrollToRow(l);
1418
+ },
1419
+ subscribe: (l) => (De.current.add(l), () => {
1420
+ De.current.delete(l);
1421
+ })
1422
+ };
1423
+ }, [re, J]);
1424
+ dn(F, () => Be, [Be]), fn(Sn, Be, E);
1425
+ const Jt = b(
1426
+ () => mi({
1427
+ t: f,
1428
+ language: X,
1429
+ documentKind: r,
1430
+ currency: u,
1431
+ privacyMode: G,
1432
+ setQuantity: lt,
1433
+ setItem: ot,
1434
+ queryItems: st
1435
+ }),
1436
+ [
1437
+ f,
1438
+ X,
1439
+ r,
1440
+ u,
1441
+ G,
1442
+ lt,
1443
+ ot,
1444
+ st
1445
+ ]
1446
+ ), Zt = k((a) => a.line.id, []), en = k((a) => a.readOnly, []), tn = k(
1447
+ (a) => f("billLineTable.rowLabel", {
1448
+ number: K(a.line.lineNumber, X),
1449
+ defaultValue: "Line {{number}}"
1450
+ }),
1451
+ [f, X]
1452
+ ), nn = k(
1453
+ (a) => a.line.alreadyLoaded ? {
1454
+ state: "none",
1455
+ reason: f(
1456
+ "billLineTable.selection.alreadyLoadedReason",
1457
+ "Already loaded into the warehouse"
1458
+ )
1459
+ } : a.readOnly ? {
1460
+ state: "none",
1461
+ reason: f(
1462
+ "billLineTable.selection.invoiceLoadedReason",
1463
+ "This invoice was already loaded. Lines left out then cannot be loaded later."
1464
+ )
1465
+ } : "selectable",
1466
+ [f]
1467
+ ), rn = ce.invoiceLoaded, Me = ge ? typeof M == "object" && M.reason !== "" && !G ? M.reason : f(
1468
+ "billLineTable.selection.readOnlyReason",
1469
+ "Loading into the warehouse"
1470
+ ) : rn ? f(
1471
+ "billLineTable.selection.invoiceLoadedReason",
1472
+ "This invoice was already loaded. Lines left out then cannot be loaded later."
1473
+ ) : null, an = b(
1474
+ () => Me === null ? !1 : { reason: Me },
1475
+ [Me]
1476
+ ), ln = b(
1477
+ () => ({
1478
+ title: (v == null ? void 0 : v.title) ?? f("billLineTable.error.title", "The invoice lines could not be read"),
1479
+ description: (v == null ? void 0 : v.description) ?? f(
1480
+ "billLineTable.error.description",
1481
+ "Try again. If it keeps failing, open the invoice to check it."
1482
+ ),
1483
+ onRetry: v == null ? void 0 : v.onRetry
1484
+ }),
1485
+ [v, f]
1486
+ ), on = b(
1487
+ () => ({
1488
+ title: f(
1489
+ "billLineTable.empty.title",
1490
+ "This invoice has no lines to load"
1491
+ ),
1492
+ description: f(
1493
+ "billLineTable.empty.description",
1494
+ "Open the invoice to check what the supplier sent."
1495
+ )
1496
+ }),
1497
+ [f]
1498
+ ), sn = T ?? (r === "creditNote" ? f("billLineTable.captionCreditNote", "Credit note lines") : f("billLineTable.caption", "Invoice lines"));
1499
+ return /* @__PURE__ */ o(
1500
+ "div",
1501
+ {
1502
+ ...H,
1503
+ "data-component": "bill-line-table",
1504
+ "data-component-id": E,
1505
+ className: $n({ height: Le, className: m }),
1506
+ children: /* @__PURE__ */ o(Ft.Provider, { value: zt, children: /* @__PURE__ */ o(pe.Provider, { value: ce, children: /* @__PURE__ */ o(
1507
+ yn,
1508
+ {
1509
+ ref: Oe,
1510
+ caption: sn,
1511
+ columns: Jt,
1512
+ rows: Ve,
1513
+ getRowId: Zt,
1514
+ registerAgent: !1,
1515
+ persistColumnState: !1,
1516
+ dataMode: "client",
1517
+ selectionMode: "multiple",
1518
+ rowSelection: Ht,
1519
+ onRowSelectionChange: Xt,
1520
+ getRowSelectability: nn,
1521
+ selectAllScope: "all",
1522
+ rangeSelection: !0,
1523
+ isRowReadOnly: en,
1524
+ readOnly: an,
1525
+ getRowLabel: tn,
1526
+ rowLabelPrivacySafe: !0,
1527
+ hostTextPrivacySafe: !0,
1528
+ multiSort: !1,
1529
+ columnResizing: !1,
1530
+ responsiveColumns: !1,
1531
+ status: y,
1532
+ error: ln,
1533
+ empty: on,
1534
+ density: "default",
1535
+ height: Le,
1536
+ virtualization: "auto",
1537
+ privacyMode: G
1538
+ }
1539
+ ) }) })
1540
+ }
1541
+ );
1542
+ });
1543
+ Li.displayName = "BillLineTable";
1544
+ export {
1545
+ mt as B,
1546
+ ye as a,
1547
+ le as b,
1548
+ Cn as c,
1549
+ _t as d,
1550
+ ae as e,
1551
+ Et as f,
1552
+ Li as g,
1553
+ Sn as h,
1554
+ Kn as i,
1555
+ Mn as j,
1556
+ Ke as k,
1557
+ z as l,
1558
+ Vi as m,
1559
+ te as n,
1560
+ ze as o,
1561
+ $e as p,
1562
+ An as q,
1563
+ pt as s
1564
+ };
1565
+ //# sourceMappingURL=bill-line-table-vCnVo7_a.js.map