(()=>{function e(a,n,i){return{getColumn:function(r){var e=_.merge({header:r.name,cell:{template:"{{item.".concat(r.name,"}}"),class:"table-cell-truncate",innerClass:"truncated-cell-content"}},r);r.filteringByBoolean&&(e.filtering={schema:{type:"object",properties:{checked:{type:"boolean"},unchecked:{type:"boolean"}}},form:[{type:"template",template:["<label><span translate>",n("Show checkboxes that are"),"</span>:</label>"].join("")},{key:"checked",title:i.getString("Checked")},{key:"unchecked",title:i.getString("Unchecked")}],getFilter:function(t){var e;return e=t.checked||t.unchecked?function(e){e=_.get(e,r.filteringByBoolean.itemProperty);return t.checked&&e||t.unchecked&&!e}:e}});r.filteringByPattern&&(e.filtering={schema:{type:"object",properties:{patterns:{type:"array",items:{type:"string"}}}},form:[{key:"patterns",title:i.getString("Filter by pattern"),add:i.getString("Or"),items:[{key:"patterns[]",notitle:!0,placeholder:i.getString("e.g. value, you can use an asterisk (*) as wildcard character")}]}],getFilter:_.partial(o,"patterns",r.filteringByPattern.itemProperty)});r.filteringByMinMax&&(e.filtering={schema:{type:"object",properties:{min:{type:"number"},max:{type:"number"}}},form:[{key:"min",title:i.getString("Filter by minimum value")},{key:"max",title:i.getString("Filter by maximum value")}],getFilter:_.partial(l,"min","max",r.filteringByMinMax.itemProperty)});r.filteringByMinMaxDate&&(e.filtering={schema:{type:"object",properties:{minDate:{type:"string",format:"datetime"},maxDate:{type:"string",format:"datetime"}}},form:[{key:"minDate",title:i.getString("Filter by minimum date")},{key:"maxDate",title:i.getString("Filter by maximum date")}],getFilter:_.partial(l,"minDate","maxDate",r.filteringByMinMaxDate.itemProperty)});{var t;r.sortingByPath&&(t=r.sortingByPath.itemProperty,e.sorting={path:_.isArray(t)?t.join("."):t})}return e},getPatternFilterFromModel:o,getMinMaxFilterFromModel:l,filterSort:function(e,t,r){var n=((e,r)=>_.map(e,function(e){var t=_.get(r,e.name);return a.getColumnFilter(e,t)}))(t,r),t=((e,i)=>_.transform(e,function(r,e){var t=_.get(i,e.name),n=a.getColumnSort(e,t);e.sorting&&(e.sorting.path||e.sorting.paths)&&0!==n.order&&(t=e.sorting.paths||[{path:e.sorting.path,orderModifier:1}],_.forEach(t,function(e){var t=n.order*e.orderModifier;r.paths.push(e.path),r.orders.push(1==t?"asc":"desc")}))},{paths:[],orders:[]}))(t,r),i=_(e);return _.map(n,function(e){i=i.filter(e)}),(i=i.orderBy(t.paths,t.orders)).value()}};function o(e,r,t){var n,i=_.get(t,e,[]);return n=i.length?function(t){return _.some(i,function(e){return!e||(e=>(e=e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&").replace(/\\\*/g,".*"),e="^".concat(e,"$"),new RegExp(e)))(e).test(_.get(t,r))})}:n}function l(e,t,r,n){var i,a=_.get(n,e),o=_.get(n,t),l=!_.isUndefined(a)&&!_.isNull(a),g=!_.isUndefined(o)&&!_.isNull(o);return i=l||g?function(e){e=_.get(e,r);return(!l||a<=e)&&(!g||e<=o)}:i}}e.$inject=["c8yFilteringSortingColumns","gettext","gettextCatalog"],angular.module("c8y.ui").factory("c8yFilteringSortingCollections",e)})();