Liferay.Loader.define("segments-web@3.0.77/js/utils/odata.es",["module","exports","require","./constants.es"],(function(e,c,n){window;{Object.defineProperty(c,"__esModule",{value:!0}),c.buildQueryString=function buildQueryString(e,c,n){return e.filter(Boolean).reduce(((e,a,o)=>{const{conjunctionName:r,items:u,operatorName:s,propertyName:i,value:T}=a;if(o>0&&(e=e.concat(" ".concat(c," "))),r)e=e.concat("(".concat(buildQueryString(u,r,n),")"));else{const c=a.type||getTypeByPropertyName(i,n),o=function valueParser(e,c){let n;switch(c){case t.PROPERTY_TYPES.BOOLEAN:case t.PROPERTY_TYPES.DATE:case t.PROPERTY_TYPES.DATE_TIME:case t.PROPERTY_TYPES.INTEGER:case t.PROPERTY_TYPES.DOUBLE:n=e;break;case t.PROPERTY_TYPES.COLLECTION:case t.PROPERTY_TYPES.STRING:default:n=function escapeSingleQuotes(e){if("string"!=typeof e)return e;return"'".concat(e.replace(/'/g,"''"),"'")}(e)}return n}(T,c);if(isValueType(t.RELATIONAL_OPERATORS,s))e=c===t.PROPERTY_TYPES.COLLECTION?e.concat("".concat(i,"/any(c:c ").concat(s," ").concat(o,")")):e.concat("".concat(i," ").concat(s," ").concat(o));else if(isValueType(t.FUNCTIONAL_OPERATORS,s))e=c===t.PROPERTY_TYPES.COLLECTION?e.concat("".concat(i,"/any(c:").concat(s,"(c, ").concat(o,"))")):e.concat("".concat(s,"(").concat(i,", ").concat(o,")"));else if(isValueType(t.NOT_OPERATORS,s)){const t=s.replace(/not-/g,"");e=e.concat("(not (".concat(buildQueryString([{operatorName:t,propertyName:i,type:c,value:T}],r,n),"))"))}}return e}),"")},c.unescapeSingleQuotes=function unescapeSingleQuotes(e){if("string"!=typeof e)return e;return e.replace(/''/g,"'")};var t=n("./constants.es");const getTypeByPropertyName=(e,c)=>{let n=null;if(e&&c){const t=c.find((c=>c.name===e));n=t?t.type:null}return n};function isValueType(e,c){return Object.values(e).includes(c)}}}));
//# sourceMappingURL=odata.es.js.map