text: /*!
   * OpenUI5
   * (c) Copyright 2009-2020 SAP SE or an SAP affiliate company.
   * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
   */
  sap.ui.define(["sap/ui/base/Object","./FilterOperator","sap/base/Log"],function(e,t,r){"use strict";var a=e.extend("sap.ui.model.Filter",{constructor:function(e,a,s,n){if(typeof e==="object"&&!Array.isArray(e)){this.sPath=e.path;this.sOperator=e.operator;this.oValue1=e.value1;this.oValue2=e.value2;this.sVariable=e.variable;this.oCondition=e.condition;this.aFilters=e.filters||e.aFilters;this.bAnd=e.and||e.bAnd;this.fnTest=e.test;this.fnCompare=e.comparator;this.bCaseSensitive=e.caseSensitive}else{if(Array.isArray(e)){this.aFilters=e}else{this.sPath=e}if(typeof a==="boolean"){this.bAnd=a}else if(typeof a==="function"){this.fnTest=a}else{this.sOperator=a}this.oValue1=s;this.oValue2=n;if(this.sOperator===t.Any||this.sOperator===t.All){throw new Error("The filter operators 'Any' and 'All' are only supported with the parameter object notation.")}}if(this.sOperator===t.Any){if(this.sVariable&&this.oCondition){this._checkLambdaArgumentTypes()}else if(!this.sVariable&&!this.oCondition){}else{throw new Error("When using the filter operator 'Any', a lambda variable and a condition have to be given or neither.")}}else if(this.sOperator===t.All){this._checkLambdaArgumentTypes()}else{if(Array.isArray(this.aFilters)&&!this.sPath&&!this.sOperator&&!this.oValue1&&!this.oValue2){this._bMultiFilter=true;if(!this.aFilters.every(i)){r.error("Filter in Aggregation of Multi filter has to be instance of sap.ui.model.Filter")}}else if(!this.aFilters&&this.sPath!==undefined&&(this.sOperator&&this.oValue1!==undefined||this.fnTest)){this._bMultiFilter=false}else{r.error("Wrong parameters defined for filter.")}}}});a.prototype._checkLambdaArgumentTypes=function(){if(!this.sVariable||typeof this.sVariable!=="string"){throw new Error("When using the filter operators 'Any' or 'All', a string has to be given as argument 'variable'.")}if(!i(this.oCondition)){throw new Error("When using the filter operator 'Any' or 'All', a valid instance of sap.ui.model.Filter has to be given as argument 'condition'.")}};function i(e){return e instanceof a}var s={Logical:"Logical",Binary:"Binary",Unary:"Unary",Lambda:"Lambda",Reference:"Reference",Literal:"Literal",Variable:"Variable",Call:"Call",Custom:"Custom"};var n={Equal:"==",NotEqual:"!=",LessThan:"<",GreaterThan:">",LessThanOrEqual:"<=",GreaterThanOrEqual:">=",And:"&&",Or:"||",Not:"!"};var o={Contains:"contains",StartsWith:"startswith",EndsWith:"endswith"};a.prototype.getAST=function(e){var r,a,i,l,h,u,f,c,p;function b(e,t,r){return{type:s.Logical,op:e,left:t,right:r}}function d(e,t,r){return{type:s.Binary,op:e,left:t,right:r}}function y(e,t){return{type:s.Unary,op:e,arg:t}}function A(e,t,r,a){return{type:s.Lambda,op:e,ref:t,variable:r,condition:a}}function g(e){return{type:s.Reference,path:e}}function T(e){return{type:s.Literal,value:e}}function m(e){return{type:s.Variable,name:e}}function E(e,t){return{type:s.Call,name:e,args:t}}if(this.aFilters){a=this.bAnd?n.And:n.Or;i=this.bAnd?"AND":"OR";r=this.aFilters[this.aFilters.length-1].getAST(e);for(var O=this.aFilters.length-2;O>=0;O--){r=b(a,this.aFilters[O].getAST(e),r)}}else{a=this.sOperator;i=this.sOperator;l=g(this.sPath);h=T(this.oValue1);switch(a){case t.EQ:r=d(n.Equal,l,h);break;case t.NE:r=d(n.NotEqual,l,h);break;case t.LT:r=d(n.LessThan,l,h);break;case t.GT:r=d(n.GreaterThan,l,h);break;case t.LE:r=d(n.LessThanOrEqual,l,h);break;case t.GE:r=d(n.GreaterThanOrEqual,l,h);break;case t.Contains:r=E(o.Contains,[l,h]);break;case t.StartsWith:r=E(o.StartsWith,[l,h]);break;case t.EndsWith:r=E(o.EndsWith,[l,h]);break;case t.NotContains:r=y(n.Not,E(o.Contains,[l,h]));break;case t.NotStartsWith:r=y(n.Not,E(o.StartsWith,[l,h]));break;case t.NotEndsWith:r=y(n.Not,E(o.EndsWith,[l,h]));break;case t.BT:u=h;f=T(this.oValue2);r=b(n.And,d(n.GreaterThanOrEqual,l,u),d(n.LessThanOrEqual,l,f));break;case t.NB:u=h;f=T(this.oValue2);r=b(n.Or,d(n.LessThan,l,u),d(n.GreaterThan,l,f));break;case t.Any:case t.All:c=m(this.sVariable);p=this.oCondition.getAST(e);r=A(a,l,c,p);break;default:throw new Error("Unknown operator: "+a)}}if(e&&!r.origin){r.origin=i}return r};a.defaultComparator=function(e,t){if(e==t){return 0}if(e==null||t==null){return NaN}if(typeof e=="string"&&typeof t=="string"){return e.localeCompare(t)}if(e<t){return-1}if(e>t){return 1}return NaN};return a});