"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../../../constants.js"),l=require("../../../../stores/picker-props-store/usePickerPropsStore.js"),i=require("../../../../stores/filter-store/useFilterStore.js"),s=require("../../../../hooks/useIsAllWellsLoading.js"),o=require("../../utils/isAllOrNoneSelected.js"),n=require("../MultiFilterSelect/MultiFilterSelect.js"),u=r.memo((function(u){var a=u.value,c=u.label,d=u.options,p=u.handleChangeFilter,m=u.dropdownClassName,f=l.usePickerPropsStore((function(e){return e.isLoadAllWells})),F=s.useIsAllWellsLoading(),j=i.useFilterStore((function(e){return e.filters[a]||[]})),S=a===t.FilterType.company,q=r.useMemo((function(){return S?d.map((function(e){return{id:e.id,title:e.name}})):d.map((function(e){return{id:e,title:e}}))}),[d,S]),v=r.useCallback((function(e){var r=o.isAllOrNoneSelected(e,d.length);S?p(a,r?f?[]:void 0:e):p(a,r?void 0:e)}),[d.length,S,f,p,a]);return e.jsx(n.MultiFilterSelect,{label:c,options:q,value:j,onChange:v,testId:"".concat("Filter","_select_").concat(c),dropdownClassName:m,loading:S&&F,disabled:!S&&F})}));u.displayName="FilterItem",exports.FilterItem=u;
//# sourceMappingURL=FilterItem.js.map
