@feedmepos/mf-inventory-portal 1.8.0-dev.2 → 1.8.0-dev.21

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 (248) hide show
  1. package/dist/App-BxpqrT2x.js +1445 -0
  2. package/dist/{ApprovalView-RaXuWWSu.js → ApprovalView-DZBM9n1Y.js} +26 -25
  3. package/dist/{BindingsDialog-DomvXijP.js → BindingsDialog-jjHrmqY_.js} +2 -2
  4. package/dist/{BindingsPicker-DGnzxEs7.js → BindingsPicker-Dv1KwHIQ.js} +2 -2
  5. package/dist/{BindingsTable-DfG9kWrv.js → BindingsTable-Ch_TlrZu.js} +10 -10
  6. package/dist/BulkReceiveRequestPage-BVB3PNxF.js +2839 -0
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CVekIoiN.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DpHYhOmI.js} +1 -1
  8. package/dist/{ClosingDraftView-C3n66bbh.js → ClosingDraftView-DQQkWYOh.js} +748 -746
  9. package/dist/ClosingHistoryView-CXXd0Csp.js +769 -0
  10. package/dist/{ClosingTemplateView-DwGloYxn.js → ClosingTemplateView-Bf5Ivxjw.js} +22 -21
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-9eY_r8LF.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-C3Y_rwNE.js} +1 -1
  12. package/dist/{DefaultView-JC_e4xgC.js → DefaultView-Bt8ZFV10.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-BBCvI67S.js → DeliveryOrderPrintPreview-BS5ZKe1f.js} +15 -15
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-H4FWc9ga.js → EmailDialog.vue_vue_type_script_setup_true_lang-BvDFKrFF.js} +10077 -9950
  15. package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-B389iY-f.js +48 -0
  16. package/dist/FeatureCapabilityGate-BAOroN-j.js +82 -0
  17. package/dist/FeaturePageGate.vue_vue_type_script_setup_true_lang-Xapa8xyy.js +189 -0
  18. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Q8Mptiv3.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CgbvPK8u.js} +1 -1
  19. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CE1_yyHe.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DnCj1qv6.js} +2 -2
  20. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CGJi3f86.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CUb4VGOc.js} +2 -2
  21. package/dist/{FmMultiselectDialog-DCaRlBIy.js → FmMultiselectDialog-Bz8bNuK2.js} +2 -2
  22. package/dist/FmMultiselectDialog-CosTDuNE.js +123 -0
  23. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-ClaLVtpK.js → FmUnitInput.vue_vue_type_script_setup_true_lang-3OrHiybe.js} +105 -99
  24. package/dist/ImportView-BoTmcCyn.js +1540 -0
  25. package/dist/{IngredientsView-DPj9lBTK.js → IngredientsView-VED94pGW.js} +691 -689
  26. package/dist/{IntegrationExplorerView-CO2wpUR_.js → IntegrationExplorerView-B9ZY9hG1.js} +1537 -1620
  27. package/dist/IntegrationPlatformView-Bar1zj3R.js +13385 -0
  28. package/dist/{IntegrationView-DIeZoey0.js → IntegrationView-BvzBDBGp.js} +2604 -2565
  29. package/dist/{InventoryBindingForm-Cj4_Chue.js → InventoryBindingForm-DWhXHIaL.js} +1 -1
  30. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-mZRrPywY.js +472 -0
  31. package/dist/{InventoryBindingSummary-yzGzd7jJ.js → InventoryBindingSummary-Imo2J8O2.js} +1 -1
  32. package/dist/JsonViewer.vue_vue_type_script_setup_true_lang-C_hg75l0.js +25 -0
  33. package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CChCnKxa.js +79 -0
  34. package/dist/PlanTierBadge.vue_vue_type_script_setup_true_lang-CM3gtYZo.js +19 -0
  35. package/dist/PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-0F-yOcPC.js +79 -0
  36. package/dist/PremiumUpgradePage.vue_vue_type_script_setup_true_lang-DGAxPOEh.js +58 -0
  37. package/dist/ProductionRunDetailPage-KFKeWhhY.js +2317 -0
  38. package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BYyiiAWb.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-CobaPkUr.js} +3053 -3163
  39. package/dist/ProductionRunPage-BrXsPo-A.js +954 -0
  40. package/dist/{PublishView-CPK9NeVF.js → PublishView-_k3N44Pl.js} +3 -3
  41. package/dist/{PurchaseOrderPrintPreview-DosqWQeN.js → PurchaseOrderPrintPreview-DXVEhy-G.js} +17 -17
  42. package/dist/{ReceiveRequestView-BxSkpK2t.js → ReceiveRequestView-ByWddqiL.js} +17 -16
  43. package/dist/RecipeView-C29uNZxj.js +3272 -0
  44. package/dist/SettingsView-CyE6ZM8x.js +1005 -0
  45. package/dist/StockView-BBR404Ie.js +3003 -0
  46. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-GdGJCuc0.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cmnk66T9.js} +1 -1
  47. package/dist/{SupplierView-BKxKoi_0.js → SupplierView-CIB5GCwp.js} +304 -301
  48. package/dist/{SurchargeView-Db4cwhZv.js → SurchargeView-DNtEbO7I.js} +7 -7
  49. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CpkF77Ow.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-ClCi5rLI.js} +2 -2
  50. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-gJQQKKAC.js +71 -0
  51. package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-C19KOLrQ.js +332 -0
  52. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DD5nMsrn.js +4953 -0
  53. package/dist/TransferTemplateView-BftwH1_W.js +2347 -0
  54. package/dist/{UnitCostHistoryView-CqcyjCCd.js → UnitCostHistoryView-CE-1joTV.js} +4 -4
  55. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DO80_8SZ.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-reJFavQF.js} +4 -4
  56. package/dist/{UnitView-BqdK1AM_.js → UnitView-T-Vo8IpV.js} +111 -106
  57. package/dist/{WarehouseView-COJM9IXM.js → WarehouseView-CzQcj5VY.js} +12 -11
  58. package/dist/{WastageTemplateView-DW3viTHN.js → WastageTemplateView-Cm5_V2zN.js} +19 -18
  59. package/dist/api/bill.d.ts +4 -2
  60. package/dist/api/bill.spec.d.ts +1 -0
  61. package/dist/api/closing.d.ts +1 -0
  62. package/dist/api/feature-flags.d.ts +4 -0
  63. package/dist/api/integration-sync-log.d.ts +0 -13
  64. package/dist/api/license.d.ts +0 -2
  65. package/dist/api/netsuite-explorer.d.ts +1 -0
  66. package/dist/api/stock.d.ts +1 -1
  67. package/dist/{app-yvK__CBL.js → app-DnOtng5V.js} +10177 -10126
  68. package/dist/app.d.ts +151 -164
  69. package/dist/app.js +1 -1
  70. package/dist/bulk-edit-simulation.helper-BZRyNbpM.js +178 -0
  71. package/dist/{closing-template-DezidSM0.js → closing-template-BiJRchG9.js} +4 -4
  72. package/dist/components/FeatureCapabilityBadge.vue.d.ts +4 -0
  73. package/dist/components/FeatureCapabilityGate.spec.d.ts +1 -0
  74. package/dist/components/FeatureCapabilityGate.vue.d.ts +5 -0
  75. package/dist/components/FeatureGateLayout.vue.d.ts +11 -0
  76. package/dist/components/FeaturePageGate.spec.d.ts +1 -0
  77. package/dist/components/FeaturePageGate.vue.d.ts +34 -0
  78. package/dist/components/FmAdminCollapsiblePanel.vue.d.ts +1 -1
  79. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  80. package/dist/components/FmInventoryTableToolbar.vue.d.ts +2 -2
  81. package/dist/components/FmUnitInputProps.d.ts +1 -0
  82. package/dist/components/FmUnitInputRules.d.ts +1 -1
  83. package/dist/components/HrmPermissionGuard.vue.d.ts +1 -1
  84. package/dist/components/NumberPrecisionInput.spec.d.ts +1 -0
  85. package/dist/{views/ingredient-group/IngredientGroupView.vue.d.ts → components/PremiumUpgradePage.vue.d.ts} +0 -1
  86. package/dist/components/TemplatePublishDialog.d.ts +2 -0
  87. package/dist/components/TemplatePublishDialog.spec.d.ts +1 -0
  88. package/dist/composable/defineApi.d.ts +1 -1
  89. package/dist/{date2-2XjepIqc.js → date2-Bzlk0lSj.js} +1 -1
  90. package/dist/{dayjs.min-CNp5DLBB.js → dayjs.min-B8gqMYa7.js} +1 -1
  91. package/dist/{decimal-Z7oJdGk8.js → decimal-utE08Cjv.js} +2 -2
  92. package/dist/{defineDeepModel-CMxJn_H2.js → defineDeepModel-D_tKNP-n.js} +5 -5
  93. package/dist/{duplicate-template-BetV5oy_.js → duplicate-template-lCi99jVD.js} +1 -1
  94. package/dist/{feature-CkWaZ-5K.js → feature-Zeyz4pJe.js} +2089 -2854
  95. package/dist/feature-flags/core.d.ts +4 -2
  96. package/dist/feature-flags/portal-feature-catalog.d.ts +1 -6
  97. package/dist/feature-flags/portal-feature-catalog.spec.d.ts +1 -0
  98. package/dist/feature-flags/vue.d.ts +24 -1
  99. package/dist/feature-flags/vue.spec.d.ts +1 -0
  100. package/dist/{format-time-from-id-DatSI9uD.js → format-time-from-id-v_KvI4jM.js} +1 -1
  101. package/dist/{format-unit-display-DM5We5cx.js → format-unit-display-C8oexlpM.js} +209 -208
  102. package/dist/helper/country.spec.d.ts +1 -0
  103. package/dist/helper/menu-usage-module.d.ts +2 -1
  104. package/dist/helper/number.d.ts +5 -1
  105. package/dist/helper/rules.d.ts +1 -1
  106. package/dist/{id-to-date-Dxw2jKhy.js → id-to-date-Doi1vn9Q.js} +1 -1
  107. package/dist/{import-export.helper-BOmADwUw.js → import-export.helper-DyRPa4wa.js} +17 -17
  108. package/dist/{index-CIH9NCvs.js → index-B-SVjo8N.js} +1 -1
  109. package/dist/{index-ClYgfwW7.js → index-Bl8qrC1m.js} +2234 -2163
  110. package/dist/{JsonViewer.vue_vue_type_script_setup_true_lang-ig2zSXAB.js → index-C25C1Dg7.js} +1074 -1066
  111. package/dist/{index-7fz5sGDO.js → index-DZ9i-1uy.js} +3 -3
  112. package/dist/index-eGvSlWMU.js +1892 -0
  113. package/dist/layout/SingleColumnLayout.vue.d.ts +1 -1
  114. package/dist/{lz-string-CCsc2X7t.js → lz-string-pPNhTzCj.js} +1 -1
  115. package/dist/menu-usage-module-Bq_KLsO4.js +74 -0
  116. package/dist/{netsuite-COumFXC2.js → netsuite-C5s0JXRA.js} +254 -263
  117. package/dist/netsuite-explorer-BF-bujxD.js +79 -0
  118. package/dist/{predefined-templates-Bw9A9LNA.js → predefined-templates-C6hmqqhm.js} +1 -1
  119. package/dist/production-run-list-DR1WsaBR.js +61 -0
  120. package/dist/{purchase-order-template-BaZjdGq8.js → purchase-order-template-C0XlITpK.js} +1 -1
  121. package/dist/{recalculationUtils-t32wAurN.js → recalculationUtils-CnzCEyIJ.js} +1 -1
  122. package/dist/router/name.d.ts +2 -2
  123. package/dist/{row-action.enum-BDeudY4d.js → row-action.enum-Ci5mHFdS.js} +1 -1
  124. package/dist/rules-rAD4INHX.js +243 -0
  125. package/dist/{stock-B59sfN28.js → stock-CukGlv0u.js} +1 -1
  126. package/dist/stock-DUQYl3xe.js +78 -0
  127. package/dist/stores/feature.d.ts +41 -11
  128. package/dist/stores/feature.load-state.spec.d.ts +1 -0
  129. package/dist/stores/inventory.d.ts +0 -47
  130. package/dist/stores/inventory.no-location.spec.d.ts +1 -0
  131. package/dist/stores/supplier.d.ts +1 -1
  132. package/dist/stores/warehouse.d.ts +1 -1
  133. package/dist/style.css +1 -1
  134. package/dist/{supplier-DnbLJ_cS.js → supplier-CDPdi2B5.js} +2 -2
  135. package/dist/{surcharge-C1uE3uQa.js → surcharge-XABFccMt.js} +1 -1
  136. package/dist/tsconfig.app.tsbuildinfo +1 -1
  137. package/dist/{uom-rules-DjfyrFHJ.js → uom-rules-BbNTM-Xw.js} +1 -1
  138. package/dist/{use-ingredient-select-dialog-7A7fWyEH.js → use-ingredient-select-dialog-CxrFXfoM.js} +2 -2
  139. package/dist/use-inventory-binding-dialog-BZpguHE1.js +113 -0
  140. package/dist/{use-template-enabled-locations-C-Hqqgzt.js → use-template-enabled-locations-B9n-uc36.js} +2 -2
  141. package/dist/{use-transfer-locations-CqsXvOI2.js → use-transfer-locations-z78M6XgR.js} +14 -14
  142. package/dist/{useHrmPermission-BzwD3Ctc.js → useHrmPermission-CfMWeFGZ.js} +1 -1
  143. package/dist/{useNavigationMenu-PrZg9HS7.js → useNavigationMenu-B6dCSflb.js} +111 -117
  144. package/dist/{useSseClient-FCyLWq8k.js → useSseClient-ICUObHUB.js} +1 -1
  145. package/dist/views/changelog/composables/use-snapshot-diff.d.ts +2 -2
  146. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +1 -1
  147. package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +1 -1
  148. package/dist/views/import/helper/submit-rows.d.ts +1 -1
  149. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -1
  150. package/dist/views/ingredients/components/inventory-binding/composables/use-inventory-binding-dialog.d.ts +0 -1
  151. package/dist/views/ingredients/components/inventory-binding/recipe-amount-validation.spec.d.ts +1 -0
  152. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -1
  153. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -1
  154. package/dist/views/ingredients/helper/is-linked-ingredient-error.d.ts +3 -1
  155. package/dist/views/{ingredient-group/components/ingredient-group-rule-field/IngredientGroupRuleField.vue.d.ts → integration/IntegrationPlatformView.vue.d.ts} +11 -24
  156. package/dist/views/integration/components/Synergy/importFn.spec.d.ts +1 -0
  157. package/dist/views/integration/components/Xilnex/importFn.spec.d.ts +1 -0
  158. package/dist/views/integration/helper/opening-balance.d.ts +22 -0
  159. package/dist/views/integration/helper/opening-balance.spec.d.ts +1 -0
  160. package/dist/views/production-run/ProductionRunDetailPage.spec.d.ts +1 -0
  161. package/dist/views/{integration/components/IntegrationSyncLogTab.vue.d.ts → production-run/ProductionRunDetailPage.vue.d.ts} +2 -2
  162. package/dist/views/production-run/ProductionRunPage.vue.d.ts +2 -0
  163. package/dist/views/production-run/features/detail/ProductionRunItemsTable.vue.d.ts +2 -2
  164. package/dist/views/production-run/features/detail/ProductionRunOverviewTab.vue.d.ts +4 -4
  165. package/dist/views/production-run/features/detail/use-production-run-detail.d.ts +19 -9
  166. package/dist/views/production-run/features/lifecycle/CancelRunDialog.vue.d.ts +4 -4
  167. package/dist/views/production-run/features/lifecycle/CloseRunDialog.vue.d.ts +4 -4
  168. package/dist/views/production-run/features/lifecycle/ProductionRunLifecycleDialogs.vue.d.ts +14 -14
  169. package/dist/views/production-run/features/lifecycle/TargetReachedDialog.vue.d.ts +4 -4
  170. package/dist/views/production-run/features/planning/ProductionRunFormDialog.vue.d.ts +4 -4
  171. package/dist/views/production-run/features/planning/ProductionRunPlanner.vue.d.ts +1 -1
  172. package/dist/views/production-run/features/planning/use-production-run-duplicate-sources.d.ts +6 -6
  173. package/dist/views/production-run/shared/helpers/production-run-navigation.d.ts +0 -1
  174. package/dist/views/production-run/shared/model/production-run-list.d.ts +1 -1
  175. package/dist/views/production-run/shared/ui/ProductionRunInfoBadge.vue.d.ts +1 -1
  176. package/dist/views/production-run/shared/ui/ProductionRunInfoText.vue.d.ts +1 -1
  177. package/dist/views/production-run/shared/ui/ProductionRunScrollHint.vue.d.ts +2 -2
  178. package/dist/views/production-run/shared/ui/ProductionRunTextarea.vue.d.ts +3 -3
  179. package/dist/views/receive-request/composables/netsuite-order-label.d.ts +11 -0
  180. package/dist/views/receive-request/composables/netsuite-order-label.spec.d.ts +1 -0
  181. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +1 -1
  182. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +9 -9
  183. package/dist/views/receive-request/composables/use-receive-request-form.spec.d.ts +1 -0
  184. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +7 -7
  185. package/dist/views/receive-request/import/export.spec.d.ts +1 -0
  186. package/dist/views/receive-request-bulk/BulkReceiveRequestPage.vue.d.ts +2 -0
  187. package/dist/views/receive-request-bulk/components/CreateTransferWizard.spec.d.ts +1 -0
  188. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +20 -20
  189. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.readiness.spec.d.ts +1 -0
  190. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +2 -2
  191. package/dist/views/recipe/components/recipe-bulk-editor/components/ModificationCard.spec.d.ts +1 -0
  192. package/dist/views/recipe/helper/bulk-edit-simulation.helper.d.ts +0 -1
  193. package/dist/views/recipe/helper/import-recipe.d.ts +32 -2
  194. package/dist/views/recipe/helper/import-recipe.spec.d.ts +1 -0
  195. package/dist/views/settings/PlanLicenseDisplay.spec.d.ts +1 -0
  196. package/dist/views/settings/PlanLicenseDisplay.vue.d.ts +2 -0
  197. package/dist/views/stock/components/StockRecordCard.spec.d.ts +1 -0
  198. package/dist/views/stock/components/StockRecordCard.vue.d.ts +19 -865
  199. package/dist/views/stock/components/dialog/AmendAdjustmentForm.spec.d.ts +1 -0
  200. package/dist/views/stock/components/dialog/BillInventoryInfoDialog.spec.d.ts +1 -0
  201. package/dist/views/stock/components/dialog/BillInventoryInfoDialog.vue.d.ts +36 -0
  202. package/dist/views/stock/components/dialog/ConvertSkuDialog.spec.d.ts +1 -0
  203. package/dist/views/stock/composables/use-last-closing-summary.d.ts +4 -0
  204. package/dist/views/stock/composables/use-last-closing-summary.spec.d.ts +1 -0
  205. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.spec.d.ts +1 -0
  206. package/dist/views/transfer-template/helpers/template-item.error.helper.spec.d.ts +1 -0
  207. package/dist/views/unit/composables/use-unit-form.spec.d.ts +1 -0
  208. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +2 -2
  209. package/dist/vue-DBxqzbt5.js +295 -0
  210. package/dist/{vue-i18n-C34f-Tph.js → vue-i18n-CdbY8MsR.js} +539 -539
  211. package/dist/{xlsx.util-X4amwe_k.js → xlsx.util-CD5NablT.js} +2 -2
  212. package/package.json +71 -66
  213. package/dist/App-DVHgBTHP.js +0 -1499
  214. package/dist/BulkReceiveRequestView-DxHWrfbi.js +0 -2656
  215. package/dist/ClosingHistoryView-kdpYGy1Y.js +0 -761
  216. package/dist/DeprecateSoonWarningDialog.vue_vue_type_script_setup_true_lang-5Cc08Svt.js +0 -58
  217. package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-C1C8aDA6.js +0 -61
  218. package/dist/FmMultiselectDialog-yVPY5aBV.js +0 -77
  219. package/dist/ImportView-DQrVMzxN.js +0 -1302
  220. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-7lT5UZc8.js +0 -51
  221. package/dist/IngredientGroupView-BMUnEaY7.js +0 -1000
  222. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CaBOK7NC.js +0 -563
  223. package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DzzTPdyF.js +0 -72
  224. package/dist/ProductionRunDetailView-Cw-ecaey.js +0 -2312
  225. package/dist/ProductionRunView-C11eseXQ.js +0 -930
  226. package/dist/RecipeView-oHDWsT0P.js +0 -3624
  227. package/dist/SettingsView-QlUNwFhM.js +0 -983
  228. package/dist/StockView-a8LbVZ_7.js +0 -2614
  229. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js +0 -84
  230. package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CCCj4WVF.js +0 -299
  231. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CFNPXqt5.js +0 -4796
  232. package/dist/TransferTemplateView-CzwxOBMQ.js +0 -2326
  233. package/dist/menu-usage-module-BdjYEk3s.js +0 -57
  234. package/dist/number-gSLvxNqA.js +0 -138
  235. package/dist/portal-feature-catalog-yGIESKTc.js +0 -246
  236. package/dist/random-CSbEbElR.js +0 -10
  237. package/dist/rules-C1btu0Md.js +0 -98
  238. package/dist/stock-BF86TMW0.js +0 -75
  239. package/dist/use-inventory-binding-dialog-Cc1tjTfV.js +0 -152
  240. package/dist/usePromise-CbVUCxhj.js +0 -29
  241. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +0 -31
  242. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +0 -10
  243. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +0 -21
  244. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +0 -12
  245. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +0 -24
  246. package/dist/views/ingredient-group/composables/use-ingredient-group-rule-item.d.ts +0 -31
  247. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +0 -77
  248. package/dist/views/integration/composables/use-integration-sync-log.d.ts +0 -45
