@feedmepos/mf-inventory-portal 0.0.23-dev.28 → 0.0.23-dev.3

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 (114) hide show
  1. package/dist/{App-DRBjtrVV.js → App-BREfwtck.js} +73 -85
  2. package/dist/{ApprovalView-OzaufzMA.js → ApprovalView-DCzLx24G.js} +27 -24
  3. package/dist/{BindingsDialog-DQwWNg1N.js → BindingsDialog-CUcC8lue.js} +4 -4
  4. package/dist/{BindingsPicker-DSYOkBTy.js → BindingsPicker-3VOdZBWI.js} +9 -8
  5. package/dist/{BindingsTable-BB39IdFU.js → BindingsTable-D5Lt6GOO.js} +22 -18
  6. package/dist/{ClosingTemplateView-Dk5TTe31.js → ClosingTemplateView-CukthwOo.js} +286 -272
  7. package/dist/FmDroppableField-8RzKjEdL.js +154 -0
  8. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dwb3eBLo.js +267 -0
  9. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CvtvzIt1.js +436 -0
  10. package/dist/FmMultiselectDialog-CKBcMDGC.js +415 -0
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-qqudhwEN.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DigsIOB0.js} +114 -116
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-g1RpNK-0.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DweLQVwq.js} +5 -5
  13. package/dist/{IngredientGroupView-CREz-Vh2.js → IngredientGroupView-CkD8x2CP.js} +69 -63
  14. package/dist/IngredientsView-DuK4YSD6.js +1613 -0
  15. package/dist/{IntegrationView-3cA_x_gB.js → IntegrationView-BfeV07OO.js} +95 -92
  16. package/dist/{InventoryBindingForm-DDS19Q0p.js → InventoryBindingForm-BsSmth0U.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-5elMjhnH.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CMV5e99K.js} +27 -25
  18. package/dist/{InventoryBindingSummary-HSClvlZ5.js → InventoryBindingSummary-BHloDawE.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-ni8Q5uWj.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BjddpTCS.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-ClmXXhpb.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BZBa_99i.js} +24 -23
  21. package/dist/{PurchaseOrderPrintPreview-wKM6u0Ci.js → PurchaseOrderPrintPreview-CTdd-RuH.js} +14 -13
  22. package/dist/ReceiveRequestView-CgWNaYs1.js +4104 -0
  23. package/dist/{RecipeView-DJzDyKB5.js → RecipeView-CrmDQdc5.js} +85 -79
  24. package/dist/{StockView-DO4ys9XN.js → StockView-Xb3fQaiD.js} +1446 -1338
  25. package/dist/{SupplierView-BIJkWdt4.js → SupplierView-CrtIiaz0.js} +787 -2325
  26. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +135 -0
  27. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C9H41eg7.js +1189 -0
  28. package/dist/TransferTemplateView-Cc7VRbZ7.js +1262 -0
  29. package/dist/{UnitView-DJoSWs6g.js → UnitView-C6BgrZ1G.js} +44 -40
  30. package/dist/{WarehouseView-C8YZTOZd.js → WarehouseView-Hhd76ybU.js} +100 -94
  31. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  32. package/dist/api/bill.d.ts +2 -2
  33. package/dist/api/closing.d.ts +0 -1
  34. package/dist/api/netsuite.d.ts +1 -1
  35. package/dist/app-CwUHqg7h.js +33462 -0
  36. package/dist/app.d.ts +0 -56
  37. package/dist/app.js +2 -2
  38. package/dist/components/FmMinMaxInputRules.d.ts +1 -4
  39. package/dist/components/FmMultiselectDialogProps.d.ts +0 -1
  40. package/dist/components/row-action.enum.d.ts +0 -1
  41. package/dist/composable/defineDeepModel.d.ts +1 -1
  42. package/dist/date2-CHNm4ELK.js +117 -0
  43. package/dist/dayjs.min-FE3dpxHU.js +282 -0
  44. package/dist/{decimal-0QwuGxcA.js → decimal-rPKr5T-H.js} +1 -1
  45. package/dist/defineDeepModel-Dc1zZzOi.js +13 -0
  46. package/dist/{feature-Q0gPMHLe.js → feature-z95vJnA1.js} +9 -23
  47. package/dist/format-time-from-id-CaPj8EHN.js +15 -0
  48. package/dist/format-unit-display-Bkz5kW6p.js +1198 -0
  49. package/dist/fuzzy-DXqhGaFi.js +41 -0
  50. package/dist/index-BMJHz32O.js +22277 -0
  51. package/dist/index-Be5vGZdr.js +45 -0
  52. package/dist/index-D2juQPg6.js +10545 -0
  53. package/dist/netsuite-P0as0Moa.js +194 -0
  54. package/dist/normalizeArguments-DP7Hrren.js +1552 -0
  55. package/dist/router/name.d.ts +0 -2
  56. package/dist/row-action.enum-PMKMRrZR.js +50 -0
  57. package/dist/rules-BQz4NGht.js +198 -0
  58. package/dist/stores/feature.d.ts +0 -2
  59. package/dist/stores/integration/netsuite.d.ts +1 -69
  60. package/dist/stores/inventory.d.ts +4 -1
  61. package/dist/style.css +1 -1
  62. package/dist/{supplier-xeNz-LFV.js → supplier-BixmjZyl.js} +15 -15
  63. package/dist/tsconfig.app.tsbuildinfo +1 -1
  64. package/dist/{use-inventory-binding-dialog-WCVWoWcc.js → use-inventory-binding-dialog-BRygbm1p.js} +11 -10
  65. package/dist/use-template-enabled-locations-2-Dd15d-ng.js +86 -0
  66. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +192 -24
  67. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +193 -25
  68. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +34 -34
  69. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +0 -1
  70. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +54 -54
  71. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +54 -54
  72. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  73. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
  74. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  75. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +8 -8
  76. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +96 -96
  77. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +96 -96
  78. package/dist/xlsx-k2Rf0NcF.js +24004 -0
  79. package/dist/xlsx.util-CJxPf7XZ.js +78 -0
  80. package/package.json +2 -2
  81. package/dist/ClosingDraftView-CF3wn51T.js +0 -1190
  82. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-vvfsYTGA.js +0 -282
  83. package/dist/IngredientsView-DzI9vr-u.js +0 -1657
  84. package/dist/ReceiveRequestView-CTk9r1bA.js +0 -4188
  85. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-KSBV1U_z.js +0 -1227
  86. package/dist/TransferTemplateView-CDUNWRLQ.js +0 -1264
  87. package/dist/api/adjustment-template.d.ts +0 -23
  88. package/dist/api/closing-draft.d.ts +0 -6
  89. package/dist/app-CYk4J4VK.js +0 -84180
  90. package/dist/format-unit-display-BIMHakYl.js +0 -1207
  91. package/dist/index-BQjj0Tdx.js +0 -12087
  92. package/dist/stock-ahRK16Qq.js +0 -110
  93. package/dist/views/adjustment-template/import/AdjustmentTemplateImport.vue.d.ts +0 -2
  94. package/dist/views/adjustment-template/import/AdjustmentTemplateImportItem.vue.d.ts +0 -18
  95. package/dist/views/adjustment-template/import/export.d.ts +0 -60
  96. package/dist/views/adjustment-template/wastage-template/WastageTemplateDetails.vue.d.ts +0 -2
  97. package/dist/views/adjustment-template/wastage-template/WastageTemplateDialog.vue.d.ts +0 -22
  98. package/dist/views/adjustment-template/wastage-template/WastageTemplatePublish.vue.d.ts +0 -6
  99. package/dist/views/adjustment-template/wastage-template/WastageTemplateView.vue.d.ts +0 -2
  100. package/dist/views/adjustment-template/wastage-template/actions.d.ts +0 -1295
  101. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateForm.vue.d.ts +0 -16
  102. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +0 -35
  103. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +0 -20
  104. package/dist/views/adjustment-template/wastage-template/props.d.ts +0 -29
  105. package/dist/views/adjustment-template/wastage-template/table.d.ts +0 -1273
  106. package/dist/views/closing-draft/ClosingDraftView.vue.d.ts +0 -2
  107. package/dist/views/closing-draft/components/closing-draft-action/ClosingDraftAction.vue.d.ts +0 -22
  108. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +0 -621
  109. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +0 -25
  110. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +0 -3621
  111. package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +0 -1
  112. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +0 -19
  113. package/dist/views/closing-draft/helpers/get-calculated-total.helper.d.ts +0 -4
  114. package/dist/views/receive-request/helper/check-netsuite-subsidiary.helper.d.ts +0 -1
