-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathenv.min.js
158 lines (150 loc) · 128 KB
/
env.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/* 1.4.1 определяет дополнительные переменные среды
cscript env.min.js [\\<context>] [<input>@<charset>] [<output>] [<option>...] ...
<context> - В контексте какого компьютера получить переменные.
<input> - Формат текстовых данных стандартного потока ввода.
ini - Ввести дополнительные переменные в ini формате.
csv - Ввести в csv формате (заглавное написание ожидает ещё и заголовок).
tsv - Ввести в tsv формате (заглавное написание ожидает ещё и заголовок).
<output> - Формат текстовых данных стандартного потока вывода.
ini - Вывести дополнительные переменные в ini формате.
csv - Вывести в csv формате (заглавное написание добавляет заголовок).
tsv - Вывести в tsv формате (заглавное написание добавляет заголовок).
<charset> - Кодировка текста стандартного потока ввода.
<option> - Дополнительные опции (может быть несколько, порядок не важен).
silent - Последующие команды выполнить без отображения.
nowait - Последующие команды выполнить без ожидания.
debug - Ввести в стандартный поток ошибок отладочную информацию.
*/
// 0.3.16 конструктор основного приложения
function App(a){this.val=a};
// 0.3.5 библиотека функций общего назначения
(function(q,D){q.lib={strFirstUpperCase:function(a){return a.substr(0,1).toUpperCase()+a.substr(1)},clone:function(a){switch(!0){case q.lib.validate(a,"date"):var b=new Date(a);break;case q.lib.validate(a,"array"):b=[];for(var c=0,d=a.length;c<d;c++)b[c]=q.lib.clone(a[c]);break;case q.lib.validate(a,"object"):b={};for(c in a)b[c]="prototype"!==c?q.lib.clone(a[c]):a[c];break;default:b=a}return b},compare:function(a,b,c){var d=0;b||(b=null);switch(!0){case q.lib.validate(a,"string"):b=q.lib.convert(b,
"string");c&&(a=a.toLowerCase(),b=b.toLowerCase());break;case q.lib.validate(a,"array"):b=b&&b.length?b.length:0;a=a.length;break;case q.lib.validate(a,"date"):b=b&&b.valueOf()?b.valueOf():0,a=a.valueOf()}a>b&&(d=1);a<b&&(d=-1);return d},difference:function(a,b,c){var d;c||(c=q.lib.compare);if(q.lib.validate(a,"array")){b||(b=[]);for(var e=0,h=a.length;e<h;e++){var n=a[e];for(var g=0,f=b.length;g<f;g++){var k=b[g];if(value=c(n,k))d||(d=[]),d.push(n)}}}else if(q.lib.validate(a,"object"))for(e in b||
(b={}),a)n=a[e],k=b[e],value=q.lib.difference(n,k,c),q.lib.validate(value,"undefined")||(d||(d={}),d[e]=value);else(value=q.lib.compare(a,b))&&(d=a);return d},strim:function(a,b,c,d,e){var h="";a=a?a.toString():h;b=b?b.toString():h;c=c?c.toString():h;if(e){var n=c?a.lastIndexOf(c):a.length;e=b&&~n?a.lastIndexOf(b,n-1):0}else e=b?a.indexOf(b):0,n=c&&~e?a.indexOf(c,e+b.length):a.length;~e&&~n&&(e=d?e:e+b.length,n=d?n+c.length:n,h=a.substr(e,n-e));return h},trim:function(a){return(a||"").replace(/^\s+|\s+$/g,
"")},validate:function(a,b){var c;switch(b){case "email":b="^([a-z0-9_-]+.)*[a-z0-9_-]+@[a-z0-9_-]+(.[a-z0-9_-]+)*.[a-z]{2,6}$";break;case "password":b="(?=^.{8,}$)((?=.*d)|(?=.*W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$";break;case "guid":b="^{[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}}$";break;case "md5":b="^[0-9a-fA-F]{32}$"}switch(b){case "boolean":a=!0===a||!1===a;break;case "string":a="[object String]"===Object.prototype.toString.call(a);break;case "number":a="[object Number]"===Object.prototype.toString.call(a);
break;case "function":a="[object Function]"===Object.prototype.toString.call(a);break;case "form":a=!(!a||!a.tagName||"form"!==a.tagName.toLowerCase());break;case "files":a="[object FileList]"===Object.prototype.toString.call(a);break;case "date":a="[object Date]"===Object.prototype.toString.call(a);break;case "array":a=Array.isArray?Array.isArray(a):"[object Array]"===Object.prototype.toString.call(a);break;case "xml":a=!(!a||!(c=(a.ownerDocument||a).documentElement)||"html"===c.nodeName.toLowerCase());
break;case "undefined":a=void 0===a;break;case "null":a=null===a;break;case "object":a=a===Object(a)&&"[object Null]"!==Object.prototype.toString.call(a)&&"[object Date]"!==Object.prototype.toString.call(a)&&"[object Function]"!==Object.prototype.toString.call(a)&&"[object FileList]"!==Object.prototype.toString.call(a)&&"[object Array]"!==Object.prototype.toString.call(a)&&!(a&&(c=(a.ownerDocument||a).documentElement)&&"html"!==c.nodeName.toLowerCase())&&!(a&&a.tagName&&"form"===a.tagName.toLowerCase());
break;default:a=(new RegExp(b)).test(""+a)}return a},obj2str:function(a,b,c,d,e){var h=[];c||(c="&");d||(d="=");e||(e=",");for(var n in a){var g=a[n];var f=b?encodeURIComponent(n):n;switch(!0){case q.lib.validate(g,"array"):g=g.join(e);case !q.lib.validate(g,"undefined"):f+=d,f+=b?encodeURIComponent(g):g}h.push(f)}return h.join(c)},str2obj:function(a,b,c,d){var e,h={};c||(c="&");d||(d="=");c=a.split(c);for(var n=0,g=c.length;n<g;n++)if(e=c[n])e=e.split(d,2),a=e[0],e=e[1],a=b?decodeURIComponent(a):
a,e=b&&e?decodeURIComponent(e):e,h[a]=e;return h},url2obj:function(a){var b={},c=!1;a=a?""+a:"";var d="fragment";var e="#";-1!=a.indexOf(e)&&(b[d]=q.lib.strim(a,e,null,!1),a=q.lib.strim(a,null,e,!1));d="query";e="?";-1!=a.indexOf(e)&&(b[d]=q.lib.strim(a,e,null,!1),a=q.lib.strim(a,null,e,!1));d="scheme";e="//";0==a.indexOf(e)&&(b[d]=q.lib.strim(a,null,e,!1),a=q.lib.strim(a,e,null,!1),c=!0);d="path";e="/";a.indexOf("://")>a.indexOf(e)&&(b[d]=q.lib.strim(a,e,null,!0),a=q.lib.strim(a,null,e,!1));d="path";
e="://";0==a.indexOf(e)&&(b[d]=q.lib.strim(a,e,null,!0),a=q.lib.strim(a,null,e,!1));d="scheme";e="://";!c&&0<a.indexOf(e)&&(b[d]=q.lib.strim(a,null,e,!1),a=q.lib.strim(a,e,null,!1),c=!0);d="path";e="/";c&&-1!=a.indexOf(e)&&(b[d]=q.lib.strim(a,e,null,!0),a=q.lib.strim(a,null,e,!1));d="path";e=a.length;!c&&0<e&&(b[d]=a,a="");e="@";if(-1!=a.indexOf(e)){var h=q.lib.strim(a,e,null,!1);a=q.lib.strim(a,null,e,!1);d="password";e=":";-1!=a.indexOf(e)&&(b[d]=q.lib.strim(a,e,null,!1),a=q.lib.strim(a,null,e,
!1));b.user=a;a=h}d="port";e=":";-1!=a.indexOf(e)&&(b[d]=q.lib.strim(a,e,null,!1),a=q.lib.strim(a,null,e,!1));c&&(b.domain=a);return b},obj2url:function(a){var b="";"user"in a&&(b="//");"password"in a&&(b="//");"domain"in a&&(b="//");"port"in a&&(b="//");var c="scheme";a[c]&&(b="://");var d=""+((a[c]?a[c]:"")+b);c="user";c in a&&(d+=""+a[c]);c="password";c in a&&(d+=":"+a[c]);b="";"user"in a&&(b="@");"password"in a&&(b="@");c="domain";d+=b+(a[c]?a[c]:"");c="port";c in a&&(d+=":"+a[c]);c="path";c in
a&&(d+=""+a[c]);c="query";c in a&&(d+="?"+a[c]);c="fragment";c in a&&(d+="#"+a[c]);return d},obj2arr:function(a,b){var c=[];switch(!0){case q.lib.validate(b,"string"):case q.lib.validate(b,"number"):var d=b;b=function(n){n||(n={});return n[d]}}for(var e in a){var h=a[e];h=b?b(h,e,a):h;q.lib.validate(h,"undefined")||c.push(h)}return c},arr2obj:function(a,b,c){var d={};switch(!0){case q.lib.validate(b,"string"):case q.lib.validate(b,"number"):var e=b;b=function(p){p||(p={});return p[e]}}switch(!0){case q.lib.validate(c,
"string"):case q.lib.validate(c,"number"):var h=c;c=function(p){p||(p={});return p[h]}}for(var n=0,g=a.length;n<g;n++){var f=a[n];var k=c?c(f,n,a):n;f=b?b(f,n,a):f;q.lib.validate(f,"undefined")||q.lib.validate(k,"undefined")||(d[k]=f)}return d},convert:function(a,b){switch(b){case "bool":case "boolean":a="true"===a?!0:"false"===a?!1:!!a;break;case "int":case "integer":case "float":case "double":case "real":case "number":a=Number(a);break;case "date":a=new Date(1E3*Number(a));break;case "string":q.lib.validate(a,
"boolean")?a=a?"true":"false":q.lib.validate(a,"date")?(a=a.valueOf()/1E3,a=a.toString()):a=q.lib.validate(a,"number")?a.toString():a&&a.toString?a.toString():"";break;case "auto":q.lib.validate(a,"string")&&(b=a.split('"'),3!=b.length||b[0]||b[2]||(a=b[1]),b=a.split("'"),3!=b.length||b[0]||b[2]||(a=b[1]),q.lib.compare("true",a,!0)?q.lib.compare("false",a,!0)?q.lib.compare("null",a,!0)?a.length&&!isNaN(a)&&(a=Number(a)):a=null:a=!1:a=!0)}return a},xhr:function(a,b,c,d,e,h,n,g){var f,k=6E5,p=0;var m=
f={responseText:""};var w=null;if(!p){var r=a?""+a:"get";a=r.toUpperCase();switch(a.toLowerCase()){case "get":w=!0;break;case "head":w=!0;break;case "delete":w=!0}}if(!p){var t=function(){};var v={upload:t,download:t,success:t,error:t,complete:t};if(q.lib.validate(h,"function"))v.complete=h;else if(h)for(u in v)t=h[u],q.lib.validate(t,"function")&&(v[u]=t);h=v}if(!p){v={"X-Requested-With":"XMLHttpRequest"};if(!1===c){var u="X-Requested-With";u in v&&delete v[u]}if(q.lib.validate(c,"object"))for(u in c)switch(t=
c[u],u.toLowerCase()){case "cookie":break;case "host":break;default:v[u]=t}c=v}if(!p){d=d?d:"";if(q.lib.validate(d,"form")){v={};for(var x=0,y=d.elements.length;x<y;x++)t=d.elements[x],t.name&&!t.disabled&&(u=(""+t.type).toLowerCase(),"checkbox"==u||"radio"==u?t.checked&&(v[t.name]=t.value?t.value:!0):v[t.name]=t.files&&t.files.length?t.files:t.value?t.value:D);d=v}q.lib.validate(d,"xml")&&(w=!1,c["Content-Type"]="application/xml",d.xml?d=d.xml:(v=new XMLSerializer,d=v.serializeToString(d)));if(q.lib.validate(d,
"object")){v=!1;for(u in d)if(t=d[u],q.lib.validate(t,"files")){w=!1;v=!0;break}if(v)for(u in v=new FormData,d)if(t=d[u],q.lib.validate(t,"files")){var z=d[u];x=0;for(y=z.length;x<y;x++)t=z[x],v.append(u,t)}else q.lib.validate(t,"undefined")&&(t=""),v.append(u,t);else d=q.lib.obj2str(d,!0),!w&&d&&(c["Content-Type"]="application/x-www-form-urlencoded")}}p||(r=b?""+b:"",w&&d&&(r=r?~r.indexOf("?")?r+"&":r+"?":r+"?",r+=d,d=""),b=r);if(!p){v=null;if(!v)try{v=new XMLHttpRequest}catch(A){}if(!v)for(w="$#!&%",
z=["Ms$#!&%xm$#!&%l2$#!&%.XM$#!&%LHT$#!&%TP.6.0","Ms$#!&%xm$#!&%l2$#!&%.XM$#!&%LHT$#!&%TP.3.0","Ms$#!&%xm$#!&%l2$#!&%.XM$#!&%LHT$#!&%TP","Micr$#!&%osoft$#!&%.XM$#!&%LH$#!&%TTP"],x=0,y=z.length;!v&&x<y;x++){t=z[x];r=t.split(w).join("");try{v=new ActiveXObject(r)}catch(A){}}v?m=v:p=1}if(!p){try{k=setTimeout(function(){r=m.responseText?m.responseText:"";m.abort();h.error(r,m);h.complete(r,m)},k)}catch(A){}m.upload&&(m.upload.onprogress=function(A){A.total&&A.loaded!=A.total&&h.upload(A,m)},m.onprogress=
function(A){A.total&&A.loaded!=A.total&&h.download(A,m)});m.onreadystatechange=function(A){if(4==m.readyState){try{clearTimeout(k)}catch(B){}u=m.status?m.status:200;r=m.responseText?m.responseText:"";200<=u&&300>u&&r?h.success(r,m):h.error(r,m);h.complete(r,m)}}}if(!p)try{g?m.open(a,b,e,n,g):n?m.open(a,b,e,n):m.open(a,b,e)}catch(A){m=f,p=2}if(!p)for(u in c)r=c[u],w="; ",q.lib.validate(r,"array")&&(z=r,r=z.join(w)),m.setRequestHeader(u,r);if(!p)try{d?m.send(d):m.send()}catch(A){m=f,p=3}if(1<p)try{clearTimeout(k)}catch(A){}p&&
(r="",h.error(r,m),h.complete(r,m));return m},ajax:function(a,b,c,d,e){return q.lib.xhr(a,b,c,d,!0,e)},sjax:function(a,b,c,d){return q.lib.xhr(a,b,c,d,!1)},strPad:function(a,b,c,d){var e,h=e="",n=function(g,f){for(;h.length<f;)h+=g;return h=h.substr(0,f)};a=""+a;c=c?""+c:" ";"left"!=d&&"right"!=d&&"both"!=d&&(d="right");0<(e=b-a.length)&&("left"==d?a=n(c,e)+a:"right"==d?a+=n(c,e):"both"==d&&(e=n(c,Math.ceil(e/2)),a=(e+a+a).substr(0,b)));return a},getCookie:function(a,b){var c=document.cookie.indexOf(a+
"="),d=c+a.length+1;if(!c&&a!=document.cookie.substring(0,a.length)||-1==c)return null;a=document.cookie.indexOf(";",d);-1==a&&(a=document.cookie.length);return b?decodeURIComponent(document.cookie.substring(d,a)):unescape(document.cookie.substring(d,a))},setCookie:function(a,b,c,d,e,h,n){var g=new Date((new Date).valueOf()+c);document.cookie=a+"="+(n?encodeURIComponent(b):escape(b))+(c?";expires="+g.toGMTString():"")+(d?";path="+d:"")+(e?";domain="+e:"")+(h?";secure":"");return!0},delCookie:function(a,
b,c){q.lib.getCookie(a)&&(document.cookie=a+"="+(b?";path="+b:"")+(c?";domain="+c:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT");return!0},getStorage:function(a,b){var c,d=null,e=null;if(c=window&&window.localStorage?localStorage.getItem(a):q.lib.getCookie(a)){var h=c.indexOf("?");-1!=h&&(type=c.substr(0,h),c=c.substr(h+1));b?(c=c.split("&"),!0!==b&&(c.length=Math.min(b,c.length))):c=[c];for(var n=0,g=c.length;n<g;n++){h=c[n].indexOf("=");if(-1!=h){if(a=c[n].substr(0,h),a=decodeURIComponent(a),d=c[n].substr(h+
1),!e){var f=!0;e={}}}else a=n,d=c[n],e||(f=!1,e=[]);d=decodeURIComponent(d);type&&(d=q.lib.convert(d,type));f?e[a]=d:e.push(d)}}else e=null;return b?e:d},setStorage:function(a,b){var c,d=[];var e=function(f,k){c||(c=q.lib.validate(f,"number")?"number":q.lib.validate(f,"date")?"date":q.lib.validate(f,"boolean")?"boolean":"string");f=q.lib.convert(f,"string");f=encodeURIComponent(f);q.lib.validate(k,"undefined")?d.push(f):(k=encodeURIComponent(k),d.push(k+"="+f))};if(q.lib.validate(b,"object"))for(var h in b)e(b[h],
h);else if(q.lib.validate(b,"array")){h=0;for(var n=b.length;h<n;h++)e(b[h])}else q.lib.validate(b,"null")||e(b);if(d=d.join("&"))if(d=c+"?"+d,window&&window.localStorage)try{localStorage.setItem(a,d);var g=!0}catch(f){g=!1}else g=q.lib.setCookie(a,d,31536E7,location.pathname,document.domain);else window&&window.localStorage?(localStorage.removeItem(a),g=!0):g=q.lib.delCookie(a,location.pathname,document.domain);return g},counter:function(){var a={};return function(b,c){var d=0;q.lib.validate(b,"array")&&
b.join("_");b&&(a[b]=a[b]||0,d=a[b],!1===c?delete a[b]:!0===c?a[b]++:c&&(a[b]+=c));return d}}(),on:function(){var a={};return function(b,c,d){var e,h=[],n=0;b=b.toString().split(/\s+/);for(var g=0,f=b.length;g<f;g++)if(e=b[g])if(a[e]||(a[e]=[0]),d)if(c){a[e][c]||(a[e][c]=[]);var k=a[e][c].length;a[e][c][k]=d;a[e][0]>=c&&h.push([e,c,k]);n++}else{k=1;for(var p=a[e].length;k<p;k++)if(a[e][k])for(var m=0,w=a[e][k].length;m<w;m++)a[e][k][m]===d&&(delete a[e][k][m],n++)}else if(a[e][0]++,c=c||a[e][0],a[e][c])for(k=
0;k<a[e][c].length;k++)a[e][c][k]&&h.push([e,c,k]),n++;g=0;for(f=h.length;g<f;g++)e=h[g][0],c=h[g][1],k=h[g][2],a[e]&&a[e][c]&&a[e][c][k]&&a[e][c][k].call(a[e][c][k],c);return n}}(),href:function(a){var b=document.createElement("a");b.href=a;return b.cloneNode(!1).href},getExt:function(a){var b="";var c=(""+a).lastIndexOf(".");-1!==c&&(b=a.substr(c+1),b=b.toLowerCase());return b},md5:function(a){var b=function(u,x){var y=u&2147483648;var z=x&2147483648;var A=u&1073741824;var B=x&1073741824;u=(u&1073741823)+
(x&1073741823);return A&B?u^2147483648^y^z:A|B?u&1073741824?u^3221225472^y^z:u^1073741824^y^z:u^y^z},c=function(u,x,y,z,A,B,C){u=b(u,b(b(x&y|~x&z,A),C));return b(u<<B|u>>>32-B,x)},d=function(u,x,y,z,A,B,C){u=b(u,b(b(x&z|y&~z,A),C));return b(u<<B|u>>>32-B,x)},e=function(u,x,y,z,A,B,C){u=b(u,b(b(x^y^z,A),C));return b(u<<B|u>>>32-B,x)},h=function(u,x,y,z,A,B,C){u=b(u,b(b(y^(x|~z),A),C));return b(u<<B|u>>>32-B,x)},n=function(u){var x="",y;for(y=0;3>=y;y++){var z=u>>>8*y&255;z="0"+z.toString(16);x+=z.substr(z.length-
2,2)}return x},g=[];a=function(u){u=u.replace(/\r\n/g,"\n");for(var x="",y=0;y<u.length;y++){var z=u.charCodeAt(y);128>z?x+=String.fromCharCode(z):(127<z&&2048>z?x+=String.fromCharCode(z>>6|192):(x+=String.fromCharCode(z>>12|224),x+=String.fromCharCode(z>>6&63|128)),x+=String.fromCharCode(z&63|128))}return x}(a.toString());g=function(u){var x=u.length;var y=x+8;for(var z=16*((y-y%64)/64+1),A=Array(z-1),B,C=0;C<x;)y=(C-C%4)/4,B=C%4*8,A[y]|=u.charCodeAt(C)<<B,C++;y=(C-C%4)/4;A[y]|=128<<C%4*8;A[z-2]=
x<<3;A[z-1]=x>>>29;return A}(a);var f=1732584193;var k=4023233417;var p=2562383102;var m=271733878;for(a=0;a<g.length;a+=16){var w=f;var r=k;var t=p;var v=m;f=c(f,k,p,m,g[a+0],7,3614090360);m=c(m,f,k,p,g[a+1],12,3905402710);p=c(p,m,f,k,g[a+2],17,606105819);k=c(k,p,m,f,g[a+3],22,3250441966);f=c(f,k,p,m,g[a+4],7,4118548399);m=c(m,f,k,p,g[a+5],12,1200080426);p=c(p,m,f,k,g[a+6],17,2821735955);k=c(k,p,m,f,g[a+7],22,4249261313);f=c(f,k,p,m,g[a+8],7,1770035416);m=c(m,f,k,p,g[a+9],12,2336552879);p=c(p,m,
f,k,g[a+10],17,4294925233);k=c(k,p,m,f,g[a+11],22,2304563134);f=c(f,k,p,m,g[a+12],7,1804603682);m=c(m,f,k,p,g[a+13],12,4254626195);p=c(p,m,f,k,g[a+14],17,2792965006);k=c(k,p,m,f,g[a+15],22,1236535329);f=d(f,k,p,m,g[a+1],5,4129170786);m=d(m,f,k,p,g[a+6],9,3225465664);p=d(p,m,f,k,g[a+11],14,643717713);k=d(k,p,m,f,g[a+0],20,3921069994);f=d(f,k,p,m,g[a+5],5,3593408605);m=d(m,f,k,p,g[a+10],9,38016083);p=d(p,m,f,k,g[a+15],14,3634488961);k=d(k,p,m,f,g[a+4],20,3889429448);f=d(f,k,p,m,g[a+9],5,568446438);
m=d(m,f,k,p,g[a+14],9,3275163606);p=d(p,m,f,k,g[a+3],14,4107603335);k=d(k,p,m,f,g[a+8],20,1163531501);f=d(f,k,p,m,g[a+13],5,2850285829);m=d(m,f,k,p,g[a+2],9,4243563512);p=d(p,m,f,k,g[a+7],14,1735328473);k=d(k,p,m,f,g[a+12],20,2368359562);f=e(f,k,p,m,g[a+5],4,4294588738);m=e(m,f,k,p,g[a+8],11,2272392833);p=e(p,m,f,k,g[a+11],16,1839030562);k=e(k,p,m,f,g[a+14],23,4259657740);f=e(f,k,p,m,g[a+1],4,2763975236);m=e(m,f,k,p,g[a+4],11,1272893353);p=e(p,m,f,k,g[a+7],16,4139469664);k=e(k,p,m,f,g[a+10],23,3200236656);
f=e(f,k,p,m,g[a+13],4,681279174);m=e(m,f,k,p,g[a+0],11,3936430074);p=e(p,m,f,k,g[a+3],16,3572445317);k=e(k,p,m,f,g[a+6],23,76029189);f=e(f,k,p,m,g[a+9],4,3654602809);m=e(m,f,k,p,g[a+12],11,3873151461);p=e(p,m,f,k,g[a+15],16,530742520);k=e(k,p,m,f,g[a+2],23,3299628645);f=h(f,k,p,m,g[a+0],6,4096336452);m=h(m,f,k,p,g[a+7],10,1126891415);p=h(p,m,f,k,g[a+14],15,2878612391);k=h(k,p,m,f,g[a+5],21,4237533241);f=h(f,k,p,m,g[a+12],6,1700485571);m=h(m,f,k,p,g[a+3],10,2399980690);p=h(p,m,f,k,g[a+10],15,4293915773);
k=h(k,p,m,f,g[a+1],21,2240044497);f=h(f,k,p,m,g[a+8],6,1873313359);m=h(m,f,k,p,g[a+15],10,4264355552);p=h(p,m,f,k,g[a+6],15,2734768916);k=h(k,p,m,f,g[a+13],21,1309151649);f=h(f,k,p,m,g[a+4],6,4149444226);m=h(m,f,k,p,g[a+11],10,3174756917);p=h(p,m,f,k,g[a+2],15,718787259);k=h(k,p,m,f,g[a+9],21,3951481745);f=b(f,w);k=b(k,r);p=b(p,t);m=b(m,v)}return(n(f)+n(k)+n(p)+n(m)).toLowerCase()},sha256:function(a){var b=function(d,e){var h=(d&65535)+(e&65535);return(d>>16)+(e>>16)+(h>>16)<<16|h&65535},c=function(d,
e){return d>>>e|d<<32-e};a=function(d){d=d.replace(/\r\n/g,"\n");for(var e="",h=0;h<d.length;h++){var n=d.charCodeAt(h);128>n?e+=String.fromCharCode(n):(127<n&&2048>n?e+=String.fromCharCode(n>>6|192):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128)),e+=String.fromCharCode(n&63|128))}return e}(a);return function(d){for(var e="",h=0;h<4*d.length;h++)e+="0123456789abcdef".charAt(d[h>>2]>>8*(3-h%4)+4&15)+"0123456789abcdef".charAt(d[h>>2]>>8*(3-h%4)&15);return e}(function(d,e){var h=
[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,
275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],g=Array(64),f,k;d[e>>5]|=128<<24-e%32;d[(e+64>>9<<4)+15]=e;for(f=0;f<d.length;f+=16){e=n[0];var p=n[1];var m=n[2];var w=n[3];var r=n[4];var t=n[5];var v=n[6];var u=n[7];for(k=0;64>k;k++){if(16>k)g[k]=d[k+f];else{var x=k;var y=g[k-
2];y=c(y,17)^c(y,19)^y>>>10;y=b(y,g[k-7]);var z=g[k-15];z=c(z,7)^c(z,18)^z>>>3;g[x]=b(b(y,z),g[k-16])}x=r;x=c(x,6)^c(x,11)^c(x,25);x=b(b(b(b(u,x),r&t^~r&v),h[k]),g[k]);u=e;u=c(u,2)^c(u,13)^c(u,22);y=b(u,e&p^e&m^p&m);u=v;v=t;t=r;r=b(w,x);w=m;m=p;p=e;e=b(x,y)}n[0]=b(e,n[0]);n[1]=b(p,n[1]);n[2]=b(m,n[2]);n[3]=b(w,n[3]);n[4]=b(r,n[4]);n[5]=b(t,n[5]);n[6]=b(v,n[6]);n[7]=b(u,n[7])}return n}(function(d){for(var e=[],h=0;h<8*d.length;h+=8)e[h>>5]|=(d.charCodeAt(h/8)&255)<<24-h%32;return e}(a),8*a.length))},
parseJSON:function(a){if(window&&window.JSON&&JSON.parse)try{var b=JSON.parse(a)}catch(c){b=eval("("+a+")")}else b=eval("("+a+")");return b},numDeclin:function(a,b,c,d){a=Number(a);a=Math.abs(a);a=Math.floor(a);var e=a%10;return 1!=(a%100-e)/10?0==e?b:1==e?c:5>e?d:b:b},num2str:function(a,b,c,d){var e,h;isNaN(b=Math.abs(b))&&(b=2);c==D&&(c=",");d==D&&(d=".");if(h=0>a)a=Math.abs(a);var n=parseInt(a=(+a||0).toFixed(b))+"";var g=(e=3<(e=n.length)?e%3:0)?n.substr(0,e)+d:"";d=n.substr(e).replace(/(\d{3})(?=\d)/g,
"$1"+d);a=b?c+Math.abs(a-n).toFixed(b).replace(/-/,0).slice(2):"";return(h?"-":"")+g+d+a},num2word:function(a,b,c){function d(u,x){u=u.toString().substr(-2);return x[0]+(/^[0,2-9]?[1]$/.test(u)?x[2]:/^[0,2-9]?[2-4]$/.test(u)?x[3]:x[1])}var e=[],h=[["ноль"],[,,,"три","четыре","пять","шесть","семь","восемь","девять"],"десять одиннадцать двенадцать тринадцать четырнадцать пятнадцать шестнадцать семнадцать восемнадцать девятнадцать".split(" "),[,,"двадцать","тридцать","сорок","пятьдесят","шестьдесят",
"семьдесят","восемьдесят","девяносто"],[,"сто","двести","триста","четыреста","пятьсот","шестьсот","семьсот","восемьсот","девятьсот"],[[,"один","два"],[,"одна","две"],[,"одно","два"]]],n=[["...ллион","ов","","а"],["тысяч","","а","и"],["миллион","ов","","а"],["миллиард","ов","","а"],["триллион","ов","","а"],["квадриллион","ов","","а"],["квинтиллион","ов","","а"],["секстилион","ов","","а"],["септилион","ов","","а"],["окталион","ов","","а"],["ноналион","ов","","а"],["декалион","ов","","а"],["эндекалион",
"ов","","а"],["додекалион","ов","","а"]],g=[[["цел","ых","ый","ых"],["цел","ых","ая","ых"],["цел","ых","ое","ых"]],["десят","ых","ая","ых"],["сот","ых","ая","ых"],["тясячн","ых","ая","ых"],["десятитысячн","ых","ая","ых"],["стотысячн","ых","ая","ых"],["милионн","ых","ая","ых"],["десятимилионн","ых","ая","ых"]];c=c||0;a=a.toString().split(".");for(var f=0,k=a.length;f<k;f++){f&&(a[f]=a[f].substr(0,g.length-1));l=a[f].length;a[f]=["","00","0"][a[f].split(/\d{3}/).join("").length]+a[f];for(var p=a[f].length,
m,w=0,r=-1,t=[];3*w<p;){m=a[f].substr(-3*(w+1),3);t[++r]=[];for(var v=0;2>=v;v++)if(0!=m[v])switch(v){case 0:t[r][t[r].length]=h[4][m[v]];break;case 1:1==m[v]?(t[r][t[r].length]=h[2][m[2]],v=3):t[r][t[r].length]=h[3][m[v]];break;case 2:t[r][t[r].length]=2>=m[v]?h[5][1==w||f?1:c][m[v]]:h[1][m[v]]}t[r].length||(t[r][t[r].length]=h[0][0]);0<m&&0<w&&(t[r][t[r].length]=d(m,n[w]));!w&&1<k&&(t[r][t[r].length]=d(m,f?g[l]:g[0][c]));w||!b||f||f!=k-1?!w&&b&&f&&(t[r][t[r].length]=b[0]+b[3]):t[r][t[r].length]=
d(m,b);t[r]=t[r].join(" ");w++}e[e.length]=t.reverse().join(" ")}return e.join(" ")},date2str:function(a,b){var c="Воскресенье Понедельник Вторник Среда Четверг Пятница Суббота".split(" "),d=" Января Февраля Марта Апреля Мая Июня Июля Августа Сентября Октября Ноября Декабря".split(" "),e={0:"ый",2:"ой",3:"ий",6:"ой",7:"ой",8:"ой",22:"ой",26:"ой",27:"ой",28:"ой"},h={"-660":"ST","-600":"HAST","-540":"AKT","-480":"AWST","-420":"CXT","-360":"СST","-300":"EST","-240":"AST","-210":"NST","-180":"ART",0:"GMT",
60:"CET",120:"CAT",180:"MSK",210:"IRST",300:"PKT",330:"IST",360:"BDT",390:"MST",420:"CXT",480:"AWST",540:"JST",570:"ACST",600:"AEST",660:"NFT"},n="";var g=function(w){var r="";switch(w){case "d":r+=q.lib.strPad(g("j"),2,"0","left");break;case "D":r+=g("l").substr(0,3);break;case "j":r+=a.getDate();break;case "l":r+=c[g("w")];break;case "N":r+=g("w")||7;break;case "S":r+=e[g("j")]||e[0];break;case "w":r+=a.getDay();break;case "z":r+=(a-new Date(a.getFullYear(),0,1))/864E5>>0;break;case "W":w=new Date(a.valueOf());
var t=(a.getDay()+6)%7;w.setDate(w.getDate()-t+3);t=w.valueOf();w.setMonth(0,1);4!==w.getDay()&&w.setMonth(0,1+(4-w.getDay()+7)%7);r+=1+Math.ceil((t-w)/6048E5);break;case "F":r+=d[g("n")];break;case "m":r+=q.lib.strPad(g("n"),2,"0","left");break;case "M":r+=g("F").substr(0,3);break;case "n":r+=a.getMonth()+1;break;case "t":r+=(new Date(a.getFullYear(),a.getMonth()+1,0)).getDate();break;case "L":r+=a.getFullYear()&3||!(a.getFullYear()%100)&&a.getFullYear()%400?0:1;break;case "o":(function(){var v=
new Date(a.valueOf());v.setDate(v.getDate()-(a.getDay()+6)%7+3);r+=v.getFullYear()})();break;case "Y":r+=a.getFullYear();break;case "y":r+=g("Y").substr(2,2);break;case "a":r+=11<a.getHours()?"pm":"am";break;case "A":r+=g("a").toUpperCase();break;case "B":(function(){var v=60*(a.getTimezoneOffset()+60);v=3600*a.getHours()+60*a.getMinutes()+a.getSeconds()+v;v=Math.floor(v/86.4);1E3<v&&(v-=1E3);0>v&&(v+=1E3);r+=q.lib.strPad(v,3,"0","left")})();break;case "g":r+=a.getHours()%12||12;break;case "G":r+=
a.getHours();break;case "h":r+=q.lib.strPad(g("g"),2,"0","left");break;case "H":r+=q.lib.strPad(g("G"),2,"0","left");break;case "i":r+=q.lib.strPad(a.getMinutes(),2,"0","left");break;case "s":r+=q.lib.strPad(a.getSeconds(),2,"0","left");break;case "u":r+=q.lib.strPad(1E3*a.getMilliseconds(),6,"0","left");break;case "e":r+=(new Date).toString().split(" ")[5].split("-")[0].split("+")[0];break;case "I":r+=(new Date(a.getFullYear(),0,1)).getTimezoneOffset()!=a.getTimezoneOffset()?1:0;break;case "O":r+=
(0<a.getTimezoneOffset()?"-":"+")+q.lib.strPad(Math.abs(a.getTimezoneOffset()/60*100),4,"0","left");break;case "P":r+=g("O").substr(0,3)+":"+g("O").substr(3,2);break;case "T":r+=h[-1*a.getTimezoneOffset()-60*Number(g("I"))]||h[0];break;case "Z":r+=-60*a.getTimezoneOffset();break;case "c":r+=g("Y")+"-"+g("m")+"-"+g("d")+"T"+g("h")+":"+g("i")+":"+g("s")+g("P");break;case "r":r+=g("D")+", "+g("j")+" "+g("M")+" "+g("Y")+" "+g("h")+":"+g("i")+":"+g("s")+" "+g("O");break;case "U":r+=Math.round(a.getTime()/
1E3)}return r};for(var f=0,k=b.length;f<k;f++){var p=b.charAt(f);n="\\"!==m?n+(g(p)||p):n+p;var m=p}return n},extend:function(){var a=arguments[0]||{},b=1,c=arguments.length,d=!1,e;q.lib.validate(a,"boolean")&&(d=a,a=arguments[1]||{},b=2);for(q.lib.validate(a,"object")||q.lib.validate(a,"function")||(a={});b<c;++b)if(null!=(e=arguments[b]))for(var h in e){var n=a[h],g=e[h];a!==g&&(d&&g&&q.lib.validate(g,"object")&&!g.nodeType?a[h]=q.lib.extend(d,n||(null!=g.length?[]:{}),g):q.lib.validate(g,"undefined")||
(a[h]=g))}return a},template:function(a,b,c){var d;if(a){b||(b={});a=a.toString();a=a.split("|");for(var e=a.length,h=e-1;-1<h;h--)if(d=a[h]){var n=!0;var g=d.split("{");for(var f=1,k=g.length;f<k;f++){d=g[f];var p=d.indexOf("}");if(~p){var m=d.substr(0,p);var w=m.split(">");var r=w.shift().split(".");if(q.lib.validate(b,"function"))m=b(r),n=!q.lib.validate(m,"undefined");else{m=b;for(var t=0,v=r.length;n&&t<v;t++){var u=r[t];(n=u in m)&&(m=m[u])}}t=0;for(v=w.length;n&&t<v;t++)n=w[t],c?(m=c(n,m),
n=!q.lib.validate(m,"undefined")):n=!1;n&&(p+=1,d=m+d.substr(p))}else d="{"+d;g[f]=d}d=g.join("");n?a[h]=d:a.splice(h,1)}else h&&h<e-1&&(a[h]="|");b=a.join("")}else b="";return b},getRandomString:function(a,b){var c="";b||(b=89);b=Math.min(Math.max(b,1),89);for(var d=0;d<a;d++)c+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()-_+=;:,./?|`~[]{}".charAt(Math.round(Math.random()*(b-1)));return c},hasValue:function(a,b,c){var d,e=0;var h=1>=arguments.length;var n=!c&&q.lib.validate(b,
"string");var g=!c&&q.lib.validate(b,"boolean");switch(!0){case q.lib.validate(a,"array"):for(var f=0,k=a.length;f<k;f++)(d=h?!0:c?a[f]===b:n&&q.lib.validate(a[f],"string")?a[f].toLowerCase()==b.toLowerCase():g?b?a[f]:!a[f]:a[f]==b)&&e++;break;case q.lib.validate(a,"object"):for(k in a)(d=h?!0:c?a[k]===b:n&&q.lib.validate(a[k],"string")?a[k].toLowerCase()==b.toLowerCase():g?b?a[k]:!a[k]:a[f]==b)&&e++;break;case q.lib.validate(a,"string"):e=h?e+a.length:n?e+(a.toLowerCase().split(b.toLowerCase()).length-
1):e+(a.split(b).length-1);break;default:(h?a:c?a===b:g?b?a:!a:a==b)&&e++}return e},ini2obj:function(a,b){var c={};a=a?(""+a).split("\r\n"):"";for(var d=0,e=a.length;d<e;d++){var h=q.lib.trim(a[d]);if(h.indexOf(";")&&h.indexOf("#"))if(h.indexOf("[")||h.length!=h.indexOf("]",1)+1){if(~h.indexOf("=")){var n=q.lib.trim(q.lib.strim(h,null,"=",!1,!1));h=q.lib.trim(q.lib.strim(h,"=",null,!1,!1));b&&(h=q.lib.convert(h,"auto"))}else n=q.lib.trim(h),h=D;g?(q.lib.validate(c[g],"object")||(c[g]={}),n&&(c[g][n]=
h)):n&&(c[n]=h)}else var g=q.lib.trim(h.substr(1,h.length-1-1))}return c},tsv2arr:function(a,b,c,d,e){var h,n=0,g=[],f=[],k="\t",p=[];c&&(k=c);a=(a?""+a:"").split("\r\n");switch(!0){case q.lib.validate(b,"array"):c=0;for(var m=b.length;c<m;c++){var w=b[c];var r="";g.push(w);f.push(r)}break;case q.lib.validate(b,"object"):for(w in b)r=b[w],g.push(w),f.push(r);break;case !!b:b=a[n].split(k);c=0;for(m=b.length;c<m;c++){var t=b[c].split(":");w=t[0];r=t[1]||"";g.push(w);f.push(r)}n++}for(t=a.length;n<
t;n++)if(w=a[n]){b=w.split(k);var v=!1;var u=(h=g.length)?{}:[];w=h?g.length:b.length;c=0;for(m=w;c<m;c++){var x=b[c]||"";w=h?g[c]:u.length;r=f[c]||(d?"auto":"");h&&!w||e&&!x||(r&&(x=q.lib.convert(x,r)),u[w]=x,v=!0)}v&&p.push(u)}return p},arr2tsv:function(a,b,c,d){var e=0,h,n=!1,g=[],f=[],k=[],p="\t",m="";a||(a=[]);c&&(p=c);switch(!0){case q.lib.validate(b,"array"):c=0;for(var w=b.length;c<w;c++){var r=b[c];f.push(r);n=!0}break;case q.lib.validate(b,"object"):for(r in b){var t=b[r];f.push(r);k.push(t);
n=!0}}if(!f.length)for(c=0,w=a.length;c<w;c++)switch(t=a[c],!0){case q.lib.validate(t,"array"):c=0;for(w=t.length;c<w;c++)r=""+c,q.lib.hasValue(f,r,!0)||f.push(r);break;case q.lib.validate(t,"object"):for(r in t)q.lib.hasValue(f,r,!0)||(f.push(r),n=!0)}if(!k.length&&d)for(c=0,w=f.length;c<w;c++){b=t="";r=f[c];var v=0;for(h=a.length;v<h;v++)if(r in a[v]){b=a[v][r];switch(!0){case q.lib.validate(b,"boolean"):b="boolean";break;case q.lib.validate(b,"number"):b="number";break;case q.lib.validate(b,"date"):b=
"date";break;default:b=""}if(t&&t!=b)break;else t=b}b||(t="string");k[c]=t}if(f.length&&q.lib.validate(d,"boolean")){v=[];h=!1;c=0;for(w=f.length;c<w;c++)r=f[c],t=k[c],b=r+(d?":"+t:""),~b.indexOf(p)&&(b=b.split(p).join("")),~b.indexOf("\r\n")&&(b=b.split("\r\n").join("")),b&&(h=!0),v.push(b);v.length&&h&&(r=v.join(p),g.push(r))}for(d=a.length;e<d;e++){t=a[e];v=[];h=!1;r=n?f.length:t.length;c=0;for(w=r;c<w;c++)r=n?f[c]:c,b=r in t?t[r]:"",b=q.lib.convert(b,"string"),~b.indexOf(p)&&(b=b.split(p).join("")),
~b.indexOf("\r\n")&&(b=b.split("\r\n").join("")),b&&(h=!0),v.push(b);v.length&&h&&(r=v.join(p),g.push(r))}g.length&&(m=g.join("\r\n"));return m},nix2win:function(a,b,c){a=a?""+a:"";b?a="//"+b+a:a.indexOf("/")||(a=a.substring(1));c||(a=a.split("/").join("\\"));return a},wcd2wql:function(a,b,c){var d="";if(b){isBreak=!1;a=(a?""+a:"").split("|");for(var e=0,h=a.length;e<h;e++){a[e]=a[e].split("!");for(var n=0,g=a[e].length;n<g;n++){var f=a[e][n];var k=b;q.lib.validate(c,"function")&&(d=c(f,k),d.length&&
(f=d.shift()),d.length&&(k=d.shift()));f||(f="*");f&&!q.lib.hasValue(["true","false"],f,!1)&&(f="'"+f+"'");d=k+" "+(n?"<>":"=")+" "+f;a[e][n]=d}d=a[e].join(" AND ");2<h&&1<g&&(d="("+d+")");a[e]=d}d=a.join(" OR ");1<h&&(d="("+d+")")}return d},sort:function(a,b){var c=[],d=0;if(!q.lib.validate(b,"function")){switch(b){case "asc":case !0:d=1;break;case "desc":case !1:d=-1}b=function(g,f){return d?d*q.lib.compare(g,f,!1):0}}switch(!0){case q.lib.validate(a,"array"):var e=a.sort(b);break;case q.lib.validate(a,
"object"):e={};for(n in a)c.push(n);c.sort(b);b=0;for(var h=c.length;b<h;b++){var n=c[b];e[n]=a[n]}break;default:e=a}return e},count:function(a,b){var c=0;if(a)switch(!0){case q.lib.validate(a,"array"):b||(c=a.length);for(var d=c,e=a.length;d<e;d++){var h=a[d];b&&!h||c++}break;case q.lib.validate(a,"object"):for(d in a)h=a[d],b&&!h||c++}return c},match:function(a,b){var c;if(b&&"*"!=b){b=b?""+b:"";a=(a?""+a:"").toLowerCase();b=b.toLowerCase();var d=c=!1;b=b.split("|");for(var e=0,h=b.length;e<h&&
!d;e++){b[e]=b[e].split("!");for(var n=0,g=b[e].length;n<g&&!d;n++){var f=!0;var k=d=0;b[e][n]=b[e][n].split("*");for(var p=0,m=b[e][n].length;p<m&&f;p++){var w=b[e][n][p];d=a.indexOf(w,d);k=a.lastIndexOf(w);f=p?~d:!d;d+=w.length;k+=w.length}f&&w.length&&(f=(1<m?k:d)==a.length);c=n?c&&!f:c||f;d=n&&!c}}}else c=!0;return!!c},setParamKeys:function(a,b,c,d,e,h,n,g){var f,k,p,m,w=[],r=0;if(a&&e&&h){q.lib.validate(b,"array")?m=!0:b=[b];var t=!1;var v=0;for(k=b.length;v<k&&!t;v++)(f=b[v])||(t=!0);t&&(b=
[]);for(v=0;v<e.length;v++){k=e[v];var u="";if(g&&k==g)break;if(p=(p=(p=f=q.lib.strim(k,null,h,!1,!1))&&!q.lib.hasValue(f,"\\",!0))&&!q.lib.hasValue(f,"/",!0))u=f,k=q.lib.strim(k,h,null,!1,!1),n&&(t=k.split(n),3!=t.length||t[0]||t[2]||(k=t[1]));var x=!1;q.lib.validate(c,"function")&&(t=c(k,u),t.length&&(k=t.shift()),t.length&&(u=t.shift()),x=!0);t=!1;if(p=(p=!u||!b.length||q.lib.hasValue(b,u,!0))&&(m?u:!u))f=m?u:b[0],q.lib.validate(c,"array")?q.lib.hasValue(c,k,!0)&&(f||(f=k,k=!0),f&&(t=!0)):(x||
c&&(k=q.lib.convert(k,c)),f&&(t=!0));u=!1;t&&!q.lib.hasValue(w,f,!0)&&(w.push(f),u=!0);t&&(u||d)&&(d?(a[f]||(a[f]=[]),a[f].push(k)):a[f]=k,e.splice(v,1),v--,r++)}}return r}}})(App.prototype);
// 0.3.0 функци для работы в среде windows script host
(function(q,t,u){q.wsh={ldap:function(a,e){var b=[],f=[],d=0;if(!d){var c=new ActiveXObject("ADODB.Connection");var h=new ActiveXObject("NameTranslate");var g=new ActiveXObject("ADODB.Command")}d||(c.provider="ADsDSOObject",c.open("Active Directory Provider"),g.activeConnection=c,g.properties("Searchscope").value=2,g.properties("Page Size").value=100);if(!d)try{var k=GetObject("LDAP://RootDSE");var m=k.get("DefaultNamingContext")}catch(r){d=1}d||(f=[a],e&&f.push(e));for(var p=f.length-1;!d&&-1<p;p--){a=
f[p];e=k=null;var l="SELECT distinguishedName FROM 'LDAP://"+m+"'";if(!d&&a&&!e&&q.lib.validate(a,"guid")){c=(""+a).toUpperCase();try{h.init(3,""),h.set(7,c),e=h.get(1)}catch(r){d=2}}if(!d&&a&&!e)try{(e=a.get("distinguishedName"))&&(k=a)}catch(r){}if(!d&&a&&!e){c=l+" WHERE cn = '"+a+"' OR sAMAccountName = '"+a+"' OR distinguishedName = '"+a+"'";try{g.commandText=c;var n=g.execute();n.recordCount&&(e=n.fields("distinguishedName").value)}catch(r){}}if(!d&&!e){a?(c=""+a,c=q.lib.template(c,{scheme:"LDAP:",
parent:m,select:l}),c.toUpperCase().indexOf("WHERE")?c.toUpperCase().indexOf("SELECT")&&(d=3):c=l+" "+c):c=l+" WHERE distinguishedName = '"+m+"'";try{g.commandText=c,n=g.execute(),n.recordCount||(d=5)}catch(r){d=4}}if(!d&&e&&!p)if(k)b.push(k);else{c=e;try{k=GetObject("LDAP://"+c),b.push(k)}catch(r){d=6}}if(!d&&!e)for(a=0,l=n.recordCount;a<l;n.moveNext(),a++)c=n.fields("distinguishedName").value,a||(e=c),!p&&c&&(k=GetObject("LDAP://"+c),b.push(k));d||(m=e)}return b},iconv:function(a,e,b){var f=new ActiveXObject("ADODB.Stream");
f.type=2;f.mode=3;f.open();f.charset=e;f.writeText(b);f.position=0;f.charset=a;b=f.readText();f.close();return b},getFileText:function(a){var e="";var b=new ActiveXObject("ADODB.Stream");b.type=2;b.mode=3;b.open();try{b.loadFromFile(a),e=b.readText()}catch(f){}b.close();return e},setFileText:function(a,e,b){var f=!1,d=0;var c=new ActiveXObject("ADODB.Stream");c.type=2;c.mode=3;var h=new ActiveXObject("ADODB.Stream");h.type=1;h.mode=3;c.open();h.open();if(b)try{c.loadFromFile(a);var g=c.readText().charAt(0);
48111==g.charCodeAt(0)&&(f=!0);c.writeText("",1)}catch(k){}try{c.writeText(e),g=e&&e.charAt?e.charAt(0):"",48111==g.charCodeAt(0)&&(f=!0),c.position=f?2:0,c.copyTo(h),h.saveToFile(a,2)}catch(k){d=1}h.close();c.close();return!d},getFolder:function(a,e){var b=!1;var f=new ActiveXObject("Scripting.FileSystemObject");if(a){a=f.getAbsolutePathName(a);var d=a.split("\\");var c=d[0]?1:4;for(var h=d.length;h>c&&(a=d.slice(0,h).join("\\"),!f.folderExists(a));h--);for(var g=d.length;h<=g;h++)if(a=d.slice(0,
h).join("\\"),f.folderExists(a))b=f.getFolder(a);else if(e){if(h>c)try{b=f.createFolder(a)}catch(k){b=!1;break}}else{b=!1;break}}return b},setShortcut:function(a){var e,b,f,d={},c=!1,h=!1,g=0;var k=new ActiveXObject("WScript.Shell");var m=new ActiveXObject("Scripting.FileSystemObject");g||(a&&a.fullName?(a.targetPath&&(b=k.expandEnvironmentStrings(a.targetPath)),a.fullName&&(f=k.expandEnvironmentStrings(a.fullName))):g=1);if(!g&&"targetPath"in a&&!b&&(c=!0,m.fileExists(f)))try{m.deleteFile(f,!0)}catch(n){g=
3}if(!g&&!c)try{d=k.createShortcut(f)}catch(n){g=2}if(!g&&!c)for(e in a){var p=!0;b=a[e];switch(e.toLowerCase()){case "fullname":p=!1;break;case "targetpath":var l=k.expandEnvironmentStrings(b);l=m.getAbsolutePathName(l);d[e]==l&&(p=!1);l=m.getAbsolutePathName(b);!q.lib.compare(l,b,!0)&&q.lib.compare(l,b,!1)&&(b=l);break;case "iconlocation":b=~b.indexOf(",")?b.split(", ").join(","):b+",0"}if(p&&e in d&&d[e]!=b)try{d[e]=b,h=!0}catch(n){g=4}}if(!g&&h)try{d.save()}catch(n){g=5}if(!g&&!c&&m.getFileName(f)!=
m.getFileName(m.getAbsolutePathName(d.fullName)))try{m.moveFile(d.fullName,f)}catch(n){g=6}return g?!1:d},arg2arr:function(a){for(var e,b=[],f=0,d=a.length;f<d;f++)e=a.item(f),b.push(e);return b}}})(App.prototype,WSH);
// 0.1.0 расширяем глобальные функции среды
function setEnv(env, key, value) { env(key) = value; }
// 1.4.1 определяет дополнительные переменные среды
var env=new App({driveMinSize:27917287424,runStyle:1,defReturn:0,argWrap:'"',argDelim:" ",linDelim:"\r\n",keyDelim:"\\",chrDelim:"@",getDelim:"+",setDelim:"#",iniDelim:"=",csvDelim:";",tsvDelim:"\t",envType:"Process"});
(function(x,c,F){c.lib.extend(c,{fun:{wql2date:function(g,m){return new Date(g?Date.UTC(1*g.substring(0,4),1*g.substring(4,6)-1,1*g.substring(6,8),1*g.substring(8,10),1*g.substring(10,12)-1*g.substring(21,25)+(m||0),1*g.substring(12,14),1*g.substring(14,17)):0)},getDateOfWeek:function(g,m){var p=new Date;g=1*g||1;m=1*m||p.getFullYear();p=(new Date(m,0,4)).getDay();return new Date(m,0,-((6+p)%7)+7*g)},bin2key:function(g){var m="";try{var p=g.toArray()}catch(w){p=[]}if(p.length){g=Math.floor(p[66]/
6)&1;p[66]=p[66]&247|4*(g&2);for(var l=24;-1<l;l--){var d=0;for(var n=14;-1<n;n--)d*=256,d=p[n+52]+d,p[n+52]=Math.floor(d/24),d%=24;m="BCDFGHJKMPQRTVWXY2346789".substring(d,d+1)+m}1==g&&(p=m.substring(1,d+1),m=m.substring(1).replace(p,p+"N"));m=[m.substring(0,5),m.substring(5,10),m.substring(10,15),m.substring(15,20),m.substring(20,25)].join("-")}return m},bin2sid:function(g){var m="";try{var p=g.toArray()}catch(r){p=[]}if(p.length){var l=p[0]&255;g=p[1]&255;var d=0;for(var n=2;7>=n;n++)d+=(p[n]&
255)*(1<<8*(5-(n-2)));m=m+("S-"+l)+("-"+d);d=8;for(n=0;n<g;n++){for(var w=l=0;4>w;w++)l+=(p[d+w]&255)*(1<<8*w);m+="-"+l;d+=4}}return m},bin2str:function(g){var m="";try{var p=g.toArray()}catch(n){p=[]}for(var l=0,d=p.length;l<d;l++)(g=p[l])&&(m+=String.fromCharCode(g));return m},info2str:function(g,m,p){if(!p||2>p)p=1024;if(!m||0>m)m=0;var l=Math.pow(10,m);for(var d=-1;g>=p;d++)g/=p;g=Math.ceil(g*l)/l;g=c.lib.num2str(g,-1<d?m:0,".","");return g+=" "+"KMGTPEZYRQ".charAt(d)},clear:function(g){g=g?""+
g:"";"INVALID"==g&&(g="");"To be filled by O.E.M."==g&&(g="");"System Product Name"==g&&(g="");"System Serial Number"==g&&(g="");"System manufacturer"==g&&(g="");"Default string"==g&&(g="");"empty"==g&&(g="");"None"==g&&(g="");for(var m=1,p=arguments.length;m<p;m++)g=g.replace(arguments[m],"");return g.replace(/\(R\)/gi,"").replace(/\(Registered Trademark\)/gi,"").replace(/\(Microsoft Corporation\)/gi,"").replace(/\(Корпорация Майкрософт\)/gi,"").replace(/\(Майкрософт\)/gi,"").replace(/\(TM\)/gi,
"").replace(/^[/'"]|[/"']$/g,"").replace(/\r\n|\n|\t/g," ").replace(/^\s+|\s+$/g,"").replace(/\.+$/,"").replace(/\s(?=\s)/gi,"")},repair:function(g){return("'"+(g?g:"")+"'").replace(/\\/g,"\\\\")},debug:function(){var g,m,p={},l=-1;return function(d){if(p.first){g=[c.lib.strPad(l,3,"0","left")];g.push("|");g.push(c.lib.strPad(c.lib.num2str((p.now.valueOf()-p.first.valueOf())/1E3,3,".",""),7,"0","left"));p.last=p.now;p.now=new Date;g.push("+"+c.lib.strPad(c.lib.num2str((p.now.valueOf()-p.last.valueOf())/
1E3,3,".",""),7,"0","left"));g.push("|");g.push(m);try{x.stdErr.writeLine(g.join(" "))}catch(n){}}else p.now=new Date;!l&&m&&(p.first=p.now);m=d;l++;return d}}()},init:function(){var g,m="",p="",l={};var d={};var n={},w=0;var r=new Date;var A=new ActiveXObject("WScript.Shell");var e=new ActiveXObject("wbemScripting.Swbemlocator");e.security_.impersonationLevel=3;var h=x.arguments.length;for(g=0;g<h;g++){var a=x.arguments.item(g);var k="context";if(!(k in n)){var f=a.split(c.val.keyDelim);if(3==f.length&&
!f[0]&&!f[1]){n[k]=f[2];continue}}k="input";if(!(k in n)&&(f=a.split(c.val.chrDelim),2==f.length&&c.lib.hasValue(["ini","csv","tsv","CSV","TSV"],f[0],!0)&&f[1])){n[k]=f[0];n.charset=f[1];continue}k="output";if(!(k in n)&&(f=a.split(c.val.chrDelim),1==f.length&&c.lib.hasValue(["ini","csv","tsv","CSV","TSV"],f[0],!0))){n[k]=f[0];continue}k="silent";if(k in n||c.lib.compare(k,a,!0))if(k="nowait",k in n||c.lib.compare(k,a,!0))if(k="debug",k in n||c.lib.compare(k,a,!0))break;else n[k]=!0;else n[k]=!0;
else n[k]=!0}var B=g;"context"in n||(n.context=".");"auto"==n.charset&&(n.charset="windows-1251");c.fun.debug(n.debug);if(n.context)for(c.fun.debug("Connect and create objects"),g=1;g;g++)try{switch(g){case 1:var t=e.connectServer(n.context,"root\\CIMV2",null,null,null,null,128);break;case 2:var z=e.connectServer(n.context,"root\\WMI",null,null,null,null,128);break;case 3:var u=e.connectServer(".","root\\directory\\LDAP",null,null,null,null,128);break;case 4:var C=e.connectServer(n.context,"root\\Microsoft\\Windows\\Storage",
null,null,null,null,128);break;case 5:var v=e.connectServer(n.context,"root\\default",null,null,null,null,128).get("stdRegProv");break;default:g=-1}}catch(y){switch(g){case 1:t=null;g=-1;break;case 2:z=null;break;case 3:u=null;break;case 4:C=null;break;case 5:v=null}}if(t){if(v){e=v.methods_.item("getBinaryValue");var b=e.inParameters.spawnInstance_();b.hDefKey=2147483650;b.sSubKeyName="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";b.sValueName=c.fun.debug("DigitalProductId");b=v.execMethod_(e.name,
b);!b.returnValue&&(a=c.fun.bin2key(b.uValue),a=c.fun.clear(a,"BBBBB-BBBBB-BBBBB-BBBBB-BBBBB"))&&(d["SYS-KEY"]=a)}g=null;response=t.execQuery(c.fun.debug("SELECT * FROM Win32_OperatingSystem WHERE primary = TRUE"));for(e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();b.systemDrive&&(g=b);if(a=b.localDateTime)r=c.fun.wql2date(a);if(a=c.fun.clear(b.caption,"Майкрософт","Microsoft","Edition","x64",","))d["SYS-NAME"]=a;if(a=c.fun.clear(b.version))d["SYS-VERSION"]=a;if(a=b.localDateTime)d["SYS-TIME"]=
c.lib.date2str(c.fun.wql2date(a),"d.m.Y H:i:s");if(a=b.localDateTime)d["SYS-TIME-DATE"]=c.lib.date2str(c.fun.wql2date(a),"d.m.Y");if(a=c.fun.clear(b.systemDrive))d["SYS-DRIVE"]=a;if(a=b.installDate)d["SYS-INSTALL"]=c.lib.date2str(c.fun.wql2date(a),"d.m.Y H:i:s");if(a=b.installDate)d["SYS-INSTALL-DATE"]=c.lib.date2str(c.fun.wql2date(a),"d.m.Y");if(a=b.lastBootUpTime)d["SYS-RESET"]=c.lib.date2str(c.fun.wql2date(a),"d.m.Y H:i:s");if(a=b.lastBootUpTime)d["SYS-RESET-DATE"]=c.lib.date2str(c.fun.wql2date(a),
"d.m.Y");if(a=c.fun.clear(b.serialNumber))d["SYS-SERIAL"]=a;if(a=c.fun.clear(b.description))d["SYS-DESCRIPTION"]=a;d["SYS-ARCHITECTURE"]=b.osArchitecture&&!b.osArchitecture.indexOf("64")?"x64":"x86";break}response=t.execQuery(c.fun.debug("SELECT * FROM Win32_ComputerSystem"));for(e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();if(a=b.dnsHostName)m=a;if(a=b.name)m||(m=a.toLowerCase());b.domain!=b.workgroup&&(p=b.domain);if(a=b.userName)l.domain=a.split(c.val.keyDelim)[0];if(a=b.userName)l.login=
a.split(c.val.keyDelim)[1];if(a=b.userName)l.account=a;if(a=c.fun.clear(m))d["NET-HOST"]=a;if(a=c.fun.clear(b.domain))d["NET-DOMAIN"]=a;if(a=c.fun.clear(b.model))d["DEV-NAME"]=a;a&&(a=c.fun.clear(b.manufacturer,"Inc.","Hewlett-Packard"))&&(d["DEV-NAME"]=a.split(" ")[0]+" "+c.fun.clear(b.model));switch(!0){case 2==g.productType:a="Controller";break;case 3==g.productType:a="Server";break;case 2==b.pcSystemTypeEx:a="Notebook";break;case 8==b.pcSystemTypeEx:a="Tablet";break;default:a="Desktop"}a&&(d["DEV-TYPE"]=
a);break}response=t.execQuery(c.fun.debug("SELECT caption, size FROM Win32_LogicalDisk WHERE driveType = 2 OR driveType = 3 OR driveType = 4"));for(e=new Enumerator(response);!e.atEnd();)b=e.item(),e.moveNext(),b.caption&&g&&g.systemDrive&&-1!=b.caption.indexOf(g.systemDrive)||d["BAK-DRIVE"]||(a=c.fun.clear(b.caption))&&b.size>=c.val.driveMinSize&&(d["BAK-DRIVE"]=a);response=t.execQuery(c.fun.debug("SELECT manufacturer, product, serialNumber FROM Win32_BaseBoard WHERE hostingBoard = TRUE"));for(e=
new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();if(a=c.fun.clear(b.product))d["PCB-NAME"]=a;a&&(a=c.fun.clear(b.manufacturer,"Inc.").replace("Hewlett-Packard","HP"))&&(d["PCB-NAME"]=a.split(" ")[0]+" "+c.fun.clear(b.product));if(a=c.fun.clear(b.serialNumber))d["PCB-SERIAL"]=a;break}response=t.execQuery(c.fun.debug("SELECT releaseDate, manufacturer, smBIOSBIOSVersion, serialNumber FROM Win32_BIOS WHERE primaryBIOS = TRUE"));for(e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();
if(a=c.fun.clear(b.releaseDate))d["PCB-BIOS-RELEASE"]=c.lib.date2str(c.fun.wql2date(a,r.getTimezoneOffset()),"d.m.Y H:i:s");if(a=c.fun.clear(b.releaseDate))d["PCB-BIOS-RELEASE-DATE"]=c.lib.date2str(c.fun.wql2date(a,r.getTimezoneOffset()),"d.m.Y");if(a=c.fun.clear(b.manufacturer,"Inc."))d["PCB-BIOS-MANUFACTURE"]=a;if(a=c.fun.clear(b.smBIOSBIOSVersion))d["PCB-BIOS-VERSION"]=a;if(a=c.fun.clear(b.serialNumber))d["PCB-BIOS-SERIAL"]=a;break}g=null;response=t.execQuery(c.fun.debug("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE ipEnabled = TRUE AND fullDNSRegistrationEnabled = TRUE"));
for(e=new Enumerator(response);!e.atEnd();)if(b=e.item(),e.moveNext(),!b.serviceName||-1==b.serviceName.indexOf("vpn"))if(!b.serviceName||-1==b.serviceName.indexOf("loop"))if(!b.serviceName||-1==b.serviceName.indexOf("VBox")){b.interfaceIndex&&(g=b);if(null!=b.ipAddress){f=b.ipAddress.toArray();h=0;for(var q=f.length;h<q;h++)(a=c.fun.clear(f[h]))&&-1!=a.indexOf(".")&&!d["NET-IP-V4"]&&(d["NET-IP-V4"]=a),a&&-1==a.indexOf(".")&&!d["NET-IP-V6"]&&(d["NET-IP-V6"]=a)}if(null!=b.defaultIPGateway)for(f=b.defaultIPGateway.toArray(),
h=0,q=f.length;h<q;h++)(a=c.fun.clear(f[h]))&&-1!=a.indexOf(".")&&!d["NET-GATEWAY-V4"]&&(d["NET-GATEWAY-V4"]=a),a&&-1==a.indexOf(".")&&!d["NET-GATEWAY-V6"]&&(d["NET-GATEWAY-V6"]=a);if(null!=b.dnsServerSearchOrder)for(f=b.dnsServerSearchOrder.toArray(),h=0,q=f.length;h<q;h++)(a=c.fun.clear(f[h]))&&-1!=a.indexOf(".")&&!d["NET-DNS-V4"]&&(d["NET-DNS-V4"]=a),a&&-1==a.indexOf(".")&&!d["NET-DNS-V6"]&&(d["NET-DNS-V6"]=a);if(null!=b.ipSubnet)for(f=b.ipSubnet.toArray(),h=0,q=f.length;h<q;h++)(a=c.fun.clear(f[h]))&&
-1!=a.indexOf(".")&&!d["NET-SUBNET-V4"]&&(d["NET-SUBNET-V4"]=a),a&&-1==a.indexOf(".")&&!d["NET-SUBNET-V6"]&&(d["NET-SUBNET-V6"]=a);if(a=c.fun.clear(b.dhcpServer))d["NET-DHCP-V4"]=a;if(a=c.fun.clear(b.description,"Сетевой адаптер","Адаптер","для виртуальной сети","Сетевая карта","Контроллер","NIC (NDIS 6.20)","- Минипорт планировщика пакетов","Family Controller","Adapter","Virtual Miniport","for Windows","x64").replace(/#\d+$/g,""))d["NET-NAME"]=a;if(a=c.fun.clear(b.macAddress))d["NET-MAC"]=a;break}if(g&&
g.interfaceIndex)for(response=t.execQuery(c.fun.debug("SELECT speed, timeOfLastReset FROM Win32_NetworkAdapter WHERE netEnabled = TRUE AND interfaceIndex = "+c.fun.repair(g.interfaceIndex))),e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();if(a=b.speed)d["NET-SPEED"]=c.fun.info2str(a,0,1E3)+"bps";if(a=b.speed)d["NET-SPEED-VAL"]=a;if(a=b.timeOfLastReset)d["NET-RESET"]=c.lib.date2str(c.fun.wql2date(a),"d.m.Y H:i:s");if(a=b.timeOfLastReset)d["NET-RESET-DATE"]=c.lib.date2str(c.fun.wql2date(a),
"d.m.Y");break}!l.account&&v&&(f=[],e=v.methods_.item("getStringValue"),b=e.inParameters.spawnInstance_(),b.hDefKey=2147483650,b.sSubKeyName="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",b.sValueName=c.fun.debug("DefaultDomainName"),b=v.execMethod_(e.name,b),!b.returnValue&&b.sValue&&f.push(b.sValue),e=v.methods_.item("getStringValue"),b=e.inParameters.spawnInstance_(),b.hDefKey=2147483650,b.sSubKeyName="SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",b.sValueName=c.fun.debug("DefaultUserName"),
b=v.execMethod_(e.name,b),!b.returnValue&&b.sValue&&f.push(b.sValue),2==f.length&&(l.domain=f[0]),2==f.length&&(l.login=f[1]),2==f.length&&(l.account=f.join(c.val.keyDelim)));if(!l.account){f=null;response=t.execQuery(c.fun.debug("SELECT lastUseTime, localPath, loaded, sid FROM Win32_UserProfile WHERE special = FALSE"));for(e=new Enumerator(response);!e.atEnd();)b=e.item(),e.moveNext(),(a=f?0:1)||(a=b.loaded&&!f.loaded?1:a),a||(a=c.lib.compare(c.fun.wql2date(b.lastUseTime),c.fun.wql2date(f.lastUseTime))),
0<a&&(f=b);if(b=f)if(l.profile=b.localPath,a=b.sid)l.sid=a}if(!l.account&&l.sid){f=[];try{b=t.get('Win32_SID.SID="'+l.sid+'"')}catch(y){b=null}(a=b.referencedDomainName)&&f.push(a);(a=b.accountName)&&f.push(a);2==f.length&&(l.domain=f[0]);2==f.length&&(l.login=f[1]);2==f.length&&(l.account=f.join(c.val.keyDelim))}if(l.account&&c.lib.hasValue([".",m],l.domain,!1))for(response=t.execQuery(c.fun.debug("SELECT domain, name, fullName, sid FROM Win32_UserAccount WHERE name = "+c.fun.repair(l.login)+" AND domain = "+
c.fun.repair(l.domain))),e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();f=[];l.name=b.fullName;if(a=b.sid)l.sid=a;(a=b.domain)&&f.push(a);(a=b.name)&&f.push(a);2==f.length&&(l.domain=f[0]);2==f.length&&(l.login=f[1]);2==f.length&&(l.account=f.join(c.val.keyDelim));break}if(l.account&&u&&!c.lib.hasValue([".",m],l.domain,!1))for(f="DS_co DS_c DS_company DS_displayName DS_department DS_info DS_homeDirectory DS_l DS_mail DS_mobile DS_objectSid DS_telephoneNumber DS_title DS_distinguishedName".split(" "),
response=u.execQuery(c.fun.debug("SELECT "+f.join(", ")+" FROM DS_user WHERE DS_sAMAccountName = "+c.fun.repair(l.login))),e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();l.name=b.DS_displayName;l.home=b.DS_homeDirectory;if(f=b.DS_objectSid)if(a=c.fun.bin2sid(f.value))l.sid=a;if(a=c.fun.clear(b.DS_co))d["USR-COUNTRY"]=a;if(a=c.fun.clear(b.DS_c))d["USR-COUNTRY-ID"]=a;if(a=c.fun.clear(b.DS_company,'"'))d["USR-COMPANY"]=a;if(a=c.fun.clear(b.DS_department,'"'))d["USR-DEPARTMENT"]=a;if(a=
c.fun.clear(b.DS_distinguishedName))d["USR-ACCOUNT-DN"]=a;if(a=c.fun.clear(b.DS_l))d["USR-CITY"]=a;if(a=c.fun.clear(b.DS_mail))d["USR-EMAIL"]=a;if(a=c.fun.clear(b.DS_mobile))d["USR-MOBILE"]=a;if(a=c.fun.clear(b.DS_telephoneNumber))d["USR-PHONE"]=a;if(a=c.fun.clear(b.DS_title,'"'))d["USR-POSITION"]=a;if(a=c.fun.clear(b.DS_info,'"'))d["USR-INFO"]=a;break}if(l.account&&!("home"in l))for(response=t.execQuery(c.fun.debug("SELECT homeDirectory FROM Win32_NetworkLoginProfile WHERE name = "+c.fun.repair(l.account))),
e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();l.home=b.homeDirectory;break}if(l.sid&&!("profile"in l))for(response=t.execQuery(c.fun.debug("SELECT localPath FROM Win32_UserProfile WHERE sid = "+c.fun.repair(l.sid))),e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();l.profile=b.localPath;break}if(a=c.fun.clear(l.sid))d["USR-SID"]=a;if(a=c.fun.clear(l.account))d["USR-ACCOUNT"]=a;if(a=c.fun.clear(l.login))d["USR-LOGIN"]=a;if(a=c.fun.clear(l.domain))d["USR-DOMAIN"]=a;if(a=
c.fun.clear(l.profile))d["USR-PROFILE"]=a;if(a=c.fun.clear(l.home))d["USR-HOME"]=a;if(a=c.fun.clear(l.name))d["USR-NAME"]=a;if(a=c.fun.clear(l.name)){f=a.split(c.val.argDelim);for(h=f.length-1;-1<h;h--)a=c.fun.clear(f[h],/[\[\(,\.\)\]]/g),(k=(k=3>a.length)||c.lib.hasValue(["von"],a,!0))?f.splice(h,1):f[h]=a;if(a=f[0])d["USR-NAME-FIRST"]=a;if(a=f[1])d["USR-NAME-SECOND"]=a;if(a=f[2])d["USR-NAME-THIRD"]=a;if(a=f[3])d["USR-NAME-FOURTH"]=a}if(m&&u&&p)for(response=u.execQuery(c.fun.debug("SELECT DS_distinguishedName FROM DS_computer WHERE DS_cn = "+
c.fun.repair(m))),e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();if(a=c.fun.clear(b.DS_distinguishedName))d["NET-HOST-DN"]=a;break}u=0;response=t.execQuery(c.fun.debug("SELECT architecture, maxClockSpeed, name, revision, numberOfCores, socketDesignation FROM Win32_Processor WHERE role = 'CPU'"));for(e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();0==b.architecture?d["CPU-ARCHITECTURE"]="x86":9==b.architecture&&(d["CPU-ARCHITECTURE"]="x64");if(a=b.maxClockSpeed)d["CPU-SPEED"]=
c.fun.info2str(1E6*a,2,1E3)+"Hz";if(a=b.maxClockSpeed)d["CPU-SPEED-VAL"]=1E6*a;if(a=c.fun.clear(b.name,"CPU","APU","Процессор","Processor","with","Radeon HD Graphics","11th Gen"))d["CPU-NAME"]=a;if(a=c.fun.clear(b.revision))d["CPU-VERSION"]=a;if(a=c.fun.clear(b.numberOfCores))d["CPU-CORE"]=a;if(a=c.fun.clear(b.socketDesignation,"SOCKET 0"))d["CPU-SOCKET"]=a;if(a=b.maxClockSpeed)u+=2.26143*Math.sqrt(a/1E3);if(a=b.numberOfCores)u*=1.02033*Math.sqrt(a);break}u&&(w=w?Math.min(w,u):u);response=t.execQuery(c.fun.debug("SELECT level, maxCacheSize FROM Win32_CacheMemory"));
for(e=new Enumerator(response);!e.atEnd();)if(b=e.item(),e.moveNext(),a=b.maxCacheSize)d["CPU-CACHE-L"+(b.level-2)]=c.fun.info2str(1024*a,0)+"B";k=u=0;response=t.execQuery(c.fun.debug("SELECT capacity, speed FROM Win32_PhysicalMemory"));for(e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();if(a=b.capacity)d["RAM-SIZE-VAL"]=k+=1*a;if(a=b.capacity)d["RAM-SIZE"]=c.fun.info2str(k,0)+"B";if(a=b.speed)d["RAM-SPEED"]=a+" MHz";if(a=b.speed)d["RAM-SPEED-VAL"]=1E6*a;if(a=k)u=2.51143*Math.sqrt(a/
1024/1024/1024);if(a=b.speed)u*=.92245*Math.sqrt(a/1E3)}u&&(w=w?Math.min(w,u):u);g=f=null;response=t.execQuery(c.fun.debug("SELECT adapterRam, name, driverVersion, currentHorizontalResolution, currentRefreshRate, currentBitsPerPixel, currentVerticalResolution FROM Win32_VideoController"));for(e=new Enumerator(response);!e.atEnd();)b=e.item(),e.moveNext(),b.currentHorizontalResolution&&b.currentVerticalResolution&&(k="Microsoft Remote Display",(a=g?0:1)||(a=b.name&&-1!=b.name.indexOf(k)?1:a),a||(a=
g.name&&-1!=g.name.indexOf(k)?-1:a),a||(a=c.lib.compare(b.currentHorizontalResolution,g.currentHorizontalResolution)),a||(a=c.lib.compare(b.currentVerticalResolution,g.currentVerticalResolution)),0<a&&(g=b)),(a=f?0:1)||(a=c.lib.compare(Math.abs(b.adapterRam),Math.abs(f.adapterRam))),a||(a=c.lib.compare(b.currentHorizontalResolution,f.currentHorizontalResolution)),a||(a=c.lib.compare(b.currentVerticalResolution,f.currentVerticalResolution)),0<a&&(f=b);if(b=f){if(a=b.adapterRam)d["GPU-SIZE"]=c.fun.info2str(Math.abs(a),
0)+"B";if(a=b.adapterRam)d["GPU-SIZE-VAL"]=Math.abs(a);if(a=c.fun.clear(b.name,"GPU","Видеоустройство","Family","Chipset","Series","Graphics","Adapter"))d["GPU-NAME"]=a;if(a=c.fun.clear(b.driverVersion))d["GPU-VERSION"]=a;if(a=g&&g.currentHorizontalResolution)d["GPU-RESOLUTION-X"]=a;if(a=g&&g.currentVerticalResolution)d["GPU-RESOLUTION-Y"]=a;if(a=g&&g.currentRefreshRate)d["GPU-FREQUENCY"]=c.fun.info2str(a,0,1E3)+"Hz";if(a=g&&g.currentRefreshRate)d["GPU-FREQUENCY-VAL"]=a;if(a=g&&g.currentBitsPerPixel)d["GPU-COLOR"]=
c.fun.info2str(a,0)+"bit";if(a=g&&g.currentBitsPerPixel)d["GPU-COLOR-VAL"]=a;g&&g.currentHorizontalResolution&&g.currentVerticalResolution&&(d["GPU-RESOLUTION"]=g.currentHorizontalResolution+" x "+g.currentVerticalResolution)}if(z){g=null;response=z.execQuery(c.fun.debug("SELECT instanceName, serialNumberId, userFriendlyName, userFriendlyNameLength, weekOfManufacture, yearOfManufacture FROM WmiMonitorID WHERE active = TRUE"));for(e=new Enumerator(response);!e.atEnd();)if(b=e.item(),e.moveNext(),b.userFriendlyNameLength){b.instanceName&&
(g=b);if(a=c.fun.bin2str(b.userFriendlyName))if(a=c.fun.clear(a," 4K"," HDR"))d["MON-NAME"]=a;(a=c.fun.bin2str(b.serialNumberId))&&(a=c.fun.clear(a))&&"0"!=a&&(d["MON-SERIAL"]=a);b.yearOfManufacture&&b.weekOfManufacture&&(d["MON-RELEASE"]=c.lib.date2str(c.fun.getDateOfWeek(b.weekOfManufacture,b.yearOfManufacture),"d.m.Y H:i:s"));b.yearOfManufacture&&b.weekOfManufacture&&(d["MON-RELEASE-DATE"]=c.lib.date2str(c.fun.getDateOfWeek(b.weekOfManufacture,b.yearOfManufacture),"d.m.Y"));break}if(g&&g.instanceName)for(response=
z.execQuery(c.fun.debug("SELECT maxHorizontalImageSize, maxVerticalImageSize FROM WmiMonitorBasicDisplayParams WHERE instanceName = "+c.fun.repair(g.instanceName))),e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();if(a=b.maxHorizontalImageSize)d["MON-SIZE-X"]=a;if(a=b.maxVerticalImageSize)d["MON-SIZE-Y"]=a;b.maxHorizontalImageSize&&b.maxVerticalImageSize&&(a=Math.sqrt(Math.pow(b.maxHorizontalImageSize,2)+Math.pow(b.maxVerticalImageSize,2)),a=Math.round(a/2.54),d["MON-SIZE"]=b.maxHorizontalImageSize+
" x "+b.maxVerticalImageSize+" cm / "+a+" in",d["MON-SIZE-Z"]=a);break}}u=0;response=C?C.execQuery(c.fun.debug("SELECT model, firmwareVersion, mediaType, serialNumber, size FROM MSFT_PhysicalDisk")):t.execQuery(c.fun.debug("SELECT * FROM Win32_DiskDrive"));for(e=new Enumerator(response);!e.atEnd();){b=e.item();e.moveNext();switch(b.mediaType){case 0:k="USB";break;case 3:k="HDD";break;case 4:k="SSD";break;case 5:k="SCM";break;case "Removable Media":k="USB";break;case "Fixed\thard disk media":case "Fixed hard disk media":k=
b.model&&-1!=b.model.indexOf("Solid")?"SSD":b.model&&-1!=b.model.indexOf("SSD")?"SSD":b.model&&!b.model.indexOf("ADATA")?"SSD":"HDD";break;default:k=""}if((!b.model||-1==b.model.indexOf("Raid"))&&k&&!d[k+"-NAME"]){if(a=c.fun.clear(b.model,"ATA Device","SCSI Disk Device","USB Device","SSD","SATA"))d[k+"-NAME"]=a;if(a=c.fun.clear(b.firmwareVersion||b.firmwareRevision))d[k+"-VERSION"]=a;if(a=c.fun.clear(b.serialNumber))d[k+"-SERIAL"]=a;if(a=b.size)d[k+"-SIZE"]=c.fun.info2str(a,0)+"B";if(a=b.size)d[k+
"-SIZE-VAL"]=a;k&&(u=Math.max(u,"SDD"==k?15.51143:7.14577))}}u&&(w=w?Math.min(w,u):u);response=t.execQuery(c.fun.debug("SELECT mediaType, caption, drive FROM Win32_CDROMDrive"));for(e=new Enumerator(response);!e.atEnd();)if(b=e.item(),e.moveNext(),!b.caption||-1==b.caption.indexOf("Alcohol"))if(!b.caption||-1==b.caption.indexOf("Virtual"))if(!b.caption||-1==b.caption.indexOf("Виртуальный"))if(!b.mediaType||"UNKNOWN"!=b.mediaType){switch(b.mediaType){case "CD-ROM":a="CD";break;case "DVD-ROM":a="DVD";
break;case "CD Writer":a="CD-RW";break;case "DVD Writer":a="DVD-RW";break;default:a=""}a&&(d["ROM-TYPE"]=a);if(a=c.fun.clear(b.caption,"ATA Device","SCSI CdRom Device"))d["ROM-NAME"]=a;if(a=c.fun.clear(b.drive))d["ROM-DRIVE"]=a;break}g=null;k="DisplayIcon";f=["SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\F3 TAIL","SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\F3 TAIL","SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\еФарма","SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\еФарма"];
a="";if(v)for(e=v.methods_.item("getStringValue"),h=0,q=f.length;h<q&&!a;h++)b=e.inParameters.spawnInstance_(),b.hDefKey=2147483650,b.sSubKeyName=c.fun.debug(f[h]),b.sValueName=k,b=v.execMethod_(e.name,b),!b.returnValue&&b.sValue&&(a=c.fun.clear(b.sValue));a&&(f=a.split(c.val.keyDelim),f.pop(),f.pop(),g=f.join(c.val.keyDelim),d["APP-EFARMA-DIR"]=g);k="\\Client\\ePlus.Client.exe";f=g?[g]:[];a="";h=0;for(q=f.length;h<q;h++)h&&(a+=" OR "),a+="name = "+c.fun.repair(f[h]+k);if(a)for(response=t.execQuery(c.fun.debug("SELECT name FROM CIM_DataFile WHERE "+
a)),e=new Enumerator(response);!e.atEnd();)for(b=e.item(),e.moveNext(),h=0,q=f.length;h<q;h++)if(a=f[h]+k,b.name&&b.name.toLowerCase()==a.toLowerCase()){d["APP-EFARMA-CLIENT"]=a;break}k="\\ARM\\ePlus.ARMCasherNew.exe";f=g?[g]:[];a="";h=0;for(q=f.length;h<q;h++)h&&(a+=" OR "),a+="name = "+c.fun.repair(f[h]+k);if(a)for(response=t.execQuery(c.fun.debug("SELECT name FROM CIM_DataFile WHERE "+a)),e=new Enumerator(response);!e.atEnd();)for(b=e.item(),e.moveNext(),h=0,q=f.length;h<q;h++)if(a=f[h]+k,b.name&&
b.name.toLowerCase()==a.toLowerCase()){d["APP-EFARMA-CASHER"]=a;break}k="\\UpdateServer\\ePlus.UpdateServer.exe";f=g?[g]:[];a="";h=0;for(q=f.length;h<q;h++)h&&(a+=" OR "),a+="name = "+c.fun.repair(f[h]+k);if(a)for(response=t.execQuery(c.fun.debug("SELECT name FROM CIM_DataFile WHERE "+a)),e=new Enumerator(response);!e.atEnd();)for(b=e.item(),e.moveNext(),h=0,q=f.length;h<q;h++)if(a=f[h]+k,b.name&&b.name.toLowerCase()==a.toLowerCase()){d["APP-EFARMA-UPDATER"]=a;break}k="lic";f=g?[g+"\\UpdateServer\\",
g+"\\Client\\",g+"\\ARM\\"]:[];a="";h=0;for(q=f.length;h<q;h++)h&&(a+=" OR "),a+="drive = "+c.fun.repair(c.lib.strim(f[h],"",":",!0,!1))+" ",a+="AND path = "+c.fun.repair(c.lib.strim(f[h],":","",!1,!1))+" ",a+="AND extension = "+c.fun.repair(k);if(a)for(response=t.execQuery(c.fun.debug("SELECT name, fileName FROM CIM_DataFile WHERE "+a)),e=new Enumerator(response);!e.atEnd();)for(b=e.item(),e.moveNext(),h=0,q=f.length;h<q;h++)if(a=f[h]+b.fileName+"."+k,b.name&&b.name.toLowerCase()==a.toLowerCase()){d["APP-EFARMA-LICENSE"]=
a;break}a=c.lib.date2str(r,"Y");k="\\ULUS.exe";f=["C:\\SoftLink\\Ulus\\"+a,"C:\\LO\\ULUS\\"+a,"C:\\so\\Ulus\\"+a,"C:\\ULUS\\"+a];a="";h=0;for(q=f.length;h<q;h++)h&&(a+=" OR "),a+="name = "+c.fun.repair(f[h]+k);if(a)for(response=t.execQuery(c.fun.debug("SELECT name FROM CIM_DataFile WHERE "+a)),e=new Enumerator(response);!e.atEnd();)for(b=e.item(),e.moveNext(),h=0,q=f.length;h<q;h++)if(a=f[h]+k,b.name&&b.name.toLowerCase()==a.toLowerCase()){d["APP-ULUS"]=a;d["APP-ULUS-DIR"]=f[h];break}k="";f=["SOFTWARE\\Clients\\StartMenuInternet\\Google Chrome\\shell\\open\\command",
"SOFTWARE\\WOW6432Node\\Clients\\StartMenuInternet\\Google Chrome\\shell\\open\\command"];a="";if(v)for(e=v.methods_.item("getStringValue"),h=0,q=f.length;h<q&&!a;h++)b=e.inParameters.spawnInstance_(),b.hDefKey=2147483650,b.sSubKeyName=c.fun.debug(f[h]),b.sValueName=k,b=v.execMethod_(e.name,b),!b.returnValue&&b.sValue&&(a=c.fun.clear(b.sValue));a&&(f=a.split(c.val.keyDelim),f.pop(),d["APP-CHROME"]=a,d["APP-CHROME-DIR"]=f.join(c.val.keyDelim));k="";f=["SOFTWARE\\VideoLAN\\VLC","SOFTWARE\\WOW6432Node\\VideoLAN\\VLC"];
a="";if(v)for(e=v.methods_.item("getStringValue"),h=0,q=f.length;h<q&&!a;h++)b=e.inParameters.spawnInstance_(),b.hDefKey=2147483650,b.sSubKeyName=c.fun.debug(f[h]),b.sValueName=k,b=v.execMethod_(e.name,b),!b.returnValue&&b.sValue&&(a=c.fun.clear(b.sValue));a&&(f=a.split(c.val.keyDelim),f.pop(),d["APP-VLC"]=a,d["APP-VLC-DIR"]=f.join(c.val.keyDelim));k="ClientID";f=["SOFTWARE\\TeamViewer","SOFTWARE\\WOW6432Node\\TeamViewer"];a="";if(v)for(e=v.methods_.item("getDWORDValue"),h=0,q=f.length;h<q&&!a;h++)b=
e.inParameters.spawnInstance_(),b.hDefKey=2147483650,b.sSubKeyName=c.fun.debug(f[h]),b.sValueName=k,b=v.execMethod_(e.name,b),!b.returnValue&&b.uValue&&(a=c.fun.clear(b.uValue));a&&(d["APP-TEAMVIEWER-ID"]=a);f=[];d["CPU-NAME"]&&d["CPU-CORE"]&&d["CPU-SPEED"]&&f.push(c.fun.clear(d["CPU-NAME"].replace("Dual-Core","Intel"),"Dual Core","Xeon","Pentium","Celeron","Core2 Duo","Core","Processor","Athlon 64","Athlon",/,.+/,/@.+/,/\d\.d+GHz/)+" "+d["CPU-CORE"]+"x"+d["CPU-SPEED"].replace(" ",""));d["RAM-SIZE"]&&
d["RAM-SPEED"]&&f.push(d["RAM-SIZE"].replace(" ","")+" "+d["RAM-SPEED"].replace(" ",""));d["GPU-SIZE"]&&d["GPU-NAME"]&&(-1!=d["GPU-NAME"].indexOf("GeForce")||-1!=d["GPU-NAME"].indexOf("Radeon"))&&f.push(d["GPU-SIZE"].replace(" ","")+" "+c.fun.clear(d["GPU-NAME"],"AMD","NVIDIA","GeForce","Radeon",/\(.+/));d["HDD-SIZE"]&&f.push(d["HDD-SIZE"].replace(" ","")+" HDD");d["SSD-SIZE"]&&f.push(d["SSD-SIZE"].replace(" ","")+" SSD");d["USB-SIZE"]&&f.push(d["USB-SIZE"].replace(" ","")+" USB");d["ROM-TYPE"]&&
f.push(d["ROM-TYPE"]);f.length&&(d["DEV-DESCRIPTION"]=f.join("/"));w&&(d["DEV-BENCHMARK"]=c.lib.num2str(w,5,".",""))}var D="NET-HOST NET-DOMAIN SYS-NAME SYS-VERSION SYS-ARCHITECTURE SYS-KEY SYS-TIME SYS-DRIVE SYS-INSTALL SYS-RESET PCB-NAME PCB-SERIAL PCB-BIOS-SERIAL PCB-BIOS-RELEASE CPU-NAME CPU-SOCKET CPU-CORE CPU-SPEED CPU-SPEED-VAL RAM-SPEED RAM-SIZE RAM-SIZE-VAL GPU-NAME GPU-RESOLUTION GPU-SIZE GPU-SIZE-VAL MON-NAME MON-SERIAL MON-SIZE MON-SIZE-Z MON-RELEASE NET-NAME NET-MAC NET-IP-V4 NET-SUBNET-V4 NET-GATEWAY-V4 NET-DNS-V4 NET-DHCP-V4 NET-IP-V6 NET-SUBNET-V6 NET-GATEWAY-V6 NET-SPEED NET-SPEED-VAL NET-RESET SSD-NAME SSD-SERIAL SSD-SIZE SSD-SIZE-VAL HDD-NAME HDD-SERIAL HDD-SIZE HDD-SIZE-VAL USB-NAME USB-SERIAL USB-SIZE USB-SIZE-VAL ROM-NAME ROM-TYPE ROM-DRIVE USR-ACCOUNT USR-DOMAIN USR-LOGIN USR-NAME USR-SID USR-COUNTRY USR-CITY USR-COMPANY USR-DEPARTMENT USR-POSITION USR-EMAIL USR-PHONE USR-MOBILE USR-PROFILE DEV-TYPE DEV-NAME DEV-DESCRIPTION DEV-BENCHMARK".split(" ");
if(n.input){c.fun.debug("Read input data");try{k="windows-1251",a=x.stdIn.readAll(),n.charset!=k&&(a=c.wsh.iconv(n.charset,k,a))}catch(y){a=""}}e=null;if(n.input&&a)switch(r="",c.fun.debug("Convert input data"),n.input){case "TSV":r||(r=c.val.tsvDelim);case "CSV":r||(r=c.val.csvDelim),e||(e=c.lib.tsv2arr(a,!1,r)),e.length&&(D=e.shift());case "tsv":r||(r=c.val.tsvDelim);case "csv":for(r||(r=c.val.csvDelim),e||(e=c.lib.tsv2arr(a,!1,r)),h=0,q=e.length;h<q;h++)b=e[h],b=c.lib.arr2obj(b,null,function(y,
E){if(y)return D[E]}),e[h]=b;case "ini":e||(e=[c.lib.ini2obj(a,!1)]);f={};h=0;for(q=e.length;h<q;h++){b=e[h];for(k in b)(a=b[k])&&(f[k]=a);for(k in d)a=d[k],b[k]=a;e[h]=b}for(k in f)a=f[k],!k||!a||k in d||(d[k]=a)}if(n.output)switch(r="",e=e||[d],t=null,c.fun.debug("Convert output data"),n.output){case "ini":r=c.val.argDelim+c.val.iniDelim+c.val.argDelim;b=c.lib.sort(d,"asc");a=c.lib.obj2str(b,!1,c.val.linDelim,r);break;case "TSV":r||(r=c.val.tsvDelim);case "CSV":r||(r=c.val.csvDelim),t=!1;case "tsv":r||
(r=c.val.tsvDelim);case "csv":r||(r=c.val.csvDelim),a=c.lib.arr2tsv(e,D,r,t)}if(n.output&&a){a+=c.val.linDelim;c.fun.debug("Write output data");try{x.stdOut.write(a)}catch(y){}}c.fun.debug("Set environment variables");e=A.environment(c.val.envType);for(k in d)a=d[k],setEnv(e,k,a);e=[];h=x.arguments.length;for(g=B;g<h;g++)a=x.arguments.item(g),a=a.split(c.val.getDelim).join(c.val.setDelim),(a=A.expandEnvironmentStrings(a))&&-1==a.indexOf(c.val.argDelim)||(a=c.val.argWrap+a+c.val.argWrap),e.push(a);
if(d=e.join(c.val.argDelim)){B=n.silent?0:c.val.runStyle;c.fun.debug("Calling an external command");try{a=A.run(d,B,!n.nowait),n.nowait&&(a=c.val.defReturn)}catch(y){a=c.val.defReturn}}else a=c.val.defReturn;c.fun.debug("Exit with code "+a);c.fun.debug(n.debug);x.quit(a)}})})(WSH,env);env.init();