hplx-feature-library 1.0.172 → 1.0.173

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 (153) hide show
  1. package/dist/APIAction--DyoXs57.js +3752 -0
  2. package/dist/APIAction-B5XQnkiF.cjs +9 -0
  3. package/dist/AllInvestigations/index.js +1 -1
  4. package/dist/{AllInvestigationsTable-C7jrmW8z.js → AllInvestigationsTable-BxezFrCD.js} +5853 -6144
  5. package/dist/AllInvestigationsTable-C7uQ56B0.cjs +79 -0
  6. package/dist/Attachments/components/document-canvas/document-pen-tool.d.ts +1 -1
  7. package/dist/Attachments/components/drag-drop-overlay.d.ts +1 -1
  8. package/dist/Attachments/components/edit-document-modal.d.ts +1 -1
  9. package/dist/Attachments/components/uploading-toast.d.ts +1 -1
  10. package/dist/Attachments/context/index.d.ts +2 -2
  11. package/dist/Attachments/hooks/useDropdownPosition.d.ts +1 -1
  12. package/dist/Attachments/index.js +512 -534
  13. package/dist/CameraCapture/index.d.ts +1 -1
  14. package/dist/PatientAddEdit/index.js +1662 -0
  15. package/dist/PatientPopup/action/APIAction.d.ts +65 -0
  16. package/dist/PatientPopup/app/PatientPopupContainer.d.ts +6 -0
  17. package/dist/PatientPopup/app/PatientPopupContext.d.ts +30 -0
  18. package/dist/PatientPopup/common/common.d.ts +14 -0
  19. package/dist/PatientPopup/components/Lab/HPLXLab.d.ts +8 -0
  20. package/dist/PatientPopup/components/Lab/LISLab.d.ts +8 -0
  21. package/dist/PatientPopup/components/Lab/LabTable.d.ts +5 -0
  22. package/dist/PatientPopup/components/Lab/index.d.ts +5 -0
  23. package/dist/PatientPopup/components/Loader/Loader.d.ts +2 -0
  24. package/dist/PatientPopup/components/Pagination.d.ts +9 -0
  25. package/dist/PatientPopup/components/Profile/Abha.d.ts +11 -0
  26. package/dist/PatientPopup/components/Profile/PatientDetailsModal.d.ts +1 -0
  27. package/dist/PatientPopup/components/Profile/Profile.d.ts +11 -0
  28. package/dist/PatientPopup/components/Profile/Sms.d.ts +2 -0
  29. package/dist/PatientPopup/components/Visits/Table.d.ts +11 -0
  30. package/dist/PatientPopup/components/Visits/index.d.ts +15 -0
  31. package/dist/PatientPopup/components/addBills/AddBillFooter.d.ts +2 -0
  32. package/dist/PatientPopup/components/addBills/AddBills.d.ts +5 -0
  33. package/dist/PatientPopup/components/addBills/AddBillsTable.d.ts +17 -0
  34. package/dist/PatientPopup/components/addBills/DropDown.d.ts +15 -0
  35. package/dist/PatientPopup/components/appointment/AllAppts.d.ts +8 -0
  36. package/dist/PatientPopup/components/appointment/Appointment.d.ts +2 -0
  37. package/dist/PatientPopup/components/appointment/AppointmentsTable.d.ts +10 -0
  38. package/dist/PatientPopup/components/bills/Bills.d.ts +6 -0
  39. package/dist/PatientPopup/components/bills/BillsTable.d.ts +11 -0
  40. package/dist/PatientPopup/components/deposit/DepositSection.d.ts +9 -0
  41. package/dist/PatientPopup/components/mainNavItem/MainNavItem.d.ts +13 -0
  42. package/dist/PatientPopup/components/patientPopupBody/PatientPopupBody.d.ts +8 -0
  43. package/dist/PatientPopup/components/patientPopupHeader/PatientPopupHeader.d.ts +10 -0
  44. package/dist/PatientPopup/components/patientPopupSummary/BillSummary.d.ts +19 -0
  45. package/dist/PatientPopup/components/patientPopupSummary/ConsultationDetails.d.ts +14 -0
  46. package/dist/PatientPopup/components/patientPopupSummary/DeleteItem.d.ts +11 -0
  47. package/dist/PatientPopup/components/patientPopupSummary/DepositRefundSummary.d.ts +8 -0
  48. package/dist/PatientPopup/components/patientPopupSummary/LabServiceDetails.d.ts +13 -0
  49. package/dist/PatientPopup/components/patientPopupSummary/OtherServiceDetails.d.ts +13 -0
  50. package/dist/PatientPopup/components/patientPopupSummary/PatientPopupSummary.d.ts +8 -0
  51. package/dist/PatientPopup/components/patientPopupSummary/PaymentCard.d.ts +25 -0
  52. package/dist/PatientPopup/components/patientPopupSummary/ServiceLevelBillSummary.d.ts +18 -0
  53. package/dist/PatientPopup/components/payments/DepositRefundTable.d.ts +14 -0
  54. package/dist/PatientPopup/components/payments/OtherServicesTable.d.ts +16 -0
  55. package/dist/PatientPopup/components/payments/PaymentEditModal.d.ts +15 -0
  56. package/dist/PatientPopup/components/payments/PaymentHeader.d.ts +7 -0
  57. package/dist/PatientPopup/components/payments/Payments.d.ts +5 -0
  58. package/dist/PatientPopup/components/payments/PaymentsTable.d.ts +14 -0
  59. package/dist/PatientPopup/constants/AppConstants.d.ts +123 -0
  60. package/dist/PatientPopup/index.d.ts +1 -0
  61. package/dist/PatientPopup/index.js +135376 -0
  62. package/dist/PatientPopup/types/hplxAPITypes.d.ts +37 -0
  63. package/dist/PatientPopup/utils/PrintFontLoader.d.ts +4 -0
  64. package/dist/PatientPopup/utils/helperFunctions.d.ts +3 -0
  65. package/dist/PediatricsCalculator/components/PediatricsCalculatorTableContext.d.ts +1 -1
  66. package/dist/PediatricsCalculator/index.js +1 -1
  67. package/dist/PediatricsCalculatorTable-B4fTy1J5.cjs +9 -0
  68. package/dist/PediatricsCalculatorTable-C4HGNrjE.js +1167 -0
  69. package/dist/ReusableModal-CIgDYOWZ.cjs +1 -0
  70. package/dist/ReusableModal-pSi21hnc.js +29 -0
  71. package/dist/ReusableTable/context/TableContextBase.d.ts +1 -1
  72. package/dist/Subscription/components/SubscriptionBadge.d.ts +2 -0
  73. package/dist/TrendGraphs/context/index.d.ts +1 -1
  74. package/dist/changePasswordModal/APIAction/APIActions.d.ts +8 -0
  75. package/dist/changePasswordModal/component/ChangePasswordModal.d.ts +14 -0
  76. package/dist/clsx-C11secjj.cjs +1 -0
  77. package/dist/clsx-OuTLNxxd.js +16 -0
  78. package/dist/common/APIAction/APIAction.d.ts +28 -0
  79. package/dist/common/components/BorderFullWidth.d.ts +2 -0
  80. package/dist/common/components/table/ExistingPatients.d.ts +17 -0
  81. package/dist/common/editRibbon/EditRibbon.d.ts +9 -0
  82. package/dist/common/utils/NetworkInstance.d.ts +4 -0
  83. package/dist/common/utils/common-utils.d.ts +36 -0
  84. package/dist/components/CustomDropdown.d.ts +1 -1
  85. package/dist/components/PatientAddEdit.d.ts +3 -0
  86. package/dist/constants/CommonConstant.d.ts +70 -0
  87. package/dist/dayjs.min-BbV4duaj.js +284 -0
  88. package/dist/dayjs.min-DXp74Ozx.cjs +1 -0
  89. package/dist/fonts/AnekMalayalam-Bold.ttf +0 -0
  90. package/dist/fonts/AnekMalayalam-Regular.ttf +0 -0
  91. package/dist/fonts/Arial-Bold-Italic.ttf +0 -0
  92. package/dist/fonts/Arial-Bold.ttf +0 -0
  93. package/dist/fonts/Arial-Italic.ttf +0 -0
  94. package/dist/fonts/Arial.ttf +0 -0
  95. package/dist/fonts/IndianRupee.ttf +0 -0
  96. package/dist/fonts/MuktaMaheePunjabi-Bold.ttf +0 -0
  97. package/dist/fonts/MuktaMaheePunjabi-Regular.ttf +0 -0
  98. package/dist/fonts/Noto-Sans-Telugu-Bold.ttf +0 -0
  99. package/dist/fonts/Noto-Sans-Telugu-Regular.ttf +0 -0
  100. package/dist/fonts/NotoNastaliqUrdu-Bold.ttf +0 -0
  101. package/dist/fonts/NotoNastaliqUrdu-Regular.ttf +0 -0
  102. package/dist/fonts/NotoSansArabic-Bold.ttf +0 -0
  103. package/dist/fonts/NotoSansArabic.ttf +0 -0
  104. package/dist/fonts/NotoSansHindi-Bold.ttf +0 -0
  105. package/dist/fonts/NotoSansHindi.ttf +0 -0
  106. package/dist/fonts/NotoSansKannada-Bold.ttf +0 -0
  107. package/dist/fonts/NotoSansKannada.ttf +0 -0
  108. package/dist/fonts/NotoSansOriya-Bold.ttf +0 -0
  109. package/dist/fonts/NotoSansOriya.ttf +0 -0
  110. package/dist/fonts/NotoSansTamil-Bold.ttf +0 -0
  111. package/dist/fonts/NotoSansTamil.ttf +0 -0
  112. package/dist/fonts/NotoSerifGujarati-Bold.ttf +0 -0
  113. package/dist/fonts/NotoSerifGujarati-Regular.ttf +0 -0
  114. package/dist/fonts/Roboto-Regular.ttf +0 -0
  115. package/dist/fonts/Times-Bold-Italic.ttf +0 -0
  116. package/dist/fonts/Times-Bold.ttf +0 -0
  117. package/dist/fonts/Times-Italic.ttf +0 -0
  118. package/dist/fonts/Times.ttf +0 -0
  119. package/dist/fonts/TiroBangla-Bold.ttf +0 -0
  120. package/dist/fonts/TiroBangla-Regular.ttf +0 -0
  121. package/dist/fonts/Verdana-Bold-Italic.ttf +0 -0
  122. package/dist/fonts/Verdana-Bold.ttf +0 -0
  123. package/dist/fonts/Verdana-Italic.ttf +0 -0
  124. package/dist/fonts/Verdana.ttf +0 -0
  125. package/dist/hooks/useMediaQuery.d.ts +1 -0
  126. package/dist/hplx-feature-library.css +1 -1
  127. package/dist/index-DQlbIHh3.cjs +102 -0
  128. package/dist/index-DkA8S5IK.cjs +32 -0
  129. package/dist/index-sG1tIMJ6.js +7242 -0
  130. package/dist/index-vVtPa2-N.js +961 -0
  131. package/dist/index.js +2 -2
  132. package/dist/nineDots/NineDotsTypes.d.ts +22 -0
  133. package/dist/nineDots/NineDotsUtils.d.ts +3 -0
  134. package/dist/nineDots/nineDots.d.ts +3 -0
  135. package/dist/searchPatients/SearchPatients.d.ts +11 -0
  136. package/dist/types/APIEndPoints.d.ts +11 -0
  137. package/dist/types/ApiResponseTypes.d.ts +290 -0
  138. package/dist/types/CommonTypes.d.ts +255 -0
  139. package/dist/types/PatientAddEditTypes/index.js +1 -0
  140. package/dist/types/PatientAddEditTypes.d.ts +7 -0
  141. package/dist/types/PatientPopupTypes/index.js +1 -0
  142. package/dist/types/PatientPopupTypes.d.ts +836 -0
  143. package/dist/userProfile/APIAction/APIActions.d.ts +18 -0
  144. package/dist/userProfile/UserProfile.d.ts +18 -0
  145. package/dist/userProfile/UserProfileItem.d.ts +7 -0
  146. package/dist/warning-BozzKWdr.js +38 -0
  147. package/dist/warning-W0tkkrLJ.cjs +1 -0
  148. package/package.json +31 -5
  149. package/dist/AllInvestigationsTable-C3aTtdGN.cjs +0 -79
  150. package/dist/PediatricsCalculatorTable-Be2H_OXh.js +0 -2156
  151. package/dist/PediatricsCalculatorTable-fk_QinWG.cjs +0 -40
  152. package/dist/index-4whwJbrk.js +0 -6867
  153. package/dist/index-C6KQLMQs.cjs +0 -92
