>>2]>>>24-8*(r%4)&255)<<16|(l[r+1>>>2]>>>24-8*((r+1)%4)&255)<<8|l[r+2>>>2]>>>24-8*((r+2)%4)&255,v=0;4>v&&r+0.75*v>>6*(3-v)&63));if(l=t.charAt(64))for(;d.length%4;)d.push(l);return d.join("")},parse:function(d){var l=d.length,s=this._map,t=s.charAt(64);t&&(t=d.indexOf(t),-1!=t&&(l=t));for(var t=[],r=0,w=0;w<
l;w++)if(w%4){var v=s.indexOf(d.charAt(w-1))<<2*(w%4),b=s.indexOf(d.charAt(w))>>>6-2*(w%4);t[r>>>2]|=(v|b)<<24-8*(r%4);r++}return p.create(t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();
(function(u){function p(b,n,a,c,e,j,k){b=b+(n&a|~n&c)+e+k;return(b<>>32-j)+n}function d(b,n,a,c,e,j,k){b=b+(n&c|a&~c)+e+k;return(b<>>32-j)+n}function l(b,n,a,c,e,j,k){b=b+(n^a^c)+e+k;return(b<>>32-j)+n}function s(b,n,a,c,e,j,k){b=b+(a^(n|~c))+e+k;return(b<>>32-j)+n}for(var t=CryptoJS,r=t.lib,w=r.WordArray,v=r.Hasher,r=t.algo,b=[],x=0;64>x;x++)b[x]=4294967296*u.abs(u.sin(x+1))|0;r=r.MD5=v.extend({_doReset:function(){this._hash=new w.init([1732584193,4023233417,2562383102,271733878])},
_doProcessBlock:function(q,n){for(var a=0;16>a;a++){var c=n+a,e=q[c];q[c]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360}var a=this._hash.words,c=q[n+0],e=q[n+1],j=q[n+2],k=q[n+3],z=q[n+4],r=q[n+5],t=q[n+6],w=q[n+7],v=q[n+8],A=q[n+9],B=q[n+10],C=q[n+11],u=q[n+12],D=q[n+13],E=q[n+14],x=q[n+15],f=a[0],m=a[1],g=a[2],h=a[3],f=p(f,m,g,h,c,7,b[0]),h=p(h,f,m,g,e,12,b[1]),g=p(g,h,f,m,j,17,b[2]),m=p(m,g,h,f,k,22,b[3]),f=p(f,m,g,h,z,7,b[4]),h=p(h,f,m,g,r,12,b[5]),g=p(g,h,f,m,t,17,b[6]),m=p(m,g,h,f,w,22,b[7]),
f=p(f,m,g,h,v,7,b[8]),h=p(h,f,m,g,A,12,b[9]),g=p(g,h,f,m,B,17,b[10]),m=p(m,g,h,f,C,22,b[11]),f=p(f,m,g,h,u,7,b[12]),h=p(h,f,m,g,D,12,b[13]),g=p(g,h,f,m,E,17,b[14]),m=p(m,g,h,f,x,22,b[15]),f=d(f,m,g,h,e,5,b[16]),h=d(h,f,m,g,t,9,b[17]),g=d(g,h,f,m,C,14,b[18]),m=d(m,g,h,f,c,20,b[19]),f=d(f,m,g,h,r,5,b[20]),h=d(h,f,m,g,B,9,b[21]),g=d(g,h,f,m,x,14,b[22]),m=d(m,g,h,f,z,20,b[23]),f=d(f,m,g,h,A,5,b[24]),h=d(h,f,m,g,E,9,b[25]),g=d(g,h,f,m,k,14,b[26]),m=d(m,g,h,f,v,20,b[27]),f=d(f,m,g,h,D,5,b[28]),h=d(h,f,
m,g,j,9,b[29]),g=d(g,h,f,m,w,14,b[30]),m=d(m,g,h,f,u,20,b[31]),f=l(f,m,g,h,r,4,b[32]),h=l(h,f,m,g,v,11,b[33]),g=l(g,h,f,m,C,16,b[34]),m=l(m,g,h,f,E,23,b[35]),f=l(f,m,g,h,e,4,b[36]),h=l(h,f,m,g,z,11,b[37]),g=l(g,h,f,m,w,16,b[38]),m=l(m,g,h,f,B,23,b[39]),f=l(f,m,g,h,D,4,b[40]),h=l(h,f,m,g,c,11,b[41]),g=l(g,h,f,m,k,16,b[42]),m=l(m,g,h,f,t,23,b[43]),f=l(f,m,g,h,A,4,b[44]),h=l(h,f,m,g,u,11,b[45]),g=l(g,h,f,m,x,16,b[46]),m=l(m,g,h,f,j,23,b[47]),f=s(f,m,g,h,c,6,b[48]),h=s(h,f,m,g,w,10,b[49]),g=s(g,h,f,m,
E,15,b[50]),m=s(m,g,h,f,r,21,b[51]),f=s(f,m,g,h,u,6,b[52]),h=s(h,f,m,g,k,10,b[53]),g=s(g,h,f,m,B,15,b[54]),m=s(m,g,h,f,e,21,b[55]),f=s(f,m,g,h,v,6,b[56]),h=s(h,f,m,g,x,10,b[57]),g=s(g,h,f,m,t,15,b[58]),m=s(m,g,h,f,D,21,b[59]),f=s(f,m,g,h,z,6,b[60]),h=s(h,f,m,g,C,10,b[61]),g=s(g,h,f,m,j,15,b[62]),m=s(m,g,h,f,A,21,b[63]);a[0]=a[0]+f|0;a[1]=a[1]+m|0;a[2]=a[2]+g|0;a[3]=a[3]+h|0},_doFinalize:function(){var b=this._data,n=b.words,a=8*this._nDataBytes,c=8*b.sigBytes;n[c>>>5]|=128<<24-c%32;var e=u.floor(a/
4294967296);n[(c+64>>>9<<4)+15]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360;n[(c+64>>>9<<4)+14]=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360;b.sigBytes=4*(n.length+1);this._process();b=this._hash;n=b.words;for(a=0;4>a;a++)c=n[a],n[a]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return b},clone:function(){var b=v.clone.call(this);b._hash=this._hash.clone();return b}});t.MD5=v._createHelper(r);t.HmacMD5=v._createHmacHelper(r)})(Math);
(function(){var u=CryptoJS,p=u.lib,d=p.Base,l=p.WordArray,p=u.algo,s=p.EvpKDF=d.extend({cfg:d.extend({keySize:4,hasher:p.MD5,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,r){for(var p=this.cfg,s=p.hasher.create(),b=l.create(),u=b.words,q=p.keySize,p=p.iterations;u.length>>2]&255}};d.BlockCipher=v.extend({cfg:v.cfg.extend({mode:b,padding:q}),reset:function(){v.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;this._mode=c.call(a,
this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var n=d.CipherParams=l.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),b=(p.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt;return(a?s.create([1398893684,
1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=s.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return n.create({ciphertext:a,salt:c})}},a=d.SerializableCipher=l.extend({cfg:l.extend({format:b}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var l=a.createEncryptor(c,d);b=l.finalize(b);l=l.cfg;return n.create({ciphertext:b,key:c,iv:l.iv,algorithm:a,mode:l.mode,padding:l.padding,blockSize:a.blockSize,formatter:d.format})},
decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),p=(p.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=s.random(8));a=w.create({keySize:b+c}).compute(a,d);c=s.create(a.words.slice(b),4*c);a.sigBytes=4*b;return n.create({key:a,iv:c,salt:d})}},c=d.PasswordBasedCipher=a.extend({cfg:a.cfg.extend({kdf:p}),encrypt:function(b,c,d,l){l=this.cfg.extend(l);d=l.kdf.execute(d,
b.keySize,b.ivSize);l.iv=d.iv;b=a.encrypt.call(this,b,c,d.key,l);b.mixIn(d);return b},decrypt:function(b,c,d,l){l=this.cfg.extend(l);c=this._parse(c,l.format);d=l.kdf.execute(d,b.keySize,b.ivSize,c.salt);l.iv=d.iv;return a.decrypt.call(this,b,c,d.key,l)}})}();
(function(){for(var u=CryptoJS,p=u.lib.BlockCipher,d=u.algo,l=[],s=[],t=[],r=[],w=[],v=[],b=[],x=[],q=[],n=[],a=[],c=0;256>c;c++)a[c]=128>c?c<<1:c<<1^283;for(var e=0,j=0,c=0;256>c;c++){var k=j^j<<1^j<<2^j<<3^j<<4,k=k>>>8^k&255^99;l[e]=k;s[k]=e;var z=a[e],F=a[z],G=a[F],y=257*a[k]^16843008*k;t[e]=y<<24|y>>>8;r[e]=y<<16|y>>>16;w[e]=y<<8|y>>>24;v[e]=y;y=16843009*G^65537*F^257*z^16843008*e;b[k]=y<<24|y>>>8;x[k]=y<<16|y>>>16;q[k]=y<<8|y>>>24;n[k]=y;e?(e=z^a[a[a[G^z]]],j^=a[a[j]]):e=j=1}var H=[0,1,2,4,8,
16,32,64,128,27,54],d=d.AES=p.extend({_doReset:function(){for(var a=this._key,c=a.words,d=a.sigBytes/4,a=4*((this._nRounds=d+6)+1),e=this._keySchedule=[],j=0;j>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255]):(k=k<<8|k>>>24,k=l[k>>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255],k^=H[j/d|0]<<24);e[j]=e[j-d]^k}c=this._invKeySchedule=[];for(d=0;dd||4>=j?k:b[l[k>>>24]]^x[l[k>>>16&255]]^q[l[k>>>
8&255]]^n[l[k&255]]},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._keySchedule,t,r,w,v,l)},decryptBlock:function(a,c){var d=a[c+1];a[c+1]=a[c+3];a[c+3]=d;this._doCryptBlock(a,c,this._invKeySchedule,b,x,q,n,s);d=a[c+1];a[c+1]=a[c+3];a[c+3]=d},_doCryptBlock:function(a,b,c,d,e,j,l,f){for(var m=this._nRounds,g=a[b]^c[0],h=a[b+1]^c[1],k=a[b+2]^c[2],n=a[b+3]^c[3],p=4,r=1;r>>24]^e[h>>>16&255]^j[k>>>8&255]^l[n&255]^c[p++],s=d[h>>>24]^e[k>>>16&255]^j[n>>>8&255]^l[g&255]^c[p++],t=
d[k>>>24]^e[n>>>16&255]^j[g>>>8&255]^l[h&255]^c[p++],n=d[n>>>24]^e[g>>>16&255]^j[h>>>8&255]^l[k&255]^c[p++],g=q,h=s,k=t;q=(f[g>>>24]<<24|f[h>>>16&255]<<16|f[k>>>8&255]<<8|f[n&255])^c[p++];s=(f[h>>>24]<<24|f[k>>>16&255]<<16|f[n>>>8&255]<<8|f[g&255])^c[p++];t=(f[k>>>24]<<24|f[n>>>16&255]<<16|f[g>>>8&255]<<8|f[h&255])^c[p++];n=(f[n>>>24]<<24|f[g>>>16&255]<<16|f[h>>>8&255]<<8|f[k&255])^c[p++];a[b]=q;a[b+1]=s;a[b+2]=t;a[b+3]=n},keySize:8});u.AES=p._createHelper(d)})();
var px = {
uiSettings: { "Theme": "Green", "Language": "Bd", "DefaultDateFormat": "dd/mm/yy", "CurrencySymbol": "£", "Currency": "GBP", "InvoiceRequestAllowedGroups": "24,25" },
versionInfo: { "PatchId": 12, "Year": "Azolve 2015", "Version": "2015", "BuildNo": "1", "PatchNo": "001", "PatchDate": "\/Date(1427625847773+0600)\/", "PatchDetails": "Azolve Invoicing" },
appPath: '/'
};
// jQuery formatCurrency plugin... see http://code.google.com/p/jquery-formatcurrency/
(function ($) {
$.formatCurrency = {}; $.formatCurrency.regions = []; $.formatCurrency.regions[""] = { symbol: "$", positiveFormat: "%s%n", negativeFormat: "(%s%n)", decimalSymbol: ".", digitGroupSymbol: ",", groupDigits: true };
$.fn.formatCurrency = function (destination, settings) {
if (arguments.length == 1 && typeof destination !== "string") {
settings = destination; destination = false
} var defaults = { name: "formatCurrency", colorize: false, region: "", global: true, roundToDecimalPlace: 2, eventOnDecimalsEntered: false }; defaults = $.extend(defaults, $.formatCurrency.regions[""]);
settings = $.extend(defaults, settings); if (settings.region.length > 0) { settings = $.extend(settings, getRegionOrCulture(settings.region)) } settings.regex = generateRegex(settings);
return this.each(function () {
$this = $(this); var num = "0"; num = $this[$this.is("input, select, textarea") ? "val" : "html"](); if (num.search("\\(") >= 0) {
num = "-" + num
} if (num === "" || (num === "-" && settings.roundToDecimalPlace === -1)) { return } if (isNaN(num)) {
num = num.replace(settings.regex, ""); if (num === "" || (num === "-" && settings.roundToDecimalPlace === -1)) {
return
} if (settings.decimalSymbol != ".") { num = num.replace(settings.decimalSymbol, ".") } if (isNaN(num)) { num = "0" }
} var numParts = String(num).split("."); var isPositive = (num == Math.abs(num));
var hasDecimals = (numParts.length > 1); var decimals = (hasDecimals ? numParts[1].toString() : "0"); var originalDecimals = decimals; num = Math.abs(numParts[0]);
num = isNaN(num) ? 0 : num; if (settings.roundToDecimalPlace >= 0) {
decimals = parseFloat("1." + decimals); decimals = decimals.toFixed(settings.roundToDecimalPlace);
if (decimals.substring(0, 1) == "2") { num = Number(num) + 1 } decimals = decimals.substring(2)
} num = String(num); if (settings.groupDigits) {
for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3);
i++) { num = num.substring(0, num.length - (4 * i + 3)) + settings.digitGroupSymbol + num.substring(num.length - (4 * i + 3)) }
} if ((hasDecimals && settings.roundToDecimalPlace == -1) || settings.roundToDecimalPlace > 0) {
num += settings.decimalSymbol + decimals
} var format = isPositive ? settings.positiveFormat : settings.negativeFormat; var money = format.replace(/%s/g, settings.symbol); money = money.replace(/%n/g, num);
var $destination = $([]); if (!destination) { $destination = $this } else { $destination = $(destination) } $destination[$destination.is("input, select, textarea") ? "val" : "html"](money);
if (hasDecimals && settings.eventOnDecimalsEntered && originalDecimals.length > settings.roundToDecimalPlace) {
$destination.trigger("decimalsEntered", originalDecimals)
} if (settings.colorize) { $destination.css("color", isPositive ? "black" : "red") }
})
}; $.fn.toNumber = function (settings) {
var defaults = $.extend({ name: "toNumber", region: "", global: true }, $.formatCurrency.regions[""]);
settings = jQuery.extend(defaults, settings); if (settings.region.length > 0) { settings = $.extend(settings, getRegionOrCulture(settings.region)) } settings.regex = generateRegex(settings);
return this.each(function () {
var method = $(this).is("input, select, textarea") ? "val" : "html"; $(this)[method]($(this)[method]().replace("(", "(-").replace(settings.regex, ""))
})
}; $.fn.asNumber = function (settings) {
var defaults = $.extend({ name: "asNumber", region: "", parse: true, parseType: "Float", global: true }, $.formatCurrency.regions[""]);
settings = jQuery.extend(defaults, settings); if (settings.region.length > 0) { settings = $.extend(settings, getRegionOrCulture(settings.region)) } settings.regex = generateRegex(settings);
settings.parseType = validateParseType(settings.parseType); var method = $(this).is("input, select, textarea") ? "val" : "html"; var num = $(this)[method]();
num = num ? num : ""; num = num.replace("(", "(-"); num = num.replace(settings.regex, ""); if (!settings.parse) { return num } if (num.length == 0) { num = "0" } if (settings.decimalSymbol != ".") {
num = num.replace(settings.decimalSymbol, ".")
} return window["parse" + settings.parseType](num)
}; function getRegionOrCulture(region) {
var regionInfo = $.formatCurrency.regions[region]; if (regionInfo) {
return regionInfo
} else { if (/(\w+)-(\w+)/g.test(region)) { var culture = region.replace(/(\w+)-(\w+)/g, "$1"); return $.formatCurrency.regions[culture] } } return null
} function validateParseType(parseType) {
switch (parseType.toLowerCase()) {
case "int": return "Int";
case "float": return "Float"; default: throw "invalid parseType"
}
} function generateRegex(settings) {
if (settings.symbol === "") {
return new RegExp("[^\\d" + settings.decimalSymbol + "-]", "g")
} else { var symbol = settings.symbol.replace("$", "\\$").replace(".", "\\."); return new RegExp(symbol + "|[^\\d" + settings.decimalSymbol + "-]", "g") }
}
})(jQuery);
//IE<9 doesn't have an .indexOf() function for Array
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (elt /*, from*/) {
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0)
? Math.ceil(from)
: Math.floor(from);
if (from < 0)
from += len;
for (; from < len; from++) {
if (from in this &&
this[from] === elt)
return from;
}
return -1;
};
}
Array.prototype.swap = function(a, b){
this[a] = this.splice(b, 1, this[a])[0];
return this;
}
if (!Array.prototype.find) {
Array.prototype.find = function (fn /*, from*/) {
var len = this.length >>> 0;
var res = [];
for (var i = 0; i < len; i++) {
if (fn(this[i])) res.push(this[i]);
}
return res.length > 0 ? (res.length > 1 ? res : res[0]) : undefined;
};
}
(function () {
var $rootPath = 'https://webletAUS.azolve.com/';
var $client = 'GFA';
var $client_api_code = 'GFA-2352504F-7923-4318-8C64-4C6A7DFA3B09';
var autoIdSeed = 1000;
var toString = Object.prototype.toString;
var initQueue = [];
$(function () {
for (var i = 0, j = initQueue.length; i < j; i++) {
initQueue[i]();
}
delete az.__addToInitQueue;
delete initQueue;
});
var htmlRegEx = /^(?:<\/?[^>]+(>|$))$/;
az = {
$rootPath:function(){
return $rootPath;
},
$client:function(){
return $client;
},
$client_api_code:function(){
return $client_api_code;
},
$emptyStr:'',
basePrefix: 'az',
__addToInitQueue: function (fn) {
initQueue.push(fn);
},
version: '0.0.1',
uid: function () {
return autoIdSeed++;
},
emptyFn: function () { },
doNothingFn: function (param) { return param; },
format: function (formatableStr, data) {
if (!formatableStr) return '';
return formatableStr.replace(/\{(\$[a-zA-z.0-9]+|[a-zA-z.0-9]+)\}/g, function (matchStr, replacePropName) {
if (replacePropName.indexOf('.') != -1) {
var props = replacePropName.split('.');
var i = 1;
var tmp = data[props[0]];
while (i < props.length) {
tmp = tmp[props[i]];
i++;
}
return tmp || '';
}
return data[replacePropName] || '';
});
},
array: {
uniq: function (array) {
},
remove: function (array, item) {
}
},
chk: {
ifFunction: function (v) {
return toString.call(v) === '[object Function]';
},
ifArray: function (v) {
return toString.call(v) === '[object Array]';
},
ifDefined: function (v) {
return typeof v !== 'undefined';
},
ifEmptyObj: function (v) {
return $.isEmptyObject(v);
},
ifEmpty: function (v, allowBlank) {
return v === null || v === undefined || ((az.chk.ifArray(v) && !v.length)) || (!allowBlank ? v === '' : false);
},
ifDate: function (v) {
return toString.apply(v) === '[object Date]';
},
ifObject: function (v) {
return !!v && toString.call(v) === '[object Object]';
},
ifPrimitive: function (v) {
return az.chk.ifString(v) || az.chk.ifNumber(v) || az.chk.ifBoolean(v);
},
ifNumber: function (v) {
return typeof v === 'number' && isFinite(v);
},
ifBoolean:function(v) {
return typeof v === 'boolean';
},
ifString: function (v) {
return typeof v === 'string';
},
ifDomEl: function (v) {
return v ? !!v.tagName : false;
},
ifHtmlTag:function (v) {
return htmlRegEx.test(v);
}
},
absorb: function (obj1, obj2, skipProps) {
skipProps += ',';
if(az.chk.ifArray(obj1) && az.chk.ifArray(obj2)) {
for(var i=0;i 1 && index + 1 <= ln - 1)
array.swap(index, index + 1);
return array;
},
swapWithPrevious: function(array, index) {
var ln = array.length;
if ( ln>1 && index - 1 != -1)
array.swap(index, index-1);
return array;
},
FocusManager: {
FocusedElementId:''
}
};
})();
/*Scripts/libs/Astral/Core/browser.js*/
(function () {
var userAgent = navigator.userAgent.toLowerCase();
var check = function(regex) {
return regex.test(userAgent);
},
isStrict = document.compatMode == "CSS1Compat",
version = function(is, regex) {
var m;
return (is && (m = regex.exec(userAgent))) ? parseFloat(m[1]) : 0;
},
docMode = document.documentMode,
isEdge = check(/\bedge\b/),
isOpera = check( /opera/ ),
isOpera10_5 = isOpera && check( /version\/10\.5/ ),
isChrome = check( /\bchrome\b/ ),
isWebKit = check( /webkit/ ),
isSafari = !isChrome && check( /safari/ ),
isSafari2 = isSafari && check( /applewebkit\/4/ ), // unique to Safari 2
isSafari3 = isSafari && check( /version\/3/ ),
isSafari4 = isSafari && check( /version\/4/ ),
isSafari5_0 = isSafari && check( /version\/5\.0/ ),
isSafari5 = isSafari && check( /version\/5/ ),
isIE= typeof document.documentMode == "number" || new Function("return/*@cc_on!@*/!1")(),
//isIE = !isOpera && check( /msie/ ),
isIE10 = isIE && ((check(/msie 10/) && docMode != 7 && docMode != 9) || docMode != 8 || docMode != 9 || docMode == 10),
isIE9 = isIE && ((check(/msie 9/) && docMode != 7 && docMode != 9) || docMode != 8 || docMode == 9),
isIE7 = isIE && ((check( /msie 7/ ) && docMode != 8 && docMode != 9) || docMode == 7),
isIE8 = isIE && ((check( /msie 8/ ) && docMode != 7 && docMode != 9) || docMode == 8),
isIE9 = isIE && ((check( /msie 9/ ) && docMode != 7 && docMode != 8) || docMode == 9),
isIE6 = isIE && check( /msie 6/ ),
isGecko = !isWebKit && check( /gecko/ ),
isGecko3 = isGecko && check( /rv:1\.9/ ),
isGecko4 = isGecko && check( /rv:2\.0/ ),
isGecko5 = isGecko && check( /rv:5\./ ),
isGecko10 = isGecko && check( /rv:10\./ ),
isFF3_0 = isGecko3 && check( /rv:1\.9\.0/ ),
isFF3_5 = isGecko3 && check( /rv:1\.9\.1/ ),
isFF3_6 = isGecko3 && check( /rv:1\.9\.2/ ),
isWindows = check( /windows|win32/ ),
isMac = check( /macintosh|mac os x/ ),
isLinux = check( /linux/ ),
chromeVersion = version(true, /\bchrome\/(\d+\.\d+)/ ),
firefoxVersion = version(true, /\bfirefox\/(\d+\.\d+)/ ),
ieVersion = version(isIE, /msie (\d+\.\d+)/ ),
operaVersion = version(isOpera, /version\/(\d+\.\d+)/ ),
safariVersion = version(isSafari, /version\/(\d+\.\d+)/ ),
webKitVersion = version(isWebKit, /webkit\/(\d+\.\d+)/ ),
isSecure = /^https/i .test(window.location.protocol);
az.browser = {};
az.copy(az.browser, {
isStrict: isStrict,
isWindows: isWindows,
isLinux: isLinux,
isSecure: isSecure,
isOpera: isOpera,
operaVersion: operaVersion,
isOpera10_5: isOpera10_5,
isMac: isMac,
isWebKit: isWebKit,
webKitVersion: webKitVersion,
isGecko: isGecko,
isGecko3: isGecko3,
isGecko4: isGecko4,
isGecko5: isGecko5,
isGecko10: isGecko10,
isChrome: isChrome,
chromeVersion: chromeVersion,
isSafari: isSafari,
isSafari2: isSafari2,
isSafari3: isSafari3,
isSafari4: isSafari4,
isSafari5_0: isSafari5_0,
isSafari5: isSafari5,
safariVersion: safariVersion,
isFF3_0: isFF3_0,
isFF3_5: isFF3_5,
isFF3_6: isFF3_6,
firefoxVersion: firefoxVersion,
isIE: isIE,
isIE6: isIE6,
isIE7: isIE7,
isIE8: isIE8,
isIE9: isIE9,
isIE10: isIE10,
ieVersion: ieVersion,
isEdge: isEdge
});
})();
/*Scripts/libs/Astral/Core/class.js*/
(function () {
var classes = {};
var classeAlias = {};
var classMeta = {};
var staticClasses = {};
var features = {};
var fnTest = function (fn) { return fn.toString().indexOf('this.$super') != -1; };
var Base = function () { };
var createNamespace = function (className, type) {
var accesor = className.split('.');
if (accesor.length == 1) {
if (az.hasOwnProperty(className)) throw new Error('Unable to create namespace for ' + className + ' its already Occupied');
az[className] = type;
return;
}
var item = az[accesor[0]] = az[accesor[0]] || {};
for (var i = 1; i < accesor.length - 1; i++) {
item = item[accesor[i]] = item[accesor[i]] || {};
}
var propName = accesor[accesor.length - 1];
if (item && item.hasOwnProperty(propName) && (item[propName]) == 'function') throw new Error('Invalid namespace, its already been occupied');
item[propName] = type;
};
var initMixins = function (instance, name) {
var mixins = name ? name.split(',') : classMeta[instance.$class].includes;
if (mixins) {
for (var i = 0, j = mixins.length; i < j; i++)
if (features[mixins[i]].init) features[mixins[i]].init.call(instance);
}
};
var destroyMixins = function (instance, name) {
var mixins = name ? name.split(',') : classMeta[instance.$class].includes;
if (mixins) {
for (var i = 0, j = mixins.length; i < j; i++)
if (features[mixins[i]].destroy) features[mixins[i]].destroy.call(instance);
}
};
az.copy(az, {
defineClass: function (className, config, afterDefine) {
if (arguments.length < 2) throw new Error("az.defineClass requires 2 parameters");
var baseClassName = config.$extends, mixins = config.$includes, statics = config.$static, override = config.$override, alias = config.$alias;
delete config.$extends;
delete config.$includes;
delete config.$statics;
var baseClass = (baseClassName ? classes[baseClassName] : Base);
if (!baseClass) throw new Error(baseClassName + " not loaded");
baseClass.prototype.__initializing = true;
var proto = new baseClass();
delete baseClass.prototype.__initializing;
if (mixins) {
if (typeof (mixins) == 'string') mixins = mixins.split(',');
for (var i = 0; i < mixins.length; i++) {
if (features.hasOwnProperty(mixins[i])) {
az.copy(proto, features[mixins[i]], 'init,destroy');
}
}
}
if (baseClassName) {
var baseMixins = classMeta[baseClassName].includes;
if (baseMixins) {
if (mixins) {
for (var j = 0; j < baseMixins.length; j++) {
mixins.splice(0, 0, baseMixins[j]);
}
}
else {
mixins = baseMixins;
}
}
}
for (var i in config) {
if (typeof config[i] == "function" && fnTest(config[i])) {
if (i == '$super') throw '$super method name is not allowed';
proto[i] = (function (superClassName, method, fn) {
return function () {
var tmp = this.$super;
this.$super = classes[superClassName].prototype[method];
var ret = fn.apply(this, arguments);
this.$super = tmp;
return ret;
};
})(baseClassName, i, config[i]);
}
else {
if (az.chk.ifObject(config[i])) {
if (!proto.hasOwnProperty(i)) proto[i] = {};
az.absorb(proto[i], config[i]);
}
else if (az.chk.ifArray(config[i])) {
if (!proto.hasOwnProperty(i)) proto[i] = [];
az.absorb(proto[i], config[i]);
}
else {
proto[i] = config[i];
}
}
}
if (override)
az.copy(proto, override);
proto.__props = {};
for (var i in proto) {
if (!proto.hasOwnProperty(i) || az.chk.ifFunction(proto[i]) || i == '__props') continue;
proto.__props[i] = proto[i];
delete proto[i];
}
if (!az.chk.ifEmptyObj(proto.__props))
proto.__props = JSON.stringify(proto.__props);
else
delete proto.__props;
proto.$class = className;
classes[className] = function () {
if (this.__props)
az.copy(this, JSON.parse(this.__props));
this.__props = undefined;
delete this.__props;
if (!this.__initializing && this.init) this.init.apply(this, arguments);
if (!this.__initializing && this.$autoInitMixin != false) {
initMixins(this);
delete this.$autoInitMixin;
}
};
createNamespace(className, classes[className]);
classes[className].prototype = proto;
classes[className].prototype.constructor = classes[className];
classMeta[className] = { name: className, _extends: baseClassName, includes: mixins };
az.copy(classes[className], statics);
if (alias) {
alias = alias.split(',');
i = alias.length;
while (i--) {
if (classeAlias.hasOwnProperty(alias[i])) throw alias[i] + " alias is already used for " + classeAlias[alias[i]];
classeAlias[alias[i]] = className;
}
}
if (afterDefine && az.chk.ifFunction(afterDefine)) {
afterDefine(classes[className], classMeta[className]);
}
return classes[className];
},
defineSingleton: function (name, config) {
createNamespace(name, config);
staticClasses[name] = config;
},
defineMixin: function (mixinName, config) {
if (!features.hasOwnProperty(name))
features[mixinName] = config;
},
initMixins: function (instance, mixins) {
initMixins(instance, mixins);
},
initAllMixinsExcept: function (instance, mixins) {
var allmixins = classMeta[instance.$class].includes;
var excludeList = mixins.split(',');
var selectedMixin = [];
for (var i = 0; i < allmixins.length; i++) {
var found = false;
for (var j = 0; j < excludeList.length; j++)
if (excludeList[j] == allmixins[i]) {
found = true;
break;
}
if (!found)
selectedMixin.push(allmixins[i]);
}
initMixins(instance, selectedMixin.join(','));
},
destroyMixins: function (instance, mixins) {
destroyMixins(instance, mixins);
},
isSubclassOf: function (name, parent) {
var superClass = az.getParentOf(name);
while (superClass != parent && superClass) {
superClass = az.getParentOf(superClass);
}
if (!superClass) return false;
return true;
},
getParentOf: function (name) {
if (az.chk.ifString(name))
if (classMeta.hasOwnProperty(name)) return classMeta[name]._extends;
if (name instanceof Base) return classMeta[name.$class]._extends;
},
existsClass: function (name) {
return classes.hasOwnProperty(name);
},
$class: function (name) {
if (!classes.hasOwnProperty(name) && !classeAlias.hasOwnProperty(name)) return null;
return classes.hasOwnProperty(name) ? classes[name] : classes[classeAlias[name]];
},
create: function (name, config) {
if (!classes.hasOwnProperty(name) && !classeAlias.hasOwnProperty(name)) return null;
return classes.hasOwnProperty(name) ? new (classes[name])(config) : new (classes[classeAlias[name]])(config);
},
instanceOf: function (instance, name) {
if (az.chk.ifString(name) && !classes.hasOwnProperty(name)) return false;
return instance instanceof classes[name];
}
});
})();
/*Scripts/libs/Astral/Core/componentMgr.js*/
(function () {
var componentInstances = {};
var compIdPrefix = 'az-com-';
var compNameRegistry = {};
var compClassRegistry = {};
function getChildsOf(items) {
var childs = [];
for (var i = 0; i < items.length; i++) {
childs.push.apply(childs, filters.byOwner(items[i]));
}
return childs;
}
function readBetween(start, end, str) {
var depth = -1;
var expression = '';
for (var i = 0; i < str.length; i++) {
if (str[i] == end && depth == 0) break;
if (str[i] == start) depth++;
if (str[i] == end) depth--;
if (depth >= 0) expression += str[i];
}
return expression.substr(1);
}
function isChildOf(item, parent) {
var owner = item.owner;
while (owner && owner != parent) {
owner = owner.owner;
}
if (owner == parent) return true;
return false;
}
var filters = {
createExpressionFn: function (str) {
var expression = readBetween('[', ']', str);
if (az.browser.isSafari)
return new Function("ctx", " with(ctx){ try{ return " + expression + "} catch(e){ if(e.message.indexOf('find variable')>-1){return false;} else throw e } }");
else if (az.browser.isIE || az.browser.isEdge)
return new Function("ctx", " with(ctx){ try{ return " + expression + "} catch(e){ if(e.message.indexOf('undefined')>-1){return false;} else throw e } }");
else
return new Function("ctx", " with(ctx){ try{ return " + expression + "} catch(e){ if(e.message.indexOf('not defined')>-1){return false;} else throw e } }");
},
byOwner: function (owner, filterItems) {
var items = [];
if (filterItems) {
for (var i = 0; i < filterItems.length; i++) {
if (isChildOf(filterItems[i], owner))
items.push(filterItems[i]);
}
}
else
for (var i in componentInstances) {
if (componentInstances[i].owner == owner) items.push(componentInstances[i]);
}
return items;
},
byName: function (name, items, expressionFn) {
if (!items && !expressionFn) az.getCmpByName(name);
var itemsToFilter = items ? items : az.getCmpByName(name);
var filteredItems = [];
for (var i = 0; i < itemsToFilter.length; i++) {
if (itemsToFilter[i].name == name) {
if (expressionFn) {
if (expressionFn(itemsToFilter[i]))
filteredItems.push(itemsToFilter[i]);
}
else
filteredItems.push(itemsToFilter[i]);
}
}
return filteredItems;
},
byClass: function (className, items, expressionFn) {
if (!items && !expressionFn) return compClassRegistry[className];
var itemsToFilter = items ? items : compClassRegistry[className];
var filteredItems = [];
for (var i = 0; i < itemsToFilter.length; i++) {
if (itemsToFilter[i].$class == className) {
if (expressionFn) {
if (expressionFn(itemsToFilter[i]))
filteredItems.push(itemsToFilter[i]);
}
else
filteredItems.push(itemsToFilter[i]);
}
}
return filteredItems;
}
};
az.copy(az, {
register: function (instance) {
instance.cid = compIdPrefix + az.uid();
componentInstances[instance.cid] = instance;
if (az.chk.ifDefined(instance.name)) {
if (!compNameRegistry.hasOwnProperty(instance.name)) {
compNameRegistry[instance.name] = [];
}
compNameRegistry[instance.name].push(instance.cid);
}
if (!compClassRegistry.hasOwnProperty(instance.$class)) {
compClassRegistry[instance.$class] = [];
}
compClassRegistry[instance.$class].push(instance);
},
findCmp: function (query, owner) {
var tockens = query.split('>'); //todo use regex to split
var items;
for (var i = 0; i < tockens.length; i++) {
if (items && items.length > 0) {
items = getChildsOf(items);
}
var expressionFn = undefined;
if (tockens[i].indexOf('[') != -1) {
expressionFn = filters.createExpressionFn(tockens[i]);
}
if (tockens[i].trim()[0] == '$') {
var className;
if (tockens[i].indexOf('[') != -1)
className = tockens[i].substr(tockens[i].indexOf('$') + 1, tockens[i].indexOf('[') - 1).trim();
else
className = tockens[i].substr(1).trim();
items = filters.byClass(className, items, expressionFn);
continue;
}
items = filters.byName(tockens[i].trim(), items, expressionFn);
if (owner && i == 0) {
items = filters.byOwner(owner, items);
}
}
return items;
},
getCmpByName: function (name) {
if (compNameRegistry.hasOwnProperty(name)) {
var items = [];
for (var i = 0; i < compNameRegistry[name].length; i++)
items.push(componentInstances[compNameRegistry[name][i]]);
return items;
}
},
unregister: function (instance) {
delete componentInstances[instance.cid];
if (az.chk.ifDefined(instance.name)) {
if (compNameRegistry.hasOwnProperty(instance.name)) {
for (var i = 0; i < compNameRegistry[instance.name].length; i++) {
if (compNameRegistry[instance.name][i] == instance.cid) {
compNameRegistry[instance.name].splice(i, 1);
if (compNameRegistry[instance.name].length == 0) delete compNameRegistry[instance.name];
break;
}
}
}
}
for (var i = 0; i < compClassRegistry[instance.$class].length; i++) {
if (compClassRegistry[instance.$class][i].cid == instance.cid) {
compClassRegistry[instance.$class].splice(i, 1);
break;
}
}
},
getCmp: function (id) {
return componentInstances[id];
},
getCmpByElId: function (elementId) {
return az.getCmp(elementId.match(/az-com-\d+/)[0]);
}
});
})();
/*Scripts/libs/Astral/Core/eventMgr.js*/
(function () {
var domEvtsRe = /click|dblclick|mousedown|mouseenter|mouseleave|mousemove|mouseover|mouseout|mouseup|keydown|keypress|keyup|load|unload|resize|scroll|mousewheel|blur|change|focus|reset|select|submit|focusin|focusout/i;
var deligatableEvtRe = /click|dblclick|mousedown|mouseover|mouseup|keydown|keypress|keyup|resize|change|select/i;
var globalChannel = {};
var domChannels = {};
var customChannels = {};
var interceptors = {};
var nonDeligatedChannel = {};
var elIdToCid = {};
var btnMap = az.browser.isIE ? { 1: 0, 4: 1, 2: 2} : { 0: 0, 1: 1, 2: 2 };
var clickRe = /(dbl)?click/;
var safariKeys = {
3: 13, // enter
63234: 37, // left
63235: 39, // right
63232: 38, // up
63233: 40, // down
63276: 33, // page up
63277: 34, // page down
63272: 46, // delete
63273: 36, // home
63275: 35 // end
};
var keyEnum = {
BACKSPACE: 8,
TAB: 9,
NUM_CENTER: 12,
ENTER: 13,
RETURN: 13,
SHIFT: 16,
CTRL: 17,
ALT: 18,
PAUSE: 19,
CAPS_LOCK: 20,
ESC: 27,
SPACE: 32,
PAGE_UP: 33,
PAGE_DOWN: 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
PRINT_SCREEN: 44,
INSERT: 45,
DELETE: 46,
ZERO: 48,
ONE: 49,
TWO: 50,
THREE: 51,
FOUR: 52,
FIVE: 53,
SIX: 54,
SEVEN: 55,
EIGHT: 56,
NINE: 57,
CONTEXT_MENU: 93,
NUM_ZERO: 96,
NUM_ONE: 97,
NUM_TWO: 98,
NUM_THREE: 99,
NUM_FOUR: 100,
NUM_FIVE: 101,
NUM_SIX: 102,
NUM_SEVEN: 103,
NUM_EIGHT: 104,
NUM_NINE: 105,
NUM_MULTIPLY: 106,
NUM_PLUS: 107,
NUM_MINUS: 109,
NUM_PERIOD: 110,
NUM_DIVISION: 111,
F1: 112,
F2: 113,
F3: 114,
F4: 115,
F5: 116,
F6: 117,
F7: 118,
F8: 119,
F9: 120,
F10: 121,
F11: 122,
F12: 123
};
function dispatchGlobalEventHandlers(event) {
var handlers = globalChannel[event.type];
if (handlers && handlers.length > 0) {
var i = 0, j = handlers.length;
if (j > 0)
setTimeout(function () {
for (; i < j; i++) {
handlers[i].fn.apply(handlers[i].scope || null, event);
}
}, 10);
}
}
function dispatchCustomEventHandler(cid, event, args) {
var handlers = customChannels[cid][event];
var i = 0, j = handlers.length;
if (j > 0)
setTimeout(function () {
for (; i < j; i++) {
handlers[i].fn.apply(handlers[i].scope || null, args);
}
}, 10);
}
function dispatchDomEventHandler(elId, browserEvent) {
if (!elIdToCid.hasOwnProperty(elId)) return true;
var event = browserEvent.type;
var cid = elIdToCid[elId];
var hasInterceptor = interceptors.hasOwnProperty(cid) && interceptors[cid].hasOwnProperty(elId) && interceptors[cid][elId].hasOwnProperty(event);
if (hasInterceptor) {
var interceptorHandler = interceptors[cid][elId][event];
if (!interceptorHandler.fn.call(interceptorHandler.scope || null, new az.Event(elId, browserEvent))) {
if (browserEvent.preventDefault) browserEvent.preventDefault();
return false;
}
}
if (!domChannels.hasOwnProperty(cid)) return true;
if (!domChannels[cid].hasOwnProperty(elId)) return true;
if (!domChannels[cid][elId].hasOwnProperty(event)) return true;
var handlers = domChannels[cid][elId][event];
var i = 0, j = handlers.length;
if (j > 0)
setTimeout(function () {
for (; i < j; i++) {
handlers[i].fn.call(handlers[i].scope || null, az.getCmp(cid), new az.Event(elId, browserEvent));
}
// todo remove one time handlers
}, 10);
return true;
}
az.__addToInitQueue(function () {
var events = 'click|dblclick|mousedown|mouseover|mouseup|keydown|keypress|keyup|resize|change|select'.split('|');
var bodyEl = $(document), i = events.length;
while (i--) {
bodyEl.on(events[i], function (event) {
var el = event.target;
var idAttr = $(el).attr('id');
while (el && (idAttr == undefined || idAttr[0] == '!')) {
el = el.parentNode;
idAttr = $(el).attr('id');
}
dispatchGlobalEventHandlers(event);
return dispatchDomEventHandler(idAttr || az.FocusManager.FocusedElementId, event);
});
};
});
az.copy(az, {
eventUtil: {
key: keyEnum,
getPageXY: function (event) {
var x = event.pageX,
y = event.pageY,
docEl = document.documentElement,
body = document.body;
// pageX/pageY not available (undefined, not null), use clientX/clientY instead
if (!x && x !== 0) {
x = event.clientX + (docEl && docEl.scrollLeft || body && body.scrollLeft || 0) - (docEl && docEl.clientLeft || body && body.clientLeft || 0);
y = event.clientY + (docEl && docEl.scrollTop || body && body.scrollTop || 0) - (docEl && docEl.clientTop || body && body.clientTop || 0);
}
if (isNaN(x)) return null;
return [x, y];
},
normalizeKey: function (key) {
return az.browser.isWebKit ? (safariKeys[key] || key) : key;
},
normalizeButton: function (btnCode) {
return btnMap[btnCode];
},
isClickEvent: function (evetType) {
return clickRe.test(evetType);
}
},
destoryEventHandlers: function (cid) {
delete customChannels[cid];
delete domChannels[cid];
delete nonDeligatedChannel[cid];
delete interceptors[cid];
},
interceptEvent: function (cid, domElementId, event, handler, scope) {
if (!interceptors.hasOwnProperty(cid)) interceptors[cid] = {};
if (!interceptors[cid].hasOwnProperty(domElementId)) interceptors[cid][domElementId] = {};
if (!interceptors[cid][domElementId].hasOwnProperty(event)) interceptors[cid][domElementId][event] = {};
interceptors[cid][domElementId][event] = { fn: handler, scope: scope };
},
suspendEvents: function (cid, suspend) {
if (customChannels.hasOwnProperty(cid)) customChannels[cid].suspend = suspend;
if (domChannels.hasOwnProperty(cid)) domChannels[cid].suspend = suspend;
if (nonDeligatedChannel.hasOwnProperty(cid)) nonDeligatedChannel[cid].suspend = suspend;
},
isListening: function (cid, event, fn, scope) {
if (!az.hasListener(cid, event)) return false;
var handlers = customChannels[cid][event];
for (var i = 0; i < handlers.length; i++) {
if (handlers[i].fn == fn && handlers[i].scope == scope)
return true;
}
return false;
},
isDelegatedDomListening: function (cid, domElementId, event, fn, scope) {
if (!az.hasDeligatedDomListener(cid, domElementId, event)) return false;
var handlers = domChannels[cid][domElementId][event];
for (var i = 0; i < handlers.length; i++) {
if (handlers[i].fn == fn && handlers[i].scope == scope)
return true;
}
return false;
},
isNonDeligatedDomListening: function (cid, domElementId, event, fn, scope) {
if (!az.hasNonDeligatedDomListener(cid, domElementId, event)) return false;
var handlers = nonDeligatedChannel[cid][domElementId][event];
for (var i = 0; i < handlers.length; i++) {
if (handlers[i].fn == fn && handlers[i].scope == scope)
return true;
}
return false;
},
hasDeligatedDomListener: function (cid, domElementId, event) {
if (!domChannels.hasOwnProperty(cid)) return false;
if (!domChannels[cid].hasOwnProperty(domElementId)) return false; ;
if (!domChannels[cid][domElementId].hasOwnProperty(event)) return false;
return true;
},
hasNonDeligatedDomListener: function (cid, domElementId, event) {
if (!nonDeligatedChannel.hasOwnProperty(cid)) return false;
if (!nonDeligatedChannel[cid].hasOwnProperty(domElementId)) return false;
if (!nonDeligatedChannel[cid][domElementId].hasOwnProperty(event)) return false;
return true;
},
hasListener: function (cid, event) {
if (!customChannels.hasOwnProperty(cid)) return false;
if (!customChannels[cid].hasOwnProperty(event)) return false;
return customChannels[cid][event].length > 0;
},
forwardEvent: function (elementId, event) {
var el = $('#' + elementId);
var idAttr = el.attr('id');
while (idAttr == undefined) {
el = el.parentNode;
idAttr = $(el).attr('id');
}
return dispatchDomEventHandler(idAttr, event);
},
fireEvent: function (cid, event, args) {
if (az.hasListener(cid, event))
dispatchCustomEventHandler(cid, event, args);
},
addListener: function (cid, event, handler, scope) {
if (!customChannels.hasOwnProperty(cid)) customChannels[cid] = {};
if (!customChannels[cid].hasOwnProperty(event)) customChannels[cid][event] = [];
if (!az.isListening(cid, event, handler, scope))
customChannels[cid][event].push({ fn: handler, scope: scope });
},
removeListener: function (cid, event, handler, scope) {
if (!customChannels.hasOwnProperty(cid)) return null;
if (!customChannels[cid].hasOwnProperty(event)) return null;
var handlers = customChannels[cid][event];
var i = handlers.length;
while (i--) {
if (handlers[i].fn == handler && handlers[i].scope == scope) {
return handlers.splice(i, 1);
}
}
},
addGloablEventHandler: function (event, handler, scope) {
if (!globalChannel.hasOwnProperty(event)) {
globalChannel[event] = [];
}
globalChannel[event].push({ fn: handler, scope: scope });
},
removeGloablEventHandler: function (event, handler, scope) {
if (!globalChannel.hasOwnProperty(event)) return null;
var handlers = globalChannel[event];
var i = handlers.length;
while (i--) {
if (handlers[i].fn == handler && handlers[i].scope == scope) {
return handlers.splice(i, 1);
}
}
},
addDomEventHandlers: function (cid, domElementId, event, handler, scope) {
if (!domEvtsRe.test(event)) return;
if (deligatableEvtRe.test(event)) {
if (az.isDelegatedDomListening(cid, domElementId, event, handler, scope)) return;
if (!domChannels.hasOwnProperty(cid)) domChannels[cid] = { suspend: false };
if (!domChannels[cid].hasOwnProperty(domElementId)) domChannels[cid][domElementId] = {};
if (!domChannels[cid][domElementId].hasOwnProperty(event)) domChannels[cid][domElementId][event] = [];
domChannels[cid][domElementId][event].push({ fn: handler, scope: scope });
}
else {
if (!nonDeligatedChannel.hasOwnProperty(cid)) nonDeligatedChannel[cid] = { suspend: false };
if (!nonDeligatedChannel[cid].hasOwnProperty(domElementId)) nonDeligatedChannel[cid][domElementId] = {};
if (!nonDeligatedChannel[cid][domElementId].hasOwnProperty(event)) nonDeligatedChannel[cid][domElementId][event] = [];
if (az.isNonDeligatedDomListening(cid, domElementId, event, handler, scope)) {
var handlers = nonDeligatedChannel[cid][domElementId][event];
for (var i = 0; i < handler.length; i++) {
if (handlers[i].fn == handler && handlers[i].scope == scope) {
$('#' + domElementId).off(event, handlers[i].newFn);
$('#' + domElementId).on(event, handlers[i].newFn);
break;
}
}
}
else {
var handlerCfg = { fn: handler, scope: scope, newFn: (function (id) {
return function (evt) {
if (!nonDeligatedChannel[id].suspend)
return handler.call(scope || null, new az.Event(domElementId, evt));
};
})(cid)
};
nonDeligatedChannel[cid][domElementId][event].push(handlerCfg);
$('#' + domElementId).on(event, handlerCfg.newFn);
}
}
elIdToCid[domElementId] = cid;
},
removeAllDomEventHandler: function (cid, domElementId) {
if (domChannels.hasOwnProperty(cid) && domChannels[cid].hasOwnProperty(domElementId)) {
delete domChannels[cid][domElementId];
}
if (nonDeligatedChannel.hasOwnProperty(cid) && nonDeligatedChannel[cid].hasOwnProperty(domElementId)) {
delete nonDeligatedChannel[cid][domElementId];
$('#' + domElementId).off();
}
delete elIdToCid[domElementId];
},
removeDomEventHandler: function (cid, domElementId, event, handler, scope) {
var handlers, i, deletedHandler = null, removeDomDirect = false;
if (deligatableEvtRe.test(event)) {
if (!domChannels.hasOwnProperty(cid)) return null;
if (!domChannels[cid].hasOwnProperty(domElementId)) return null;
if (!domChannels[cid][domElementId].hasOwnProperty(event)) return null;
handlers = domChannels[cid][domElementId][event];
}
else {
if (!nonDeligatedChannel[cid].hasOwnProperty(domElementId)) return null;
if (!nonDeligatedChannel[cid][domElementId].hasOwnProperty(event)) return null;
handlers = nonDeligatedChannel[cid][domElementId][event];
removeDomDirect = true;
}
i = handlers.length;
while (i--) {
if (handlers[i].fn == handler && handlers[i].scope == scope) {
deletedHandler = handlers.splice(i, 1);
break;
}
}
if (removeDomDirect && deletedHandler.newFn)
$('#' + domElementId).off(event, deletedHandler.newFn);
return deletedHandler;
}
});
})();
/*Scripts/libs/Astral/Core/Event.js*/
az.defineClass('Event', {
init: function (elementId, event) {
this.elementId = elementId;
var button, options;
this.browserEvent = event;
// normalize buttons
button = event.button ? az.eventUtil.normalizeButton(event.button) : (event.which ? event.which - 1 : -1);
if (az.eventUtil.isClickEvent(event.type) && button == -1) {
button = 0;
}
options = {
type: event.type,
button: button,
shiftKey: event.shiftKey,
// mac metaKey behaves like ctrlKey
ctrlKey: event.ctrlKey || event.metaKey || false,
altKey: event.altKey,
// in getKey these will be normalized for the mac
keyCode: az.eventUtil.normalizeKey(event.keyCode),
charCode: event.charCode,
xy: az.eventUtil.getPageXY(event)
};
az.copy(this, options);
},
getKey: function () {
return this.keyCode || this.charCode;
},
getCharCode: function () {
return this.charCode || this.keyCode;
},
stopPropagation: function () {
this.browserEvent.stopPropagation();
},
stopEvent: function () {
this.browserEvent.stopPropagation();
this.browserEvent.preventDefault();
return false;
},
preventDefault: function () {
this.browserEvent.preventDefault();
return false;
},
hasModifier: function () {
return this.ctrlKey || this.altKey || this.shiftKey || this.metaKey;
},
ifNavKeyPress: function () {
var k = this.keyCode, keyEnum = az.eventUtil.key;
return (k >= 33 && k <= 40) || k == keyEnum.RETURN || k == keyEnum.TAB || k == keyEnum.ESC;
},
ifSpecialKey: function () {
var k = this.keyCode, keyEnum = az.eventUtil.key;
return (this.type == 'keypress' && this.ctrlKey) ||
this.ifNavKeyPress() ||
(k == keyEnum.BACKSPACE) || // Backspace
(k >= 16 && k <= 20) || // Shift, Ctrl, Alt, Pause, Caps Lock
(k >= 44 && k <= 46); // Print Screen, Insert, Delete
}
});
/*Scripts/libs/Astral/Core/date.js*/
(function () {
az.date = {};
az.copy(az.date, {
/* Standard date formats. */
ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
COOKIE: "D, dd M yy",
ISO_8601: "yy-mm-dd",
RFC_822: "D, d M y",
RFC_850: "DD, dd-M-y",
RFC_1036: "D, d M y",
RFC_1123: "D, d M yy",
RFC_2822: "D, d M yy",
RSS: "D, d M y", // RFC 822
TICKS: "!",
TIMESTAMP: "@",
W3C: "yy-mm-dd", // ISO 8601
_ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
monthNames: ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"], // Names of months for drop-down and formatting
monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], // Column headings for days starting at Sunday
shortYearCutoff: "+10", // Short year values < this are in the current century,
/* Format a date object into a string value.
* The format can be combinations of the following:
* d - day of month (no leading zero)
* dd - day of month (two digit)
* o - day of year (no leading zeros)
* oo - day of year (three digit)
* D - day name short
* DD - day name long
* m - month of year (no leading zero)
* mm - month of year (two digit)
* M - month name short
* MM - month name long
* y - year (two digit)
* yy - year (four digit)
* @ - Unix timestamp (ms since 01/01/1970)
* ! - Windows ticks (100ns since 01/01/0001)
* "..." - literal text
* '' - single quote
*
* @param format string - the desired format of the date
* @param date Date - the date value to format
* @param settings Object - attributes include:
* dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
* dayNames string[7] - names of the days from Sunday (optional)
* monthNamesShort string[12] - abbreviated names of the months (optional)
* monthNames string[12] - names of the months (optional)
* @return string - the date in the above format
*/
formatDate: function (format, date) {
if (!date || !(date instanceof Date)) {
return "";
}
var iFormat,
// Check whether a format character is doubled
lookAhead = function (match) {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
if (matches) {
iFormat++;
}
return matches;
},
// Format a number, with leading zero if necessary
formatNumber = function (match, value, len) {
var num = "" + value;
if (lookAhead(match)) {
while (num.length < len) {
num = "0" + num;
}
}
return num;
},
// Format a name, short or long as requested
formatName = function (match, value, shortNames, longNames) {
return (lookAhead(match) ? longNames[value] : shortNames[value]);
},
output = "",
literal = false;
if (date) {
for (iFormat = 0; iFormat < format.length; iFormat++) {
if (literal) {
if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
literal = false;
} else {
output += format.charAt(iFormat);
}
} else {
switch (format.charAt(iFormat)) {
case "d":
output += formatNumber("d", date.getDate(), 2);
break;
case "D":
output += formatName("D", date.getDay(), this.dayNamesShort, this.dayNames);
break;
case "o":
output += formatNumber("o",
Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
break;
case "m":
output += formatNumber("m", date.getMonth() + 1, 2);
break;
case "M":
output += formatName("M", date.getMonth(), this.monthNamesShort, this.monthNames);
break;
case "y":
output += (lookAhead("y") ? date.getFullYear() :
(date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100);
break;
case "@":
output += date.getTime();
break;
case "!":
output += date.getTime() * 10000 + this._ticksTo1970;
break;
case "'":
if (lookAhead("'")) {
output += "'";
} else {
literal = true;
}
break;
default:
output += format.charAt(iFormat);
}
}
}
}
return output;
},
/* Parse a string value into a date object.
* See formatDate below for the possible formats.
*
* @param format string - the expected format of the date
* @param value string - the date in the above format
* @param settings Object - attributes include:
* shortYearCutoff number - the cutoff year for determining the century (optional)
* dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
* dayNames string[7] - names of the days from Sunday (optional)
* monthNamesShort string[12] - abbreviated names of the months (optional)
* monthNames string[12] - names of the months (optional)
* @return Date - the extracted date value or null if value is blank
*/
parseDate: function (format, value) {
if (format == null || value == null) {
throw "Invalid arguments";
}
value = (typeof value === "object" ? value.toString() : value + "");
if (value === "") {
return null;
}
var shortYearCutoffTemp = this.shortYearCutoff;
var shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10));
var iFormat, dim, extra,
iValue = 0,
year = -1,
month = -1,
day = -1,
doy = -1,
literal = false,
date,
// Check whether a format character is doubled
lookAhead = function (match) {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
if (matches) {
iFormat++;
}
return matches;
},
// Extract a number from the string value
getNumber = function (match) {
var isDoubled = lookAhead(match),
size = (match === "@" ? 14 : (match === "!" ? 20 :
(match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
digits = new RegExp("^\\d{1," + size + "}"),
num = value.substring(iValue).match(digits);
if (!num) {
throw "Missing number at position " + iValue;
}
iValue += num[0].length;
return parseInt(num[0], 10);
},
// Extract a name from the string value and convert to an index
getName = function (match, shortNames, longNames) {
var index = -1,
names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
return [[k, v]];
}).sort(function (a, b) {
return -(a[1].length - b[1].length);
});
$.each(names, function (i, pair) {
var name = pair[1];
if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
index = pair[0];
iValue += name.length;
return false;
}
});
if (index !== -1) {
return index + 1;
} else {
throw "Unknown name at position " + iValue;
}
},
// Confirm that a literal character matches the string value
checkLiteral = function () {
if (value.charAt(iValue) !== format.charAt(iFormat)) {
throw "Unexpected literal at position " + iValue;
}
iValue++;
};
for (iFormat = 0; iFormat < format.length; iFormat++) {
if (literal) {
if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
literal = false;
} else {
checkLiteral();
}
} else {
switch (format.charAt(iFormat)) {
case "d":
day = getNumber("d");
break;
case "D":
getName("D", this.dayNamesShort, this.dayNames);
break;
case "o":
doy = getNumber("o");
break;
case "m":
month = getNumber("m");
break;
case "M":
month = getName("M", this.monthNamesShort, this.monthNames);
break;
case "y":
year = getNumber("y");
break;
case "@":
date = new Date(getNumber("@"));
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
break;
case "!":
date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
year = date.getFullYear();
month = date.getMonth() + 1;
day = date.getDate();
break;
case "'":
if (lookAhead("'")) {
checkLiteral();
} else {
literal = true;
}
break;
default:
checkLiteral();
}
}
}
if (iValue < value.length) {
extra = value.substr(iValue);
if (!/^\s+/.test(extra)) {
throw "Extra/unparsed characters found in date: " + extra;
}
}
if (year === -1) {
year = new Date().getFullYear();
} else if (year < 100) {
year += new Date().getFullYear() - new Date().getFullYear() % 100 +
(year <= shortYearCutoff ? 0 : -100);
}
if (doy > -1) {
month = 1;
day = doy;
do {
dim = this.getDaysInMonth(year, month - 1);
if (day <= dim) {
break;
}
month++;
day -= dim;
} while (true);
}
date = this.daylightSavingAdjust(new Date(year, month - 1, day));
if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
throw "Invalid date"; // E.g. 31/02/00
}
// date.setMinutes(date.getTimezoneOffset()*-1);
return date;
},
/* Find the number of days in a given month. */
getDaysInMonth: function (year, month) {
return 32 - this.daylightSavingAdjust(new Date(year, month, 32)).getDate();
},
/* Handle switch to/from daylight saving.
* Hours may be non-zero on daylight saving cut-over:
* > 12 when midnight changeover, but then cannot generate
* midnight datetime, so jump to 1AM, otherwise reset.
* @param date (Date) the date to check
* @return (Date) the corrected date
*/
daylightSavingAdjust: function (date) {
if (!date) {
return null;
}
date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
return date;
},
/* A date may be specified as an exact value or a relative one. */
determineDate: function (date, defaultDate) {
var me = this;
var offsetNumeric = function (offset) {
var date = new Date();
date.setDate(date.getDate() + offset);
return date;
},
offsetString = function (offset) {
try {
return az.date.parseDate(me.dateFormat, offset);
}
catch (e) {
// Ignore
}
var date = (offset.toLowerCase().match(/^c/) ?
me._getDate() : null) || new Date(),
year = date.getFullYear(),
month = date.getMonth(),
day = date.getDate(),
pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
matches = pattern.exec(offset);
while (matches) {
switch (matches[2] || "d") {
case "d": case "D":
day += parseInt(matches[1], 10); break;
case "w": case "W":
day += parseInt(matches[1], 10) * 7; break;
case "m": case "M":
month += parseInt(matches[1], 10);
day = Math.min(day, az.date.getDaysInMonth(year, month));
break;
case "y": case "Y":
year += parseInt(matches[1], 10);
day = Math.min(day,az.date.getDaysInMonth(year, month));
break;
}
matches = pattern.exec(offset);
}
return new Date(year, month, day);
},
newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
(typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
if (newDate) {
newDate.setHours(0);
newDate.setMinutes(0);
newDate.setSeconds(0);
newDate.setMilliseconds(0);
}
return az.date.daylightSavingAdjust(newDate);
}
});
})();
/*Scripts/libs/Astral/Core/template.js*/
(function () {
function skipSpaces(str, fromIndex) {
while (str.charAt(fromIndex) == ' ' && fromIndex < str.length) fromIndex++;
return fromIndex;
}
function isChar(str, index) {
var charCode = str.charCodeAt(index);
return (charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123);
}
function readWord(str, fromIndex) {
var word = '';
fromIndex = skipSpaces(str, fromIndex);
while (str.charAt(fromIndex) != ' ' && isChar(str, fromIndex) && fromIndex < str.length) {
word += str.charAt(fromIndex);
fromIndex++;
}
return word;
}
function readBlock(str, index, blockStart, blockEnd) {
var blockStr = '';
var i = index + 2;
var blockDepth = 0;
while (i < str.length) {
if (str.charAt(i) == blockEnd && blockDepth == 0) break;
if (str.charAt(i) == blockStart) blockDepth++;
if (str.charAt(i) == blockEnd) blockDepth--;
blockStr += str.charAt(i);
i++;
}
return {
txt: blockStr,
next: i + 1
};
}
function readUpto(str, index, uptoChar) {
var tmp = '';
while (str.charAt(index) != uptoChar && index < str.length)
if (str.charAt(index) != '') tmp += str.charAt(index++);
return {
txt: tmp,
next: index + 1
};
}
function readStatement(str, index) {
var stmt = readWord(str, index + 1), data;
if (stmt == '') {
var d = readBlock(str, index, '{', '}');
return {
name: 'block',
type: 'block',
data: d,
end: ''
};
}
if (stmt == 'case' || stmt == 'default') {
data = readUpto(str, index + 1, '{');
return {
name: 'case',
data: data,
end: ''
};
}
if (stmt != 'for') {
var i = index + 1;
while (!(str.charAt(i) == ';' || str.charAt(i) == '{') && i < str.length) i++;
if (str.charAt(i) == ';') {
data = readUpto(str, index + 1, ';');
data.txt += ';';
return {
name: stmt,
type: 'block',
data: data,
end: ''
};
}
}
data = readUpto(str, index + 1, '{');
data.txt += '{';
return {
name: stmt,
data: data,
end: '}'
};
}
function compile(tmplStr) {
var i = 0, len = tmplStr.length, tmp = '', fnBody = '', stack = [], stmt;
while (i < len) {
if (tmplStr.indexOf('%{', i) == i) {
tmp += '{';
i += 2;
continue;
}
if (tmplStr.indexOf('}%', i) == i) {
tmp += '}';
i += 2;
continue;
}
if (tmplStr.charAt(i) == '@') {
if ($.trim(tmp)) //tmp.trim() todo: not sure. chamge made by mehedi
fnBody += '\np.push(\'' + tmp + '\');\n';
stmt = readStatement(tmplStr, i);
fnBody += stmt.data.txt;
i = stmt.data.next;
tmp = '';
if (stmt.type != 'block')
stack.push(stmt);
if (tmplStr.charAt(i) == '@') continue;
}
if (tmplStr.charAt(i) == '}' && stack.length > 0) {
stmt = stack.pop();
if ($.trim(tmp))
fnBody += '\np.push(\'' + tmp + '\');\n';
fnBody += stmt.end + '\n';
tmp = '';
i++;
continue;
}
if (tmplStr.charAt(i) == '{') {
var d = readUpto(tmplStr, i + 1, '}');
if (d) {
if (d.txt.indexOf('[') != -1) {
tmp += '\'+( (ctx.' + d.txt + ' ? ctx.' + d.txt + ' : az.$emptyStr) )+\'';
}
else
tmp += '\'+( (ctx.' + d.txt + ' ? ctx.' + d.txt + ' : (global.' + d.txt + '? global.' + d.txt + ' : az.$emptyStr )) )+\'';
i = d.next;
continue;
}
}
if (tmplStr.charAt(i) == '\'') tmp += "\\";
tmp += tmplStr.charAt(i);
i++;
};
if ($.trim(tmp))
fnBody += '\np.push(\'' + tmp + '\');\n';
var finalFn = " var ctx=ctx||{}; if(override)az.absorb(ctx,override); var p=[];" + (fnBody.indexOf('$emit') != -1 ? "function $emit(str){p.push(str);};" : '') + fnBody + " \nreturn p.join('');";
return new Function("global", "ctx", "override", finalFn);
};
function compileMeta(metaTplStr, tpls) {
var templates = az.transform(metaTplStr.match(/@[\w]+/gi), function (item) { return item.replace("@", ''); });
for (var tpl in tpls)
if (templates.indexOf(tpl) == -1) throw tpl + " template not found";
metaTplStr = metaTplStr.replace(/@(\w+)\(/gi, 'tpls.$1(owner,tplData.$1 ,');
metaTplStr = metaTplStr.replace(/@(\w+)/gi, ' tpls.$1(owner,tplData.$1) ');
return { fn: new Function("tpls", "tplData", "owner", 'return ' + metaTplStr + ';'), tplNames: templates };
};
var tplCache = {};
az.copy(az, {
cacheTpl:true,
createTpl: function (tplStr, id) {
if (!az.cacheTpl) return compile(tplStr);
if (id && tplCache.hasOwnProperty(id)) return tplCache[id];
var tplFn = compile(tplStr);
if (id) tplCache[id] = tplFn;
return tplFn;
},
createMetaTpl: function (metaStr, tpls) {
return compileMeta(metaStr, tpls);
},
defaultMetaTpl: function (tpls) {
var templates = [];
var fnBody = [];
for (var i in tpls) {
templates.push(i);
fnBody.push('tpls.' + i + '(owner,tplData.' + i + ')');
}
return { fn: new Function("tpls", "tplData", "owner", 'return ' + fnBody.join('+') + ';'), tplNames: templates };
}
});
})();
/*Scripts/libs/Astral/Core/dom.js*/
(function () {
az.__addToInitQueue(function () {
var db = document.body, div = document.createElement('div');
div.style.width = div.style.height = '100px';
div.style.overflow = 'scroll';
div.style.position = 'absolute';
db.appendChild(div); // now we can measure the div...
// at least in iE9 the div is not 100px - the scrollbar size is removed!
az.dom.SCROLLBAR = {
HEIGHT: (div.offsetWidth - div.clientWidth), //+2
WIDTH: div.offsetHeight - div.clientHeight
};
db.removeChild(div);
});
az.dom = {};
az.copy(az.dom, {
SCROLLBAR: {
HEIGHT:20,
WIDTH:20
}
});
})();
/*Scripts/libs/Astral/Core/formatters.js*/
(function () {
az.defineSingleton('formatter', {
_readBetween: function (str, start, end) {
var blockStr = '';
var i = str.indexOf(start) + 1;
var depth = 0;
while (i < str.length) {
if (str.charAt(i) == end && depth == 0) break;
if (str.charAt(i) == start) depth++;
if (str.charAt(i) == end) end--;
blockStr += str.charAt(i);
i++;
}
return blockStr;
},
_format: {
number: function (value, formatKey) {
var tempValue = parseFloat(value);
if (isNaN(tempValue)) return '';
var tempKey = formatKey.split('.');
if (tempKey.length == 1) {
return tempValue.toFixed(0);
}
else {
return tempValue.toFixed(tempKey[1].length);
}
},
date: function (value, formatKey) {
return az.date.formatDate(formatKey, value);
},
bool: function (value, formatKey) {
formatKey = formatKey || 'No|Yes';
return formatKey.split('|')[Number(value)];
}
},
format: function (pattern, value) {
var type = this._readBetween(pattern, '@', '[').toLowerCase();
var formatKey = this._readBetween(pattern, '[', ']');
if (this._format[type])
return this._format[type](value, formatKey);
else return value;
}
});
})();
/*Scripts/libs/Astral/Util/observable.js*/
az.defineMixin('observable', {
init: function () {
this.channels = {};
if (this.listeners)
this.monitor(this.listeners);
},
monitor: function (eventCfg) {
for (var eventName in eventCfg) {
if (az.chk.ifFunction(eventCfg[eventName]))
this.on(eventName, eventCfg[eventName]);
else
this.on(eventName, eventCfg[eventName].fn, eventCfg[eventName].scope);
}
},
on: function (event, fn, scope) {
if (!this.channels.hasOwnProperty(event)) this.channels[event] = [];
this.channels[event].push({ fn: fn, scope: scope });
},
addListener: function () {
this.on.apply(this, arguments);
},
removeListener: function () {
this.off.apply(this, arguments);
},
off: function (event, fn, scope) {
if (arguments.length == 0) {
this.channels = {};
return;
}
if (!this.channels.hasOwnProperty(event)) return;
var i = this.channels[event].length;
while (i--) {
if (this.channels[event][i].fn == fn && this.channels[event][i].scope == scope) {
return this.channels[event].splice(i, 1);
}
}
},
fire: function () {
if (!this.channels.hasOwnProperty(arguments[0])) return;
var args = [];
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
var handlers = this.channels[arguments[0]];
if (this.delayHandlers)
setTimeout(function () {
for (var i = 0; i < handlers.length; i++) {
handlers[i].fn.apply(handlers[i].scope || null, args);
}
}, 10);
else {
for (var i = 0; i < handlers.length; i++) {
handlers[i].fn.apply(handlers[i].scope || null, args);
}
}
},
fireExcluding:function (event,args,excludeList) {
if (!this.channels.hasOwnProperty(event)) return;
var handlers = this.channels[event];
if (this.delayHandlers)
setTimeout(function () {
for (var i = 0; i < handlers.length; i++) {
if (excludeList.indexOf(handlers[i].scope) == -1)
handlers[i].fn.apply(handlers[i].scope || null, args);
}
}, 10);
else {
for (var i = 0; i < handlers.length; i++) {
if (excludeList.indexOf(handlers[i].scope) == -1)
handlers[i].fn.apply(handlers[i].scope || null, args);
}
}
}
});
/*Scripts/libs/Astral/Data/DataReader.js*/
az.defineClass('DataReader', {
source: [],
readAs: 'objectArray', //array
map: {},
init: function (config, source, store) {
az.copy(this, config);
this.store = store;
if (az.chk.ifString(config) && az.Schema.exists(config)) {
az.copy(this, az.Schema.get(config.schema));
}
else {
if (az.chk.ifString(this.schema)) {
this.schema = az.Schema.get(this.schema);
}
}
this.source = source;
},
_prepare: function (callback) {
var me = this;
if (az.chk.ifArray(this.source)) {
this.rawData = this.source;
callback.call(me);
}
if (az.chk.ifObject(this.source) && this.source.fn) {
this.source.fn.call(this.source.scope || null, this.store, function (result) {
me.rawData = result;
callback.call(me);
});
}
if (az.chk.ifFunction(this.source)) this.source(this.store, function (result) {
me.rawData = result;
callback.call(me);
});
},
readItem: function (rawData) {
var fields = this.schema;
if (this.mode == 'objectArray') {
var data = {};
for (var i = 0; i < fields.length; i++) {
if (az.chk.ifObject(fields[i])) {
if (this.map.hasOwnProperty(fields[i].name)) {
data[fields[i].name] = rawData[this.map[fields[i].name]];
}
else {
data[fields[i].name] = rawData[fields[i].name];
}
}
if (az.chk.ifString(fields[i])) {
data[fields[i]] = rawData[fields[i]];
}
}
data.originalSource = rawData;
return new az.DataRecord({ data: data, type: this.schema.name });
}
if (this.mode == 'array') {
var data = {};
for (var i = 0; i < fields.length; i++) {
if (fields[i].name)
data[fields[i].name] = rawData[i];
else
data[fields[i]] = rawData[i];
}
data.originalSource = rawData;
return new az.DataRecord({ data: data, type: this.schema.name });
}
},
read: function (pageIndex, pageSize, afterRead) {
this._prepare(function () {
var records = [];
if (az.chk.ifArray(this.rawData)) {
var start = (pageIndex * pageSize) || 0;
var end = (this.rawData.length > (start + pageSize) ? start + pageSize : this.rawData.length)
for (var i = start; i < end; i++) {
records.push(this.readItem(this.rawData[i]));
}
afterRead({ totalCount: this.rawData.length, records: records, pageCount: this.rawData.length / pageSize, pageIndex: pageIndex })
}
if (az.chk.ifObject(this.rawData)) {
for (var i = 0; i < this.rawData.Data.length; i++) {
records.push(this.readItem(this.rawData.Data[i]));
}
afterRead({ totalCount: this.rawData.TotalCount, records: records, pageCount: this.rawData.TotalPages, pageIndex: this.rawData.PageIndex });
}
if(!az.chk.ifDefined(this.rawData)) {
afterRead({ totalCount: 0, records: [], pageCount: 0, pageIndex: -1});
}
});
}
});
/*Scripts/libs/Astral/Data/DataRecord.js*/
az.defineClass('DataRecord', {
$static: {
recordId: 0
},
$autoInitMixin: true,
$includes: 'observable',
tmp: {},
data: {},
isDirty: false,
type: 'none',
init: function (config) {
az.copy(this, config);
this.rid = az.DataRecord.recordId++;
},
forEach: function (fn) {
var data = (this.isDirty ? this.tmp : this.data);
for (var i in data) {
fn(data[i], i);
}
},
update: function (data) {
az.copy(this.tmp, data);
this.isDirty = true;
this.fire('update', this, data, this.data);
},
set: function (field, value) {
if (az.chk.ifObject(field)) {
az.copy(this.tmp, field);
}
if (az.chk.ifString(field)) {
this.tmp[field] = value;
}
this.isDirty = true;
this.fire('change', this, field, value, this.tmp, this.data);
},
get: function (field) {
if (az.chk.ifString(field)) {
if (this.isDirty && this.tmp.hasOwnProperty(field)) return this.tmp[field];
return this.data[field];
}
},
commit: function () {
az.copy(this.data, this.tmp);
this.isDirty = false;
this.fire('commit', this);
},
rollback: function () {
az.copy(this.tmp, this.data);
this.isDirty = false;
this.fire('rollback', this);
},
destroy: function () {
this.fire('destroy', this);
for (var prop in this) {
if (prop != 'destroy') continue;
this[prop] = null;
delete this[prop];
}
}
});
/*Scripts/libs/Astral/Data/Schema.js*/
az.defineSingleton('Schema', {
regrstry: {},
destroy: function (name) {
delete this.registry[name];
},
define: function (name, config) {
if (this.registry.hasOwnProperty(name)) throw "A schema called " + name + " already exists";
for (var i = 0; i < config.fields.length; i++) {
if (az.chk.ifString(config.fields[i])) {
config.fields[i] = { name: config.fields[i], type: 'auto' };
}
if (!config.fields[i].type) config.fields[i].type = 'auto';
}
config.name = name;
this.registry[name] = config;
},
exists: function (name) {
return this.registry.hasOwnProperty(name);
},
get: function (name) {
return this.registry[name];
}
});
/*Scripts/libs/Astral/Data/Store.js*/
az.defineClass('DataStore', {
$includes: 'observable',
records: null,
totalCount: 0,
pageCount: 0,
pageIndex: 0,
pageSize: Number.MAX_VALUE,
autoLoad: true,
mode: 'objectArray',
sorter: null,
init: function (config) {
az.copy(this, config);
if (this.fields) {
this.reader = new az.DataReader({ schema: this.fields, mode: this.mode }, this.source, this);
}
},
sort: function (field, sortDir, comparator) {
if (this.sorter != null) {
this.sorter(field, sortDir, this)
return;
}
this.records.sort(function (record1, record2) {
var val1 = record1.get(field + '');
var val2 = record2.get(field + '');
if (sortDir == 'asc') {
if (comparator) return comparator(val1, val2);
if (val1 == val2) return 0;
if (val1 > val2) return 1;
if (val1 < val2) return -1;
}
else {
if (comparator) return comparator(val2, val1);
if (val2 == val1) return 0;
if (val2 > val1) return 1;
if (val2 < val1) return -1;
}
})
},
setPageSize: function (pageSize) {
this.pageSize = pageSize || Number.MAX_VALUE;
this.pageIndex = 0;
},
onRecordChange: function (record) {
this.fire('update', record);
},
count: function () {
return this.totalCount;
},
forEach: function (fn) {
az.each(this.records, fn);
},
getAt: function (index) {
return this.records[index];
},
find: function (fn) {
return az.find(this.records, fn);
},
findAll: function (fn) {
return az.select(this.records, fn);
},
indexOf: function (fn, all) {
return az.indexOf(this.records, fn, all);
},
_insertAt: function (record, index) {
if (index != undefined && index < this.records.length) {
this.records.splice(index, 0, record);
}
else {
this.records.push(record);
}
},
_setUpRecordListeners: function () {
for (var i = 0; i < this.records.length; i++) {
this.records[i].on('commit', this.onRecordChange, this);
}
},
add: function (record, index) {
if (record instanceof az.DataRecord) {
record.on('commit', this.onRecordChange, this);
this._insertAt(record, index);
}
else {
var r = this.reader.readItem(record);
r.on('commit', this.onRecordChange, this);
this._insertAt(r, index);
}
this.totalCount++;
this.fire('add', record);
return record;
},
remove: function (recordOrIndex) {
if (az.chk.ifNumber(recordOrIndex)) {
var record = this.records.splice(recordOrIndex, 1);
this.totalCount--;
this.fire('remove', record);
}
if (recordOrIndex instanceof az.DataRecord) {
for (var i = 0; i < this.records.length; i++) {
if (this.records[i].rid == recordOrIndex.rid) {
this.records.splice(i, 1);
this.totalCount--;
this.fire('remove', recordOrIndex);
recordOrIndex.destroy();
}
}
}
},
clear: function () {
for (var i = 0; i < this.records.length; i++) this.records[i].destroy();
this.records = [];
this.fire('clear');
},
load: function (pageIndex, callback) {
var me = this;
me.fire('beforeload');
if (az.chk.ifNumber(pageIndex)) {
this.pageIndex = pageIndex;
if (this.pageIndex >= this.pageCount) this.pageIndex = this.pageCount - 1;
if (this.pageIndex < 0) this.pageIndex = 0;
}
if (this.records && this.records.length > 0) this.clear();
if (this.reader)
this.reader.read(this.pageIndex, this.pageSize, function (result) {
me.totalCount = result.totalCount;
me.pageCount = result.pageCount;
me.records = result.records;
me._setUpRecordListeners();
me.fire('load');
});
if (callback) callback.call(me);
},
loadData: function (data) {
this.reader.source = data;
this.load(0);
}
});
/*Scripts/libs/Astral/Core/util.js*/
(function () {
var htmlEscapeMap = {
"&": "&",
"<": "<",
">": ">",
'"': '"',
"'": ''',
"/": '/'
};
var idRegex = /id\s*=\s*["'](\S+)["']/gi;
az.util = {};
az.copy(az.util, {
margeStyleStr: function (origianl, current) {
if (!origianl) return current;
var oritialItems = origianl.split(';');
var currentItems = current.split(';');
for (var i = 0; i < oritialItems.length; i++) {
if (!oritialItems[i] || oritialItems[i].length == 0) {
oritialItems.splice(i, 1);
i--;
continue;
}
for (var j = 0; j < currentItems.length; j++) {
if (!currentItems[j] || currentItems[j].length == 0) {
currentItems.splice(j, 1);
j--;
continue;
}
if (oritialItems[i].split(':')[0].indexOf(currentItems[j].split(':')[0]) == 0 || currentItems[j].split(':')[0].indexOf(oritialItems[i].split(':')[0]) == 0) {
oritialItems.splice(i, 1);
i--;
break;
}
}
}
return oritialItems.join(';') + ';' + currentItems.join(';')
},
extractIdByPattern: function (str, pattern) {
var patternRe = new RegExp(pattern);
var result;
var ids = [];
while ((result = idRegex.exec(str)) !== null) {
if (patternRe.test(result[1]))
ids.push(result[1]);
}
return ids;
},
extractIdProp: function (str, noPrefix) {
var result;
var ids = [];
while ((result = idRegex.exec(str)) !== null) {
ids.push((noPrefix ? result[1] : '#' + result[1]));
}
return ids.join(',');
},
escapeId: function (id) {
return id.replace(/(:|\.|\[|\])/g, "\\$1");
},
strToObj: function (str, propDelimeter, keyValueDelimeter) {
var obj = {};
var items = str.split(propDelimeter);
for (var i = 0, j = items.length; i < j; i++) {
var kv = items[i].split(keyValueDelimeter);
obj[kv[0]] = kv[1];
}
return obj;
},
objToStr: function (obj, propDelimeter, keyValueDelimeter) {
var str = [];
for (var i in obj) {
str.push(i + keyValueDelimeter + obj[i]);
}
return str.join(propDelimeter);
},
escapeHtml: function (string) {
return String(string).replace(/[&<>"'\/]/g, function (s) {
return htmlEscapeMap[s];
});
},
stripScriptTagsFromStr: function (s) {
var div = document.createElement('div');
div.innerHTML = s;
var scripts = div.getElementsByTagName('script');
var i = scripts.length;
while (i--) {
scripts[i].parentNode.removeChild(scripts[i]);
}
return div.innerHTML;
},
evalJson : function (s) {
var json = "o = " + (s || 'null') + ";";
json = json.replace(/"\\?\/Date\((-?[\d]+).*?\)\\?\/"/gi, "new Date($1)");
var o = eval(json);
// console.log(json)
// console.log(s)
return o;
},
clone: function (obj) {
// Handle the 3 simple types, and null or undefined
if (null == obj || "object" != typeof obj) return obj;
// Handle Date
var copy;
if (obj instanceof Date) {
copy = new Date();
copy.setTime(obj.getTime());
return copy;
}
// Handle Array
if (obj instanceof Array) {
copy = [];
for (var i = 0, len = obj.length; i < len; i++) {
copy[i] = az.util.clone(obj[i]);
}
return copy;
}
// Handle Object
if (obj instanceof Object) {
copy = {};
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) copy[attr] = az.util.clone(obj[attr]);
}
return copy;
}
throw new Error("Unable to copy obj! Its type isn't supported.");
},
validURL: function (str) {
var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|' + // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
return pattern.test(str);
},
loadImg: function (src, successCallback,errorCallback) {
$("
")
.on('load', successCallback)
.on('error',errorCallback)
.attr("src", src);
},
resolveDownloadSrc: function (path, splitDelm, entityType, queryParams, dontUseAppPath, isPrivate) {
path = (path || '').toLowerCase();
if (!path) {
return '';
} else if ((path.indexOf('store/download') > -1) || ((/^http(s?):\/\//.test(path)) && path.indexOf(splitDelm) == -1)) {
return path;
}
queryParams = queryParams || {}; /* { p: 1, p1: 2, p2: 0 } */
splitDelm = splitDelm || 'repository/';
entityType = entityType || 'repo';
isPrivate = isPrivate ? '' : 'public';
var downLoadPath = !dontUseAppPath ? px.appPath + '' : '';
if (path.indexOf('temp/') > -1) {
downLoadPath += 'store/downloadTemp?path=' + path.split('temp/')[1];
} else {
var dirParts = (path.split(splitDelm)[1] || '').split('/');
var fileName = dirParts[dirParts.length - 1];
var nums = dirParts.filter(function (item) { return !Number.isNaN(Number(item)) });
downLoadPath += 'store/download' + isPrivate + '?f=' + fileName + '&t=' + entityType;
for (param in queryParams) {
downLoadPath += '&' + param + '=' + nums[queryParams[param]];
}
///downLoadPath = az.format('store/downloadpublic?f={file}&t={type}&p={entityId}&p1={fieldSetId}&p2={repositoryId}', { file: dirParts[dirParts.length - 1], type: entityType, entityId: nums[1], fieldSetId: nums[2], repositoryId: nums[0] });
}
return downLoadPath;
},
escapeScriptTag: function (string) {
if (!az.chk.ifString(string)) return string;
var reScript = /