@@ -0,0 +1,154 @@
1
+ import { defineComponent as U, ref as d, computed as y, resolveComponent as k, openBlock as s, createElementBlock as c, createElementVNode as p, createCommentVNode as S, renderSlot as u, createBlock as C, normalizeClass as f, toDisplayString as F, unref as B } from "vue";
2
+ import { useI18n as W } from "@feedmepos/mf-common";
3
+ import { _ as q } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
+ const G = {
5
+ key: 0,
6
+ class: "relative"
7
+ }, H = ["accept", "disabled"], J = { class: "flex flex-col gap-8" }, K = ["accept", "disabled"], M = /* @__PURE__ */ U({
8
+ __name: "FmDroppableField",
9
+ props: {
10
+ buttonLabel: {},
11
+ label: { default: "" },
12
+ disabled: { type: Boolean, default: !1 },
13
+ accept: { default: "" },
14
+ maxFileSize: { default: 8e6 },
15
+ contentClass: {}
16
+ },
17
+ emits: ["file-upload", "file-rejected"],
18
+ setup(T, { emit: V }) {
19
+ const l = T, g = V, { t: r } = W(), t = d(!1), i = d(null), n = d(null), m = d(), R = (e) => {
20
+ l.disabled || (e.stopPropagation(), e.preventDefault());
21
+ }, $ = (e) => {
22
+ l.disabled || (e.stopPropagation(), e.preventDefault(), t.value = !0);
23
+ }, j = (e) => {
24
+ l.disabled || (e.stopPropagation(), e.preventDefault(), t.value = !1);
25
+ }, E = (e) => {
26
+ var a;
27
+ l.disabled || (e.stopPropagation(), e.preventDefault(), t.value = !1, h((a = e.dataTransfer) == null ? void 0 : a.files));
28
+ };
29
+ function h(e) {
30
+ if (e)
31
+ if (m.value = e, i.value = I(e[0]), n.value = P(e[0]), i.value && n.value)
32
+ g("file-upload", e[0]);
33
+ else {
34
+ const a = L();
35
+ g("file-rejected", [
36
+ {
37
+ file: e[0],
38
+ reason: a
39
+ }
40
+ ]);
41
+ }
42
+ }
43
+ const L = () => {
44
+ const e = new Array();
45
+ return i.value || e.push("invalid-type"), n.value || e.push("invalid-size"), e;
46
+ }, I = (e) => {
47
+ if (!l.accept) return !0;
48
+ const a = l.accept.split(",").map((o) => o.trim());
49
+ for (const o of a)
50
+ if (w(o)) {
51
+ if (D(o) === D(e.type)) return !0;
52
+ } else if (A(e) === o || e.type === o) return !0;
53
+ return !1;
54
+ }, P = (e) => e.size <= l.maxFileSize, w = (e) => e.indexOf("*") !== -1, A = (e) => "." + e.name.split(".").pop(), D = (e) => e.substring(0, e.indexOf("/")), O = y(() => {
55
+ if (t.value) return r("inventory.formField.dropField.dropToUpload");
56
+ if (i.value) {
57
+ if (!n.value)
58
+ return r("inventory.formField.dropField.fileSizeExceeded", { size: l.maxFileSize });
59
+ } else return r("inventory.formField.dropField.invalidFileType");
60
+ return "";
61
+ }), v = y(() => m.value ? !i.value || !n.value : !1), _ = (e) => {
62
+ const a = e.target;
63
+ h(a.files);
64
+ }, N = y(() => {
65
+ var e;
66
+ return (e = m.value) == null ? void 0 : e.item(0);
67
+ }), b = d();
68
+ return (e, a) => {
69
+ const o = k("FmLabel"), x = k("FmButton");
70
+ return s(), c("label", {
71
+ class: "fm-droppable-field",
72
+ ref_key: "fmButtonRef",
73
+ ref: b
74
+ }, [
75
+ e.$slots.default ? (s(), c("div", G, [
76
+ p("input", {
77
+ accept: e.accept,
78
+ disabled: e.disabled,
79
+ class: "fm-droppable-field__input",
80
+ type: "file",
81
+ onChange: _
82
+ }, null, 40, H)
83
+ ])) : S("", !0),
84
+ u(e.$slots, "default", {
85
+ isDragging: t.value,
86
+ isValidFileType: i.value,
87
+ isValidFileSize: n.value,
88
+ singleValidFile: N.value,
89
+ openFileDialog: () => {
90
+ var z;
91
+ return console.log("click", b.value), (z = b.value) == null ? void 0 : z.click();
92
+ }
93
+ }, () => [
94
+ p("div", J, [
95
+ e.$slots.label ? u(e.$slots, "label", { key: 0 }, void 0, !0) : (s(), C(o, {
96
+ key: 1,
97
+ label: e.label
98
+ }, null, 8, ["label"]))
99
+ ]),
100
+ p("div", {
101
+ class: f([[
102
+ e.contentClass ? e.contentClass : "w-full h-full",
103
+ {
104
+ "fm-droppable-field__container--dragging": t.value,
105
+ "fm-droppable-field__container--invalid": v.value && !e.disabled,
106
+ "fm-droppable-field__container--disabled": e.disabled
107
+ }
108
+ ], "fm-droppable-field__container"]),
109
+ onDragenter: R,
110
+ onDragleave: j,
111
+ onDragover: $,
112
+ onDrop: E
113
+ }, [
114
+ (t.value || v.value) && !e.disabled ? (s(), c("div", {
115
+ key: 0,
116
+ class: f({
117
+ "fm-typo-en-body-lg-600": !0,
118
+ "text-fm-color-primary": t.value,
119
+ "text-fm-color-typo-error": v.value
120
+ })
121
+ }, F(O.value), 3)) : (s(), C(x, {
122
+ key: 1,
123
+ disabled: e.disabled,
124
+ label: e.buttonLabel ?? "Add files",
125
+ size: "md",
126
+ variant: "secondary"
127
+ }, null, 8, ["disabled", "label"])),
128
+ u(e.$slots, "accept-text", {}, () => [
129
+ l.accept ? (s(), c("div", {
130
+ key: 0,
131
+ class: f([[e.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"], "fm-typo-en-body-md-400"])
132
+ }, F(B(r)("inventory.formField.dropField.accepts", { fileTypes: e.accept })), 3)) : S("", !0)
133
+ ], !0),
134
+ p("input", {
135
+ accept: e.accept,
136
+ disabled: e.disabled,
137
+ class: "fm-droppable-field__input",
138
+ type: "file",
139
+ onChange: _
140
+ }, null, 40, K)
141
+ ], 34),
142
+ u(e.$slots, "helper-text", {}, () => [
143
+ p("div", {
144
+ class: f([[e.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"], "fm-typo-en-body-sm-400"])
145
+ }, F(B(r)("inventory.formField.dropField.maxSize", { size: e.maxFileSize })), 3)
146
+ ], !0)
147
+ ], !0)
148
+ ], 512);
149
+ };
150
+ }
151
+ }), Z = /* @__PURE__ */ q(M, [["__scopeId", "data-v-e121b2c1"]]);
152
+ export {
153
+ Z as F
154
+ };
@@ -0,0 +1,267 @@
1
+ import { r as I, u as B, I as D, y as R, z as V } from "./app-CwUHqg7h.js";
2
+ import { a as P, t as H } from "./rules-BQz4NGht.js";
3
+ import { u as j } from "./supplier-BixmjZyl.js";
4
+ import { P as S } from "./format-unit-display-Bkz5kW6p.js";
5
+ import { computed as y, defineComponent as $, mergeModels as W, useModel as J, resolveComponent as w, openBlock as F, createElementBlock as A, normalizeStyle as K, createElementVNode as N, createVNode as Q, withCtx as X, createBlock as x, createCommentVNode as E, Fragment as Y, renderList as Z, unref as M } from "vue";
6
+ function oe(c, i, t, s) {
7
+ var b, g, u;
8
+ if (s != null && s.manualTotalCost)
9
+ return s == null ? void 0 : s.manualTotalCost;
10
+ const e = (u = (g = (b = s == null ? void 0 : s.supplier) == null ? void 0 : b.supplyItems) == null ? void 0 : g.find(
11
+ (r) => r.skuId === c._id
12
+ )) == null ? void 0 : u.defaultCost, o = c.defaultCost, n = e ?? o, l = n == null ? void 0 : n.costPerUnit, a = l ? n != null && n.measurement ? +P(l) / +P(n == null ? void 0 : n.measurement.conversion) : +P(l) : void 0, p = a ? t ? a * +P(t.conversion) : a : void 0, f = p ? +P(i) * p : void 0;
13
+ return f ? {
14
+ ...H(f ?? 0, 2),
15
+ currency: I()
16
+ } : {
17
+ amount: 0,
18
+ precision: 0,
19
+ currency: I()
20
+ };
21
+ }
22
+ function _(c) {
23
+ return R.parse(c);
24
+ }
25
+ function T(c) {
26
+ return {
27
+ _id: c.doc._id,
28
+ internal: c.type,
29
+ contactName: c.doc.profile.name,
30
+ name: c.doc.profile.name ?? "",
31
+ email: c.doc.profile.email,
32
+ phoneNumber: c.doc.profile.phoneNo,
33
+ registrationNumber: c.doc.profile.regNo,
34
+ address: c.doc.profile.address ?? {
35
+ line1: "",
36
+ state: "",
37
+ city: "",
38
+ postcode: "",
39
+ country: ""
40
+ }
41
+ };
42
+ }
43
+ function le(c, i, t = !1, s = !1) {
44
+ const e = j(), o = B();
45
+ o.watchLocation(async () => {
46
+ var v;
47
+ await e.readSuppliers();
48
+ const u = c();
49
+ if ((v = u.supplier) != null && v._id) return;
50
+ const r = s ? e.suppliers[0] : e.businessSuppliers[0], d = (t ? o.locations.filter((m) => m.doc._id !== o.currentLocation.doc._id) : o.locations)[0];
51
+ i({
52
+ ...u,
53
+ supplier: r ? _(r) : d ? T(d) : u.supplier
54
+ });
55
+ });
56
+ const n = y(
57
+ () => {
58
+ var u, r;
59
+ return typeof ((r = (u = c()) == null ? void 0 : u.supplier) == null ? void 0 : r.internal) == "string" ? S.TRANSFER : S.PURCHASE;
60
+ }
61
+ ), l = y({
62
+ get() {
63
+ var u, r;
64
+ return (r = (u = c()) == null ? void 0 : u.supplier) == null ? void 0 : r._id;
65
+ },
66
+ set(u) {
67
+ const r = c() ?? {};
68
+ if (n.value === S.PURCHASE) {
69
+ const C = (s ? e.suppliers : e.businessSuppliers).find((U) => U._id === u);
70
+ i({
71
+ ...r,
72
+ supplier: C ? _(C) : r.supplier
73
+ });
74
+ return;
75
+ }
76
+ const v = (t ? o.locations.filter((m) => m.doc._id !== o.currentLocation.doc._id) : o.locations).find((m) => m.doc._id === u);
77
+ i({
78
+ ...r,
79
+ supplier: v ? T(v) : r.supplier
80
+ });
81
+ }
82
+ }), a = y(() => e.locationSuppliers.map(_)), p = y(() => e.businessSuppliers.map(_)), f = y(() => {
83
+ const u = [...a.value], r = [...p.value];
84
+ return s ? [...r, ...u] : r;
85
+ }), k = y(() => {
86
+ var h;
87
+ const u = ((h = o._currentLocation) == null ? void 0 : h.type) === D.warehouse;
88
+ return (t ? o.locations.filter((d) => d.doc._id !== o.currentLocation.doc._id) : o.locations).filter((d) => u || d.acceptRequest).map(T);
89
+ }), b = y(() => {
90
+ if (n.value === S.PURCHASE) {
91
+ const r = a.value.map((d) => ({
92
+ label: d.name,
93
+ value: d._id
94
+ })), h = p.value.map((d) => ({
95
+ label: d.name,
96
+ sublabel: "Business supplier",
97
+ value: d._id
98
+ }));
99
+ return s ? [...r, ...h] : h;
100
+ }
101
+ return k.value.map((r) => ({
102
+ label: r.name,
103
+ sublabel: r.internal ? `${r.internal}` : void 0,
104
+ value: r._id
105
+ }));
106
+ }), g = y(() => {
107
+ var d, v;
108
+ const u = (v = (d = c()) == null ? void 0 : d.supplier) == null ? void 0 : v._id;
109
+ if (n.value === S.PURCHASE) {
110
+ const m = e.suppliers.find((C) => C._id === u);
111
+ return m ? _(m) : null;
112
+ }
113
+ const h = o.locations.find((m) => m.doc._id);
114
+ return h ? T(h) : null;
115
+ });
116
+ return {
117
+ transferLocationModel: l,
118
+ transferLocationOptions: b,
119
+ locationOptionsTypePurchase: f,
120
+ locationOptionsTypePurchaseLocationLevel: a,
121
+ locationOptionsTypeTransfer: k,
122
+ selectedLocation: g
123
+ };
124
+ }
125
+ class O {
126
+ static getDescendantProperty(i, t, s = []) {
127
+ let e, o, n, l, a, p;
128
+ if (t) {
129
+ if (n = t.indexOf("."), n === -1 ? e = t : (e = t.slice(0, n), o = t.slice(n + 1)), l = i[e], l !== null && typeof l < "u")
130
+ if (!o && (typeof l == "string" || typeof l == "number"))
131
+ s.push(l);
132
+ else if (Object.prototype.toString.call(l) === "[object Array]")
133
+ for (a = 0, p = l.length; a < p; a++)
134
+ O.getDescendantProperty(l[a], o, s);
135
+ else o && O.getDescendantProperty(l, o, s);
136
+ } else
137
+ s.push(i);
138
+ return s;
139
+ }
140
+ }
141
+ class L {
142
+ constructor(i = [], t = [], s = {}) {
143
+ Array.isArray(t) || (s = t, t = []), this.haystack = i, this.keys = t, this.options = Object.assign({
144
+ caseSensitive: !1,
145
+ sort: !1
146
+ }, s);
147
+ }
148
+ search(i = "") {
149
+ if (i === "")
150
+ return this.haystack;
151
+ const t = [];
152
+ for (let s = 0; s < this.haystack.length; s++) {
153
+ const e = this.haystack[s];
154
+ if (this.keys.length === 0) {
155
+ const o = L.isMatch(e, i, this.options.caseSensitive);
156
+ o && t.push({ item: e, score: o });
157
+ } else
158
+ for (let o = 0; o < this.keys.length; o++) {
159
+ const n = O.getDescendantProperty(e, this.keys[o]);
160
+ let l = !1;
161
+ for (let a = 0; a < n.length; a++) {
162
+ const p = L.isMatch(n[a], i, this.options.caseSensitive);
163
+ if (p) {
164
+ l = !0, t.push({ item: e, score: p });
165
+ break;
166
+ }
167
+ }
168
+ if (l)
169
+ break;
170
+ }
171
+ }
172
+ return this.options.sort && t.sort((s, e) => s.score - e.score), t.map((s) => s.item);
173
+ }
174
+ static isMatch(i, t, s) {
175
+ i = String(i), t = String(t), s || (i = i.toLocaleLowerCase(), t = t.toLocaleLowerCase());
176
+ const e = L.nearestIndexesFor(i, t);
177
+ return e ? i === t ? 1 : e.length > 1 ? 2 + (e[e.length - 1] - e[0]) : 2 + e[0] : !1;
178
+ }
179
+ static nearestIndexesFor(i, t) {
180
+ const s = t.split("");
181
+ let e = [];
182
+ return L.indexesOfFirstLetter(i, t).forEach((n, l) => {
183
+ let a = n + 1;
184
+ e[l] = [n];
185
+ for (let p = 1; p < s.length; p++) {
186
+ const f = s[p];
187
+ if (a = i.indexOf(f, a), a === -1) {
188
+ e[l] = !1;
189
+ break;
190
+ }
191
+ e[l].push(a), a++;
192
+ }
193
+ }), e = e.filter((n) => n !== !1), e.length ? e.sort((n, l) => n.length === 1 ? n[0] - l[0] : (n = n[n.length - 1] - n[0], l = l[l.length - 1] - l[0], n - l))[0] : !1;
194
+ }
195
+ static indexesOfFirstLetter(i, t) {
196
+ const s = t[0];
197
+ return i.split("").map((e, o) => e !== s ? !1 : o).filter((e) => e !== !1);
198
+ }
199
+ }
200
+ const z = { class: "sticky top-0 bg-white mb-8" }, G = { class: "overflow-y-auto pb-8" }, ie = /* @__PURE__ */ $({
201
+ __name: "FmFilterableMenuOptions",
202
+ props: /* @__PURE__ */ W({
203
+ modelValue: {},
204
+ maxHeight: {},
205
+ width: {},
206
+ handleItemChange: { type: Function },
207
+ items: {},
208
+ options: {}
209
+ }, {
210
+ search: {},
211
+ searchModifiers: {}
212
+ }),
213
+ emits: ["update:search"],
214
+ setup(c) {
215
+ const i = c, t = J(c, "search"), s = y(
216
+ () => new L(i.items, ["label", "sublabel"], i.options)
217
+ ), e = y(() => s.value.search(t.value));
218
+ return (o, n) => {
219
+ const l = w("FmButton"), a = w("FmTextField"), p = w("FmMenuItem");
220
+ return F(), A("div", {
221
+ class: "relative",
222
+ style: K({ maxHeight: `${o.maxHeight}px`, width: o.width })
223
+ }, [
224
+ N("div", z, [
225
+ Q(a, {
226
+ modelValue: t.value,
227
+ "onUpdate:modelValue": n[1] || (n[1] = (f) => t.value = f),
228
+ placeholder: "Filter options"
229
+ }, {
230
+ append: X(() => [
231
+ t.value ? (F(), x(l, {
232
+ key: 0,
233
+ variant: "tertiary",
234
+ "prepend-icon": "close",
235
+ onClick: n[0] || (n[0] = (f) => t.value = "")
236
+ })) : E("", !0)
237
+ ]),
238
+ _: 1
239
+ }, 8, ["modelValue"])
240
+ ]),
241
+ N("div", G, [
242
+ (F(!0), A(Y, null, Z(e.value, (f, k) => (F(), x(p, {
243
+ key: k,
244
+ label: f.label,
245
+ sublabel: f.sublabel,
246
+ "model-value": M(V)(o.modelValue, f.value),
247
+ onClick: () => o.handleItemChange(M(V)(o.modelValue, f.value), f),
248
+ onVnodeMounted: (b) => {
249
+ var g;
250
+ return M(V)(o.modelValue, f.value) && ((g = b.el) == null || g.scrollIntoView({ behavior: "smooth", block: "center" }), console.log("scrollTo", b.el)), void 0;
251
+ }
252
+ }, null, 8, ["label", "sublabel", "model-value", "onClick", "onVnodeMounted"]))), 128)),
253
+ e.value.length ? E("", !0) : (F(), x(p, {
254
+ key: 0,
255
+ disabled: "",
256
+ label: "No options available"
257
+ }))
258
+ ])
259
+ ], 4);
260
+ };
261
+ }
262
+ });
263
+ export {
264
+ ie as _,
265
+ oe as c,
266
+ le as u
267
+ };