@@ -0,0 +1,1167 @@
1
+ import { j as e, b as $, O as Ee, K as oe, N as Re, d as ue, g as We } from "./index-sG1tIMJ6.js";
2
+ import be, { createContext as Ge, useContext as Ve, useState as G, useRef as pe, useMemo as re, useCallback as W, useEffect as Q, forwardRef as Pe, useImperativeHandle as Ke } from "react";
3
+ import { C_MedicineCalculatorList as _e, C_FrequencyDosageMap as Me, C_MedicineTypeList as we, C_MedicineFrequencyList as Se, C_DefaultMgKgFields as Je, C_DefaultMlKgFields as Ye, C_Table_Column_Name as Ue } from "./constants/PediatricsCalculatorConstants/index.js";
4
+ import { u as Xe } from "./useClickOutside-BjJyGTec.js";
5
+ import { u as Ze } from "./useOutsideClick-C4Q0aGuf.js";
6
+ import { M as Fe } from "./index-vVtPa2-N.js";
7
+ const Oe = Ge(null), $e = () => {
8
+ const a = Ve(Oe);
9
+ if (!a) throw new Error("usePediatricsCalculatorTableContext must be used inside a MedicineTableProvider");
10
+ return a;
11
+ }, Qe = ({
12
+ effectiveEditMode: a,
13
+ rowData: t,
14
+ isSavedToLibrary: g,
15
+ onSave: _,
16
+ onCancel: m,
17
+ onEdit: N,
18
+ onCheckboxToggle: i
19
+ }) => {
20
+ const { variant: C, externallyTriggeredEditMode: w, setRowToDelete: b, openPopupForRow: k } = $e();
21
+ return C === "standard" ? a ? /* @__PURE__ */ e.jsxs("div", { className: "hfl-grid hfl-grid-cols-[1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg ", children: [
22
+ /* @__PURE__ */ e.jsx(
23
+ "button",
24
+ {
25
+ className: "hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hfl-border-r-1 hover:hfl-bg-Primary-50",
26
+ onClick: _,
27
+ children: /* @__PURE__ */ e.jsx($, { variant: "Medium", type: "Text xs", className: "hfl-text-Blue_gray-800", children: "Save" })
28
+ }
29
+ ),
30
+ /* @__PURE__ */ e.jsx("button", { className: "hfl-px-3 hfl-py-2 hfl-text-Error-600 hover:hfl-bg-Error-50", onClick: m, children: /* @__PURE__ */ e.jsx($, { variant: "Medium", type: "Text xs", className: "", children: "Cancel" }) })
31
+ ] }) : /* @__PURE__ */ e.jsxs("div", { className: "hfl-grid hfl-grid-cols-[1fr_1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg", children: [
32
+ /* @__PURE__ */ e.jsx("button", { className: "hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hover:hfl-bg-Primary-50", onClick: N, children: /* @__PURE__ */ e.jsx($, { variant: "Medium", type: "Text xs", className: "", children: "Edit" }) }),
33
+ /* @__PURE__ */ e.jsx(
34
+ "button",
35
+ {
36
+ className: "hfl-px-3 hfl-py-2 hfl-text-Blue_gray-800 hfl-border-x-1 hover:hfl-bg-Primary-50",
37
+ onClick: () => k?.(t),
38
+ children: /* @__PURE__ */ e.jsx($, { variant: "Medium", type: "Text xs", className: "", children: "Copy" })
39
+ }
40
+ ),
41
+ /* @__PURE__ */ e.jsx(
42
+ "button",
43
+ {
44
+ className: "hx_delete hfl-px-3 hfl-py-2 hfl-text-Error-500 hover:hfl-bg-Error-50",
45
+ onClick: () => b?.(t.rowId)
46
+ }
47
+ )
48
+ ] }) : /* @__PURE__ */ e.jsx(
49
+ Ee,
50
+ {
51
+ disabled: !w,
52
+ text: "Save this to Pediatric Calculator Library ",
53
+ id: t.rowId,
54
+ size: "md",
55
+ onClick: i,
56
+ isMarked: g ?? !1,
57
+ checkboxClasses: "hfl-mt-2",
58
+ checkBoxInnerDivClasses: "hfl-text-Blue-600 hfl-bg-Blue-50"
59
+ },
60
+ t.rowId
61
+ );
62
+ };
63
+ function el(a) {
64
+ const { options: t, selectedOption: g, onChangeHandler: _ } = a;
65
+ return /* @__PURE__ */ e.jsx("div", { className: "hfl-flex hfl-gap-2 hfl-h-full hfl-items-center hfl-px-4 hfl-justify-center hfl-py-1", children: t?.map((m) => /* @__PURE__ */ e.jsx("div", { className: "hfl-bg-White hfl-rounded-lg", children: /* @__PURE__ */ e.jsx(
66
+ oe,
67
+ {
68
+ onClick: () => _ && _(m),
69
+ hierarchy: g?.label === m.label ? "Primary" : "Secondary-Grey",
70
+ size: "sm",
71
+ textField: m.label,
72
+ className: g?.label === m.label ? "hfl-bg-Blue-600" : ""
73
+ }
74
+ ) }, m.label)) });
75
+ }
76
+ const ll = "data:image/svg+xml,%3csvg%20width='10'%20height='6'%20viewBox='0%200%2010%206'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M0.480062%200.819173C0.650418%200.648817%200.92662%200.648817%201.09698%200.819173L4.71454%204.43674L8.3321%200.819173C8.50246%200.648817%208.77866%200.648817%208.94902%200.819173C9.11937%200.98953%209.11937%201.26573%208.94902%201.43609L5.023%205.36211C4.85264%205.53246%204.57644%205.53246%204.40608%205.36211L0.480062%201.43609C0.309706%201.26573%200.309706%200.98953%200.480062%200.819173Z'%20fill='%23667085'/%3e%3c/svg%3e";
77
+ function D(a) {
78
+ const {
79
+ label: t,
80
+ labelClassName: g,
81
+ hideDropdownIcon: _,
82
+ showClearOption: m,
83
+ isRequiredField: N,
84
+ btnClassName: i,
85
+ placeholder: C,
86
+ options: w,
87
+ selectedOption: b,
88
+ onChangeHandler: k,
89
+ inputValue: y,
90
+ inputChangeHandler: L,
91
+ onInputFocusOutEvent: B,
92
+ inputClassName: s,
93
+ isSearchable: p,
94
+ inputType: H,
95
+ showInput: M,
96
+ inputSuffix: S,
97
+ selectedLabel: X,
98
+ suffixPadding: V,
99
+ disableInputAutoSize: r,
100
+ selectedOptions: x,
101
+ isMulti: f,
102
+ dropDownItemClickHandler: u,
103
+ showToggle: z,
104
+ toggleChangeHandler: E,
105
+ selectedToggleOption: o,
106
+ toggleOptionsList: n,
107
+ border: I,
108
+ height: j,
109
+ disabled: T,
110
+ fieldColor: q,
111
+ errorMsg: l,
112
+ showErrorMsg: d,
113
+ placeholderStyle: c,
114
+ onInputKeyDown: F,
115
+ showEmptyDropdownPopup: A = !0,
116
+ isDropdownFixed: R = !1,
117
+ dropdownClassName: ce = "",
118
+ wrapperClass: de = "",
119
+ maxInputLength: fe,
120
+ alternateListBgStyle: te,
121
+ showLabelTooltip: v = !1,
122
+ labelToolTipContent: J = "",
123
+ inputContainerClasses: Z = "",
124
+ onInputFocus: le
125
+ } = a, [ee, ae] = G(!1), [ne, Le] = G(null), he = pe(null), me = pe(null), Ce = pe(null), ge = pe([]), Be = re(() => w?.filter((h) => h ? h.label.toLowerCase().includes((y ?? "").toLowerCase()) : void 0), [y, w]), [He, xe] = G(!1), ze = () => {
126
+ ae(!1), f && L && L(""), Le(null);
127
+ }, Ne = W(
128
+ (h) => {
129
+ h.stopPropagation(), T || ae((O) => !O);
130
+ },
131
+ [T]
132
+ ), Ie = (y?.length || 0) + 2 + Number(V || 0);
133
+ Ze(he, ze), Q(() => {
134
+ ne !== null && ge.current[ne] && ge.current[ne].scrollIntoView({ block: "nearest" });
135
+ }, [ne]);
136
+ const se = W(() => {
137
+ if (R && ee) {
138
+ const h = M ? me.current : Ce.current, O = he.current;
139
+ if (h && O) {
140
+ const Y = h.getBoundingClientRect();
141
+ O.style.position = "fixed", O.style.top = `${window.scrollY ? Y.bottom + window.scrollY : Y.bottom}px`, O.style.left = `${Y.left}px`, O.style.width = `${Y.width}px`;
142
+ }
143
+ }
144
+ }, [R, ee, M]);
145
+ Q(() => {
146
+ if (R)
147
+ return ee ? (se(), window.addEventListener("scroll", se, !0)) : window.removeEventListener("scroll", se, !0), () => {
148
+ window.removeEventListener("scroll", se, !0);
149
+ };
150
+ }, [R, se, ee]), Xe(he, () => {
151
+ He && B && B();
152
+ });
153
+ const Te = (h) => {
154
+ if (f && u) {
155
+ const O = x?.some((Y) => Y.value === h.value);
156
+ u(!!O, h);
157
+ }
158
+ }, qe = W(
159
+ async (h) => {
160
+ h.stopPropagation(), ee || ae(!0), le && await le();
161
+ },
162
+ [le, ee]
163
+ );
164
+ return /* @__PURE__ */ e.jsxs("div", { className: `hfl-relative hfl-inline-block hfl-text-left ${de || ""}`, children: [
165
+ !!t && /* @__PURE__ */ e.jsxs("div", { className: "hfl-text-Gray-700 hfl-mb-1 hfl-flex", children: [
166
+ /* @__PURE__ */ e.jsx($, { type: "Text sm", variant: "Medium", className: g || "", children: `${t}` }),
167
+ N && /* @__PURE__ */ e.jsx("span", { className: "hfl-ml-1 hfl-text-Error-600", children: "*" }),
168
+ v && /* @__PURE__ */ e.jsx(Re, { variant: "Right", text: J, theme: "dark", children: /* @__PURE__ */ e.jsx("i", { className: "hx_info-filled" }) })
169
+ ] }),
170
+ M ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
171
+ /* @__PURE__ */ e.jsxs(
172
+ "div",
173
+ {
174
+ className: `hfl-flex hfl-items-center hfl-shadow-xs hfl-px-2 ${Z || ""} ${I || "hfl-border-1"} hfl-rounded-lg hfl-overflow-x-auto ${l ? "hfl-border-Error-300" : "hfl-border-Gray-300"} ${j || "hfl-h-10"} ${T ? "!hfl-bg-Gray-50 !hfl-pointer-events-none" : q || "hfl-bg-White"} hover:hfl-border-Primary-300 hover:hfl-shadow-xs-primary`,
175
+ onClick: T ? () => {
176
+ } : Ne,
177
+ children: [
178
+ x?.map((h, O) => /* @__PURE__ */ e.jsxs(
179
+ "div",
180
+ {
181
+ className: "hfl-flex hfl-items-center hfl-bg-Blue-100 hfl-mr-2 hfl-py-1 hfl-px-2 hfl-rounded-sm hfl-font-inter-0 hfl-text-nowrap",
182
+ children: [
183
+ /* @__PURE__ */ e.jsx("span", { className: "hfl-pointer-events-none", children: h.label }),
184
+ /* @__PURE__ */ e.jsx(
185
+ "span",
186
+ {
187
+ onClick: (Y) => {
188
+ Y.stopPropagation(), Te(h);
189
+ },
190
+ className: "hx_close hfl-text-Gray-500 hfl-my-0 hfl-text-[14px] hfl-ml-[1px] hfl-cursor-pointer"
191
+ }
192
+ )
193
+ ]
194
+ },
195
+ `${h.label}-${O}`
196
+ )),
197
+ Object.keys(c || {}).length > 0 && /* @__PURE__ */ e.jsx("style", { children: `
198
+ input.input-placeholder::placeholder {
199
+ font-family: ${c?.fontFamily};
200
+ font-weight: ${c?.fontWeight};
201
+ line-height: ${c?.lineHeight};
202
+ font-size: ${c?.fontSize};
203
+ color: ${c?.color};
204
+ }
205
+ ` }),
206
+ /* @__PURE__ */ e.jsx(
207
+ "input",
208
+ {
209
+ ref: me,
210
+ style: r ? {} : { width: `${Number(y?.length) > 4 ? (y?.length || 0) + 5 : 12}ch` },
211
+ type: H,
212
+ placeholder: C,
213
+ value: y,
214
+ className: `input-placeholder hfl-flex-1 hfl-pl-2 hfl-placeholder hfl-py-1 focus-visible:hfl-outline-0 focus-visible:hfl-outline-none hfl-border-0 focus:hfl-border-0 ${T ? "!hfl-bg-Gray-50 !hfl-cursor-not-allowed" : q || "hfl-bg-White"} ${s || ""}`,
215
+ onChange: (h) => {
216
+ L && L(h.target.value), xe(!0);
217
+ },
218
+ onClick: qe,
219
+ onKeyDown: (h) => F && F(h, ae, me),
220
+ maxLength: fe ?? fe,
221
+ ...a.inputProps || {}
222
+ }
223
+ ),
224
+ !_ && !m && /* @__PURE__ */ e.jsx("i", { className: "hx_down hfl-mx-2" }),
225
+ m && /* @__PURE__ */ e.jsx(
226
+ "i",
227
+ {
228
+ className: `${y ? "hx_close hfl-cursor-pointer" : "hx_down"} hfl-mx-2`,
229
+ onClick: () => {
230
+ (b?.value || y) && (L && L(""), xe(!0));
231
+ }
232
+ }
233
+ ),
234
+ S ? /* @__PURE__ */ e.jsx(
235
+ "span",
236
+ {
237
+ style: { left: `${Ie < 2 ? "3" : Ie}ch` },
238
+ className: "hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",
239
+ children: S
240
+ }
241
+ ) : null
242
+ ]
243
+ }
244
+ ),
245
+ d && /* @__PURE__ */ e.jsx("span", { className: "hfl-text-0 hfl-text-Error-600", children: l })
246
+ ] }) : /* @__PURE__ */ e.jsxs(
247
+ "button",
248
+ {
249
+ ref: Ce,
250
+ onClick: Ne,
251
+ className: `hfl-w-full hfl-bg-White hfl-py-[6px] hfl-px-4 hfl-rounded-lg hfl-inline-flex hfl-justify-between hfl-items-center ${i || ""} ${I || "hfl-border-1"} ${l ? "hfl-border-Error-300" : "hfl-border-Gray-300"} ${j || "hfl-h-[40px]"} ${T ? "!hfl-bg-Gray-50 !hfl-cursor-not-allowed" : ""}`,
252
+ style: X || b?.label ? {} : c ? {
253
+ fontFamily: c?.fontFamily,
254
+ fontSize: c?.fontSize,
255
+ fontWeight: c?.fontWeight,
256
+ lineHeight: c?.lineHeight,
257
+ color: c?.color
258
+ } : {},
259
+ children: [
260
+ /* @__PURE__ */ e.jsx("span", { className: "hfl-pr-4", children: X || b?.label || C || "Select an option" }),
261
+ /* @__PURE__ */ e.jsx("img", { src: ll, alt: "down arrow" })
262
+ ]
263
+ }
264
+ ),
265
+ w && w?.length >= 0 && /* @__PURE__ */ e.jsxs(
266
+ "ul",
267
+ {
268
+ ref: he,
269
+ className: `custom-dropdown-menu ${ee ? "hfl-visible" : "hfl-invisible"} hfl-absolute hfl-z-50 hfl-grid hfl-gap-1 hfl-mt-3 hfl-w-full hfl-rounded-lg hfl-shadow-lg hfl-bg-White hfl-font-inter-0 hfl-p-1 hfl-px-2 ${f ? "hfl-min-w-[20em]" : "hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${ce}`,
270
+ role: "menu",
271
+ "aria-orientation": "vertical",
272
+ "aria-labelledby": "options-menu",
273
+ children: [
274
+ z ? /* @__PURE__ */ e.jsx(
275
+ el,
276
+ {
277
+ onChangeHandler: E,
278
+ selectedOption: o,
279
+ options: n
280
+ }
281
+ ) : !1,
282
+ (p ? Be : w)?.map((h, O) => {
283
+ const Y = f ? !!x?.some((ye) => ye.value === h?.value) : !1, ke = b?.value === h?.value, Ae = ne === O;
284
+ return h ? /* @__PURE__ */ e.jsx(
285
+ "li",
286
+ {
287
+ onClick: () => {
288
+ f ? Te(h) : (k && k(h), ae(!1), xe(!1));
289
+ },
290
+ className: `hfl-text-1 hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item ${te ? "odd:hfl-bg-Gray-100" : ""} ${ke ? "hfl-bg-Blue-50 hfl-text-Blue-500" : ""}`,
291
+ role: "menuitem",
292
+ "aria-selected": ke,
293
+ tabIndex: Ae ? 0 : -1,
294
+ ref: (ye) => {
295
+ ge.current[O] = ye;
296
+ },
297
+ children: f ? /* @__PURE__ */ e.jsx(
298
+ Ee,
299
+ {
300
+ size: "sm",
301
+ disabled: !1,
302
+ text: /* @__PURE__ */ e.jsx("span", { children: h.label }),
303
+ secondaryText: "",
304
+ id: `${h.label}-${O}`,
305
+ isMarked: Y
306
+ }
307
+ ) : h.label
308
+ },
309
+ `${h.label}-${O}`
310
+ ) : null;
311
+ }),
312
+ w?.length === 0 && A && /* @__PURE__ */ e.jsx(
313
+ "li",
314
+ {
315
+ className: "hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item",
316
+ children: "No items found, please change the search criteria"
317
+ }
318
+ )
319
+ ]
320
+ }
321
+ )
322
+ ] });
323
+ }
324
+ var je, De;
325
+ function tl() {
326
+ if (De) return je;
327
+ De = 1;
328
+ var a = "Expected a function", t = NaN, g = "[object Symbol]", _ = /^\s+|\s+$/g, m = /^[-+]0x[0-9a-f]+$/i, N = /^0b[01]+$/i, i = /^0o[0-7]+$/i, C = parseInt, w = typeof ue == "object" && ue && ue.Object === Object && ue, b = typeof self == "object" && self && self.Object === Object && self, k = w || b || Function("return this")(), y = Object.prototype, L = y.toString, B = Math.max, s = Math.min, p = function() {
329
+ return k.Date.now();
330
+ };
331
+ function H(r, x, f) {
332
+ var u, z, E, o, n, I, j = 0, T = !1, q = !1, l = !0;
333
+ if (typeof r != "function")
334
+ throw new TypeError(a);
335
+ x = V(x) || 0, M(f) && (T = !!f.leading, q = "maxWait" in f, E = q ? B(V(f.maxWait) || 0, x) : E, l = "trailing" in f ? !!f.trailing : l);
336
+ function d(v) {
337
+ var J = u, Z = z;
338
+ return u = z = void 0, j = v, o = r.apply(Z, J), o;
339
+ }
340
+ function c(v) {
341
+ return j = v, n = setTimeout(R, x), T ? d(v) : o;
342
+ }
343
+ function F(v) {
344
+ var J = v - I, Z = v - j, le = x - J;
345
+ return q ? s(le, E - Z) : le;
346
+ }
347
+ function A(v) {
348
+ var J = v - I, Z = v - j;
349
+ return I === void 0 || J >= x || J < 0 || q && Z >= E;
350
+ }
351
+ function R() {
352
+ var v = p();
353
+ if (A(v))
354
+ return ce(v);
355
+ n = setTimeout(R, F(v));
356
+ }
357
+ function ce(v) {
358
+ return n = void 0, l && u ? d(v) : (u = z = void 0, o);
359
+ }
360
+ function de() {
361
+ n !== void 0 && clearTimeout(n), j = 0, u = I = z = n = void 0;
362
+ }
363
+ function fe() {
364
+ return n === void 0 ? o : ce(p());
365
+ }
366
+ function te() {
367
+ var v = p(), J = A(v);
368
+ if (u = arguments, z = this, I = v, J) {
369
+ if (n === void 0)
370
+ return c(I);
371
+ if (q)
372
+ return n = setTimeout(R, x), d(I);
373
+ }
374
+ return n === void 0 && (n = setTimeout(R, x)), o;
375
+ }
376
+ return te.cancel = de, te.flush = fe, te;
377
+ }
378
+ function M(r) {
379
+ var x = typeof r;
380
+ return !!r && (x == "object" || x == "function");
381
+ }
382
+ function S(r) {
383
+ return !!r && typeof r == "object";
384
+ }
385
+ function X(r) {
386
+ return typeof r == "symbol" || S(r) && L.call(r) == g;
387
+ }
388
+ function V(r) {
389
+ if (typeof r == "number")
390
+ return r;
391
+ if (X(r))
392
+ return t;
393
+ if (M(r)) {
394
+ var x = typeof r.valueOf == "function" ? r.valueOf() : r;
395
+ r = M(x) ? x + "" : x;
396
+ }
397
+ if (typeof r != "string")
398
+ return r === 0 ? r : +r;
399
+ r = r.replace(_, "");
400
+ var f = N.test(r);
401
+ return f || i.test(r) ? C(r.slice(2), f ? 2 : 8) : m.test(r) ? t : +r;
402
+ }
403
+ return je = H, je;
404
+ }
405
+ var al = tl();
406
+ const nl = /* @__PURE__ */ We(al), ve = (a, t) => {
407
+ const g = parseFloat(a), _ = parseFloat(t);
408
+ if (!a || !t || isNaN(g) || isNaN(_) || _ === 0)
409
+ return "";
410
+ const m = g / _;
411
+ return Number.isInteger(m) ? m.toString(10) : m.toFixed(3).replace(/\.?0+$/, "");
412
+ }, U = (a) => /^(\d+)?(\.)?(\d*)?$/.test(a), P = ({ label: a, children: t }) => /* @__PURE__ */ e.jsxs(
413
+ $,
414
+ {
415
+ variant: "Regular",
416
+ type: "Text sm",
417
+ className: "hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",
418
+ children: [
419
+ /* @__PURE__ */ e.jsxs("span", { className: "hfl-flex-shrink-0", children: [
420
+ a,
421
+ ":"
422
+ ] }),
423
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-flex-1 hfl-min-w-0", children: t })
424
+ ]
425
+ }
426
+ ), K = ({ label: a, value: t }) => /* @__PURE__ */ e.jsxs($, { variant: "Regular", type: "Text sm", className: "hfl-flex hfl-text-Blue_gray-800 hfl-gap-1", children: [
427
+ /* @__PURE__ */ e.jsxs("span", { className: "hfl-flex-shrink-0", children: [
428
+ a,
429
+ ":"
430
+ ] }),
431
+ /* @__PURE__ */ e.jsx($, { variant: "Bold", type: "Text sm", className: "hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0", children: t || "--" })
432
+ ] }), ie = ({ children: a, className: t = "" }) => /* @__PURE__ */ e.jsx(
433
+ $,
434
+ {
435
+ variant: "Regular",
436
+ type: "Text sm",
437
+ className: `hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${t}`,
438
+ children: a
439
+ }
440
+ ), sl = be.memo(
441
+ function({ rowData: t, isEditing: g, setIsEditing: _, onSaveRow: m, allowCustomMedicineInput: N }) {
442
+ const {
443
+ variant: i,
444
+ externallyTriggeredEditMode: C,
445
+ externallyTriggeredEditRowIds: w,
446
+ getMedicineOptions: b,
447
+ onRowChange: k,
448
+ onRowDelete: y
449
+ } = $e(), [L, B] = G([]), [s, p] = G(t), [H, M] = G(t.medicine_name);
450
+ Q(() => {
451
+ g || M(t.medicine_name);
452
+ }, [t.medicine_name, g]), Q(() => {
453
+ g || p(t);
454
+ }, [t, g]);
455
+ const S = async (l) => (await b?.(l))?.map((c) => ({
456
+ label: c.doctorMedicineName,
457
+ value: c
458
+ })) || [], V = C || w?.includes(t.rowId) || g, r = re(() => s.out_of_range || t.out_of_range, [s.out_of_range, t.out_of_range]), x = re(() => s?.isDosageMismatch || t?.isDosageMismatch, [s?.isDosageMismatch, t?.isDosageMismatch]), f = be.useMemo(() => s.calculation_type === _e[0] ? s.calculation_fields : null, [s.calculation_fields, s.calculation_type]), u = be.useMemo(() => s.calculation_type === _e[1] ? s.calculation_fields : null, [s.calculation_fields, s.calculation_type]), z = (l, d) => {
459
+ let c;
460
+ if (l === "calculation_type") {
461
+ const F = d, A = {
462
+ frequency: s.calculation_fields.frequency,
463
+ pedia_dosage: i === "standard" ? s.calculation_fields.pedia_dosage : s.pedia_dosage
464
+ };
465
+ c = {
466
+ ...s,
467
+ calculation_type: F,
468
+ calculation_fields: F === "mg/kg/dose" ? { ...Je, ...A } : { ...Ye, ...A }
469
+ };
470
+ } else
471
+ c = {
472
+ ...s,
473
+ [l]: d
474
+ };
475
+ p(c), i === "prescription" && E(c, l);
476
+ }, E = re(
477
+ () => nl((l, d) => {
478
+ k?.(l, d || void 0);
479
+ }, 500),
480
+ [k]
481
+ ), o = re(() => /* @__PURE__ */ e.jsxs("div", { className: "hfl-mb-1 hfl-flex hfl-w-max hfl-items-center hfl-rounded hfl-border-1 hfl-border-Warning-400 hfl-bg-Warning-50 hfl-p-1 hfl-px-2", children: [
482
+ /* @__PURE__ */ e.jsx("div", { className: "hx_warning hfl-text-Error-400" }),
483
+ /* @__PURE__ */ e.jsx($, { variant: "Regular", type: "Text sm", className: "hfl-px-2 hfl-text-1 hfl-text-Error-500", children: "Dosage exceed safety limits" })
484
+ ] }), []);
485
+ Q(() => () => {
486
+ E.cancel();
487
+ }, [E]);
488
+ const n = W(
489
+ (l, d) => {
490
+ p((c) => {
491
+ let F = { ...c.calculation_fields, [l]: d };
492
+ if (l === "frequency" && i === "standard") {
493
+ const R = Me[d] || [];
494
+ R.length > 0 && (F = {
495
+ ...F,
496
+ pedia_dosage: R[0]
497
+ });
498
+ }
499
+ const A = {
500
+ ...c,
501
+ calculation_fields: F
502
+ };
503
+ return i === "prescription" && E(A, l), A;
504
+ });
505
+ },
506
+ [E, i]
507
+ ), I = async () => {
508
+ const l = {
509
+ ...s,
510
+ calculation_fields: { ...s.calculation_fields }
511
+ };
512
+ await m?.(l) && E({ ...l, isNewlyAdded: !1, isEditing: !1 });
513
+ }, j = async () => {
514
+ if (!t.medicine_name || t.medicine_name.trim() === "") {
515
+ y?.(t.rowId);
516
+ return;
517
+ }
518
+ p(t), i === "standard" && _(!1);
519
+ }, T = (l) => i === "prescription" && (l === "medicine_name" || l === "generic_name" || l === "type" || l === "calculation_type") ? !1 : V, q = () => {
520
+ const l = !(s?.isSavedToLibrary ?? !1), d = { ...s, isSavedToLibrary: l };
521
+ p(d), E(d, "isSavedToLibrary");
522
+ };
523
+ return /* @__PURE__ */ e.jsxs(
524
+ "div",
525
+ {
526
+ className: `medicine-row hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-px-2 hfl-py-1 hfl-border-b-1 hfl-border-Gray-200 ${V ? "hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50" : ""} ${i === "prescription" && !s.pedia_data_available ? "hfl-hidden" : ""}`,
527
+ children: [
528
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: T("medicine_name") ? /* @__PURE__ */ e.jsx(
529
+ D,
530
+ {
531
+ wrapperClass: "hfl-w-full",
532
+ btnClassName: "hfl-w-full",
533
+ inputClassName: "hfl-w-full",
534
+ inputValue: s.medicine_name,
535
+ showInput: !0,
536
+ disableInputAutoSize: !0,
537
+ inputChangeHandler: async (l) => {
538
+ if (z("medicine_name", l), l.trim()) {
539
+ const d = await S(l);
540
+ B(d);
541
+ } else
542
+ B([]);
543
+ },
544
+ onInputFocus: async () => {
545
+ const l = await S(s.medicine_name);
546
+ B(l);
547
+ },
548
+ onChangeHandler: (l) => {
549
+ const d = l.value, c = we.find((F) => F.val === d.medicineType);
550
+ p((F) => ({
551
+ ...F,
552
+ medicine_name: d.doctorMedicineName,
553
+ medicine_id: d.medicineId,
554
+ generic_name: d.doctorGenericName,
555
+ type: c?.type ?? ""
556
+ })), M(d.doctorMedicineName);
557
+ },
558
+ options: L,
559
+ isSearchable: !0,
560
+ placeholder: "Search medicine",
561
+ disabled: !s?.isNewlyAdded,
562
+ inputProps: {
563
+ onBlur: (l) => {
564
+ const d = l.relatedTarget;
565
+ if (!(d && d.closest(".custom-dropdown-menu")) && !N) {
566
+ const c = s.medicine_name?.trim() || "";
567
+ L.some((A) => A.label === c) || p((A) => ({ ...A, medicine_name: H }));
568
+ }
569
+ }
570
+ }
571
+ }
572
+ ) : /* @__PURE__ */ e.jsx(ie, { children: t.medicine_name }) }),
573
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: T("generic_name") ? /* @__PURE__ */ e.jsx(
574
+ D,
575
+ {
576
+ wrapperClass: "hfl-w-full",
577
+ inputClassName: "hfl-w-full",
578
+ btnClassName: "hfl-w-full",
579
+ inputValue: s.generic_name,
580
+ showInput: !0,
581
+ disableInputAutoSize: !0,
582
+ inputChangeHandler: (l) => z("generic_name", l),
583
+ hideDropdownIcon: !0
584
+ }
585
+ ) : /* @__PURE__ */ e.jsx(ie, { children: t.generic_name }) }),
586
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: T("type") ? /* @__PURE__ */ e.jsx(
587
+ D,
588
+ {
589
+ wrapperClass: "hfl-w-full",
590
+ btnClassName: "hfl-w-full",
591
+ placeholder: "Select",
592
+ showInput: !1,
593
+ disableInputAutoSize: !0,
594
+ selectedOption: (() => {
595
+ const l = we.find((d) => d.type === s.type);
596
+ return l ? { label: l.type, value: l.type } : void 0;
597
+ })(),
598
+ options: we.map((l) => ({
599
+ label: l.type,
600
+ value: l.type
601
+ })),
602
+ onChangeHandler: (l) => z("type", l.value)
603
+ }
604
+ ) : /* @__PURE__ */ e.jsx(ie, { children: t.type || "" }) }),
605
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: T("calculation_type") ? /* @__PURE__ */ e.jsx(
606
+ D,
607
+ {
608
+ wrapperClass: "hfl-w-full",
609
+ btnClassName: "hfl-w-full",
610
+ placeholder: "Select",
611
+ showInput: !1,
612
+ disableInputAutoSize: !0,
613
+ selectedOption: { label: s.calculation_type, value: s.calculation_type },
614
+ options: _e.map((l) => ({ label: l, value: l })),
615
+ onChangeHandler: (l) => z("calculation_type", l.value)
616
+ }
617
+ ) : /* @__PURE__ */ e.jsx(ie, { children: t.calculation_type }) }),
618
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2", children: T("calculation_fields") ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
619
+ f && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
620
+ /* @__PURE__ */ e.jsx(P, { label: "Drug Strength", children: /* @__PURE__ */ e.jsx(
621
+ D,
622
+ {
623
+ wrapperClass: "hfl-w-full",
624
+ placeholder: "e.g., 250",
625
+ showInput: !0,
626
+ hideDropdownIcon: !0,
627
+ disableInputAutoSize: !0,
628
+ inputType: "text",
629
+ inputValue: f.drug_strength || "",
630
+ inputChangeHandler: (l) => {
631
+ U(l) && n("drug_strength", l);
632
+ }
633
+ }
634
+ ) }),
635
+ /* @__PURE__ */ e.jsx(P, { label: "Dose/mg/kg", children: /* @__PURE__ */ e.jsx(
636
+ D,
637
+ {
638
+ wrapperClass: "hfl-w-full",
639
+ placeholder: "e.g., 15",
640
+ showInput: !0,
641
+ hideDropdownIcon: !0,
642
+ disableInputAutoSize: !0,
643
+ inputType: "text",
644
+ inputValue: f.dose_mg_kg || "",
645
+ inputChangeHandler: (l) => {
646
+ U(l) && n("dose_mg_kg", l);
647
+ }
648
+ }
649
+ ) }),
650
+ /* @__PURE__ */ e.jsx(P, { label: "Frequency", children: /* @__PURE__ */ e.jsx(
651
+ D,
652
+ {
653
+ wrapperClass: "hfl-w-full",
654
+ placeholder: "Frequency",
655
+ showInput: !1,
656
+ selectedOption: s.calculation_fields.frequency ? {
657
+ label: s.calculation_fields.frequency,
658
+ value: s.calculation_fields.frequency
659
+ } : void 0,
660
+ options: Se.map((l) => ({ label: l, value: l })),
661
+ onChangeHandler: (l) => {
662
+ n("frequency", l.value);
663
+ }
664
+ }
665
+ ) }),
666
+ /* @__PURE__ */ e.jsx(P, { label: "Max Dose (mg)", children: /* @__PURE__ */ e.jsx(
667
+ D,
668
+ {
669
+ wrapperClass: "hfl-w-full",
670
+ placeholder: "Max mg/dose",
671
+ showInput: !0,
672
+ hideDropdownIcon: !0,
673
+ disableInputAutoSize: !0,
674
+ inputType: "text",
675
+ inputValue: f.max_mg_dose || "",
676
+ inputChangeHandler: (l) => {
677
+ U(l) && n("max_mg_dose", l);
678
+ }
679
+ }
680
+ ) }),
681
+ /* @__PURE__ */ e.jsx(P, { label: "Max Day (mg)", children: /* @__PURE__ */ e.jsx(
682
+ D,
683
+ {
684
+ wrapperClass: "hfl-w-full",
685
+ placeholder: "Max mg/day",
686
+ showInput: !0,
687
+ hideDropdownIcon: !0,
688
+ disableInputAutoSize: !0,
689
+ inputType: "text",
690
+ inputValue: f.max_mg_day || "",
691
+ inputChangeHandler: (l) => {
692
+ U(l) && n("max_mg_day", l);
693
+ }
694
+ }
695
+ ) })
696
+ ] }),
697
+ u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
698
+ /* @__PURE__ */ e.jsx(P, { label: "Drug Strength/mL", children: /* @__PURE__ */ e.jsx(
699
+ D,
700
+ {
701
+ wrapperClass: "hfl-w-full",
702
+ placeholder: "e.g., 250",
703
+ showInput: !0,
704
+ hideDropdownIcon: !0,
705
+ disableInputAutoSize: !0,
706
+ inputType: "text",
707
+ inputValue: u.drug_strength || "",
708
+ inputChangeHandler: (l) => {
709
+ U(l) && (n("drug_strength", l), n("dose_ml_kg", ve(u.dose_mg_kg, l)));
710
+ }
711
+ }
712
+ ) }),
713
+ /* @__PURE__ */ e.jsx(P, { label: "Dose/mg/kg", children: /* @__PURE__ */ e.jsx(
714
+ D,
715
+ {
716
+ wrapperClass: "hfl-w-full",
717
+ placeholder: "e.g., 15",
718
+ showInput: !0,
719
+ hideDropdownIcon: !0,
720
+ disableInputAutoSize: !0,
721
+ inputType: "text",
722
+ inputValue: u.dose_mg_kg || "",
723
+ inputChangeHandler: (l) => {
724
+ U(l) && (n("dose_mg_kg", l), n("dose_ml_kg", ve(l, u.drug_strength)));
725
+ }
726
+ }
727
+ ) }),
728
+ /* @__PURE__ */ e.jsx(P, { label: "Dose/mL/kg", children: /* @__PURE__ */ e.jsx(
729
+ D,
730
+ {
731
+ wrapperClass: "hfl-w-full",
732
+ disabled: !0,
733
+ placeholder: "e.g., 5",
734
+ showInput: !0,
735
+ hideDropdownIcon: !0,
736
+ disableInputAutoSize: !0,
737
+ inputType: "text",
738
+ inputValue: ve(u.dose_mg_kg, u.drug_strength) || "",
739
+ inputChangeHandler: (l) => {
740
+ U(l) && n("dose_ml_kg", l);
741
+ }
742
+ }
743
+ ) }),
744
+ /* @__PURE__ */ e.jsx(P, { label: "Frequency", children: /* @__PURE__ */ e.jsx(
745
+ D,
746
+ {
747
+ wrapperClass: "hfl-w-full",
748
+ placeholder: "Frequency",
749
+ showInput: !1,
750
+ selectedOption: s.calculation_fields.frequency ? {
751
+ label: s.calculation_fields.frequency,
752
+ value: s.calculation_fields.frequency
753
+ } : void 0,
754
+ options: Se.map((l) => ({ label: l, value: l })),
755
+ onChangeHandler: (l) => {
756
+ n("frequency", l.value);
757
+ }
758
+ }
759
+ ) }),
760
+ /* @__PURE__ */ e.jsx(P, { label: "Max Dose (mL)", children: /* @__PURE__ */ e.jsx(
761
+ D,
762
+ {
763
+ wrapperClass: "hfl-w-full",
764
+ placeholder: "Max mL/dose",
765
+ showInput: !0,
766
+ hideDropdownIcon: !0,
767
+ disableInputAutoSize: !0,
768
+ inputType: "text",
769
+ inputValue: u.max_ml_dose || "",
770
+ inputChangeHandler: (l) => {
771
+ U(l) && n("max_ml_dose", l);
772
+ }
773
+ }
774
+ ) }),
775
+ /* @__PURE__ */ e.jsx(P, { label: "Max Day (mL)", children: /* @__PURE__ */ e.jsx(
776
+ D,
777
+ {
778
+ wrapperClass: "hfl-w-full",
779
+ placeholder: "Max mL/day",
780
+ showInput: !0,
781
+ hideDropdownIcon: !0,
782
+ disableInputAutoSize: !0,
783
+ inputType: "text",
784
+ inputValue: u.max_ml_day || "",
785
+ inputChangeHandler: (l) => {
786
+ U(l) && n("max_ml_day", l);
787
+ }
788
+ }
789
+ ) })
790
+ ] })
791
+ ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
792
+ f && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
793
+ /* @__PURE__ */ e.jsx(K, { label: "Drug Strength", value: f.drug_strength }),
794
+ /* @__PURE__ */ e.jsx(K, { label: "Dose/mg/kg", value: f.dose_mg_kg }),
795
+ /* @__PURE__ */ e.jsx(K, { label: "Frequency", value: f.frequency }),
796
+ /* @__PURE__ */ e.jsx(K, { label: "Max Dose (mg)", value: f.max_mg_dose }),
797
+ /* @__PURE__ */ e.jsx(K, { label: "Max Day (mg)", value: f.max_mg_day })
798
+ ] }),
799
+ u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
800
+ /* @__PURE__ */ e.jsx(K, { label: "Drug Strength/mL", value: u.drug_strength }),
801
+ /* @__PURE__ */ e.jsx(K, { label: "Dose/mg/kg", value: u.dose_mg_kg }),
802
+ /* @__PURE__ */ e.jsx(K, { label: "Dose/mL/kg", value: u.dose_ml_kg }),
803
+ /* @__PURE__ */ e.jsx(K, { label: "Frequency", value: u.frequency }),
804
+ /* @__PURE__ */ e.jsx(K, { label: "Max Dose (mL)", value: u.max_ml_dose }),
805
+ /* @__PURE__ */ e.jsx(K, { label: "Max Day (mL)", value: u.max_ml_day })
806
+ ] })
807
+ ] }) }),
808
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: T("pedia_dosage") ? (() => {
809
+ const l = s.calculation_fields.frequency, d = Me[l] || [];
810
+ return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
811
+ D,
812
+ {
813
+ wrapperClass: "hfl-w-full",
814
+ btnClassName: "hfl-w-full",
815
+ inputClassName: "hfl-w-full",
816
+ placeholder: "Select",
817
+ showInput: i !== "standard",
818
+ disableInputAutoSize: !0,
819
+ inputValue: i === "standard" ? s.calculation_fields.pedia_dosage : s.pedia_dosage,
820
+ inputChangeHandler: (c) => i === "prescription" ? z("pedia_dosage", c) : n("pedia_dosage", c),
821
+ selectedOption: i === "standard" ? {
822
+ label: s.calculation_fields.pedia_dosage,
823
+ value: s.calculation_fields.pedia_dosage
824
+ } : void 0,
825
+ options: i !== "prescription" ? d.map((c) => ({ label: c, value: c })) : void 0,
826
+ onChangeHandler: i !== "prescription" ? (c) => n("pedia_dosage", c.value) : void 0,
827
+ hideDropdownIcon: i === "prescription",
828
+ showEmptyDropdownPopup: i !== "prescription",
829
+ showErrorMsg: i === "prescription" ? r || x : !1,
830
+ errorMsg: i === "prescription" && r ? "Dosage Exceeds Safety Limits" : i === "prescription" && x ? "Dosage is in mismatch with selected type of Frequency" : ""
831
+ }
832
+ ) });
833
+ })() : /* @__PURE__ */ e.jsxs("div", { className: "hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0", children: [
834
+ /* @__PURE__ */ e.jsx(ie, { children: i === "prescription" ? t.pedia_dosage : t.calculation_fields.pedia_dosage }),
835
+ r && o
836
+ ] }) }),
837
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: /* @__PURE__ */ e.jsx(
838
+ Qe,
839
+ {
840
+ effectiveEditMode: V,
841
+ rowData: t,
842
+ isSavedToLibrary: s.isSavedToLibrary ?? !1,
843
+ onSave: I,
844
+ onCancel: j,
845
+ onEdit: () => _(!0),
846
+ onCheckboxToggle: q
847
+ }
848
+ ) })
849
+ ]
850
+ }
851
+ );
852
+ },
853
+ (a, t) => a.isEditing === t.isEditing && a.rowData.rowId === t.rowData.rowId && a.rowData.isEditing === t.rowData.isEditing && a.rowData.medicine_name === t.rowData.medicine_name && a.rowData.generic_name === t.rowData.generic_name && a.rowData.type === t.rowData.type && a.rowData.pedia_dosage === t.rowData.pedia_dosage && a.rowData.calculation_type === t.rowData.calculation_type && JSON.stringify(a.rowData.calculation_fields) === JSON.stringify(t.rowData.calculation_fields) && a.rowData.out_of_range === t.rowData.out_of_range && a.rowData.isDosageMismatch === t.rowData.isDosageMismatch && a.rowData.calculation_fields.pedia_dosage === t.rowData.calculation_fields.pedia_dosage && a.rowData?.isNewlyAdded === t.rowData?.isNewlyAdded && a.rowData?.pedia_data_available === t.rowData?.pedia_data_available
854
+ ), il = (a) => {
855
+ const {
856
+ openState: t,
857
+ closePopupCallback: g,
858
+ headingIconFile: _,
859
+ headingText: m,
860
+ subHeadingText: N,
861
+ positiveButtonText: i,
862
+ negativeButtonText: C,
863
+ classNamePositiveBtn: w,
864
+ classNameNegativeBtn: b,
865
+ positiveActionCallback: k,
866
+ negativeActionCallback: y
867
+ } = a;
868
+ return /* @__PURE__ */ e.jsxs(
869
+ Fe,
870
+ {
871
+ isOpen: t,
872
+ onRequestClose: g,
873
+ shouldCloseOnOverlayClick: !1,
874
+ style: {
875
+ overlay: {
876
+ backgroundColor: "rgba(52, 64, 84, 0.5)",
877
+ position: "fixed",
878
+ alignContent: "center",
879
+ justifyContent: "center",
880
+ zIndex: 1030,
881
+ display: t ? "block" : "none"
882
+ },
883
+ content: {
884
+ zIndex: 1030,
885
+ padding: "24px",
886
+ maxWidth: "750px",
887
+ maxHeight: "600px",
888
+ width: "400px",
889
+ height: "fit-content",
890
+ margin: "auto",
891
+ borderRadius: "12px",
892
+ overflow: "unset",
893
+ display: t ? "block" : "none"
894
+ }
895
+ },
896
+ children: [
897
+ _ == "warning" && /* @__PURE__ */ e.jsx("div", { className: "hfl-hx_warning hfl-mb-4 hfl-flex hfl-h-12 hfl-w-12 hfl-items-center hfl-justify-center hfl-rounded-full hfl-border-8 hfl-border-Warning-50 hfl-bg-Warning-100 hfl-text-Warning-600", children: /* @__PURE__ */ e.jsx("i", { className: "hx_warning hfl-text-5" }) }),
898
+ /* @__PURE__ */ e.jsx($, { variant: "Medium", type: "Text xl", className: "hfl-mt-5 hfl-text-Gray-900", children: m }),
899
+ N && /* @__PURE__ */ e.jsx($, { variant: "Regular", type: "Text sm", className: "hfl-mt-1 hfl-text-Gray-500 ", children: N }),
900
+ /* @__PURE__ */ e.jsxs("div", { className: "hfl-mt-4 hfl-flex hfl-items-center hfl-justify-center hfl-gap-4", children: [
901
+ C && /* @__PURE__ */ e.jsx(
902
+ oe,
903
+ {
904
+ size: "md",
905
+ textField: C,
906
+ hierarchy: "Primary",
907
+ className: b || "",
908
+ onClick: y,
909
+ "data-qa": "negative-action"
910
+ }
911
+ ),
912
+ i && /* @__PURE__ */ e.jsx(
913
+ oe,
914
+ {
915
+ size: "md",
916
+ textField: i,
917
+ hierarchy: "Secondary",
918
+ className: w || "",
919
+ onClick: k,
920
+ "data-qa": "positive-action"
921
+ }
922
+ )
923
+ ] })
924
+ ]
925
+ }
926
+ );
927
+ }, rl = ({ open: a, onCancel: t, onCopySave: g, rowMedicineData: _, getMedicineOptions: m }) => {
928
+ const [N, i] = G([]), [C, w] = G(""), [b, k] = G([]), y = W(
929
+ async (p) => {
930
+ const M = (await m?.(p))?.map(
931
+ (S) => ({
932
+ label: S.doctorMedicineName,
933
+ value: S
934
+ })
935
+ );
936
+ k(M || []);
937
+ },
938
+ [m]
939
+ );
940
+ Q(() => {
941
+ a && y(C);
942
+ }, [C, y, a]);
943
+ const L = (p) => {
944
+ const H = p.value;
945
+ N.some(
946
+ (S) => S.medicineId === H.medicineId && S.doctorMedicineName.trim().toLowerCase() === H.doctorMedicineName.trim().toLowerCase()
947
+ ) || i((S) => [...S, H]), w(""), k([]);
948
+ }, B = (p) => {
949
+ i((H) => H.filter((M) => M.medicineId !== p));
950
+ }, s = async () => {
951
+ C.trim() || await y("");
952
+ };
953
+ return /* @__PURE__ */ e.jsxs(
954
+ Fe,
955
+ {
956
+ isOpen: a,
957
+ onRequestClose: t,
958
+ shouldCloseOnOverlayClick: !1,
959
+ style: {
960
+ overlay: {
961
+ backgroundColor: "rgba(52, 64, 84, 0.5)",
962
+ zIndex: 1030
963
+ },
964
+ content: {
965
+ zIndex: 1031,
966
+ maxWidth: "600px",
967
+ maxHeight: "50vh",
968
+ height: "auto",
969
+ margin: "auto",
970
+ borderRadius: "12px",
971
+ padding: "0px",
972
+ display: "flex",
973
+ flexDirection: "column"
974
+ }
975
+ },
976
+ children: [
977
+ /* @__PURE__ */ e.jsx(
978
+ $,
979
+ {
980
+ variant: "Bold",
981
+ type: "Text lg",
982
+ className: "hfl-text-White hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-2",
983
+ children: "Please select medicine to copy"
984
+ }
985
+ ),
986
+ /* @__PURE__ */ e.jsxs("div", { className: "hfl-px-6 hfl-py-5 hfl-flex hfl-flex-col hfl-gap-6 hfl-overflow-y-auto hfl-flex-1", children: [
987
+ /* @__PURE__ */ e.jsx(
988
+ D,
989
+ {
990
+ inputValue: C,
991
+ showInput: !0,
992
+ isSearchable: !0,
993
+ disableInputAutoSize: !0,
994
+ inputChangeHandler: w,
995
+ onChangeHandler: L,
996
+ onInputFocus: s,
997
+ options: b,
998
+ placeholder: "Search for medicines"
999
+ }
1000
+ ),
1001
+ /* @__PURE__ */ e.jsx("div", { className: "hfl-flex hfl-flex-wrap hfl-gap-2", children: N.map((p) => /* @__PURE__ */ e.jsxs(
1002
+ "div",
1003
+ {
1004
+ className: "hfl-flex hfl-items-center hfl-bg-Gray-100 hfl-px-2 hfl-py-0.5 hfl-rounded-md hfl-gap-1",
1005
+ children: [
1006
+ /* @__PURE__ */ e.jsx($, { variant: "Regular", type: "Text sm", className: "hfl-text-nowrap", children: p.doctorMedicineName }),
1007
+ /* @__PURE__ */ e.jsx("button", { className: "hfl-text-Blue_gray-800", onClick: () => B(p.medicineId), children: /* @__PURE__ */ e.jsx("i", { className: "hx_close" }) })
1008
+ ]
1009
+ },
1010
+ p.doctorMedicineName + p.medicineId
1011
+ )) })
1012
+ ] }),
1013
+ /* @__PURE__ */ e.jsxs("div", { className: "hfl-flex hfl-justify-end hfl-gap-2.5 hfl-bg-Gray-50 hfl-px-7 hfl-py-3 hfl-border-t hfl-border-Gray-200", children: [
1014
+ /* @__PURE__ */ e.jsx(oe, { size: "md", textField: "Cancel", onClick: t, hierarchy: "Secondary-Grey" }),
1015
+ /* @__PURE__ */ e.jsx(
1016
+ oe,
1017
+ {
1018
+ size: "md",
1019
+ textField: "Save",
1020
+ disabled: !N || N.length == 0,
1021
+ onClick: async () => {
1022
+ await g(_, N) && t();
1023
+ },
1024
+ className: "hfl-bg-Primary-600 hfl-text-White disabled:hfl-opacity-50 disabled:hfl-cursor-not-allowed",
1025
+ hierarchy: "Primary"
1026
+ }
1027
+ )
1028
+ ] })
1029
+ ]
1030
+ }
1031
+ );
1032
+ }, pl = Pe(
1033
+ ({
1034
+ data: a = [],
1035
+ variant: t,
1036
+ externallyTriggeredEditRowIds: g = [],
1037
+ externallyTriggeredEditMode: _ = !1,
1038
+ allowCustomMedicineInput: m = !0,
1039
+ getMedicineOptions: N,
1040
+ onRowChange: i,
1041
+ onRowDelete: C,
1042
+ onRowCopy: w,
1043
+ onSaveRow: b,
1044
+ externalSaveTrigger: k,
1045
+ setSearchDisabled: y
1046
+ }, L) => {
1047
+ const [B, s] = G(null), [p, H] = G(!1), [M, S] = G(), X = W(
1048
+ (o, n, I) => {
1049
+ const j = a.find((q) => q.rowId === o);
1050
+ if (!j) return;
1051
+ const T = { ...j, ...n };
1052
+ i?.(T, I || void 0);
1053
+ },
1054
+ [a, i]
1055
+ ), V = W(async () => {
1056
+ const o = a.filter((n) => n.isEditing && n.medicine_name);
1057
+ if (o.length !== 0)
1058
+ try {
1059
+ await b?.(o) && o.forEach((I) => {
1060
+ i?.({ ...I, isEditing: !1 });
1061
+ });
1062
+ } catch (n) {
1063
+ console.error("Bulk save failed", n);
1064
+ } finally {
1065
+ y?.(!1);
1066
+ }
1067
+ }, [a, b, i, y]);
1068
+ Q(() => {
1069
+ k && V();
1070
+ }, [k, V]), Q(() => {
1071
+ const o = a.some((n) => n.isEditing);
1072
+ y?.(o);
1073
+ }, [a, y]);
1074
+ const r = W((o) => {
1075
+ S(o), H(!0);
1076
+ }, []), x = W(async () => {
1077
+ if (B)
1078
+ try {
1079
+ await C?.(B);
1080
+ } catch (o) {
1081
+ console.error("Delete failed", o);
1082
+ } finally {
1083
+ s(null);
1084
+ }
1085
+ }, [B, C]), f = W(() => {
1086
+ s(null);
1087
+ }, []), u = W(
1088
+ async (o) => {
1089
+ try {
1090
+ return await b?.([o]) ? (i?.({ ...o, isEditing: !1 }), !0) : !1;
1091
+ } catch (n) {
1092
+ return console.error("Save row failed", n), !1;
1093
+ }
1094
+ },
1095
+ [b, i]
1096
+ ), z = W(async () => {
1097
+ const o = a.filter((n) => n.isEditing && n.medicine_name);
1098
+ if (o.length === 0) return !0;
1099
+ try {
1100
+ const n = await b?.(o);
1101
+ return n && a.map((j) => j.isEditing ? { ...j, isEditing: !1 } : j).forEach((j) => i?.(j)), !!n;
1102
+ } catch (n) {
1103
+ return console.error("External bulk save failed", n), !1;
1104
+ }
1105
+ }, [a, b, i]);
1106
+ Ke(L, () => ({
1107
+ triggerExternalSave: z
1108
+ }));
1109
+ const E = {
1110
+ variant: t,
1111
+ externallyTriggeredEditMode: _,
1112
+ externallyTriggeredEditRowIds: g,
1113
+ getMedicineOptions: N,
1114
+ onRowChange: (o, n) => {
1115
+ X(o.rowId, o, n), i?.(o, n);
1116
+ },
1117
+ onRowDelete: C,
1118
+ onRowCopy: w,
1119
+ setRowToDelete: s,
1120
+ openPopupForRow: r
1121
+ };
1122
+ return /* @__PURE__ */ e.jsxs("div", { className: "hfl-border-1 hfl-border-Gray-200", children: [
1123
+ /* @__PURE__ */ e.jsx("div", { className: "table-header hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-py-2 hfl-px-2 hfl-font-bold hfl-border-b-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50", children: Ue.map((o) => /* @__PURE__ */ e.jsx($, { variant: "Medium", type: "Text sm", className: "hfl-text-Blue_gray-600", children: o }, o)) }),
1124
+ /* @__PURE__ */ e.jsxs(Oe.Provider, { value: E, children: [
1125
+ /* @__PURE__ */ e.jsx("div", { className: "table-body", children: a.length === 0 ? /* @__PURE__ */ e.jsx($, { variant: "Medium", type: "Text sm", className: "hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3", children: "No medicines added" }) : a.map((o) => /* @__PURE__ */ e.jsx(
1126
+ sl,
1127
+ {
1128
+ rowData: o,
1129
+ isEditing: o.isEditing || !1,
1130
+ setIsEditing: (n) => X(o.rowId, { isEditing: n }),
1131
+ onSaveRow: u,
1132
+ allowCustomMedicineInput: m
1133
+ },
1134
+ o.rowId
1135
+ )) }),
1136
+ /* @__PURE__ */ e.jsx(
1137
+ il,
1138
+ {
1139
+ headingText: "Delete Medicine",
1140
+ subHeadingText: "Are you sure you want to delete this medicine?",
1141
+ openState: !!B,
1142
+ positiveButtonText: "Delete",
1143
+ negativeButtonText: "Cancel",
1144
+ positiveActionCallback: x,
1145
+ negativeActionCallback: f,
1146
+ classNameNegativeBtn: "hfl-bg-Blue-600",
1147
+ classNamePositiveBtn: "hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",
1148
+ closePopupCallback: f
1149
+ }
1150
+ ),
1151
+ /* @__PURE__ */ e.jsx(
1152
+ rl,
1153
+ {
1154
+ open: p,
1155
+ onCancel: () => H(!1),
1156
+ onCopySave: w,
1157
+ rowMedicineData: M,
1158
+ getMedicineOptions: N
1159
+ }
1160
+ )
1161
+ ] })
1162
+ ] });
1163
+ }
1164
+ );
1165
+ export {
1166
+ pl as P
1167
+ };