import{C as Comparison}from"./filter-cbaa3d7d.js";var getDefaultFilterValues=function(e,r){var t={};e.fields.forEach((function(e){var i=e.field||r.find((function(r){return r.id===e.fieldId}));if(i.value){t[i.id]=i.value}}));return t};var getFilterFields=function(e,r){return e.fields.map((function(e){return e.field||r.find((function(r){return r.id===e.fieldId}))}))};var generateDefaultFilters=function(e,r){var t=getFilterFields(e,r);return generateFilters(t,getDefaultFilterValues(e,t))};var generateFilters=function(e,r){var t=[];var i=generateFieldFilters(e,r);if(i.filters.length){t.push(i)}if(t.length===0){return undefined}else if(t.length===1){return t[0]}else{return{operator:"and",filters:t}}};var generateFieldFilters=function(e,r){return{operator:"and",filters:e.filter((function(e){return!!r[e.id]})).map((function(e){return{comparison:Comparison.Contain,id:e.id,value:r[e.id]}}))}};export{generateFilters as a,getDefaultFilterValues as b,generateDefaultFilters as g};