angular.module("c8y.assets").factory("c8yComparisons",["$q","c8yBase","gettext",function(e,a,E){var u=a.createEnum([{name:"EQUAL",value:"EQUAL",label:E("Equal")},{name:"NOT_EQUAL",value:"NOT_EQUAL",label:E("Not equal")},{name:"GREATER_THAN_OR_EQUAL",value:"GREATER_THAN_OR_EQUAL",label:E("Greater than or equal")},{name:"GREATER_THAN",value:"GREATER_THAN",label:E("Greater than")},{name:"LESS_THAN_OR_EQUAL",value:"LESS_THAN_OR_EQUAL",label:E("Less than or equal")},{name:"LESS_THAN",value:"LESS_THAN",label:E("Less than")}]),A={Equal:u.EQUAL.value,"Not equal":u.NOT_EQUAL.value,"Greater then or equal":u.LESS_THAN_OR_EQUAL.value,"Greater than":u.LESS_THAN.value,"Less than or equal":u.GREATER_THAN_OR_EQUAL.value,"Less than":u.GREATER_THAN.value};return{Comparisons:u,compare:function(e,a,E){var A,r=a,l=E,a=_.find(u.values(),{value:e})||u.EQUAL;switch(_.isNaN(Number(r))||(r=Number(r)),_.isNaN(Number(l))||(l=Number(l)),a){case u.EQUAL:A=r===l;break;case u.NOT_EQUAL:A=r!==l;break;case u.GREATER_THAN_OR_EQUAL:A=l<=r;break;case u.GREATER_THAN:A=l<r;break;case u.LESS_THAN_OR_EQUAL:A=r<=l;break;case u.LESS_THAN:A=r<l}return A},convertDeprecatedComparisonType:function(e){return A[e]||e}}}]);