hplx-feature-library 1.0.41 → 1.0.42

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.
@@ -1,4 +1,4 @@
1
- import { P as f } from "../PediatricsCalculatorTable-C135fTvI.js";
1
+ import { P as f } from "../PediatricsCalculatorTable-MqLciBeP.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -90,7 +90,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
90
90
  font-size: ${Z?.fontSize};
91
91
  color: ${Z?.color};
92
92
  }
93
- `}),W.jsx("input",{ref:Pe,style:y?{}:{width:`${Number(f?.length)>4?(f?.length||0)+5:12}ch`},type:b,placeholder:i,value:f,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 ${_?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":F||"hfl-bg-White"} ${h||""}`,onChange:we=>{d&&d(we.target.value),At(!0)},onClick:Fr,onKeyDown:we=>L&&L(we,K,Pe),maxLength:V??V}),!e&&!n&&W.jsx("i",{className:"hx_down hfl-mx-2"}),n&&W.jsx("i",{className:`${f?"hx_close hfl-cursor-pointer":"hx_down"} hfl-mx-2`,onClick:()=>{(u?.value||f)&&(d&&d(""),At(!0))}}),T?W.jsx("span",{style:{left:`${ur<2?"3":ur}ch`},className:"hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",children:T}):null]}),$&&W.jsx("span",{className:"hfl-text-0 hfl-text-Error-600",children:O})]}):W.jsxs("button",{ref:Ke,onClick:_t,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 ${s||""} ${N||"hfl-border-1"} ${O?"hfl-border-Error-300":"hfl-border-Gray-300"} ${x||"hfl-h-[40px]"} ${_?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":""}`,style:k||u?.label?{}:Z?{fontFamily:Z?.fontFamily,fontSize:Z?.fontSize,fontWeight:Z?.fontWeight,lineHeight:Z?.lineHeight,color:Z?.color}:{},children:[W.jsx("span",{className:"hfl-pr-4",children:k||u?.label||i||"Select an option"}),W.jsx("img",{src:F1,alt:"down arrow"})]}),l&&l?.length>=0&&W.jsxs("ul",{ref:de,className:`${te?"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 ${E?"hfl-min-w-[20em]":"hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${A}`,role:"menu","aria-orientation":"vertical","aria-labelledby":"options-menu",children:[G?W.jsx(A1,{onChangeHandler:q,selectedOption:j,options:P}):!1,(m?Qe:l)?.map((we,qe)=>{const ot=E?!!v?.some(Wn=>Wn.value===we?.value):!1,Lr=u?.value===we?.value,Bi=ue===qe;return we?W.jsx("li",{onClick:()=>{E?gr(we):(c&&c(we),K(!1),At(!1))},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 ${M?"odd:hfl-bg-Gray-100":""} ${Lr?"hfl-bg-Blue-50 hfl-text-Blue-500":""}`,role:"menuitem","aria-selected":Lr,tabIndex:Bi?0:-1,ref:Wn=>{Ge.current[qe]=Wn},children:E?W.jsx(wm,{size:"sm",disabled:!1,text:W.jsx("span",{children:we.label}),secondaryText:"",id:`${we.label}-${qe}`,isMarked:ot}):we.label},`${we.label}-${qe}`):null}),l?.length===0&&B&&W.jsx("li",{className:"hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item",children:"No items found, please change the search criteria"})]})]})}var el,oh;function L1(){if(oh)return el;oh=1;var t="Expected a function",r=NaN,a="[object Symbol]",e=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,i=parseInt,l=typeof qa=="object"&&qa&&qa.Object===Object&&qa,u=typeof self=="object"&&self&&self.Object===Object&&self,c=l||u||Function("return this")(),f=Object.prototype,d=f.toString,p=Math.max,h=Math.min,m=function(){return c.Date.now()};function b(y,v,E){var H,G,q,j,P,N,x=0,_=!1,F=!1,O=!0;if(typeof y!="function")throw new TypeError(t);v=S(v)||0,C(E)&&(_=!!E.leading,F="maxWait"in E,q=F?p(S(E.maxWait)||0,v):q,O="trailing"in E?!!E.trailing:O);function $(R){var I=H,z=G;return H=G=void 0,x=R,j=y.apply(z,I),j}function Z(R){return x=R,P=setTimeout(J,v),_?$(R):j}function L(R){var I=R-N,z=R-x,Q=v-I;return F?h(Q,q-z):Q}function B(R){var I=R-N,z=R-x;return N===void 0||I>=v||I<0||F&&z>=q}function J(){var R=m();if(B(R))return A(R);P=setTimeout(J,L(R))}function A(R){return P=void 0,O&&H?$(R):(H=G=void 0,j)}function U(){P!==void 0&&clearTimeout(P),x=0,H=N=G=P=void 0}function V(){return P===void 0?j:A(m())}function M(){var R=m(),I=B(R);if(H=arguments,G=this,N=R,I){if(P===void 0)return Z(N);if(F)return P=setTimeout(J,v),$(N)}return P===void 0&&(P=setTimeout(J,v)),j}return M.cancel=U,M.flush=V,M}function C(y){var v=typeof y;return!!y&&(v=="object"||v=="function")}function T(y){return!!y&&typeof y=="object"}function k(y){return typeof y=="symbol"||T(y)&&d.call(y)==a}function S(y){if(typeof y=="number")return y;if(k(y))return r;if(C(y)){var v=typeof y.valueOf=="function"?y.valueOf():y;y=C(v)?v+"":v}if(typeof y!="string")return y===0?y:+y;y=y.replace(e,"");var E=o.test(y);return E||s.test(y)?i(y.slice(2),E?2:8):n.test(y)?r:+y}return el=b,el}var W1=L1();const Y1=eu(W1),wr=t=>/^(\d+)?(\.)?(\d*)?$/.test(t),Qt=({label:t,children:r})=>W.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",children:[W.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),W.jsx("div",{className:"hfl-flex-1 hfl-min-w-0",children:r})]}),Xt=({label:t,value:r})=>W.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-text-Blue_gray-800 hfl-gap-1",children:[W.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),W.jsx($e,{variant:"Bold",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0",children:r||"--"})]}),na=({children:t,className:r=""})=>W.jsx($e,{variant:"Regular",type:"Text sm",className:`hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${r}`,children:t}),U1=ae.memo(function({rowData:r,isEditing:a,setIsEditing:e,onSaveRow:n}){const{variant:o,externallyTriggeredEditMode:s,externallyTriggeredEditRowIds:i,getMedicineOptions:l,onRowChange:u,onRowDelete:c}=iy(),[f,d]=ae.useState([]),[p,h]=ae.useState(r);ae.useEffect(()=>{a||h(r)},[r,a]);const m=async x=>(await l?.(x))?.map(F=>({label:F.doctorMedicineName,value:F}))||[],C=s||i?.includes(r.rowId)||a,T=ae.useMemo(()=>p.out_of_range||r.out_of_range,[p.out_of_range,r.out_of_range]),k=ae.useMemo(()=>p?.isDosageMismatch||r?.isDosageMismatch,[p?.isDosageMismatch,r?.isDosageMismatch]),S=ae.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[0]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),y=ae.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[1]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),v=(x,_)=>{let F;if(x==="calculation_type"){const O=_,$={frequency:p.calculation_fields.frequency,pedia_dosage:o==="standard"?p.calculation_fields.pedia_dosage:p.pedia_dosage};F={...p,calculation_type:O,calculation_fields:O==="mg/kg/dose"?{...wt.C_DefaultMgKgFields,...$}:{...wt.C_DefaultMlKgFields,...$}}}else F={...p,[x]:_};h(F),o==="prescription"&&E(F,x)},E=ae.useMemo(()=>Y1((x,_)=>{u?.(x,_||void 0)},500),[u]),H=ae.useMemo(()=>W.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:[W.jsx("div",{className:"hx_warning hfl-text-Error-400"}),W.jsx($e,{variant:"Regular",type:"Text sm",className:"hfl-px-2 hfl-text-1 hfl-text-Error-500",children:"Dosage exceeds safety limits"})]}),[]);ae.useEffect(()=>()=>{E.cancel()},[E]);const G=ae.useCallback((x,_)=>{h(F=>{let O={...F.calculation_fields,[x]:_};if(x==="frequency"&&o==="standard"){const Z=wt.C_FrequencyDosageMap[_]||[];Z.length>0&&(O={...O,pedia_dosage:Z[0]})}const $={...F,calculation_fields:O};return o==="prescription"&&E($,x),$})},[E,o]),q=async()=>{const x={...p,calculation_fields:{...p.calculation_fields}};await n?.(x)&&E({...x,isNewlyAdded:!1,isEditing:!1})},j=async()=>{if(!r.medicine_name||r.medicine_name.trim()===""){c?.(r.rowId);return}h(r),o==="standard"&&e(!1)},P=x=>o==="prescription"?!["medicine_name","generic_name","type","calculation_type"].includes(x):C,N=()=>{const x=!(p?.isSavedToLibrary??!1),_={...p,isSavedToLibrary:x};h(_),E(_,"isSavedToLibrary")};return W.jsxs("div",{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 ${C?"hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50":""}`,children:[W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("medicine_name")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",inputValue:p.medicine_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:async x=>{if(v("medicine_name",x),x.trim()){const _=await m(x);d(_)}else d([])},onInputFocus:async()=>{const x=await m(p.medicine_name);d(x)},onChangeHandler:x=>{const _=x.value,F=wt.C_MedicineTypeList.find(O=>O.val===_.medicineType);h(O=>({...O,medicine_name:_.doctorMedicineName,medicine_id:_.medicineId,generic_name:_.doctorGenericName,type:F?.type??""}))},options:f,isSearchable:!0,placeholder:"Search medicine",disabled:!p?.isNewlyAdded}):W.jsx(na,{children:r.medicine_name})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("generic_name")?W.jsx(st,{wrapperClass:"hfl-w-full",inputClassName:"hfl-w-full",btnClassName:"hfl-w-full",inputValue:p.generic_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:x=>v("generic_name",x),hideDropdownIcon:!0}):W.jsx(na,{children:r.generic_name})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("type")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:(()=>{const x=wt.C_MedicineTypeList.find(_=>_.type===p.type);return x?{label:x.type,value:x.type}:void 0})(),options:wt.C_MedicineTypeList.map(x=>({label:x.type,value:x.type})),onChangeHandler:x=>v("type",x.value)}):W.jsx(na,{children:r.type||""})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("calculation_type")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:{label:p.calculation_type,value:p.calculation_type},options:wt.C_MedicineCalculatorList.map(x=>({label:x,value:x})),onChangeHandler:x=>v("calculation_type",x.value)}):W.jsx(na,{children:r.calculation_type})}),W.jsx("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2",children:P("calculation_fields")?W.jsxs(W.Fragment,{children:[S&&W.jsxs(W.Fragment,{children:[W.jsx(Qt,{label:"Drug Strength",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.drug_strength||"",inputChangeHandler:x=>{wr(x)&&G("drug_strength",x)}})}),W.jsx(Qt,{label:"Dose/mg/kg",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.dose_mg_kg||"",inputChangeHandler:x=>{wr(x)&&G("dose_mg_kg",x)}})}),W.jsx(Qt,{label:"Frequency",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(x=>({label:x,value:x})),onChangeHandler:x=>{G("frequency",x.value)}})}),W.jsx(Qt,{label:"Max Dose (mg)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_mg_dose||"",inputChangeHandler:x=>{wr(x)&&G("max_mg_dose",x)}})}),W.jsx(Qt,{label:"Max Day (mg)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_mg_day||"",inputChangeHandler:x=>{wr(x)&&G("max_mg_day",x)}})})]}),y&&W.jsxs(W.Fragment,{children:[W.jsx(Qt,{label:"Multiplier",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 0.5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:y.multiplier||"",inputChangeHandler:x=>{wr(x)&&G("multiplier",x)}})}),W.jsx(Qt,{label:"Dose/mL/kg",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:y.dose_ml_kg||"",inputChangeHandler:x=>{wr(x)&&G("dose_ml_kg",x)}})}),W.jsx(Qt,{label:"Frequency",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(x=>({label:x,value:x})),onChangeHandler:x=>{G("frequency",x.value)}})}),W.jsx(Qt,{label:"Max Dose (mL)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:y.max_ml_dose||"",inputChangeHandler:x=>{wr(x)&&G("max_ml_dose",x)}})}),W.jsx(Qt,{label:"Max Day (mL)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:y.max_ml_day||"",inputChangeHandler:x=>{wr(x)&&G("max_ml_day",x)}})})]})]}):W.jsxs(W.Fragment,{children:[S&&W.jsxs(W.Fragment,{children:[W.jsx(Xt,{label:"Drug Strength",value:S.drug_strength}),W.jsx(Xt,{label:"Dose/mg/kg",value:S.dose_mg_kg}),W.jsx(Xt,{label:"Frequency",value:S.frequency}),W.jsx(Xt,{label:"Max Dose (mg)",value:S.max_mg_dose}),W.jsx(Xt,{label:"Max Day (mg)",value:S.max_mg_day})]}),y&&W.jsxs(W.Fragment,{children:[W.jsx(Xt,{label:"Multiplier",value:y.multiplier}),W.jsx(Xt,{label:"Dose/mL/kg",value:y.dose_ml_kg}),W.jsx(Xt,{label:"Frequency",value:y.frequency}),W.jsx(Xt,{label:"Max Dose (mL)",value:y.max_ml_dose}),W.jsx(Xt,{label:"Max Day (mL)",value:y.max_ml_day})]})]})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("pedia_dosage")?(()=>{const x=p.calculation_fields.frequency,_=wt.C_FrequencyDosageMap[x]||[];return W.jsx(W.Fragment,{children:W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",placeholder:"Select",showInput:o!=="standard",disableInputAutoSize:!0,inputValue:o==="standard"?p.calculation_fields.pedia_dosage:p.pedia_dosage,inputChangeHandler:F=>o==="prescription"?v("pedia_dosage",F):G("pedia_dosage",F),selectedOption:o==="standard"?{label:p.calculation_fields.pedia_dosage,value:p.calculation_fields.pedia_dosage}:void 0,options:o!=="prescription"?_.map(F=>({label:F,value:F})):void 0,onChangeHandler:o!=="prescription"?F=>G("pedia_dosage",F.value):void 0,hideDropdownIcon:o==="prescription",showEmptyDropdownPopup:o!=="prescription",showErrorMsg:o==="prescription"?T||k:!1,errorMsg:o==="prescription"&&T?"Dosage Exceeds Safety Limits":o==="prescription"&&k?"Dosage is in mismatch with selected type of Frequency":""})})})():W.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0",children:[W.jsx(na,{children:o==="prescription"?r.pedia_dosage:r.calculation_fields.pedia_dosage}),T&&H]})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:W.jsx(R1,{effectiveEditMode:C,rowData:r,isSavedToLibrary:p.isSavedToLibrary??!1,onSave:q,onCancel:j,onEdit:()=>e(!0),onCheckboxToggle:N})})]})},(t,r)=>t.isEditing===r.isEditing&&t.rowData.rowId===r.rowData.rowId&&t.rowData.isEditing===r.rowData.isEditing&&t.rowData.medicine_name===r.rowData.medicine_name&&t.rowData.generic_name===r.rowData.generic_name&&t.rowData.type===r.rowData.type&&t.rowData.pedia_dosage===r.rowData.pedia_dosage&&t.rowData.calculation_type===r.rowData.calculation_type&&JSON.stringify(t.rowData.calculation_fields)===JSON.stringify(r.rowData.calculation_fields)&&t.rowData.out_of_range===r.rowData.out_of_range&&t.rowData.isDosageMismatch===r.rowData.isDosageMismatch&&t.rowData.calculation_fields.pedia_dosage===r.rowData.calculation_fields.pedia_dosage&&t.rowData?.isNewlyAdded===r.rowData?.isNewlyAdded);var vo={exports:{}},xr={},yo={exports:{}},kt={},go={exports:{}},ih;function sy(){return ih||(ih=1,function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=c;/*!
93
+ `}),W.jsx("input",{ref:Pe,style:y?{}:{width:`${Number(f?.length)>4?(f?.length||0)+5:12}ch`},type:b,placeholder:i,value:f,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 ${_?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":F||"hfl-bg-White"} ${h||""}`,onChange:we=>{d&&d(we.target.value),At(!0)},onClick:Fr,onKeyDown:we=>L&&L(we,K,Pe),maxLength:V??V}),!e&&!n&&W.jsx("i",{className:"hx_down hfl-mx-2"}),n&&W.jsx("i",{className:`${f?"hx_close hfl-cursor-pointer":"hx_down"} hfl-mx-2`,onClick:()=>{(u?.value||f)&&(d&&d(""),At(!0))}}),T?W.jsx("span",{style:{left:`${ur<2?"3":ur}ch`},className:"hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",children:T}):null]}),$&&W.jsx("span",{className:"hfl-text-0 hfl-text-Error-600",children:O})]}):W.jsxs("button",{ref:Ke,onClick:_t,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 ${s||""} ${N||"hfl-border-1"} ${O?"hfl-border-Error-300":"hfl-border-Gray-300"} ${x||"hfl-h-[40px]"} ${_?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":""}`,style:k||u?.label?{}:Z?{fontFamily:Z?.fontFamily,fontSize:Z?.fontSize,fontWeight:Z?.fontWeight,lineHeight:Z?.lineHeight,color:Z?.color}:{},children:[W.jsx("span",{className:"hfl-pr-4",children:k||u?.label||i||"Select an option"}),W.jsx("img",{src:F1,alt:"down arrow"})]}),l&&l?.length>=0&&W.jsxs("ul",{ref:de,className:`${te?"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 ${E?"hfl-min-w-[20em]":"hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${A}`,role:"menu","aria-orientation":"vertical","aria-labelledby":"options-menu",children:[G?W.jsx(A1,{onChangeHandler:q,selectedOption:j,options:P}):!1,(m?Qe:l)?.map((we,qe)=>{const ot=E?!!v?.some(Wn=>Wn.value===we?.value):!1,Lr=u?.value===we?.value,Bi=ue===qe;return we?W.jsx("li",{onClick:()=>{E?gr(we):(c&&c(we),K(!1),At(!1))},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 ${M?"odd:hfl-bg-Gray-100":""} ${Lr?"hfl-bg-Blue-50 hfl-text-Blue-500":""}`,role:"menuitem","aria-selected":Lr,tabIndex:Bi?0:-1,ref:Wn=>{Ge.current[qe]=Wn},children:E?W.jsx(wm,{size:"sm",disabled:!1,text:W.jsx("span",{children:we.label}),secondaryText:"",id:`${we.label}-${qe}`,isMarked:ot}):we.label},`${we.label}-${qe}`):null}),l?.length===0&&B&&W.jsx("li",{className:"hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item",children:"No items found, please change the search criteria"})]})]})}var el,oh;function L1(){if(oh)return el;oh=1;var t="Expected a function",r=NaN,a="[object Symbol]",e=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,i=parseInt,l=typeof qa=="object"&&qa&&qa.Object===Object&&qa,u=typeof self=="object"&&self&&self.Object===Object&&self,c=l||u||Function("return this")(),f=Object.prototype,d=f.toString,p=Math.max,h=Math.min,m=function(){return c.Date.now()};function b(y,v,E){var H,G,q,j,P,N,x=0,_=!1,F=!1,O=!0;if(typeof y!="function")throw new TypeError(t);v=S(v)||0,C(E)&&(_=!!E.leading,F="maxWait"in E,q=F?p(S(E.maxWait)||0,v):q,O="trailing"in E?!!E.trailing:O);function $(R){var I=H,z=G;return H=G=void 0,x=R,j=y.apply(z,I),j}function Z(R){return x=R,P=setTimeout(J,v),_?$(R):j}function L(R){var I=R-N,z=R-x,Q=v-I;return F?h(Q,q-z):Q}function B(R){var I=R-N,z=R-x;return N===void 0||I>=v||I<0||F&&z>=q}function J(){var R=m();if(B(R))return A(R);P=setTimeout(J,L(R))}function A(R){return P=void 0,O&&H?$(R):(H=G=void 0,j)}function U(){P!==void 0&&clearTimeout(P),x=0,H=N=G=P=void 0}function V(){return P===void 0?j:A(m())}function M(){var R=m(),I=B(R);if(H=arguments,G=this,N=R,I){if(P===void 0)return Z(N);if(F)return P=setTimeout(J,v),$(N)}return P===void 0&&(P=setTimeout(J,v)),j}return M.cancel=U,M.flush=V,M}function C(y){var v=typeof y;return!!y&&(v=="object"||v=="function")}function T(y){return!!y&&typeof y=="object"}function k(y){return typeof y=="symbol"||T(y)&&d.call(y)==a}function S(y){if(typeof y=="number")return y;if(k(y))return r;if(C(y)){var v=typeof y.valueOf=="function"?y.valueOf():y;y=C(v)?v+"":v}if(typeof y!="string")return y===0?y:+y;y=y.replace(e,"");var E=o.test(y);return E||s.test(y)?i(y.slice(2),E?2:8):n.test(y)?r:+y}return el=b,el}var W1=L1();const Y1=eu(W1),wr=t=>/^(\d+)?(\.)?(\d*)?$/.test(t),Qt=({label:t,children:r})=>W.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",children:[W.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),W.jsx("div",{className:"hfl-flex-1 hfl-min-w-0",children:r})]}),Xt=({label:t,value:r})=>W.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-text-Blue_gray-800 hfl-gap-1",children:[W.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),W.jsx($e,{variant:"Bold",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0",children:r||"--"})]}),na=({children:t,className:r=""})=>W.jsx($e,{variant:"Regular",type:"Text sm",className:`hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${r}`,children:t}),U1=ae.memo(function({rowData:r,isEditing:a,setIsEditing:e,onSaveRow:n}){const{variant:o,externallyTriggeredEditMode:s,externallyTriggeredEditRowIds:i,getMedicineOptions:l,onRowChange:u,onRowDelete:c}=iy(),[f,d]=ae.useState([]),[p,h]=ae.useState(r);ae.useEffect(()=>{a||h(r)},[r,a]);const m=async x=>(await l?.(x))?.map(F=>({label:F.doctorMedicineName,value:F}))||[],C=s||i?.includes(r.rowId)||a,T=ae.useMemo(()=>p.out_of_range||r.out_of_range,[p.out_of_range,r.out_of_range]),k=ae.useMemo(()=>p?.isDosageMismatch||r?.isDosageMismatch,[p?.isDosageMismatch,r?.isDosageMismatch]),S=ae.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[0]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),y=ae.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[1]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),v=(x,_)=>{let F;if(x==="calculation_type"){const O=_,$={frequency:p.calculation_fields.frequency,pedia_dosage:o==="standard"?p.calculation_fields.pedia_dosage:p.pedia_dosage};F={...p,calculation_type:O,calculation_fields:O==="mg/kg/dose"?{...wt.C_DefaultMgKgFields,...$}:{...wt.C_DefaultMlKgFields,...$}}}else F={...p,[x]:_};h(F),o==="prescription"&&E(F,x)},E=ae.useMemo(()=>Y1((x,_)=>{u?.(x,_||void 0)},500),[u]),H=ae.useMemo(()=>W.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:[W.jsx("div",{className:"hx_warning hfl-text-Error-400"}),W.jsx($e,{variant:"Regular",type:"Text sm",className:"hfl-px-2 hfl-text-1 hfl-text-Error-500",children:"Dosage exceeds safety limits"})]}),[]);ae.useEffect(()=>()=>{E.cancel()},[E]);const G=ae.useCallback((x,_)=>{h(F=>{let O={...F.calculation_fields,[x]:_};if(x==="frequency"&&o==="standard"){const Z=wt.C_FrequencyDosageMap[_]||[];Z.length>0&&(O={...O,pedia_dosage:Z[0]})}const $={...F,calculation_fields:O};return o==="prescription"&&E($,x),$})},[E,o]),q=async()=>{const x={...p,calculation_fields:{...p.calculation_fields}};await n?.(x)&&E({...x,isNewlyAdded:!1,isEditing:!1})},j=async()=>{if(!r.medicine_name||r.medicine_name.trim()===""){c?.(r.rowId);return}h(r),o==="standard"&&e(!1)},P=x=>o==="prescription"?!["medicine_name","generic_name","type","calculation_type"].includes(x):C,N=()=>{const x=!(p?.isSavedToLibrary??!1),_={...p,isSavedToLibrary:x};h(_),E(_,"isSavedToLibrary")};return W.jsxs("div",{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 ${C?"hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50":""} ${o==="prescription"&&!p.pedia_data_available?"hfl-hidden":""}`,children:[W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("medicine_name")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",inputValue:p.medicine_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:async x=>{if(v("medicine_name",x),x.trim()){const _=await m(x);d(_)}else d([])},onInputFocus:async()=>{const x=await m(p.medicine_name);d(x)},onChangeHandler:x=>{const _=x.value,F=wt.C_MedicineTypeList.find(O=>O.val===_.medicineType);h(O=>({...O,medicine_name:_.doctorMedicineName,medicine_id:_.medicineId,generic_name:_.doctorGenericName,type:F?.type??""}))},options:f,isSearchable:!0,placeholder:"Search medicine",disabled:!p?.isNewlyAdded}):W.jsx(na,{children:r.medicine_name})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("generic_name")?W.jsx(st,{wrapperClass:"hfl-w-full",inputClassName:"hfl-w-full",btnClassName:"hfl-w-full",inputValue:p.generic_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:x=>v("generic_name",x),hideDropdownIcon:!0}):W.jsx(na,{children:r.generic_name})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("type")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:(()=>{const x=wt.C_MedicineTypeList.find(_=>_.type===p.type);return x?{label:x.type,value:x.type}:void 0})(),options:wt.C_MedicineTypeList.map(x=>({label:x.type,value:x.type})),onChangeHandler:x=>v("type",x.value)}):W.jsx(na,{children:r.type||""})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("calculation_type")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:{label:p.calculation_type,value:p.calculation_type},options:wt.C_MedicineCalculatorList.map(x=>({label:x,value:x})),onChangeHandler:x=>v("calculation_type",x.value)}):W.jsx(na,{children:r.calculation_type})}),W.jsx("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2",children:P("calculation_fields")?W.jsxs(W.Fragment,{children:[S&&W.jsxs(W.Fragment,{children:[W.jsx(Qt,{label:"Drug Strength",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.drug_strength||"",inputChangeHandler:x=>{wr(x)&&G("drug_strength",x)}})}),W.jsx(Qt,{label:"Dose/mg/kg",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.dose_mg_kg||"",inputChangeHandler:x=>{wr(x)&&G("dose_mg_kg",x)}})}),W.jsx(Qt,{label:"Frequency",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(x=>({label:x,value:x})),onChangeHandler:x=>{G("frequency",x.value)}})}),W.jsx(Qt,{label:"Max Dose (mg)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_mg_dose||"",inputChangeHandler:x=>{wr(x)&&G("max_mg_dose",x)}})}),W.jsx(Qt,{label:"Max Day (mg)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_mg_day||"",inputChangeHandler:x=>{wr(x)&&G("max_mg_day",x)}})})]}),y&&W.jsxs(W.Fragment,{children:[W.jsx(Qt,{label:"Multiplier",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 0.5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:y.multiplier||"",inputChangeHandler:x=>{wr(x)&&G("multiplier",x)}})}),W.jsx(Qt,{label:"Dose/mL/kg",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:y.dose_ml_kg||"",inputChangeHandler:x=>{wr(x)&&G("dose_ml_kg",x)}})}),W.jsx(Qt,{label:"Frequency",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(x=>({label:x,value:x})),onChangeHandler:x=>{G("frequency",x.value)}})}),W.jsx(Qt,{label:"Max Dose (mL)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:y.max_ml_dose||"",inputChangeHandler:x=>{wr(x)&&G("max_ml_dose",x)}})}),W.jsx(Qt,{label:"Max Day (mL)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:y.max_ml_day||"",inputChangeHandler:x=>{wr(x)&&G("max_ml_day",x)}})})]})]}):W.jsxs(W.Fragment,{children:[S&&W.jsxs(W.Fragment,{children:[W.jsx(Xt,{label:"Drug Strength",value:S.drug_strength}),W.jsx(Xt,{label:"Dose/mg/kg",value:S.dose_mg_kg}),W.jsx(Xt,{label:"Frequency",value:S.frequency}),W.jsx(Xt,{label:"Max Dose (mg)",value:S.max_mg_dose}),W.jsx(Xt,{label:"Max Day (mg)",value:S.max_mg_day})]}),y&&W.jsxs(W.Fragment,{children:[W.jsx(Xt,{label:"Multiplier",value:y.multiplier}),W.jsx(Xt,{label:"Dose/mL/kg",value:y.dose_ml_kg}),W.jsx(Xt,{label:"Frequency",value:y.frequency}),W.jsx(Xt,{label:"Max Dose (mL)",value:y.max_ml_dose}),W.jsx(Xt,{label:"Max Day (mL)",value:y.max_ml_day})]})]})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:P("pedia_dosage")?(()=>{const x=p.calculation_fields.frequency,_=wt.C_FrequencyDosageMap[x]||[];return W.jsx(W.Fragment,{children:W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",placeholder:"Select",showInput:o!=="standard",disableInputAutoSize:!0,inputValue:o==="standard"?p.calculation_fields.pedia_dosage:p.pedia_dosage,inputChangeHandler:F=>o==="prescription"?v("pedia_dosage",F):G("pedia_dosage",F),selectedOption:o==="standard"?{label:p.calculation_fields.pedia_dosage,value:p.calculation_fields.pedia_dosage}:void 0,options:o!=="prescription"?_.map(F=>({label:F,value:F})):void 0,onChangeHandler:o!=="prescription"?F=>G("pedia_dosage",F.value):void 0,hideDropdownIcon:o==="prescription",showEmptyDropdownPopup:o!=="prescription",showErrorMsg:o==="prescription"?T||k:!1,errorMsg:o==="prescription"&&T?"Dosage Exceeds Safety Limits":o==="prescription"&&k?"Dosage is in mismatch with selected type of Frequency":""})})})():W.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0",children:[W.jsx(na,{children:o==="prescription"?r.pedia_dosage:r.calculation_fields.pedia_dosage}),T&&H]})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:W.jsx(R1,{effectiveEditMode:C,rowData:r,isSavedToLibrary:p.isSavedToLibrary??!1,onSave:q,onCancel:j,onEdit:()=>e(!0),onCheckboxToggle:N})})]})},(t,r)=>t.isEditing===r.isEditing&&t.rowData.rowId===r.rowData.rowId&&t.rowData.isEditing===r.rowData.isEditing&&t.rowData.medicine_name===r.rowData.medicine_name&&t.rowData.generic_name===r.rowData.generic_name&&t.rowData.type===r.rowData.type&&t.rowData.pedia_dosage===r.rowData.pedia_dosage&&t.rowData.calculation_type===r.rowData.calculation_type&&JSON.stringify(t.rowData.calculation_fields)===JSON.stringify(r.rowData.calculation_fields)&&t.rowData.out_of_range===r.rowData.out_of_range&&t.rowData.isDosageMismatch===r.rowData.isDosageMismatch&&t.rowData.calculation_fields.pedia_dosage===r.rowData.calculation_fields.pedia_dosage&&t.rowData?.isNewlyAdded===r.rowData?.isNewlyAdded&&t.rowData?.pedia_data_available===r.rowData?.pedia_data_available);var vo={exports:{}},xr={},yo={exports:{}},kt={},go={exports:{}},ih;function sy(){return ih||(ih=1,function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=c;/*!
94
94
  * Adapted from jQuery UI core
95
95
  *
96
96
  * http://jqueryui.com