UNPKG

daa

Version:
6 lines 125 kB
/* DAAJS v0.9.2 (c) 2012-2016 DAA Systems. http://daajs.org License: MIT */ if(!("name" in Function.prototype)){Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().replace(/^[\s]*function[\s]*|\([\s\S]*$/g,"")}})}Object.defineProperty(Function.prototype,"daa_name",{writable:true});var daa=new function(){this.path="";this.name="daa";this.classname="DAA";this.version="0.1.0";this.RET_ASIS=1;this.RET_NUMERIC=2;this.RET_ROUNDED=4;this.RET_STRING=8;this.RET_ARRAY=16;this.RET_OBJECT=32;this.RET_TRIMMED=64;this.RET_VALUE=128;this.IS_LOGICAL=1;this.IS_ARITHMETICAL=2;this.IS_OVERRIDE=1;this.REL_NONE=0;this.REL_PAGE=1;this.REL_CLIENT=2;this.REL_PARENT=3;var a={errorhandlingstyle:"",errormessagemethod:"",crlf:"\r\n",inputprocessor:"",restmethod:"daasrv.php"};this.Conf=a;var b={};this.GlobalModel=b;this.variables={};this.zorder={wnd:500,fw:1000};this.protos={object:{path:"",name:"model"},vobject:{path:"",name:"model",lastid:0,proto:{path:"model",name:"proto",isproto:1}},vtreesimple:{path:"",name:"model",isvtree:1,lastid:0,proto:{path:"model",name:"proto",isproto:1,isvtreeitem:1,vparent:""}},vtreecomplex:{path:"",name:"model",isvtree:1,lastid:0,proto:{path:"model",name:"proto",isproto:1,isvtreeitem:1,vindex:0,vlevel:0,vcount:0,vparent:""}},viewtree:{path:"",name:"model",isproto:1,isvtree:1,isvtreeitem:1,isviewtree:1,lastid:0,lastids:{},vindex:0,vlevel:0,vcount:0,vparent:"",proto:{path:"model",name:"proto",isproto:1,isvtreeitem:1,isviewdata:1,vindex:0,vlevel:0,vcount:0,vparent:"",vnid:"",vcid:""}}};this.protos.vtree=this.protos.vtreecomplex;this.IsClient=Number(typeof(window)!="undefined"&&typeof(window.navigator)!="undefined");this.IsServer=Number(!this.IsClient&&typeof(process)!="undefined");this.IsMobile=(this.IsClient&&Number(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|Tablet/i.test(navigator.userAgent)))||0;this.DBr=function(j){var k=navigator.userAgent,l=/Version[ \/]+\w+\.\w+/i,m=/Safari\/\w+\.\w+/i,n=[],o=/[ \/\.]/i;l=k.match(l);var p=k.match(/Firefox\/\w+\.\w+/i),q=k.match(/Chrome\/\w+\.\w+/i),r=k.match(/Version\/\w+\.\w+/i);m=k.match(m);var s=k.match(/MSIE *\d+\.\w+/i);k=k.match(/Opera[ \/]+\w+\.\w+/i);if(!k==""&!l=="")n[0]=l[0].replace(/Version/,"Opera");else if(!k=="")n[0]=k[0];else if(!s=="")n[0]=s[0];else if(!p=="")n[0]=p[0];else if(!q=="")n[0]=q[0];else if(!r==""&&!m=="")n[0]=r[0].replace("Version","Safari");var t;if(n[0]!=null)t=n[0].split(o);if((j==null|j==0)&t!=null){j=t[2].length;t[2]=t[2].substring(0,j);return t}else if(j!=null){t[2]=t[2].substr(0,j);return t}else return["none",0,0]};this.DJS=function(){var j=[];if(window.opera){j[0]="Opera";j[1]=window.opera.version()}else if(window.chrome)j[0]="Chrome";else if(window.sidebar)j[0]="Firefox";else if(!window.external&&j[0]!=="Opera")j[0]="Safari";else if(window.ActiveXObject){j[0]="MSIE";j[1]=window.navigator.userProfile?"6":window.Storage?"8":!window.Storage&&!window.navigator.userProfile?"7":"Unknown"}else if(typeof(navigator.msPointerEnabled)!="undefined"){j[0]="MSIE";j[1]=11}return j?j:["none",0,0]};this.GetBrowser=function(j,k){j=this.DBr(),k=this.DJS();return j[0]==k[0]?j:k};this.GetNJSVer=function(){var j=["nodejs",0,0],k=process.version.split(".");j[1]=(k[0]&&k[0].replace(/[a-z]/g,""))||0;j[2]=k[1]||0;return j};this.Browser=(this.IsClient&&this.GetBrowser())||(this.IsServer&&this.GetNJSVer())||["none",0,0];this.Browser[0]=this.Browser[0].toLowerCase();var c={IsNull:"null",IsUndefined:"undefined",IsBoolean:"boolean",IsString:"string",IsFloat:"float",IsInt:"int",IsNumber:"number",IsArray:"array",IsObject:"object",IsFunction:"function",IsNaN:"nan"},d=Object.prototype.toString;this.IsNull=function(j){return Number(typeof(j)=="object"&&j==null)};this.IsUndefined=function(j){return Number(typeof(j)=="undefined")};this.IsBoolean=function(j){return Number(typeof(j)=="boolean")};this.IsString=function(j){return Number(typeof(j)=="string")};this.IsFloat=function(j){return Number(typeof(j)=="number"&&j!=~~j&&!isNaN(j))};this.IsInt=function(j){return Number(typeof(j)=="number"&&j==~~j&&!isNaN(j))};this.IsNumber=function(j){return Number(typeof(j)=="number"&&!isNaN(j))};this.IsArray=function(j){return Number(d.apply(j)=="[object Array]")};this.IsObject=function(j){return Number(typeof(j)=="object"&&j!=null&&d.apply(j)!="[object Array]")};this.IsEnum=function(j){return Number(this.IsObject(j)||this.IsArray(j))};this.IsFunction=function(j){return Number(typeof(j)=="function")};this.IsNaN=function(j){return Number(isNaN(j))};function f(j){for(var k in c){if(daa[k](j)){return c[k]}}return "unknown"}this.GetType=f;this.IsNumeric=function(j){if((this.IsNull(j))||(this.IsBoolean(j))||(this.IsNumber(j))){return 1}if(this.IsString(j)){return Number(!isNaN(j)&&h(j)!="")}return 0};this.IsZero=function(j){return Number(typeof(j)=="number"&&j==0)};this.IsZeroString=function(j){return Number(typeof(j)=="string"&&h(j)=="0")};this.IsEmpty=function(j){if(this.IsFunction(j)){return Number(j.toString().replace(/^[\s\S]*function[\s\S]*\([\s\S]*\)\s*{\s*/,"").replace(/\s*}\s*$/,"")=="")}if(this.IsArray(j)){return Number(j.length<=0)}if(this.IsObject(j)){for(var k in j){return 0}return 1}if(!j){return 1}return 0};this.IsEmptyString=function(j){if(this.IsString(j)&&!j){return 1}return 0};this.IsNode=function(j){return Number(d.apply(j).indexOf("[object HTML")>=0)};this.IsBrowserObject=function(j){return Number(d.apply(j).indexOf("[object Object")<0)};this.IsPath=function(j){return Number(this.IsString(j)&&j.indexOf("/")>0&&!/[^A-Za-z0-9_\/]/.test(j))};this.IsVObject=function(j){if(!j||typeof(j)!="object"||!("path" in j)||!j.name||j.name=="proto"||!j.proto){return 0}return 1};this.IsVTree=function(j){if(!daa.IsVObject(j)||!j.isvtree){return 0}return 1};this.IsVItem=function(j){if(!j||typeof(j)!="object"||!("path" in j)||!j.name||j.name=="proto"||!j.isproto){return 0}return 1};this.IsVTreeItem=function(j){if(!daa.IsVItem(j)||!j.isvtreeitem||!("vparent" in j)){return 0}return 1};this.IsLayoutItem=function(j){if(!j||typeof(j)!="object"||!j.islayoutitem){return 0}return 1};this.IsError=function(j){if(!this.IsString(j)){return 0}if(/^daa:error:/.test(j)){return 1}return 0};this.nullToCode=function(j){return "null"};this.undefinedToCode=function(j){return "undefined"};this.booleanToCode=function(j){return j.toString()};this.stringToCode=function(j){return "\""+j.replace(/\\/g,"\\\\").replace(/\"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"")+"\""};this.floatToCode=function(j){return j.toString()};this.intToCode=function(j){return j.toString()};this.numberToCode=function(j){return j.toString()};this.arrayToCode=function(j){return daa.Serialize(j)};this.objectToCode=function(j){return daa.Serialize(j)};this.functionToCode=function(j){return j.toString()};this.nanToCode=function(j){return "NaN"};this.expr=new function(){var j=",";for(var k in c){j+=c[k]+","}function l(r,s,t){var u,v,w,x="",y="";switch(t){case daa.IS_LOGICAL:u=r.match(/[^\&\&|\|\|]+/g);v=r.match(/[\&\&|\|\|]+/g);w=q;break;case daa.IS_ARITHMETICAL:r=r.replace(/ \/ /g,"").replace(/^[\s]*-/g,"").replace(/(\+|\*|\-||%)[\s]*-/g,"$1");u=r.match(/[^\+|\*|\-||%]+/g)||[];v=r.match(/[\+|\*|\-||%]+/g)||[];w=n;break;default:return 0}var x="",y="";for(var z=0;z<u.length;z++){u[z]=u[z].replace(//g,"-");y=u[z].replace(/^[\s]+|[\s]+$/g,"");if(!daa.IsNumeric(y)){x+=daa.Replace(new RegExp(y.replace(daa.EscapeRE,"\\$1")),u[z],w(y,s,daa.RET_ASIS))}else{x+=u[z]}if(v[z]){x+=v[z]}}switch(t){case daa.IS_LOGICAL:return eval(x);case daa.IS_ARITHMETICAL:return eval(x.replace(//g," / "));default:return 0}}function m(r,s){var t=daa.ParseQuotes(r,"(",")");if(!t.value){return r}var u=t.value.replace(/^\(|\)$/g,"");r=daa.Replace(new RegExp(t.value.replace(daa.EscapeRE,"\\$1")),r,q(u,s));if(/\([\s\S]*?\)/.test(r)){return m(r,s)}else{return r}}function n(r,s,t){if(/[\+\*\-%]| \/ /.test(r)){return l(r,s,daa.IS_ARITHMETICAL)}if(daa.IsPath(r)){var u=b;if(r.search(/^this\//)==0){u=s;r=r.replace(/^this\//,"")}r=daa.o.Get(r,u,null);if(!(t&daa.RET_OBJECT)){if(daa.IsArray(r)){r=r.toString()}else if(daa.IsObject(r)){r=r.toString()}}}else if(/^'[\s\S]*?'$/.test(r)){r=r.replace(/^'|'$/g,"")}if(r=="null"||r=="undefined"){r=null}else if(t&daa.RET_STRING){daa.IsObject(r)?r=daa.csv.JoinKeys(r):r=g(r)}else if(!daa.IsNumeric(r)&&!(t&daa.RET_OBJECT)){r=daa.stringToCode(r)}return r}function o(r,s){var t=(/ in /i.test(r)&&"==")||"!=",u=",";r=r.replace(/ !*?in /g,"");var v=r.replace(/[\s\S]*$/,"").replace(/^[\s]+|[\s]+$/g,""),w=r.replace(/^[\s\S]+/,"").replace(/^[\s]+|[\s]+$/g,"");v=n(v,s,daa.RET_STRING);if(/^RegExp:/.test(v)){v=v.replace(/^RegExp:/,"");u=""}else{v=u+v+u}if(daa.IsPath(w)){w=n(w,s,daa.RET_STRING|daa.RET_OBJECT)||""}w=u+w.replace(/^\[|\]$/g,"").replace(/,[\s]*/g,",")+u;if(!u){return Number(new RegExp(v,"i").test(w))}else{return Number(w.indexOf(v)>=0)}}function p(r,s){var t=(/ is /i.test(r)&&"==")||"!=";r=r.replace(/ !*?is /g,"");var u=r.replace(/[\s\S]*$/,"").replace(/^[\s]+|[\s]+$/g,""),v=r.replace(/^[\s\S]+/,"").replace(/^[\s]+|[\s]+$/g,"");if(/^class /.test(v)){t=="=="?t=1:t=0;var w=n(u,s,daa.RET_OBJECT);if(daa.IsString(w)&&/vnid$/.test(u)){w=daa.n.Get(w)}return Number(t==daa.class.Is(w,v.replace(/^class /,"")))}else if(j.indexOf(","+v+",")>=0){u=n(u,s,daa.RET_OBJECT);if(/number|int|float/.test(v)&&daa.IsNumeric(u)&&daa.IsString(u)){u=Number(u)}return eval("(\""+f(u)+"\""+t+"\""+v+"\")")}else{return 0}return 1}function q(r,s,t){if(/\([\s\S]*?\)/.test(r)){r=m(r,s)}if(/\&\&|\|\|/.test(r)){return l(r,s,daa.IS_LOGICAL)}if(/ !*?is /i.test(r)){return p(r,s)}if(/ !*?in /i.test(r)){return o(r,s)}if(!/[=><!]/.test(r)){return n(r,s,t||daa.RET_OBJECT)}var u=r.replace(/[^=><!]+/g,""),v=r.replace(/[=><!]+[\s\S]*$/,"").replace(/^[\s]+|[\s]+$/g,""),w=r.replace(/^[\s\S]+[=><!]/,"").replace(/^[\s]+|[\s]+$/g,"");v=n(v,s);w=n(w,s);if(!v&&!w){w=v}if(typeof(v)=="string"&&v=="\"\""){v=null}return eval(v+u+w)}this.Eval=function(r,s,t){r=daa.variable.Fill(r);return q(r,s,t)}};this.EvalExpr=this.expr.Eval;this.Condition=function(j,k){j=g(j);return(this.EvalExpr(j,k)&&1)||0};this.srlz=new function(){var j={json:{array:["[","]"],object:["{","}",":","","\""]},jsonquoted:{array:["[","]"],object:["{","}",":","\"","\""]},php:{array:["array(",")"],object:["array(",")","=>","\"","\""]}};function k(p,q,r,s,t){switch(r){case "array":return t[r][0]+l(p,q,r,s+1)+t[r][1];case "object":if(daa.IsBrowserObject(p)){return p.toString()}else{return t[r][0]+m(p,q,r,s+1)+t[r][1]}default:if(daa[r+"ToCode"]){return daa[r+"ToCode"](p)}else{return p}}}function l(p,q,r,s){r?r:r=f(p);var t=j[q.format],u="",v="",w="",x="",y="",z,A="",B="";switch(q.style){case "optimized":v=" ";x=" ";break;case "expanded":u=a.crlf;v=" ";w=daa.StrRepeat(" ",s*3);y=daa.StrRepeat(" ",(s-1)*3);break}for(var C in p){((B=="array")||(B=="object"))?z=u+w+x:z=v;A?A+=","+z:A;B=f(p[C]);A+=k(p[C],q,B,s,t)}return u+w+A+u+y}function m(p,q,r,s){r?r:r=f(p);var t=j[q.format],u=q.style,v="",w="",x="",y="",z="",A="",B={},C=0;for(var D in p){B[D]=f(p[D]);if((B[D]=="array")||(B[D]=="object")){C=1}}if((C)&&(u=="optimized")){u="expanded"}switch(u){case "optimized":v=" ";w=" ";break;case "expanded":v=a.crlf;w=" ";x=daa.StrRepeat(" ",s*3);y=a.crlf;z=daa.StrRepeat(" ",(s-1)*3);break}for(var D in p){A?A+=","+v+x:A;A+=n(D,t[r][3],t[r][4])+t[r][2]+w;A+=k(p[D],q,B[D]||"",s,t)}return y+x+A+y+z}function n(p,q,r){var s=g(p);if((q==r)||(/^[0-9a-z_]+$/i.test(s))){return q+s+q}return r+s+r}function o(p,q,r,s){q?q:q={};q.format?q:q.format="json";j[q.format]?q:q.format="json";q.style?q:q.style="minimized";q.codetypes?q:q.codetypes="string, function";r?r:r=f(p);daa.IsUndefined(s)?s=0:s++;return k(p,q,r,s,j[q.format])}this.Serialize=o};this.Serialize=this.srlz.Serialize;this.Unserialize=function(j){var k=g(j);try{if(!/\[|{|\"|'/.test(k)&&!daa.IsNumeric(k)){k="'"+k+"'"}eval("var k="+k);return k}catch(e){return null}};this.Chr=function(j){return window.String.fromCharCode(j)};function g(j){var k=f(j);switch(k){case "boolean":if(j){return "1"}else{return ""}case "string":return j;case "float":return j.toString();case "int":return j.toString();case "number":return j.toString();case "array":return daa.Serialize(j);case "object":return daa.Serialize(j);case "function":return j.toString();default:return ""}}this.String=g;this.StrToLower=function(j){return g(j).toLowerCase()};this.StrToUpper=function(j){return g(j).toUpperCase()};this.StrPos=function(j,k){return g(j).indexOf(g(k))};this.StrRPos=function(j,k){return g(j).lastIndexOf(g(k))};this.StrRepeat=function(j,k){var l="",m=g(j);for(var n=0;n<k;n++){l+=m}return l};function h(j){return g(j).replace(/^[\s]+|[\s]+$/g,"")}this.Trim=h;this.ParseQuotes=function(j,k,l){j=g(j);var m={pre:"",post:j,value:""},n=j.length,o=-999,p="",q=0;for(var r=0;r<n;r++){p=j.charAt(r);if(p==k){if(o==-999){o=1;q=r;m.pre=j.substr(0,r)}else{o++}}else if(p==l){o--}if(o==0){m.value=j.substr(q,r-q+1);m.post=j.substr(r+1);break}}return m};this.ReplaceQuotes=function(j,k,l){j=g(j);var m="",n="",o="",p="",q="",r="",s=0,t=j.length;for(var u=0;u<t;u++){n=j.charAt(u);if(q){p+=n;if(l){if(p=="/*"){q="",r="*/";o=n;continue}else if(p=="//"){q="",r="\n";o=n;continue}}if(n=="\\"){s?s=0:s=1;o=n;continue}if(s){s=0;o=n;continue}if(n==q){m+=k(p);q="";p=""}else if(q=="/"&&o=="/"&&!/[\(\?!=\+\-\*\/&\|^}{:;#][\s]*$/.test(m)){m+=p;q="";p=""}}else if(r){p+=n;if(n==r||(o+n)==r){m+=l(p);r="";p=""}}else{if(/\"|'|\//.test(n)){q=n;p=n}else{m+=n}}o=n}return m};this.EscapeRE=/(\[|\]|\(|\)|\{|\}|\.|\?|\+|\*|\\|\/|\^|\$|\|)/g;this.Replace=function(j,k,l){if(/\$/.test(l)){l=l.replace(/\$/g,"$$$$")}return k.replace(j,l)};this.Rand=function(j,k){if(k){return Math.floor(Math.random()*(k-j+1))+j}else{return Math.floor(Math.random()*(j+1))}};this.Time=function(){var j=new Date();return Math.round((j/1000)-(j.getTimezoneOffset()*60))};this.LessInt=function(j,k){j=Number(j);k=Number(k);if(j<=k){return j}else{return k}};this.MostInt=function(j,k){j=Number(j);k=Number(k);if(j>=k){return j}else{return k}};this.Neg=function(j){if(!j){return 1}else{return 0}};this.PosVal=function(j){if(j>0){return j}else{return 0}};this.Swap=function(j){if(daa.IsString(j)){if(j=="v"){return "h"}if(j=="h"){return "v"}if(this.StrPos(j,"display:")==0){j=j.replace(/display:\s*/,"");if(j=="block"){return "none"}else{return "block"}}}else{if(j){return 0}return 1}};this.csv=new function(){this.path="daa";this.name="csv";this.classname="CSV";this.requires="daa";this.Split=function(m,n){n=n||",";var o=g(m).split(n),p=[];for(var q=0;q<o.length;q++){o[q]=h(o[q]);if(daa.IsEmptyString(o[q])){continue}p.push(o[q])}return p};this.SplitAsKeys=function(m,n,o){n=n||",";var p=g(m).split(n),q={};for(var r=0;r<p.length;r++){p[r]=h(p[r]);if(daa.IsEmptyString(p[r])){continue}if(o){q[p[r]]=o}else{q[p[r]]=1}}return q};this.Join=function(m,n,o){o=o||0;var p=n||",",q=p,r="";if(daa.IsEnum(m)){for(var s in m){r=h(m[s]);if(daa.IsEmptyString(r)){continue}if(!o){if(q.indexOf(p+r+p)>=0){continue}}q+=r+p}}else if(m.toString){q=p+(daa&&h(m)||m)+p}return q.replace(new RegExp("^"+p+"|"+p+"$","g"),"")};this.JoinKeys=function(m,n){if(!daa.IsEnum(m)){return "0"}var o=n||",",p="";for(var q in m){if(daa.IsEmptyString(q)){continue}p?p+=o:p;p+=h(q)}return p};this.Count=function(m,n){return g(m).split(n||",").length};this.Get=function(m,n,o){var p=this.Split(m,o);return p[n]||""};this.Set=function(m,n,o,p){var q=this.Split(m,p);n=Math.abs(n);n>q.length?n=q.length:n;q[n]=g(o);return this.Join(q,p)};function j(m,n,o){var p=o||",",q=p;if(daa.IsString(m)){q+=daa.csv.JoinKeys(daa.csv.SplitAsKeys(m,p),p)}else if(daa.IsArray(m)){q+=daa.csv.Join(m,p)}else if(daa.IsObject(m)){q+=daa.csv.JoinKeys(m,p)}if(q!=p){q+=p}return{s:p,v:(daa.IsEnum(n)&&n)||daa.csv.Split(n,p),o:q}}function k(m,n){n=n.replace(daa.EscapeRE,"\\$1");return new RegExp(n+"[\\s]*?"+m.replace(daa.EscapeRE,"\\$1")+"[\\s]*?"+n)}function l(m,n){n=n.replace(daa.EscapeRE,"\\$1");return m.replace(new RegExp("^"+n+"|"+n+"$","g"),"")}this.HAS=function(m,n,o){var p=j(m,n,o);for(var q=0;q<p.v.length;q++){if(!k(p.v[q],p.s).test(p.o)){return 0}}return 1};this.EQV=function(m,n,o){var p=o||",";return Number(this.HAS(m,n,p)&&this.HAS(n,m,p))};this.AND=function(m,n,o){var p=j(m,n,o),q,r=p.s;for(var s=0;s<p.v.length;s++){q=k(p.v[s],p.s);if(q.test(p.o)&&!q.test(r)){r+=p.v[s]+p.s}}return l(r,p.s)};this.OR=function(m,n,o){var p=j(m,n,o);for(var q=0;q<p.v.length;q++){if(!k(p.v[q],p.s).test(p.o)){p.o+=p.v[q]+p.s}}return l(p.o,p.s)};this.XOR=function(m,n,o){var p=j(m,n,o),q;for(var r=0;r<p.v.length;r++){q=k(p.v[r],p.s);if(q.test(p.o)){p.o=p.o.replace(q,p.s)}else{p.o+=p.v[r]+p.s}}return l(p.o,p.s)};this.NOT=function(m,n,o){var p=j(m,n,o),q;for(var r=0;r<p.v.length;r++){q=k(p.v[r],p.s);if(q.test(p.o)){p.o=p.o.replace(q,p.s)}}return l(p.o,p.s)}};this.qs=new function(){this.path="daa";this.name="qs";this.classname="QS";this.Split=function(j,k,l,m){j=g(j);var n=(k&&k)||"&",o=(l&&l)||"=",p=(n=="#"&&"")||"#";p=p+"DAA_SEP"+p;var q={n:0,f:function(x){return x.replace(new RegExp(n,"g"),p)}},r=function(x){q.n>0?x=q.f(x):x=x.replace(new RegExp(q.se+"[\\s\\S]+$"),q.f);q.n=q.n+x.split(q.s).length-2;return x};q.s="{";q.se="{";j=j.replace(/[\s\S]*?}/g,r);q.s="<";q.se="<";j=j.replace(/[\s\S]*?>/g,r);q.s="(";q.se="\\(";j=j.replace(/[\s\S]*?\)/g,r);q.s="[";q.se="\\[";j=j.replace(/[\s\S]*?\]/g,r);j=daa.ReplaceQuotes(j,q.f);var s={},t=j.split(n),u,v;if(arguments.length>2&&daa.IsNull(l)){for(var w=0;w<t.length;w++){t[w]=t[w].replace(new RegExp(p,"g"),n);if(m&daa.RET_TRIMMED){t[w]=h(t[w])}if(m&daa.RET_NUMERIC&&daa.IsNumeric(t[w])){t[w]=Number(t[w])}}return t}for(var w=0;w<t.length;w++){if(!t[w]){continue}t[w]=t[w].replace(new RegExp(p,"g"),n);u=t[w].replace(new RegExp(o+"[\\s\\S]*$"),"").replace(/^[\s]+|[\s]+$/g,"");t[w].indexOf(o)>=0?v=t[w].replace(new RegExp("^[\\s\\S]*?"+o),""):v="";if(m&daa.RET_TRIMMED){v=h(v)}if((m&daa.RET_NUMERIC)&&daa.IsNumeric(v)){v=Number(v)}s[u]=v}return s};this.Join=function(j,k,l){var m=(k&&k)||"&",n=(l&&l)||"=",o="";for(var p in j){o?o+=m:o;o+=p+n+j[p]||""}return o}};this.lc=new function(){this.path="daa";this.name="lc";this.classname="LC";function j(t,u,v){return(v?"_":"")+u.toLowerCase()}function k(t,u){return(u?"_":"")+t.toLowerCase()}this.ToSnake=function(t){t=g(t);if(/-/.test(t)){return t.replace(/-(\S)/g,j).replace(/[A-Z]/g,k)}else if(/_/.test(t)){return t.replace(/_(\S)/g,j).replace(/[A-Z]/g,k)}else{return t.replace(/[A-Z]/g,k)}};function l(t,u,v){return v?u.toUpperCase():u.toLowerCase()}function m(t){return t.toLowerCase()}this.ToCamel=function(t){t=g(t);if(/_/.test(t)){return t.replace(/_(\S)/g,l).replace(/^[A-Z]/,m)}else if(/-/.test(t)){return t.replace(/-(\S)/g,l).replace(/^[A-Z]/,m)}else{return t.replace(/^[A-Z]/,m)}};function n(t,u){return u.toUpperCase()}function o(t){return t.toUpperCase()}this.ToPascal=function(t){t=g(t);if(/_/.test(t)){return t.replace(/_(\S)/g,n).replace(/^[a-z]/,o)}else if(/-/.test(t)){return t.replace(/-(\S)/g,n).replace(/^[a-z]/,o)}else{return t.replace(/^[a-z]/,o)}};function p(t,u,v){return(v?"-":"")+u.toLowerCase()}function q(t,u){return(u?"-":"")+t.toLowerCase()}this.ToKebab=function(t){t=g(t);if(/-/.test(t)){return t.replace(/-(\S)/g,p).replace(/[A-Z]/g,q)}else if(/_/.test(t)){return t.replace(/_(\S)/g,p).replace(/[A-Z]/g,q)}else{return t.replace(/[A-Z]/g,q)}};function r(t,u,v){return(v?"-":"")+u.toUpperCase()}function s(t,u){return(u?"-":"")+t.toUpperCase()}this.ToTrain=function(t){t=g(t);if(/-/.test(t)){return t.replace(/-(\S)/g,r).replace(/^[a-z]/,o)}else if(/_/.test(t)){return t.replace(/_(\S)/g,r).replace(/^[a-z]/,o)}else{return t.replace(/[A-Z]/g,s).replace(/^[a-z]/,o)}}};this.variable=new function(){this.path="daa";this.name="variable";this.classname="Variable";this.Fill=function(j){if(!j||!/\$/.test(j)){return j}j=daa.String(j);var k,l,m,n;for(var o in daa.variables){if(!/^\$/.test(o)){continue}k=new RegExp(o.replace(/\$/,"\\$")+"\\b");l=new RegExp("\\\\("+o.replace(/\$/,"\\$")+")\\b");m=new RegExp("{"+o.replace(/\$/,"\\$")+"}");n=new RegExp("{{"+o.replace(/\$/,"\\$")+"}}");if(m.test(j)&&!n.test(j)){j=j.replace(m,daa.variables[o])}if(k.test(j)&&!l.test(j)){j=j.replace(k,daa.variables[o])}if(l.test(j)){j=j.replace(l,"$1")}if(!/\$/.test(j)){break}}return j}};this.pattern=new function(){this.path="daa";this.name="pattern";this.classname="Pattern";function j(l){l=l.replace(/([{\(])[\s]*?([&\|\^\+\-\*\/=!\?])/g,"$1 0 $2").replace(/([&\|\^\+\-\*\/=!\?])[\s]*?([}\)])/g,"$1 0 $2").replace(/([&\|\^\+\-\*\/=!\?])[\s]+?([&\|\^\+\-\*\/=!\?])/g,"$1 0 $2");return l}function k(l,m){var n=undefined,o="";if(/\?/.test(l)){o=l.replace(/^[\s\S]*?\?/,"");l=l.replace(/\?[\s\S]*$/,"")}if(/\"|'/.test(l)){n=l.replace(/[\"']/g,"")}else{if(!daa.IsEnum(m)){if(l=="value"){n=m}}else{if(n==undefined&&l in m){n=m[l]}if(n==undefined){n=daa.o.Get(l,m,undefined)}if(n==undefined&&m!=b){n=daa.o.Get(l,null,undefined)}}}if(n==undefined||daa.IsEmptyString(n)){n=o}return n}this.Fill=function(l,m){if(!m){m=b}if(l==m){if(daa.Conf.isdesigning){return l}else{return l.replace(/%[\s\S]*?%/g,"").replace(/{{[\s\S]*?}}/g,"")}}var n=g(l).replace(/\\\%/g,"#DAA_PRC#");n=daa.variable.Fill(n);var o=n.match(/%[\s\S]*?%/g)||[],p="",q="",r="";for(var s=0;s<o.length;s++){q=undefined;p=o[s].replace(/%/g,"");if(/\[/.test(p)){r=k(p.replace(/^[\s\S]*?\[/,"").replace(/\][\s\S]*$/,""),m);p=p.replace(/\[[\s\S]*$/,"");if(!p){q=r}}if(q==undefined){if(!daa.IsEnum(m)){if(p=="value"){q=m}}else{if(q==undefined&&p in m){q=m[p]}if(q==undefined){q=daa.o.Get(p,m,undefined)}if(q==undefined&&m!=b){q=daa.o.Get(p,null,undefined)}}if(q==undefined){q=""}if(daa.IsObject(q)&&r){q=q[r]||""}}if(/%|{{/.test(q)){q=q.replace(/%/g,"#DAA_PRC#").replace(/{{/g,"#DAA_EXPA#").replace(/}}/g,"#DAA_EXPB#")}n=daa.Replace(new RegExp(o[s].replace(daa.EscapeRE,"\\$1"),"g"),n,q)}var t=n.match(/{{[\s\S]*?}}/g)||[],q;for(var s=0;s<t.length;s++){try{q=eval(j(t[s].replace(/%.*?%/g,"")).replace(/{{/,"").replace(/}}/,""))}catch(e){q="";daa.m.Error("daa:error:core:IllegalFormat:"+e.message)}n=daa.Replace(new RegExp(t[s].replace(daa.EscapeRE,"\\$1"),"g"),n,q)}return n.replace(/%.*?%/g,"").replace(/#DAA_PRC#/g,"%").replace(/#DAA_EXPA#/g,"{{").replace(/#DAA_EXPB#/g,"}}")};this.FillObject=function(l,m){var n=l;if(!daa.IsEnum(n)){return this.Fill(n,m)}for(var o in n){if(daa.IsEnum(n[o])){this.FillObject(n[o],m)}else if(/%/.test(n[o])){n[o]=this.Fill(n[o],m)}}return n}};this.path=new function(){this.path="daa";this.name="path";this.classname="Path";this.Concat=function(j){var k="";for(var l=0;l<arguments.length;l++){arguments[l]=g(arguments[l]).replace(/\/$/,"");if(daa.IsEmptyString(arguments[l])){continue}k?k+="/":k;k+=arguments[l]}return k};this.GetAppName=function(j){j=g(j);if(j.indexOf("/")<0){return j}return j.substr(0,j.indexOf("/"))};this.SetAppName=function(j,k){var l=this.GetAppName(k);if(this.GetAppName(j)==l){return j}j=g(j);if(j.indexOf("/")<0){return l}return this.Concat(l,j.substr(j.indexOf("/")+1))};this.GetPath=function(j){j=g(j);if(j.indexOf("/")<0){return ""}return j.substr(0,j.lastIndexOf("/"))};this.GetName=function(j){j=g(j);if(j.indexOf("/")<0){return j}return j.substr(j.lastIndexOf("/")+1)};this.Split=function(j){return daa.csv.Split(j,"/")};this.Join=function(j){return daa.csv.Join(j,"/",1)}};this.p=this.path;var e=null;this.errobj=e;function i(j,k){this.name="daa.Exception";this.message=j;this.value=j;this.caller=null;this.isdaaerror=1;if(k&&(k.name||k.daa_name)){var l=k.name||k.daa_name;this.caller=l.replace(/__/,"._").replace(/[^\.]_/g,".")}}this.error=new function(){this.path="daa";this.name="error";this.classname="Error";function j(n,o){var p={name:n.name,message:n.message,value:n.message};if("stack" in n){p.stack=n.stack}if(o=="string"){return p.name+": "+p.message}return p};function k(n,o){n.value=l(n.value);if(o=="string"){return n.value}return n};function l(n){var o=a.errorhandlingstyle||"";a.errorhandlingstyle="";var p="";n=g(n);if(n.indexOf("daa:error:")>=0){if(n.indexOf("\n")>=0){n=n.split("\n")}else{n=[n]}for(var q=0;q<n.length;q++){p?p+="\n":p;p+=m(n[q])}}else{p=n}a.errorhandlingstyle=o;return p};function m(n){n=g(n);if(n.indexOf("daa:error:")<0){return n}n=n.split(":");var o=daa.obj.Get(daa.p.Concat("base/errors",n[2],n[3]),null,""),p=o.match(/\$[0-9]/g)||[],q="";if(n.length>4){for(var r=4;r<n.length;r++){if(p.length){o=daa.Replace(new RegExp("\\"+p.shift()),o,n[r])}else{q?q+=":":q;q+=n[r]}}}q?o+=": "+q:q;return o};this.Translate=function(n,o){o=o||"string";if(n instanceof Error){return j(n,o)}if(typeof(n)=="object"){return k(n,o)}return l(n)};this.GetMessageMethod=function(){var n=a.errormessagemethod||"";if(n&&n!="console.log"&&n!="console.dir"){if(n==this.Message||n=="daa.error.Message"){return alert}try{if(typeof(n)=="function"){return n}else if(typeof(eval(n))=="function"){return eval(n)}n="console.log"}catch(err){n="console.log"}}if(n=="console.log"){return function(o){console.log(o)}}if(n=="console.dir"){return function(o){console.dir(o)}}return alert};this.Message=function(n){var o=this.GetMessageMethod(),p;a.errormessagemethod?p="object":p="string";o(this.Translate(n,p))}};this.method=new function(){this.path="daa";this.name="method";this.classname="Method";function j(k,l){l=l||{};k=k.toString();if(k.indexOf("(")>0){var m=k.replace(/^[\s\S]*\(\s*/,"").replace(/\s*\)\s*$/,"");k=k.replace(/^\s*/,"").replace(/\s*\([\s\S]*$/,"");eval("m = "+m);if(typeof(m)=="object"){for(var n in m){l[n]=m[n]}}}return eval(k+"(l)")};this.Call=function(k,l){if(typeof(k)=="function"){return k(l)}if(!k||typeof(k.toString)!="function"){return this.Escape(null,"daa:error:method:NoMethod:"+k)}return j(k,l)};this.HandleErrors=function(k,l){if(typeof(k)!="undefined"){a.errorhandlingstyle=k}if(typeof(l)!="undefined"){a.errormessagemethod=l}};this.Error=function(k){return this.Escape(null,k)};this.Escape=function(k,l){var m=a.errorhandlingstyle||"";if(m){if(m=="exception"){throw new i(l||"daa:error:core:Error",this.Escape.caller)}else if(m=="message"){daa.error.Message(l||"daa:error:core:Error");if(arguments.length){return arguments[0]}else{return null}}else{return j(m,{default:k,message:l,caller:this.Escape.caller})}}else{if(arguments.length){return arguments[0]}else{return null}}};this.Args=function(k,l){switch(l){case "vd":if(daa.IsPath(k)){k=daa.o.Get(k)}if(daa.IsNode(k)){if(k.vd){return k.vd}else{return this.Agrs(daa.n.GetVN(k),l)}}if(daa.IsObject(k)){if(k.isviewdata){return k}if((k.vn)&&(k.vn.vd)){return k.vn.vd}}break;case "vcid":if(daa.IsPath(k)){k=daa.o.Get(k)}else if(daa.IsString(k)){return k}if(daa.IsNode(k)){if(k.vcid){return k.vcid}else{return this.Args(daa.n.GetVN(k),l)}}if(daa.IsObject(k)){if(k.vcid){return k.vcid}if(k.isclass){return k.name}if(k.vnid){return this.Args(daa.n.Get(k.vnid),l)}}break;case "model":if(daa.IsObject(k)){return k}if(daa.IsString(k)){return daa.o.Get(k)}break;case "vn":if(daa.IsNode(k)){return daa.n.GetVN(k)}if(daa.IsObject(k)){if(k.vn){return k.vn}if(k.vnid){return daa.n.Get(k.vnid)}}break;case "node":if(daa.IsNode(k)){return k}if(daa.IsPath(k)){k=daa.o.Get(k)}else if(daa.IsString(k)){return daa.n.Get(k)}if(daa.IsObject(k)){if(k.node){return k.node}else if(k.vd){return this.Args(k.vd,l)}else if(k.vnid){return daa.n.Get(k.vnid)}else if(k.vdpath){return this.Args(k.vdpath,l)}}break}return null}};this.m=this.method;this.object=new function(){this.path="daa";this.name="object";this.classname="Object";function j(s,t,u,v){if(daa.IsFunction(v)){s[u]=new v;s[u].path=t;s[u].name=u}else if(daa.IsArray(v)){s[u]=[];for(var w=0;w<v.length;w++){s[u].push(v[w])}}else{s[u]={};for(var x in v){if(daa.IsObject(v[x])&&!daa.IsBrowserObject(v[x])){s[u][x]=j(s[u],daa.p.Concat(t,u),x,v[x])}else{s[u][x]=v[x]}}if("path" in s[u]){s[u].path=t}if("name" in s[u]){s[u].name=u}}return s[u]}function k(s,t,u,v){var w="";for(var x=0;x<s.length;x++){if(!s[x]){continue}if(t[s[x]]==null){if(u&&v){j(t,w,s[x],u)}else{return u}}t=t[s[x]];if(w!=""){w=w+"/"}w=w+s[x]}return t}function l(s,t,u,v,w){v=v||"";for(var x in t){if(typeof(t[x])=="object"&&!daa.IsBrowserObject(t[x])){if(!s[x]||!daa.IsObject(s[x])){j(s,v,x,u)}l(s[x],t[x],u,daa.p.Concat(v,x),w)}else if(!(x in s)||w){s[x]=t[x]}}return s}function m(s,t,u){if(typeof(s)!="object"||!("path" in s)||!s.name){return s}s.path=t;if(u){s.name=u}var v=daa.p.Concat(t,s.name);for(var w in s){if(typeof(s[w])!="object"){continue}m(s[w],v)}return s}this.SetPath=function(s,t,u){return m(s,t,u)};this.Get=function(s,t,u){arguments.length<3?u=null:u;return k(g(s).split("/"),t||b,u,0)};this.Set=function(s,t,u){if(!s&&t&&"path" in t&&"name" in t){s=daa.p.Concat(t.path,t.name)}if(!s){return daa.m.Escape({},"daa:error:method:NoArg:APath")}var v={path:daa.p.GetPath(s),name:daa.p.GetName(s)};if(t||daa.IsZero(t)){return this.Ensure(v.path,u)[v.name]=m(t,v.path,v.name)}else{delete this.Ensure(v.path,u)[v.name];return t}};this.Ensure=function(s,t,u){return k(g(s).split("/"),t||b,u||{path:"",name:""},1)};this.Merge=function(s,t,u){if(!s){return{}}if(!t){return s}u=u||0;return l(s,t,{path:"",name:""},daa.p.Concat(s.path,s.name),u)};this.MergePlain=function(s,t,u){if(!s){return{}}if(!t){return s}u=u||0;return l(s,t,{},"",u)};this.MergeCopy=function(s,t,u){if(!s){return{}}var v=daa.p.Concat(s.path,s.name),w=l({},s,{path:"",name:""},v);if(!t){return w}u=u||0;return l(w,t,{},{path:"",name:""},v,u)};this.Copy=function(s){if(!s){return{}}return l({},s,{path:"",name:""},daa.p.Concat(s.path,s.name))};this.Create=function(s,t){if(!s){return{}}t=g(t)||"model";return l({path:daa.p.GetPath(t),name:daa.p.GetName(t)},s,{path:"",name:""},t)};this.CopyOne=function(s){if(!s){return daa.m.Escape({},"daa:error:method:NoArg:AObj")}var t={};for(var u in s){t[u]=s[u]}return t};this.AddPrepare=function(s,t){if(!s){return t}var u={};if(s.proto){u=this.Copy(s.proto)}this.Merge(u,t,daa.IS_OVERRIDE);if(("vindex" in u)&&(daa.vo)){u.vindex=daa.vo.GetLastIndex(s)+1}return u};this.GetFirstKey=function(s){for(var t in s){return t}return ""};this.GetLastKey=function(s){var t="";for(var t in s){}return t};this.ADD=function(s,t,u){var v=daa.IsNumber(t),w=0;for(var x in s){if(!daa.IsNumber(s[x])){continue}v?w=t:w=t[x]||0;s[x]+=w;if(u){s[x]=Math.round(s[x])}}return s};this.SUB=function(s,t,u){var v=daa.IsNumber(t),w=0;for(var x in s){if(!daa.IsNumber(s[x])){continue}v?w=t:w=t[x]||0;s[x]-=w;if(u){s[x]=Math.round(s[x])}}return s};this.MUL=function(s,t,u){var v=daa.IsNumber(t),w=0;for(var x in s){if(!daa.IsNumber(s[x])){continue}v?w=t:w=t[x]||0;s[x]=s[x]*w;if(u){s[x]=Math.round(s[x])}}return s};this.DIV=function(s,t,u){var v=daa.IsNumber(t),w=0;for(var x in s){if(!daa.IsNumber(s[x])){continue}v?w=t:w=t[x]||0;w?s[x]=s[x]/w:s[x]=0;if(u){s[x]=Math.round(s[x])}}return s};function n(s,t){for(var u in s){if(!(u in t)){return 0}if(daa.IsEnum(s[u])){if(!o(s[u],t[u])){return 0}}else if(s[u]!=t[u]){return 0}}return 1}function o(s,t){if(daa.IsBrowserObject(s)||daa.IsBrowserObject(t)){if(s==t){return 1}else{return 0}}if(!n(s,t)){return 0}if(!n(t,s)){return 0}return 1}this.EQV=function(s,t){if(daa.IsEnum(s)){return o(s,t)}return Number(s==t)};this.HAS=function(s,t){if(!daa.IsEnum(s)){return Number(s==t)}if(!daa.IsEnum(t)){return 0}for(var u in t){if(!(u in s)){return 0}if(t[u]==undefined||t[u]=="*"){continue}if(s[u]!=t[u]){return 0}}return 1};this.Assign=function(s,t){t=t||{};if(daa.IsString(t)){t=daa.qs.Split(t.replace(/^ *set +?/,""),",","=",daa.RET_TRIMMED)}var u="";for(var v in t){u=t[v];if(/%[\s\S]+?%/.test(u)){try{u=daa.pattern.Fill(u,s);u=eval(u)}catch(e){u="";daa.m.Error("daa:error:core:IllegalFormat:"+e.message)}}if((v in s&&daa.IsNumber(s[v]))||(daa.IsNumeric(u))){u=Number(u)}s[v]=u}return s};this.Update=function(s,t,u){t=t||{};if(daa.IsString(t)){t=daa.qs.Split(t.replace(/^ *set +?/,""),",","=",daa.RET_TRIMMED)}u=u||"";var v=daa.IsString(u);if(v){u=u.replace(/^ *where */,"")}for(var w in s){if(w=="proto"||typeof(s[w])!="object"||!s[w].isproto){continue}if(v){if(!daa.Condition(u,s[w])){continue}}else{if(!this.HAS(s[w],u)){continue}}this.Assign(s[w],t)}return s};this.Delete=function(s,t){t=t||"";var u=daa.IsString(t);if(u){t=t.replace(/^ *where */,"")}for(var v in s){if(v=="proto"||typeof(s[v])!="object"||!s[v].isproto){continue}if(u){if(!daa.Condition(t,s[v])){continue}}else{if(!this.HAS(s[v],t)){continue}}delete s[v]}return s};this.Select=function(s,t,u){if(!s){return null}var v={},w=null;if(daa.IsString(t)&&daa.Trim(t)!="*"){w=daa.csv.SplitAsKeys(t)}else if(daa.IsObject(t)&&!daa.IsEmpty(t)){w=t}u=u||"";var x=daa.IsString(u);if(x){u=u.replace(/^ *where */,"")}for(var y in s){if(y=="proto"||typeof(s[y])!="object"||!s[y].isproto){continue}if(x){if(!daa.Condition(u,s[y])){continue}}else{if(!this.HAS(s[y],u)){continue}}if(!w){v[y]=s[y]}else{v[y]={};for(var z in w){if(!(z in s[y])){continue}else{v[y][z]=s[y][z]}}}}return v};function p(s,t,u){var v=1,w=-1;if(u.m){v=-1;w=1}if(typeof(u.o[s][u.p])!="undefined"){s=u.o[s][u.p]}if(typeof(u.o[t][u.p])!="undefined"){t=u.o[t][u.p]}if((typeof(s)!=typeof(t))){if(typeof(s)!="string"){s=s.toString()}if(typeof(t)!="string"){t=t.toString()}}if((typeof(s)=="string")&&(typeof(t)=="string")){var x=0;if(!s.length){return w}else if(!t.length){return v}while((x<s.length)&&(x<t.length)){if(s.charCodeAt(x)<t.charCodeAt(x)){return w}else if(s.charCodeAt(x)>t.charCodeAt(x)){return v}else{x++}}if(s.length<t.length){return w}else if(s.length>t.length){return v}else{return 0}}else if((typeof(s)=="number")&&(typeof(t)=="number")){if(u.m){return t-s}else{return s-t}}else{return 0}}this.Sort=function(s,t){!t?t={}:t;daa.IsString(t)?t={sortby:t}:t;var u=daa.csv.Split(t.sortby);if(!u.length||u[0]=="_key"){return q(s,t)}if(u[0]=="_value"){var v={};for(var w in s){v[w]={_value:s[w]}}s=v}if(u[0]=="_unsorted"){u[0]="path";t.isunsorted=1}var x=[],y=[];for(var w in u){(/ desc/.test(u[w])||t.order=="desc")?y[w]=1:y[w]=0;u[w]=u[w].replace(/ desc/,"").replace(/ asc/,"")}var z;for(var w in s){if((w=="proto")||(!s[w])||(typeof(s[w])!="object")){continue}z=1;for(var A in u){if(!(u[A]in s[w])){z=0;break}}if(z){x.push(w)}}if(t.isunsorted){return x}return r(s,x,u,y,0,u.length)};function q(s,t){var u=[];for(var v in s){if(!t.issystemkeys&&(/^(path|name|proto|lastid|lastids)$/.test(v)||/^is[a-z]+$/.test(v))){continue}u.push(v)}if(t.isunsorted){return u}u.sort();if(t.order=="desc"){return u.reverse()}else{return u}}function r(s,t,u,v,w,x){if(!u[w]){return t}t.sort(function(F,G){return p(F,G,{"o":s,"p":u[w],"m":v[w]})});if(w>=x-1){return t}var y="",z="",A="",B=[],C=[];for(var D in t){z=s[t[D]][u[w]];if(z!=A){if(B.length>1){B=r(s,B,u,v,w+1,x)}for(var E in B){C.push(B[E])}B=[t[D]];A=z}else{B.push(t[D])}}if(B.length>1){B=r(s,B,u,v,w+1,x)}for(var D in B){C.push(B[D])}return C}this.Iterate=function(s,t,u,v){if(!t){return}!("level" in s)?s.level=0:s.level++;var w={};s.sortby?w.sortby=s.sortby:w.isunsorted=1;s.issystemkeys?w.issystemkeys=s.issystemkeys:w;s.sort=daa.o.Sort(t,w);s.tree={};s.index=0;s.count=0;if(s.layout&&daa.vo&&!s.sortl){daa.vo.IterateLayoutPrepare(s,t)}var x,y,z,A=daa.p.Concat(t.path,t.name),B=s.sort.length;for(var C=0;C<B;C++){s.key=s.sort[C];x=t[s.key];y=Number(daa.IsObject(x)&&!daa.IsBrowserObject(x));s.tree[s.key]={path:A,name:s.key,vindex:C,vcount:y,vlevel:s.level,vparent:t.name||""};s.treeitem=s.tree[s.key];if(s.filter&&!daa.Condition(s.filter,s.treeitem)){continue}if(v){v.call(this,s,x);s.count++}if(u&&y){u.call(this,s,x);continue}if(s.canceliteration||(s.limit&&s.count>=s.limit)){break}}}};this.obj=this.object;this.o=this.object;this.vobject=new function(){this.path="daa";this.name="vobject";this.classname="VObject";this.IterateLayoutPrepare=function(p,q){if(!q){return}p.sortl=daa.o.Sort(p.layout,"vindex");p.layout=daa.o.Merge({path:q.path,name:q.name},p.layout)};this.IterateLayout=function(p,q,r,s){p.sort=p.sortl;p.tree=p.layout;p.index=0;p.count=0;return daa.vo.Iterate.call(this,p,q,r,s)};this.Iterate=function(p,q,r,s){if(!q){return}var t=q;if(!p.sort){if(q.isvtree&&!("vindex" in q.proto)&&"vparent" in q.proto){t=daa.vo.MakeTree(q,p.sortby||"name")}p.sort=daa.o.Sort(t,(q.isvtree&&"vindex")||p.sortby||"name");p.tree=t;p.index=0;p.count=0;if((p.layout)&&(!p.sortl)){daa.vo.IterateLayoutPrepare(p,q)}}var u,v,w,x,y=-1,z=daa.p.Concat(q.path,q.name),A=p.sort.length;while(p.index<A){p.key=p.sort[p.index];p.sort==p.sortl?x=p.key.replace(/^_/,""):x=p.key;u=q[x];v=p.tree[p.key];v.name=x;p.treeitem=v;if(p.sortl&&p.sort==p.sortl){v.path=z;if(p.key=="_key"||p.key=="_value"){v.name=""}}if(y==-1){y=v.vlevel}if(v.vlevel>y){if(r){w=p.index;r.call(this,p,q);if(p.index<=w){alert("ERROR: An infinite recursion in daa.vo.Iterate, called from "+daa.vo.Iterate.caller.daa_name);break}continue}}else if(v.vlevel<y){break}if(p.filter&&!daa.Condition(p.filter,p.treeitem)){p.index++;continue}if(s){s.call(this,p,u);p.count++}p.index++;if(p.canceliteration||(p.limit&&p.count>=p.limit)){break}}};function j(p,q){p[q].vcount++;if(p[q].vparent){return j(p,p[q].vparent)+1}else{return 1}}function k(p,q){for(var r in p){if(p[r].vparent!=q){continue}p[r].vindex=p[q].last;p[r].last=p[r].vindex+1;p[q].last=p[r].vindex+p[r].vcount+1;k(p,r)}}this.MakeTree=function(p,q){var r={},s="";q=daa.csv.NOT(q,"vindex,vlevel,vcount")||"_unsorted";var t=daa.o.Sort(p,q),u="";for(var v=0;v<t.length;v++){u=t[v];s=p[u];if(!r[u]){r[u]={path:s.path,name:u,vindex:-1,vlevel:0,vcount:0,vparent:"",last:0}}if(s.vparent&&p[s.vparent]){r[u].vparent=s.vparent}}for(var u in r){if(!r[u].vparent){continue}r[u].vlevel=j(r,r[u].vparent)}var w=0;for(var u in r){if(r[u].vparent){continue}r[u].vindex=w;r[u].last=w+1;w=r[u].vindex+r[u].vcount+1;k(r,u)}return r};function l(p,q,r){if(!p[q]){return}p[q].vcount+=r;p[q].vparent?l(p,p[q].vparent,r):r}function m(p,q,r,s,t){var u={obj:null,pid:""},v=daa.p.Concat(p.path,p.name);if(q){daa.IsString(q)?(p[q]&&t)?u.obj=p[q]:u.obj=daa.o.Merge({path:v,name:q},p.proto):daa.IsVItem(q)?u.obj=q:u}u.obj?u.obj:u.obj=daa.o.Copy(p.proto);u.obj.path!=v?daa.o.SetPath(u.obj,v):u.obj;if(r){daa.IsString(r)?u.pid=r:daa.IsVItem(r)?u.pid=r.name:u}(u.pid&&daa.IsVItem(p[u.pid]))?u.pid:u.pid="";(u.pid!=u.obj.name)?u.pid:u.pid="";if(u.pid&&"vparent" in u.obj&&!p[u.obj.name]){s?u.obj.vparent=p[u.pid].vparent||"":u.obj.vparent=u.pid}return u}this.Add=function(p,q,r){if(!daa.IsVObject(p)){return null}var s=m(p,q,r);if(p[s.obj.name]){this.Delete(p,s.obj.name)}if(!("vindex" in p.proto)){p[s.obj.name]=s.obj;return s.obj}s.index=this.GetLastIndex(p,s.pid);if(s.pid){l(p,s.pid,1);daa.o.Update(p,{vindex:"%vindex% + 1"},"this/vindex > "+s.index)}s.obj.vindex=s.index+1;s.obj.vlevel=(s.pid&&(p[s.pid].vlevel+1))||0;p[s.obj.name]=s.obj;return s.obj};this.Insert=function(p,q,r,s){if(!daa.IsVObject(p)){return null}if(!s){s="c"}if(s=="c"){return this.Add(p,q,r)}else{s=daa.String(s).replace(/t/,"l").replace(/b/,"r")}var t=m(p,q,r,s);if(p[t.obj.name]){this.Delete(p,t.obj.name)}if(!t.pid){return this.Add(p,q)}if(!("vindex" in p.proto)){p[t.obj.name]=t.obj;return t.obj}if(s=="l"){t.index=p[t.pid].vindex-1}else{t.index=p[t.pid].vindex+p[t.pid].vcount}t.obj.vindex=t.index+1;t.obj.vlevel=p[t.pid].vlevel;l(p,t.obj.vparent,1);daa.o.Update(p,{vindex:"%vindex% + 1"},"this/vindex > "+t.index);p[t.obj.name]=t.obj;return t.obj};function n(p,q){for(var r in p){if(r=="proto"||typeof(p[r])!="object"||!p[r].isproto){continue}if(p[r].vparent==q){n(p,r)}}delete p[q]}this.Delete=function(p,q){if(!daa.IsVObject(p)){return null}var r=m(p,q,null,"",1);if(!p[r.obj.name]){return null}if(!("vindex" in p.proto)){n(p,r.obj.name);return r.obj}l(p,r.obj.vparent,0-(1+r.obj.vcount));daa.o.Delete(p,"this/vindex >= "+r.obj.vindex+" && this/vindex < "+(r.obj.vindex+r.obj.vcount+1));daa.o.Update(p,{vindex:"%vindex% - "+(r.obj.vcount+1)},"this/vindex > "+r.obj.vindex);return r.obj};function o(p,q,r){if(!p[q]||!p[q].vparent){return 0}if(p[q].vparent==r){return 1}else{return o(p,p[q].vparent,r)}}this.Move=function(p,q,r,s){if(!daa.IsVObject(p)){return null}var t=m(p,q,r,"",1);if(!t||!p[t.obj.name]){return null}if(!s){s="c"}s=daa.String(s).replace(/t/,"l").replace(/b/,"r");if(!t.pid){s="c"}if(!("vindex" in p.proto)){if(o(p,t.pid,t.obj.name)){return null}s=="c"?p[t.obj.name].vparent=t.pid:p[t.obj.name].vparent=p[t.pid].vparent;return t.obj}if(t.pid&&p[t.pid].vindex>=t.obj.vindex&&p[t.pid].vindex<=t.obj.vindex+t.obj.vcount){return null}t.index=t.obj.vindex;t.lastindex=this.GetLastIndex(p);t.previndex=t.lastindex+t.obj.vcount+1;t.prevlevel=t.obj.vlevel;daa.o.Update(p,{vindex:"%vindex% + "+t.previndex},"this/vindex >= "+t.obj.vindex+" && this/vindex < "+(t.obj.vindex+t.obj.vcount+1));l(p,t.obj.vparent,0-(t.obj.vcount+1));daa.o.Update(p,{vindex:"%vindex% - "+(t.obj.vcount+1)},"this/vindex > "+t.index+" && this/vindex < "+t.previndex);t.previndex=t.obj.vindex;if(s=="l"){t.index=(t.pid&&p[t.pid].vindex-1)||0}else{t.index=(t.pid&&(p[t.pid].vindex+p[t.pid].vcount))||(t.lastindex-t.obj.vcount-1)}if(s=="c"){t.level=(t.pid&&p[t.pid].vlevel+1)||0;t.obj.vparent=t.pid}else{t.level=(t.pid&&p[t.pid].vlevel)||0;t.obj.vparent=(t.pid&&p[t.pid].vparent)||""}l(p,t.obj.vparent,t.obj.vcount+1);daa.o.Update(p,{vindex:"%vindex% + "+(t.obj.vcount+1)},"this/vindex > "+t.index+" && this/vindex < "+t.previndex);daa.o.Update(p,{vindex:"%vindex% - "+(t.previndex-(t.index+1)),vlevel:"%vlevel% - "+(t.prevlevel-t.level)},"this/vindex >= "+t.previndex);return t.obj};this.GetRoot=function(p){for(var q in p){if(q=="proto"||typeof(p[q])!="object"||!p[q].isproto){continue}if(!p[q].vparent){return p[q]}}return null};this.GetLastIndex=function(p,q){if(!daa.IsVObject(p)||!("vindex" in p.proto)){return-1}var r=-1,s="",t=0;if(q){daa.IsObject(q)?s=q.name:daa.IsString(q)?s=q:s=""}if(s&&(!p[s]||!daa.IsVItem(p[s]))){s=""}if(s){return p[s].vindex+p[s].vcount}for(var u in p){if(u=="proto"||!p[u].isproto){continue}r<p[u].vindex?r=p[u].vindex:r}return r};this.Count=function(p){var q=0;for(var r in p){if(r=="proto"||typeof(p[r])!="object"||!p[r].isproto||!("path" in p[r])||!p[r].name){continue}q++}return q};this.IsEmpty=function(p){return Number(this.Count(p)==0)}};this.vobj=this.vobject;this.vo=this.vobject;this.node=new function(){this.path="daa";this.name="node";this.classname="Node";this.properties={offsetleft:1,offsettop:1,isdesigning:1};this.TempProps={modelpath:1,editorid:1,expandedid:1,isitems:1,isitem:1,lastid:1,left:1,modelindex:1,openerid:1,prevdisplay:1,prevselectedstyle:1,prevselectedclass:1,selectedid:1,startx:1,starty:1,top:1,vlevel:1};var j={};this.SetProps=function(p,q){p.vd=q;if(q.mvnid){p.mvnid=q.mvnid}if(q.pvnid){p.pvnid=q.pvnid}for(var r in this.properties){if(r in q){p["daa_"+r]=q[r]}}};this.GetProps=function(p){var q={};for(var r in this.properties){if("daa_"+r in p){q[r]=p["daa_"+r]}}return q};this.ResolvePath=function(p,q){if(!p){return q}if(/^this/.test(q)){var r=this.GetUpper(p.parentNode,{daa_modelpath:"*"});if(r&&r.daa_modelpath){q=q.replace(/^this/,r.daa_modelpath)}}if(/^self/.test(q)&&p.vd){q=q.replace(/^self/,daa.p.Concat(p.vd.path,p.vd.name))}return q};this.AddClassName=function(p,q){p?p.className=daa.csv.OR(p.className,q," "):p};this.AddCN=this.AddClassName;this.DeleteClassName=function(p,q){p?p.className=daa.csv.NOT(p.className,q," "):p};this.DeleteCN=this.DeleteClassName;this.ReplaceClassName=function(p,q,r){p?p.className=daa.csv.OR(daa.csv.NOT(p.className,q," "),r," "):p};this.ReplaceCN=this.ReplaceClassName;this.Show=function(p){if(!p){return}this.DeleteClassName(p,"hidden")};this.Hide=function(p){if(!p){return}this.AddClassName(p,"hidden")};this.ShowHide=function(p){var q=daa.n.GetStyle(p,"display");if(q=="none"){this.Show(p)}else{this.Hide(p)}};this.Select=function(p,q){q=q||this.GetParentVN(p);if(!q){return}if(q.daa_selectedid){if(q.daa_selectedid==p.id){return}this.Unselect(this.Get(q.daa_selectedid),q)}p.daa_prevstyle=daa.css.GetProps(p,"color, backgroundColor");if(daa.css.IsRule("itemselected")){this.ReplaceClassName(p,"itemgreyed","itemselected")}else{daa.css.SetProps(p,{color:"white",backgroundColor:"#4466AA"})}p.daa_isselected=1;q.daa_selectedid=p.id};this.Unselect=function(p,q){if(!p||!p.daa_isselected){return}q=q||this.GetParentVN(p);if(!q){return}if(daa.css.IsRule("itemselected")){this.DeleteClassName(p,"itemselected itemgreyed")}else{daa.css.SetProps(p,p.daa_prevstyle||{color:"black",backgroundColor:"transparent"})}p.daa_isselected=0;q.daa_selectedid=""};this.Grey=function(p){if(!p||!p.daa_isselected){return}p.daa_prevselstyle=daa.css.GetProps(p,"color, backgroundColor");if(daa.css.IsRule("itemgreyed")){this.ReplaceClassName(p,"itemselected","itemgreyed")}else{daa.css.SetProps(p,{color:"white",backgroundColor:"#bbb"})}p.daa_isgreyed=1};this.Ungrey=function(p){if(!p||!p.daa_isselected){return}if(daa.css.IsRule("itemgreyed")){this.ReplaceClassName(p,"itemgreyed","itemselected")}else{daa.css.SetProps(p,p.daa_prevselstyle||{color:"white",backgroundColor:"#4466AA"})}p.daa_isgreyed=0};this.SelectUnselect=function(p,q){q=q||this.GetParentVN(p);if(!q){return}if(p.daa_isselected){this.Unselect(p,q)}else{this.Select(p,q)}};this.IsIn=function(p,q){if(!p||!p.parentNode){return 0}q=daa.m.Args(q,"node");if(!q){return 0}if(p==q){return 0}p=p.parentNode;while(p){if(p==q){return 1}p=p.parentNode}return 0};this.IsSibling=function(p,q){if(p.parentNode==q.parentNode){return 1}return 0};this.IsVisible=function(p){while(p&&p!=document.body&&p!=document.documentElement){if(this.GetStyle(p,"display")=="none"||this.GetStyle(p,"visibility")=="collapse"){return 0}p=p.parentNode}if(!p){return 0}return 1};this.Get=function(p){if(!p){return null}return document.getElementById(p)||null};this.GetUpper=function(p,q,r){if(!p||!q){return null}var s="";if(daa.IsString(q)){s=q.replace(/^[\s\S]*?where[\s]*?/i,"")}while(p){if(s&&daa.Condition(s,p)){return p}else if(!s&&daa.o.HAS(p,q)){return p}if(r&&r in p){break}p=p.parentNode}return null};function m(p,q,r,s){var t=p.childNodes||[],u=null;for(var v=0;v<t.length;v++){if(s&&s in t[v]){break}if(r&&daa.Condition(r,t[v])){return t[v]}else if(!r&&daa.o.HAS(t[v],q)){return t[v]}u=m(t[v],q,r,s);if(u){return u}}return null}this.GetLower=function(p,q,r){if(!p||!q){return null}if(r&&r in p){return null}var s="";if(daa.IsString(q)){s=q.replace(/^[\s\S]*?where[\s]*?/i,"")}if(s&&daa.Condition(s,p)){return p}else if(!s&&daa.o.HAS(p,q)){return p}return m(p,q,s,r)};this.GetUpperByTagName=function(p,q){return this.GetUpper(p,{tagName:g(q).toUpperCase()})};this.GetLowerByTagName=function(p,q){return this.GetLower(p,{tagName:g(q).toUpperCase()})};this.GetItemNode=function(p,q){q=q||"daa_isitem";var r={};r[q]=undefined;var s=null;if(!s){s=this.GetUpper(p,r,"vcid")}return s};this.GetIN=this.GetItemNode;this.GetViewNode=function(p,q){q=q||"parentNode";while(p){if(p.vcid){return p}if(p.pvnid&&q=="parentNode"){return this.Get(p.pvnid)}p=p[q]}return null};this.GetVN=this.GetViewNode;this.GetParentViewNode=function(p){return this.GetVN(p.parentNode||null)};this.GetParentVN=this.GetParentViewNode;this.GetMasterViewNode=function(p){while(p){if(p.mvnid){return this.Get(p.mvnid)||this.GetUpper(p,{id:p.mvnid})}if(p.pvnid){xVN=this.GetMasterViewNode(this.Get(p.pvnid))}p=p.parentNode}return null};this.GetMasterVN=this.GetMasterViewNode;this.GetPrevViewNode=function(p){return this.GetVN(p.previousSibling||null,"previousSibling")};this.GetPrevVN=this.GetPrevViewNode;this.GetNextViewNode=function(p){return this.GetVN(p.nextSibling,"nextSibling")};this.GetNextVN=this.GetNextViewNode;this.GetFirstViewNode=function(p){return this.GetVN(p.firstChild,"nextSibling")};this.GetFirstVN=this.GetFirstViewNode;this.GetLastViewNode=function(p){return this.GetVN(p.lastChild,"previousSibling")};this.GetLastVN=this.GetLastViewNode;this.GetViewNodeHierarchy=function(p){var q={};while(p){if((p.id)&&(p.vcid)){q[p.id]=p}p=p.parentNode}return q};this.GetVNHierarchy=this.GetViewNodeHierarchy;this.GetViewNodeChain=function(p,q){var r={},s=",";while(p&&p.id&&q){if(s.indexOf(","+p.id+",")>=0){break}s+=p.id+",";r[p.id]=1;p=(p[q]&&this.Get(p[q]))||null}return r};this.GetVNChain=this.GetViewNodeChain;this.CloneProperties=function(p,q){if(p.vcid){q.vcid=p.vcid}if(p.pvcid){q.pvcid=p.pvcid}if(p.mvcid){q.mvcid=p.mvcid}for(var r in p){if(/^daa_/.test(r)){q[r]=p[r]}}var s=p.childNodes||[],t=null;for(var u=0;u<s.length;u++){t=q.childNodes[u]||null;if(!t){continue}this.CloneProperties(s[u],t)}};function n(p,q){if(p.id){p.id+=q}var r=p.childNodes;for(var s=0;s<r.length;s++){n(r[s],q)}return p};this.Clone=function(p,q){if(!p){return null}q=q||"_clone";var r=p.cloneNode(1);this.CloneProperties(p,r);r.daa_isclone=1;if(r.daa_islostownership&&daa.View(r).RegainOwnership){r=daa.View(r).RegainOwnership(r);r.daa_islostownership=0}n(r,q);return r};this.Move=function(p,q){if(!p){return null}if(!q||!q.childNodes.length){return p}var r=q.childNodes,s=null;for(var t=0;t<r.length;t++){s=r[t];if(s==p){continue}if(p.vcid){daa.View(p).AddNode(s)}else{p.appendChild(s)}if(s!=r[t]){t--}}return p};this.GetPageScroll=function(p){if(/right|bottom/i.test(p)){return 0}var q=0+(document.documentElement["scroll"+p]||(document.body&&document.body["scroll"+p])||0);if(/left|top/i.test(p)){q-=document.documentElement["client"+p]||0}return q};this.GetScrollSum=function(p,q,r){if(p==q){return 0}var s=0;p=p.parentNode;while(p){s+=p["scroll"+r]||0;if(p==q){break}p=p.parentNode}if(p!=q){s=0}return s};this.GetXY=function(p,q,r){var s=daa.RET_ROUNDED,t={left:0,top:0,right:0,bottom:0};if(!p||!p.getBoundingClientRect){return t}q=q||"";r=r||daa.REL_NONE;var u=null,v=document.body||document.documentElement;if(daa.IsNode(q)){v=q}else if(q){if(q=="parent"){v=(this.GetStyle(p,"position")!="absolute"&&p.parentNode)||p.offsetParent}else{v=this.Get(q)}}var w=0,x=0;if(v){if(v==p){return t}w=0+(r==daa.REL_NONE&&this.GetScrollSum(p,v,"Left"))-(r==daa.REL_CLIENT&&this.GetPageScroll("Left"));x=0+(r==daa.REL_NONE&&this.GetScrollSum(p,v,"Top"))-(r==daa.REL_CLIENT&&this.GetPageScroll("Top"));t=v.getBoundingClientRect();t={left:t.left+this.GetStyle(v,"borderLeftWidth",s)-w,top:t.top+this.GetStyle(v,"borderTopWidth",s)-x,right:t.right-this.GetStyle(v,"borderRightWidth",s)-w,bottom:t.bottom-this.GetStyle(v,"borderBottomWidth",s)-x}}u=p.getBoundingClientRect();u={left:Math.round((u.left-this.GetStyle(p,"marginLeft",s))-t.left),top:Math.round((u.top