@@ -0,0 +1,1445 @@
1
+ import { ref as x, onUnmounted as mt, computed as V, defineComponent as ue, watch as Z, onMounted as Ie, resolveComponent as W, createElementBlock as m, openBlock as i, createBlock as ie, createCommentVNode as E, unref as D, createVNode as I, createElementVNode as w, toDisplayString as b, Fragment as J, renderList as oe, withKeys as Me, normalizeClass as ae, withModifiers as pt, withCtx as le, createTextVNode as ve, h as vt, onBeforeUnmount as gt, nextTick as yt, Teleport as ht, normalizeStyle as _t, mergeModels as Ue, useModel as bt } from "vue";
2
+ import { _ as xt } from "./empty-placeholder-B0QU467o.js";
3
+ import { _ as wt } from "./PremiumUpgradePage.vue_vue_type_script_setup_true_lang-DGAxPOEh.js";
4
+ import { u as He, a as Je, R as me, d as kt, S as St, b as $t } from "./app-DnOtng5V.js";
5
+ import { useCoreStore as ge, useI18n as he } from "@feedmepos/mf-common";
6
+ import { useRouter as Ne, useRoute as Ct } from "vue-router";
7
+ import { u as Lt } from "./feature-Zeyz4pJe.js";
8
+ import { u as Rt } from "./netsuite-C5s0JXRA.js";
9
+ import { u as Ye, n as Dt, e as Vt } from "./useNavigationMenu-B6dCSflb.js";
10
+ import { useBreakpoints as It } from "@feedmepos/ui-library";
11
+ import { F as We } from "./FmAdminBadge-DlplQOHb.js";
12
+ import { i as Nt, _ as Et } from "./FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CgbvPK8u.js";
13
+ import { F as Tt } from "./decimal-utE08Cjv.js";
14
+ import { t as Pt, a as Bt } from "./date2-Bzlk0lSj.js";
15
+ import { _ as Ft } from "./_plugin-vue_export-helper-CHgC5LLL.js";
16
+ import { u as At } from "./useTabStorage-BkIVScW_.js";
17
+ import { _ as Mt } from "./PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-0F-yOcPC.js";
18
+ import { D as Ut } from "./FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-B389iY-f.js";
19
+ import { u as Ot, g as Oe } from "./vue-DBxqzbt5.js";
20
+ import { u as Kt } from "./googlemap-D9vA7GsS.js";
21
+ function zt() {
22
+ return {
23
+ loadingHookInstalled: !1,
24
+ isLoading: !1
25
+ };
26
+ }
27
+ const fe = x(zt());
28
+ function jt() {
29
+ const o = Ne();
30
+ if (!fe.value.loadingHookInstalled) {
31
+ fe.value.loadingHookInstalled = !0;
32
+ const e = o.beforeEach(() => {
33
+ fe.value.isLoading = !0;
34
+ }), t = o.afterEach(() => {
35
+ fe.value.isLoading = !1;
36
+ });
37
+ mt(() => {
38
+ fe.value.loadingHookInstalled = !1, e(), t();
39
+ });
40
+ }
41
+ return {
42
+ get isLoading() {
43
+ return fe.value.isLoading;
44
+ }
45
+ };
46
+ }
47
+ function Gt() {
48
+ const { firstAccessibleRouteName: o } = Ye();
49
+ return { hasAnyAccessibleInventoryRoute: V(() => o.value !== null) };
50
+ }
51
+ const Ht = {
52
+ key: 0,
53
+ class: "flex flex-col items-center w-full h-full gap-24"
54
+ }, Jt = {
55
+ key: 1,
56
+ class: "flex flex-col pt-[200px] gap-32 items-center"
57
+ }, Yt = { class: "flex flex-col gap-12 items-center text-center px-24 max-w-[600px]" }, Wt = { class: "fm-typo-en-title-lg-600" }, Xt = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, qt = /* @__PURE__ */ ue({
58
+ __name: "InventoryView",
59
+ setup(o) {
60
+ const e = He(), t = Je(), l = Rt(), s = ge(), a = Ne(), r = jt(), u = Lt(), { t: v } = he(), { hasAnyAccessibleInventoryRoute: p } = Gt();
61
+ Z(
62
+ [() => s.sessionUser.value, () => s.currentBusiness.value],
63
+ ([U, $]) => {
64
+ L(U, $);
65
+ }
66
+ ), Ie(async () => {
67
+ await u.init(), await s.readBusinesses();
68
+ const U = s.sessionUser.value, $ = s.currentBusiness.value;
69
+ L(U, $);
70
+ });
71
+ function L(U, $) {
72
+ !U || !$ || F();
73
+ }
74
+ async function F() {
75
+ return await e.init(), await l.readSetting().catch((U) => {
76
+ console.error("[all] error on reading netsuite store", U);
77
+ }), await t.init();
78
+ }
79
+ const B = V(() => a.currentRoute.value.name === me.TRANSFER_TEMPLATE ? u.enablePoTemplate : !0), K = V(
80
+ () => a.currentRoute.value.matched.some((U) => {
81
+ var C;
82
+ const $ = U.meta, G = $ == null ? void 0 : $.validationManifest;
83
+ return (((C = G == null ? void 0 : G.requiredCaslPermissions) == null ? void 0 : C.length) ?? 0) > 0;
84
+ })
85
+ ), Q = V(() => {
86
+ if (!s.sessionUser.value) return !1;
87
+ if (e._locations !== null && e.locations.length === 0) return !0;
88
+ if (!u.isLoaded) return !1;
89
+ const G = a.currentRoute.value.name === me.LOADING;
90
+ return !p.value && (G || K.value);
91
+ });
92
+ return (U, $) => {
93
+ const G = W("FmSpacer"), C = W("FmCircularProgress"), y = W("RouterView");
94
+ return i(), m("div", null, [
95
+ D(r).isLoading ? (i(), m("div", Ht, [
96
+ I(G),
97
+ w("div", null, [
98
+ I(C, { size: "xl" })
99
+ ]),
100
+ $[0] || ($[0] = w("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary pl-8" }, "Loading page...", -1)),
101
+ I(G)
102
+ ])) : Q.value ? (i(), m("div", Jt, [
103
+ $[1] || ($[1] = w("img", {
104
+ src: xt,
105
+ alt: "No permission",
106
+ class: "w-[200px] h-[200px]"
107
+ }, null, -1)),
108
+ w("div", Yt, [
109
+ w("div", Wt, b(D(v)("inventory.common.noPermission.title")), 1),
110
+ w("div", Xt, b(D(v)("inventory.common.noPermission.description")), 1)
111
+ ])
112
+ ])) : B.value ? D(s).sessionUser.value ? (i(), ie(y, { key: 3 })) : E("", !0) : (i(), ie(wt, { key: 2 }))
113
+ ]);
114
+ };
115
+ }
116
+ }), Le = {
117
+ // Template/PO item rows carry no id of their own — the embedded sku's _id is
118
+ // the element identity, and kit names the element from that object's name
119
+ // field, so an item change reads "Items › <sku name> › …" instead of a bare
120
+ // index. Arrays where the key isn't usable (an element without sku._id, or
121
+ // duplicates) fall back to identity_fields, then positional — unchanged.
122
+ array_keys: { items: "sku._id" },
123
+ identity_fields: ["_id", "id"],
124
+ name_fields: ["name", "code"],
125
+ ignored_fields: [
126
+ "_id",
127
+ "_rev",
128
+ "_deleted",
129
+ "__v",
130
+ "updatedAt",
131
+ "createdAt",
132
+ "updatedBy",
133
+ "createdBy"
134
+ ],
135
+ label_keys: {
136
+ prefix: "inventory.changelog.label.",
137
+ fields: [
138
+ "abbrev",
139
+ "alternatives",
140
+ "amount",
141
+ "code",
142
+ "contains",
143
+ "conversion",
144
+ "convert",
145
+ "costPerUnit",
146
+ "customAttributes",
147
+ "default",
148
+ "defaultCost",
149
+ "defaultRemark",
150
+ "disabledMeasurements",
151
+ "groups",
152
+ "inventoryBindings",
153
+ "isInactive",
154
+ "items",
155
+ "locations",
156
+ "low",
157
+ "measurement",
158
+ "measurements",
159
+ "mid",
160
+ "name",
161
+ "operationalGroup",
162
+ "position",
163
+ "precision",
164
+ "priority",
165
+ "recipe",
166
+ "ref",
167
+ "rules",
168
+ "sku",
169
+ "skuId",
170
+ "thresholds",
171
+ "trackingMeasurement",
172
+ "type",
173
+ "unit",
174
+ "valuation",
175
+ "version"
176
+ ]
177
+ }
178
+ }, Re = {
179
+ ...Le,
180
+ array_keys: {
181
+ measurements: "id",
182
+ "unit.measurements": "id",
183
+ "convert.inventoryBindings": "id",
184
+ "convert.inventoryBindings.alternatives": "_id",
185
+ contains: "id",
186
+ "contains.alternatives": "_id"
187
+ }
188
+ };
189
+ function Zt(o) {
190
+ return o instanceof St && o.errorResponse.statusCode === 409;
191
+ }
192
+ const _e = kt((o, e) => ({
193
+ /**
194
+ * Commits for one record. recordId is the changelog docId, `${dbName}/${id}`.
195
+ * The dbName scopes the (access-checked) backend route; only the bare id is
196
+ * sent — the backend rebuilds the docId server-side.
197
+ */
198
+ async getRecordChangelog(t, l, s, a) {
199
+ const r = t.indexOf("/");
200
+ if (r < 0) return [];
201
+ const u = t.slice(0, r), v = t.slice(r + 1), p = new URLSearchParams({ id: v });
202
+ l != null && p.set("limit", String(l)), a && p.set("before", a), s && (p.set("explain", "1"), p.set("schema", JSON.stringify(s)));
203
+ const L = `${o.inventoryBackendUrl}/${u}/changelog?${p.toString()}`;
204
+ return await e.get(L);
205
+ },
206
+ /**
207
+ * Purchase orders in a date range, each with when it last changed. The
208
+ * backend joins the orders to their newest commit, so no ids travel and the
209
+ * browser makes one request instead of list-then-ask-for-timestamps.
210
+ */
211
+ async listPurchaseOrders(t, l, s) {
212
+ if (!t) return [];
213
+ const a = new URLSearchParams({ start: l, end: s }), r = `${o.inventoryBackendUrl}/${t}/changelog/purchase-order?${a}`;
214
+ return await e.get(r);
215
+ },
216
+ /**
217
+ * Closing drafts created in a date range, each with when it last changed.
218
+ * Closing groups come back as rows of their own — their submit/approve/
219
+ * reject is recorded against the group document, not its parent.
220
+ */
221
+ async listClosingDrafts(t, l, s) {
222
+ if (!t) return [];
223
+ const a = new URLSearchParams({ start: l, end: s }), r = `${o.inventoryBackendUrl}/${t}/changelog/closing-draft?${a}`;
224
+ return await e.get(r);
225
+ },
226
+ /**
227
+ * A kit-dialect record's whole document, at HEAD or as of (and including)
228
+ * commit `at`. Same dbName/id split as getRecordChangelog. Rejects with a
229
+ * 409 (see isStateConflict) when the record's history predates the kit
230
+ * write path — the backend passthrough for kit httpapi's GET /api/state.
231
+ */
232
+ async getState(t, l, s) {
233
+ const a = new URLSearchParams({ id: l });
234
+ s && a.set("at", s);
235
+ const r = `${o.inventoryBackendUrl}/${t}/changelog/state?${a.toString()}`;
236
+ return await e.get(r);
237
+ },
238
+ /**
239
+ * The domains the browser lists generically, declared in
240
+ * changelog-domains-pkg and served by the backend — a new browsable domain
241
+ * becomes a tab without a portal change. Backends predating the route
242
+ * yield an error the caller treats as "no extra domains".
243
+ */
244
+ async listDomains(t) {
245
+ if (!t) return [];
246
+ const l = `${o.inventoryBackendUrl}/business_${t}/changelog/domains`;
247
+ return await e.get(l);
248
+ },
249
+ /**
250
+ * One generic domain's records, each with when it last changed. Business-
251
+ * scoped: the generic domains are configuration documents of the business
252
+ * db, not of a location.
253
+ */
254
+ async listDomainRecords(t, l) {
255
+ if (!t) return [];
256
+ const s = `${o.inventoryBackendUrl}/business_${t}/changelog/domain/${encodeURIComponent(l)}`;
257
+ return await e.get(s);
258
+ },
259
+ /**
260
+ * One inventory module's records, each with when it last changed. Business-
261
+ * scoped, so the db is `business_<id>` — the same prefixed name the record's
262
+ * own changelog docId carries.
263
+ */
264
+ async listInventory(t, l) {
265
+ if (!t) return [];
266
+ const s = `${o.inventoryBackendUrl}/business_${t}/changelog/inventory?module=${l}`;
267
+ return await e.get(s);
268
+ }
269
+ })), Se = 50;
270
+ function Qt() {
271
+ const o = _e(), e = x([]), t = x(!1), l = x(!1);
272
+ let s = null, a = 0;
273
+ async function r(v, p, L) {
274
+ const F = ++a;
275
+ if (s = null, l.value = !1, !v) {
276
+ e.value = [];
277
+ return;
278
+ }
279
+ t.value = !0;
280
+ try {
281
+ const B = p ?? Se, K = await o.getRecordChangelog(v, B, L);
282
+ if (F !== a) return;
283
+ e.value = K, p == null && (s = { recordId: v, explain: L }, l.value = K.length === B);
284
+ } catch (B) {
285
+ throw F === a && (e.value = []), B;
286
+ } finally {
287
+ F === a && (t.value = !1);
288
+ }
289
+ }
290
+ async function u() {
291
+ const v = e.value[e.value.length - 1];
292
+ if (!s || !v || t.value || !l.value) return;
293
+ const p = a;
294
+ t.value = !0;
295
+ try {
296
+ const L = await o.getRecordChangelog(s.recordId, Se, s.explain, v.id);
297
+ if (p !== a) return;
298
+ e.value = [...e.value, ...L], l.value = L.length === Se;
299
+ } finally {
300
+ p === a && (t.value = !1);
301
+ }
302
+ }
303
+ return { commits: e, isLoading: t, hasMore: l, load: r, loadMore: u };
304
+ }
305
+ const Xe = 1e3;
306
+ function Ke(o) {
307
+ const e = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d+))?/.exec(o);
308
+ return e ? `${e[1]}.${(e[2] ?? "").padEnd(9, "0").slice(0, 9)}` : o;
309
+ }
310
+ function en(o, e) {
311
+ return [...o, ...e].sort(
312
+ (t, l) => Ke(l.at).localeCompare(Ke(t.at)) || l.id.localeCompare(t.id)
313
+ );
314
+ }
315
+ function tn() {
316
+ const o = _e(), e = x([]);
317
+ async function t(l) {
318
+ if (e.value = [], !!l)
319
+ try {
320
+ e.value = await o.getRecordChangelog(
321
+ l,
322
+ Xe,
323
+ Re
324
+ );
325
+ } catch (s) {
326
+ console.error("changelog per-entity load failed", s);
327
+ }
328
+ }
329
+ return { commits: e, load: t };
330
+ }
331
+ function qe(o) {
332
+ if (!o) return null;
333
+ try {
334
+ const e = JSON.parse(o);
335
+ return typeof (e == null ? void 0 : e.changelogLabelKey) == "string" && typeof (e == null ? void 0 : e.verb) == "string" ? {
336
+ labelKey: e.changelogLabelKey,
337
+ verb: e.verb,
338
+ ...typeof e.name == "string" ? { name: e.name } : {}
339
+ } : null;
340
+ } catch {
341
+ return null;
342
+ }
343
+ }
344
+ function Ze(o) {
345
+ return o.startsWith("inventory.changelog.");
346
+ }
347
+ const Qe = "";
348
+ function De(o) {
349
+ const e = o.indexOf(Qe);
350
+ return e === -1 ? { raw: o, human: o } : { raw: o.slice(0, e), human: o.slice(e + 1) };
351
+ }
352
+ const nn = [
353
+ "inventory.changelog.label.recipe",
354
+ "inventory.changelog.label.sku",
355
+ "inventory.changelog.label.unit"
356
+ ], on = [...nn, "Recipe", "Ingredient", "Unit"];
357
+ function an(o) {
358
+ const { human: e } = De(o);
359
+ if (!e) return { type: "Document", name: "", field: [] };
360
+ const t = e.split(" › ");
361
+ return t.length >= 2 && on.includes(t[0]) ? { type: t[0], name: t[1], field: t.slice(2) } : { type: "Document", name: "", field: t };
362
+ }
363
+ const ze = 800;
364
+ function et(o, e, t = 2) {
365
+ const l = je(o), s = je(e);
366
+ if (!l || !s) return null;
367
+ let a = 0;
368
+ for (; a < l.length && a < s.length && l[a] === s[a]; ) a++;
369
+ let r = 0;
370
+ for (; r < l.length - a && r < s.length - a && l[l.length - 1 - r] === s[s.length - 1 - r]; )
371
+ r++;
372
+ const u = l.slice(a, l.length - r), v = s.slice(a, s.length - r);
373
+ if (u.length > ze || v.length > ze) return null;
374
+ const p = (L) => ({ type: "same", text: L });
375
+ return ln(
376
+ [...l.slice(0, a).map(p), ...sn(u, v), ...l.slice(l.length - r).map(p)],
377
+ t
378
+ );
379
+ }
380
+ function je(o) {
381
+ try {
382
+ const e = JSON.parse(o);
383
+ return e === null || typeof e != "object" ? null : JSON.stringify(e, null, 2).split(`
384
+ `);
385
+ } catch {
386
+ return null;
387
+ }
388
+ }
389
+ function sn(o, e) {
390
+ const t = o.length, l = e.length, s = Array.from({ length: t + 1 }, () => new Uint32Array(l + 1));
391
+ for (let v = t - 1; v >= 0; v--)
392
+ for (let p = l - 1; p >= 0; p--)
393
+ s[v][p] = o[v] === e[p] ? s[v + 1][p + 1] + 1 : Math.max(s[v + 1][p], s[v][p + 1]);
394
+ const a = [];
395
+ let r = 0, u = 0;
396
+ for (; r < t && u < l; )
397
+ o[r] === e[u] ? (a.push({ type: "same", text: o[r] }), r++, u++) : s[r + 1][u] >= s[r][u + 1] ? (a.push({ type: "del", text: o[r] }), r++) : (a.push({ type: "add", text: e[u] }), u++);
398
+ for (; r < t; ) a.push({ type: "del", text: o[r++] });
399
+ for (; u < l; ) a.push({ type: "add", text: e[u++] });
400
+ return a;
401
+ }
402
+ function ln(o, e) {
403
+ const t = o.map(() => !1);
404
+ o.forEach((a, r) => {
405
+ if (a.type !== "same")
406
+ for (let u = Math.max(0, r - e); u <= Math.min(o.length - 1, r + e); u++)
407
+ t[u] = !0;
408
+ });
409
+ const l = [];
410
+ let s = !1;
411
+ return o.forEach((a, r) => {
412
+ t[r] ? (l.push(a), s = !1) : s || (l.push({ type: "skip", text: "⋯" }), s = !0);
413
+ }), l;
414
+ }
415
+ function rn(o, e) {
416
+ let t;
417
+ try {
418
+ t = JSON.parse(o);
419
+ } catch {
420
+ return o;
421
+ }
422
+ return t === null ? "—" : typeof t == "number" ? t.toLocaleString() : typeof t == "boolean" ? e(t ? "inventory.changelog.yes" : "inventory.changelog.no") : String(t);
423
+ }
424
+ function Ve(o, e, t = 0, l) {
425
+ var p;
426
+ const s = o.label == null ? void 0 : Ze(o.label) ? e(o.label) : o.label, a = s != null || o.value != null || o.display != null, r = !((p = o.kids) != null && p.length), u = [];
427
+ a && u.push({
428
+ depth: t,
429
+ // A bare array index says nothing a reader needs — a leaf list entry
430
+ // shows just its value. Branch nodes keep the index as their header.
431
+ label: s != null && r && /^\d+$/.test(s) ? void 0 : s,
432
+ text: r ? un(o, e, l) : void 0,
433
+ bookkeeping: !!o.bookkeeping
434
+ });
435
+ const v = a ? t + 1 : t;
436
+ for (const L of o.kids ?? [])
437
+ u.push(...Ve(L, e, v, l));
438
+ return u;
439
+ }
440
+ function un(o, e, t) {
441
+ if (o.value == null) return o.display || void 0;
442
+ const l = rn(o.value, e);
443
+ return (t == null ? void 0 : t(l)) ?? o.display ?? l;
444
+ }
445
+ function $e(o, e) {
446
+ return JSON.stringify(o, null, 2).split(`
447
+ `).map((t) => ({ type: e, text: t }));
448
+ }
449
+ function cn() {
450
+ const o = _e(), e = /* @__PURE__ */ new Map(), t = x(!1), l = x(null);
451
+ async function s(a) {
452
+ const r = e.get(a.id);
453
+ if (r) {
454
+ l.value = r;
455
+ return;
456
+ }
457
+ t.value = !0;
458
+ try {
459
+ const u = a.doc_id.indexOf("/"), v = a.doc_id.slice(0, u), p = a.doc_id.slice(u + 1), [L, F] = await Promise.all([
460
+ a.parent ? o.getState(v, p, a.parent) : Promise.resolve({}),
461
+ o.getState(v, p, a.id)
462
+ ]), K = { diff: a.parent ? et(JSON.stringify(L), JSON.stringify(F)) ?? [
463
+ ...$e(L, "del"),
464
+ ...$e(F, "add")
465
+ ] : $e(F, "add"), conflict: !1 };
466
+ e.set(a.id, K), l.value = K;
467
+ } catch (u) {
468
+ if (!Zt(u))
469
+ throw l.value = null, u;
470
+ const v = { diff: null, conflict: !0 };
471
+ e.set(a.id, v), l.value = v;
472
+ } finally {
473
+ t.value = !1;
474
+ }
475
+ }
476
+ return { isLoading: t, result: l, load: s };
477
+ }
478
+ const dn = {
479
+ key: 0,
480
+ class: "flex justify-center p-16"
481
+ }, fn = {
482
+ key: 1,
483
+ class: "p-16 text-center text-gray-500"
484
+ }, mn = {
485
+ key: 2,
486
+ class: "flex h-full min-h-0 gap-8"
487
+ }, pn = { class: "w-1/3 shrink-0 overflow-y-auto border-r border-gray-200 pr-4" }, vn = ["onClick", "onKeydown"], gn = { class: "fm-typo-en-body-md-600" }, yn = { class: "text-xs text-gray-500" }, hn = {
488
+ key: 0,
489
+ class: "flex-1 overflow-y-auto pl-4"
490
+ }, _n = { class: "mb-12 flex flex-col gap-2 border-b border-gray-200 pb-8" }, bn = { class: "flex flex-wrap items-center gap-8" }, xn = { class: "fm-typo-en-body-lg-600" }, wn = {
491
+ key: 0,
492
+ class: "rounded-full bg-gray-100 px-8 text-xs text-gray-500"
493
+ }, kn = { class: "text-xs text-gray-500" }, Sn = { class: "mb-12" }, $n = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary pl-8" }, Cn = {
494
+ key: 0,
495
+ class: "mb-12"
496
+ }, Ln = {
497
+ key: 1,
498
+ class: "text-sm text-gray-400"
499
+ }, Rn = {
500
+ key: 2,
501
+ class: "w-full overflow-x-auto rounded border border-gray-200 py-4 font-mono text-xs"
502
+ }, Dn = {
503
+ key: 0,
504
+ class: "text-xs text-gray-400"
505
+ }, Vn = { class: "fm-typo-en-body-md-600" }, In = { class: "flex flex-col gap-6" }, Nn = {
506
+ key: 0,
507
+ class: "text-gray-700"
508
+ }, En = { class: "min-w-[120px] shrink-0 text-gray-500" }, Tn = {
509
+ key: 0,
510
+ class: "flex w-full flex-col gap-4"
511
+ }, Pn = {
512
+ key: 0,
513
+ class: "w-full overflow-x-auto rounded border border-gray-200 py-4 font-mono text-xs"
514
+ }, Bn = { key: 0 }, Fn = { key: 1 }, An = {
515
+ key: 1,
516
+ class: "w-full overflow-x-auto rounded border border-gray-200 py-4 font-mono text-xs"
517
+ }, Mn = { key: 0 }, Un = { key: 1 }, On = {
518
+ key: 1,
519
+ class: "w-full overflow-x-auto rounded border border-gray-200 py-4 font-mono text-xs"
520
+ }, Kn = {
521
+ key: 2,
522
+ class: "flex w-full flex-wrap items-baseline gap-4"
523
+ }, zn = {
524
+ key: 0,
525
+ class: "rounded bg-red-50 px-4 text-red-700"
526
+ }, jn = {
527
+ key: 1,
528
+ class: "text-gray-400"
529
+ }, Gn = {
530
+ key: 2,
531
+ class: "rounded bg-green-50 px-4 text-green-700"
532
+ }, Hn = {
533
+ key: 1,
534
+ class: "text-sm text-gray-500"
535
+ }, Jn = {
536
+ key: 2,
537
+ class: "mt-16 break-all border-t border-gray-200 pt-8 font-mono text-xs text-gray-400"
538
+ }, Yn = { key: 0 }, Wn = "capture baseline", Xn = /* @__PURE__ */ ue({
539
+ __name: "ChangelogPanel",
540
+ props: {
541
+ commits: {},
542
+ isLoading: { type: Boolean },
543
+ resolveName: { type: Function }
544
+ },
545
+ setup(o) {
546
+ const e = o, { t } = he(), l = x(null), s = V(
547
+ () => e.commits.find((d) => d.id === l.value)
548
+ ), a = /* @__PURE__ */ new Set(["updatedAt", "createdAt", "updatedBy", "createdBy", "_rev"]), r = V(() => {
549
+ var h;
550
+ return (((h = s.value) == null ? void 0 : h.changes) ?? []).filter((M) => {
551
+ const { raw: A } = De(M.path);
552
+ return A === "@payload" || M.from == null && M.to == null ? !1 : !A.split(".").some((X) => a.has(X));
553
+ });
554
+ });
555
+ Z(
556
+ () => e.commits,
557
+ (d) => {
558
+ var h;
559
+ d.find((M) => M.id === l.value) || (l.value = ((h = d[0]) == null ? void 0 : h.id) ?? null);
560
+ },
561
+ { immediate: !0 }
562
+ );
563
+ const u = x(!1), { isLoading: v, result: p, load: L } = cn();
564
+ Z([u, s], ([d, h]) => {
565
+ p.value = null, !(!d || !h) && L(h).catch((M) => {
566
+ console.error("changelog snapshot load failed", M), u.value = !1;
567
+ });
568
+ });
569
+ function F(d) {
570
+ return d ? d.slice(0, 8) : "";
571
+ }
572
+ function B(d) {
573
+ return d ? new Date(d).toLocaleString() : "";
574
+ }
575
+ function K(d) {
576
+ if (d == null) return "";
577
+ let h;
578
+ try {
579
+ h = JSON.parse(d);
580
+ } catch {
581
+ return d;
582
+ }
583
+ return h === null ? "—" : typeof h == "string" ? h : typeof h == "number" ? h.toLocaleString() : typeof h == "boolean" ? t(h ? "inventory.changelog.yes" : "inventory.changelog.no") : JSON.stringify(h, null, 2);
584
+ }
585
+ function Q(d) {
586
+ return (d.authors || []).join(", ") || t("inventory.changelog.unknownActor");
587
+ }
588
+ function U(d) {
589
+ if (d.message === Wn) return t("inventory.changelog.captureBaseline");
590
+ const h = qe(d.message);
591
+ if (!h) return d.message || t("inventory.changelog.noMessage");
592
+ const M = $(h.labelKey);
593
+ return h.name ? t(`inventory.changelog.message.${h.verb}`, { module: M, name: h.name }) : t(`inventory.changelog.message.${h.verb}NoName`, { module: M });
594
+ }
595
+ function $(d) {
596
+ return Ze(d) ? t(d) : d;
597
+ }
598
+ const G = (d) => /[^a-zA-Z]/.test(d);
599
+ function C(d, h) {
600
+ return d == null || h == null ? null : et(d, h);
601
+ }
602
+ function y(d) {
603
+ if (!(!d.to_value && !d.from_value))
604
+ return {
605
+ toTree: d.to_value ? Ve(d.to_value, t, 0, e.resolveName) : void 0,
606
+ fromTree: d.from_value ? Ve(d.from_value, t, 0, e.resolveName) : void 0
607
+ };
608
+ }
609
+ function S(d) {
610
+ return d === "add" ? "bg-green-50 text-green-700" : d === "del" ? "bg-red-50 text-red-700" : d === "skip" ? "text-gray-400" : "text-gray-600";
611
+ }
612
+ function T(d) {
613
+ return d.type === "skip" ? d.text : (d.type === "add" ? "+ " : d.type === "del" ? "- " : " ") + d.text;
614
+ }
615
+ const O = V(() => {
616
+ const d = /* @__PURE__ */ new Map(), h = [], M = (g, f) => {
617
+ let N = d.get(g);
618
+ return N || (N = f(), d.set(g, N), h.push(N)), N;
619
+ }, A = () => M("@doc", () => ({ header: "", lines: [] })), X = (g, f) => {
620
+ var P;
621
+ if (g == null) return f;
622
+ let N;
623
+ try {
624
+ N = JSON.parse(g);
625
+ } catch {
626
+ N = g;
627
+ }
628
+ return (typeof N == "string" ? (P = e.resolveName) == null ? void 0 : P.call(e, N) : void 0) ?? f;
629
+ }, H = (g, f, N) => {
630
+ var P, Y, ee, te;
631
+ const _ = y(f);
632
+ _ ? g.lines.push({ label: N, ..._ }) : f.from != null && f.to != null ? g.lines.push({
633
+ label: N,
634
+ from: f.from,
635
+ to: f.to,
636
+ diff: C(f.from, f.to),
637
+ fromDisplay: X(f.from, (P = f.display) == null ? void 0 : P.from),
638
+ toDisplay: X(f.to, (Y = f.display) == null ? void 0 : Y.to)
639
+ }) : f.to != null ? g.lines.push({ label: N, to: f.to, toDisplay: X(f.to, (ee = f.display) == null ? void 0 : ee.to) }) : g.lines.push({ label: N, from: f.from, fromDisplay: X(f.from, (te = f.display) == null ? void 0 : te.from) });
640
+ }, R = (g) => {
641
+ var N;
642
+ const f = g.element;
643
+ if (f) {
644
+ const _ = M(`kit:${(f.trail ?? []).join(".")}:${f.id ?? ""}`, () => ({
645
+ kind: (f.trail ?? []).map($).join(" › "),
646
+ header: f.name || f.id || "",
647
+ lines: []
648
+ }));
649
+ if ((N = g.field) != null && N.length)
650
+ H(_, g, g.field.map($).join(" › "));
651
+ else {
652
+ _.badge = g.to != null ? "added" : "removed";
653
+ const P = y(g);
654
+ P && _.lines.push(P);
655
+ }
656
+ return;
657
+ }
658
+ H(A(), g, (g.field ?? []).map($).join(" › "));
659
+ };
660
+ for (const g of r.value) {
661
+ const { raw: f, human: N } = De(g.path);
662
+ if (g.kind === "create" && !f) {
663
+ const ee = y(g);
664
+ A().lines.push(
665
+ ee ? { label: t("inventory.changelog.kind.created"), ...ee } : { text: t("inventory.changelog.kind.created") }
666
+ );
667
+ continue;
668
+ }
669
+ if (!g.path.includes(Qe) && (g.field || g.element)) {
670
+ R(g);
671
+ continue;
672
+ }
673
+ const _ = f ? f.split(".") : [], P = N ? N.split(" › ") : [], Y = _.findIndex((ee, te) => te > 0 && G(ee));
674
+ if (Y > 0 && P.length === _.length) {
675
+ const ee = P[Y], te = M(_.slice(0, Y + 1).join("."), () => ({
676
+ kind: P.slice(0, Y).map($).join(" › "),
677
+ header: ee,
678
+ lines: []
679
+ })), re = P.slice(Y + 1).map($).join(" › ");
680
+ if (re) H(te, g, re);
681
+ else if (g.from != null && g.to != null) H(te, g, ee);
682
+ else {
683
+ te.badge = g.to != null ? "added" : "removed";
684
+ const ce = y(g);
685
+ ce && te.lines.push(ce);
686
+ }
687
+ continue;
688
+ }
689
+ H(A(), g, P.map($).join(" › "));
690
+ }
691
+ return h;
692
+ });
693
+ return (d, h) => {
694
+ var X, H;
695
+ const M = W("FmCircularProgress"), A = W("FmSwitch");
696
+ return d.isLoading ? (i(), m("div", dn, [
697
+ I(M)
698
+ ])) : d.commits.length ? (i(), m("div", mn, [
699
+ w("ol", pn, [
700
+ (i(!0), m(J, null, oe(d.commits, (R) => (i(), m("li", {
701
+ key: R.id,
702
+ role: "button",
703
+ tabindex: "0",
704
+ class: ae([
705
+ "cursor-pointer border-l-2 py-8 pl-12",
706
+ R.id === l.value ? "border-fm-color-primary bg-fm-color-primary-50" : "border-gray-200 hover:bg-gray-50"
707
+ ]),
708
+ onClick: (g) => l.value = R.id,
709
+ onKeydown: [
710
+ Me((g) => l.value = R.id, ["enter"]),
711
+ Me(pt((g) => l.value = R.id, ["prevent"]), ["space"])
712
+ ]
713
+ }, [
714
+ w("div", gn, b(U(R)), 1),
715
+ w("div", yn, b(Q(R)) + " · " + b(B(R.at)) + " · " + b(F(R.id)), 1)
716
+ ], 42, vn))), 128))
717
+ ]),
718
+ s.value ? (i(), m("div", hn, [
719
+ w("div", _n, [
720
+ w("div", bn, [
721
+ w("div", xn, b(U(s.value)), 1),
722
+ s.value.parent ? E("", !0) : (i(), m("span", wn, b(D(t)("inventory.changelog.rootCommit")), 1))
723
+ ]),
724
+ w("div", kn, b(Q(s.value)) + " · " + b(B(s.value.at)), 1)
725
+ ]),
726
+ w("div", Sn, [
727
+ I(We, null, {
728
+ default: le(() => [
729
+ w("span", $n, b(D(t)("inventory.changelog.dataDiff")), 1),
730
+ I(A, {
731
+ modelValue: u.value,
732
+ "onUpdate:modelValue": h[0] || (h[0] = (R) => u.value = R)
733
+ }, null, 8, ["modelValue"])
734
+ ]),
735
+ _: 1
736
+ })
737
+ ]),
738
+ u.value ? (i(), m("div", Cn, [
739
+ D(v) ? (i(), ie(M, { key: 0 })) : (X = D(p)) != null && X.conflict ? (i(), m("div", Ln, b(D(t)("inventory.changelog.snapshotUnavailable")), 1)) : (H = D(p)) != null && H.diff ? (i(), m("div", Rn, [
740
+ (i(!0), m(J, null, oe(D(p).diff, (R, g) => (i(), m("div", {
741
+ key: g,
742
+ class: ae(["whitespace-pre px-4", S(R.type)])
743
+ }, b(T(R)), 3))), 128))
744
+ ])) : E("", !0)
745
+ ])) : E("", !0),
746
+ (i(!0), m(J, null, oe(O.value, (R, g) => (i(), m("div", {
747
+ key: g,
748
+ class: "mb-12 rounded-lg border border-gray-200 p-12"
749
+ }, [
750
+ R.kind || R.header || R.badge ? (i(), m("div", {
751
+ key: 0,
752
+ class: ae(["flex flex-wrap items-baseline gap-8", R.lines.length ? "mb-8" : ""])
753
+ }, [
754
+ R.kind ? (i(), m("span", Dn, b(R.kind), 1)) : E("", !0),
755
+ w("span", Vn, b(R.header), 1),
756
+ R.badge ? (i(), m("span", {
757
+ key: 1,
758
+ class: ae(["rounded-full px-8 text-xs", R.badge === "added" ? "bg-green-100 text-green-700" : "bg-red-100 text-red-700"])
759
+ }, b(R.badge === "added" ? D(t)("inventory.changelog.added") : D(t)("inventory.changelog.kind.removed")), 3)) : E("", !0)
760
+ ], 2)) : E("", !0),
761
+ w("ul", In, [
762
+ (i(!0), m(J, null, oe(R.lines, (f, N) => (i(), m("li", {
763
+ key: N,
764
+ class: "flex flex-wrap items-baseline gap-8 text-sm"
765
+ }, [
766
+ f.text ? (i(), m("span", Nn, b(f.text), 1)) : (i(), m(J, { key: 1 }, [
767
+ w("span", En, b(f.label), 1),
768
+ f.toTree || f.fromTree ? (i(), m("div", Tn, [
769
+ f.fromTree ? (i(), m("div", Pn, [
770
+ (i(!0), m(J, null, oe(f.fromTree, (_, P) => (i(), m("div", {
771
+ key: P,
772
+ class: ae(["flex items-baseline gap-4 px-4", _.bookkeeping ? "text-gray-400" : "text-red-700"])
773
+ }, [
774
+ (i(!0), m(J, null, oe(_.depth, (Y) => (i(), m("span", {
775
+ key: Y,
776
+ class: "inline-block w-16"
777
+ }))), 128)),
778
+ _.label ? (i(), m("span", Bn, [
779
+ ve(b(_.label), 1),
780
+ _.text ? (i(), m(J, { key: 0 }, [
781
+ ve(":")
782
+ ], 64)) : E("", !0)
783
+ ])) : E("", !0),
784
+ _.text ? (i(), m("span", Fn, b(_.text), 1)) : E("", !0)
785
+ ], 2))), 128))
786
+ ])) : E("", !0),
787
+ f.toTree ? (i(), m("div", An, [
788
+ (i(!0), m(J, null, oe(f.toTree, (_, P) => (i(), m("div", {
789
+ key: P,
790
+ class: ae(["flex items-baseline gap-4 px-4", _.bookkeeping ? "text-gray-400" : "text-green-700"])
791
+ }, [
792
+ (i(!0), m(J, null, oe(_.depth, (Y) => (i(), m("span", {
793
+ key: Y,
794
+ class: "inline-block w-16"
795
+ }))), 128)),
796
+ _.label ? (i(), m("span", Mn, [
797
+ ve(b(_.label), 1),
798
+ _.text ? (i(), m(J, { key: 0 }, [
799
+ ve(":")
800
+ ], 64)) : E("", !0)
801
+ ])) : E("", !0),
802
+ _.text ? (i(), m("span", Un, b(_.text), 1)) : E("", !0)
803
+ ], 2))), 128))
804
+ ])) : E("", !0)
805
+ ])) : f.diff ? (i(), m("div", On, [
806
+ (i(!0), m(J, null, oe(f.diff, (_, P) => (i(), m("div", {
807
+ key: P,
808
+ class: ae(["whitespace-pre px-4", S(_.type)])
809
+ }, b(T(_)), 3))), 128))
810
+ ])) : (i(), m("span", Kn, [
811
+ f.from != null ? (i(), m("span", zn, b(f.fromDisplay ?? K(f.from)), 1)) : E("", !0),
812
+ f.from != null && f.to != null ? (i(), m("span", jn, "→")) : E("", !0),
813
+ f.to != null ? (i(), m("span", Gn, b(f.toDisplay ?? K(f.to)), 1)) : E("", !0)
814
+ ]))
815
+ ], 64))
816
+ ]))), 128))
817
+ ])
818
+ ]))), 128)),
819
+ O.value.length ? E("", !0) : (i(), m("div", Hn, b(D(t)("inventory.changelog.empty")), 1)),
820
+ u.value ? (i(), m("div", Jn, [
821
+ ve(b(s.value.id) + " ", 1),
822
+ s.value.parent ? (i(), m("span", Yn, "← " + b(s.value.parent), 1)) : E("", !0)
823
+ ])) : E("", !0)
824
+ ])) : E("", !0)
825
+ ])) : (i(), m("div", fn, b(D(t)("inventory.changelog.empty")), 1));
826
+ };
827
+ }
828
+ }), qn = { class: "flex flex-col gap-8" }, Zn = { class: "flex flex-wrap items-center gap-16" }, Qn = { class: "fm-typo-en-heading-lg-600" }, eo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, to = { class: "flex h-full min-h-0 flex-col gap-12 p-16" }, no = { class: "flex flex-wrap items-center gap-12" }, oo = { class: "flex shrink-0 items-center gap-8" }, ao = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, so = { class: "flex flex-wrap items-center gap-12" }, lo = {
829
+ key: 0,
830
+ class: "fm-typo-en-body-md-600"
831
+ }, ro = { class: "fm-typo-en-heading-md-600" }, io = {
832
+ key: 0,
833
+ class: "flex justify-center py-8"
834
+ }, Ce = "inventory.changelog.label.", uo = /* @__PURE__ */ ue({
835
+ __name: "ChangelogDialog",
836
+ props: {
837
+ modelValue: { type: Boolean }
838
+ },
839
+ emits: ["update:modelValue"],
840
+ setup(o, { emit: e }) {
841
+ const t = o, l = e, s = V({
842
+ get: () => t.modelValue,
843
+ set: (n) => l("update:modelValue", n)
844
+ }), { t: a } = he(), r = ge(), u = Je(), v = He(), p = _e(), { breakpoints: L } = It(), F = V(() => L.value.xs || L.value.sm), B = V(() => F.value ? "98vw" : "72vw"), { commits: K, isLoading: Q, hasMore: U, load: $, loadMore: G } = Qt();
845
+ function C() {
846
+ G().catch((n) => console.error("changelog load more failed", n));
847
+ }
848
+ function y(n) {
849
+ return n ? new Date(n).toLocaleString() : "—";
850
+ }
851
+ function S(n) {
852
+ return [...n].sort((c, k) => (k.lastUpdate ?? "").localeCompare(c.lastUpdate ?? ""));
853
+ }
854
+ function T(n, c, k) {
855
+ $(n, c, k).catch((z) => console.error("changelog load failed", z));
856
+ }
857
+ const O = x([]);
858
+ async function d() {
859
+ var c;
860
+ const n = (c = r.currentBusiness.value) == null ? void 0 : c._id;
861
+ if (n)
862
+ try {
863
+ O.value = await p.listDomains(n);
864
+ } catch (k) {
865
+ console.error("changelog domain list load failed", k), O.value = [];
866
+ }
867
+ }
868
+ const h = V(() => [
869
+ { label: a("inventory.changelog.label.purchaseOrder"), value: "purchaseOrder" },
870
+ { label: a("inventory.changelog.label.closingDraft"), value: "closingDraft" },
871
+ { label: a("inventory.changelog.domainInventory"), value: "inventory" },
872
+ ...O.value.map((n) => ({ label: a(n.labelKey), value: n.domain }))
873
+ ]), M = x(h.value[0]), A = V(() => {
874
+ var n;
875
+ return ((n = M.value) == null ? void 0 : n.value) ?? "purchaseOrder";
876
+ }), X = V(
877
+ () => O.value.some((n) => n.domain === A.value)
878
+ ), H = x(!1), R = V(
879
+ () => ["sku", "recipe", "unit"].map((n) => ({
880
+ label: a(Ce + n),
881
+ value: n
882
+ }))
883
+ ), g = x(R.value[0]), f = V(() => {
884
+ var n;
885
+ return ((n = g.value) == null ? void 0 : n.value) ?? "sku";
886
+ }), N = x(""), _ = x(null), P = x(!1), Y = V(() => {
887
+ var k;
888
+ const n = (k = r.currentBusiness.value) == null ? void 0 : k._id, c = u.inventory._id;
889
+ return n && c ? `business_${n}/${c}` : "";
890
+ }), ee = V(() => {
891
+ const n = /* @__PURE__ */ new Map(), c = u.inventory;
892
+ for (const k of [c.sku, c.recipe, c.unit])
893
+ for (const z of k ?? [])
894
+ z._id && z.name && n.set(z._id, z.name);
895
+ for (const k of c.unit ?? [])
896
+ for (const z of k.measurements ?? []) {
897
+ if (!z.id) continue;
898
+ const q = z.abbrev || z.name;
899
+ if (!q) continue;
900
+ const ne = Tt.toDouble(z.conversion);
901
+ n.set(z.id, ne ? `${q} (1 ${q} = ${ne} ${k.abbrev})` : q);
902
+ }
903
+ return n;
904
+ }), te = (n) => ee.value.get(n), re = x([]), ce = x(!1);
905
+ async function Ee() {
906
+ var c;
907
+ const n = (c = r.currentBusiness.value) == null ? void 0 : c._id;
908
+ if (n) {
909
+ ce.value = !0;
910
+ try {
911
+ re.value = S(
912
+ await p.listInventory(n, f.value)
913
+ );
914
+ } catch (k) {
915
+ console.error("changelog inventory list load failed", k), re.value = [];
916
+ } finally {
917
+ ce.value = !1;
918
+ }
919
+ }
920
+ }
921
+ const tt = V(
922
+ () => P.value ? re.value : re.value.filter((n) => !n.deleted)
923
+ ), nt = V(() => [
924
+ { accessorKey: "id", header: () => a("inventory.closing.draft.table.id"), size: 320 },
925
+ {
926
+ id: "name",
927
+ header: () => a("inventory.common.name"),
928
+ accessorFn: (n) => n.name,
929
+ // Deleted records sit in the same list as live ones, so the row says which
930
+ // it is; nothing else distinguishes them.
931
+ cell: ({ row: n }) => n.original.deleted ? vt(
932
+ "span",
933
+ { "data-deleted": "" },
934
+ `${n.original.name} (${a("inventory.changelog.deleted")})`
935
+ ) : n.original.name
936
+ },
937
+ {
938
+ id: "lastUpdate",
939
+ header: () => a("inventory.changelog.column.lastUpdate"),
940
+ size: 200,
941
+ // Raw ISO is the sort key — clicking the header on formatted dates would
942
+ // order them lexicographically by locale string. Formatted only to display.
943
+ accessorFn: (n) => n.lastUpdate ?? "",
944
+ cell: ({ getValue: n }) => y(n() || void 0)
945
+ }
946
+ ]), { commits: ot, load: at } = tn();
947
+ function st(n) {
948
+ _.value = n, H.value = !0, T(Y.value, Xe, Re), n.id && at(`${Y.value}/${f.value}/${n.id}`).catch(
949
+ (c) => console.error("changelog per-entity load failed", c)
950
+ );
951
+ }
952
+ function lt(n, c) {
953
+ const k = qe(n.message);
954
+ return k && k.labelKey === Ce + f.value && k.name === c.name ? !0 : (n.changes ?? []).some((z) => {
955
+ const q = an(z.path);
956
+ return q.type === Ce + f.value && q.name === c.name;
957
+ });
958
+ }
959
+ const rt = V(() => {
960
+ const n = _.value;
961
+ if (!n) return [];
962
+ const c = K.value.filter((k) => lt(k, n));
963
+ return en(c, ot.value);
964
+ }), be = x([]), xe = x(!1), we = x(null);
965
+ async function it() {
966
+ var c;
967
+ const n = (c = r.currentBusiness.value) == null ? void 0 : c._id;
968
+ if (n) {
969
+ xe.value = !0;
970
+ try {
971
+ be.value = S(
972
+ await p.listDomainRecords(n, A.value)
973
+ );
974
+ } catch (k) {
975
+ console.error("changelog domain records load failed", k), be.value = [];
976
+ } finally {
977
+ xe.value = !1;
978
+ }
979
+ }
980
+ }
981
+ function ut(n) {
982
+ var k;
983
+ const c = (k = r.currentBusiness.value) == null ? void 0 : k._id;
984
+ c && (we.value = n, H.value = !0, T(`business_${c}/${n.id}`, void 0, Le));
985
+ }
986
+ const pe = x(Nt()), ye = x([]), ke = x(!1), de = x(null), Te = V(() => {
987
+ const n = v._currentLocation;
988
+ return n ? `${n.name} (${n.doc.profile.code ?? "--"})` : "";
989
+ }), Pe = V(() => [
990
+ { accessorKey: "id", header: () => a("inventory.closing.draft.table.id"), size: 320 },
991
+ {
992
+ accessorKey: "name",
993
+ header: () => A.value === "purchaseOrder" ? a("inventory.changelog.column.seq") : a("inventory.common.name"),
994
+ size: 240
995
+ },
996
+ {
997
+ id: "lastUpdate",
998
+ header: () => a("inventory.changelog.column.lastUpdate"),
999
+ size: 200,
1000
+ // Raw ISO is the sort key; see the note on the inventory table.
1001
+ accessorFn: (n) => n.lastUpdate ?? "",
1002
+ cell: ({ getValue: n }) => y(n() || void 0)
1003
+ }
1004
+ ]);
1005
+ async function Be() {
1006
+ var z;
1007
+ const n = (z = v._currentLocation) == null ? void 0 : z.dbName;
1008
+ if (!n) return;
1009
+ const c = Pt(new Date(pe.value.startDate)).toISOString(), k = Bt(new Date(pe.value.endDate)).toISOString();
1010
+ ke.value = !0;
1011
+ try {
1012
+ ye.value = S(
1013
+ A.value === "purchaseOrder" ? await p.listPurchaseOrders(n, c, k) : await p.listClosingDrafts(n, c, k)
1014
+ );
1015
+ } catch (q) {
1016
+ console.error("changelog location list load failed", q), ye.value = [];
1017
+ } finally {
1018
+ ke.value = !1;
1019
+ }
1020
+ de.value && !ye.value.find((q) => {
1021
+ var ne;
1022
+ return q.id === ((ne = de.value) == null ? void 0 : ne.id);
1023
+ }) && (de.value = null, T(""));
1024
+ }
1025
+ function ct(n) {
1026
+ de.value = n, H.value = !0, T(`${v.currentLocationDBName}/${n.id}`, void 0, Le);
1027
+ }
1028
+ const dt = V(() => {
1029
+ var n, c, k;
1030
+ return A.value === "inventory" ? ((n = _.value) == null ? void 0 : n.name) ?? "" : X.value ? ((c = we.value) == null ? void 0 : c.name) ?? "" : ((k = de.value) == null ? void 0 : k.name) ?? "";
1031
+ });
1032
+ function Fe() {
1033
+ H.value = !1, A.value === "inventory" ? (_.value = null, P.value = !1, T(""), Ee().catch(
1034
+ (n) => console.error("changelog inventory list failed", n)
1035
+ )) : X.value ? (we.value = null, T(""), it().catch(
1036
+ (n) => console.error("changelog domain records failed", n)
1037
+ )) : (de.value = null, T(""), Be().catch((n) => console.error("changelog location list failed", n)));
1038
+ }
1039
+ return Z(s, (n) => {
1040
+ n && (d().catch((c) => console.error("changelog domain list failed", c)), Fe());
1041
+ }), Z(A, () => {
1042
+ s.value && Fe();
1043
+ }), Z(pe, () => {
1044
+ s.value && A.value !== "inventory" && !X.value && Be().catch((n) => console.error("changelog location list failed", n));
1045
+ }), Z(P, (n) => {
1046
+ var c;
1047
+ !n && ((c = _.value) != null && c.deleted) && (_.value = null, H.value = !1);
1048
+ }), Z(f, () => {
1049
+ _.value = null, H.value = !1, s.value && A.value === "inventory" && Ee().catch(
1050
+ (n) => console.error("changelog inventory list failed", n)
1051
+ );
1052
+ }), Z(Y, (n) => {
1053
+ _.value = null, s.value && A.value === "inventory" && T(n, void 0, Re);
1054
+ }), (n, c) => {
1055
+ const k = W("FmButtonGroup"), z = W("FmSearch"), q = W("FmSwitch"), ne = W("FmTable"), Ae = W("FmDialog"), ft = W("FmButton");
1056
+ return i(), m(J, null, [
1057
+ I(Ae, {
1058
+ modelValue: s.value,
1059
+ "onUpdate:modelValue": c[8] || (c[8] = (j) => s.value = j),
1060
+ "close-button": "",
1061
+ "dismiss-away": "",
1062
+ "min-width": "98vw",
1063
+ "max-width": "98vw",
1064
+ "max-height": "94vh",
1065
+ "content-class": "!p-0 h-[86vh]"
1066
+ }, {
1067
+ "dialog-header": le(() => [
1068
+ w("div", qn, [
1069
+ w("div", Zn, [
1070
+ w("div", Qn, b(D(a)("inventory.changelog.title")), 1),
1071
+ I(k, {
1072
+ modelValue: M.value,
1073
+ "onUpdate:modelValue": c[0] || (c[0] = (j) => M.value = j),
1074
+ items: h.value
1075
+ }, null, 8, ["modelValue", "items"])
1076
+ ]),
1077
+ w("div", eo, b(D(a)("inventory.changelog.scopeDescription")), 1)
1078
+ ])
1079
+ ]),
1080
+ default: le(() => [
1081
+ w("div", to, [
1082
+ A.value === "inventory" ? (i(), m(J, { key: 0 }, [
1083
+ w("div", no, [
1084
+ I(k, {
1085
+ modelValue: g.value,
1086
+ "onUpdate:modelValue": c[1] || (c[1] = (j) => g.value = j),
1087
+ items: R.value
1088
+ }, null, 8, ["modelValue", "items"]),
1089
+ I(z, {
1090
+ modelValue: N.value,
1091
+ "onUpdate:modelValue": c[2] || (c[2] = (j) => N.value = j),
1092
+ class: "flex-1",
1093
+ placeholder: D(a)("inventory.changelog.searchInventory")
1094
+ }, null, 8, ["modelValue", "placeholder"]),
1095
+ w("div", oo, [
1096
+ w("span", ao, b(D(a)("inventory.changelog.includeDeleted")), 1),
1097
+ I(q, {
1098
+ modelValue: P.value,
1099
+ "onUpdate:modelValue": c[3] || (c[3] = (j) => P.value = j)
1100
+ }, null, 8, ["modelValue"])
1101
+ ])
1102
+ ]),
1103
+ I(ne, {
1104
+ class: "min-h-0 flex-1",
1105
+ "row-data": tt.value,
1106
+ "column-defs": nt.value,
1107
+ "search-value": N.value,
1108
+ loading: ce.value,
1109
+ "page-size": 20,
1110
+ onRowClick: c[4] || (c[4] = (j) => st(j.original))
1111
+ }, null, 8, ["row-data", "column-defs", "search-value", "loading"])
1112
+ ], 64)) : X.value ? (i(), ie(ne, {
1113
+ key: 1,
1114
+ class: "min-h-0 flex-1",
1115
+ "row-data": be.value,
1116
+ "column-defs": Pe.value,
1117
+ loading: xe.value,
1118
+ "page-size": 20,
1119
+ onRowClick: c[5] || (c[5] = (j) => ut(j.original))
1120
+ }, null, 8, ["row-data", "column-defs", "loading"])) : (i(), m(J, { key: 2 }, [
1121
+ w("div", so, [
1122
+ I(Et, {
1123
+ modelValue: pe.value,
1124
+ "onUpdate:modelValue": c[6] || (c[6] = (j) => pe.value = j)
1125
+ }, null, 8, ["modelValue"]),
1126
+ Te.value ? (i(), m("span", lo, b(Te.value), 1)) : E("", !0)
1127
+ ]),
1128
+ I(ne, {
1129
+ class: "min-h-0 flex-1",
1130
+ "row-data": ye.value,
1131
+ "column-defs": Pe.value,
1132
+ loading: ke.value,
1133
+ "page-size": 20,
1134
+ onRowClick: c[7] || (c[7] = (j) => ct(j.original))
1135
+ }, null, 8, ["row-data", "column-defs", "loading"])
1136
+ ], 64))
1137
+ ])
1138
+ ]),
1139
+ _: 1
1140
+ }, 8, ["modelValue"]),
1141
+ I(Ae, {
1142
+ modelValue: H.value,
1143
+ "onUpdate:modelValue": c[9] || (c[9] = (j) => H.value = j),
1144
+ "close-button": "",
1145
+ "dismiss-away": "",
1146
+ "min-width": B.value,
1147
+ "max-width": B.value,
1148
+ "max-height": "86vh"
1149
+ }, {
1150
+ "dialog-header": le(() => [
1151
+ w("div", ro, b(dt.value), 1)
1152
+ ]),
1153
+ default: le(() => [
1154
+ I(Xn, {
1155
+ commits: A.value === "inventory" ? rt.value : D(K),
1156
+ "is-loading": D(Q),
1157
+ "resolve-name": te
1158
+ }, null, 8, ["commits", "is-loading"]),
1159
+ A.value !== "inventory" && D(U) ? (i(), m("div", io, [
1160
+ I(ft, {
1161
+ label: D(a)("inventory.changelog.loadMore"),
1162
+ variant: "secondary",
1163
+ disabled: D(Q),
1164
+ onClick: C
1165
+ }, null, 8, ["label", "disabled"])
1166
+ ])) : E("", !0)
1167
+ ]),
1168
+ _: 1
1169
+ }, 8, ["modelValue", "min-width", "max-width"])
1170
+ ], 64);
1171
+ };
1172
+ }
1173
+ }), co = /* @__PURE__ */ Ft(uo, [["__scopeId", "data-v-07c5a952"]]), se = 8;
1174
+ function fo(o, e) {
1175
+ return { x: se, y: Math.max(se, e - o - se) };
1176
+ }
1177
+ const mo = ["title"], Ge = 48, po = 8, vo = /* @__PURE__ */ ue({
1178
+ __name: "ChangelogFloatingButton",
1179
+ setup(o) {
1180
+ const { t: e } = he(), t = ge(), l = V(() => {
1181
+ var C;
1182
+ return !!((C = t.sessionUser.value) != null && C.role.isAdmin);
1183
+ }), s = x(!1), a = x(null);
1184
+ function r() {
1185
+ var C, y;
1186
+ return {
1187
+ width: ((C = a.value) == null ? void 0 : C.offsetWidth) ?? Ge,
1188
+ height: ((y = a.value) == null ? void 0 : y.offsetHeight) ?? Ge
1189
+ };
1190
+ }
1191
+ const u = x({ x: 0, y: 0 });
1192
+ function v(C, y, S) {
1193
+ return Math.min(Math.max(C, y), S);
1194
+ }
1195
+ function p() {
1196
+ const { width: C, height: y } = r(), S = Math.max(se, window.innerWidth - C - se - po), T = Math.max(se, window.innerHeight - y - se), O = u.value.x + C / 2;
1197
+ u.value = {
1198
+ x: O < window.innerWidth / 2 ? se : S,
1199
+ y: v(u.value.y, se, T)
1200
+ };
1201
+ }
1202
+ function L() {
1203
+ u.value = fo(r().height, window.innerHeight);
1204
+ }
1205
+ Ie(() => {
1206
+ L(), window.addEventListener("resize", p), window.addEventListener("orientationchange", p);
1207
+ }), gt(() => {
1208
+ window.removeEventListener("resize", p), window.removeEventListener("orientationchange", p);
1209
+ }), Z(l, async (C) => {
1210
+ C && (await yt(), L());
1211
+ });
1212
+ const F = x(!1);
1213
+ let B = null, K = !1;
1214
+ function Q(C) {
1215
+ B = { x: C.clientX, y: C.clientY, px: u.value.x, py: u.value.y }, F.value = !0, K = !1, C.currentTarget.setPointerCapture(C.pointerId);
1216
+ }
1217
+ function U(C) {
1218
+ if (!B) return;
1219
+ const y = C.clientX - B.x, S = C.clientY - B.y;
1220
+ Math.abs(y) + Math.abs(S) > 3 && (K = !0);
1221
+ const { width: T, height: O } = r();
1222
+ u.value = {
1223
+ x: v(B.px + y, 0, window.innerWidth - T),
1224
+ y: v(B.py + S, 0, window.innerHeight - O)
1225
+ };
1226
+ }
1227
+ function $() {
1228
+ B = null, F.value = !1, p();
1229
+ }
1230
+ function G() {
1231
+ B && ($(), K || (s.value = !0));
1232
+ }
1233
+ return (C, y) => {
1234
+ const S = W("FmIcon");
1235
+ return i(), ie(ht, { to: "body" }, [
1236
+ l.value ? (i(), m(J, { key: 0 }, [
1237
+ w("div", {
1238
+ ref_key: "wrapperRef",
1239
+ ref: a,
1240
+ class: ae(["fixed z-50 cursor-grab touch-none", F.value ? "" : "transition-[left,top] duration-200 ease-out"]),
1241
+ style: _t({ left: `${u.value.x}px`, top: `${u.value.y}px` })
1242
+ }, [
1243
+ I(We, null, {
1244
+ default: le(() => [
1245
+ w("button", {
1246
+ type: "button",
1247
+ title: D(e)("inventory.changelog.title"),
1248
+ class: ae(["fm-typo-en-body-sm-600 flex h-48 items-center gap-8 whitespace-nowrap rounded-full border border-gray-200 bg-white px-16 shadow-lg hover:bg-gray-50", F.value ? "cursor-grabbing" : "cursor-grab"]),
1249
+ onPointerdown: Q,
1250
+ onPointermove: U,
1251
+ onPointerup: G,
1252
+ onPointercancel: $
1253
+ }, [
1254
+ I(S, {
1255
+ name: "history",
1256
+ size: "md",
1257
+ outline: ""
1258
+ }),
1259
+ w("span", null, b(D(e)("inventory.changelog.fabLabel")), 1)
1260
+ ], 42, mo)
1261
+ ]),
1262
+ _: 1
1263
+ })
1264
+ ], 6),
1265
+ I(co, {
1266
+ modelValue: s.value,
1267
+ "onUpdate:modelValue": y[0] || (y[0] = (T) => s.value = T)
1268
+ }, null, 8, ["modelValue"])
1269
+ ], 64)) : E("", !0)
1270
+ ]);
1271
+ };
1272
+ }
1273
+ }), go = { class: "flex items-center gap-8" }, yo = { class: "flex flex-col gap-8 text-fm-color-typo-secondary" }, ho = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary" }, _o = /* @__PURE__ */ ue({
1274
+ __name: "DeprecateSoonWarningDialog",
1275
+ props: /* @__PURE__ */ Ue({
1276
+ featureName: {}
1277
+ }, {
1278
+ modelValue: { type: Boolean, required: !0 },
1279
+ modelModifiers: {}
1280
+ }),
1281
+ emits: /* @__PURE__ */ Ue(["proceed"], ["update:modelValue"]),
1282
+ setup(o, { emit: e }) {
1283
+ const t = bt(o, "modelValue"), l = e;
1284
+ function s() {
1285
+ t.value = !1, l("proceed");
1286
+ }
1287
+ return (a, r) => {
1288
+ const u = W("FmSpacer"), v = W("FmButton"), p = W("FmDialog");
1289
+ return i(), ie(p, {
1290
+ modelValue: t.value,
1291
+ "onUpdate:modelValue": r[1] || (r[1] = (L) => t.value = L),
1292
+ overlay: !0,
1293
+ "close-button": "",
1294
+ dismissAway: "",
1295
+ "max-width": "520px"
1296
+ }, {
1297
+ "dialog-header": le(() => [
1298
+ w("div", go, [
1299
+ r[2] || (r[2] = w("span", null, "Feature removal notice", -1)),
1300
+ I(Ut)
1301
+ ])
1302
+ ]),
1303
+ "dialog-footer": le(() => [
1304
+ I(u, { class: "sm:hidden xs:hidden" }),
1305
+ I(v, {
1306
+ variant: "tertiary",
1307
+ label: "Cancel",
1308
+ onClick: r[0] || (r[0] = (L) => t.value = !1)
1309
+ }),
1310
+ I(v, {
1311
+ label: "Continue",
1312
+ onClick: s
1313
+ })
1314
+ ]),
1315
+ default: le(() => [
1316
+ w("div", yo, [
1317
+ w("p", ho, b(a.featureName ?? "This feature") + " will be removed in a future release. ", 1),
1318
+ r[3] || (r[3] = w("p", { class: "fm-typo-en-body-sm-400" }, " You can continue to use it for now, but we recommend moving to the supported workflow. ", -1))
1319
+ ])
1320
+ ]),
1321
+ _: 1
1322
+ }, 8, ["modelValue"]);
1323
+ };
1324
+ }
1325
+ }), bo = { class: "h-full flex flex-col overflow-auto py-16 gap-2" }, xo = /* @__PURE__ */ ue({
1326
+ __name: "NavigationTab",
1327
+ setup(o) {
1328
+ const e = Ct(), t = Ne(), l = ge(), s = Ot(), a = At(), r = x(!1), u = x(null), v = x(null), p = x(!1), L = x(null), F = x(null), B = V(
1329
+ () => {
1330
+ var y, S;
1331
+ return (S = Oe(((y = L.value) == null ? void 0 : y.featureKey) ?? "")) == null ? void 0 : S.label;
1332
+ }
1333
+ ), { menuItems: K } = Ye();
1334
+ Z([() => l.currentBusiness.value, () => e.name], ([y, S]) => {
1335
+ (y == null ? void 0 : y.menuVersion) === "v3" && (S === me.INGREDIENTS || S === me.RECIPE || S === me.UNIT) && t.push({ name: me.STOCK });
1336
+ });
1337
+ const Q = V({
1338
+ get() {
1339
+ if (e.name)
1340
+ return String(e.name);
1341
+ },
1342
+ set(y) {
1343
+ var d;
1344
+ if (!y) return;
1345
+ const S = String(y), T = Dt.find((h) => h.route === S), O = Vt(S, s.value);
1346
+ if ((d = Oe((T == null ? void 0 : T.featureKey) ?? "")) != null && d.deprecateSoon) {
1347
+ L.value = T ?? null, F.value = S, p.value = !0;
1348
+ return;
1349
+ }
1350
+ if (T && O.disabled) {
1351
+ u.value = T, v.value = O, r.value = !0;
1352
+ return;
1353
+ }
1354
+ t.push({ name: S });
1355
+ }
1356
+ });
1357
+ function U() {
1358
+ F.value && (t.push({ name: F.value }), F.value = null);
1359
+ }
1360
+ const $ = V(
1361
+ () => {
1362
+ var y;
1363
+ return `NavigationTab.${(y = l.currentBusiness.value) == null ? void 0 : y._id}`;
1364
+ }
1365
+ ), G = x(!1), C = V({
1366
+ get() {
1367
+ return G.value;
1368
+ },
1369
+ set(y) {
1370
+ G.value = y, y || a.setItem($.value, "true");
1371
+ }
1372
+ });
1373
+ return Z([() => $.value], () => {
1374
+ G.value = !1, setTimeout(() => {
1375
+ C.value = !a.getItem($.value);
1376
+ }, 2e3);
1377
+ }), (y, S) => {
1378
+ const T = W("FmCollapsibleTabs");
1379
+ return i(), m("div", bo, [
1380
+ I(T, {
1381
+ modelValue: Q.value,
1382
+ "onUpdate:modelValue": S[0] || (S[0] = (O) => Q.value = O),
1383
+ items: D(K)
1384
+ }, null, 8, ["modelValue", "items"]),
1385
+ I(Mt, {
1386
+ modelValue: r.value,
1387
+ "onUpdate:modelValue": S[1] || (S[1] = (O) => r.value = O),
1388
+ capability: u.value,
1389
+ result: v.value
1390
+ }, null, 8, ["modelValue", "capability", "result"]),
1391
+ I(_o, {
1392
+ modelValue: p.value,
1393
+ "onUpdate:modelValue": S[2] || (S[2] = (O) => p.value = O),
1394
+ "feature-name": B.value,
1395
+ onProceed: U
1396
+ }, null, 8, ["modelValue", "feature-name"])
1397
+ ]);
1398
+ };
1399
+ }
1400
+ });
1401
+ typeof Promise.withResolvers > "u" && (Promise.withResolvers = () => {
1402
+ let o, e;
1403
+ return { promise: new Promise((l, s) => {
1404
+ o = l, e = s;
1405
+ }), resolve: o, reject: e };
1406
+ });
1407
+ typeof Promise.prototype.delayed > "u" && (Promise.prototype.delayed = async function(o) {
1408
+ return await new Promise((e) => setTimeout(e, o)), Promise.resolve(this);
1409
+ });
1410
+ const wo = {
1411
+ key: 0,
1412
+ class: "flex h-5 items-center justify-center bg-amber-100 px-12 text-xs font-medium text-amber-800 shadow-sm"
1413
+ }, zo = /* @__PURE__ */ ue({
1414
+ __name: "App",
1415
+ setup(o) {
1416
+ const e = ge(), t = Kt(), l = $t(), s = window.location.href.includes("print-preview");
1417
+ Ie(() => {
1418
+ if (window.location.href.includes("print-preview")) {
1419
+ e.setEmbedded(!0), document.body.classList.add("print-mode");
1420
+ return;
1421
+ }
1422
+ e.registerSidebarComponent(xo), t.initGoogleMap(l.appApi.googleMap).catch(() => {
1423
+ console.error("Google map cannot be loaded");
1424
+ });
1425
+ }), Z([() => e.currentCountry.value], () => {
1426
+ a();
1427
+ });
1428
+ async function a() {
1429
+ var r;
1430
+ try {
1431
+ await e.readBusinesses(), e.currentBusiness.value = (r = e.businesses.value) == null ? void 0 : r.find((u) => u);
1432
+ } catch (u) {
1433
+ console.error("error when trying to reset businesses:", u);
1434
+ }
1435
+ }
1436
+ return (r, u) => (i(), m(J, null, [
1437
+ D(l).isDev && !D(s) ? (i(), m("div", wo, " Non-production environment ")) : E("", !0),
1438
+ I(qt),
1439
+ D(s) ? E("", !0) : (i(), ie(vo, { key: 1 }))
1440
+ ], 64));
1441
+ }
1442
+ });
1443
+ export {
1444
+ zo as default
1445
+ };