(function(){u8.Base.Selectors=function(){this._selectors={}};$.extend(u8.Base.Selectors.prototype,{execute:function(e,t,s){var r=this.parse(e);var i=this.get(r);if(!i){$error("Failed to execute selector! Expression '"+e+"' is not a valid selector.")}if(i.executeWithArgs){i.executeWithArgs(r.args,t,s)}else{if(!r.args){r.args={}}r.args["executeOptions"]=t;r.args["arguments"]=r.args;i.execute(r.args,s)}},get:function(e){var t=this.tryParseSelectorNames(e);return t&&this._selectors[t.selectorName]},register:function(e,t){$assert(e,"Argument 'name' must not be null or empty.");$assert(t&&t.execute,"A selector must at least implement method 'execute(o, callback)'.");this._selectors[e]=t;this[e]=t.execute.bind(t);return t},parse:function(t){if(typeof t!="string"){return t}t=e(t);var s=t.indexOf("(");var r=null;if(s>=0){var i=t.substr(s+1).trim();if(i[i.length-1]==";"){i=i.substr(0,i.length-1)}if(i[i.length-1]==")"){i=i.substr(0,i.length-1)}if(i){r=evalValue("["+i+"]")}if(r&&r.length==1&&typeof r[0]=="object"){r=r[0]}}return $.extend(this.parseSelectorNames(t),{args:r})},parseSelectorNames:function(e){if(typeof e!="string"){return e}var t=e.indexOf("(");var s;if(t>=0){s=e.substr(0,t)}else{s=e}var r=s;t=r.lastIndexOf(".");if(t>=0){r=r.substr(t+1)}r=r.trim();var i=this._selectors[r];if(!i){var a=r.toCamelCase();i=this._selectors[a];if(i){r=a}}if(!i){if(r=="ConditionalSelector"){i=this._selectors["selectRecordWithCondition"];if(i){r="selectRecordWithCondition"}}}if(!i){if(s.indexOf(".")<0){s="FieldDetails_on"+s}var n=null;try{n=evalValue(s)}catch(e){}if(n){this.register(r,{execute:n})}}return{selectorName:r,functionName:s}},tryParse:function(e){return u8.debug.tryCatch(this.parse.bind(this,e),"evaluation",this._getMessage.bind(this,"selector",e))},tryParseSelectorNames:function(e){return u8.debug.tryCatch(this.parseSelectorNames.bind(this,e),"evaluation",this._getMessage.bind(this,"selector name",e))},_getMessage:function(e,t){var s="Evaluation failed while parsing "+e+"\n";return{message:s,artifacts:[t]}}});u8.services.add("selectors",u8.Base.Selectors);function e(e){while(true){var t=e;if(e.startsWith("/*")){e=e.substring(e.indexOf("*/")+2)}if(e.startsWith("//")){e=e.substring(e.indexOf("\n")+1)}if(e==t){return e}}}})();